コード例 #1
0
 private void fillFields(ValueObject valueObject) {
   setTitle(valueObject);
   if (!valueObject.getClientValueObjectProxy().isNew()) {
     idTextField.setText(((BargeTariffValue) valueObject).getId().toString());
     durationFromTextField.setDate(
         new java.sql.Date(((BargeTariffValue) valueObject).getDurationFrom().getTime()));
     durationToTextField.setDate(
         new java.sql.Date(((BargeTariffValue) valueObject).getDurationTo().getTime()));
     importCheckBox.setSelected(((BargeTariffValue) valueObject).getIsImport());
     vendor.setText(((BargeTariffValue) valueObject).getVendorName());
     facility.setText(((BargeTariffValue) valueObject).getFacilityName());
     currency.setSelectedCurrencyId(model.getCurrencyId());
     currency.setEnabled(false);
   }
   copyButton.setEnabled(!model.getClientValueObjectProxy().isNew());
   valueObject.getClientValueObjectProxy().setChanged(false);
 }
コード例 #2
0
 protected void vendorSearch() {
   VendorValue vendorVal = (VendorValue) VendorLookup.showModalLookup(Constants.VENDOR_TYPE_BARGE);
   log.debug(vendorVal);
   this.getModel().getClientValueObjectProxy().setChanged();
   ((BargeTariffValue) getModel()).setVendorId(vendorVal.getId().longValue());
   ((BargeTariffValue) getModel()).setVendorName(vendorVal.getName());
   vendor.setText(vendorVal.getName());
 }
コード例 #3
0
 protected void facilitySearch() {
   String[] selection = {Constants.FACILITY_TYPE_SEATERMINAL, Constants.FACILITY_TYPE_SEAPORT};
   FacilityValue facilityVal =
       (FacilityValue)
           FacilityLookup.showModalLookup(selection, Constants.FACILITY_TYPE_SEATERMINAL);
   if (facilityVal == null) {
     return;
   }
   log.debug(facilityVal);
   this.getModel().getClientValueObjectProxy().setChanged();
   ((BargeTariffValue) getModel()).setFacilityId(facilityVal.getId().longValue());
   ((BargeTariffValue) getModel()).setFacilityName(facilityVal.getName());
   facility.setText(facilityVal.getName());
 }
コード例 #4
0
  private void postInit() {
    idTextField.setEditable(false);
    currency.setEditable(false);
    vendor.setEditable(false);
    facility.setEditable(false);
    if (this.getModel().getClientValueObjectProxy().isNew()) {
      importCheckBox.setEnabled(true);
      vendorLookup.setEnabled(true);
      facilityLookup.setEnabled(true);
    } else {
      importCheckBox.setEnabled(false);
      vendorLookup.setVisible(false);
      facilityLookup.setVisible(false);
    }

    Collection val = new ArrayList();

    try {
      if (!((BargeTariffValue) this.getModel()).hasBeenFilled()) {
        ((BargeTariffValue) this.getModel())
            .fillBargeTariffLines(
                ((BargeTariffValue) TariffService.getInstance().fill(getModel()))
                    .getBargeTariffLines());
      }
      val = ((BargeTariffValue) getModel()).getBargeTariffLines();
    } catch (Exception e) {
      log.debug(this, e);
    }
    BargeTariffLineTableModel btlm = new BargeTariffLineTableModel(val);
    bargeTariffTable.setModel(btlm);
    bargeTariffTable.setTableInstanceIdentifier(serialVersionUID, "BargeTariffLineTable");
    log.debug("Table rows = " + btlm.getRowCount());
    log.debug("Table rows = " + bargeTariffTable.getModel().getRowCount());
    bargeTariffTable.setParentModel(getModel());
    getModel().getClientValueObjectProxy().setChanged(false);
  }
コード例 #5
0
  public void initComponents() {

    allowedRoles = new String[] {"*"};
    idLabel = new JLabel("ID");
    vendorLabel = new JLabel("Vendor");
    currencyLabel = new JLabel("Currency");
    facilityLabel = new JLabel("Facility");

    modifyJButton = new TooltipJButton("modify");
    modifyJButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            modifyTableContent();
          }
        });
    modifyJButton.setBounds(420, 90, 75, 20);

    vendorLookup = new TooltipJButton("Lookup");
    vendorLookup.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            vendorSearch();
          }
        });
    facilityLookup = new TooltipJButton("Lookup");
    facilityLookup.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            facilitySearch();
          }
        });
    copyButton = new TooltipJButton("copy");
    copyButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copy();
          }
        });
    importLabel = new JLabel("import");
    durationFromLabel = new JLabel("Valid From");
    durationToLabel = new JLabel("Valid To");
    idTextField = new ContextJTextField(this);
    vendor = new ContextJTextField(this, true);
    currency = new CurrencyBox(this, true);

    facility = new ContextJTextField(this, true);
    durationFromTextField = new DateJTextField(this, true);
    mandatoryFields.add(durationFromTextField);
    durationToTextField = new DateJTextField(this, true);
    mandatoryFields.add(durationToTextField);
    bargeTariffTable = new ComposedContextJTable();
    bargeTariffTable.setColorable(true);
    importCheckBox = new ImportExportPane(this);

    mandatoryFields.add(vendor);
    mandatoryFields.add(currency);
    mandatoryFields.add(facility);
    mandatoryFields.add(durationFromTextField);
    mandatoryFields.add(durationToTextField);

    scrollpane = new JScrollPane();
    scrollpane.setBounds(10, 120, 490, 200);

    bargeTariffTable.setBounds(0, 0, 400, 400);

    idLabel.setBounds(10, 10, 40, 20);
    idTextField.setBounds(100, 10, 100, 20);
    durationFromLabel.setBounds(10, 35, 80, 20);
    durationFromTextField.setBounds(100, 35, 100, 20);
    durationToLabel.setBounds(10, 60, 80, 20);
    durationToTextField.setBounds(100, 60, 100, 20);

    // importLabel.setBounds(10, 90, 40, 20);
    importCheckBox.setBounds(10, 90, 200, 25);

    vendorLabel.setBounds(220, 10, 80, 20);
    vendor.setBounds(300, 10, 100, 20);
    vendorLookup.setBounds(420, 10, 80, 20);

    currencyLabel.setBounds(220, 60, 80, 20);
    currency.setBounds(300, 60, 100, 20);

    facilityLabel.setBounds(220, 35, 80, 20);
    facility.setBounds(300, 35, 100, 20);
    facilityLookup.setBounds(420, 35, 80, 20);

    copyButton.setBounds(345, 90, 75, 20);
    panel.setLayout(null);
    panel.setSize(700, 215);
    panel.setMinimumSize(new Dimension(700, 130));
    panel.add(idLabel);
    panel.add(idTextField);
    panel.add(durationFromLabel);
    panel.add(durationFromTextField);
    panel.add(durationToLabel);
    panel.add(durationToTextField);
    panel.add(importLabel);
    panel.add(importCheckBox);
    panel.add(vendorLabel);
    panel.add(vendor);
    panel.add(vendorLookup);
    panel.add(currencyLabel);
    panel.add(currency);
    panel.add(facilityLabel);
    panel.add(facility);
    panel.add(facilityLookup);
    panel.add(copyButton);
    panel.add(modifyJButton);

    // tabbed pane
    tabPane = new JTabbedPane();
    tabPane.setBounds(10, 175, 870, 200);
    tabPane.add("Tarifflines", scrollpane);

    // VERSION_TOGGLE Tariff.2ExtraSurcharges Start ----------
    if (ResourceUtil.getBoolean("Tariff.2ExtraSurcharges")) {
      surchargesPanel = new SurchargesPanel((Tariff) getModel());
      tabPane.add("Surcharges", surchargesPanel);
    }
    // VERSION_TOGGLE Tariff.2ExtraSurcharges End ----------

    scrollpane.getViewport().add(bargeTariffTable);
    JSplitPane splitp = new JSplitPane();
    splitp.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitp.setLeftComponent(panel);
    splitp.setRightComponent(tabPane);
    splitp.setDividerSize(0);
    getContentPane().add(splitp);
    pack();
  }