1 19 20 package org.netbeans.modules.tasklist.usertasks.translators; 21 22 import java.util.ArrayList ; 23 import java.util.List ; 24 import net.fortuna.ical4j.data.CalendarBuilder; 25 import org.netbeans.modules.tasklist.usertasks.util.UTUtils; 26 27 33 public class MyCalendarBuilder extends CalendarBuilder { 34 private List cmps = new ArrayList (); 35 private String property; 36 37 40 public MyCalendarBuilder() { 41 } 42 43 public void parameter(String name, String value) throws java.net.URISyntaxException { 44 String c = (String ) cmps.get(cmps.size() - 1); 45 if (c.equals("VTODO") && "X-NETBEANS-WORK-PERIOD".equals(property) && name.equals("START")) name = "X-NETBEANS-START"; if (c.equals("VTODO") && "X-NETBEANS-DEPENDENCY".equals(property) && name.equals("TYPE")) name = "X-NETBEANS-TYPE"; super.parameter(name, value); 52 } 53 54 @SuppressWarnings ("unchecked") 55 public void startComponent(String name) { 56 if (name.equals("X")) 57 name = "X-UNKNOWN"; 58 59 cmps.add(name); 60 61 super.startComponent(name); 62 } 63 64 public void endComponent(String name) { 65 super.endComponent(name); 66 cmps.remove(cmps.size() - 1); 67 } 68 69 public void startProperty(String name) { 70 if (name.indexOf(' ') >= 0) { 71 name = "X-" + name.replace(' ', '-'); 72 } 73 property = name; 74 super.startProperty(name); 75 } 76 77 public void endProperty(String name) { 78 super.endProperty(name); 79 property = null; 80 } 81 } 82 | Popular Tags |