Examples of NSTimestampFormatter


Examples of com.webobjects.foundation.NSTimestampFormatter

        } 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();
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

    public void setTextFieldValue(String value) {
        String className = valueClassNameForKey(selectedKey());
        if (className.equals("com.webobjects.foundation.NSTimestamp")) {
            String dateFormatterString = formatterForKey(selectedKey());
            NSTimestampFormatter dateFormatter = new NSTimestampFormatter(dateFormatterString);
            Object objectValue = null;
            try {
                objectValue = dateFormatter.parseObject((value != null) ? value.toString() : "");
            } catch (ParseException e) {
                if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupWebObjects)) {
                    NSLog.debug.appendln(e);
                }
            }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

        formatString = (String)_WOJExtensionsUtil.valueForBindingOrNull("dateformat",this);

        if (formatString!=null) {
            if (!formatString.equals(oldFormatString)) {
                oldFormatString = formatString;
                _cachedTSFormatter = new NSTimestampFormatter(formatString);
            }
            return _cachedTSFormatter;
        }
        return null;
   }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

    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);
    }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

    return format(time, true);
  }
 
  public String format(NSTimestamp time, boolean useTimes) {
    if (time != null) {
      NSTimestampFormatter formatDateTime;
      if (useTimes) {
        formatDateTime = new NSTimestampFormatter("%m/%d/%Y %I:%M %p");
      }
      else {
        formatDateTime = new NSTimestampFormatter("%m/%d/%Y");
      }
      return formatDateTime.format(time);
    }
    return null;
  }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

    return null;
  }

  public String mdy(NSTimestamp time) {
    if(time != null) {
      NSTimestampFormatter formatDateTime = new NSTimestampFormatter("%m/%d/%Y");
      return formatDateTime.format(time);
    }
    return null;
  }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

    return "";
  }
 
  public String timeOnly(NSTimestamp time) {
    if (time != null) {
      NSTimestampFormatter formatDateTime = new NSTimestampFormatter("%I:%M%p");
      String results = formatDateTime.format(time);
      results = results.toLowerCase();
     
      if(results.charAt(0) == '0') {
        results = results.subSequence(1, results.length()).toString();
     
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

    }

    public NSTimestamp desiredTimestamp;

    public String desiredTimestampInDesiredTimeZone() {
      NSTimestampFormatter formatter = new NSTimestampFormatter();
      NSTimeZone tz = NSTimeZone.timeZoneWithName(timeZoneID, false);
      formatter.setDefaultFormatTimeZone(tz);
      StringBuffer buffer = formatter.format(_currentTimestamp, new StringBuffer(), new FieldPosition(0));
      return buffer.toString();
    }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

  public String currentNSTExplain() {
    return (String)nstFormats.valueForKey(currentNSTFormat);
  }

  public String currentFormattedNST() {
    NSTimestampFormatter formatter = new NSTimestampFormatter(currentNSTFormat);
    return formatter.format(currentTS());
  }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

     * @param attribute
     * @param stringValue
     */
    protected Object qualifierValueForAttribute(EOAttribute attribute, String stringValue) {
        //AK: I still don't like this...in particular the new NSTimestampFormatter() which would be totally arbitrary...
        return ERXStringUtilities.attributeValueFromString(attribute, stringValue, context().request().formValueEncoding(), new NSTimestampFormatter());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.