public void awake() {
super.awake();
if ( ! (hasBinding("formatter") || hasBinding("format"))) {
format = "%m %d %Y"; // Default
formatter = new NSTimestampFormatter(format);
}
else if (hasBinding("formatter")) {
formatter = (Format) valueForBinding("formatter");
if (formatter instanceof NSTimestampFormatter) {
format = translateSimpleDateFormatSymbols(((NSTimestampFormatter)formatter).pattern());
}
else if (formatter instanceof SimpleDateFormat) {
format = ((SimpleDateFormat)formatter).toPattern();
}
else if (formatter instanceof ERXJodaFormat) {
format = ((ERXJodaFormat)formatter).pattern();
}
else {
throw new RuntimeException("Can't handle formatter of class " + formatter.getClass().getCanonicalName());
}
}
else {
format = (String) valueForBinding("format");
formatter = new NSTimestampFormatter(format);
}
format = translateSimpleDateFormatSymbols(format);
}