Exemplo n.º 1
0
  protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
      throws java.io.IOException {
    super.renderProperties(renderer);
    if (!_btnVisible) renderer.render("buttonVisible", false);
    if (!_lenient) renderer.render("lenient", false);
    if (_dtzonesReadonly) renderer.render("timeZonesReadonly", true);
    if (_dtzones != null) {
      StringBuffer sb = new StringBuffer();
      for (int i = 0; i < _dtzones.size(); i++) {
        if (i != 0) sb.append(',');
        TimeZone tz = _dtzones.get(i);
        sb.append(tz.getID());
      }
      renderer.render("displayedTimeZones", sb.toString());
    }

    render(renderer, "weekOfYear", _weekOfYear);

    if (_tzone != null) renderer.render("timeZone", _tzone.getID());
    renderer.render("localizedFormat", getLocalizedFormat());

    String unformater = getUnformater();
    if (!Strings.isBlank(unformater)) renderer.render("unformater", unformater);

    if (_locale != null) renderer.render("localizedSymbols", getRealSymbols(_locale, this));
  }
Exemplo n.º 2
0
 /**
  * Processes an AU request.
  *
  * <p>Default: in addition to what are handled by {@link XulElement#service}, it also handles
  * onTimeZoneChange, onChange, onChanging and onError.
  *
  * @since 5.0.0
  */
 public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
   final String cmd = request.getCommand();
   if (cmd.equals("onTimeZoneChange")) {
     final Map<String, Object> data = request.getData();
     String timezone = (String) data.get("timezone");
     setTimeZone(timezone);
   } else super.service(request, everError);
 }
Exemplo n.º 3
0
 /**
  * Sets the date format.
  *
  * <p>If null or empty is specified, {@link #getDefaultFormat} is assumed. Since 5.0.7, you could
  * specify one of the following reserved words, and {@link DateFormats#getDateFormat} or {@link
  * DateFormats#getDateTimeFormat} will be used to retrieve the real format.
  *
  * <table border=0 cellspacing=3 cellpadding=0>
  * <tr>
  * <td>short</td>
  * <td>{@link DateFormats#getDateFormat} with {@link DateFormat#SHORT}</td>
  * </tr>
  * <tr>
  * <td>medium</td>
  * <td>{@link DateFormats#getDateFormat} with {@link DateFormat#MEDIUM}</td>
  * </tr>
  * <tr>
  * <td>long</td>
  * <td>{@link DateFormats#getDateFormat} with {@link DateFormat#LONG}</td>
  * </tr>
  * <tr>
  * <td>full</td>
  * <td>{@link DateFormats#getDateFormat} with {@link DateFormat#FULL}</td>
  * </tr>
  * </table>
  *
  * <p>To specify a date/time format, you could specify two reserved words, separated by a plus.
  * For example, "medium+short" means {@link DateFormats#getDateTimeFormat} with the medium date
  * styling and the short time styling.
  *
  * <p>In additions, the format could be a combination of the following pattern letters:
  *
  * <table border=0 cellspacing=3 cellpadding=0>
  *
  * <tr bgcolor="#ccccff">
  * <th align=left>Letter
  * <th align=left>Date or Time Component
  * <th align=left>Presentation
  * <th align=left>Examples
  * <tr>
  * <td><code>G</code>
  * <td>Era designator
  * <td><a href="#text">Text</a>
  * <td><code>AD</code>
  *
  * <tr bgcolor="#eeeeff">
  * <td><code>y</code>
  * <td>Year
  * <td><a href="#year">Year</a>
  * <td><code>1996</code>; <code>96</code>
  * <tr>
  * <td><code>M</code>
  *
  * <td>Month in year
  * <td><a href="#month">Month</a>
  * <td><code>July</code>; <code>Jul</code>; <code>07</code>
  * <tr bgcolor="#eeeeff">
  * <td><code>w</code>
  * <td>Week in year (starting at 1)
  * <td><a href="#number">Number</a>
  *
  * <td><code>27</code>
  * <tr>
  * <td><code>W</code>
  * <td>Week in month (starting at 1)
  * <td><a href="#number">Number</a>
  * <td><code>2</code>
  * <tr bgcolor="#eeeeff">
  *
  * <td><code>D</code>
  * <td>Day in year (starting at 1)
  * <td><a href="#number">Number</a>
  * <td><code>189</code>
  * <tr>
  * <td><code>d</code>
  * <td>Day in month (starting at 1)
  * <td><a href="#number">Number</a>
  *
  * <td><code>10</code>
  * <tr bgcolor="#eeeeff">
  * <td><code>F</code>
  * <td>Day of week in month
  * <td><a href="#number">Number</a>
  * <td><code>2</code>
  * <tr>
  *
  * <td><code>E</code>
  * <td>Day in week
  * <td><a href="#text">Text</a>
  * <td><code>Tuesday</code>; <code>Tue</code>
  * </table>
  */
 public void setFormat(String format) throws WrongValueException {
   if (format == null) {
     format = "";
   } else if (format.length() != 0) {
     boolean bCustom;
     int j = format.indexOf('+');
     if (j > 0) {
       bCustom =
           toStyle(format.substring(j + 1)) == -111 || toStyle(format.substring(0, j)) == -111;
     } else {
       bCustom = toStyle(format) == -111;
     }
     if (bCustom) getDateFormat(format); // make sure the format is correct
   }
   super.setFormat(format);
   smartUpdate("localizedFormat", getLocalizedFormat());
 }