Examples of toPattern()


Examples of java.text.SimpleDateFormat.toPattern()

  public void setParameterFromObject(final Object o)
      throws ObjectFactoryException
  {
    super.setParameterFromObject(o);
    final SimpleDateFormat format = (SimpleDateFormat) o;
    setParameter("pattern", format.toPattern());
  }

  /**
   * Creates an object based on this description.
   *
 
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

  public static void main (String[] args)
          throws IOException, ClassNotFoundException
  {
    final SimpleDateFormat dfmt = new SimpleDateFormat("");
    System.out.println(dfmt.toPattern());

    final DecimalFormat dcfmt = new DecimalFormat(DECIMALFORMAT_DEFAULT_PATTERN);
    System.out.println(dcfmt.toPattern());

    testSerialization(dfmt);
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

      // this includes timestamp ..
      final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, context.getLocale());
      if (dateFormat instanceof SimpleDateFormat)
      {
        final SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
        return sdf.toPattern();
      }
      // we cannot come up with a sensible default ..
      return null;
    }
    else if (Time.class.isAssignableFrom(type))
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

      // this includes timestamp ..
      final DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.DEFAULT, context.getLocale());
      if (dateFormat instanceof SimpleDateFormat)
      {
        final SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
        return sdf.toPattern();
      }
      // we cannot come up with a sensible default ..
      return null;
    }
    else if (Date.class.isAssignableFrom(type))
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

      final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT,
          context.getLocale());
      if (dateFormat instanceof SimpleDateFormat)
      {
        final SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
        return sdf.toPattern();
      }
      // we cannot come up with a sensible default ..
      return null;
    }
    else if (Number.class.isAssignableFrom(type))
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

  public String getFormatString()
  {
    if (getFormat() instanceof SimpleDateFormat)
    {
      final SimpleDateFormat decFormat = (SimpleDateFormat) getFormat();
      return decFormat.toPattern();
    }
    return null;
  }

  /**
 
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

        element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
      }
      if (format != null)
      {
        final SimpleDateFormat simpleDateFormat = (SimpleDateFormat) format;
        final String formatString = simpleDateFormat.toPattern();
        element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FORMAT_STRING, formatString);
      }
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE, getNullString());
    }
    else
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

        timeInstance = (SimpleDateFormat)DateFormat.getTimeInstance(DateFormat.SHORT, Locale.UK); // 24 hours notation
      }
    } else {
      timeInstance = (SimpleDateFormat)DateFormat.getTimeInstance(DateFormat.SHORT);
    }
    JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(this.timeSpinner, timeInstance.toPattern());
    this.timeSpinner.setEditor(timeEditor);
    SwingTools.addAutoSelectionOnFocusGain(timeEditor.getTextField());

    final PropertyChangeListener timeChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

        timeInstance = (SimpleDateFormat)DateFormat.getTimeInstance(DateFormat.SHORT, Locale.UK); // 24 hours notation
      }
    } else {
      timeInstance = (SimpleDateFormat)DateFormat.getTimeInstance(DateFormat.SHORT);
    }
    JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(this.timeSpinner, timeInstance.toPattern());
    this.timeSpinner.setEditor(timeEditor);
    SwingTools.addAutoSelectionOnFocusGain(timeEditor.getTextField());

    final PropertyChangeListener timeChangeListener = new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent ev) {
View Full Code Here

Examples of java.text.SimpleDateFormat.toPattern()

        if (shortDateFormat instanceof SimpleDateFormat)
        {
            SimpleDateFormat simpleDateFormat = (SimpleDateFormat) shortDateFormat;

            String pattern = simpleDateFormat.toPattern();

            String revised = pattern.replaceAll("([^y])yy$", "$1yyyy");

            return new SimpleDateFormat(revised);
        }
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.