Changeset 155 in josm for src/org/openstreetmap/josm/gui


Ignore:
Timestamp:
2006-10-08T17:29:58+02:00 (19 years ago)
Author:
imi
Message:
  • added online help system
Location:
src/org/openstreetmap/josm/gui
Files:
15 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/MainApplication.java

    r153 r155  
    172172                Main.parent = mainFrame;
    173173                Main main = new MainApplication(mainFrame);
     174                main.loadPlugins();
    174175
    175176                mainFrame.setVisible(true);
  • src/org/openstreetmap/josm/gui/MapFrame.java

    r128 r155  
    2929import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
    3030import org.openstreetmap.josm.gui.dialogs.HistoryDialog;
    31 import org.openstreetmap.josm.gui.dialogs.LayerList;
     31import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    3232import org.openstreetmap.josm.gui.dialogs.PropertiesDialog;
    3333import org.openstreetmap.josm.gui.dialogs.SelectionListDialog;
     
    118118                toggleDialogs.setLayout(new BoxLayout(toggleDialogs, BoxLayout.Y_AXIS));
    119119
    120                 addIconToggle(toggleDialogs, new LayerList(this));
     120                addIconToggle(toggleDialogs, new LayerListDialog(this));
    121121                addIconToggle(toggleDialogs, new PropertiesDialog(this));
    122122                addIconToggle(toggleDialogs, new HistoryDialog());
  • src/org/openstreetmap/josm/gui/MapScaler.java

    r116 r155  
    77
    88import org.openstreetmap.josm.Main;
     9import org.openstreetmap.josm.actions.HelpAction.Helpful;
    910import org.openstreetmap.josm.tools.ColorHelper;
    1011
    11 public class MapScaler extends JComponent {
     12public class MapScaler extends JComponent implements Helpful {
    1213
    1314        private final MapView mv;
     
    2930                g.drawString(text, (int)(50-bound.getWidth()/2), 23);
    3031    }
     32
     33        public String helpTopic() {
     34            return "MapView/Scaler";
     35    }
    3136}
  • src/org/openstreetmap/josm/gui/MapSlider.java

    r115 r155  
    1010import javax.swing.event.ChangeListener;
    1111
     12import org.openstreetmap.josm.actions.HelpAction.Helpful;
    1213import org.openstreetmap.josm.data.coor.EastNorth;
    1314
    14 class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener {
     15class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener, Helpful {
    1516       
    1617    private final MapView mv;
     
    4950                        this.mv.zoomTo(this.mv.center, pos.north()*2/(this.mv.getHeight()-20));
    5051        }
     52
     53        public String helpTopic() {
     54            return "MapView/Slider";
     55    }
    5156}
  • src/org/openstreetmap/josm/gui/MapStatus.java

    r142 r155  
    2727
    2828import org.openstreetmap.josm.Main;
     29import org.openstreetmap.josm.actions.HelpAction.Helpful;
    2930import org.openstreetmap.josm.data.coor.LatLon;
    3031import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    3637 * It keeps a status line below the map up to date and displays some tooltip
    3738 * information if the user hold the mouse long enough at some point.
    38  * 
     39 *
    3940 * All this is done in background to not disturb other processes.
    40  * 
     41 *
    4142 * The background thread does not alter any data of the map (read only thread).
    4243 * Also it is rather fail safe. In case of some error in the data, it just do
    4344 * nothing instead of whining and complaining.
    44  * 
     45 *
    4546 * @author imi
    4647 */
    47 public class MapStatus extends JPanel {
    48 
    49         /**
    50          * The MapView this status belongs. 
     48public class MapStatus extends JPanel implements Helpful {
     49
     50        /**
     51         * The MapView this status belongs.
    5152         */
    5253        final MapView mv;
     
    6364         * The collector class that waits for notification and then update
    6465         * the display objects.
    65          * 
     66         *
    6667         * @author imi
    6768         */
     
    107108                                // This try/catch is a hack to stop the flooding bug reports about this.
    108109                                // 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
    110111                                // the data.
    111112                                try {
     
    242243                }, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
    243244        }
     245
     246        public String helpTopic() {
     247            return "Statusline";
     248    }
    244249}
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r104 r155  
    88
    99import org.openstreetmap.josm.Main;
     10import org.openstreetmap.josm.actions.HelpAction.Helpful;
    1011import org.openstreetmap.josm.data.coor.EastNorth;
    1112import org.openstreetmap.josm.data.coor.LatLon;
     
    1920 * An component that can be navigated by a mapmover. Used as map view and for the
    2021 * zoomer in the download dialog.
    21  * 
     22 *
    2223 * @author imi
    2324 */
    24 public class NavigatableComponent extends JComponent {
     25public class NavigatableComponent extends JComponent implements Helpful {
    2526
    2627
     
    2930        /**
    3031         * 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
    3233         * northing/easting space of the projection.
    3334         */
     
    5354                return 32;
    5455        }
    55        
     56
    5657        /**
    5758         * Return the current scale value.
     
    7374         * @param x X-Pixelposition to get coordinate from
    7475         * @param y Y-Pixelposition to get coordinate from
    75          * 
     76         *
    7677         * @return Geographic coordinates from a specific pixel coordination
    7778         *              on the screen.
     
    8687         * @param x X-Pixelposition to get coordinate from
    8788         * @param y Y-Pixelposition to get coordinate from
    88          * 
     89         *
    8990         * @return Geographic unprojected coordinates from a specific pixel coordination
    9091         *              on the screen.
     
    164165                                        minPrimitive = w;
    165166                                }
    166                         }                       
     167                        }
    167168                }
    168169                return minPrimitive;
     
    195196        /**
    196197         * Return the object, that is nearest to the given screen point.
    197          * 
     198         *
    198199         * First, a node will be searched. If a node within 10 pixel is found, the
    199200         * nearest node is returned.
    200          * 
     201         *
    201202         * 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
    206207         * corresponding Way is returned.
    207          * 
     208         *
    208209         * If no segment is found and the point is within an area, return that
    209210         * area.
    210          * 
     211         *
    211212         * If no area is found, return <code>null</code>.
    212          * 
     213         *
    213214         * @param p                              The point on screen.
    214215         * @param segmentInsteadWay Whether the segment (true) or only the whole
     
    226227
    227228        /**
    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
    230231         * determined.
    231          * 
     232         *
    232233         * If its a node, return all segments and
    233234         * streets the node is part of, as well as all nodes
    234235         * (with their segments and ways) with the same
    235236         * location.
    236          * 
    237          * If its a segment, return all ways this segment 
     237         *
     238         * If its a segment, return all ways this segment
    238239         * belongs to as well as all segments that are between
    239240         * the same nodes (in both direction) with all their ways.
    240          * 
     241         *
    241242         * @return A collection of all items or <code>null</code>
    242243         *              if no item under or near the point. The returned
     
    258259                                if (!ls.deleted && !ls.incomplete && (c.contains(ls.from) || c.contains(ls.to)))
    259260                                        c.add(ls);
    260                 } 
     261                }
    261262                if (osm instanceof Segment) {
    262263                        Segment line = (Segment)osm;
     
    286287                return Main.proj;
    287288        }
     289
     290        public String helpTopic() {
     291            String n = getClass().getName();
     292            return n.substring(n.lastIndexOf('.')+1);
     293    }
    288294}
  • src/org/openstreetmap/josm/gui/WorldChooser.java

    r116 r155  
    4444         */
    4545        private double scaleMax;
    46        
     46
    4747        /**
    4848         * Mark this rectangle (lat/lon values) when painting.
     
    5151
    5252        private Projection projection;
    53        
     53
    5454        /**
    5555         * Create the chooser component.
  • src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r119 r155  
    6868                        }
    6969                });
     70                button.putClientProperty("help", "Dialog/Conflict/Resolve");
    7071                buttonPanel.add(button);
    7172
     
    8081                        }
    8182                });
     83                button.putClientProperty("help", "Dialog/Conflict/Select");
    8284                buttonPanel.add(button);
    8385
     
    132134                                model.addElement(osm);
    133135        }
    134        
     136
    135137        public final void add(Map<OsmPrimitive, OsmPrimitive> conflicts) {
    136138                this.conflicts.putAll(conflicts);
     
    139141
    140142        /**
    141          * Paint all conflicts that can be expressed on the main window. 
     143         * Paint all conflicts that can be expressed on the main window.
    142144         */
    143145        public void paintConflicts(final Graphics g, final NavigatableComponent nc) {
  • src/org/openstreetmap/josm/gui/dialogs/HistoryDialog.java

    r143 r155  
    3838/**
    3939 * History dialog works like follows:
    40  * 
     40 *
    4141 * There is a history cache hold in the back for primitives of the last refresh.
    4242 * When the user refreshes, this cache is cleared and all currently selected items
    4343 * 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
    4545 * is not displayed. Elsewhere, the list of all changes of all currently selected
    4646 * objects are displayed.
    47  * 
     47 *
    4848 * @author imi
    4949 */
     
    130130                });
    131131                reloadButton.setToolTipText(tr("Reload all currently selected objects and refresh the list."));
     132                reloadButton.putClientProperty("help", "Dialog/History/Reload");
    132133                revertButton.addActionListener(new ActionListener(){
    133134                        public void actionPerformed(ActionEvent e) {
     
    136137                });
    137138                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");
    138140        }
    139141
  • src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r153 r155  
    4242 * @author imi
    4343 */
    44 public class LayerList extends ToggleDialog implements LayerChangeListener {
     44public class LayerListDialog extends ToggleDialog implements LayerChangeListener {
    4545
    4646        /**
     
    5757                        super(tr("Delete"), ImageProvider.get("dialogs", "delete"));
    5858                        putValue(SHORT_DESCRIPTION, tr("Delete the selected layer."));
     59                        putValue("help", "Dialog/LayerList/Delete");
    5960                        this.layer = layer;
    6061                }
     
    7980                        super(tr("Show/Hide"), ImageProvider.get("dialogs", "showhide"));
    8081                        putValue(SHORT_DESCRIPTION, tr("Toggle visible state of the selected layer."));
     82                        putValue("help", "Dialog/LayerList/ShowHide");
    8183                        this.layer = layer;
    8284                }
     
    9698        /**
    9799         * 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.
    99101         */
    100102        private final JButton mergeButton = new JButton(ImageProvider.get("dialogs", "mergedown"));
     
    115117         * Create an layerlist and attach it to the given mapView.
    116118         */
    117         public LayerList(MapFrame mapFrame) {
     119        public LayerListDialog(MapFrame mapFrame) {
    118120                super(tr("Layers"), "layerlist", tr("Open a list of all loaded layers."), KeyEvent.VK_L, 100);
    119121                instance = new JList(model);
     
    123125                        @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    124126                                Layer layer = (Layer)value;
    125                                 JLabel label = (JLabel)super.getListCellRendererComponent(list, 
     127                                JLabel label = (JLabel)super.getListCellRendererComponent(list,
    126128                                                layer.name, index, isSelected, cellHasFocus);
    127129                                Icon icon = layer.getIcon();
     
    158160                                Layer layer = (Layer)instance.getModel().getElementAt(index);
    159161                                LayerListPopup menu = new LayerListPopup(instance, layer);
    160                                 menu.show(LayerList.this, e.getX(), e.getY());
     162                                menu.show(LayerListDialog.this, e.getX(), e.getY());
    161163                        }
    162164                        @Override public void mousePressed(MouseEvent e) {
     
    191193                upButton.addActionListener(upDown);
    192194                upButton.setActionCommand("up");
     195                upButton.putClientProperty("help", "Dialog/LayerList/Up");
    193196                buttonPanel.add(upButton);
    194197
     
    196199                downButton.addActionListener(upDown);
    197200                downButton.setActionCommand("down");
     201                downButton.putClientProperty("help", "Dialog/LayerList/Down");
    198202                buttonPanel.add(downButton);
    199203
     
    215219                                mapView.removeLayer(lFrom);
    216220                        }
    217                 });             
     221                });
     222                mergeButton.putClientProperty("help", "Dialog/LayerList/Merge");
    218223                buttonPanel.add(mergeButton);
    219224
  • src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java

    r144 r155  
    5454/**
    5555 * 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.
    5858 * If only one is selected, all properties of this object are selected.
    5959 * If more than one object are selected, the sum of all properties are displayed. If the
     
    6161 * different values, all of them are put in a combo box and the string "&lt;different&gt;"
    6262 * 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
    6565 * edit the table selection value.
    66  * 
     66 *
    6767 * The command is applied to all selected entries.
    68  * 
     68 *
    6969 * @author imi
    7070 */
     
    9191        /**
    9292         * 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.
    9494         */
    9595        void edit(int row) {
     
    138138                if (value == null)
    139139                        selectionChanged(sel); // update whole table
    140                
     140
    141141                Main.parent.repaint(); // repaint all - drawing could have been changed
    142142        }
     
    330330                b.setToolTipText(tooltip);
    331331                b.setMnemonic(mnemonic);
     332                b.putClientProperty("help", "Dialog/Properties/"+name);
    332333                return b;
    333334        }
  • src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r153 r155  
    126126                JPanel buttonPanel = new JPanel(new GridLayout(1,2));
    127127
    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(){
    131129                        public void actionPerformed(ActionEvent e) {
    132130                                updateMap();
    133131                        }
    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(){
    140135                        public void actionPerformed(ActionEvent e) {
    141136                                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(){
    149141                        private String lastSearch = "";
    150142                        public void actionPerformed(ActionEvent e) {
     
    185177                                search(lastSearch, mode);
    186178                        }
    187                 });
    188                 buttonPanel.add(button);
     179                }));
    189180
    190181                add(buttonPanel, BorderLayout.SOUTH);
    191182                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;
    192191        }
    193192
  • src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r119 r155  
    1313import org.openstreetmap.josm.Main;
    1414import org.openstreetmap.josm.actions.JosmAction;
     15import org.openstreetmap.josm.actions.HelpAction.Helpful;
    1516
    1617/**
    1718 * This class is a toggle dialog that can be turned on and off. It is attached
    1819 * to a ButtonModel.
    19  * 
     20 *
    2021 * @author imi
    2122 */
    22 public class ToggleDialog extends JPanel {
     23public class ToggleDialog extends JPanel implements Helpful {
    2324
    2425        public final class ToggleDialogAction extends JosmAction {
     
    4950                setPreferredSize(new Dimension(330,preferredHeight));
    5051                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));
    5154                setLayout(new BorderLayout());
    5255                add(new JLabel(name), BorderLayout.NORTH);
     
    5457                setBorder(BorderFactory.createEtchedBorder());
    5558        }
     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    }
    5665}
  • src/org/openstreetmap/josm/gui/layer/GeoImageLayer.java

    r153 r155  
    5656import org.openstreetmap.josm.gui.PleaseWaitRunnable;
    5757import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    58 import org.openstreetmap.josm.gui.dialogs.LayerList;
     58import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    5959import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    6060import org.openstreetmap.josm.gui.layer.RawGpsLayer.GpsPoint;
     
    360360                });
    361361                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)),
    364364                                new JSeparator(),
    365365                                sync,
  • src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r144 r155  
    4040import org.openstreetmap.josm.gui.MapView;
    4141import org.openstreetmap.josm.gui.dialogs.ConflictDialog;
    42 import org.openstreetmap.josm.gui.dialogs.LayerList;
     42import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    4343import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    4444import org.openstreetmap.josm.tools.GBC;
     
    327327        @Override public Component[] getMenuEntries() {
    328328                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)),
    331331                                new JSeparator(),
    332332                                new JMenuItem(new SaveAction()),
  • src/org/openstreetmap/josm/gui/layer/RawGpsLayer.java

    r138 r155  
    4040import org.openstreetmap.josm.gui.MapView;
    4141import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
    42 import org.openstreetmap.josm.gui.dialogs.LayerList;
     42import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    4343import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
    4444import org.openstreetmap.josm.tools.ColorHelper;
     
    277277               
    278278                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)),
    281281                                new JSeparator(),
    282282                                new JMenuItem(new GpxExportAction(this)),
Note: See TracChangeset for help on using the changeset viewer.