Changeset 9996 in josm for trunk/src/org/openstreetmap


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/src/org/openstreetmap/josm/gui
Files:
7 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));
Note: See TracChangeset for help on using the changeset viewer.