Changeset 12391 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2017-06-11T13:57:28+02:00 (7 years ago)
Author:
michael2402
Message:

See #14794: Documentation for the gui package

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
8 edited

Legend:

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

    r10791 r12391  
    3333import org.openstreetmap.josm.tools.WindowGeometry;
    3434
     35/**
     36 * Utility methods that display an option dialog with an additional help button that links to the JOSM help
     37 */
    3538public final class HelpAwareOptionPane {
    3639
     
    3942    }
    4043
     44    /**
     45     * A specification of a button that should be added to the options dialog
     46     */
    4147    public static class ButtonSpec {
     48        /**
     49         * the button text
     50         */
    4251        public final String text;
     52        /**
     53         * the icon to display. Can be <code>null</code>
     54         */
    4355        public final Icon icon;
     56        /**
     57         * The tooltip to display when hovering the button
     58         */
    4459        public final String tooltipText;
     60        /**
     61         * The help topic to link
     62         */
    4563        public final String helpTopic;
    4664        private boolean enabled;
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r12368 r12391  
    131131    private final List<ToggleDialog> allDialogs = new ArrayList<>();
    132132    private final List<IconToggleButton> allDialogButtons = new ArrayList<>();
     133    /**
     134     * All map mode buttons. Should only be read form the outside
     135     */
    133136    public final List<IconToggleButton> allMapModeButtons = new ArrayList<>();
    134137
     
    294297    }
    295298
     299    /**
     300     * Enables the select tool
     301     * @param onlyIfModeless Only enable if modeless mode is active
     302     * @return <code>true</code> if it is selected
     303     */
    296304    public boolean selectSelectTool(boolean onlyIfModeless) {
    297305        if (onlyIfModeless && !MODELESS.get())
     
    301309    }
    302310
     311    /**
     312     * Enables the draw tool
     313     * @param onlyIfModeless Only enable if modeless mode is active
     314     * @return <code>true</code> if it is selected
     315     */
    303316    public boolean selectDrawTool(boolean onlyIfModeless) {
    304317        if (onlyIfModeless && !MODELESS.get())
     
    308321    }
    309322
     323    /**
     324     * Enables the zoom tool
     325     * @param onlyIfModeless Only enable if modeless mode is active
     326     * @return <code>true</code> if it is selected
     327     */
    310328    public boolean selectZoomTool(boolean onlyIfModeless) {
    311329        if (onlyIfModeless && !MODELESS.get())
     
    401419    }
    402420
     421    /**
     422     * Adds a new map mode button
     423     * @param b The map mode button with a {@link MapMode} action.
     424     */
    403425    public void addMapMode(IconToggleButton b) {
    404426        if (!(b.getAction() instanceof MapMode))
     
    654676    }
    655677
     678    /**
     679     * Validate the visibility of all tool bars and hide the ones that should be hidden
     680     */
    656681    public void validateToolBarsVisibility() {
    657682        for (IconToggleButton b : allDialogButtons) {
  • trunk/src/org/openstreetmap/josm/gui/MapSlider.java

    r10078 r12391  
    1515import org.openstreetmap.josm.gui.help.Helpful;
    1616
     17/**
     18 * This is the slider used in the top left corner of the map view. It allows the user to select the scale
     19 */
    1720class MapSlider extends JSlider implements PropertyChangeListener, ChangeListener, Helpful {
    1821
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r12065 r12391  
    154154    }
    155155
     156    /**
     157     * The progress monitor that is used to display the progress if the user selects to run in background
     158     */
    156159    public class BackgroundProgressMonitor implements ProgressMonitorDialog {
    157160
     
    225228    private final JProgressBar progressBar = new JProgressBar();
    226229    private final transient ComponentAdapter mvComponentAdapter;
     230    /**
     231     * The progress monitor for displaying a background progress
     232     */
    227233    public final transient BackgroundProgressMonitor progressMonitor = new BackgroundProgressMonitor();
    228234
     
    971977    }
    972978
     979    /**
     980     * Gets the panel that displays the angle
     981     * @return The angle panel
     982     */
    973983    public JPanel getAnglePanel() {
    974984        return angleText;
     
    986996    }
    987997
    988     public void setHelpText(String t) {
    989         setHelpText(null, t);
    990     }
    991 
     998    /**
     999     * Sets the help text in the status panel
     1000     * @param text The text
     1001     */
     1002    public void setHelpText(String text) {
     1003        setHelpText(null, text);
     1004    }
     1005
     1006    /**
     1007     * Sets the help status text to display
     1008     * @param id The object that caused the status update (or a id object it selects). May be <code>null</code>
     1009     * @param text The text
     1010     */
    9921011    public void setHelpText(Object id, final String text) {
    993 
    9941012        StatusTextHistory entry = new StatusTextHistory(id, text);
    9951013
     
    10031021    }
    10041022
     1023    /**
     1024     * Removes a help text and restores the previous one
     1025     * @param id The id passed to {@link #setHelpText(Object, String)}
     1026     */
    10051027    public void resetHelpText(Object id) {
    10061028        if (statusText.isEmpty())
     
    10191041    }
    10201042
     1043    /**
     1044     * Sets the angle to display in the angle panel
     1045     * @param a The angle
     1046     */
    10211047    public void setAngle(double a) {
    10221048        angleText.setText(a < 0 ? "--" : DECIMAL_FORMAT.format(a) + " \u00B0");
    10231049    }
    10241050
     1051    /**
     1052     * Sets the heading to display in the heading panel
     1053     * @param h The heading
     1054     */
    10251055    public void setHeading(double h) {
    10261056        headingText.setText(h < 0 ? "--" : DECIMAL_FORMAT.format(h) + " \u00B0");
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r12380 r12391  
    396396    private boolean virtualNodesEnabled;
    397397
     398    /**
     399     * Enables or disables drawing of the virtual nodes.
     400     * @param enabled if virtual nodes are enabled
     401     */
    398402    public void setVirtualNodesEnabled(boolean enabled) {
    399403        if (virtualNodesEnabled != enabled) {
  • trunk/src/org/openstreetmap/josm/gui/NameFormatterHook.java

    r8512 r12391  
    66import org.openstreetmap.josm.data.osm.IWay;
    77
     8/**
     9 * Hooks that allow correcting the name of a OSM primitive
     10 * @see DefaultNameFormatter
     11 */
    812public interface NameFormatterHook {
    913
  • trunk/src/org/openstreetmap/josm/gui/ScrollViewport.java

    r12079 r12391  
    3131    private static final int NO_SCROLL = 0;
    3232
     33    /**
     34     * Direction flag for upwards
     35     */
    3336    public static final int UP_DIRECTION = 1;
     37    /**
     38     * Direction flag for downwards
     39     */
    3440    public static final int DOWN_DIRECTION = 2;
     41    /**
     42     * Direction flag for left
     43     */
    3544    public static final int LEFT_DIRECTION = 4;
     45    /**
     46     * Direction flag for right
     47     */
    3648    public static final int RIGHT_DIRECTION = 8;
    3749    /**
     
    240252    }
    241253
     254    /**
     255     * Gets the current visible part of the view
     256     * @return The current view rect
     257     */
    242258    public Rectangle getViewRect() {
    243259        return vp.getViewRect();
    244260    }
    245261
     262    /**
     263     * Gets the size of the view
     264     * @return The size
     265     */
    246266    public Dimension getViewSize() {
    247267        return vp.getViewSize();
    248268    }
    249269
     270    /**
     271     * Gets the position (offset) of the view area
     272     * @return The offset
     273     */
    250274    public Point getViewPosition() {
    251275        return vp.getViewPosition();
  • trunk/src/org/openstreetmap/josm/gui/ShowHideButtonListener.java

    r8512 r12391  
    88 */
    99public interface ShowHideButtonListener {
     10    /**
     11     * Called when the button is shown
     12     */
    1013    void buttonShown();
    1114
     15    /**
     16     * Called when the button is hidden
     17     */
    1218    void buttonHidden();
    1319}
Note: See TracChangeset for help on using the changeset viewer.