Пример #1
0
  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();
  }
Пример #2
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();
 }
Пример #3
0
  private void setFields() {
    nameTextBox.setValue(group.getName());
    for (User user : group.getUsers()) {
      toUserStore.add(new UserData(user));
    }

    loadAvailableUsers();
  }
Пример #4
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());
   }
 }
  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;
  }
Пример #6
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);
  }
Пример #7
0
 public void set(XObject input) {
   if (input instanceof XGroup) {
     XGroup group = (XGroup) input;
     name.setValue(group.getName());
     description.setValue(translateDescription(group.getDescription()));
     if (group != null
         && group.getName() != null
         && (group.getName().equals("admin")
             || group.getName().equals("editor")
             || group.getName().equals("creator")
             || group.getName().equals("viewer")
             || group.getName().equals("poweruser")
             || group.getName().equals("publisher"))) {
       name.setEnabled(false);
       description.setEnabled(false);
     } else {
       name.setEnabled(true);
       description.setEnabled(true);
     }
   }
 }
  public void selectLayout() {

    BodyLayout_PersonalManager lcPM = new BodyLayout_PersonalManager();
    if (getParent().getParent().getParent().getParent().getClass().equals(lcPM.getClass())) {
      lcPM = (BodyLayout_PersonalManager) getParent().getParent().getParent().getParent();
      txtfldUsername.setValue(lcPM.txtfldUsername.getValue().toString());
      txtfldRuolo.setValue("PM");
    }

    BodyLayout_Administration lcAMM = new BodyLayout_Administration();
    if (getParent().getParent().getParent().getParent().getClass().equals(lcAMM.getClass())) {
      lcAMM = (BodyLayout_Administration) getParent().getParent().getParent().getParent();
      txtfldUsername.setValue(lcAMM.txtfldUsername.getValue().toString());
      txtfldRuolo.setValue("AMM");
    }

    BodyLayout_GestionePersonale lcGP = new BodyLayout_GestionePersonale();
    if (getParent().getParent().getParent().getParent().getClass().equals(lcGP.getClass())) {
      lcGP = (BodyLayout_GestionePersonale) getParent().getParent().getParent().getParent();
      txtfldUsername.setValue(lcGP.txtfldUsername.getValue().toString());
      txtfldRuolo.setValue("GP");
    }
    /*
    BodyLayout_UffAmministrazione lcUA = new BodyLayout_UffAmministrazione();
    if (getParent().getParent().getParent().getParent().getClass().equals(lcUA.getClass())) {
    	lcUA = (BodyLayout_UffAmministrazione) getParent().getParent().getParent().getParent();
    	txtfldUsername.setValue(lcUA.txtfldUsername.getValue().toString());
    	txtfldRuolo.setValue("UA");
    }
    */
    BodyLayout_Direzione lcDir = new BodyLayout_Direzione();
    if (getParent().getParent().getParent().getParent().getClass().equals(lcDir.getClass())) {
      lcDir = (BodyLayout_Direzione) getParent().getParent().getParent().getParent();
      txtfldUsername.setValue(lcDir.txtfldUsername.getValue().toString());
      txtfldRuolo.setValue("DIP");
    }
  }
Пример #9
0
  private void createForm() {
    FormLayout layout = new FormLayout();
    layout.setLabelAlign(LabelAlign.TOP);
    fp.setLayout(layout);
    fp.setFrame(false);
    fp.setHeaderVisible(false);
    fp.setAutoWidth(true);
    fp.setBodyBorder(true);
    fp.setButtonAlign(HorizontalAlignment.CENTER);

    eMail = new TextField<String>();
    eMail.setFieldLabel("E-mail address"); // ID
    eMail.setValue("*****@*****.**");
    eMail.setAllowBlank(false);

    eMail.setRegex("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$");
    fp.add(eMail);

    pass = new TextField<String>();
    pass.setPassword(true);
    pass.setValue("pass");
    pass.setFieldLabel("Password");
    fp.add(pass);

    fp.addButton(loginButton);
    fp.addButton(newAccountButton);

    loginButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {

            ArrayList eventData = new ArrayList();
            if (!eMail.isValid()) {
              eventData = new ArrayList();
              eventData.add("e-mail is invalid!");
              Dispatcher.get().dispatch(MainEvents.login, eventData);
              return;
            } else if (eMail.getValue() == null) {
              eventData = new ArrayList();
              eventData.add("Please enter your e-mail address!");
              Dispatcher.get().dispatch(MainEvents.login, eventData);
              return;
            } else if (pass.getValue() == null) {
              eventData = new ArrayList();
              eventData.add("Please enter the password!");
              Dispatcher.get().dispatch(MainEvents.login, eventData);
              return;
            } else service = (ServiceManagerWebServiceAsync) Registry.get("guiservice");

            String email = eMail.getValue();
            String password = pass.getValue();
            service.loginUser(
                email,
                password,
                new AsyncCallback<ArrayList<Object>>() {
                  public void onFailure(Throwable caught) {
                    System.out.println("loginUser: error");
                  }

                  public void onSuccess(ArrayList<Object> result) {
                    System.out.println("loginUser: success; result.get(0) = \n" + result.get(0));
                    System.out.println("loginUser: session_id = \n" + result.get(1));
                    session_id = (String) result.get(1);
                    ArrayList eventData = new ArrayList();
                    if (!result
                        .get(0)
                        .equals(
                            "User/pass are wrong! Please correct input data or register an account")) {
                      eventData.add("Please select the option");
                      eventData.add(result.get(0));
                      Dispatcher.get().dispatch(MainEvents.login, eventData);
                      fp.remove(eMail);
                      fp.remove(pass);
                      fp.clear();
                      remove(fp);
                      FormLayout layout = new FormLayout();
                      layout.setLabelAlign(LabelAlign.TOP);
                      fp = new FormPanel();
                      fp.setLayout(layout);
                      fp.setFrame(false);
                      fp.setHeaderVisible(false);
                      fp.setAutoWidth(true);
                      fp.setBodyBorder(true);
                      fp.setButtonAlign(HorizontalAlignment.CENTER);
                      fp.addText((String) result.get(0));
                      fp.addButton(logoutButton);
                      add(fp);
                    } else {
                      eventData.add("You need to log in");
                      eventData.add(result.get(0));
                      Dispatcher.get().dispatch(MainEvents.newAccount, eventData);
                    }

                    layout(true);
                  }
                });
          }
        });

    logoutButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            fp.clear();
            remove(fp);
            FormLayout layout = new FormLayout();
            layout.setLabelAlign(LabelAlign.TOP);
            fp = new FormPanel();
            fp.setLayout(layout);
            fp.setFrame(false);
            fp.setHeaderVisible(false);
            fp.setAutoWidth(true);
            fp.setBodyBorder(true);
            fp.setButtonAlign(HorizontalAlignment.CENTER);

            fp.add(eMail);
            fp.add(pass);
            fp.addButton(loginButton);
            fp.addButton(newAccountButton);
            add(fp);

            layout(true);

            ArrayList eventData = new ArrayList();
            eventData.add("You are logged out!");
            eventData.add("You are logged out, " + eMail.getValue() + "!");
            Dispatcher.get().dispatch(MainEvents.logout, eventData);

            service.logoutUser(
                session_id,
                eMail.getValue(),
                new AsyncCallback<Boolean>() {
                  public void onFailure(Throwable caught) {
                    System.out.println("logoutUser: error");
                  }

                  public void onSuccess(Boolean result) {
                    System.out.println("logoutUser: success");
                  }
                });
          }
        });

    newAccountButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            ArrayList eventData = new ArrayList();
            eventData.add("Please select the option");
            Dispatcher.get().dispatch(MainEvents.newAccount, eventData);
          }
        });

    /*
    skipButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
    	@Override
    	public void componentSelected(ButtonEvent ce) {
    		ArrayList eventData = new ArrayList();
    		eventData.add("Please select the option");
    		Dispatcher.get().dispatch(MainEvents.login, eventData);
    	}

    });
    */
    this.add(fp);
  }
Пример #10
0
 public void setNickOrEmail(final String nickOrEmail) {
   loginNickOrEmailField.setValue(nickOrEmail);
 }
Пример #11
0
 public void setLoginPassword(final String password) {
   loginPassField.setValue(password);
 }
  private List<ColumnConfig> createColumns() {
    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();

    column = new ColumnConfig();
    column.setId("nome");
    column.setHeader("Nominativo");
    column.setWidth(140);
    ListStore<PersonaleModel> store = new ListStore<PersonaleModel>();
    cmbxPersonale = new ComboBox<PersonaleModel>();
    cmbxPersonale.setStore(store);
    cmbxPersonale.setDisplayField("nomeCompleto");
    cmbxPersonale.setEmptyText("Selezionare..");
    cmbxPersonale.setEditable(true);
    cmbxPersonale.setVisible(true);
    cmbxPersonale.setTriggerAction(TriggerAction.ALL);
    cmbxPersonale.setForceSelection(true);
    cmbxPersonale.setAllowBlank(false);
    cmbxPersonale.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            getAllDipendenti();
          }

          private void getAllDipendenti() {
            AdministrationService.Util.getInstance()
                .getListaDipendentiModel(
                    "",
                    new AsyncCallback<List<PersonaleModel>>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        Window.alert("Errore connessione on getListaDipendentiModel();");
                        caught.printStackTrace();
                      }

                      @Override
                      public void onSuccess(List<PersonaleModel> result) {
                        if (result != null) {
                          ListStore<PersonaleModel> lista = new ListStore<PersonaleModel>();
                          lista.setStoreSorter(new StoreSorter<PersonaleModel>());
                          lista.setDefaultSort("nomeCompleto", SortDir.ASC);

                          lista.add(result);
                          cmbxPersonale.clear();
                          cmbxPersonale.setStore(lista);

                        } else Window.alert("error: Errore durante l'accesso ai dati Personale.");
                      }
                    });
          }
        });
    cmbxPersonale.addListener(
        Events.Select,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            int idPersonale = cmbxPersonale.getValue().get("idPersonale");

            csm.getSelectedItem().set("idPersonale", idPersonale);
          }
        });
    CellEditor editor =
        new CellEditor(cmbxPersonale) {
          @Override
          public Object preProcessValue(Object value) {
            if (value == null) {
              return value;
            }
            return cmbxPersonale.getValue();
          }

          @Override
          public Object postProcessValue(Object value) {
            if (value == null) {
              return value;
            }
            return ((ModelData) value).get("nomeCompleto");
          }
        };
    column.setEditor(editor);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("tipoOrario");
    column.setHeader("Orario Giornaliero");
    column.setWidth(50);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoAnnuo");
    column.setHeader("Costo Annuo");
    column.setWidth(100);
    txtfldcostoAnno = new TextField<String>();
    txtfldcostoAnno.setValue("0.00");
    txtfldcostoAnno.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldcostoAnno.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldcostoAnno.getValue() == null) txtfldcostoAnno.setValue("0.00");
              else {
                String valore = txtfldcostoAnno.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldcostoAnno.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldcostoAnno));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("orePreviste");
    column.setHeader("Ore Previste");
    column.setWidth(100);
    txtfldoreAnno = new TextField<String>();
    txtfldoreAnno.setValue("0");
    txtfldoreAnno.setRegex("^([0-9]+)");
    txtfldoreAnno.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldoreAnno.getValue() == null) txtfldoreAnno.setValue("0");
              else {
                String valore = txtfldoreAnno.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0";

                txtfldoreAnno.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldoreAnno));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoOrario");
    column.setHeader("Costo Orario");
    column.setWidth(100);
    txtfldcostoOrario = new TextField<String>();
    txtfldcostoOrario.setValue("0.00");
    txtfldcostoOrario.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldcostoOrario.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldcostoOrario.getValue() == null) txtfldcostoOrario.setValue("0.00");
              else {
                String valore = txtfldcostoOrario.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldcostoOrario.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldcostoOrario));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoTrasferta");
    column.setHeader("Costo Trasferta");
    column.setWidth(100);
    txtfldcostoTrasferta = new TextField<String>();
    txtfldcostoTrasferta.setValue("0.00");
    txtfldcostoTrasferta.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldcostoTrasferta.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldcostoTrasferta.getValue() == null) txtfldcostoTrasferta.setValue("0.00");
              else {
                String valore = txtfldcostoTrasferta.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldcostoTrasferta.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldcostoTrasferta));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoStruttura");
    column.setHeader("Costo Struttura");
    column.setWidth(100);
    txtfldCostoStruttura = new TextField<String>();
    txtfldCostoStruttura.setValue("0.00");
    txtfldCostoStruttura.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoStruttura.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoStruttura.getValue() == null) txtfldCostoStruttura.setValue("0.00");
              else {
                String valore = txtfldCostoStruttura.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoStruttura.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoStruttura));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoOneri");
    column.setHeader("Costo Oneri");
    column.setWidth(100);
    txtfldCostoOneri = new TextField<String>();
    txtfldCostoOneri.setValue("0.00");
    txtfldCostoOneri.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoOneri.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoOneri.getValue() == null) txtfldCostoOneri.setValue("0.00");
              else {
                String valore = txtfldCostoOneri.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoOneri.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoOneri));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoSw");
    column.setHeader("Costo SW");
    column.setWidth(100);
    txtfldCostoSoftware = new TextField<String>();
    txtfldCostoSoftware.setValue("0.00");
    txtfldCostoSoftware.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoSoftware.addKeyListener(
        new KeyListener() {
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoSoftware.getValue() == null) txtfldCostoSoftware.setValue("0.00");
              else {
                String valore = txtfldCostoSoftware.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoSoftware.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoSoftware));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoHw");
    column.setHeader("Costo HW");
    column.setWidth(100);
    txtfldCostoHardware = new TextField<String>();
    txtfldCostoHardware.setValue("0.00");
    txtfldCostoHardware.setRegex("^([0-9]+).([0-9]{1,2})$");
    txtfldCostoHardware.addKeyListener(
        new KeyListener() {

          /*	public void componentKeyUp(ComponentEvent event) {
          	txtfldNumeroOreResidue.setValue(txtfldNumeroOre.getValue());
          }
          */
          public void componentKeyDown(ComponentEvent event) {
            int keyCode = event.getKeyCode();
            if (keyCode == 9) {

              if (txtfldCostoHardware.getValue() == null) txtfldCostoHardware.setValue("0.00");
              else {
                String valore = txtfldCostoHardware.getValue().toString();

                if (valore.compareTo("") == 0) valore = "0.00";
                else if (valore.indexOf(".") == -1) valore = valore + ".00";
                else {
                  int index = valore.indexOf(".");
                  int length = valore.length();

                  if (valore.substring(index + 1, length).length() == 1) valore = valore + "0";
                  else if (valore.substring(index + 1, length).length() == 0)
                    valore = valore + "00";
                }
                txtfldCostoHardware.setValue(valore);
              }
            }
          }
        });
    column.setEditor(new CellEditor(txtfldCostoHardware));
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoHwSw");
    column.setHeader("Costo HwSw");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("costoOrarioTotale");
    column.setHeader("CostoTot/h");
    column.setWidth(100);
    configs.add(column);

    column = new ColumnConfig();
    column.setId("gruppoLavoro");
    column.setHeader("Area");
    column.setWidth(160);
    configs.add(column);

    return configs;
  }
Пример #13
0
  private void displayRecords(UserWeb user) {

    // Name
    userName.setValue(user.getUsername());
    firstName.setValue(user.getFirstName());
    lastName.setValue(user.getLastName());

    passwordHint.setValue(user.getPasswordHint());

    // Address
    address.setValue(user.getAddress());
    city.setValue(user.getCity());
    for (State st : states.getModels()) {
      if (st.getAbbr().equals(user.getState())) state.setValue(st);
    }
    zip.setValue(user.getPostalCode());
    for (Country co : countries.getModels()) {
      if (co.getName().equals(user.getCountry())) country.setValue(co);
    }

    // Phone
    phoneNumber.setValue(user.getPhoneNumber());

    // Other
    email.setValue(user.getEmail());
    emailConfirm.setValue(user.getEmail());
    webSite.setValue(user.getWebsite());
  }
Пример #14
0
  private void update() {
    if (m_selectNetIfConfig != null) {
      Log.debug(
          "in update(): got new netIfConfig for DHCP server for "
              + m_selectNetIfConfig.getName()
              + ": "
              + "\n\t\trouter mode: "
              + m_selectNetIfConfig.getRouterMode()
              + "\n\t\trouter DHCP start address: "
              + m_selectNetIfConfig.getRouterDhcpBeginAddress()
              + "\n\t\trouter DHCP end address: "
              + m_selectNetIfConfig.getRouterDhcpEndAddress()
              + "\n\t\trouter default lease: "
              + Integer.toString(m_selectNetIfConfig.getRouterDhcpDefaultLease())
              + "\n\t\trouter max lease: "
              + Integer.toString(m_selectNetIfConfig.getRouterDhcpMaxLease())
              + "\n\t\trouter Pass DNS: "
              + Boolean.toString(m_selectNetIfConfig.getRouterDnsPass()));

      m_modeCombo.setSimpleValue(MessageUtils.get(m_selectNetIfConfig.getRouterMode()));
      m_modeCombo.setOriginalValue(m_modeCombo.getValue());

      m_dhcpBeginAddressField.setValue(m_selectNetIfConfig.getRouterDhcpBeginAddress());
      m_dhcpBeginAddressField.setOriginalValue(m_dhcpBeginAddressField.getValue());

      m_dhcpEndAddressField.setValue(m_selectNetIfConfig.getRouterDhcpEndAddress());
      m_dhcpEndAddressField.setOriginalValue(m_dhcpEndAddressField.getValue());

      m_dhcpSubnetMaskField.setValue(m_selectNetIfConfig.getRouterDhcpSubnetMask());
      m_dhcpSubnetMaskField.setOriginalValue(m_dhcpSubnetMaskField.getValue());

      m_dhcpLeaseDefaultField.setValue(m_selectNetIfConfig.getRouterDhcpDefaultLease());
      m_dhcpLeaseDefaultField.setOriginalValue(m_dhcpLeaseDefaultField.getValue());

      m_dhcpLeaseMaxField.setValue(m_selectNetIfConfig.getRouterDhcpMaxLease());
      m_dhcpLeaseMaxField.setOriginalValue(m_dhcpLeaseMaxField.getValue());

      if (m_selectNetIfConfig.getRouterDnsPass()) {
        m_passDnsRadioTrue.setValue(true);
        m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue());

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

        m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioTrue);
        m_passDnsRadioGroup.setValue(m_passDnsRadioGroup.getValue());
      } else {
        m_passDnsRadioTrue.setValue(false);
        m_passDnsRadioTrue.setOriginalValue(m_passDnsRadioTrue.getValue());

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

        m_passDnsRadioGroup.setOriginalValue(m_passDnsRadioFalse);
        m_passDnsRadioGroup.setValue(m_passDnsRadioGroup.getValue());
      }
    } else {
      Log.debug("selected Network Interface Config is null");
    }

    for (Field<?> field : m_formPanel.getFields()) {
      FormUtils.removeDirtyFieldIcon(field);
    }

    refreshForm();
  }
Пример #15
0
 @Override
 public void setValue(Object value) {
   field.setValue((String) value);
   fireUpdate();
 }