private TextField<String> getEmailTextField() {
    if (emailTextField == null) {
      emailTextField = new TextField<String>();
      emailTextField.setEnabled(false);
      emailTextField.setWidth("");
      emailTextField.setFieldLabel("Email");
      emailTextField.setValidator(
          new Validator() {
            public String validate(Field<?> field, String value) {
              if (field == emailTextField) {
                if (!emailTextField
                    .getValue()
                    .toLowerCase()
                    .matches(
                        "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])")) {
                  return "Bad E-mail Address";
                }
              }

              return null;
            }
          });
    }
    return emailTextField;
  }
  private TextField<String> getJobnameTextField() {
    if (jobnameTextField == null) {
      jobnameTextField = new TextField<String>();
      jobnameTextField.setAllowBlank(false);
      jobnameTextField.setWidth("100");
      jobnameTextField.setFieldLabel("Jobname");
      jobnameTextField.setValidator(
          new Validator() {

            public String validate(Field<?> field, String value) {

              if (field == jobnameTextField) {

                if (value.indexOf(" ") >= 0) {
                  return "Jobname contains whitespace";
                }

                if (UserEnvironment.getInstance().getAllJobnames().contains(value)) {
                  return "Jobname already exists.";
                }
              }
              return null;
            }
          });
      jobnameTextField.addListener(
          Events.KeyUp,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {
              userTypedInTextField = true;
            }
          });
    }
    return jobnameTextField;
  }
  /**
   * Display a Prompting Message to enter some text in the Application. The OK button will be
   * enabled iff the text is not empty or blank.
   *
   * @param title
   * @param message
   * @param callback
   */
  public static MessageBox promptMessage(
      String title, String message, Listener<MessageBoxEvent> callback) {
    final MessageBox box = MessageBox.prompt(title, message, callback);

    final Button okButton = box.getDialog().getButtonById(Dialog.OK);
    okButton.disable();

    final TextField<String> textBox = box.getTextBox();
    textBox.addKeyListener(
        new KeyListener() {

          @Override
          public void componentKeyPress(ComponentEvent event) {
            if (okButton.isEnabled() && event.getKeyCode() == KeyCodes.KEY_ENTER) {
              box.getDialog().hide(okButton);
            }
          }
        });

    box.addListener(
        Events.OnKeyUp,
        new Listener<MessageBoxEvent>() {

          @Override
          public void handleEvent(MessageBoxEvent be) {
            String value = textBox.getValue();
            if (value == null || value.trim().equals("")) {
              okButton.disable();
            } else {
              okButton.enable();
            }
          }
        });
    return box;
  }
示例#4
0
  private TextField<String> buildFilterField() {
    filter =
        new TextField<String>() {
          @Override
          public void onKeyUp(FieldEvent fe) {
            String val = getValue();
            if (val == null || val.isEmpty()) {
              search("");
              return;
            }

            if (fe.getKeyCode() == 13) {
              if (val.length() >= 3) {
                search(val);
              }
            }
          }
        };

    filter.setEmptyText(I18N.DISPLAY.searchToolTip());
    filter.setToolTip(I18N.DISPLAY.searchToolTip());
    filter.setId(ID_SEARCH_FLD);
    filter.setWidth(350);
    return filter;
  }
  public LatestVirtualReportItemsPanel() {
    setHeading("Virtual Level Monitoring");
    setLayout(new FitLayout());

    ToolBar toolBar = new ToolBar();
    Button reflesh = new Button("Refresh");
    reflesh.setIcon(IconHelper.createStyle("icon-email-add"));
    id = new TextField<String>();
    id.setFieldLabel("Virtual ID");
    id.setAllowBlank(false);
    toolBar.add(new LabelToolItem("Virtual ID: "));
    toolBar.add(id);
    toolBar.add(reflesh);
    setTopComponent(toolBar);
    reflesh.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            String virtualId = id.getValue();
            service = (MonitoringManagerWebServiceAsync) Registry.get("guiservice");
            service.getMonitoringResources(
                "virtual",
                virtualId,
                new AsyncCallback<List<MonitoringResource>>() {
                  public void onFailure(Throwable caught) {
                    Dispatcher.forwardEvent(MainEvents.Error, caught);
                  }

                  public void onSuccess(List<MonitoringResource> result) {
                    getVirtualStore().removeAll();
                    if (result.size() > 0) virtualStore.add(result);
                  }
                });
          }
        });

    virtualStore = new GroupingStore<MonitoringResource>();
    virtualStore.groupBy("resource_type");
    cm = new ColumnModel(OptimisResource.getColumnConfig());
    GroupingView view = new GroupingView();
    view.setShowGroupedColumn(true);
    view.setForceFit(true);
    view.setGroupRenderer(
        new GridGroupRenderer() {
          public String render(GroupColumnData data) {
            String f = cm.getColumnById(data.field).getHeader();
            String l = data.models.size() == 1 ? "Item" : "Items";
            return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
          }
        });

    virtualGrid = new Grid<MonitoringResource>(virtualStore, cm);
    virtualGrid.setTitle(" Service Resources ");
    virtualGrid.setView(view);
    virtualGrid.setBorders(true);
    virtualGrid.getView().setForceFit(true);
    add(virtualGrid);
  }
  public LatestPhysicalReportItemsPanel() {
    setHeading("Physical Level Monitoring");
    setLayout(new FitLayout());

    ToolBar toolBar = new ToolBar();
    ToolBar toolBarBottom = new ToolBar();
    Button reflesh = new Button("Refresh");
    reflesh.setIcon(IconHelper.createStyle("icon-email-add"));
    id = new TextField<String>();
    id.setFieldLabel("Physical ID");
    id.setAllowBlank(false);
    toolBar.add(new LabelToolItem("Physical ID: "));
    toolBar.add(id);
    toolBar.add(reflesh);
    setTopComponent(toolBar);
    lt = new LabelField("");
    setToolBar4Status("");
    toolBarBottom.add(lt);
    setBottomComponent(toolBarBottom);
    reflesh.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            setToolBar4Status("Loading data, please wait...");
            String physicalId = id.getValue();
            service = (MonitoringManagerWebServiceAsync) Registry.get("guiservice");
            service.getMonitoringResources(
                "physical",
                physicalId,
                new AsyncCallback<List<MonitoringResource>>() {
                  public void onFailure(Throwable caught) {
                    setToolBar4Status("Connection failed by loading data, please try again.");
                    Dispatcher.forwardEvent(MainEvents.Error, caught);
                  }

                  public void onSuccess(List<MonitoringResource> result) {
                    setToolBar4Status("");
                    getStore().removeAll();
                    if (result.size() > 0) {
                      store.add(result);
                    } else {
                      setToolBar4ErrorStatus("No data found.");
                    }
                  }
                });
          }
        });

    cm = new ColumnModel(OptimisResource.getColumnConfig());
    store = new ListStore<MonitoringResource>();
    grid = new Grid<MonitoringResource>(store, cm);
    grid.setTitle(" Physical Level Resources ");
    grid.setBorders(true);
    grid.getView().setForceFit(true);
    add(grid);
    setLayout(new FitLayout());
  }
示例#7
0
 @Override
 protected void onRender(Element parent, int pos) {
   super.onRender(parent, pos);
   setHeaderVisible(false);
   firstNameField.setFieldLabel("First name");
   lastNameField.setFieldLabel("Last name");
   add(firstNameField);
   add(lastNameField);
   add(saveButton);
 }
  private void reset() {
    Log.debug("DhcpNatConfigTab: reset()");
    m_modeCombo.setSimpleValue(MessageUtils.get(GwtNetRouterMode.netRouterOff.name()));
    m_modeCombo.setOriginalValue(m_modeCombo.getValue());

    m_dhcpBeginAddressField.setValue("");
    m_dhcpBeginAddressField.setOriginalValue(m_dhcpBeginAddressField.getValue());

    m_dhcpEndAddressField.setValue("");
    m_dhcpEndAddressField.setOriginalValue(m_dhcpEndAddressField.getValue());

    m_dhcpSubnetMaskField.setValue("");
    m_dhcpSubnetMaskField.setOriginalValue(m_dhcpSubnetMaskField.getValue());

    m_dhcpLeaseDefaultField.setValue(0);
    m_dhcpLeaseDefaultField.setOriginalValue(m_dhcpLeaseDefaultField.getValue());

    m_dhcpLeaseMaxField.setValue(0);
    m_dhcpLeaseMaxField.setOriginalValue(m_dhcpLeaseMaxField.getValue());

    m_passDnsRadioTrue.setValue(false);
    m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue());

    m_passDnsRadioFalse.setValue(true);
    m_passDnsRadioFalse.setOriginalValue(m_passDnsRadioFalse.getValue());

    m_passDnsRadioGroup.setValue(m_passDnsRadioFalse);
    m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioGroup.getValue());

    update();
  }
示例#9
0
 private boolean validateFields() {
   if (Utils.safeString(nameTextBox.getValue()).equals("")) {
     MessageBox.alert(textMessages.error(), textMessages.mustEnterName(), null);
     return false;
   }
   if (Utils.safeString(nameTextBox.getValue()).length() > Group.LENGTH_NAME) {
     MessageBox.alert(textMessages.error(), textMessages.tooLongName(), null);
     return false;
   }
   return true;
 }
示例#10
0
 private void setFields() {
   usernameTextBox.setValue(user.getUsername());
   fullnameTextBox.setValue(user.getFullname());
   emailTextBox.setValue(user.getEmail());
   enabledCheckBox.setValue(user.isActiveFlag());
   for (Group group : user.getGroups()) {
     if (!group.getName().equals(Constants.EVERYONE_GROUP_NAME)) {
       toGroupStore.add(new GroupData(group));
     }
   }
   loadAvailableGroups();
 }
示例#11
0
  private void doSave() {
    if (validateFields()) {
      user.setUsername(Utils.safeString(usernameTextBox.getValue()));
      user.setFullname(Utils.safeString(fullnameTextBox.getValue()));
      user.setEmail(Utils.safeString(emailTextBox.getValue()));
      user.setActiveFlag(enabledCheckBox.getValue());
      user.updateAuthnPasswordValue(Utils.safeString(password1TextBox.getValue()));
      user.removeGroups();
      for (GroupData groupData : toGroupStore.getModels()) {
        Group group = (Group) groupData.get(Constants.GROUP);
        user.addGroup(group);
      }

      final AsyncCallback<Void> callback =
          new AsyncCallback<Void>() {
            @Override
            public void onFailure(Throwable caught) {
              WebPasswordSafe.handleServerFailure(caught);
            }

            @Override
            public void onSuccess(Void result) {
              Info.display(textMessages.status(), textMessages.userSaved());
              hide();
            }
          };
      if (user.getId() == 0) {
        final AsyncCallback<Boolean> callbackCheck =
            new AsyncCallback<Boolean>() {
              @Override
              public void onFailure(Throwable caught) {
                WebPasswordSafe.handleServerFailure(caught);
              }

              @Override
              public void onSuccess(Boolean result) {
                // true => username already taken, else go ahead and save
                if (result) {
                  MessageBox.alert(
                      textMessages.error(), textMessages.usernameAlreadyExists(), null);
                } else {
                  UserService.Util.getInstance().addUser(user, callback);
                }
              }
            };
        UserService.Util.getInstance().isUserTaken(user.getUsername(), callbackCheck);
      } else {
        UserService.Util.getInstance().updateUser(user, callback);
      }
    }
  }
  public List<IntervalliCommesseModel> elaboraIntervalliC(
      FldsetIntervalliCommesse fldSetIntervalliC) {

    TextField<String> txtfldOreLavoro = new TextField<String>();
    TextField<String> txtfldOreViaggio = new TextField<String>();
    TextField<String> txtfldOreStrao = new TextField<String>();
    Text txtDescrizione = new Text();
    FormInserimentoIntervalloCommessa frm = new FormInserimentoIntervalloCommessa("2");
    String numeroCommessa;
    String descrizione;

    IntervalliCommesseModel intervallo;
    List<IntervalliCommesseModel> intervalliC = new ArrayList<IntervalliCommesseModel>();
    String frmItemId = new String();

    int i;

    i = fldSetIntervalliC.getItemCount(); // numero di commesse registrate

    for (int j = 1; j < i; j++) {
      frmItemId = String.valueOf(j - 1);
      frm = (FormInserimentoIntervalloCommessa) fldSetIntervalliC.getItemByItemId(frmItemId);

      // txtfldNumCommessa=frm.txtfldNumeroCommessa;
      txtfldOreLavoro = frm.txtfldOreIntervallo;
      txtfldOreViaggio = frm.txtfldOreViaggio;

      txtfldOreStrao = frm.txtfldOreStrao;
      txtDescrizione = frm.txtDescrizione;

      descrizione = txtDescrizione.getText();
      numeroCommessa = descrizione.substring(0, descrizione.indexOf(" "));
      descrizione = descrizione.substring(descrizione.indexOf("(") + 1, descrizione.indexOf(")"));

      // TODO ore strao
      intervallo =
          new IntervalliCommesseModel(
              numeroCommessa,
              txtfldOreLavoro.getValue().toString(),
              txtfldOreViaggio.getValue().toString(),
              "0.00",
              "",
              "",
              descrizione,
              "");
      intervalliC.add(intervallo);
    }

    return intervalliC;
  }
示例#13
0
  /**
   * DOC bessaies Comment method "buildField".
   *
   * @param fieldPart
   * @param messagePart
   * @param configBean
   */
  private Field<?> buildPasswordField(
      final LayoutContainer fieldPart, final LayoutContainer messagePart, Config config) {
    String key = config.labelKey;
    TextField<String> field = new TextField<String>();
    field.setName(config.name());
    field.setReadOnly(
        !(config.editable
            && userBean.getRole().getRights().contains(RightsConstants.CONFIG_MANAGMENT)));
    field.setPassword(true);

    buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart);
    bindings.add(new FieldBinding<String>(field, config.name()));
    return field;
  }
  private TextField<String> addDefinition(String definable, String definition) {
    TableData deleteColumn = new TableData();
    deleteColumn.setWidth("20px");
    deleteColumn.setVerticalAlign(VerticalAlignment.TOP);

    TableData defColumn = new TableData();
    defColumn.setWidth(defColumnWidth);
    defColumn.setVerticalAlign(VerticalAlignment.TOP);

    TableData definitionsColumn = new TableData();
    definitionsColumn.setWidth(definitionsColumnWidth);
    definitionsColumn.setVerticalAlign(VerticalAlignment.TOP);

    final TextField<String> defText = new TextField<String>();
    defText.setValue(definable);
    defText.setWidth(defColumnWidth);

    final TextArea definitionText = new TextArea();
    definitionText.setValue(definition);
    definitionText.setWidth(definitionsColumnWidth);

    fields.put(defText, definitionText);
    final Image image = new Image("images/icon-delete.png");
    image.addClickListener(
        new ClickListener() {

          public void onClick(Widget sender) {
            WindowUtils.confirmAlert(
                "Delete?",
                "Are you sure you want to delete this definition?",
                new Listener<MessageBoxEvent>() {
                  public void handleEvent(MessageBoxEvent be) {
                    if (be.getButtonClicked().getText().equalsIgnoreCase("yes")) {
                      remove(defText);
                      remove(definitionText);
                      remove(image);
                      fields.remove(defText);
                    }
                  };
                });
          }
        });

    add(image, deleteColumn);
    add(defText, defColumn);
    add(definitionText, definitionsColumn);

    return defText;
  }
示例#15
0
  private final ContentPanel createPropertiesPanel() {
    FormPanel panel = new FormPanel();
    panel.setHeaderVisible(false);
    panel.setButtonAlign(HorizontalAlignment.RIGHT);
    panel.setStyleAttribute("padding", "20");

    serverName = new TextField<String>();
    serverName.setFieldLabel("Server Name");
    serverName.setEmptyText("Please enter the server name");
    serverName.setAllowBlank(false);
    serverName.setMinLength(1);
    panel.add(serverName);

    return panel;
  }
示例#16
0
 /** {@inheritDoc} */
 @Override
 protected void onDetach() {
   super.onDetach();
   if (focusPreview != null) {
     focusPreview.remove();
   }
 }
示例#17
0
 @Override
 public void setMessages(FilterMessages messages) {
   super.setMessages(messages);
   if (field != null) {
     field.setEmptyText(getMessages().getEmptyText());
   }
 }
示例#18
0
  private void createFields() {
    GroupRef groupRef = (GroupRef) groupRefBeanModel.getBean();

    nameField = new TextField<String>();
    nameField.setName("name");
    nameField.setFieldLabel("Name");
    nameField.setAllowBlank(false);
    if (groupRef.getGroup().getName() != null) {
      nameField.setValue(groupRef.getGroup().getName());
    }

    AdapterField screenField = new AdapterField(createScreenPairList(groupRef));
    screenField.setFieldLabel("Screen");
    form.add(nameField);
    form.add(screenField);
  }
示例#19
0
  public SimpleCombos(String text) {
    super(text);
    this.setLayout(new RowLayout());
    FormPanel fp = new FormPanel();

    ComboBox comboEntryKey = ComboFactory.buildStaticCombo("ERROR_CATEGORY");
    comboEntryKey.setFieldLabel("Wybierz");
    ComboBox comboId = ComboFactory.buildStaticCombo("ERROR_CATEGORY");
    comboId.setFieldLabel("Wybierz");
    ComboBox comboValue = ComboFactory.buildStaticCombo("ERROR_CATEGORY");
    comboValue.setFieldLabel("Wybierz");
    ComboBox comboComment = ComboFactory.buildStaticCombo("ERROR_CATEGORY");
    comboComment.setFieldLabel("Wybierz");
    TextField entryKey = new TextField();
    entryKey.setFieldLabel("entryKey");
    TextField id = new TextField();
    id.setFieldLabel("id");
    TextField value = new TextField();
    value.setFieldLabel("value");
    TextField comment = new TextField();
    comment.setFieldLabel("comment");

    fp.add(comboEntryKey);
    fp.add(comboId);
    fp.add(comboValue);
    fp.add(comboComment);
    fp.add(entryKey);
    fp.add(id);
    fp.add(value);
    fp.add(comment);

    FormBinding fb = new FormBinding(fp);
    ModelExample model = new ModelExample();

    fb.bind(model);

    fb.addFieldBinding(
        new DictionaryComboBindingToStringField(
            comboEntryKey, "modelEntryKey", DictionaryEntry.EntryProperty.entryKey));
    fb.addFieldBinding(
        new DictionaryComboBindingToStringField(
            comboId, "modelId", DictionaryEntry.EntryProperty.id));
    fb.addFieldBinding(
        new DictionaryComboBindingToStringField(
            comboValue, "modelValue", DictionaryEntry.EntryProperty.value));
    fb.addFieldBinding(
        new DictionaryComboBindingToStringField(
            comboComment, "modelComment", DictionaryEntry.EntryProperty.comment));
    fb.addFieldBinding(new FieldBinding(entryKey, "modelEntryKey"));
    fb.addFieldBinding(new FieldBinding(id, "modelId"));
    fb.addFieldBinding(new FieldBinding(value, "modelValue"));
    fb.addFieldBinding(new FieldBinding(comment, "modelComment"));

    comboEntryKey.setEditable(false);
    comboEntryKey.setEmptyText("wybierz");
    this.add(fp);
  }
示例#20
0
  private void setFields() {
    nameTextBox.setValue(group.getName());
    for (User user : group.getUsers()) {
      toUserStore.add(new UserData(user));
    }

    loadAvailableUsers();
  }
示例#21
0
 /** {@inheritDoc} */
 @Override
 public void onBrowserEvent(Event event) {
   super.onBrowserEvent(event);
   if ((event.getTypeInt() != Event.ONCLICK)
       && ((Element) event.getEventTarget().cast()).isOrHasChild(file.dom)) {
     button.onBrowserEvent(event);
   }
 }
示例#22
0
 public final boolean save(XObject input) {
   if (input instanceof XGroup) {
     XGroup group = (XGroup) input;
     group.setName(name.getValue());
     group.setDescription(description.getValue());
   }
   return true;
 }
示例#23
0
  private void savePerson() {
    final PersonServiceAsync personService = Registry.get(ExploitDemoConstants.PERSON_SERVICE);
    final Person p = new Person(firstNameField.getValue(), lastNameField.getValue());
    personService.savePerson(
        p,
        new AsyncCallback<Void>() {
          @Override
          public void onFailure(Throwable caught) {
            Window.alert(caught.toString());
          }

          @Override
          public void onSuccess(Void result) {
            setHeading("Editing: " + lastNameField.getValue());
          }
        });
  }
示例#24
0
 void set(XObject input) {
   if (input instanceof XServer) {
     XServer server = (XServer) input;
     serverName.setValue(server.getName());
     //			lastname.setValue(user.getLastname());
     //			login.setValue(user.getLogin());
   }
 }
示例#25
0
  private final ContentPanel createPropertiesContent() {
    FormPanel panel = new FormPanel();
    panel.setHeaderVisible(false);
    panel.setButtonAlign(HorizontalAlignment.RIGHT);
    panel.setStyleAttribute("padding", "20");

    KeyListener keyListener =
        new KeyListener() {
          public void componentKeyUp(ComponentEvent event) {
            editor.markDirty();
          }
        };

    name = new TextField<String>();
    name.setFieldLabel(constants.name());
    name.setEmptyText(constants.groupName());
    name.setAllowBlank(false);
    name.setMinLength(2);
    name.addKeyListener(keyListener);
    name.setStyleAttribute("marginTop", "5");
    name.setStyleAttribute("marginBottom", "5");
    panel.add(name);

    description = new TextArea();
    description.setPreventScrollbars(true);
    description.setFieldLabel(constants.description());
    description.addKeyListener(keyListener);
    description.setStyleAttribute("marginTop", "5");
    description.setStyleAttribute("marginBottom", "5");
    panel.add(description);

    return panel;
  }
示例#26
0
 private Field<?> buildTextField(
     final LayoutContainer fieldPart, final LayoutContainer messagePart, Config config) {
   String key = config.labelKey;
   if (config.editable
       && userBean.getRole().getRights().contains(RightsConstants.CONFIG_MANAGMENT)) {
     TextField<String> field = new TextField<String>();
     field.setName(config.name());
     buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart);
     bindings.add(new FieldBinding<String>(field, config.name(), null));
     return field;
   } else {
     LabelField field = new LabelField();
     field.setName(config.name());
     buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart);
     bindings.add(new FieldBinding<Object>(field, config.name(), null));
     return field;
   }
 }
示例#27
0
 protected void onFieldKeyUp(FieldEvent fe) {
   int key = fe.getKeyCode();
   if (key == KeyCodes.KEY_ENTER && field.isValid()) {
     fe.stopEvent();
     menu.hide(true);
     return;
   }
   updateTask.delay(getUpdateBuffer());
 }
示例#28
0
 /** {@inheritDoc} */
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   switch (ce.getEventTypeInt()) {
     case Event.ONCHANGE:
       onChange();
       break;
   }
 }
示例#29
0
 public void setTextFieldFocusOnClick() {
   textField.addListener(
       Events.OnClick,
       new Listener<FieldEvent>() {
         @Override
         public void handleEvent(final FieldEvent fe) {
           textField.focus();
         }
       });
 }
  public AttributeForm() {

    binding = new FormBinding(this);

    final NumberField idField = new NumberField();
    idField.setFieldLabel("ID");
    idField.setReadOnly(true);
    binding.addFieldBinding(new FieldBinding(idField, "id"));
    add(idField);

    TextField<String> nameField = new TextField<String>();
    nameField.setFieldLabel(I18N.CONSTANTS.name());
    nameField.setMaxLength(AttributeDTO.NAME_MAX_LENGTH);
    binding.addFieldBinding(new OnlyValidFieldBinding(nameField, "name"));

    add(nameField);

    hideFieldWhenNull(idField);
  }