Changeset 23434 in osm for applications/editors/josm/plugins/graphview/src
- Timestamp:
- 2010-10-02T01:23:18+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/dialogs/GraphViewPreferenceEditor.java
r23189 r23434 1 1 package org.openstreetmap.josm.plugins.graphview.plugin.dialogs; 2 2 3 import java.awt.Color; 3 4 import java.awt.GridBagConstraints; 4 5 import java.awt.GridBagLayout; 6 import java.awt.GridLayout; 5 7 import java.awt.event.ActionEvent; 6 8 import java.awt.event.ActionListener; … … 15 17 import javax.swing.JButton; 16 18 import javax.swing.JCheckBox; 19 import javax.swing.JColorChooser; 17 20 import javax.swing.JComboBox; 18 21 import javax.swing.JFileChooser; … … 22 25 import javax.swing.JTextField; 23 26 24 import org.openstreetmap.josm.gui.preferences.PreferenceDialog;25 27 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 26 28 import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane; … … 48 50 49 51 private JCheckBox separateDirectionsCheckBox; 50 52 private JButton segmentColorButton; 53 private JPanel segmentColorField; 54 private JButton nodeColorButton; 55 private JPanel nodeColorField; 56 51 57 public void addGui(PreferenceTabbedPane gui) { 52 58 … … 174 180 return vehiclePanel; 175 181 } 176 182 177 183 private JPanel createVisualizationPanel() { 178 179 JPanel visualizationPanel = new JPanel(); 180 visualizationPanel.setBorder(BorderFactory.createTitledBorder("visualization")); 181 visualizationPanel.setLayout(new BoxLayout(visualizationPanel, BoxLayout.Y_AXIS)); 182 183 separateDirectionsCheckBox = new JCheckBox("draw directions separately"); 184 separateDirectionsCheckBox.setSelected(GraphViewPreferences.getInstance().getSeparateDirections()); 185 visualizationPanel.add(separateDirectionsCheckBox); 186 187 return visualizationPanel; 184 185 JPanel visualizationPanel = new JPanel(); 186 visualizationPanel.setBorder(BorderFactory.createTitledBorder("visualization")); 187 visualizationPanel.setLayout(new BoxLayout(visualizationPanel, BoxLayout.Y_AXIS)); 188 189 separateDirectionsCheckBox = new JCheckBox("draw directions separately"); 190 separateDirectionsCheckBox.setSelected(GraphViewPreferences.getInstance().getSeparateDirections()); 191 visualizationPanel.add(separateDirectionsCheckBox); 192 193 { // create color chooser panel 194 195 JPanel colorPanel = new JPanel(); 196 colorPanel.setLayout(new GridLayout(2, 2)); 197 198 Color nodeColor = GraphViewPreferences.getInstance().getNodeColor(); 199 200 nodeColorButton = new JButton("node color"); 201 nodeColorButton.addActionListener(chooseNodeColorActionListener); 202 colorPanel.add(nodeColorButton); 203 nodeColorField = new JPanel(); 204 nodeColorField.setBackground(nodeColor); 205 colorPanel.add(nodeColorField); 206 207 Color segmentColor = GraphViewPreferences.getInstance().getSegmentColor(); 208 209 segmentColorButton = new JButton("arrow color"); 210 segmentColorButton.addActionListener(chooseSegmentColorActionListener); 211 colorPanel.add(segmentColorButton); 212 segmentColorField = new JPanel(); 213 segmentColorField.setBackground(segmentColor); 214 colorPanel.add(segmentColorField); 215 216 visualizationPanel.add(colorPanel); 217 218 } 219 220 return visualizationPanel; 188 221 } 189 222 … … 202 235 preferences.setSeparateDirections(separateDirectionsCheckBox.isSelected()); 203 236 237 preferences.setNodeColor(nodeColorField.getBackground()); 238 preferences.setSegmentColor(segmentColorField.getBackground()); 239 204 240 preferences.distributeChanges(); 205 241 … … 333 369 } 334 370 }; 371 372 private final ActionListener chooseNodeColorActionListener = new ActionListener() { 373 public void actionPerformed(ActionEvent e) { 374 375 Color selectedColor = JColorChooser.showDialog( 376 preferencePanel, "Choose node color", nodeColorField.getBackground()); 377 378 if (selectedColor != null) { 379 nodeColorField.setBackground(selectedColor); 380 } 381 382 } 383 }; 384 385 private final ActionListener chooseSegmentColorActionListener = new ActionListener() { 386 public void actionPerformed(ActionEvent e) { 387 388 Color selectedColor = JColorChooser.showDialog( 389 preferencePanel, "Choose arrow color", segmentColorField.getBackground()); 390 391 if (selectedColor != null) { 392 segmentColorField.setBackground(selectedColor); 393 } 394 395 } 396 }; 335 397 336 398 private void updateRulesetPanel() { -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/layer/GraphViewLayer.java
r23189 r23434 179 179 } else { 180 180 181 g2D.setColor(Color.WHITE); 182 181 Color color = GraphViewPreferences.getInstance().getSegmentColor(); 182 g2D.setColor(color); 183 183 184 Point p1 = getNodePoint(e.getStartNode(), mv); 184 185 Point p2 = getNodePoint(e.getTargetNode(), mv); -
applications/editors/josm/plugins/graphview/src/org/openstreetmap/josm/plugins/graphview/plugin/preferences/GraphViewPreferences.java
r23189 r23434 36 36 * changes will also be synchronized (two-way) with JOSM's preference storage. 37 37 * This is a singleton class. 38 * 39 * Note: Currently, manual updates in the "advanced preferences" will not have any effect 40 * because this class isn't registered as a preference listener. 38 41 */ 39 42 public class GraphViewPreferences extends Observable {
Note:
See TracChangeset
for help on using the changeset viewer.