Changeset 155 in josm
- Timestamp:
- 2006-10-08T17:29:58+02:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 2 added
- 1 deleted
- 20 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/Main.java
r154 r155 8 8 import java.awt.Toolkit; 9 9 import java.awt.event.ActionEvent; 10 import java.awt.event.KeyEvent; 10 11 import java.io.File; 11 12 import java.net.URI; … … 22 23 import javax.swing.AbstractAction; 23 24 import javax.swing.Action; 25 import javax.swing.JComponent; 24 26 import javax.swing.JMenu; 25 27 import javax.swing.JMenuBar; … … 28 30 import javax.swing.JSeparator; 29 31 import javax.swing.JToolBar; 30 import javax.swing. SwingUtilities;32 import javax.swing.KeyStroke; 31 33 import javax.swing.UIManager; 32 34 … … 37 39 import org.openstreetmap.josm.actions.ExternalToolsAction; 38 40 import org.openstreetmap.josm.actions.GpxExportAction; 41 import org.openstreetmap.josm.actions.HelpAction; 39 42 import org.openstreetmap.josm.actions.OpenAction; 40 43 import org.openstreetmap.josm.actions.PreferencesAction; … … 104 107 */ 105 108 public static PleaseWaitDialog pleaseWaitDlg; 109 /** 110 * The access to the help subsystem 111 */ 112 public HelpAction help; 106 113 107 114 … … 192 199 final Action exitAction = new ExitAction(); 193 200 final Action preferencesAction = new PreferencesAction(); 201 help = new HelpAction(); 194 202 final Action aboutAction = new AboutAction(); 195 203 … … 235 243 final JMenu helpMenu = new JMenu(tr("Help")); 236 244 helpMenu.setMnemonic('H'); 245 helpMenu.add(help); 246 helpMenu.add(aboutAction); 247 helpMenu.addSeparator(); 237 248 helpMenu.add(annotationTesterAction); 238 helpMenu.addSeparator();239 helpMenu.add(aboutAction);240 249 mainMenu.add(helpMenu); 241 250 … … 256 265 contentPane.add(toolBar, BorderLayout.NORTH); 257 266 267 contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), "Help"); 268 contentPane.getActionMap().put("Help", help); 269 258 270 contentPane.updateUI(); 259 260 // Plugins 261 if (Main.pref.hasKey("plugins")) { 271 } 272 273 /** 274 * Load all plugins specified in preferences. Has to be called after the complete 275 * GUI has been set up. (post-constructor) 276 */ 277 public void loadPlugins() { 278 if (Main.pref.hasKey("plugins")) { 262 279 for (String pluginName : Main.pref.get("plugins").split(",")) { 263 280 try { … … 273 290 } 274 291 } 275 276 SwingUtilities.updateComponentTreeUI(parent); 277 for (DownloadTask task : downloadAction.downloadTasks) 278 task.getCheckBox().updateUI(); 279 } 292 } 280 293 281 294 /** -
src/org/openstreetmap/josm/actions/AutoScaleAction.java
r113 r155 27 27 28 28 private static final String[] modes = { 29 marktr("data"), 29 marktr("data"), 30 30 marktr("selection"), 31 31 marktr("layer"), … … 39 39 public Action(String mode) { 40 40 super(tr("Auto Scale: {0}", tr(mode)), ImageProvider.get("dialogs/autoscale/"+mode)); 41 String modeHelp = Character.toUpperCase(mode.charAt(0))+mode.substring(1); 42 putValue("help", "Action/AutoScale/"+modeHelp); 41 43 putValue(SHORT_DESCRIPTION, tr("Auto zoom the view (to {0}. Disabled if the view is moved)", tr(mode))); 42 44 this.mode = mode; … … 73 75 } else if (mode.equals("layer")) 74 76 mapFrame.mapView.getActiveLayer().visitBoundingBox(v); 75 else if (mode.equals("selection") || mode.equals("conflict")) { 77 else if (mode.equals("selection") || mode.equals("conflict")) { 76 78 Collection<OsmPrimitive> sel = mode.equals("selection") ? Main.ds.getSelected() : mapFrame.conflictDialog.conflicts.keySet(); 77 79 for (OsmPrimitive osm : sel) -
src/org/openstreetmap/josm/actions/JosmAction.java
r113 r155 18 18 /** 19 19 * Construct the action as menu action entry. 20 * 20 * 21 21 * @param name Name of the action (entry name in menu) 22 22 * @param iconName Name of the icon (without extension) … … 33 33 public JosmAction(String name, String iconName, String tooltip, int shortCut, int modifier) { 34 34 super(name, ImageProvider.get(iconName)); 35 setHelpId(); 35 36 putValue(SHORT_DESCRIPTION, "<html>"+tooltip+" <font size='-2'>"+ShortCutLabel.name(shortCut, modifier)+"</font> </html>"); 36 //Main.panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(shortCut, name);37 //Main.panel.getActionMap().put(name, this);38 37 Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(shortCut, modifier), name); 39 38 Main.contentPane.getActionMap().put(name, this); … … 41 40 42 41 public JosmAction() { 42 setHelpId(); 43 } 44 45 46 private void setHelpId() { 47 String helpId = "Action/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1); 48 if (helpId.endsWith("Action")) 49 helpId = helpId.substring(0, helpId.length()-6); 50 putValue("help", helpId); 43 51 } 44 52 } -
src/org/openstreetmap/josm/actions/mapmode/AddNodeAction.java
r137 r155 29 29 * This mode adds a new node to the dataset. The user clicks on a place to add 30 30 * and there is it. Nothing more, nothing less. 31 * 32 * Newly created nodes are selected. Shift modifier does not cancel the old 31 * 32 * Newly created nodes are selected. Shift modifier does not cancel the old 33 33 * selection as usual. 34 * 34 * 35 35 * @author imi 36 36 * … … 44 44 public AddNodeGroup(MapFrame mf) { 45 45 super(KeyEvent.VK_N,0); 46 putValue("help", "Action/AddNode"); 46 47 actions.add(new AddNodeAction(mf,tr("Add node"), Mode.node, tr("Add a new node to the map"))); 47 48 actions.add(new AddNodeAction(mf, tr("Add node into segment"), Mode.nodesegment,tr( "Add a node into an existing segment"))); … … 53 54 super(name, "node/"+mode, desc, mapFrame, ImageProvider.getCursor("crosshair", "node")); 54 55 this.mode = mode; 56 putValue("help", "Action/AddNode/"+Character.toUpperCase(mode.toString().charAt(0))+mode.toString().substring(1)); 55 57 } 56 58 … … 70 72 * If user clicked with the left button, add a node at the current mouse 71 73 * position. 72 * 74 * 73 75 * If in nodesegment mode, add the node to the line segment by splitting the 74 76 * segment. The new created segment will be inserted in every way the segment … … 102 104 n.coor = Main.proj.eastNorth2latlon(n.eastNorth); 103 105 } 104 106 105 107 Collection<Command> cmds = new LinkedList<Command>(); 106 108 cmds.add(c); -
src/org/openstreetmap/josm/actions/mapmode/SelectionAction.java
r151 r155 24 24 /** 25 25 * This MapMode enables the user to easy make a selection of different objects. 26 * 26 * 27 27 * The selected objects are drawn in a different style. 28 * 29 * Holding and dragging the left mouse button draws an selection rectangle. 30 * When releasing the left mouse button, all objects within the rectangle get 31 * selected. 32 * 28 * 29 * Holding and dragging the left mouse button draws an selection rectangle. 30 * When releasing the left mouse button, all objects within the rectangle get 31 * selected. 32 * 33 33 * When releasing the left mouse button while the right mouse button pressed, 34 34 * nothing happens (the selection rectangle will be cleared, however). … … 36 36 * When releasing the mouse button and one of the following keys was hold: 37 37 * 38 * If Alt key was hold, select all objects that are touched by the 39 * selection rectangle. If the Alt key was not hold, select only those objects 40 * completly within (e.g. for ways mean: only if all nodes of the way are 41 * within). 38 * If Alt key was hold, select all objects that are touched by the 39 * selection rectangle. If the Alt key was not hold, select only those objects 40 * completly within (e.g. for ways mean: only if all nodes of the way are 41 * within). 42 42 * 43 43 * If Shift key was hold, the objects are added to the current selection. If 44 44 * Shift key wasn't hold, the current selection get replaced. 45 * 45 * 46 46 * If Ctrl key was hold, remove all objects under the current rectangle from 47 47 * the active selection (if there were any). Nothing is added to the current … … 51 51 * If both are pressed, nothing happens when releasing the mouse button. 52 52 * 53 * The user can also only click on the map. All total movements of 2 or less 53 * The user can also only click on the map. All total movements of 2 or less 54 54 * pixel are considered "only click". If that happens, the nearest Node will 55 55 * be selected if there is any within 10 pixel range. If there is no Node within 56 56 * 10 pixel, the nearest Segment (or Street, if user hold down the Alt-Key) 57 57 * within 10 pixel range is selected. If there is no Segment within 10 pixel 58 * and the user clicked in or 10 pixel away from an area, this area is selected. 59 * If there is even no area, nothing is selected. Shift and Ctrl key applies to 58 * and the user clicked in or 10 pixel away from an area, this area is selected. 59 * If there is even no area, nothing is selected. Shift and Ctrl key applies to 60 60 * this as usual. For more, @see MapView#getNearest(Point, boolean) 61 61 * … … 70 70 public Group(MapFrame mf) { 71 71 super(KeyEvent.VK_S,0); 72 putValue("help", "Action/Selection"); 72 73 actions.add(new SelectionAction(mf, tr("Selection"), Mode.select, tr("Select objects by dragging or clicking."))); 73 74 actions.add(new SelectionAction(mf, tr("Straight line"), Mode.straight, tr("Select objects in a straight line."))); … … 96 97 super(name, "selection/"+mode, desc, mapFrame, ImageProvider.getCursor("normal", "selection")); 97 98 this.mode = mode; 99 putValue("help", "Action/Selection/"+Character.toUpperCase(mode.toString().charAt(0))+mode.toString().substring(1)); 98 100 this.selectionManager = new SelectionManager(this, false, mapFrame.mapView); 99 101 } … … 149 151 curSel = new LinkedList<OsmPrimitive>(); // new selection will replace the old. 150 152 else 151 curSel = Main.ds.getSelected(); 153 curSel = Main.ds.getSelected(); 152 154 153 155 Collection<OsmPrimitive> selectionList = selectionManager.getObjectsInRectangle(r,alt); … … 196 198 197 199 /** 198 * Get the shortest path by stepping through the node with a common segment with start 200 * Get the shortest path by stepping through the node with a common segment with start 199 201 * and nearest to the end (greedy algorithm). 200 202 */ -
src/org/openstreetmap/josm/gui/MainApplication.java
r153 r155 172 172 Main.parent = mainFrame; 173 173 Main main = new MainApplication(mainFrame); 174 main.loadPlugins(); 174 175 175 176 mainFrame.setVisible(true); -
src/org/openstreetmap/josm/gui/MapFrame.java
r128 r155 29 29 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 30 30 import org.openstreetmap.josm.gui.dialogs.HistoryDialog; 31 import org.openstreetmap.josm.gui.dialogs.LayerList ;31 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 32 32 import org.openstreetmap.josm.gui.dialogs.PropertiesDialog; 33 33 import org.openstreetmap.josm.gui.dialogs.SelectionListDialog; … … 118 118 toggleDialogs.setLayout(new BoxLayout(toggleDialogs, BoxLayout.Y_AXIS)); 119 119 120 addIconToggle(toggleDialogs, new LayerList (this));120 addIconToggle(toggleDialogs, new LayerListDialog(this)); 121 121 addIconToggle(toggleDialogs, new PropertiesDialog(this)); 122 122 addIconToggle(toggleDialogs, new HistoryDialog()); -
src/org/openstreetmap/josm/gui/MapScaler.java
r116 r155 7 7 8 8 import org.openstreetmap.josm.Main; 9 import org.openstreetmap.josm.actions.HelpAction.Helpful; 9 10 import org.openstreetmap.josm.tools.ColorHelper; 10 11 11 public class MapScaler extends JComponent {12 public class MapScaler extends JComponent implements Helpful { 12 13 13 14 private final MapView mv; … … 29 30 g.drawString(text, (int)(50-bound.getWidth()/2), 23); 30 31 } 32 33 public String helpTopic() { 34 return "MapView/Scaler"; 35 } 31 36 } -
src/org/openstreetmap/josm/gui/MapSlider.java
r115 r155 10 10 import javax.swing.event.ChangeListener; 11 11 12 import org.openstreetmap.josm.actions.HelpAction.Helpful; 12 13 import org.openstreetmap.josm.data.coor.EastNorth; 13 14 14 class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener {15 class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener, Helpful { 15 16 16 17 private final MapView mv; … … 49 50 this.mv.zoomTo(this.mv.center, pos.north()*2/(this.mv.getHeight()-20)); 50 51 } 52 53 public String helpTopic() { 54 return "MapView/Slider"; 55 } 51 56 } -
src/org/openstreetmap/josm/gui/MapStatus.java
r142 r155 27 27 28 28 import org.openstreetmap.josm.Main; 29 import org.openstreetmap.josm.actions.HelpAction.Helpful; 29 30 import org.openstreetmap.josm.data.coor.LatLon; 30 31 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 36 37 * It keeps a status line below the map up to date and displays some tooltip 37 38 * information if the user hold the mouse long enough at some point. 38 * 39 * 39 40 * All this is done in background to not disturb other processes. 40 * 41 * 41 42 * The background thread does not alter any data of the map (read only thread). 42 43 * Also it is rather fail safe. In case of some error in the data, it just do 43 44 * nothing instead of whining and complaining. 44 * 45 * 45 46 * @author imi 46 47 */ 47 public class MapStatus extends JPanel {48 49 /** 50 * The MapView this status belongs. 48 public class MapStatus extends JPanel implements Helpful { 49 50 /** 51 * The MapView this status belongs. 51 52 */ 52 53 final MapView mv; … … 63 64 * The collector class that waits for notification and then update 64 65 * the display objects. 65 * 66 * 66 67 * @author imi 67 68 */ … … 107 108 // This try/catch is a hack to stop the flooding bug reports about this. 108 109 // The exception needed to handle with in the first place, means that this 109 // access to the data need to be restarted, if the main thread modifies 110 // access to the data need to be restarted, if the main thread modifies 110 111 // the data. 111 112 try { … … 242 243 }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK); 243 244 } 245 246 public String helpTopic() { 247 return "Statusline"; 248 } 244 249 } -
src/org/openstreetmap/josm/gui/NavigatableComponent.java
r104 r155 8 8 9 9 import org.openstreetmap.josm.Main; 10 import org.openstreetmap.josm.actions.HelpAction.Helpful; 10 11 import org.openstreetmap.josm.data.coor.EastNorth; 11 12 import org.openstreetmap.josm.data.coor.LatLon; … … 19 20 * An component that can be navigated by a mapmover. Used as map view and for the 20 21 * zoomer in the download dialog. 21 * 22 * 22 23 * @author imi 23 24 */ 24 public class NavigatableComponent extends JComponent {25 public class NavigatableComponent extends JComponent implements Helpful { 25 26 26 27 … … 29 30 /** 30 31 * The scale factor in x or y-units per pixel. This means, if scale = 10, 31 * every physical pixel on screen are 10 x or 10 y units in the 32 * every physical pixel on screen are 10 x or 10 y units in the 32 33 * northing/easting space of the projection. 33 34 */ … … 53 54 return 32; 54 55 } 55 56 56 57 /** 57 58 * Return the current scale value. … … 73 74 * @param x X-Pixelposition to get coordinate from 74 75 * @param y Y-Pixelposition to get coordinate from 75 * 76 * 76 77 * @return Geographic coordinates from a specific pixel coordination 77 78 * on the screen. … … 86 87 * @param x X-Pixelposition to get coordinate from 87 88 * @param y Y-Pixelposition to get coordinate from 88 * 89 * 89 90 * @return Geographic unprojected coordinates from a specific pixel coordination 90 91 * on the screen. … … 164 165 minPrimitive = w; 165 166 } 166 } 167 } 167 168 } 168 169 return minPrimitive; … … 195 196 /** 196 197 * Return the object, that is nearest to the given screen point. 197 * 198 * 198 199 * First, a node will be searched. If a node within 10 pixel is found, the 199 200 * nearest node is returned. 200 * 201 * 201 202 * If no node is found, search for pending segments. 202 * 203 * If no such segment is found, and a non-pending segment is 204 * within 10 pixel to p, this segment is returned, except when 205 * <code>wholeWay</code> is <code>true</code>, in which case the 203 * 204 * If no such segment is found, and a non-pending segment is 205 * within 10 pixel to p, this segment is returned, except when 206 * <code>wholeWay</code> is <code>true</code>, in which case the 206 207 * corresponding Way is returned. 207 * 208 * 208 209 * If no segment is found and the point is within an area, return that 209 210 * area. 210 * 211 * 211 212 * If no area is found, return <code>null</code>. 212 * 213 * 213 214 * @param p The point on screen. 214 215 * @param segmentInsteadWay Whether the segment (true) or only the whole … … 226 227 227 228 /** 228 * @return A list of all objects that are nearest to 229 * the mouse. To do this, first the nearest object is 229 * @return A list of all objects that are nearest to 230 * the mouse. To do this, first the nearest object is 230 231 * determined. 231 * 232 * 232 233 * If its a node, return all segments and 233 234 * streets the node is part of, as well as all nodes 234 235 * (with their segments and ways) with the same 235 236 * location. 236 * 237 * If its a segment, return all ways this segment 237 * 238 * If its a segment, return all ways this segment 238 239 * belongs to as well as all segments that are between 239 240 * the same nodes (in both direction) with all their ways. 240 * 241 * 241 242 * @return A collection of all items or <code>null</code> 242 243 * if no item under or near the point. The returned … … 258 259 if (!ls.deleted && !ls.incomplete && (c.contains(ls.from) || c.contains(ls.to))) 259 260 c.add(ls); 260 } 261 } 261 262 if (osm instanceof Segment) { 262 263 Segment line = (Segment)osm; … … 286 287 return Main.proj; 287 288 } 289 290 public String helpTopic() { 291 String n = getClass().getName(); 292 return n.substring(n.lastIndexOf('.')+1); 293 } 288 294 } -
src/org/openstreetmap/josm/gui/WorldChooser.java
r116 r155 44 44 */ 45 45 private double scaleMax; 46 46 47 47 /** 48 48 * Mark this rectangle (lat/lon values) when painting. … … 51 51 52 52 private Projection projection; 53 53 54 54 /** 55 55 * Create the chooser component. -
src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r119 r155 68 68 } 69 69 }); 70 button.putClientProperty("help", "Dialog/Conflict/Resolve"); 70 71 buttonPanel.add(button); 71 72 … … 80 81 } 81 82 }); 83 button.putClientProperty("help", "Dialog/Conflict/Select"); 82 84 buttonPanel.add(button); 83 85 … … 132 134 model.addElement(osm); 133 135 } 134 136 135 137 public final void add(Map<OsmPrimitive, OsmPrimitive> conflicts) { 136 138 this.conflicts.putAll(conflicts); … … 139 141 140 142 /** 141 * Paint all conflicts that can be expressed on the main window. 143 * Paint all conflicts that can be expressed on the main window. 142 144 */ 143 145 public void paintConflicts(final Graphics g, final NavigatableComponent nc) { -
src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java
r143 r155 38 38 /** 39 39 * History dialog works like follows: 40 * 40 * 41 41 * There is a history cache hold in the back for primitives of the last refresh. 42 42 * When the user refreshes, this cache is cleared and all currently selected items 43 43 * are reloaded. 44 * If the user has selected at least one primitive not in the cache, the list 44 * If the user has selected at least one primitive not in the cache, the list 45 45 * is not displayed. Elsewhere, the list of all changes of all currently selected 46 46 * objects are displayed. 47 * 47 * 48 48 * @author imi 49 49 */ … … 130 130 }); 131 131 reloadButton.setToolTipText(tr("Reload all currently selected objects and refresh the list.")); 132 reloadButton.putClientProperty("help", "Dialog/History/Reload"); 132 133 revertButton.addActionListener(new ActionListener(){ 133 134 public void actionPerformed(ActionEvent e) { … … 136 137 }); 137 138 revertButton.setToolTipText(tr("Revert the state of all currently selected objects to the version selected in the history list.")); 139 revertButton.putClientProperty("help", "Dialog/History/Revert"); 138 140 } 139 141 -
src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r153 r155 42 42 * @author imi 43 43 */ 44 public class LayerList extends ToggleDialog implements LayerChangeListener {44 public class LayerListDialog extends ToggleDialog implements LayerChangeListener { 45 45 46 46 /** … … 57 57 super(tr("Delete"), ImageProvider.get("dialogs", "delete")); 58 58 putValue(SHORT_DESCRIPTION, tr("Delete the selected layer.")); 59 putValue("help", "Dialog/LayerList/Delete"); 59 60 this.layer = layer; 60 61 } … … 79 80 super(tr("Show/Hide"), ImageProvider.get("dialogs", "showhide")); 80 81 putValue(SHORT_DESCRIPTION, tr("Toggle visible state of the selected layer.")); 82 putValue("help", "Dialog/LayerList/ShowHide"); 81 83 this.layer = layer; 82 84 } … … 96 98 /** 97 99 * The merge action. This is only called, if the current selection and its 98 * item below are editable datasets and the merge button is clicked. 100 * item below are editable datasets and the merge button is clicked. 99 101 */ 100 102 private final JButton mergeButton = new JButton(ImageProvider.get("dialogs", "mergedown")); … … 115 117 * Create an layerlist and attach it to the given mapView. 116 118 */ 117 public LayerList (MapFrame mapFrame) {119 public LayerListDialog(MapFrame mapFrame) { 118 120 super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), KeyEvent.VK_L, 100); 119 121 instance = new JList(model); … … 123 125 @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { 124 126 Layer layer = (Layer)value; 125 JLabel label = (JLabel)super.getListCellRendererComponent(list, 127 JLabel label = (JLabel)super.getListCellRendererComponent(list, 126 128 layer.name, index, isSelected, cellHasFocus); 127 129 Icon icon = layer.getIcon(); … … 158 160 Layer layer = (Layer)instance.getModel().getElementAt(index); 159 161 LayerListPopup menu = new LayerListPopup(instance, layer); 160 menu.show(LayerList .this, e.getX(), e.getY());162 menu.show(LayerListDialog.this, e.getX(), e.getY()); 161 163 } 162 164 @Override public void mousePressed(MouseEvent e) { … … 191 193 upButton.addActionListener(upDown); 192 194 upButton.setActionCommand("up"); 195 upButton.putClientProperty("help", "Dialog/LayerList/Up"); 193 196 buttonPanel.add(upButton); 194 197 … … 196 199 downButton.addActionListener(upDown); 197 200 downButton.setActionCommand("down"); 201 downButton.putClientProperty("help", "Dialog/LayerList/Down"); 198 202 buttonPanel.add(downButton); 199 203 … … 215 219 mapView.removeLayer(lFrom); 216 220 } 217 }); 221 }); 222 mergeButton.putClientProperty("help", "Dialog/LayerList/Merge"); 218 223 buttonPanel.add(mergeButton); 219 224 -
src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r144 r155 54 54 /** 55 55 * This dialog displays the properties of the current selected primitives. 56 * 57 * If no object is selected, the dialog list is empty. 56 * 57 * If no object is selected, the dialog list is empty. 58 58 * If only one is selected, all properties of this object are selected. 59 59 * If more than one object are selected, the sum of all properties are displayed. If the … … 61 61 * different values, all of them are put in a combo box and the string "<different>" 62 62 * is displayed in italic. 63 * 64 * Below the list, the user can click on an add, modify and delete property button to 63 * 64 * Below the list, the user can click on an add, modify and delete property button to 65 65 * edit the table selection value. 66 * 66 * 67 67 * The command is applied to all selected entries. 68 * 68 * 69 69 * @author imi 70 70 */ … … 91 91 /** 92 92 * Edit the value in the table row 93 * @param row The row of the table, from which the value is edited. 93 * @param row The row of the table, from which the value is edited. 94 94 */ 95 95 void edit(int row) { … … 138 138 if (value == null) 139 139 selectionChanged(sel); // update whole table 140 140 141 141 Main.parent.repaint(); // repaint all - drawing could have been changed 142 142 } … … 330 330 b.setToolTipText(tooltip); 331 331 b.setMnemonic(mnemonic); 332 b.putClientProperty("help", "Dialog/Properties/"+name); 332 333 return b; 333 334 } -
src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r153 r155 126 126 JPanel buttonPanel = new JPanel(new GridLayout(1,2)); 127 127 128 JButton button = new JButton(tr("Select"), ImageProvider.get("mapmode/selection/select")); 129 button.setToolTipText(tr("Set the selected elements on the map to the selected items in the list above.")); 130 button.addActionListener(new ActionListener(){ 128 buttonPanel.add(createButton("Select", "mapmode/selection/select", "Set the selected elements on the map to the selected items in the list above.", new ActionListener(){ 131 129 public void actionPerformed(ActionEvent e) { 132 130 updateMap(); 133 131 } 134 }); 135 buttonPanel.add(button); 136 137 button = new JButton(tr("Reload"), ImageProvider.get("dialogs", "refresh")); 138 button.setToolTipText(tr("Refresh the selection list.")); 139 button.addActionListener(new ActionListener(){ 132 })); 133 134 buttonPanel.add(createButton("Reload", "dialogs/refresh", "Refresh the selection list.", new ActionListener(){ 140 135 public void actionPerformed(ActionEvent e) { 141 136 selectionChanged(Main.ds.getSelected()); 142 } 143 }); 144 buttonPanel.add(button); 145 146 button = new JButton(tr("Search"), ImageProvider.get("dialogs", "search")); 147 button.setToolTipText(tr("Search for objects.")); 148 button.addActionListener(new ActionListener(){ 137 } 138 })); 139 140 buttonPanel.add(createButton("Search", "dialogs/search", "Search for objects.", new ActionListener(){ 149 141 private String lastSearch = ""; 150 142 public void actionPerformed(ActionEvent e) { … … 185 177 search(lastSearch, mode); 186 178 } 187 }); 188 buttonPanel.add(button); 179 })); 189 180 190 181 add(buttonPanel, BorderLayout.SOUTH); 191 182 selectionChanged(Main.ds.getSelected()); 183 } 184 185 private JButton createButton(String name, String icon, String tooltip, ActionListener action) { 186 JButton button = new JButton(tr(name), ImageProvider.get(icon)); 187 button.setToolTipText(tr(tooltip)); 188 button.addActionListener(action); 189 button.putClientProperty("help", "Dialog/SelectionList/"+name); 190 return button; 192 191 } 193 192 -
src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r119 r155 13 13 import org.openstreetmap.josm.Main; 14 14 import org.openstreetmap.josm.actions.JosmAction; 15 import org.openstreetmap.josm.actions.HelpAction.Helpful; 15 16 16 17 /** 17 18 * This class is a toggle dialog that can be turned on and off. It is attached 18 19 * to a ButtonModel. 19 * 20 * 20 21 * @author imi 21 22 */ 22 public class ToggleDialog extends JPanel {23 public class ToggleDialog extends JPanel implements Helpful { 23 24 24 25 public final class ToggleDialogAction extends JosmAction { … … 49 50 setPreferredSize(new Dimension(330,preferredHeight)); 50 51 action = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortCut, KeyEvent.ALT_MASK, iconName); 52 String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1); 53 action.putValue("help", helpId.substring(0, helpId.length()-6)); 51 54 setLayout(new BorderLayout()); 52 55 add(new JLabel(name), BorderLayout.NORTH); … … 54 57 setBorder(BorderFactory.createEtchedBorder()); 55 58 } 59 60 public String helpTopic() { 61 String help = getClass().getName(); 62 help = help.substring(help.lastIndexOf('.')+1, help.length()-6); 63 return "Dialog/"+help; 64 } 56 65 } -
src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java
r153 r155 56 56 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 57 57 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 58 import org.openstreetmap.josm.gui.dialogs.LayerList ;58 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 59 59 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 60 60 import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint; … … 360 360 }); 361 361 return new Component[]{ 362 new JMenuItem(new LayerList .ShowHideLayerAction(this)),363 new JMenuItem(new LayerList .DeleteLayerAction(this)),362 new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)), 363 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 364 364 new JSeparator(), 365 365 sync, -
src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r144 r155 40 40 import org.openstreetmap.josm.gui.MapView; 41 41 import org.openstreetmap.josm.gui.dialogs.ConflictDialog; 42 import org.openstreetmap.josm.gui.dialogs.LayerList ;42 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 43 43 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 44 44 import org.openstreetmap.josm.tools.GBC; … … 327 327 @Override public Component[] getMenuEntries() { 328 328 return new Component[]{ 329 new JMenuItem(new LayerList .ShowHideLayerAction(this)),330 new JMenuItem(new LayerList .DeleteLayerAction(this)),329 new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)), 330 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 331 331 new JSeparator(), 332 332 new JMenuItem(new SaveAction()), -
src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java
r138 r155 40 40 import org.openstreetmap.josm.gui.MapView; 41 41 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 42 import org.openstreetmap.josm.gui.dialogs.LayerList ;42 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 43 43 import org.openstreetmap.josm.gui.dialogs.LayerListPopup; 44 44 import org.openstreetmap.josm.tools.ColorHelper; … … 277 277 278 278 return new Component[]{ 279 new JMenuItem(new LayerList .ShowHideLayerAction(this)),280 new JMenuItem(new LayerList .DeleteLayerAction(this)),279 new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)), 280 new JMenuItem(new LayerListDialog.DeleteLayerAction(this)), 281 281 new JSeparator(), 282 282 new JMenuItem(new GpxExportAction(this)),
Note:
See TracChangeset
for help on using the changeset viewer.