Esempio n. 1
0
  public JProfilesPanel(JAtlasTree atlasTree) {
    super(I18nUtils.localizedStringForKey("lp_atlas_profile_title"), new GridBagLayout());

    if (atlasTree == null) throw new NullPointerException();

    // profiles combo box
    profilesCombo = new JProfilesComboBox();
    profilesCombo.setToolTipText(I18nUtils.localizedStringForKey("lp_atlas_profile_combo_tips"));
    profilesCombo.addActionListener(new ProfileListListener());

    // delete profile button
    deleteButton =
        new JButton(I18nUtils.localizedStringForKey("lp_atlas_profile_delete_btn_title"));
    deleteButton.addActionListener(new DeleteProfileListener());
    deleteButton.setToolTipText(
        I18nUtils.localizedStringForKey("lp_atlas_profile_delete_btn_tips"));

    // save as profile button
    saveAsButton = new JButton(I18nUtils.localizedStringForKey("lp_atlas_profile_save_btn_title"));
    saveAsButton.setToolTipText(I18nUtils.localizedStringForKey("lp_atlas_profile_save_btn_tips"));
    saveAsButton.addActionListener(new SaveAsProfileListener(atlasTree));

    loadButton = new JButton(I18nUtils.localizedStringForKey("lp_atlas_profile_load_btn_title"));
    loadButton.setToolTipText(I18nUtils.localizedStringForKey("lp_atlas_profile_load_btn_tips"));

    GBC gbc = GBC.eol().fill().insets(5, 5, 5, 5);
    reloadButton = new JButton(Utilities.loadResourceImageIcon("refresh.png"));
    reloadButton.setToolTipText(
        I18nUtils.localizedStringForKey("lp_atlas_profile_refresh_btn_tips"));
    reloadButton.addActionListener(new ReloadListener());
    reloadButton.setPreferredSize(new Dimension(24, 0));

    JPanel p = new JPanel(new BorderLayout());
    p.add(profilesCombo, BorderLayout.CENTER);
    p.add(reloadButton, BorderLayout.EAST);

    contentContainer.add(p, gbc);
    contentContainer.add(deleteButton, gbc.toggleEol());
    contentContainer.add(saveAsButton, gbc);
    contentContainer.add(loadButton, gbc.toggleEol());

    saveAsButton.setEnabled(false);
    deleteButton.setEnabled(false);
    loadButton.setEnabled(false);
  }
Esempio n. 2
0
  private void createComponents() {
    background = new JPanel(new GridBagLayout());

    windowTitle = new JLabel("<html><h3>ATLAS CREATION IN PROGRESS...</h3></html>");

    title = new JLabel("Processing maps of atlas:");

    mapInfoLabel =
        new JLabel(
            "Processing map ABCDEFGHIJKLMNOPQRSTUVWXYZ-nn "
                + "of layer ABCDEFGHIJKLMNOPQRSTUVWXYZ from map source ABCDEFGHIJKLMNOPQRSTUVWXYZ");

    atlasMapsDone = new JLabel("000 of 000 done");
    atlasPercent = new JLabel(String.format(TEXT_TENTHPERCENT, 100.0));
    atlasTimeLeft = new JLabel("Time remaining: 00000 minutes 00 seconds", JLabel.RIGHT);
    atlasProgressBar = new JProgressBar();

    mapDownloadTitle = new JLabel(TEXT_MAP_DOWNLOAD + "000");
    mapDownloadElementsDone = new JLabel("1000000 of 1000000 tiles done");
    mapDownloadPercent = new JLabel(String.format(TEXT_PERCENT, 100));
    mapDownloadTimeLeft = new JLabel("Time remaining: 00000 minutes 00 seconds", JLabel.RIGHT);
    mapDownloadProgressBar = new JProgressBar();

    mapCreation = new JLabel("Map Creation");
    mapCreationProgressBar = new JProgressBar();

    nrOfDownloadedBytesPerSecond = new JLabel("Average download speed");
    nrOfDownloadedBytesPerSecondValue = new JLabel();
    nrOfDownloadedBytes = new JLabel("Downloaded");
    nrOfDownloadedBytesValue = new JLabel();
    nrOfCacheBytes = new JLabel("Loaded from tile store");
    nrOfCacheBytesValue = new JLabel();

    activeDownloads = new JLabel("Active tile fetcher threads");
    activeDownloadsValue = new JLabel();
    retryableDownloadErrors = new JLabel("Transient download errors");
    retryableDownloadErrors.setToolTipText(
        "<html><h4>Download errors for the current map and for the total atlas (transient/unrecoverable)</h4>"
            + "<p>Mobile Atlas Creator retries failed tile downloads up to two times. <br>"
            + "If the tile downloads fails the second time the tile will be counted as <br>"
            + "<b>unrecoverable</b> error and not tried again during the current map creation run.<br></p></html>");
    retryableDownloadErrorsValue = new JLabel();
    retryableDownloadErrorsValue.setToolTipText(retryableDownloadErrors.getToolTipText());
    permanentDownloadErrors = new JLabel("Unrecoverable download errors");
    permanentDownloadErrors.setToolTipText(retryableDownloadErrors.getToolTipText());
    permanentDownloadErrorsValue = new JLabel();
    permanentDownloadErrorsValue.setToolTipText(permanentDownloadErrors.getToolTipText());
    totalDownloadTime = new JLabel("Total creation time");
    totalDownloadTimeValue = new JLabel();

    ignoreDlErrors =
        new JCheckBox(
            "Ignore download errors and continue automatically",
            Settings.getInstance().ignoreDlErrors);
    ignoreDlErrors.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            downloadController.setIgnoreErrors(ignoreDlErrors.isSelected());
          }
        });
    statusLabel = new JLabel("Status:");
    Font f = statusLabel.getFont();
    statusLabel.setFont(f.deriveFont(Font.BOLD));
    abortAtlasCreationButton = new JButton("Abort creation");
    abortAtlasCreationButton.setToolTipText("Abort current Atlas download");
    dismissWindowButton = new JButton("Close Window");
    dismissWindowButton.setToolTipText("Atlas creation in progress...");
    dismissWindowButton.setVisible(false);
    openProgramFolderButton = new JButton("Open Atlas Folder");
    openProgramFolderButton.setToolTipText("Atlas creation in progress...");
    openProgramFolderButton.setEnabled(false);
    pauseResumeDownloadButton = new JButton("Pause/Resume");

    GBC gbcRIF = GBC.std().insets(0, 0, 20, 0).fill(GBC.HORIZONTAL);
    GBC gbcEol = GBC.eol();
    GBC gbcEolFill = GBC.eol().fill(GBC.HORIZONTAL);
    GBC gbcEolFillI = GBC.eol().fill(GBC.HORIZONTAL).insets(0, 5, 0, 0);

    // background.add(windowTitle, gbcEolFill);
    // background.add(Box.createVerticalStrut(10), gbcEol);

    background.add(mapInfoLabel, gbcEolFill);
    background.add(Box.createVerticalStrut(20), gbcEol);

    background.add(title, gbcRIF);
    background.add(atlasMapsDone, gbcRIF);
    background.add(atlasPercent, gbcRIF);
    background.add(atlasTimeLeft, gbcEolFill);
    background.add(atlasProgressBar, gbcEolFillI);
    background.add(Box.createVerticalStrut(20), gbcEol);

    background.add(mapDownloadTitle, gbcRIF);
    background.add(mapDownloadElementsDone, gbcRIF);
    background.add(mapDownloadPercent, gbcRIF);
    background.add(mapDownloadTimeLeft, gbcEolFill);
    background.add(mapDownloadProgressBar, gbcEolFillI);
    background.add(Box.createVerticalStrut(20), gbcEol);

    background.add(mapCreation, gbcEol);
    background.add(mapCreationProgressBar, gbcEolFillI);
    background.add(Box.createVerticalStrut(10), gbcEol);

    JPanel infoPanel = new JPanel(new GridBagLayout());
    GBC gbci = GBC.std().insets(0, 3, 3, 3);
    infoPanel.add(nrOfDownloadedBytes, gbci);
    infoPanel.add(nrOfDownloadedBytesValue, gbci.toggleEol());
    infoPanel.add(nrOfCacheBytes, gbci.toggleEol());
    infoPanel.add(nrOfCacheBytesValue, gbci.toggleEol());
    infoPanel.add(nrOfDownloadedBytesPerSecond, gbci.toggleEol());
    infoPanel.add(nrOfDownloadedBytesPerSecondValue, gbci.toggleEol());
    infoPanel.add(activeDownloads, gbci.toggleEol());
    infoPanel.add(activeDownloadsValue, gbci.toggleEol());
    infoPanel.add(retryableDownloadErrors, gbci.toggleEol());
    infoPanel.add(retryableDownloadErrorsValue, gbci.toggleEol());
    infoPanel.add(permanentDownloadErrors, gbci.toggleEol());
    infoPanel.add(permanentDownloadErrorsValue, gbci.toggleEol());
    infoPanel.add(totalDownloadTime, gbci.toggleEol());
    infoPanel.add(totalDownloadTimeValue, gbci.toggleEol());

    JPanel bottomPanel = new JPanel(new GridBagLayout());
    bottomPanel.add(infoPanel, GBC.std().gridheight(2).fillH());
    bottomPanel.add(ignoreDlErrors, GBC.eol().anchor(GBC.EAST));

    bottomPanel.add(statusLabel, GBC.eol().anchor(GBC.CENTER));

    GBC gbcRight = GBC.std().anchor(GBC.SOUTHEAST).insets(5, 0, 0, 0);
    bottomPanel.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
    bottomPanel.add(abortAtlasCreationButton, gbcRight);
    bottomPanel.add(dismissWindowButton, gbcRight);
    bottomPanel.add(pauseResumeDownloadButton, gbcRight);
    bottomPanel.add(openProgramFolderButton, gbcRight);

    background.add(bottomPanel, gbcEolFillI);

    JPanel borderPanel = new JPanel(new GridBagLayout());
    borderPanel.add(background, GBC.std().insets(10, 10, 10, 10).fill());

    add(borderPanel, GBC.std().fill());

    abortAtlasCreationButton.addActionListener(this);
    dismissWindowButton.addActionListener(this);
    openProgramFolderButton.addActionListener(this);
    pauseResumeDownloadButton.addActionListener(this);
  }