コード例 #1
0
 public void closeButton_actionPerformed(ActionEvent e) {
   if (!checkValidFrom() || !checkValidUntil()) {
     return;
   }
   this.validFromResult =
       (validFrom.isSet() && validFrom.isValidInput() ? validFrom.getTimeStamp() : 0);
   this.invalidFromResult =
       (validUntil.isSet() && validUntil.isValidInput()
           ? validUntil.getTimeStamp() + 1000
           : Long.MAX_VALUE);
   super.closeButton_actionPerformed(e);
 }
コード例 #2
0
 boolean checkValidUntil() {
   validFrom.getValueFromGui();
   validUntil.getValueFromGui();
   if (!validUntil.isValidInput()) {
     if (!_inCancel) {
       Dialog.error(validUntil.getDescription() + ":\n" + validUntil.getLastInvalidError());
       validUntil.requestFocus();
     }
     return false;
   }
   return true;
 }
コード例 #3
0
  protected void iniDialog() throws Exception {
    // create GUI items
    mainPanel.setLayout(new GridBagLayout());

    ItemTypeLabel label1 =
        new ItemTypeLabel(
            "LABEL1",
            IItemType.TYPE_PUBLIC,
            "",
            International.getMessage(
                "Gültigkeitszeitraum von Version {version} ändern", version + 1));
    label1.setPadding(0, 0, 0, 10);
    label1.displayOnGui(this, mainPanel, 0, 0);

    validFrom =
        new ItemTypeDateTime(
            "VALID_FROM",
            (rCurrent.getValidFrom() == 0 ? null : new DataTypeDate(rCurrent.getValidFrom())),
            (rCurrent.getValidFrom() == 0 ? null : new DataTypeTime(rCurrent.getValidFrom())),
            IItemType.TYPE_PUBLIC,
            "",
            International.getString("gültig ab"));
    validFrom.registerItemListener(this);
    if (rPrev != null && rPrev.getValidFrom() != 0) {
      validFrom.setMustBeAfter(
          new ItemTypeDateTime(
              "PREVRECORD_VALID_FROM",
              new DataTypeDate(rPrev.getValidFrom()),
              new DataTypeTime(rPrev.getValidFrom()),
              IItemType.TYPE_INTERNAL,
              "",
              ""),
          false);
    }
    validFrom.setNotNull(rPrev != null);
    validFrom.displayOnGui(this, mainPanel, 0, 1);
    validFrom.requestFocus();
    validUntil =
        new ItemTypeDateTime(
            "VALID_UNTIL",
            (rCurrent.getInvalidFrom() == Long.MAX_VALUE
                ? null
                : new DataTypeDate(rCurrent.getInvalidFrom() - 1)),
            (rCurrent.getInvalidFrom() == Long.MAX_VALUE
                ? null
                : new DataTypeTime(rCurrent.getInvalidFrom() - 1)),
            IItemType.TYPE_PUBLIC,
            "",
            International.getString("gültig bis"));
    validUntil.registerItemListener(this);
    validUntil.setMustBeAfter(validFrom, true);
    if (rNext != null && rNext.getInvalidFrom() != Long.MAX_VALUE) {
      validUntil.setMustBeBefore(
          new ItemTypeDateTime(
              "NEXTRECORD_VALID_UNTIL",
              new DataTypeDate(rNext.getInvalidFrom() - 1),
              new DataTypeTime(rNext.getInvalidFrom() - 1),
              IItemType.TYPE_INTERNAL,
              "",
              ""),
          false);
    }
    validUntil.setNotNull(rNext != null);

    validUntil.displayOnGui(this, mainPanel, 0, 2);

    closeButton.setIcon(getIcon(BaseDialog.IMAGE_ACCEPT));
    closeButton.setIconTextGap(10);
  }