static public Format formatterForFormat(String calFormat) { synchronized(_calFormatDict) { if(calFormat == null) calFormat = _defaultCalendarFormatString; NSTimestampFormatter v = (NSTimestampFormatter)_calFormatDict.objectForKey(calFormat); if(v == null) { v = new NSTimestampFormatter(calFormat); setFormatterForFormat(v, calFormat); } return v; } } static public void setFormatterForFormat(Format formatter, String calFormat) {
private static void backupSiteConfig() { try { File sc = fileForSiteConfig(); if ( sc.exists() ) { NSTimestampFormatter formatter = new NSTimestampFormatter("%Y%m%d%H%M%S%F"); File renamedFile = new File(pathForSiteConfig() + "." + formatter.format(new NSTimestamp())); sc.renameTo(renamedFile); } } catch (NSForwardException ne) { log.error("Cannot backup file {}. Possible Permissions Problem.", pathForSiteConfig()); } }
/** * Standard constructor for WOComponent subclasses. * * @param context context of a transaction * @see WOComponent#pageWithName(String) * @see WOApplication#pageWithName(String, WOContext) */ public ERPublishCalendarPage(WOContext context) { super(context); events = new NSMutableArray(); calendarTimeZone = new NSTimestampFormatter ("%Z").format (new NSTimestamp()); dateTimeFormatter = new NSTimestampFormatter ("%Y%m%dT%H%M%S"); dateTimeFormatter.setDefaultFormatTimeZone (NSTimeZone.localTimeZone()); dateFormatter = new NSTimestampFormatter ("%Y%m%d"); dateFormatter.setDefaultFormatTimeZone (NSTimeZone.localTimeZone()); utcDateTimeFormatter = new NSTimestampFormatter ("%Y%m%dT%H%M%SZ"); utcDateTimeFormatter.setDefaultFormatTimeZone (NSTimeZone.timeZoneWithName ("UTC", false)); timeZoneFormatter = new NSTimestampFormatter ("%Z"); timeZoneFormatter.setDefaultFormatTimeZone (NSTimeZone.localTimeZone()); }
public String textFieldValue() { if (_textFieldValue != null) { return _textFieldValue; } Object value = value(); setValue(value); if (value == null) { return null; } else if (value instanceof String) { return (String) value; } else { java.text.Format formatter = null; String className = valueClassNameForKey(selectedKey()); if (className.equals("com.webobjects.foundation.NSTimestamp")) { String dateFormatterString = formatterForKey(selectedKey()); formatter = new NSTimestampFormatter(dateFormatterString); } else if (className.equals("java.lang.Number") || className.equals("java.math.BigDecimal")) { String numberFormatterString = formatterForKey(selectedKey()); formatter = new NSNumberFormatter(numberFormatterString); } return (formatter != null) ? formatter.format(value) : value.toString(); } }
formatter = new NSTimestampFormatter(format); formatter = new NSTimestampFormatter(format);
/** * This class corresponds to one property. indexModel --> properties --> a property * * @param index the index * @param name the property name (a key or keypath) * @param dict the property definition form indexModel */ IndexAttribute(ERIndex index, String name, NSDictionary dict) { _name = name; _termVector = (TermVector) classValue(dict, "termVector", TermVector.class, "YES"); _store = (Store) classValue(dict, "store", Store.class, "NO"); _index = (Index) classValue(dict, "index", Index.class, "ANALYZED"); String analyzerClass = (String) dict.objectForKey("analyzer"); if (analyzerClass == null) { analyzerClass = StandardAnalyzer.class.getName(); } _analyzer = (Analyzer) create(analyzerClass); if (_analyzer == null && name.matches("\\w+_(\\w+)")) { // String locale = name.substring(name.lastIndexOf('_') + 1); } _format = (Format) create((String) dict.objectForKey("format")); String numberFormat = (String) dict.objectForKey("numberformat"); if (numberFormat != null) { _format = new NSNumberFormatter(numberFormat); } String dateformat = (String) dict.objectForKey("dateformat"); if (dateformat != null) { _format = new NSTimestampFormatter(dateformat); } }
if (className.equals("com.webobjects.foundation.NSTimestamp")) { String dateFormatterString = formatterForKey(selectedKey()); NSTimestampFormatter dateFormatter = new NSTimestampFormatter(dateFormatterString); Object objectValue = null; try {