private String formatDateToMartusDateFormat(String dateAsString) throws Exception {
    DateFormat incomingDateFormat = new SimpleDateFormat("dd/MM/yy");
    Date parsedDate = incomingDateFormat.parse(dateAsString);
    MultiCalendar multiCalendar = new MultiCalendar(parsedDate);

    return multiCalendar.toString();
  }
Ejemplo n.º 2
0
  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);
  }