Changeset 9996 in josm


Ignore:
Timestamp:
2016-03-14T23:06:43+01:00 (9 years ago)
Author:
Don-vip
Message:

sonar - use JLabel.setLabelFor where applicable + add/update unit tests

Location:
trunk
Files:
15 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r9543 r9996  
    137137    public SelectionListDialog selectionListDialog;
    138138    public PropertiesDialog propertiesDialog;
     139    public MapPaintDialog mapPaintDialog;
    139140    public NotesDialog noteDialog;
    140141
     
    246247        addToggleDialog(filterDialog = new FilterDialog());
    247248        addToggleDialog(new ChangesetDialog(), true);
    248         addToggleDialog(new MapPaintDialog());
     249        addToggleDialog(mapPaintDialog = new MapPaintDialog());
    249250        addToggleDialog(noteDialog = new NotesDialog());
    250251        toolBarToggle.setFloatable(false);
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java

    r9468 r9996  
    8484        JLabel lblMyVersion = new JLabel(tr("My version"));
    8585        lblMyVersion.setToolTipText(tr("Properties in my dataset, i.e. the local dataset"));
     86        lblMyVersion.setLabelFor(mineVersionInfo);
    8687        add(lblMyVersion, gc);
    8788
     
    9596        JLabel lblTheirVersion = new JLabel(tr("Their version"));
    9697        lblTheirVersion.setToolTipText(tr("Properties in their dataset, i.e. the server dataset"));
     98        lblMyVersion.setLabelFor(theirVersionInfo);
    9799        add(lblTheirVersion, gc);
    98100
     
    106108        gc.gridx = 5;
    107109        add(theirVersionInfo, gc);
    108 
    109110    }
    110111
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r9833 r9996  
    572572            final JTabbedPane tabs = new JTabbedPane();
    573573
    574             tabs.add("Info", buildInfoPanel(s));
    575574            JLabel lblInfo = new JLabel(tr("Info"));
     575            lblInfo.setLabelFor(tabs.add("Info", buildInfoPanel(s)));
    576576            lblInfo.setFont(lblInfo.getFont().deriveFont(Font.PLAIN));
    577577            tabs.setTabComponentAt(0, lblInfo);
     
    583583
    584584            final JPanel pSource = new JPanel(new GridBagLayout());
    585             tabs.addTab("Source", pSource);
    586585            JLabel lblSource = new JLabel(tr("Source"));
     586            lblSource.setLabelFor(tabs.add("Source", pSource));
    587587            lblSource.setFont(lblSource.getFont().deriveFont(Font.PLAIN));
    588588            tabs.setTabComponentAt(3, lblSource);
     
    615615            if (items.isEmpty()) {
    616616                JLabel lblErrors = new JLabel(tr(title));
     617                lblErrors.setLabelFor(pErrors);
    617618                lblErrors.setFont(lblInfo.getFont().deriveFont(Font.PLAIN));
    618619                lblErrors.setEnabled(false);
     
    621622            } else {
    622623                JLabel lblErrors = new JLabel(tr(title), icon, JLabel.HORIZONTAL);
     624                lblErrors.setLabelFor(pErrors);
    623625                tabs.setTabComponentAt(pos, lblErrors);
    624626            }
  • trunk/src/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRenderer.java

    r8836 r9996  
    1717class UploadAndSaveProgressRenderer extends JPanel implements ProgressRenderer, PropertyChangeListener {
    1818
    19     private JLabel lblTaskTitle;
    20     private JLabel lblCustomText;
    21     private JProgressBar progressBar;
     19    private final JLabel lblTaskTitle = new JLabel("");
     20    private final JLabel lblCustomText = new JLabel("");
     21    private final JProgressBar progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
    2222
    2323    /**
     
    3939        gc.weighty = 0.0;
    4040        gc.insets = new Insets(5, 0, 0, 5);
    41         add(lblTaskTitle = new JLabel(""), gc);
     41        add(lblTaskTitle, gc);
     42        lblTaskTitle.setLabelFor(lblCustomText);
    4243
    43         gc.gridx = 0;
    4444        gc.gridy = 1;
    45         gc.fill = GridBagConstraints.HORIZONTAL;
    46         gc.weightx = 1.0;
    47         gc.weighty = 0.0;
    48         gc.insets = new Insets(5, 0, 0, 5);
    49         add(lblCustomText = new JLabel(""), gc);
     45        add(lblCustomText, gc);
     46        lblCustomText.setLabelFor(progressBar);
    5047
    51         gc.gridx = 0;
    5248        gc.gridy = 2;
    53         gc.fill = GridBagConstraints.HORIZONTAL;
    54         gc.weightx = 1.0;
    55         gc.weighty = 0.0;
    56         gc.insets = new Insets(5, 0, 0, 5);
    57         add(progressBar = new JProgressBar(JProgressBar.HORIZONTAL), gc);
     49        add(progressBar, gc);
    5850    }
    5951
     
    9183    public void propertyChange(PropertyChangeEvent evt) {
    9284        if (evt.getPropertyName().equals(SaveLayersModel.MODE_PROP)) {
    93             Mode mode = (Mode) evt.getNewValue();
    94             switch(mode) {
    95                 case EDITING_DATA: setVisible(false); break;
    96                 case UPLOADING_AND_SAVING: setVisible(true); break;
    97             }
     85            setVisible(Mode.UPLOADING_AND_SAVING.equals(evt.getNewValue()));
    9886        }
    9987        getParent().validate();
  • trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

    r9575 r9996  
    118118        lblWarning = new JLabel("");
    119119        lblWarning.setVisible(false);
     120        lblWarning.setLabelFor(jepMessage);
    120121        lblWarning.setIcon(ImageProvider.get("warning-small"));
    121122        lblWarning.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r9850 r9996  
    388388        p.add(label, GBC.std().insets(0, 0, 10, 0));
    389389        addToPanelAnchor(p, default_, presetInitiallyMatches);
     390        label.setLabelFor(component);
    390391        component.setToolTipText(getKeyTooltipText());
    391392
    392393        return true;
    393 
    394394    }
    395395
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java

    r9972 r9996  
    180180        final JLabel label = new JLabel(locale_text + ':');
    181181        label.setToolTipText(getKeyTooltipText());
     182        label.setLabelFor(value);
    182183        p.add(label, GBC.std().insets(0, 0, 10, 0));
    183184        p.add(value, GBC.eol().fill(GBC.HORIZONTAL));
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTest.java

    r9995 r9996  
    2020    /**
    2121     * Setup test.
    22      * @throws java.io.IOException in case of I/O exception
     22     * @throws IOException in case of I/O error
    2323     */
    2424    @BeforeClass
     
    2828    }
    2929
     30    /**
     31     * Test a well-known certificate.
     32     * @throws IOException in case of I/O error
     33     */
    3034    @Test
    3135    public void testDefault() throws IOException {
     
    3438    }
    3539
     40    /**
     41     * Test <a href="https://letsencrypt.org">Let's Encrypt</a>.
     42     * @throws IOException in case of I/O error
     43     */
    3644    @Test
    3745    public void testLetsEncrypt() throws IOException {
     
    4250    }
    4351
     52    /**
     53     * Test <a href="https://www.startssl.com">StartSSL</a>.
     54     * @throws IOException in case of I/O error
     55     */
    4456    @Test
    4557    public void testStartSSL() throws IOException {
     
    4860    }
    4961
     62    /**
     63     * Test a broken certificate.
     64     * @throws IOException in case of I/O error
     65     */
    5066    @Test
    5167    public void testBrokenCert() throws IOException {
Note: See TracChangeset for help on using the changeset viewer.