Пример #1
0
  @Override
  protected void setup() {

    List<String> list = new ArrayList<String>();
    for (int i = 0; i < 100; i++) {
      list.add("Item " + i);
    }

    ComboBox cb = new ComboBox("Combobox", list);
    cb.setImmediate(true);
    cb.setInputPrompt("Enter text");
    cb.setDescription("Some Combobox");
    addComponent(cb);

    final ObjectProperty<String> log = new ObjectProperty<String>("");

    cb.addListener(
        new FieldEvents.FocusListener() {
          public void focus(FocusEvent event) {
            log.setValue(log.getValue().toString() + "<br>" + counter + ": Focus event!");
            counter++;
          }
        });

    cb.addListener(
        new FieldEvents.BlurListener() {
          public void blur(BlurEvent event) {
            log.setValue(log.getValue().toString() + "<br>" + counter + ": Blur event!");
            counter++;
          }
        });

    TextField field = new TextField("Some textfield");
    field.setImmediate(true);
    addComponent(field);

    Label output = new Label(log);
    output.setCaption("Events:");

    output.setContentMode(Label.CONTENT_XHTML);
    addComponent(output);
  }
  @Override
  public void init() {
    inputUserName = new TextField("Nama Untuk Log In");
    inputUserName.setDescription("Nama yang digunakan untuk log in");
    inputUserName.setImmediate(true);
    inputUserName.setWidth(function.FORM_WIDTH);
    inputUserName.setMaxLength(10);
    inputUserName.addValueChangeListener(this);
    inputName = new TextField("Nama Lengkap");
    inputName.setDescription("Nama lengkap pengguna");
    inputName.setImmediate(true);
    inputName.addValueChangeListener(this);
    inputName.setWidth(function.FORM_WIDTH);
    selectRole = new ComboBox("Role Pengguna");
    selectRole.setImmediate(true);
    selectRole.setDescription("Role dari pengguna");
    selectRole.addValueChangeListener(this);
    selectRole.setWidth(function.FORM_WIDTH);
    selectRole.setNullSelectionAllowed(false);
    inputEmployeeNum = new TextField("Nomor pegawai");
    inputEmployeeNum.setDescription("Nomor pegawai");
    inputEmployeeNum.addValueChangeListener(this);
    inputEmployeeNum.setImmediate(true);
    inputEmployeeNum.setWidth(function.FORM_WIDTH);
    inputTitle = new TextField("Jabatan");
    inputTitle.setDescription("Jabatan dari pengguna");
    inputTitle.addValueChangeListener(this);
    inputTitle.setImmediate(true);
    inputTitle.setWidth(function.FORM_WIDTH);
    inputPhoneNumber = new TextField("Nomor Telepon");
    inputPhoneNumber.setDescription("Nomor Telepon yang bisa dihubungi");
    inputPhoneNumber.setImmediate(true);
    inputPhoneNumber.addValueChangeListener(this);
    inputPhoneNumber.setWidth(function.FORM_WIDTH);
    inputAddress = new TextArea("Alamat");
    inputAddress.setDescription("Alamat pengguna");
    inputAddress.addValueChangeListener(this);
    inputAddress.setImmediate(true);
    inputAddress.setWidth(function.FORM_WIDTH);
    inputPassword1 = new PasswordField("Password");
    inputPassword1.setDescription("Masukan password untuk pengguna");
    inputPassword1.addValueChangeListener(this);
    inputPassword1.setImmediate(true);
    inputPassword1.setWidth(function.FORM_WIDTH);
    inputPassword2 = new PasswordField("Ulangi Password");
    inputPassword2.setDescription("Masukan password untuk pengguna");
    inputPassword2.addValueChangeListener(this);
    inputPassword2.setImmediate(true);
    inputPassword2.setWidth(function.FORM_WIDTH);
    inputSika = new TextField("SIKA");
    inputSika.setDescription("Masukan nomor SIKA");
    inputSika.addValueChangeListener(this);
    inputSika.setImmediate(true);
    inputSika.setWidth(function.FORM_WIDTH);

    labelError =
        new Label() {
          {
            setVisible(false);
            addStyleName("form-error");
            setContentMode(ContentMode.HTML);
          }
        };
    buttonSubmit = new Button("Simpan");
    buttonSubmit.addClickListener(this);

    buttonSaveEdit = new Button("Simpan Perubahan");
    buttonSaveEdit.addClickListener(this);
    buttonReset = new Button("Reset Form");
    buttonReset.addClickListener(this);
    buttonCancel = new Button("Batalkan");
    buttonCancel.addClickListener(this);
    buttonActivation = new Button("");
    buttonActivation.addClickListener(this);
    buttonResetPassword = new Button("Reset Password");
    buttonResetPassword.addClickListener(this);
    construct();
  }
Пример #3
0
  @AutoGenerated
  private AbsoluteLayout buildGeneralLayout() {
    // common part: create layout
    generalLayout = new AbsoluteLayout();
    generalLayout.setImmediate(false);
    generalLayout.setWidth("100.0%");
    generalLayout.setHeight("100.0%");
    generalLayout.setMargin(false);

    // photoField
    photoField = new ImageField();
    photoField.setImmediate(false);
    photoField.setWidth("420px");
    photoField.setHeight("140px");
    generalLayout.addComponent(photoField, "top:20.0px;left:10.0px;");

    // vatField
    vatField = new TextField();
    vatField.setCaption("CIF/NIF");
    vatField.setImmediate(false);
    vatField.setWidth("120px");
    vatField.setHeight("-1px");
    generalLayout.addComponent(vatField, "top:16.0px;left:435.0px;");

    // clientTypeField
    clientTypeField = new ComboBox();
    clientTypeField.setCaption("Tipo");
    clientTypeField.setImmediate(false);
    clientTypeField.setDescription("Tipo Cliente");
    clientTypeField.setWidth("-1px");
    clientTypeField.setHeight("-1px");
    clientTypeField.setRequired(true);
    generalLayout.addComponent(clientTypeField, "top:54.0px;left:435.0px;");

    // clientGroupField
    clientGroupField = new ComboBox();
    clientGroupField.setCaption("Grupo");
    clientGroupField.setImmediate(false);
    clientGroupField.setWidth("-1px");
    clientGroupField.setHeight("-1px");
    clientGroupField.setRequired(true);
    generalLayout.addComponent(clientGroupField, "top:92.0px;left:435.0px;");

    // phoneField
    phoneField = new TextField();
    phoneField.setCaption("Teléfono 01");
    phoneField.setImmediate(false);
    phoneField.setWidth("115px");
    phoneField.setHeight("-1px");
    generalLayout.addComponent(phoneField, "top:16.0px;left:653.0px;");

    // faxField
    faxField = new TextField();
    faxField.setCaption("Fax");
    faxField.setImmediate(false);
    faxField.setWidth("115px");
    faxField.setHeight("-1px");
    generalLayout.addComponent(faxField, "top:54.0px;left:779.0px;");

    // facebookIdField
    facebookIdField = new TextField();
    facebookIdField.setCaption("Facebook Id");
    facebookIdField.setImmediate(false);
    facebookIdField.setWidth("242px");
    facebookIdField.setHeight("24px");
    generalLayout.addComponent(facebookIdField, "top:90.0px;left:653.0px;");

    // mobileField
    mobileField = new TextField();
    mobileField.setCaption("Teléfono 02");
    mobileField.setImmediate(false);
    mobileField.setWidth("115px");
    mobileField.setHeight("-1px");
    generalLayout.addComponent(mobileField, "top:16.0px;left:780.0px;");

    // descriptionField
    descriptionField = new TextField();
    descriptionField.setCaption("Descripción");
    descriptionField.setImmediate(false);
    descriptionField.setWidth("460px");
    descriptionField.setHeight("-1px");
    generalLayout.addComponent(descriptionField, "top:132.0px;left:435.0px;");

    // commentField
    commentField = new TextArea();
    commentField.setCaption("Comentarios");
    commentField.setImmediate(false);
    commentField.setWidth("885px");
    commentField.setHeight("70px");
    generalLayout.addComponent(commentField, "top:206.0px;left:11.0px;");

    // emailField
    emailField = new TextField();
    emailField.setCaption("Email");
    emailField.setImmediate(false);
    emailField.setWidth("460px");
    emailField.setHeight("-1px");
    generalLayout.addComponent(emailField, "top:172.0px;left:435.0px;");

    return generalLayout;
  }