Changeset 5283 in josm for trunk/src


Ignore:
Timestamp:
2012-06-17T18:26:55+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #7695 - Ensure the "should be uploaded/saved" panels displayed at JOSM closure aren't mixed up between distinct layers

File:
1 edited

Legend:

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

    r5233 r5283  
    1919class SaveLayersTableColumnModel extends DefaultTableColumnModel {
    2020    /** small renderer class that handles the "should be uploaded/saved" texts. */
    21     private static class RecommendedActionsTableCell extends JPanel implements TableCellRenderer {
     21    private static class RecommendedActionsTableCell implements TableCellRenderer {
    2222        private final static JPanel pnlEmpty = new JPanel();
    2323        private final static JLabel needsUpload = new JLabel(tr("should be uploaded"));
     
    2626
    2727        public RecommendedActionsTableCell() {
    28             setLayout(new GridBagLayout());
    2928            pnlEmpty.setPreferredSize(new Dimension(1, 19));
    3029            needsUpload.setPreferredSize(new Dimension(needsUpload.getPreferredSize().width, 19));
     
    3433        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
    3534                boolean hasFocus, int row, int column) {
     35            JPanel panel = new JPanel(new GridBagLayout());
    3636            SaveLayerInfo info = (SaveLayerInfo)value;
    3737            StringBuilder sb = new StringBuilder();
    3838            sb.append("<html>");
    3939            if (info.getLayer().requiresUploadToServer() && !info.getLayer().isUploadDiscouraged()) {
    40                 add(needsUpload, defaultCellStyle);
     40                panel.add(needsUpload, defaultCellStyle);
    4141                sb.append(tr("Layer ''{0}'' has modifications which should be uploaded to the server.", info.getName()));
    4242
    4343            } else {
    44                 add(pnlEmpty, defaultCellStyle);
     44                panel.add(pnlEmpty, defaultCellStyle);
    4545                if (info.getLayer().requiresUploadToServer()) {
    4646                    sb.append(tr("Layer ''{0}'' has modifications which are discouraged to be uploaded.", info.getName()));
     
    5252
    5353            if (info.getLayer().requiresSaveToFile()) {
    54                 add(needsSave, defaultCellStyle);
     54                panel.add(needsSave, defaultCellStyle);
    5555                sb.append(tr("Layer ''{0}'' has modifications which should be saved to its associated file ''{1}''.", info.getName(), info.getFile().toString()));
    5656            } else {
    57                 add(pnlEmpty, defaultCellStyle);
     57                panel.add(pnlEmpty, defaultCellStyle);
    5858                sb.append(tr("Layer ''{0}'' has no modifications to be saved.", info.getName()));
    5959            }
    6060            sb.append("</html>");
    61             setToolTipText(sb.toString());
    62             return this;
     61            panel.setToolTipText(sb.toString());
     62            return panel;
    6363        }
    6464    }
Note: See TracChangeset for help on using the changeset viewer.