コード例 #1
0
 /**
  * @return null if no confirmation is needed or a String with the message to display in the
  *     confirmation dialog
  */
 public String deleteRequiresConfirmation(ValueObject vo) {
   // VERSION_TOGGLE Facility.warnOnCascadeDelete Start ----------
   if (ResourceUtil.getBoolean("Facility.warnOnCascadeDelete")) {
     try {
       if (getFacilityManager().otherDataDependsOnFacility(vo.getPK())) {
         return "Warning: Deletion of this facility will delete its service "
             + "area entries and other dependent data! Continue?";
       }
     } catch (Exception e) {
       log.error("Exception while checking otherDataDependsOnFacility: ", e);
     }
   }
   // VERSION_TOGGLE Facility.warnOnCascadeDelete End ----------
   return null;
 }
コード例 #2
0
  public boolean checkFields() throws FieldValueException {
    log.debug("CheckFields start...");
    boolean retval = true;
    FieldsChecking.checkAllRequiredFields(this);
    checkDates();
    ((BargeTariffValue) getModel()).setIsImport(importCheckBox.isSelected());
    ((BargeTariffValue) getModel())
        .setCurrencyId(((CurrencyValue) currency.getSelectedItem()).getId().longValue());
    // ((BargeTariffValue) getModel()).setCurrencyName(((CurrencyValue)
    // currency.getSelectedItem()).getName());

    // VERSION_TOGGLE Tariff.2ExtraSurcharges Start ----------
    if (ResourceUtil.getBoolean("Tariff.2ExtraSurcharges")) {
      surchargesPanel.checkFields();
    }
    // VERSION_TOGGLE Tariff.2ExtraSurcharges End ----------

    log.debug("CheckFields end ... " + ((BargeTariffValue) getModel()));
    return retval;
  }
コード例 #3
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();
  }
コード例 #4
0
  private void initComponents(Seaport2FixpointValue seaport2Fixpoint) {
    seaportCombo = new ContextJComboBox(this, true);
    seaportCombo.setName("Seaport");
    mandatoryFields.add(seaportCombo);
    try {
      String regionID =
          ParameterService.getInstance()
              .getParameterValue(Constants.PARAM_SEAPORT_REGION_FOR_FIXPOINT_MAPPING);

      List seaports = new ArrayList();
      if (seaport2Fixpoint.getClientValueObjectProxy().isNew()) {
        // Die Leer-auswahl nur beim Einfuegen anzeigen.
        seaports.add("-- Select --");
      }
      seaports.addAll(
          FacilityService.getInstance()
              .findFacilitiesByTypeAndRegion(
                  Constants.FACILITY_TYPE_SEAPORT, Long.parseLong(regionID)));
      seaportCombo.setModel(new DefaultComboBoxModel(seaports.toArray()));
    } catch (Exception x) {
      log.error(
          "Exception while retrieving seaport list for seaport2fixpoint table.\n "
              + "Parameter '"
              + Constants.PARAM_SEAPORT_REGION_FOR_FIXPOINT_MAPPING
              + "' not set?",
          x);
    }
    setSelectedItem(seaportCombo, seaport2Fixpoint.getSeaportId());

    JLabel seaportLabel = new JLabel(seaportCombo.getName());
    seaportLabel.setLabelFor(seaportCombo);
    seaportLabel.setDisplayedMnemonic('S');

    fixpointCombo = new ContextJComboBox(this);
    fixpointCombo.setName("Fixpoint");
    mandatoryFields.add(fixpointCombo);
    try {
      List fixpoints = new ArrayList();
      fixpoints.add("-- n/a --");
      fixpoints.addAll(
          FacilityService.getInstance().findFacilitiesByType(Constants.FACILITY_TYPE_FIXPOINT));
      fixpointCombo.setModel(new DefaultComboBoxModel(fixpoints.toArray()));
    } catch (Exception e) {
      log.error("Exception while retrieving fixpoint list: ", e);
    }
    if (seaport2Fixpoint.getFixpointId() != null) {
      // D.h. seaport2Fixpoint.isActive().
      setSelectedItem(fixpointCombo, seaport2Fixpoint.getFixpointId().longValue());
    }

    JLabel fixpointLabel = new JLabel(fixpointCombo.getName());
    fixpointLabel.setLabelFor(fixpointCombo);
    fixpointLabel.setDisplayedMnemonic('F');

    validFromField = new DateJTextField(this);
    validFromField.setName("Valid From");
    validFromField.setDate(seaport2Fixpoint.getValidityStart());
    validFromField.setRequired(true);
    mandatoryFields.add(validFromField);

    JLabel validFromLabel = new JLabel(validFromField.getName());
    validFromLabel.setLabelFor(validFromField);
    validFromLabel.setDisplayedMnemonic('F');

    validToField = new DateJTextField(this);
    validToField.setName("Valid To");
    validToField.setDate(seaport2Fixpoint.getValidityEnd());
    // VERSION_TOGGLE ValidityModification.enabled Start ----------
    if (!ResourceUtil.getBoolean("ValidityModification.enabled")) {
      validToField.setRequired(true);
      mandatoryFields.add(validToField);
    }
    // VERSION_TOGGLE ValidityModification.enabled End ----------

    JLabel validToLabel = new JLabel(validToField.getName());
    validToLabel.setLabelFor(validToField);
    validToLabel.setDisplayedMnemonic('T');

    // Durch die Vorbelgung soll das Objekt noch nicht speicherbar sein.
    seaport2Fixpoint.getClientValueObjectProxy().setChanged(false);

    setTitle("Fixpoints");
    setMaximizable(false);

    getContentPane().setLayout(new GridBagLayout());
    ((JComponent) getContentPane()).setBorder(BorderFactory.createEmptyBorder(15, 15, 10, 15));

    GridBagConstraints constraints = new GridBagConstraints();

    // Spalte 1.

    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 0, 5, 0);
    getContentPane().add(seaportLabel, constraints);

    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.anchor = GridBagConstraints.WEST;
    getContentPane().add(validFromLabel, constraints);

    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.anchor = GridBagConstraints.WEST;
    getContentPane().add(validToLabel, constraints);

    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.anchor = GridBagConstraints.WEST;
    getContentPane().add(fixpointLabel, constraints);

    // Spalte 2.

    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    getContentPane().add(seaportCombo, constraints);

    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    getContentPane().add(validFromField, constraints);

    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    getContentPane().add(validToField, constraints);

    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    getContentPane().add(fixpointCombo, constraints);

    pack();
  }
コード例 #5
0
  /**
   * @param torder
   * @param order
   * @param limit
   * @return
   * @throws Exception
   */
  public List getDepots(TransportOrderValue torder, OrderValue order, int limit) throws Exception {
    WaypointValue customerAddress = null;
    Address seaTerminalAddress = null;
    long carrierId;
    long container;
    boolean pickup;

    pickup = !order.getIsImportOrder();
    container = order.getContainerType().longValue();
    carrierId = order.getCarrierId();
    // get the needed customer address
    List waypoints = null;
    if (pickup) {
      waypoints = torder.getExportWaypoints();
    } else {
      waypoints = torder.getImportWaypoints();
    }

    log.debug("the length of waypoints: " + waypoints.size());
    if (order.getIsImportOrder()) {
      // last customer for import
      for (int i = waypoints.size() - 1; i >= 0; i--) {
        WaypointValue point = (WaypointValue) waypoints.get(i);
        if (point.getType().equalsIgnoreCase("Customer")) {
          customerAddress = point;
        } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) {
          seaTerminalAddress = point;
        }
      }
    } else {
      // fist customer for export
      for (int i = 0; i < waypoints.size(); i++) {
        WaypointValue point = (WaypointValue) waypoints.get(i);
        if (point.getType().equalsIgnoreCase("Customer")) {
          customerAddress = point;
        } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) {
          seaTerminalAddress = point;
        }
      }
    }

    Date fixedDate = customerAddress.getFixedDate();
    boolean isExtended = false;
    // VERSION_TOGGLE FRR.ExtendedDepots Start ----------
    if (ResourceUtil.getBoolean("FRR.ExtendedDepots")) {
      isExtended = true;
    }
    // VERSION_TOGGLE FRR.ExtendedDepots End ----------
    log.debug(
        "customer:"
            + customerAddress
            + " carrierId: "
            + carrierId
            + " container "
            + container
            + " pickup "
            + pickup);
    return getFacilityManager()
        .getDepots(
            customerAddress,
            seaTerminalAddress,
            carrierId,
            container,
            pickup,
            fixedDate,
            limit,
            isExtended);
  }
コード例 #6
0
  /**
   * @param order
   * @param limit
   * @return
   * @throws Exception
   */
  public List getDepots(OrderValue order, int limit) throws Exception {
    log.debug("getDepots, order: " + order);
    WaypointValue customerAddress = null;
    WaypointValue seaTerminalAddress = null;
    long carrierId;
    long container;
    // long containerType;
    boolean pickup;

    pickup = !order.getIsImportOrder();
    container = order.getContainerType().longValue();
    carrierId = order.getCarrierId();
    // containerType = order.getContainerType().longValue();
    // get the needed customer address
    List waypoints = order.getWaypoints();
    log.info("Waypointcount: " + waypoints.size() + " limit: " + limit);

    // boolean isSpecial = false;
    // CarrierValue carrier =
    // (CarrierValue)CarrierService.getInstance().findByPrimaryKey(new
    // CarrierPK(new
    // Long(carrierId)));
    // long special = carrier.getHinterlandEquipmentChange();
    // isSpecial = (special&containerType)!=0;

    // if (!isSpecial){
    if (order.getIsImportOrder()) {
      // last customer for import
      for (int i = waypoints.size() - 1; i >= 0; i--) {
        WaypointValue point = (WaypointValue) waypoints.get(i);
        if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_CUSTOMER)) {
          customerAddress = point;
        } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) {
          seaTerminalAddress = point;
        }
      }
    } else {
      // fist customer for export
      for (int i = 0; i < waypoints.size(); i++) {
        WaypointValue point = (WaypointValue) waypoints.get(i);
        if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_CUSTOMER)) {
          customerAddress = point;
        } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) {
          seaTerminalAddress = point;
        }
      }
    }

    Date fixedDate = customerAddress.getFixedDate();
    boolean isExtended = false;
    // VERSION_TOGGLE FRR.ExtendedDepots Start ----------
    if (ResourceUtil.getBoolean("FRR.ExtendedDepots")) {
      isExtended = true;
    }
    // VERSION_TOGGLE FRR.ExtendedDepots End ----------

    return getFacilityManager()
        .getDepots(
            customerAddress,
            seaTerminalAddress,
            carrierId,
            container,
            pickup,
            fixedDate,
            limit,
            isExtended);
  }
コード例 #7
0
  public TransportOrderPricePage(
      long vendorId,
      long price,
      long currencyId,
      String mode,
      String remarks,
      String internalRemarks)
      throws WizardException {

    // Fill possibly missing information from vendor.
    VendorValue vendorValue = loadVendor(vendorId);
    if (vendorValue != null) {
      vendorName = vendorValue.getName();
      // vendorPriority = vendorValue.getPriority();
      this.vendorId = vendorValue.getId();
    }

    panel = new JPanel(new GridBagLayout());
    panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 3, 5));

    vendorField = new ContextJTextField();
    vendorField.setEnabled(false);
    vendorField.setText(vendorName);

    GridBagConstraints constraints;

    Insets insets = new Insets(0, 0, 5, 0);

    constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 0;
    constraints.gridwidth = 2;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.weightx = 1.0;
    constraints.insets = insets;
    panel.add(vendorField, constraints);

    vendorSearch = new TooltipJButton("Lookup");
    vendorSearch.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            searchVendor();
          }
        });
    setLookupButtonEnable(vendorId, vendorSearch);

    constraints = new GridBagConstraints();
    constraints.gridx = 3;
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 5, 0);
    panel.add(vendorSearch, constraints);

    JLabel vendorLabel = new JLabel("Vendor");
    vendorLabel.setLabelFor(vendorSearch);
    vendorLabel.setDisplayedMnemonic('V');

    constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = insets;
    panel.add(vendorLabel, constraints);

    priceTextField = new CurrencyJTextField(this, 2);
    priceTextField.setColumns(6);
    priceTextField.setNumber(price);
    priceTextField.setMinimumSize(priceTextField.getPreferredSize());

    constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = insets;
    panel.add(priceTextField, constraints);

    JLabel priceLabel = new JLabel("Price");
    priceLabel.setLabelFor(priceTextField);
    priceLabel.setDisplayedMnemonic('P');

    constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = insets;
    panel.add(priceLabel, constraints);

    currencyBox = new CurrencyBox(true);
    currencyBox.setSelectedCurrencyId(currencyId);
    // Mit der Auswahl der Waehrung gibt es noch zu viele potentielle Fallstricke, nicht fuer 1.8.0.
    currencyBox.setEnabled(false);

    constraints = new GridBagConstraints();
    constraints.gridx = 2;
    constraints.gridy = 1;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = new Insets(0, 5, 5, 0);
    panel.add(currencyBox, constraints);

    presetmodeBox = new JComboBox(PRESET_MODES);
    presetmodeBox.setEnabled(false);
    presetmodeBox.setSelectedItem(mode);

    constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 2;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = insets;
    panel.add(presetmodeBox, constraints);

    JLabel modeLabel = new JLabel("Mode");
    modeLabel.setLabelFor(presetmodeBox);
    modeLabel.setDisplayedMnemonic('M');

    constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.anchor = GridBagConstraints.WEST;
    constraints.insets = insets;
    panel.add(modeLabel, constraints);

    remarksTextArea = new ContextJTextArea();
    remarksTextArea.setText(remarks);
    remarksTextArea.setRows(10);
    remarksTextArea.setColumns(30);

    constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 3;
    constraints.gridwidth = 3;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.insets = insets;
    panel.add(new MetaScrollPane(remarksTextArea), constraints);

    JLabel remarkLabel = new JLabel("Remarks");
    remarkLabel.setLabelFor(remarksTextArea);
    remarkLabel.setDisplayedMnemonic('R');

    constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.insets = insets;
    panel.add(remarkLabel, constraints);

    internalRemarksTextArea = new ContextJTextArea();
    internalRemarksTextArea.setText(internalRemarks);
    internalRemarksTextArea.setRows(10);
    internalRemarksTextArea.setColumns(30);

    // VERSION_TOGGLE OrderPlacement.InternalRemarks Start ----------
    if (ResourceUtil.getBoolean("OrderPlacement.InternalRemarks")) {
      constraints = new GridBagConstraints();
      constraints.gridx = 1;
      constraints.gridy = 4;
      constraints.gridwidth = 3;
      constraints.fill = GridBagConstraints.BOTH;
      constraints.weightx = 1.0;
      constraints.weighty = 1.0;
      panel.add(new MetaScrollPane(internalRemarksTextArea), constraints);

      JLabel internalRemarksLabel = new JLabel("Internal Remarks");
      internalRemarksLabel.setLabelFor(internalRemarksTextArea);
      internalRemarksLabel.setDisplayedMnemonic('I');

      constraints = new GridBagConstraints();
      constraints.gridx = 0;
      constraints.gridy = 4;
      constraints.anchor = GridBagConstraints.NORTHWEST;
      panel.add(internalRemarksLabel, constraints);
    }
    // VERSION_TOGGLE OrderPlacement.InternalRemarks End ----------

    update();
  }