Git Product home page Git Product logo

timeglider-json's Introduction

TimeGlider JSON - Java Stubs for Serialization

This is a simple project to give me a chance to serialize from Java to Timeglider's JSON format. It does not deserialize the data, as I currently have no use for it.

I've provided 3 base classes(Event, Legend, Timeline) and one serializer (GsonFormatter) that you can build to populate your timeline, then just throw it at Google's Gson object to generate your JSON format. Gson is a pretty nifty library, and makes much of this work a breeze.

How to Use

According to the documentation, Timeglider will take an array of timelines in and use those for display. Each Timeline is composed of a Legend class, which will show you the equivalent of a key in a map, where each Legend class is a title of what the icon displays, and a link to the .png file for it.

Each Timeline is mostly composed of Event instance, which you can create borrowing from Josh Bloch's revised builder pattern:

    Event e = new Event.EventBuilder("unique event id", "Event Title", new
                                    Date())
                                      .title("title")       // all additional fields are optional
                                      .enddate(new Date())
                                      ....
                                      .build();             // But don't forget to do this

Rolling these into a timeline is pretty easy, too. To create a single timeline, create a new Timeline class:

    Timeline t = new Timeline.Builder("id_to_give", "Title of Timeline",
                                      List<Event> list_of_events)
                                      .focus_date(...)      // same as Event: all additional fields optional
                                      ...
                                      .build();             // make sure you do this, though

and finally, to create your TimeGlider JSON:

    GsonFormatter g = new GsonFormatter(new List<Timeline>(){ timelines });

    String timeglider_json = g.toJson();  // Ta Da!

Details about Timeglider can be found in the Information section.

Information

timeglider-json's People

Contributors

klauern avatar tatepoon avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.