Example #1
0
 public void setTextRigth(String right_t, OrdineModel riepilogo) {
   if (riepilogo != null
       && riepilogo.getPagamentoModel() != null
       && riepilogo.getPagamentoModel().getEsito() != null
       && riepilogo.getPagamentoModel().getEsito().equalsIgnoreCase(Esito.PAGATO.toString())) {
     right.setVisible(false);
     rigthText.setVisible(false);
   } else {
     if (right_t.length() == 0) {
       right.setEnabled(false);
       right.setVisible(false);
       rigthText.setVisible(false);
     } else {
       right.setEnabled(true);
       right.setVisible(true);
       rigthText.setVisible(true);
     }
     rigthText.setText(right_t);
   }
   c.layout(true);
 }
Example #2
0
  public void setTextLeft(String left_t, OrdineModel riepilogo) {
    if (riepilogo.getPagamentoModel() != null
        && riepilogo.getPagamentoModel().getEsito() != null
        && riepilogo.getPagamentoModel().getEsito().equalsIgnoreCase(Esito.PAGATO.toString())) {
      left.setVisible(false);
      leftText.setVisible(false);

    } else {
      if (left_t.length() == 0 || left_t.equalsIgnoreCase(".")) {
        left.setEnabled(false);
        left.setVisible(false);
        leftText.setVisible(false);
      } else {
        left.setEnabled(true);
        left.setVisible(true);
        leftText.setVisible(true);
      }
      leftText.setText(left_t);
    }
    c.layout(true);
  }
 public void resetState() {
   formPanel.setReadOnly(true);
   saveButton.setVisible(false);
   cancelButton.setVisible(false);
   updateButton.setVisible(true);
   updateButton.disable();
   resetButton.setVisible(true);
   resetButton.disable();
   if (permitedEnterprise.getCanAdd()) {
     addButton.enable();
   } else {
     addButton.disable();
   }
   if (permitedEnterprise.getCanUpdate()) {
     editButton.enable();
   } else {
     editButton.disable();
   }
   if (permitedEnterprise.getCanDelete()) {
     deleteButton.enable();
   } else {
     deleteButton.disable();
   }
   formPanel.reset();
   if (grid.getSelectionModel().getSelection().size() > 0) {
     formBindings.bind((BeanModel) grid.getSelectionModel().getSelection().get(0));
   } else {
     formBindings.unbind();
     if (permitedEnterprise.getCanAdd()) {
       addButton.enable();
     } else {
       addButton.disable();
     }
     editButton.disable();
     deleteButton.disable();
   }
 }
    @Override
    public void onSuccess(final List<ConnectionRequest> result) {

      try {
        if (result.isEmpty()) {
          connectionRequest.setVisible(false);
        } else {
          final Menu scrollMenu = new Menu();
          scrollMenu.setMaxHeight(MAX_HEIGHT);
          for (final ConnectionRequest r : result) {
            MenuItem m = acceptConnectionMenuItem(scrollMenu, r);
            scrollMenu.add(m);
          }

          connectionRequest.setMenu(scrollMenu);
          connectionCount = result.size();

          connectionRequest.setText("Requests(" + connectionCount + ')');
        }
      } catch (NimbitsException ex) {
        FeedbackHelper.showError(ex);
      }
    }
  private FormPanel createForm() {
    final FormPanel panel = new FormPanel();
    panel.setLabelWidth(100);
    panel.setHeaderVisible(false);

    TextField<String> code = new TextField<String>();
    code.setName("containerNo");
    code.setFieldLabel("集装箱号");
    code.setAllowBlank(false);
    panel.add(code);

    final ComboBox<BeanModel> size = new ComboBox<BeanModel>();
    size.setTabIndex(9);
    size.setName("size");
    size.setForceSelection(true);
    size.setEmptyText("请选择...");
    size.setDisplayField("size");
    size.setFieldLabel("尺寸");
    size.setStore(containerSizeStore);
    size.setTypeAhead(true);
    size.setTriggerAction(TriggerAction.ALL);
    size.setAllowBlank(false);
    panel.add(size);

    size.addListener(
        Events.Blur,
        new Listener<FieldEvent>() {
          @Override
          public void handleEvent(FieldEvent be) {
            formBindings.getModel().set("valentNum", size.getValue().get("valentNum"));
          }
        });

    ComboBox<BeanModel> type = new ComboBox<BeanModel>();
    type.setTabIndex(9);
    type.setName("type");
    type.setForceSelection(true);
    type.setEmptyText("请选择...");
    type.setDisplayField("code");
    type.setFieldLabel("类型");
    type.setStore(ironChestStore);
    type.setTypeAhead(true);
    type.setTriggerAction(TriggerAction.ALL);
    panel.add(type);

    ComboBox<BeanModel> bracket = new ComboBox<BeanModel>();
    bracket.setTabIndex(9);
    bracket.setName("bracket");
    bracket.setForceSelection(true);
    bracket.setEmptyText("请选择...");
    bracket.setDisplayField("code");
    bracket.setFieldLabel("车架编号");
    bracket.setStore(bracketStore);
    bracket.setTypeAhead(true);
    bracket.setTriggerAction(TriggerAction.ALL);
    panel.add(bracket);

    formBindings = new FormBinding(panel, true);

    formBindings
        .getBinding(size)
        .setConverter(
            new Converter() {
              @Override
              public Object convertFieldValue(Object value) {
                if (value == null) {
                  return null;
                }
                return ((BeanModel) value).get("code").toString();
              }

              @Override
              public Object convertModelValue(Object value) {
                if (value != null) {
                  return containerSizeStore.findModel("code", (String) value);
                } else {
                  return null;
                }
              }
            });
    formBindings
        .getBinding(type)
        .setConverter(
            new Converter() {
              @Override
              public Object convertFieldValue(Object value) {
                if (value == null) {
                  return null;
                }
                return ((BeanModel) value).get("code").toString();
              }

              @Override
              public Object convertModelValue(Object value) {
                if (value != null) {
                  return ironChestStore.findModel("code", (String) value);
                } else {
                  return null;
                }
              }
            });
    formBindings
        .getBinding(bracket)
        .setConverter(
            new Converter() {
              @Override
              public Object convertFieldValue(Object value) {
                if (value == null) {
                  return null;
                }
                return ((BeanModel) value).get("code").toString();
              }

              @Override
              public Object convertModelValue(Object value) {
                if (value != null) {
                  return bracketStore.findModel("code", (String) value);
                } else {
                  return null;
                }
              }
            });

    formBindings.setStore((Store<BeanModel>) grid.getStore());

    panel.setReadOnly(true);

    panel.setButtonAlign(HorizontalAlignment.CENTER);

    saveButton = new Button("保存");
    saveButton.setVisible(false);
    saveButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (!panel.isValid()) return;
            save();
          }
        });
    panel.addButton(saveButton);

    cancelButton = new Button("取消");
    cancelButton.setVisible(false);
    cancelButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            resetState();
          }
        });
    panel.addButton(cancelButton);

    updateButton = new Button("更新");
    updateButton.disable();
    updateButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (!panel.isValid()) return;
            update();
          }
        });
    panel.addButton(updateButton);

    resetButton = new Button("取消");
    resetButton.disable();
    resetButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            store.rejectChanges();
            resetState();
          }
        });
    panel.addButton(resetButton);

    panel.setBorders(false);
    panel.setBodyBorder(false);

    return panel;
  }
 private void setButtonHidden(Button button) {
   button.setVisible(hasEditRight());
 }
  public void clear() {
    super.clear();

    matchingField.addDisplayableReportWidget(null);
    submitWithMatchesButton.setVisible(false);
  }
  private void initialize(BillTypeManager billTypeManager, ServiceLocations serviceLocations) {
    FormData formData = new FormData("-20");

    matchingField = new MatchingItemsControl();
    Widget storeField = createStoreField();
    Widget billTypeField = createBillTypeField(billTypeManager);
    Widget costField = createCostField();
    Widget notesField = createNotesField();
    Widget dateField = createDateField();

    Button okButton = new Button("OK");

    okButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (isSplit) {
              submitSplitPurchase();
            } else {
              if (isValid()) {
                submitPurchase();
              } else {
                Window.alert("Not valid");
              }
            }
          }
        });

    Button cancelButton = new Button("Cancel");

    cancelButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            finishPurchase();
          }
        });

    submitWithMatchesButton = new Button("Submit With Matches");

    submitWithMatchesButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            sendPurchase();
          }
        });

    submitWithMatchesButton.setVisible(false);

    Button splitButton = new Button("Split");
    splitButton.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            toggleSplit();
          }
        });

    VerticalPanel labelPanel = new VerticalPanel();
    VerticalPanel controlPanel = new VerticalPanel();
    labelPanel.add(new Label("Store"));
    labelPanel.add(new Label("Cost"));
    labelPanel.add(new Label("Date"));
    labelPanel.add(new Label("Bill Type"));
    labelPanel.add(new Label("Note"));
    controlPanel.add(storeField);
    controlPanel.add(costField);
    controlPanel.add(dateField);
    controlPanel.add(billTypeField);
    controlPanel.add(notesField);

    fieldPanel = new Grid(5, 2);

    fieldPanel.setText(0, 0, "Store:");
    fieldPanel.setWidget(0, 1, storeField);

    fieldPanel.setText(1, 0, "Cost:");
    fieldPanel.setWidget(1, 1, costField);

    fieldPanel.setText(2, 0, "Date:");
    fieldPanel.setWidget(2, 1, dateField);

    fieldPanel.setText(3, 0, "Bill Type:");
    fieldPanel.setWidget(3, 1, billTypeField);

    fieldPanel.setText(4, 0, "Note:");
    fieldPanel.setWidget(4, 1, notesField);

    HorizontalPanel buttonPanel = new HorizontalPanel();

    buttonPanel.add(okButton);
    buttonPanel.add(cancelButton);

    add(splitButton);
    add(fieldPanel);
    add(matchingField);
    add(submitWithMatchesButton);
    add(buttonPanel);
  }
Example #9
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);
  }