private ContentPanel createMixed() {
    ContentPanel panel = new SamplePanel();
    panel.setHeading("Mix and match icon sizes");

    ToolBar toolBar = new ToolBar();
    panel.setTopComponent(toolBar);

    ButtonGroup group = new ButtonGroup(3);
    group.setHeading("Clipboard");
    toolBar.add(group);

    Button btn = new Button("Paste", Resources.ICONS.add32());
    btn.addStyleName("x-btn-as-arrow");
    btn.setScale(ButtonScale.LARGE);
    btn.setIconAlign(IconAlign.TOP);
    btn.setArrowAlign(ButtonArrowAlign.BOTTOM);
    TableData data = new TableData();
    data.setRowspan(3);

    group.add(btn, data);

    btn = new Button("Format", Resources.ICONS.add32());
    btn.setScale(ButtonScale.LARGE);
    btn.setIconAlign(IconAlign.TOP);
    btn.setArrowAlign(ButtonArrowAlign.BOTTOM);
    Menu menu = new Menu();
    menu.add(new MenuItem("Cool"));
    btn.setMenu(menu);
    group.add(btn, data);

    btn = new Button("Copy", IconHelper.createStyle("add16"));
    menu = new Menu();
    menu.add(new MenuItem("Copy me"));
    btn.setMenu(menu);
    group.add(btn);

    btn = new Button("Cut", IconHelper.createStyle("add16"));
    group.add(btn);

    btn = new Button("Paste", IconHelper.createStyle("add16"));
    group.add(btn);

    group = new ButtonGroup(3);
    group.setHeading("Clipboard");
    toolBar.add(group);

    btn = new Button("Paste", Resources.ICONS.add32());
    btn.addStyleName("x-btn-as-arrow");
    btn.setScale(ButtonScale.LARGE);
    btn.setIconAlign(IconAlign.TOP);
    btn.setArrowAlign(ButtonArrowAlign.BOTTOM);
    data = new TableData();
    data.setRowspan(3);

    group.add(btn, data);

    btn = new Button("Format", Resources.ICONS.add32());
    btn.setScale(ButtonScale.LARGE);
    btn.setIconAlign(IconAlign.TOP);
    btn.setArrowAlign(ButtonArrowAlign.BOTTOM);
    menu = new Menu();
    menu.add(new MenuItem("Cool"));
    btn.setMenu(menu);
    group.add(btn, data);

    btn = new Button("Copy", IconHelper.createStyle("add16"));
    menu = new Menu();
    menu.add(new MenuItem("Copy me"));
    btn.setMenu(menu);
    group.add(btn);

    btn = new Button("Cut", IconHelper.createStyle("add16"));
    group.add(btn);

    btn = new Button("Paste", IconHelper.createStyle("add16"));
    group.add(btn);
    return panel;
  }
  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);
  }
  public PanelGridContrato() {

    setCollapsible(true);
    setResizable(false);
    setMinimizable(true);
    setHeadingHtml("Contratos");
    setSize(700, 459);
    setLayout(new FitLayout());

    mainPanel = new ContentPanel();
    mainPanel.setFrame(true);
    mainPanel.setHeaderVisible(false);
    mainPanel.setLayout(new RowLayout(Orientation.VERTICAL));

    panelTool = new ContentPanel();
    panelTool.setHeaderVisible(false);
    panelTool.setFrame(true);
    panelTool.setCollapsible(true);
    panelTool.setLayout(new AbsoluteLayout());

    btnRelatrio = new Button("Relatório");
    btnRelatrio.setSize("44px", "44px");
    btnRelatrio.setIconAlign(IconAlign.TOP);
    btnRelatrio.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.report24()));
    //		btnRelatrio.setEnabled(false);
    btnRelatrio.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            ParametrosReport parametros = new ParametrosReport();
            parametros.setNomeRelatorio(JasperName.CONTRATO);
            parametros.setContratoId(getSelecaoGrid().getId());

            InstanceService.RELATORIO_SERVICE.relatorio(parametros, new RelatorioCallback());
          }
        });

    panelTool.add(btnRelatrio, new AbsoluteData(606, 6));

    btnEditar = new Button("Editar");
    btnEditar.setSize("44px", "44px");
    btnEditar.setIconAlign(IconAlign.TOP);
    btnEditar.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconEditar24()));
    btnEditar.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {

            DTOContrato contrato = getSelecaoGrid();

            if (contrato != null) {
              FormContrato formContrato = ProviderFacadeManager.formContrato.createInstance();
              formContrato.setModal(true);
              formContrato.loadDTOContrato(contrato);
              formContrato.show();
            } else {
              WebMessageBox.alert("Selecione o contrato para editar!");
            }
          }
        });
    panelTool.add(btnEditar, new AbsoluteData(556, 6));

    btnNovo = new Button("Novo");
    btnNovo.setSize("44px", "44px");
    btnNovo.setIconAlign(IconAlign.TOP);
    btnNovo.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconAdicionar24()));
    btnNovo.addSelectionListener(
        new SelectionListener<ButtonEvent>() {

          @Override
          public void componentSelected(ButtonEvent ce) {
            FormContrato formContrato = ProviderFacadeManager.formContrato.createInstance();
            formContrato.setModal(true);
            formContrato.show();
          }
        });
    panelTool.add(btnNovo, new AbsoluteData(506, 6));

    panelTool.add(new LabelField("Cliente:"), new AbsoluteData(6, 6));

    RpcProxy<PagingLoadResult<DTOCliente>> proxyCliente =
        new RpcProxy<PagingLoadResult<DTOCliente>>() {
          @Override
          public void load(
              Object loadConfig, AsyncCallback<PagingLoadResult<DTOCliente>> callback) {
            InstanceService.CLIENTE_SERVICE.loadPagingList((PagingLoadConfig) loadConfig, callback);
          }
        };

    PagingLoader<PagingLoadResult<ModelData>> loaderCliente =
        new BasePagingLoader<PagingLoadResult<ModelData>>(proxyCliente);

    storeCliente = new ListStore<DTOCliente>(loaderCliente);

    comboCliente = new ComboBox<DTOCliente>();
    comboCliente.setStore(storeCliente);
    comboCliente.setSize("286px", "22px");
    comboCliente.setTemplate(getTemplateNome());
    comboCliente.setValueField("id");
    comboCliente.setDisplayField("nome");
    comboCliente.setItemSelector("div.search-item");
    comboCliente.setHideTrigger(true);
    comboCliente.setLoadingText("Carregando...");
    comboCliente.setPageSize(10);
    comboCliente.addListener(
        Events.OnBlur,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent evt) {
            if (comboCliente.getValue() == null) {
              comboCliente.clear();
            }
          };
        });

    panelTool.add(comboCliente, new AbsoluteData(6, 28));

    tfData = new DateField();
    tfData.setSize("119px", "22px");
    tfData.setEditable(false);
    tfData.setValue(new Date());
    tfData
        .getDatePicker()
        .addListener(
            Events.Select,
            new Listener<DatePickerEvent>() {
              @Override
              public void handleEvent(DatePickerEvent be) {
                loadContratos();
              }
            });
    tfData.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
    panelTool.add(tfData, new AbsoluteData(298, 28));

    btnPesquisa = new Button();
    btnPesquisa.setSize("44px", "44px");
    btnPesquisa.setIcon(AbstractImagePrototype.create(ImagensResources.INSTANCE.iconPesquisa24()));
    btnPesquisa.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            pesquisa();
          }
        });
    panelTool.add(btnPesquisa, new AbsoluteData(423, 6));

    panelTool.add(new LabelField("Data:"), new AbsoluteData(300, 6));
    mainPanel.add(panelTool, new RowData(Style.DEFAULT, 75.0, new Margins(3)));

    storeContratos = new ListStore<DTOContrato>();

    gridContratos = new Grid<DTOContrato>(storeContratos, getColumnModel());
    gridContratos.setBorders(true);
    gridContratos.setAutoExpandColumn("nomeCliente");

    mainPanel.add(gridContratos, new RowData(Style.DEFAULT, 340.0, new Margins(3)));

    add(mainPanel);

    loadContratos();
  }
Esempio n. 4
0
 private Button createAddButton(
     String text, AbstractImagePrototype icon, SelectionListener<ButtonEvent> listener) {
   Button button = new Button(text, icon, listener);
   button.setIconAlign(IconAlign.TOP);
   return button;
 }
Esempio n. 5
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);
  }