Example #1
0
  @Override
  public void create(final PTInstruction create, final UIService uiService) {

    this.id = create.getObjectID();
    this.uiService = uiService;

    if (create.containsKey(PROPERTY.URL)) url = create.getString(PROPERTY.URL);
    else url = GWT.getHostPageBaseURL() + "?wid=" + create.getObjectID();

    if (create.containsKey(PROPERTY.NAME)) name = create.getString(PROPERTY.NAME);
    else name = "";

    if (create.containsKey(PROPERTY.FEATURES)) features = create.getString(PROPERTY.FEATURES);
    else features = "";
  }
Example #2
0
  @Override
  public void addHandler(final PTInstruction addHandler, final UIService uiService) {

    if (HANDLER.KEY_.DATE_VALUE_CHANGE_HANDLER.equals(addHandler.getString(HANDLER.KEY))) {
      final DateBox dateBox = cast();
      final TextBox textBox = dateBox.getTextBox();
      dateBox.addValueChangeHandler(
          new ValueChangeHandler<Date>() {

            @Override
            public void onValueChange(final ValueChangeEvent<Date> event) {
              triggerEvent(addHandler, uiService, dateBox);
            }
          });
      textBox.addValueChangeHandler(
          new ValueChangeHandler<String>() {

            @Override
            public void onValueChange(final ValueChangeEvent<String> event) {
              triggerEvent(addHandler, uiService, dateBox);
            }
          });
    } else {
      super.addHandler(addHandler, uiService);
    }
  }
Example #3
0
  @Override
  public void update(final PTInstruction update, final UIService uiService) {
    final MyDateBox dateBox = cast();

    if (update.containsKey(PROPERTY.VALUE)) {
      dateBox.getTextBox().setText(update.getString(PROPERTY.VALUE));
    } else if (update.containsKey(PROPERTY.DATE_FORMAT)) {
      final DefaultFormat format =
          new DefaultFormat(DateTimeFormat.getFormat(update.getString(PROPERTY.DATE_FORMAT)));
      dateBox.setFormat(format);
    } else if (update.containsKey(PROPERTY.DATE_FORMAT_PATTERN)) {
      dateBox.setFormat(
          new DefaultFormat(
              DateTimeFormat.getFormat(update.getString(PROPERTY.DATE_FORMAT_PATTERN))));
    } else if (update.containsKey(PROPERTY.ENABLED)) {
      dateBox.setEnabled(update.getBoolean(PROPERTY.ENABLED));
    } else if (update.containsKey(PROPERTY.MONTH)) {
      dateBox.setDefaultMonth(update.getString(PROPERTY.MONTH));
    } else {
      super.update(update, uiService);
    }
  }
Example #4
0
 @Override
 public void update(final PTInstruction update, final UIService uiService) {
   if (update.containsKey(PROPERTY.OPEN)) {
     window = open(url, name, features);
     if (window != null) {
       checkWindowAlive();
     }
   } else if (update.containsKey(PROPERTY.TEXT)) {
     onDataReceived(window, update.getString(PROPERTY.TEXT));
   } else if (update.containsKey(PROPERTY.CLOSE)) {
     close(window);
   }
 }