Exemplo n.º 1
1
  private void createControls() {
    lblName = new Label(this, "lblName");

    lblDescription = new Label(this, "lblDescription");

    lblDate = new Label(this, "lblDate");

    lblOwner = new Label(this, "lblOwner");

    ibName = new InputBox(this, "ibName");
    ibName.setWidth(340);

    ibDescription = new InputBox(this, "ibDescription");
    ibDescription.setEmptyInfoText("Enter a description of this list profile");
    ibDescription.setMultiLine(true);
    ibDescription.setWidth(340);
    ibDescription.setHeight(50);

    rbtnYes = new RadioButton(this, "rbtnYes");
    rbtnYes.setTitle("Yes");

    rbtnNo = new RadioButton(this, "rbtnNo", rbtnYes);
    rbtnNo.setTitle("No");

    updateFieldsValues();
  }
Exemplo n.º 2
1
  public void actionUpdate() {
    if (ibName.getText().isEmpty()) {
      editError = "You must enter a name";
      requireRedraw();
      return;
    } else {
      editError = "";
    }

    if (tableModel.getUserConfigHandler().configNameExists(ibName.getText(), userConfig.getId())) {
      editError = "A configuration with this name already exists";
      requireRedraw();
      return;
    }

    userConfig =
        tableModel
            .getUserConfigHandler()
            .updateConfig(
                userConfig, ibName.getText(), ibDescription.getText(), rbtnYes.isSelected());

    updateFieldsValues();
    editMode = false;
    requireRedraw();

    fireEvent(EVENT_TYPE_UPDATE);
  }
Exemplo n.º 3
1
  public void actionCancelUpdate() {
    // if it's a new config we need to fire the delete event to have the
    // control removed, since the entity will not be saved
    if (userConfig.getId() < 1) {
      fireEvent(EVENT_TYPE_DELETE);
      return;
    }

    ibName.setText(userConfig.getName());
    ibDescription.setText(userConfig.getDescription());
    if (userConfig.isPublic()) {
      rbtnYes.setSelected(true);
    } else {
      rbtnNo.setSelected(true);
    }

    editMode = false;
    requireRedraw();
  }
Exemplo n.º 4
1
  private void updateFieldsValues() {
    lblName.setText(userConfig.getName());
    lblDescription.setText(userConfig.getDescription() != null ? userConfig.getDescription() : "");
    lblDate.setText(sdf.format(userConfig.getCreatedAt()));
    if (userConfig.getOwner() != null) {
      lblOwner.setText(
          userConfig.getOwner().getNachname() + ", " + userConfig.getOwner().getVorname());
    } else {
      lblOwner.setText("- Unknown -");
    }

    ibName.setText(userConfig.getName());
    ibDescription.setText(userConfig.getDescription() != null ? userConfig.getDescription() : "");
    if (userConfig.isPublic()) {
      rbtnYes.setSelected(true);
    } else {
      rbtnNo.setSelected(true);
    }
  }