private SimpleComboBox<String> getVersionComboBox() {
    if (versionComboBox == null) {
      versionComboBox = new SimpleComboBox<String>();
      versionComboBox.setWidth("187px");
      versionComboBox.setAllowBlank(false);
      versionComboBox.setEditable(false);
      versionComboBox.setFieldLabel("Version");
      versionComboBox.setValidator(
          new Validator() {

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

              if (value.equals(NOT_AVAILABLE_STRING)) {
                return "The specified application is not available for the selected group.";
              }

              return null;
            }
          });
      // versionComboBox.addListener(Events.Valid, new
      // Listener<BaseEvent>() {
      //
      // public void handleEvent(BaseEvent be) {
      //
      // System.out.println("Event: "+versionComboBox.getSimpleValue());
      //
      // }
      // });
    }
    return versionComboBox;
  }
 private SimpleComboBox<Integer> getMinutesComboBox() {
   if (minutesComboBox == null) {
     minutesComboBox = new SimpleComboBox<Integer>();
     minutesComboBox.setAllowBlank(false);
     minutesComboBox.setFieldLabel("Minutes");
     minutesComboBox.add(15);
     minutesComboBox.add(30);
     minutesComboBox.add(45);
     minutesComboBox.setSimpleValue(15);
   }
   return minutesComboBox;
 }
  private SimpleComboBox<String> getVoComboBox() {
    if (voComboBox == null) {
      voComboBox = new SimpleComboBox<String>();
      voComboBox.setAllowBlank(false);
      voComboBox.setForceSelection(true);
      voComboBox.setEditable(false);
      voComboBox.setFieldLabel("Submit as");
      voComboBox.addListener(
          Events.Valid,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {

              //					xxx

              fillVersionsComboBox();
              String fqan = voComboBox.getSimpleValue();
              if (fqan != null && !"".equals(fqan)) {
                UserEnvironment.getInstance().setUserProperty(Constants.DEFAULT_FQAN, fqan);
              }
            }
          });

      String lastFqan = UserEnvironment.getInstance().getUserProperty(Constants.DEFAULT_FQAN);
      boolean useLastFqan = false;
      String firstValue = null;
      for (String vo : UserEnvironment.getInstance().getAllFqans()) {

        // I know, I know.
        if ("/ARCS".equals(vo)) {
          continue;
        }
        if (firstValue == null) {
          firstValue = vo;
        }
        if (vo.equals(lastFqan)) {
          useLastFqan = true;
        }
        voComboBox.add(vo);
      }

      //			if (useLastFqan) {
      //				voComboBox.setSimpleValue(lastFqan);
      //			} else {
      //				voComboBox.setSimpleValue(firstValue);
      //			}
    }
    return voComboBox;
  }
 private SimpleComboBox<Integer> getHoursComboBox() {
   if (hoursComboBox == null) {
     hoursComboBox = new SimpleComboBox<Integer>();
     hoursComboBox.setAllowBlank(false);
     hoursComboBox.setFieldLabel("Hours");
     hoursComboBox.add(0);
     hoursComboBox.add(1);
     hoursComboBox.add(2);
     hoursComboBox.add(4);
     hoursComboBox.add(8);
     hoursComboBox.add(12);
     hoursComboBox.add(18);
     hoursComboBox.setSimpleValue(0);
   }
   return hoursComboBox;
 }
 private SimpleComboBox<Integer> getCpusComboBox() {
   if (cpusComboBox == null) {
     cpusComboBox = new SimpleComboBox<Integer>();
     cpusComboBox.setAllowBlank(false);
     cpusComboBox.setFieldLabel("No. CPUs");
     cpusComboBox.add(1);
     cpusComboBox.add(2);
     cpusComboBox.add(4);
     cpusComboBox.add(8);
     cpusComboBox.add(16);
     cpusComboBox.add(32);
     cpusComboBox.add(64);
     cpusComboBox.add(128);
     cpusComboBox.setSimpleValue(1);
   }
   return cpusComboBox;
 }
 private SimpleComboBox<Integer> getDaysComboBox() {
   if (daysComboBox == null) {
     daysComboBox = new SimpleComboBox<Integer>();
     daysComboBox.setAllowBlank(false);
     daysComboBox.setFieldLabel("Days");
     daysComboBox.add(0);
     daysComboBox.add(1);
     daysComboBox.add(2);
     daysComboBox.add(3);
     daysComboBox.add(4);
     daysComboBox.add(7);
     daysComboBox.add(14);
     daysComboBox.add(21);
     daysComboBox.setSimpleValue(0);
   }
   return daysComboBox;
 }
  // ******************************************************
  // Method: getPanel
  //
  // ******************************************************
  private FormPanel getPanel() {
    FormLayout formLayout = new FormLayout(LabelAlign.LEFT);
    formLayout.setLabelWidth(160);

    FormPanel formPanel = new FormPanel();
    formPanel.setHeight(350);
    formPanel.setLayout(formLayout);
    formPanel.setPadding(10);
    formPanel.setFrame(false);
    formPanel.setBorders(false);
    formPanel.setBodyBorder(false);
    formPanel.setHeaderVisible(false);

    FormData formData = new FormData("95%");

    availableJndiNamesComboBox = new SimpleComboBox<String>();
    availableJndiNamesComboBox.add("FIT_DATA_TEST");
    availableJndiNamesComboBox.add("FIT_SOURCE_TEST");
    availableJndiNamesComboBox.add("FIT_CONFIG_TEST");
    availableJndiNamesComboBox.setAllowBlank(false);
    availableJndiNamesComboBox.setForceSelection(true);
    availableJndiNamesComboBox.setEditable(false);
    availableJndiNamesComboBox.setTriggerAction(TriggerAction.ALL);
    availableJndiNamesComboBox.setFieldLabel("Source JNDI*");
    availableJndiNamesComboBox.setSimpleValue("FIT_CONFIG_TEST");
    formPanel.add(availableJndiNamesComboBox, formData);

    sourceSqlQueryTextArea = new TextArea();
    sourceSqlQueryTextArea.setFieldLabel("Sql Query*");
    sourceSqlQueryTextArea.setAllowBlank(false);
    formPanel.add(sourceSqlQueryTextArea, new FormData(314, 200));

    setupRulesCheckBox = new CheckBox();
    setupRulesCheckBox.setFieldLabel("Setup Rules?");
    setupRulesCheckBox.setBoxLabel("");
    formPanel.add(setupRulesCheckBox, formData);
    return formPanel;
  }
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    final FitLayout fl = new FitLayout();

    LayoutContainer layoutContainer = new LayoutContainer();
    layoutContainer.setBorders(false);
    layoutContainer.setLayout(fl);

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(3);

    ContentPanel cpGrid = new ContentPanel();
    cpGrid.setHeaderVisible(true);
    cpGrid.setHeading("Lista Dipendenti.");
    cpGrid.setBorders(false);
    cpGrid.setFrame(true);
    cpGrid.setHeight((h - 65));
    cpGrid.setWidth(w - 250);
    cpGrid.setScrollMode(Scroll.AUTO);
    cpGrid.setLayout(new FitLayout());
    cpGrid.setButtonAlign(HorizontalAlignment.CENTER);
    Resizable r = new Resizable(cpGrid);

    btnPrint = new Button();
    btnPrint.setEnabled(true);
    btnPrint.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.print24()));
    btnPrint.setIconAlign(IconAlign.TOP);
    btnPrint.setToolTip("Stampa");
    btnPrint.setSize(26, 26);
    btnPrint.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            SessionManagementService.Util.getInstance()
                .setDatiReportCostiDip(
                    "RIEP.COSTI",
                    store.getModels(),
                    new AsyncCallback<Boolean>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        Window.alert("Error on setNomeReport()");
                      }

                      @Override
                      public void onSuccess(Boolean result) {
                        if (result) fp.submit();
                        else
                          Window.alert(
                              "Problemi durante il settaggio dei parametri in Sessione (http)");
                      }
                    });
          }
        });

    btnAdd = new Button();
    btnAdd.setStyleAttribute("padding-left", "2px");
    btnAdd.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.add()));
    btnAdd.setIconAlign(IconAlign.TOP);
    btnAdd.setSize(26, 26);
    btnAdd.setToolTip("Nuova Offerta");
    btnAdd.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            RiepilogoCostiDipendentiModel am =
                new RiepilogoCostiDipendentiModel(
                    0, 0, "", "0.00", "", "0", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "",
                    "", "");

            gridRiepilogo.stopEditing();
            store.insert(am, 0);
            gridRiepilogo.startEditing(store.indexOf(am), 0);
          }
        });

    btnConfirm = new Button();
    btnConfirm.setEnabled(true);
    btnConfirm.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.confirm()));
    btnConfirm.setIconAlign(IconAlign.TOP);
    btnConfirm.setToolTip("Conferma modifiche");
    btnConfirm.setSize(26, 26);
    btnConfirm.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {

            RiepilogoCostiDipendentiModel c = new RiepilogoCostiDipendentiModel();

            for (Record record : store.getModifiedRecords()) {

              c = (RiepilogoCostiDipendentiModel) record.getModel();

              AdministrationService.Util.getInstance()
                  .editDatiCostiAzienda(
                      c,
                      new AsyncCallback<Boolean>() {

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

                        @Override
                        public void onSuccess(Boolean result) {
                          if (result) {
                            caricaTabellaDati();
                          } else {
                            Window.alert(
                                "error: Impossibile effettuare l'inserimento/modifica dei dati!");
                          }
                        }
                      });
            }
          }
        });

    if ((ruolo.compareTo("PM") == 0)) {
      btnConfirm.disable();
      btnAdd.disable();
    }

    smplcmbxSede = new SimpleComboBox<String>();
    smplcmbxSede.setFieldLabel("Sede");
    smplcmbxSede.setWidth(65);
    smplcmbxSede.setEmptyText("Sede..");
    smplcmbxSede.setAllowBlank(false);
    smplcmbxSede.add("T");
    smplcmbxSede.add("B");
    smplcmbxSede.setStyleAttribute("padding-left", "2px");
    smplcmbxSede.addListener(
        Events.Select,
        new Listener<BaseEvent>() {
          @Override
          public void handleEvent(BaseEvent be) {
            caricaTabellaDati();
          }
        });

    // caricaTabellaDati();

    cm = new ColumnModel(createColumns());
    gridRiepilogo = new EditorGrid<RiepilogoCostiDipendentiModel>(store, cm);
    gridRiepilogo.setBorders(false);
    gridRiepilogo.setColumnLines(true);
    gridRiepilogo.setStripeRows(true);
    gridRiepilogo.setItemId("grid");
    gridRiepilogo.setSelectionModel(csm);

    fp.setMethod(FormPanel.METHOD_POST);
    fp.setAction(url);
    fp.addSubmitCompleteHandler(new FormSubmitCompleteHandler());
    fp.add(btnPrint);
    ContentPanel cp = new ContentPanel();
    cp.setHeaderVisible(false);
    cp.add(fp);

    ToolBar tlBar = new ToolBar();
    tlBar.add(smplcmbxSede);
    tlBar.add(btnAdd);
    tlBar.add(btnConfirm);
    tlBar.add(new SeparatorToolItem());
    tlBar.add(cp);

    cpGrid.setTopComponent(tlBar);
    cpGrid.add(gridRiepilogo);

    layoutContainer.add(cpGrid, new FitData(3, 3, 3, 3));

    add(layoutContainer);
  }