Exemplo n.º 1
0
  @Override
  protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(10);

    Button btn = new Button("Basic");
    btn.setToolTip(new ToolTipConfig("Information", "Prints the current document"));
    hp.add(btn);

    btn = new Button("Closable");
    ToolTipConfig config = new ToolTipConfig();
    config.setTitle("Information");
    config.setText("Prints the current document");
    config.setCloseable(true);
    btn.setToolTip(config);
    hp.add(btn);

    btn = new Button("Mouse Tracking");
    config = new ToolTipConfig();
    config.setTitle("Information");
    config.setText("Prints the current document");
    config.setTrackMouse(true);
    btn.setToolTip(config);
    hp.add(btn);

    btn = new Button("Anchor");
    config = new ToolTipConfig();
    config.setTitle("Information");
    config.setText("Prints the current document");
    config.setMouseOffset(new int[] {0, 0});
    config.setAnchor("left");
    btn.setToolTip(config);
    hp.add(btn);

    btn = new Button("Custom");
    config = new ToolTipConfig();
    config.setText("Prints the current document");
    config.setTitle("Template Tip");
    config.setMouseOffset(new int[] {0, 0});
    config.setAnchor("left");
    config.setTemplate(new Template(getTemplate()));
    config.setCloseable(true);
    config.setMaxWidth(415);
    btn.setToolTip(config);
    hp.add(btn);

    add(hp);
  }
Exemplo n.º 2
0
  private Button addChartButton() {
    Button addChartButton = new Button(" Add Chart");
    addChartButton.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.lineChart()));
    addChartButton.setToolTip("Add another chart");

    addChartButton.addListener(Events.OnClick, new AddChartBaseEventListener());
    return addChartButton;
  }
  /** Inits the save and export buttons on applicationToolBar. */
  private void initSaveAndExportButtons() {
    saveButton = new Button();
    saveButton.setIcon(icons.saveIcon());
    saveButton.setToolTip("Save");
    saveButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            uiDesignerPresenter.saveUiDesignerLayout();
          }
        });

    exportButton = new Button();
    exportButton.setIcon(icons.exportAsZipIcon());
    exportButton.setToolTip("Export as zip");
    exportButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (!isExportedDataValid()) {
              MessageBox.info("Info", "Nothing to export.", null);
              return;
            }
            viewport.mask("Exporting, please wait.");
            UtilsProxy.exportFiles(
                IDUtil.currentID(),
                uiDesignerPresenter.getAllPanels(),
                new AsyncSuccessCallback<String>() {
                  @Override
                  public void onSuccess(String exportURL) {
                    viewport.unmask();
                    Window.open(exportURL, "_blank", "");
                  }
                });
          }
        });
  }
 /**
  * Creates the logout button for the user logout the application.
  *
  * @return the button
  */
 private Button createLogoutButton() {
   String currentUserName =
       (this.authority == null) ? "" : "(" + this.authority.getUsername() + ")";
   Button logoutButton = new Button();
   logoutButton.setIcon(icons.logout());
   logoutButton.setToolTip("Logout" + currentUserName);
   logoutButton.addSelectionListener(
       new SelectionListener<ButtonEvent>() {
         @Override
         public void componentSelected(ButtonEvent ce) {
           Window.open("j_security_logout", "_self", "");
         }
       });
   return logoutButton;
 }
 /**
  * Creates the button to pop up the account management window.
  *
  * @return the button
  */
 private Button createAccountManageButton() {
   Button accountManageBtn = new Button();
   accountManageBtn.setToolTip("Account management");
   accountManageBtn.setIcon(icons.userIcon());
   accountManageBtn.addSelectionListener(
       new SelectionListener<ButtonEvent>() {
         public void componentSelected(ButtonEvent ce) {
           AsyncServiceFactory.getUserRPCServiceAsync()
               .getUserId(
                   new AsyncSuccessCallback<Long>() {
                     public void onSuccess(Long currentUserId) {
                       new AccountManageWindow(currentUserId);
                     }
                   });
         }
       });
   return accountManageBtn;
 }
  private Button createDeleteButton() {
    Button button =
        new Button(
            "",
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                FeatureInjector injector = FeatureInjector.MainInjector.getInstance();
                GPEventBus bus = injector.getEventBus();
                bus.fireEvent(
                    new DeleteAttributeConditionEvent(FeatureAttributeConditionField.this));
              }
            });
    button.setToolTip("Delete Condition");
    button.setIcon(BasicWidgetResources.ICONS.delete());
    button.setAutoWidth(true);

    return button;
  }
 /**
  * Creates the button that can pop up the testOnline dialog.
  *
  * @return the button
  */
 private Button createOnLineTestBtn() {
   final Button showDemoBtn = new Button();
   showDemoBtn.setToolTip("Test UI online in your panel. ");
   showDemoBtn.setIcon(icons.onLineTestIcon());
   showDemoBtn.addSelectionListener(
       new SelectionListener<ButtonEvent>() {
         public void componentSelected(ButtonEvent ce) {
           UtilsProxy.getOnTestLineURL(
               new AsyncSuccessCallback<String>() {
                 @Override
                 public void onSuccess(String result) {
                   Dialog dialog = new Dialog();
                   dialog.setHideOnButtonClick(true);
                   dialog.setButtonAlign(HorizontalAlignment.CENTER);
                   dialog.setClosable(false);
                   dialog.setBodyBorder(false);
                   dialog.setHeading("Test UI Online");
                   dialog.setWidth(310);
                   dialog.setAutoHeight(true);
                   Text text = new Text();
                   text.setWidth("100%");
                   text.setStyleAttribute("backgroundColor", "CCD9E8");
                   text.setText(
                       "To test your UI without installing any Controller or deploying configuration, "
                           + "type the following URL into your panel setting as Controller URL :");
                   TextField<String> url = new TextField<String>();
                   url.setWidth("100%");
                   url.setValue(result);
                   url.setReadOnly(true);
                   dialog.add(text);
                   dialog.add(url);
                   dialog.show();
                 }
               });
         }
       });
   return showDemoBtn;
 }
  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);
  }
    CreateFormIntervalliOre() {

      setLabelWidth(30);
      setFrame(true);
      setButtonAlign(HorizontalAlignment.CENTER);
      setHeading("Dettaglio Ore.");
      setHeaderVisible(false);
      setWidth(700);
      setHeight(95);
      setStyleAttribute("padding-left", "10px");
      setStyleAttribute("padding-top", "10px");
      setBorders(false);

      Date retVal = null;
      try {
        retVal = DateTimeFormat.getFormat("dd-MM-yyyy").parse(01 + "-" + 03 + "-" + 2013);
      } catch (Exception e) {
        retVal = null;
      }

      giornoRiferimento.setValue(new Date());
      giornoRiferimento.setMinValue(retVal);
      giornoRiferimento.setItemId("data");
      dtfldGiorno.setValue(giornoRiferimento.getValue());

      ListStore<PersonaleModel> store = new ListStore<PersonaleModel>();
      cmbxDipendente.setStore(store);
      cmbxDipendente.setFieldLabel("Dipendente");
      cmbxDipendente.setEnabled(true);
      cmbxDipendente.setEmptyText("Selezionare il dipendente..");
      cmbxDipendente.setEditable(false);
      cmbxDipendente.setVisible(true);
      cmbxDipendente.setTriggerAction(TriggerAction.ALL);
      cmbxDipendente.setAllowBlank(false);
      cmbxDipendente.setDisplayField("nomeCompleto");
      cmbxDipendente.addListener(
          Events.OnClick,
          new Listener<BaseEvent>() {
            @Override
            public void handleEvent(BaseEvent be) {
              getAllDipendenti();
            }
          });

      ButtonBar buttonBarTop = new ButtonBar();
      buttonBarTop.setAlignment(HorizontalAlignment.CENTER);
      buttonBarTop.setStyleAttribute("padding-bottom", "5px");
      buttonBarTop.setBorders(false);
      buttonBarTop.setWidth(570);
      buttonBarTop.setItemId("buttonBar");

      // buttonBarTop.add(btnPrev);
      buttonBarTop.add(giornoRiferimento);
      buttonBarTop.add(cmbxDipendente);
      buttonBarTop.add(btnSend);
      // buttonBarTop.add(btnNext);

      btnInviaCommenti.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.escl1()));
      btnInviaCommenti.setToolTip("Segnala eventuali problemi o anomalie.");
      btnInviaCommenti.setSize(26, 26);
      btnInviaCommenti.setIconAlign(IconAlign.TOP);
      btnInviaCommenti.addSelectionListener(
          new SelectionListener<ButtonEvent>() {
            @Override
            public void componentSelected(ButtonEvent ce) {
              Dialog d = new DialogInvioCommenti(txtfldUsername.getValue().toString(), new Date());
              d.show();
            }
          });

      btnRiepilogoCommesse.setEnabled(true);
      btnRiepilogoCommesse.setSize(26, 26);
      btnRiepilogoCommesse.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.riep_comm()));
      btnRiepilogoCommesse.setToolTip("Riepilogo Commesse");
      btnRiepilogoCommesse.addSelectionListener(
          new SelectionListener<ButtonEvent>() {

            @Override
            public void componentSelected(ButtonEvent ce) {
              /*Dialog d= new Dialog();
              d.setHeaderVisible(true);
              d.setHeading("Riepilogo dettagliato (Commesse).");
              d.setSize(550, 605);
              d.add(new PanelRiepilogoGiornalieroCommesse(txtfldUsername.getValue().toString(), giornoRiferimento.getValue()));
              d.setButtons("");
              d.show();*/
              Date data = dtfldGiorno.getValue();
              Dialog d = new Dialog();
              d.setHeaderVisible(true);
              d.setConstrain(false);
              d.setHeading("Riepilogo dettagliato (Commesse).");
              d.setSize(1500, 650);
              d.add(
                  new PanelRiepilogoMeseGiornalieroCommesseHorizontal(
                      0,
                      txtfldUsername.getValue().toString(),
                      data,
                      "0.00",
                      "0.00",
                      "0.00",
                      "0.00"));
              d.setButtons("");
              d.show();
            }
          });

      frm.setHeaderVisible(false);
      frm.setBorders(false);
      frm.setItemId("formPanel");
      frm.setWidth(1060);
      frm.setHeight(890);
      frm.setStyleAttribute("padding-left", "0px");
      frm.setStyleAttribute("padding-top", "0px");
      frm.setScrollMode(Scroll.AUTO);

      main.setLayout(new ColumnLayout());
      main.setBorders(false);
      main.setStyleAttribute("margin-top", "-10px");
      main.setItemId("main");

      left.setStyleAttribute("padding-left", "10px");
      FormLayout layout = new FormLayout();
      left.setLayout(layout);
      left.setItemId("left");

      right.setStyleAttribute("padding-left", "30px");
      layout = new FormLayout();
      right.setLayout(layout);
      right.setItemId("right");

      ButtonBar btnBarOperazioni = new ButtonBar();
      btnBarOperazioni.setHeight(28);
      btnBarOperazioni.setAlignment(HorizontalAlignment.LEFT);
      btnBarOperazioni.setBorders(false);
      btnBarOperazioni.add(btnRiepilogoCommesse);
      btnBarOperazioni.add(btnInviaCommenti);
      btnBarOperazioni.add(btnConferma);

      left.add(btnBarOperazioni);
      left.add(buttonBarTop);

      main.add(left);
      frm.add(main);
      frm.layout(true);
      add(frm);

      btnSend.setSize(26, 26);
      btnSend.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.reload()));
      btnSend.setToolTip("Carica Dati");
      btnSend.addSelectionListener(
          new SelectionListener<ButtonEvent>() {
            @Override
            public void componentSelected(ButtonEvent ce) {
              txtfldUsername.setValue(
                  cmbxDipendente
                      .getValue()
                      .get("username")
                      .toString()); // setto il valore globale dell'username per il caricamento dei
                                    // vari fieldset
              dtfldGiorno.setValue(
                  giornoRiferimento
                      .getValue()); // setto il valore globale della data con la data selezionata
              reloadFoglioOre();
            }
          });

      // btnConferma.setSize(46, 46);
      btnConferma.setIcon(AbstractImagePrototype.create(MyImages.INSTANCE.saveLittle()));
      btnConferma.setIconAlign(IconAlign.TOP);
      btnConferma.setToolTip("Conferma");
      btnConferma.setSize(26, 26);
      btnConferma.addSelectionListener(
          new SelectionListener<ButtonEvent>() {

            @Override
            public void componentSelected(ButtonEvent ce) {

              if (frm.isValid()) {
                String username = new String();
                Date giorno = new Date();
                DateField dtfld = new DateField();

                username = cmbxDipendente.getValue().get("username");
                List<IntervalliCommesseModel> intervalliC =
                    new ArrayList<IntervalliCommesseModel>();

                FldsetIntervalliCommesse fldSetIntervalliC;
                LayoutContainer lc = new LayoutContainer();
                LayoutContainer lcR = new LayoutContainer();
                ButtonBar bttnBar = new ButtonBar();

                lc = (LayoutContainer) frm.getItemByItemId("main");
                // Intervalli IU
                lc = (LayoutContainer) lc.getItemByItemId("left");

                // Data
                bttnBar = (ButtonBar) lc.getItemByItemId("buttonBar");
                dtfld = (DateField) bttnBar.getItemByItemId("data");
                giorno = dtfld.getValue();

                // Intervalli Comm
                fldSetIntervalliC =
                    (FldsetIntervalliCommesse) lc.getItemByItemId("fldSetIntervalliC");
                if (fldSetIntervalliC.getItemCount() > 1)
                  intervalliC = elaboraIntervalliC(fldSetIntervalliC);

                // Giustificativi
                lcR = (LayoutContainer) frm.getItemByItemId("main");
                lcR = (LayoutContainer) lcR.getItemByItemId("right");

                // txtfldOreTotali=fldSetGiustificativi.txtfldOreTotEffettive;

                AdministrationService.Util.getInstance()
                    .insertFoglioOreGiorno(
                        username,
                        giorno,
                        intervalliC,
                        new AsyncCallback<Boolean>() {

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

                          @Override
                          public void onSuccess(Boolean result) {
                            if (result) {
                              Window.alert("Caricamento avvenuto con successo.");
                              reloadFoglioOre();
                            } else {
                              Window.alert("error: Impossibile salvare i dati!");
                            }
                          }
                        });
              }
            }
          });
    }
Exemplo n.º 10
0
 public static void setSmallButton(Button button, ImageResource resource, String text) {
   setBtnIcon(button, resource);
   button.setToolTip(text);
   button.setScale(Style.ButtonScale.SMALL);
   setTestId(button, text);
 }
Exemplo n.º 11
0
  @Override
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    layout.setPadding(new Padding(2, 17, 1, 10)); // DIM
    layout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
    c.setLayout(layout);
    c.setLayoutOnChange(true);
    c.setAutoHeight(false);
    c.setAutoWidth(false);

    left.setIcon(AbstractImagePrototype.create(AzzeroCO2Resources.INSTANCE.left()));
    left.setIconAlign(Style.IconAlign.LEFT);
    left.setSize(32, 32);
    left.setText("");
    left.setToolTip("");
    left.setTitle("");
    left.setEnabled(false);
    left.setVisible(false);

    left.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            Dispatcher.forwardEvent(new AppEvent(UnAnnoDiAttivitaEvents.Previous, ce));
          }
        });
    c.add(left, new HBoxLayoutData(new Margins(0, 0, 0, 0)));

    flex.setFlex(1);
    c.add(leftText, flex);

    leftText.setSize(200, 15);
    rigthText.setSize(250, 15);
    rigthText.setStyleAttribute("text-align", "right");
    rigthText.setStyleAttribute("font-family", "arial");
    leftText.setStyleAttribute("font-family", "arial");
    leftText.setStyleAttribute("font-size", "14px");
    rigthText.setStyleAttribute("font-size", "14px");

    c.add(rigthText, new HBoxLayoutData(new Margins(0, 5, 0, 0)));

    right.setIconAlign(Style.IconAlign.RIGHT);
    //  right.setText("Energia");
    right.setIcon(AbstractImagePrototype.create(AzzeroCO2Resources.INSTANCE.rigth()));
    right.setSize(32, 32);
    right.setTitle("");
    right.setText("");
    right.setToolTip("");

    c.add(right, new HBoxLayoutData(new Margins(0, 0, 0, 0)));
    right.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (rigthText.getText().equalsIgnoreCase("torna alla home")) {
              Dispatcher.forwardEvent(CentralEvents.ShowPanel, Eventi.MAIN);
            } else {
              Dispatcher.forwardEvent(new AppEvent(UnAnnoDiAttivitaEvents.Next, ce));
            }
          }
        });
    add(c);
  }