private void configureOnChangeHandler() {

      final WeeklyRecurrenceEditor localThis = this;

      KeyboardListener keyboardListener =
          new KeyboardListener() {
            public void onKeyDown(Widget sender, char keyCode, int modifiers) {}

            public void onKeyPress(Widget sender, char keyCode, int modifiers) {}

            public void onKeyUp(Widget sender, char keyCode, int modifiers) {
              localThis.changeHandler();
            }
          };

      ClickListener clickListener =
          new ClickListener() {
            public void onClick(Widget sender) {
              localThis.changeHandler();
            }
          };
      for (DayOfWeek d : dayToCheckBox.keySet()) {
        CheckBox cb = dayToCheckBox.get(d);
        cb.addClickListener(clickListener);
        cb.addKeyboardListener(keyboardListener);
      }
    }
  /** constructor */
  public LoginUiHorizontal() {

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(wLoading);
    hp.add(pUi);

    pWidget.add(hp);

    initWidget(pWidget);

    // observers
    bLogin.addClickListener(this);
    bForgot.addClickListener(this);

    tbConsumerKey.addClickListener(this);
    tbConsumerKey.addChangeListener(this);
    tbConsumerKey.addKeyboardListener(this);
    tbConsumerKey.addFocusListener(this);

    tbConsumerSecret.addClickListener(this);
    tbConsumerSecret.addChangeListener(this);
    tbConsumerSecret.addKeyboardListener(this);
    tbConsumerSecret.addFocusListener(this);

    tbConsumerSecretPass.addClickListener(this);
    tbConsumerSecretPass.addChangeListener(this);
    tbConsumerSecretPass.addKeyboardListener(this);
    tbConsumerSecretPass.addFocusListener(this);

    cbRemberMe.addKeyboardListener(this);
    cbRemberMe.addClickListener(this);

    hAccountLogin.addClickListener(this);
    hForgotPassword.addClickListener(this);

    // style
    pWidget.setStyleName("login-Ui");

    // defaults
    pError.setVisible(false);

    hp.setCellVerticalAlignment(wLoading, VerticalPanel.ALIGN_MIDDLE);

    // debug
    // pWidget.addStyleName("test2");

  }
Example #3
0
  protected void addListeners(final CheckBox checkBox, final Image icon, final Label label) {
    ClickListener widgetsClickListener =
        new ClickListener() {
          public void onClick(Widget sender) {
            if (checkBox.isEnabled()) {
              checkBox.setChecked(!checkBox.isChecked());
              onElementClick();
            }
          }
        };

    icon.addClickListener(widgetsClickListener);
    label.addClickListener(widgetsClickListener);

    checkBox.addClickListener(
        new ClickListener() {

          public void onClick(Widget sender) {
            onElementClick();
          }
        });
  }
  private Grid addWalrusEntry(int row, WalrusInfoWeb walrusInfo) {
    final ArrayList<String> properties = walrusInfo.getProperties();
    int numProperties = properties.size() / 4;
    Grid g = new Grid(1 + numProperties, 2);
    g.setStyleName("euca-table");
    g.setCellPadding(4);

    int i = 0; // row 1
    g.setWidget(i, 0, new Label("Walrus host:"));
    g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel p = new HorizontalPanel();
    p.setSpacing(0);
    g.setWidget(i, 1, p);
    final TextBox walrusHost_box = new TextBox();
    walrusHost_box.addChangeListener(new ChangeCallback(this, row));
    walrusHost_box.setVisibleLength(35);
    walrusHost_box.setText(walrusInfo.getHost());
    p.add(walrusHost_box);
    p.add(new EucaButton("Deregister", new DeleteCallback(this, row)));

    for (int propIdx = 0; propIdx < numProperties; ++propIdx) {
      i++; // next row
      if ("KEYVALUE".equals(properties.get(4 * propIdx))) {
        g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        final TextBox propTextBox = new TextBox();
        propTextBox.addChangeListener(new ChangeCallback(this, row));
        propTextBox.setVisibleLength(30);
        propTextBox.setText(properties.get(4 * propIdx + 2));
        propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
        g.setWidget(i, 1, propTextBox);
      } else if ("KEYVALUEHIDDEN".equals(properties.get(4 * propIdx))) {
        g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        final TextBox propTextBox = new PasswordTextBox();
        propTextBox.addChangeListener(new ChangeCallback(this, row));
        propTextBox.setVisibleLength(30);
        propTextBox.setText(properties.get(4 * propIdx + 2));
        propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
        g.setWidget(i, 1, propTextBox);
      } else if ("BOOLEAN".equals(properties.get(4 * propIdx))) {
        final int index = propIdx;
        final CheckBox propCheckbox = new CheckBox();
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        g.setWidget(i, 0, propCheckbox);
        if (Boolean.parseBoolean(properties.get(4 * index + 2))) {
          propCheckbox.setChecked(true);
        } else {
          propCheckbox.setChecked(false);
        }
        propCheckbox.addClickListener(
            new ClickListener() {
              public void onClick(Widget sender) {
                if (((CheckBox) sender).isChecked()) {
                  properties.set(4 * index + 2, String.valueOf(true));
                } else {
                  properties.set(4 * index + 2, String.valueOf(false));
                }
              }
            });
        g.setWidget(i, 1, new Label(properties.get(propIdx * 4 + 1)));
      }
    }
    return g;
  }