Ignore:
Timestamp:
2015-05-26T01:37:50+02:00 (10 years ago)
Author:
Don-vip
Message:

Accessibility - global use of JLabel.setLabelFor() + various fixes (javadoc, code style)

Location:
trunk/src/org/openstreetmap/josm/gui/io
Files:
7 edited

Legend:

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

    r8378 r8426  
    4949
    5050    /** Temporary layer where downloaded primitives are put */
    51     private OsmDataLayer tmpLayer;
     51    private final OsmDataLayer tmpLayer;
    5252    /** Reference to the task that download requested primitives */
    5353    private DownloadPrimitivesTask mainTask;
     
    209209        JPanel p = new JPanel(new GridBagLayout());
    210210        p.add(new HtmlPanel(text), GBC.eop());
     211        JosmTextArea txt = new JosmTextArea();
    211212        if (listLabel != null) {
    212213            JLabel missing = new JLabel(listLabel);
    213214            missing.setFont(missing.getFont().deriveFont(Font.PLAIN));
     215            missing.setLabelFor(txt);
    214216            p.add(missing, GBC.eol());
    215217        }
    216         JosmTextArea txt = new JosmTextArea();
    217218        txt.setFont(GuiHelper.getMonospacedFont(txt));
    218219        txt.setEditable(false);
     
    227228                Main.parent,
    228229                title,
    229                 new String[] { tr("Ok") })
    230         .setButtonIcons(new String[] { "ok" })
     230                new String[] {tr("Ok")})
     231        .setButtonIcons(new String[] {"ok"})
    231232        .setIcon(msgType)
    232233        .setContent(p, false);
  • trunk/src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java

    r8379 r8426  
    5454        lblFilename.setPreferredSize(new Dimension(lblFilename.getPreferredSize().width, 19));
    5555        lblFilename.setOpaque(true);
     56        lblFilename.setLabelFor(btnFileChooser);
    5657
    5758        tfFilename.setToolTipText(tr("Either edit the path manually in the text field or click the \"...\" button to open a file chooser."));
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersTableColumnModel.java

    r6889 r8426  
    2525        private static final GBC defaultCellStyle = GBC.eol().fill(GBC.HORIZONTAL).insets(2, 0, 2, 0);
    2626
     27        /**
     28         * Constructs a new {@code RecommendedActionsTableCell}.
     29         */
    2730        public RecommendedActionsTableCell() {
    2831            pnlEmpty.setPreferredSize(new Dimension(1, 19));
     
    3639            JPanel panel = new JPanel(new GridBagLayout());
    3740            SaveLayerInfo info = (SaveLayerInfo)value;
    38             StringBuilder sb = new StringBuilder();
     41            StringBuilder sb = new StringBuilder(24);
    3942            sb.append("<html>");
    4043            if (info.getLayer().requiresUploadToServer() && !info.getLayer().isUploadDiscouraged()) {
     
    5457            if (info.getLayer().requiresSaveToFile()) {
    5558                panel.add(needsSave, defaultCellStyle);
    56                 sb.append(tr("Layer ''{0}'' has modifications which should be saved to its associated file ''{1}''.", info.getName(), info.getFile().toString()));
     59                sb.append(tr("Layer ''{0}'' has modifications which should be saved to its associated file ''{1}''.",
     60                        info.getName(), info.getFile().toString()));
    5761            } else {
    5862                panel.add(pnlEmpty, defaultCellStyle);
     
    6367            return panel;
    6468        }
     69    }
     70
     71    /**
     72     * Constructs a new {@code SaveLayersTableColumnModel}.
     73     */
     74    public SaveLayersTableColumnModel() {
     75        build();
    6576    }
    6677
     
    97108        addColumn(col);
    98109    }
    99 
    100     public SaveLayersTableColumnModel() {
    101         build();
    102     }
    103110}
  • trunk/src/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRenderer.java

    r6084 r8426  
    2020    private JLabel lblCustomText;
    2121    private JProgressBar progressBar;
     22
     23    /**
     24     * Constructs a new {@code UploadAndSaveProgressRenderer}.
     25     */
     26    public UploadAndSaveProgressRenderer() {
     27        build();
     28        // initially not visible
     29        setVisible(false);
     30    }
    2231
    2332    protected void build() {
     
    4756        gc.insets = new Insets(5,0,0,5);
    4857        add(progressBar = new JProgressBar(JProgressBar.HORIZONTAL), gc);
    49     }
    50 
    51     public UploadAndSaveProgressRenderer() {
    52         build();
    53         // initially not visible
    54         setVisible(false);
    5558    }
    5659
  • trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

    r8390 r8426  
    3131    private transient ConfigurationParameterRequestHandler configHandler;
    3232
     33    /**
     34     * Constructs a new {@code UploadParameterSummaryPanel}.
     35     */
     36    public UploadParameterSummaryPanel() {
     37        build();
     38        updateSummary();
     39    }
     40
    3341    protected String buildChangesetSummary() {
    3442        StringBuilder msg = new StringBuilder(96);
     
    5664        if (spec == null)
    5765            return "";
    58         // check whether we can use one changeset only or whether we have to use
    59         // multiple changesets
     66        // check whether we can use one changeset only or whether we have to use multiple changesets
    6067        //
    6168        boolean useOneChangeset = true;
     
    113120    }
    114121
    115     /**
    116      * Constructs a new {@code UploadParameterSummaryPanel}.
    117      */
    118     public UploadParameterSummaryPanel() {
    119         build();
    120         updateSummary();
    121     }
    122 
    123122    public void setConfigurationParameterRequestListener(ConfigurationParameterRequestHandler handler) {
    124123        this.configHandler = handler;
     
    141140
    142141    protected void updateSummary() {
    143         StringBuilder sb = new StringBuilder();
     142        StringBuilder sb = new StringBuilder(32);
    144143        sb.append("<html>")
    145144          .append(buildStrategySummary())
  • trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java

    r8415 r8426  
    4747 * This dialog can be used to select individual object for uploading.
    4848 *
    49  *
     49 * @since 2250
    5050 */
    5151public class UploadSelectionDialog extends JDialog {
     
    5757    private SideButton btnContinue;
    5858
     59    /**
     60     * Constructs a new {@code UploadSelectionDialog}.
     61     */
     62    public UploadSelectionDialog() {
     63        super(JOptionPane.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL);
     64        build();
     65    }
     66
    5967    protected JPanel buildSelectedPrimitivesPanel() {
    6068        JPanel pnl = new JPanel();
    6169        pnl.setLayout(new BorderLayout());
    62         JLabel lbl = new JLabel(tr("<html>Mark modified objects <strong>from the current selection</strong> to be uploaded to the server.</html>"));
     70        JLabel lbl = new JLabel(
     71                tr("<html>Mark modified objects <strong>from the current selection</strong> to be uploaded to the server.</html>"));
    6372        lbl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    6473        pnl.add(lbl, BorderLayout.NORTH);
    6574        pnl.add(new JScrollPane(lstSelectedPrimitives = new OsmPrimitiveList()), BorderLayout.CENTER);
     75        lbl.setLabelFor(lstSelectedPrimitives);
    6676        return pnl;
    6777    }
     
    7484        pnl.add(lbl, BorderLayout.NORTH);
    7585        pnl.add(new JScrollPane(lstDeletedPrimitives = new OsmPrimitiveList()), BorderLayout.CENTER);
     86        lbl.setLabelFor(lstDeletedPrimitives);
    7687        return pnl;
    7788    }
     
    114125        setTitle(tr("Select objects to upload"));
    115126        HelpUtil.setHelpContext(getRootPane(), HelpUtil.ht("/Dialog/UploadSelection"));
    116     }
    117 
    118     public UploadSelectionDialog() {
    119         super(JOptionPane.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL);
    120         build();
    121127    }
    122128
  • trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java

    r8308 r8426  
    2020
    2121/**
    22  * This panel displays a summary of the objects to upload. It is displayed in
    23  * the upper part of the {@link UploadDialog}.
    24  *
     22 * This panel displays a summary of the objects to upload. It is displayed in the upper part of the {@link UploadDialog}.
     23 * @since 2599
    2524 */
    2625public class UploadedObjectsSummaryPanel extends JPanel {
     
    4039    private JScrollPane spDelete;
    4140
     41    /**
     42     * Constructs a new {@code UploadedObjectsSummaryPanel}.
     43     */
     44    public UploadedObjectsSummaryPanel() {
     45        build();
     46    }
     47
    4248    protected void build() {
    4349        setLayout(new GridBagLayout());
    4450        OsmPrimitivRenderer renderer = new OsmPrimitivRenderer();
    45         // initialize the three lists for uploaded primitives, but don't add
    46         // them to the dialog yet,  see setUploadedPrimitives()
     51        // initialize the three lists for uploaded primitives, but don't add them to the dialog yet, see setUploadedPrimitives()
    4752        //
    4853        lstAdd = new PrimitiveList();
     
    5156        spAdd = new JScrollPane(lstAdd);
    5257        lblAdd = new JLabel(tr("Objects to add:"));
     58        lblAdd.setLabelFor(lstAdd);
    5359
    5460        lstUpdate = new PrimitiveList();
     
    5763        spUpdate = new JScrollPane(lstUpdate);
    5864        lblUpdate = new JLabel(tr("Objects to modify:"));
     65        lblUpdate.setLabelFor(lstUpdate);
    5966
    6067        lstDelete = new PrimitiveList();
     
    6370        spDelete = new JScrollPane(lstDelete);
    6471        lblDelete = new JLabel(tr("Objects to delete:"));
     72        lblDelete.setLabelFor(lstDelete);
    6573    }
    6674
     
    121129    }
    122130
    123     public UploadedObjectsSummaryPanel() {
    124         build();
    125     }
    126 
    127131    /**
    128132     * Replies the number of objects to upload
     
    138142    /**
    139143     * A simple list of OSM primitives.
    140      *
    141144     */
    142145    static class PrimitiveList extends JList<OsmPrimitive> {
     146        /**
     147         * Constructs a new {@code PrimitiveList}.
     148         */
    143149        public PrimitiveList() {
    144150            super(new PrimitiveListModel());
     
    152158    /**
    153159     * A list model for a list of OSM primitives.
    154      *
    155160     */
    156161    static class PrimitiveListModel extends AbstractListModel<OsmPrimitive> {
    157162        private transient List<OsmPrimitive> primitives;
    158163
     164        /**
     165         * Constructs a new {@code PrimitiveListModel}.
     166         */
    159167        public PrimitiveListModel() {
    160168            primitives = new ArrayList<>();
Note: See TracChangeset for help on using the changeset viewer.