Changeset 30116 in osm for applications


Ignore:
Timestamp:
2013-12-07T21:43:54+01:00 (11 years ago)
Author:
donvip
Message:

[josm_openinghours] code cleanup

Location:
applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/ClockSystem.java

    r26215 r30116  
    55import java.util.Locale;
    66
     7/**
     8 * Clock system (12 or 24 hours).
     9 */
    710public enum ClockSystem {
    8     TWELVE_HOURS, TWENTYFOUR_HOURS;
     11   
     12    /** 12-hour clock system */
     13    TWELVE_HOURS,
     14    /** 24-hour clock system */
     15    TWENTYFOUR_HOURS;
    916
     17    /**
     18     * Returns the clock system for the given locale.
     19     * @param locale The locale
     20     * @return the clock system for the given locale
     21     */
    1022    public static ClockSystem getClockSystem(Locale locale) {
    1123        DateFormat stdFormat = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.US);
  • applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/gui/OheDialogPanel.java

    r30114 r30116  
    120120    }
    121121
    122     // returns the compiled Time from the valueField
     122    /**
     123     * Returns the compiled Time from the valueField.
     124     * @return the compiled Time from the valueField
     125     */
    123126    public ArrayList<int[]> getTime() throws Exception {
    124127        String value = valueField.getText();
     
    138141                    SyntaxException syntaxError = (SyntaxException) t;
    139142                    tColumns = new int[] { syntaxError.getStartColumn(), syntaxError.getEndColumn() };
    140                     info = syntaxError.getInfo();
     143                    info = syntaxError.getMessage();
    141144                } else {
     145                    info = t.getMessage();
    142146                    Main.warn(t);
    143147                }
     
    162166                }
    163167
    164                 throw new Exception("Error in the TimeValue");
     168                throw new Exception("Error in the TimeValue", t);
    165169            }
    166170        }
     
    169173    }
    170174
    171     // updates the valueField with the given timeRects
     175    /**
     176     * Updates the valueField with the given timeRects.
     177     */
    172178    public void updateValueField(ArrayList<TimeRect> timeRects) {
    173179        if (valueField != null && timeRects != null)
     
    180186
    181187    /**
    182      * @return the hourMode
     188     * Returns the clock system (12 or 24 hours).
     189     * @return the clock system
    183190     */
    184191    public ClockSystem getHourMode() {
  • applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/gui/OheEditor.java

    r29854 r30116  
    244244    }
    245245
    246     // removes the given timerect from the panel and from the arraylist
     246    /**
     247     * Removes the given timerect from the panel and from the arraylist
     248     */
    247249    public void removeTimeRect(TimeRect timeRectToRemove) {
    248250        timeRects.remove(timeRectToRemove);
  • applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/gui/TimeRect.java

    r28477 r30116  
    1919import javax.swing.JPopupMenu;
    2020
    21 public class TimeRect extends JPanel implements MouseListener,
    22         MouseMotionListener {
     21public class TimeRect extends JPanel implements MouseListener, MouseMotionListener {
     22   
    2323    public static final int[] transformCursorTypes = new int[] {
    2424            Cursor.MOVE_CURSOR, Cursor.N_RESIZE_CURSOR,
     
    5353    private int minuteEnd;
    5454
    55     public TimeRect(OheEditor editor, int dayStart, int dayEnd,
    56             int minutesStart, int minutesEnd) {
     55    public TimeRect(OheEditor editor, int dayStart, int dayEnd, int minutesStart, int minutesEnd) {
    5756        this.editor = editor;
    5857
     
    117116    }
    118117
    119     public static void drawTimeRect(Graphics2D g2D, Rectangle bounds,
    120             boolean isZeroMinuteInterval, boolean isOpenEndInterval) {
     118    public static void drawTimeRect(Graphics2D g2D, Rectangle bounds, boolean isZeroMinuteInterval, boolean isOpenEndInterval) {
    121119
    122120        Color innerColor = new Color(135, 135, 234);
     
    156154    private int transformType;
    157155
    158     // Calculate where the Component was clicked and returns the
    159     // transformtype
     156    // Calculate where the Component was clicked and returns the transformtype
    160157    private int getTransformType(MouseEvent evt) {
    161158        int tmpClickAreaWidth = Math.min(clickAreaSize, getWidth() / 3);
  • applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/parser/OpeningTimeCompiler.jj

    r30114 r30116  
    5050import org.openstreetmap.josm.plugins.ohe.OpeningTimeUtils.DateTime;
    5151
    52 public class OpeningTimeCompiler
    53 {
     52public class OpeningTimeCompiler {
     53
     54  /**
     55   * Abbreviated week days.
     56   */
    5457  public static final String[] WEEKDAYS = new String[] {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"};
    55 
    56   public OpeningTimeCompiler(String time)
    57   {
     58  /**
     59   * Constructs a new OpeningTimeCompiler.
     60   */
     61  public OpeningTimeCompiler(String time) {
    5862    this(new ByteArrayInputStream(time.getBytes()), null);
    5963  }
  • applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/parser/SyntaxException.java

    r23192 r30116  
    1515    }
    1616
    17     public String getInfo() {
    18         return info;
    19     }
    20 
    2117    public SyntaxException(String info, int startColumn, int endColumn) {
     18        super(info);
    2219        this.startColumn = startColumn;
    2320        this.endColumn = endColumn;
Note: See TracChangeset for help on using the changeset viewer.