Changeset 5842 in josm
- Timestamp:
- 2013-04-12T00:16:55+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r5412 r5842 6 6 7 7 import java.awt.BorderLayout; 8 import java.awt.Component; 8 9 import java.awt.Dimension; 9 10 import java.awt.FlowLayout; 11 import java.awt.GridBagLayout; 10 12 import java.awt.Image; 11 13 import java.awt.event.ActionEvent; … … 15 17 import java.beans.PropertyChangeEvent; 16 18 import java.beans.PropertyChangeListener; 19 import java.util.ArrayList; 20 import java.util.Collection; 17 21 import java.util.Collections; 18 22 import java.util.List; … … 44 48 import org.openstreetmap.josm.gui.help.HelpUtil; 45 49 import org.openstreetmap.josm.io.OsmApi; 50 import org.openstreetmap.josm.tools.GBC; 46 51 import org.openstreetmap.josm.tools.ImageProvider; 47 52 import org.openstreetmap.josm.tools.InputMapUtils; … … 51 56 * This is a dialog for entering upload options like the parameters for 52 57 * the upload changeset and the strategy for opening/closing a changeset. 53 * 58 * 54 59 */ 55 60 public class UploadDialog extends JDialog implements PropertyChangeListener, PreferenceChangedListener{ 56 61 /** the unique instance of the upload dialog */ 57 62 static private UploadDialog uploadDialog; 63 64 /** 65 * List of custom components that can be added by plugins at JOSM startup. 66 */ 67 static private final Collection<Component> customComponents = new ArrayList<Component>(); 58 68 59 69 /** … … 95 105 */ 96 106 protected JPanel buildContentPanel() { 97 JPanel pnl = new JPanel( );107 JPanel pnl = new JPanel(new GridBagLayout()); 98 108 pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5)); 99 pnl.setLayout(new BorderLayout());100 109 101 110 // the panel with the list of uploaded objects 102 111 // 103 pnl.add(pnlUploadedObjects = new UploadedObjectsSummaryPanel(), BorderLayout.CENTER); 104 105 // a tabbed pane with two configuration panels in the 106 // lower half 112 pnl.add(pnlUploadedObjects = new UploadedObjectsSummaryPanel(), GBC.eol().fill(GBC.BOTH)); 113 114 // Custom components 115 for (Component c : customComponents) { 116 pnl.add(c, GBC.eol().fill(GBC.HORIZONTAL)); 117 } 118 119 // a tabbed pane with configuration panels in the lower half 107 120 // 108 121 tpConfigPanels = new JTabbedPane() { … … 114 127 } 115 128 }; 116 tpConfigPanels.add(new JPanel());117 tpConfigPanels.add(new JPanel());118 tpConfigPanels.add(new JPanel());119 tpConfigPanels.add(new JPanel());120 129 121 130 changesetCommentModel = new ChangesetCommentModel(); 122 131 123 tpConfigPanels. setComponentAt(0,pnlBasicUploadSettings = new BasicUploadSettingsPanel(changesetCommentModel));132 tpConfigPanels.add(pnlBasicUploadSettings = new BasicUploadSettingsPanel(changesetCommentModel)); 124 133 tpConfigPanels.setTitleAt(0, tr("Settings")); 125 134 tpConfigPanels.setToolTipTextAt(0, tr("Decide how to upload the data and which changeset to use")); 126 135 127 tpConfigPanels. setComponentAt(1,pnlTagSettings = new TagSettingsPanel(changesetCommentModel));136 tpConfigPanels.add(pnlTagSettings = new TagSettingsPanel(changesetCommentModel)); 128 137 tpConfigPanels.setTitleAt(1, tr("Tags of new changeset")); 129 138 tpConfigPanels.setToolTipTextAt(1, tr("Apply tags to the changeset data is uploaded to")); 130 139 131 tpConfigPanels. setComponentAt(2,pnlChangesetManagement = new ChangesetManagementPanel(changesetCommentModel));140 tpConfigPanels.add(pnlChangesetManagement = new ChangesetManagementPanel(changesetCommentModel)); 132 141 tpConfigPanels.setTitleAt(2, tr("Changesets")); 133 142 tpConfigPanels.setToolTipTextAt(2, tr("Manage open changesets and select a changeset to upload to")); 134 143 135 tpConfigPanels. setComponentAt(3,pnlUploadStrategySelectionPanel = new UploadStrategySelectionPanel());144 tpConfigPanels.add(pnlUploadStrategySelectionPanel = new UploadStrategySelectionPanel()); 136 145 tpConfigPanels.setTitleAt(3, tr("Advanced")); 137 146 tpConfigPanels.setToolTipTextAt(3, tr("Configure advanced settings")); 138 147 139 pnl.add(tpConfigPanels, BorderLayout.SOUTH);148 pnl.add(tpConfigPanels, GBC.eol().fill(GBC.HORIZONTAL)); 140 149 return pnl; 141 150 } … … 144 153 * builds the panel with the OK and CANCEL buttons 145 154 * 146 * @return 155 * @return The panel with the OK and CANCEL buttons 147 156 */ 148 157 protected JPanel buildActionPanel() { … … 360 369 } 361 370 super.setVisible(visible); 371 } 372 373 /** 374 * Adds a custom component to this dialog. 375 * Custom components added at JOSM startup are displayed between the objects list and the properties tab pane. 376 * @param c The custom component to add. If {@code null}, this method does nothing. 377 * @return {@code true} if the collection of custom components changed as a result of the call 378 * @since 5842 379 */ 380 public static boolean addCustomComponent(Component c) { 381 if (c != null) { 382 return customComponents.add(c); 383 } 384 return false; 362 385 } 363 386
Note:
See TracChangeset
for help on using the changeset viewer.