Site icon k5n.us

Java Calendar Tools

About Java Calendar Tools

k5n Java Calendar Tools is a project to provide Java-based tools and components that will leverage industry standard calendar protocols (iCalendar in particular). There seems to be a lack of open source tools for using these protocols, and it slows adoption of the protocols. For example, the CAP protocol does not seem to be supported by and calendar applications.

Overview of Components

There are currently two main components that comprise the Java Calendar Tools:

License

All software is licensed under the GNU General Public License.

For more information about this license:

This license means that you are free to use this software in other open source applications. If you are interested in using this software in something that is proprietary (not open source), then please contact us with details of your request. In most cases, we will be happy to provide you with a suitable license.

Plans

Tutorial

The Event object holds a single ical event and corresponds to the VEVENT iCalendar object.

Typically, the ICalendarParser object is the container for the ical data. (You can override this by creating your own class that implements the DataStore interface. If not, the ICalendarParser class will handle all storage of iCalendar data.) It includes an API for querying events for specific categories and/or time ranges.

Parsing an iCalendar File

 import java.io.File;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.Vector;
 import us.k5n.calendar.ICalendarParser;
 import us.k5n.calendar.Event;
 import us.k5n.calendar.Todo;
 
 // ...
 
   ICalendarParser parser;
   File icalFile = new File ("/tmp/example.ics");
   try {
     BufferedReader r = new BufferedReader(new FileReader (icalFile));
     parser.parse (r);
   } catch (IOException e) {
     // ... report error
   }
   r.close ();
   Vector events = parser.getAllEvents ();
   for (Event e : events) {
     System.out.println ("Event: " + e.getSummary () ;
   }
   TodoList todo = parser.getAllTodo (); // get to-do entries
   for (Todo t : todo) {
     Todo t = (Todo) todo.elementAt ( i );
     System.out.println ("Todo: " + t.getSummary ());
   }
 // ... 

Screenshot

The CalendarPanel class is a Swing UI component that can be used to display the typical month-at-a-glance calendar view within a Swing application.

Download

There is now a 0.5.0 release available.

Download the latest version form:

Github

Developer Resources

Related Links

Exit mobile version