Пример #1
0
  public UiProgressMeter(UiProgressWithCancelDlg dlg, MiniLocalization localizationToUse) {
    super();
    localization = localizationToUse;

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    parentDlg = dlg;
    statusMessage = new UiLabel("     ", UiLanguageDirection.getHorizontalAlignment());
    statusMessage.setMinimumSize(new Dimension(60, 25));

    progressMeter = new JProgressBar(0, 10);
    progressMeter.setComponentOrientation(UiLanguageDirection.getComponentOrientation());
    Dimension meterSize = new Dimension(100, 20);
    progressMeter.setMinimumSize(meterSize);
    progressMeter.setMaximumSize(meterSize);
    progressMeter.setPreferredSize(meterSize);
    progressMeter.setBorder(new BevelBorder(BevelBorder.LOWERED));
    progressMeter.setStringPainted(true);

    Component items[] = {statusMessage, progressMeter};
    Utilities.addComponentsRespectingOrientation(this, items);
  }
  public UiSetFolderOrderDlg(UiMainWindow owner, Vector originalFolderOrderToUse) {
    super(owner, "", true);
    originalFolderOrder = originalFolderOrderToUse;
    hiddenFolders = new Vector();
    okPressed = false;
    localization = owner.getLocalization();
    setTitle(localization.getWindowTitle("SetFolderOrder"));
    model = new DefaultListModel();
    for (int i = 0; i < originalFolderOrder.size(); ++i) {
      BulletinFolder bulletinFolder = ((BulletinFolder) originalFolderOrder.get(i));
      if (bulletinFolder.isVisible()) model.addElement(new LocalizedBulletinFolder(bulletinFolder));
      else hiddenFolders.add(bulletinFolder);
    }

    up = new UiButton(localization.getButtonLabel("FolderOrderUp"));
    up.addActionListener(this);
    down = new UiButton(localization.getButtonLabel("FolderOrderDown"));
    down.addActionListener(this);

    UiVBox upDownPanel = new UiVBox();
    upDownPanel.add(up);
    upDownPanel.addSpace();
    upDownPanel.add(down);

    folderList = new UiList();
    folderList.setModel(model);
    folderList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    folderList.setLayoutOrientation(JList.VERTICAL);

    UiScrollPane scroller = new UiScrollPane(folderList);

    ok = new UiButton(localization.getButtonLabel("ok"));
    ok.addActionListener(this);
    cancel = new UiButton(localization.getButtonLabel("cancel"));
    cancel.addActionListener(this);
    Box okCancelBox = Box.createHorizontalBox();
    Utilities.addComponentsRespectingOrientation(
        okCancelBox, new Component[] {ok, new UiLabel("   "), cancel, Box.createHorizontalGlue()});

    UiParagraphPanel foldersPanel = new UiParagraphPanel();
    foldersPanel.addComponents(scroller, upDownPanel);
    foldersPanel.addBlankLine();

    String rawText = localization.getFieldLabel("SetFolderOrder");
    HashMap map = new HashMap();
    map.put("#MoveFolderUp#", up.getText());
    map.put("#MoveFolderDown#", down.getText());
    String information = "";
    try {
      information = TokenReplacement.replaceTokens(rawText, map);
    } catch (TokenInvalidException e) {
      e.printStackTrace();
    }
    UiWrappedTextArea info = new UiWrappedTextArea(information, 40);
    info.setBorder(new EmptyBorder(5, 5, 5, 5));
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.add(info, BorderLayout.NORTH);
    contentPane.add(foldersPanel, BorderLayout.CENTER);
    contentPane.add(okCancelBox, BorderLayout.SOUTH);
    getRootPane().setDefaultButton(ok);

    Utilities.centerDlg(this);
    setResizable(true);
  }
  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);
  }