Changeset 2045 in josm


Ignore:
Timestamp:
2009-09-03T22:15:27+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3386: Upload dialog has empty areas when the changeset doesn't include all of add/modify/delete operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r2040 r2045  
    590590        private JLabel lblUpdate;
    591591        private JLabel lblDelete;
     592        private JPanel pnlLists;
    592593        private JCheckBox cbUseAtomicUpload;
    593594        private SuggestingJHistoryComboBox cmt;
     
    602603
    603604        protected JPanel buildListsPanel() {
    604             JPanel pnl = new JPanel();
    605             pnl.setLayout(new GridBagLayout());
    606 
    607             GridBagConstraints gcLabel = new GridBagConstraints();
    608             gcLabel.fill = GridBagConstraints.HORIZONTAL;
    609             gcLabel.weightx = 1.0;
    610             gcLabel.weighty = 0.0;
    611             gcLabel.anchor = GridBagConstraints.FIRST_LINE_START;
    612 
    613             GridBagConstraints gcList = new GridBagConstraints();
    614             gcList.fill = GridBagConstraints.BOTH;
    615             gcList.weightx = 1.0;
    616             gcList.weighty = 1.0;
    617             gcList.anchor = GridBagConstraints.CENTER;
    618 
    619             gcLabel.gridy = 0;
    620             pnl.add(lblAdd = new JLabel(tr("Objects to add:")), gcLabel);
    621 
    622             gcList.gridy = 1;
    623             pnl.add(new JScrollPane(lstAdd), gcList);
    624 
    625             gcLabel.gridy = 2;
    626             pnl.add(lblUpdate = new JLabel(tr("Objects to modify:")), gcLabel);
    627 
    628             gcList.gridy = 3;
    629             pnl.add(new JScrollPane(lstUpdate), gcList);
    630 
    631             gcLabel.gridy = 4;
    632             pnl.add(lblDelete = new JLabel(tr("Objects to delete:")), gcLabel);
    633 
    634             gcList.gridy = 5;
    635             pnl.add(new JScrollPane(lstDelete), gcList);
    636             return pnl;
     605            pnlLists = new JPanel();
     606            pnlLists.setLayout(new GridBagLayout());
     607
     608            return pnlLists;
    637609        }
    638610
     
    741713        public void setUploadedPrimitives(Collection<OsmPrimitive> add, Collection<OsmPrimitive> update, Collection<OsmPrimitive> delete) {
    742714            lstAdd.setListData(add.toArray());
    743             lstAdd.setVisible(!add.isEmpty());
    744             lblAdd.setVisible(!add.isEmpty());
    745715            lstUpdate.setListData(update.toArray());
    746             lstUpdate.setVisible(!update.isEmpty());
    747             lblUpdate.setVisible(!update.isEmpty());
    748716            lstDelete.setListData(delete.toArray());
    749             lstDelete.setVisible(!delete.isEmpty());
    750             lblDelete.setVisible(!delete.isEmpty());
     717
     718
     719            GridBagConstraints gcLabel = new GridBagConstraints();
     720            gcLabel.fill = GridBagConstraints.HORIZONTAL;
     721            gcLabel.weightx = 1.0;
     722            gcLabel.weighty = 0.0;
     723            gcLabel.anchor = GridBagConstraints.FIRST_LINE_START;
     724
     725            GridBagConstraints gcList = new GridBagConstraints();
     726            gcList.fill = GridBagConstraints.BOTH;
     727            gcList.weightx = 1.0;
     728            gcList.weighty = 1.0;
     729            gcList.anchor = GridBagConstraints.CENTER;
     730            pnlLists.removeAll();
     731            int y = -1;
     732            if (!add.isEmpty()) {
     733                y++;
     734                gcLabel.gridy = y;
     735                pnlLists.add(lblAdd = new JLabel(tr("Objects to add:")), gcLabel);
     736                y++;
     737                gcList.gridy = y;
     738                pnlLists.add(new JScrollPane(lstAdd), gcList);
     739            }
     740            if (!update.isEmpty()) {
     741                y++;
     742                gcLabel.gridy = y;
     743                pnlLists.add(lblUpdate = new JLabel(tr("Objects to modify:")), gcLabel);
     744                y++;
     745                gcList.gridy = y;
     746                pnlLists.add(new JScrollPane(lstUpdate), gcList);
     747            }
     748            if (!delete.isEmpty()) {
     749                y++;
     750                gcLabel.gridy = y;
     751                pnlLists.add(lblDelete = new JLabel(tr("Objects to delete:")), gcLabel);
     752                y++;
     753                gcList.gridy = y;
     754                pnlLists.add(new JScrollPane(lstDelete), gcList);
     755            }
    751756        }
    752757
Note: See TracChangeset for help on using the changeset viewer.