public boolean checkFields() throws FieldValueException {
    FieldsChecking.checkAllRequiredFields(this);

    Date validFrom = validFromField.getDate();

    Date validTo = validToField.getDateAcceptEmpty();
    if (validTo != null) {
      if (validFrom.after(validTo)) {
        throw new FieldValueException(
            "<USER>'Valid From' should not be later than 'Valid To'</USER>");
      }
    }

    FacilityValue seaport = (FacilityValue) seaportCombo.getSelectedItem();

    Seaport2FixpointValue seaport2Fixpoint = (Seaport2FixpointValue) getModel();
    seaport2Fixpoint.setSeaportId(seaport.getId().longValue());
    seaport2Fixpoint.setValidityStart(validFrom);
    seaport2Fixpoint.setValidityEnd(validTo);

    Object selectedFixpoint = fixpointCombo.getSelectedItem();
    if (selectedFixpoint instanceof FacilityValue) {
      FacilityValue fixpoint = (FacilityValue) selectedFixpoint;
      seaport2Fixpoint.setFixpointId(fixpoint.getId());
      seaport2Fixpoint.setActive(true);
    } else {
      seaport2Fixpoint.setFixpointId(null);
      seaport2Fixpoint.setActive(false);
    }

    // Nicht verwendet.
    return true;
  }
  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();
  }