public void validate(String fullFieldLabel, String candidateValue, MiniLocalization localization)
      throws DataInvalidException {
    MartusFlexidate mfd = localization.createFlexidateFromStoredData(candidateValue);
    validateDate(fullFieldLabel, mfd.getBeginDate());
    validateDate(fullFieldLabel, mfd.getEndDate());

    super.validate(fullFieldLabel, candidateValue, localization);
  }
Exemplo n.º 2
0
  public void clearAllUserData() {
    getBulletinHeaderPacket().clearAllUserData();
    getFieldDataPacket().clearAll();
    getPrivateFieldDataPacket().clearAll();

    clearUserDataInSection(fieldData.getFieldSpecs());
    clearUserDataInSection(privateFieldData.getFieldSpecs());

    set(TAGENTRYDATE, DateUtilities.getTodayInStoredFormat());
    set(TAGEVENTDATE, MartusFlexidate.toStoredDateFormat(MultiCalendar.UNKNOWN));

    setDraft();
  }
  private boolean shouldAddFieldSpec(FieldSpec spec) {
    String tag = spec.getTag();
    if (tag.equals(Bulletin.TAGAUTHOR)) return true;
    if (tag.equals(Bulletin.TAGLANGUAGE)) return true;
    if (tag.equals(Bulletin.TAGENTRYDATE)) return true;
    if (tag.equals(Bulletin.TAGTITLE)) return true;

    String data = bulletinToLoadFrom.get(spec.getTag());
    if (tag.equals(Bulletin.TAGEVENTDATE))
      return !data.equals(MartusFlexidate.toStoredDateFormat(MultiCalendar.UNKNOWN));

    return !data.isEmpty();
  }
  public UiAboutDlg(JFrame owner, UiLocalization localization) throws HeadlessException {
    super(owner, "", true);
    getContentPane().setLayout(new BorderLayout());
    //		System.out.println("Number of calls to verifyPacketSignature " +
    // Packet.callsToVerifyPacketSignature);
    //		System.out.println("Cumulative time in verifyPacketSignature " +
    // Packet.millisInVerifyPacketSignature);
    //		System.out.println("Number of calls to XmlPacketLoader " +
    // XmlPacketLoader.callsToXmlPacketLoader);
    //		System.out.println("Cumulative time in XmlPacketLoader " +
    // XmlPacketLoader.millisInXmlPacketLoader);

    setTitle(localization.getWindowTitle("about"));

    JLabel icon =
        new JLabel(
            new ImageIcon(UiAboutDlg.class.getResource("Martus-logo-black-text-160x72.png")),
            JLabel.LEFT);

    StringBuffer versionInfo = new StringBuffer(UiConstants.programName);
    versionInfo.append(" ");
    versionInfo.append(localization.getFieldLabel("aboutDlgVersionInfo"));
    versionInfo.append(" ");
    versionInfo.append(UiConstants.versionLabel);

    StringBuffer mlpDateInfo = new StringBuffer();
    if (localization.isTranslationInsideMLP()) {
      mlpDateInfo.append(localization.getFieldLabel("aboutDlgMlpDateInfo"));
      mlpDateInfo.append(" ");
      MultiCalendar mlpDate = new MultiCalendar();
      mlpDate.setTime(localization.getMlpDate());
      String storedDateString = MartusFlexidate.toStoredDateFormat(mlpDate);
      mlpDateInfo.append(localization.convertStoredDateToDisplay(storedDateString));
    }

    StringBuffer mtfVersionInfo =
        new StringBuffer(localization.getFieldLabel("aboutDlgTranslationVersionInfo"));
    mtfVersionInfo.append(" ");
    mtfVersionInfo.append(localization.getTranslationFullVersionInfo());
    if (!localization.isCurrentTranslationOfficial()) mtfVersionInfo.append("X");

    StringBuffer buildDate = new StringBuffer(localization.getFieldLabel("aboutDlgBuildDate"));
    buildDate.append(" ");
    buildDate.append(VersionBuildDate.getVersionBuildDate());

    JButton ok = new UiButton(localization.getButtonLabel(EnglishCommonStrings.OK));
    ok.addActionListener(this);
    ok.addKeyListener(new MakeEnterKeyExit());

    Box vBoxVersionInfo = new UiVBox();
    vBoxVersionInfo.add(new UiLabel(versionInfo.toString()));
    if (mlpDateInfo.length() > 0) vBoxVersionInfo.add(new UiLabel(mlpDateInfo.toString()));
    vBoxVersionInfo.add(new UiLabel(mtfVersionInfo.toString()));
    vBoxVersionInfo.add(new UiLabel(UiConstants.copyright));
    vBoxVersionInfo.add(new UiLabel(UiConstants.website));
    vBoxVersionInfo.add(new UiLabel(buildDate.toString()));

    Box hBoxVersionAndIcon = Box.createHorizontalBox();
    hBoxVersionAndIcon.add(Box.createHorizontalGlue());
    hBoxVersionAndIcon.add(vBoxVersionInfo);
    hBoxVersionAndIcon.add(Box.createHorizontalGlue());
    hBoxVersionAndIcon.add(icon);

    Box hBoxOk = Box.createHorizontalBox();
    hBoxOk.add(Box.createHorizontalGlue());
    hBoxOk.add(ok);
    hBoxOk.add(Box.createHorizontalGlue());

    final String disclaimer = localization.getFieldLabel("aboutDlgDisclaimer");
    final String credits = localization.getFieldLabel("aboutDlgCredits");
    final String notice =
        "\n"
            + disclaimer
            + "\n\n"
            + credits
            + "\n\n"
            + localization.getFieldLabel("aboutDlgThirdParty");

    getContentPane().add(hBoxVersionAndIcon, BorderLayout.NORTH);
    getContentPane().add(new UiWrappedTextArea(notice), BorderLayout.CENTER);
    getContentPane().add(hBoxOk, BorderLayout.SOUTH);

    Utilities.packAndCenterWindow(this);
    setVisible(true);
  }