Exemple #1
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);
 }
Exemple #2
0
 /**
  * Converts an AU request to a selection event.
  *
  * @since 5.0.0
  */
 public static final SelectionEvent getSelectionEvent(AuRequest request) {
   final Map data = request.getData();
   return new SelectionEvent(
       request.getCommand(),
       request.getComponent(),
       AuRequests.getInt(data, "start", 0),
       AuRequests.getInt(data, "end", 0),
       (String) data.get("selected"));
 }
Exemple #3
0
  /**
   * Processes an AU request.
   *
   * <p>Default: in addition to what are handled by its superclass, it also handles onSort.
   *
   * @since 6.5.0
   */
  public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
    final String cmd = request.getCommand();
    if (cmd.equals(Events.ON_SORT)) {
      SortEvent evt = SortEvent.getSortEvent(request);
      Events.postEvent(evt);
    } else if (cmd.equals(Events.ON_GROUP)) {
      final Map<String, Object> data = request.getData();
      final boolean ascending = AuRequests.getBoolean(data, "");
      Events.postEvent(new SortEvent(cmd, this, ascending));

      // internal use, and it should be invoked after onGroup event.
      Events.postEvent(-1000, new SortEvent("onGroupLater", this, ascending));
    } else if (cmd.equals(Events.ON_UNGROUP)) {
      final Map<String, Object> data = request.getData();
      final boolean ascending = AuRequests.getBoolean(data, "");
      ungroup(ascending);
      Events.postEvent(new SortEvent(cmd, request.getComponent(), ascending));
    } else super.service(request, everError);
  }
Exemple #4
0
  public static final ResizeEvent getResizeEvent(AuRequest request) {
    final Component comp = request.getComponent();

    if (comp == null) throw new UiException(MZk.ILLEGAL_REQUEST_COMPONENT_REQUIRED, request);

    final Map data = request.getData();

    if (data == null)
      throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, new Object[] {data, request});

    return new ResizeEvent(
        request.getCommand(),
        comp,
        AuRequests.getInt(data, "width", 0),
        AuRequests.getInt(data, "height", 0));
  }