Changeset 3646 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-10-31T06:21:03+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/StyleSourceEditor.java
r3479 r3646 6 6 7 7 import java.awt.Component; 8 import java.awt.FlowLayout;9 8 import java.awt.GridBagConstraints; 10 9 import java.awt.GridBagLayout; … … 45 44 import javax.swing.JPanel; 46 45 import javax.swing.JScrollPane; 46 import javax.swing.JSeparator; 47 47 import javax.swing.JTable; 48 48 import javax.swing.JTextField; 49 import javax.swing.JToolBar; 49 50 import javax.swing.KeyStroke; 50 51 import javax.swing.ListCellRenderer; … … 101 102 lstAvailableStyles.setSelectionModel(selectionModel); 102 103 lstAvailableStyles.setCellRenderer(new StyleSourceCellRenderer()); 103 //availableStylesModel.setStyleSources(reloadAvailableStyles(availableStylesUrl));104 104 this.availableStylesUrl = availableStylesUrl; 105 105 … … 107 107 this.iconpref = iconsPreferenceKey; 108 108 109 JButton iconadd = null; 110 JButton iconedit = null; 111 JButton icondelete = null; 112 109 EditActiveStyleAction editActiveStyleAction = new EditActiveStyleAction(); 110 tblActiveStyles.getSelectionModel().addListSelectionListener(editActiveStyleAction); 111 112 RemoveActiveStylesAction removeActiveStylesAction = new RemoveActiveStylesAction(); 113 tblActiveStyles.getSelectionModel().addListSelectionListener(removeActiveStylesAction); 114 tblActiveStyles.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), "delete"); 115 tblActiveStyles.getActionMap().put("delete", removeActiveStylesAction); 116 117 ActivateStylesAction activateStylesAction = new ActivateStylesAction(); 118 lstAvailableStyles.addListSelectionListener(activateStylesAction); 119 JButton activate = new JButton(activateStylesAction); 120 121 setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 122 setLayout(new GridBagLayout()); 123 add(new JLabel(tr("Active styles:")), GBC.eol().insets(11, 5, 5, 0)); 124 JScrollPane sp = new JScrollPane(tblActiveStyles); 125 add(sp, GBC.std().insets(10, 0, 3, 0).fill(GBC.BOTH)); 126 sp.setColumnHeaderView(null); 127 128 JToolBar sideButtonTB = new JToolBar(JToolBar.VERTICAL); 129 sideButtonTB.setFloatable(false); 130 sideButtonTB.setBorderPainted(false); 131 sideButtonTB.setOpaque(false); 132 sideButtonTB.add(new NewActiveStyleAction()); 133 sideButtonTB.add(editActiveStyleAction); 134 sideButtonTB.add(removeActiveStylesAction); 135 add(sideButtonTB, GBC.eol().insets(0, 0, 10, 0).fill(GBC.VERTICAL)); 136 137 JToolBar bottomButtonTB = new JToolBar(); 138 bottomButtonTB.setFloatable(false); 139 bottomButtonTB.setBorderPainted(false); 140 bottomButtonTB.setOpaque(false); 141 bottomButtonTB.add(activate); 142 add(bottomButtonTB, GBC.eol().insets(12, 4, 5, 4).fill(GBC.HORIZONTAL)); 143 144 add(new JLabel(tr("Available styles (from {0}):", availableStylesUrl)), GBC.eol().insets(11, 0, 5, 0)); 145 add(new JScrollPane(lstAvailableStyles), GBC.std().insets(10, 0, 3, 0).fill(GBC.BOTH)); 146 147 sideButtonTB = new JToolBar(JToolBar.VERTICAL); 148 sideButtonTB.setFloatable(false); 149 sideButtonTB.setBorderPainted(false); 150 sideButtonTB.setOpaque(false); 151 sideButtonTB.add(new ReloadStylesAction(availableStylesUrl)); 152 add(sideButtonTB, GBC.eol().insets(0, 0, 10, 0).fill(GBC.VERTICAL)); 153 113 154 if (iconsPreferenceKey != null) { 114 155 selectionModel = new DefaultListSelectionModel(); … … 121 162 iconPathsModel.setIconPaths(Main.pref.getCollection(iconsPreferenceKey, null)); 122 163 123 iconadd = new JButton(new NewIconPathAction());124 125 164 EditIconPathAction editIconPathAction = new EditIconPathAction(); 126 165 tblIconPaths.getSelectionModel().addListSelectionListener(editIconPathAction); 127 iconedit = new JButton(editIconPathAction);128 166 129 167 RemoveIconPathAction removeIconPathAction = new RemoveIconPathAction(); 130 168 tblIconPaths.getSelectionModel().addListSelectionListener(removeIconPathAction); 131 icondelete = new JButton(removeIconPathAction);132 169 tblIconPaths.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), "delete"); 133 170 tblIconPaths.getActionMap().put("delete", removeIconPathAction); 134 } 135 136 JButton add = new JButton(new NewActiveStyleAction()); 137 138 EditActiveStyleAction editActiveStyleAction = new EditActiveStyleAction(); 139 tblActiveStyles.getSelectionModel().addListSelectionListener(editActiveStyleAction); 140 JButton edit = new JButton(editActiveStyleAction); 141 142 RemoveActiveStylesAction removeActiveStylesAction = new RemoveActiveStylesAction(); 143 tblActiveStyles.getSelectionModel().addListSelectionListener(removeActiveStylesAction); 144 tblActiveStyles.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), "delete"); 145 tblActiveStyles.getActionMap().put("delete", removeActiveStylesAction); 146 JButton delete = new JButton(removeActiveStylesAction); 147 148 ActivateStylesAction activateStylesAction = new ActivateStylesAction(); 149 lstAvailableStyles.addListSelectionListener(activateStylesAction); 150 JButton copy = new JButton(activateStylesAction); 151 152 JButton update = new JButton(new ReloadStylesAction(availableStylesUrl)); 153 154 setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); 155 setLayout(new GridBagLayout()); 156 add(new JLabel(tr("Active styles")), GBC.eol().insets(5, 5, 5, 0)); 157 JScrollPane sp; 158 add(sp = new JScrollPane(tblActiveStyles), GBC.eol().insets(5, 0, 5, 0).fill(GBC.BOTH)); 159 sp.setColumnHeaderView(null); 160 JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); 161 add(buttonPanel, GBC.eol().insets(5, 0, 5, 5).fill(GBC.HORIZONTAL)); 162 buttonPanel.add(add, GBC.std().insets(0, 5, 0, 0)); 163 buttonPanel.add(edit, GBC.std().insets(5, 5, 5, 0)); 164 buttonPanel.add(delete, GBC.std().insets(0, 5, 5, 0)); 165 buttonPanel.add(copy, GBC.std().insets(0, 5, 5, 0)); 166 add(new JLabel(tr("Available styles (from {0})", availableStylesUrl)), GBC.eol().insets(5, 5, 5, 0)); 167 add(new JScrollPane(lstAvailableStyles), GBC.eol().insets(5, 0, 5, 0).fill(GBC.BOTH)); 168 buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); 169 add(buttonPanel, GBC.eol().insets(5, 0, 5, 5).fill(GBC.HORIZONTAL)); 170 buttonPanel.add(update, GBC.std().insets(0, 5, 0, 0)); 171 if (tblIconPaths != null) { 172 add(new JLabel(tr("Icon paths")), GBC.eol().insets(5, -5, 5, 0)); 173 add(sp = new JScrollPane(tblIconPaths), GBC.eol().insets(5, 0, 5, 0).fill(GBC.BOTH)); 171 172 add(new JSeparator(), GBC.eol().fill(GBC.HORIZONTAL).insets(5, 10, 5, 10)); 173 add(new JLabel(tr("Icon paths:")), GBC.eol().insets(11, 0, 5, 0)); 174 add(sp = new JScrollPane(tblIconPaths), GBC.std().insets(10, 0, 3, 0).fill(GBC.BOTH)); 174 175 sp.setColumnHeaderView(null); 175 buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); 176 add(buttonPanel, GBC.eol().insets(5, 0, 5, 5).fill(GBC.HORIZONTAL)); 177 buttonPanel.add(iconadd); 178 buttonPanel.add(iconedit); 179 buttonPanel.add(icondelete); 176 sideButtonTB = new JToolBar(JToolBar.VERTICAL); 177 sideButtonTB.setFloatable(false); 178 sideButtonTB.setBorderPainted(false); 179 sideButtonTB.setOpaque(false); 180 add(sideButtonTB, GBC.eol().insets(0, 0, 10, 0).fill(GBC.VERTICAL)); 181 sideButtonTB.add(new NewIconPathAction()); 182 sideButtonTB.add(editIconPathAction); 183 sideButtonTB.add(removeIconPathAction); 180 184 } 181 185 } … … 530 534 putValue(NAME, tr("Reload")); 531 535 putValue(SHORT_DESCRIPTION, tr("Reloads the list of available styles from ''{0}''", url)); 532 putValue(SMALL_ICON, ImageProvider.get("d ownload"));536 putValue(SMALL_ICON, ImageProvider.get("dialogs/refresh")); 533 537 this.url = url; 534 538 }
Note:
See TracChangeset
for help on using the changeset viewer.