Methods Summary |
---|
PIMFormat | getEncodingFormat()Gets the encoding format handler.
return new VCalendar10Format();
|
public javax.microedition.pim.RepeatRule | getRepeat()Gets the repeat rule, if any.
if (repeatRule == null) {
return null;
}
// clone the repeat rule
int[] fields = repeatRule.getFields();
RepeatRule newRule = new RepeatRule();
for (int i = 0; i < fields.length; i++) {
int field = fields[i];
switch (field) {
case RepeatRule.COUNT:
case RepeatRule.DAY_IN_MONTH:
case RepeatRule.DAY_IN_WEEK:
case RepeatRule.DAY_IN_YEAR:
case RepeatRule.FREQUENCY:
case RepeatRule.INTERVAL:
case RepeatRule.MONTH_IN_YEAR:
case RepeatRule.WEEK_IN_MONTH:
newRule.setInt(field, repeatRule.getInt(field));
break;
case RepeatRule.END:
newRule.setDate(field, repeatRule.getDate(field));
break;
}
}
Enumeration dates = repeatRule.getExceptDates();
while (dates.hasMoreElements()) {
Date date = (Date) dates.nextElement();
newRule.addExceptDate(date.getTime());
}
return newRule;
|
protected int | getRevisionField()Gets the revision field identifier.
return REVISION;
|
protected int | getUIDField()Gets the UID field identifier.
return UID;
|
static boolean | isValidPIMField(int field)Ensures the PIM field identifier is supported.
switch (field) {
case Event.ALARM:
case Event.CLASS:
case Event.END:
case Event.LOCATION:
case Event.NOTE:
case Event.REVISION:
case Event.START:
case Event.SUMMARY:
case Event.UID:
return true;
default:
return false;
}
|
protected void | setDefaultValues()Sets default values for this item.
super.setDefaultValues();
if (repeatRule != null) {
try {
repeatRule.getInt(RepeatRule.FREQUENCY);
} catch (FieldEmptyException e) {
repeatRule.setInt(RepeatRule.FREQUENCY, RepeatRule.DAILY);
}
try {
repeatRule.getInt(RepeatRule.INTERVAL);
} catch (FieldEmptyException e) {
repeatRule.setInt(RepeatRule.INTERVAL, 1);
}
}
|
public void | setRepeat(javax.microedition.pim.RepeatRule value)Updates the repeat rule.
this.repeatRule = value;
setModified(true);
|
protected java.lang.String | toDisplayableString()Converts the Event record to a printable format.
StringBuffer sb = new StringBuffer("Event[");
String data = formatData();
sb.append(data);
RepeatRule rule = getRepeat();
if (rule != null) {
if (data.length() > 0) {
sb.append(", ");
}
sb.append("Rule=[");
int[] fields = rule.getFields();
for (int i = 0; i < fields.length; i++) {
if (i != 0) {
sb.append(",");
}
int field = fields[i];
switch (field) {
case RepeatRule.FREQUENCY:
sb.append("Frequency=");
switch (rule.getInt(field)) {
case RepeatRule.DAILY:
sb.append("Daily");
break;
case RepeatRule.WEEKLY:
sb.append("Weekly");
break;
case RepeatRule.MONTHLY:
sb.append("Monthly");
break;
case RepeatRule.YEARLY:
sb.append("Yearly");
break;
default:
sb.append("<Unknown: " +
rule.getInt(field) + ">");
}
break;
case RepeatRule.END:
sb.append("End=" +
PIMHandler.getInstance()
.composeDateTime(rule.getDate(field)));
break;
case RepeatRule.COUNT:
sb.append("Count=" + rule.getInt(field));
break;
case RepeatRule.INTERVAL:
sb.append("Interval=" + rule.getInt(field));
break;
case RepeatRule.DAY_IN_WEEK:
sb.append("DayInWeek=0x" + Integer
.toHexString(rule.getInt(field)));
break;
case RepeatRule.DAY_IN_MONTH:
sb.append("DayInMonth=" + rule.getInt(field));
break;
case RepeatRule.DAY_IN_YEAR:
sb.append("DayInYear=" + rule.getInt(field));
break;
case RepeatRule.WEEK_IN_MONTH:
sb.append("WeekInMonth=0x" + Integer
.toHexString(rule.getInt(field)));
break;
case RepeatRule.MONTH_IN_YEAR:
sb.append("MonthInYear=0x" + Integer
.toHexString(rule.getInt(field)));
break;
default:
sb.append("<Unknown: " + field + "="
+ rule.getInt(field));
}
}
sb.append("]");
}
sb.append("]");
return sb.toString();
|