Changeset 14395 in osm for applications/editors/josm/plugins
- Timestamp:
- 2009-04-03T13:19:41+02:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java
r14365 r14395 113 113 */ 114 114 private IconToggleButton moveRouteNodeButton; 115 116 /** 117 * IconToggleButton for moving route nodes, we use this field to show or hide the button. 118 */ 119 private RoutingMenu menu; 115 120 116 121 /** … … 133 138 // Add routing layer 134 139 routingLayer = new RoutingLayer(tr("Navigation")); 135 Main.main.menu.add(new RoutingMenu(tr("Routing"))); 140 // Add menu 141 menu = new RoutingMenu(tr("Routing")); 142 Main.main.menu.add(menu); 136 143 // Register this class as LayerChangeListener 137 144 Layer.listeners.add(this); … … 188 195 removeRouteNodeButton.setVisible(false); 189 196 moveRouteNodeButton.setVisible(false); 197 // Enable menu 198 menu.enableStartItem(); 190 199 newFrame.addToggleDialog(routingDialog); 191 200 } … … 209 218 removeRouteNodeButton.setVisible(true); 210 219 moveRouteNodeButton.setVisible(true); 220 menu.enableRestOfItems(); 211 221 logger.debug("Added routing layer."); 212 222 } … … 223 233 removeRouteNodeButton.setVisible(false); 224 234 moveRouteNodeButton.setVisible(false); 235 menu.disableRestOfItems(); 225 236 logger.debug("Removed routing layer."); 226 237 } -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/gui/RoutingMenu.java
r14287 r14395 60 60 private static final long serialVersionUID = 3559922048225708480L; 61 61 62 private JMenuItem startMI; 63 private JMenuItem reverseMI; 64 private JMenuItem clearMI; 65 private JMenu criteriaM; 66 62 67 /** 63 68 * @param s … … 71 76 JMenu m; 72 77 73 mi= new JMenuItem(tr("Start routing"));74 mi.addActionListener(new ActionListener() {78 startMI = new JMenuItem(tr("Start routing")); 79 startMI.addActionListener(new ActionListener() { 75 80 public void actionPerformed(ActionEvent e) { 76 81 if(!routingLayer.isLayerAdded()) { … … 80 85 } 81 86 }); 82 this.add( mi);87 this.add(startMI); 83 88 84 89 this.addSeparator(); 85 90 ButtonGroup group = new ButtonGroup(); 86 91 87 m= new JMenu(tr("Criteria"));92 criteriaM = new JMenu(tr("Criteria")); 88 93 89 94 JRadioButtonMenuItem rshorter = new JRadioButtonMenuItem(tr("Shortest")); … … 110 115 group.add(rshorter); 111 116 group.add(rfaster); 112 m.add(rshorter);113 m.add(rfaster);117 criteriaM.add(rshorter); 118 criteriaM.add(rfaster); 114 119 115 m.addSeparator();120 criteriaM.addSeparator(); 116 121 JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem("Ignore oneways"); 117 122 cbmi.addItemListener(new ItemListener() { … … 125 130 } 126 131 }); 127 m.add(cbmi);128 this.add( m);132 criteriaM.add(cbmi); 133 this.add(criteriaM); 129 134 130 135 this.addSeparator(); 131 mi= new JMenuItem(tr("Reverse route"));132 mi.addActionListener(new ActionListener() {136 reverseMI = new JMenuItem(tr("Reverse route")); 137 reverseMI.addActionListener(new ActionListener() { 133 138 public void actionPerformed(ActionEvent e) { 134 139 routingModel.reverseNodes(); … … 136 141 } 137 142 }); 138 this.add( mi);143 this.add(reverseMI); 139 144 140 mi= new JMenuItem(tr("Clear route"));141 mi.addActionListener(new ActionListener() {145 clearMI = new JMenuItem(tr("Clear route")); 146 clearMI.addActionListener(new ActionListener() { 142 147 public void actionPerformed(ActionEvent e) { 143 148 // Reset routing nodes and paths … … 147 152 } 148 153 }); 149 this.add( mi);154 this.add(clearMI); 150 155 156 // Initially disabled 157 disableAllItems(); 151 158 } 152 159 160 public void disableAllItems() { 161 startMI.setEnabled(false); 162 reverseMI.setEnabled(false); 163 clearMI.setEnabled(false); 164 criteriaM.setEnabled(false); 165 } 153 166 167 public void enableStartItem() { 168 startMI.setEnabled(true); 169 } 170 171 public void enableRestOfItems() { 172 reverseMI.setEnabled(true); 173 clearMI.setEnabled(true); 174 criteriaM.setEnabled(true); 175 } 176 177 public void disableRestOfItems() { 178 reverseMI.setEnabled(false); 179 clearMI.setEnabled(false); 180 criteriaM.setEnabled(false); 181 } 154 182 }
Note:
See TracChangeset
for help on using the changeset viewer.