Changeset 1677 in josm for trunk


Ignore:
Timestamp:
2009-06-17T10:04:22+02:00 (15 years ago)
Author:
stoecker
Message:

remove all these ugly tab stops introduced in the last half year

Location:
trunk/src/org/openstreetmap/josm
Files:
57 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ExitAction.java

    r1286 r1677  
    2828            Main.saveGuiGeometry();
    2929            System.exit(0);
    30         }
     30        }
    3131    }
    3232}
  • trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java

    r1676 r1677  
    107107        p.add(warning, GBC.eol().fill(GBC.HORIZONTAL).insets(15,0,0,0));
    108108        addDependencies(author, authorName, email, copyright, predefined, copyrightYear, nameLabel, emailLabel, copyrightLabel, copyrightYearLabel, warning);
    109        
     109
    110110        // if the user name is not the email address, but the osm user name
    111111        // move it from the email textfield to the author textfield
     
    119119        p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL));
    120120
    121         int answer = new ExtendedDialog(Main.parent, 
    122                         tr("Export options"), 
     121        int answer = new ExtendedDialog(Main.parent,
     122                        tr("Export options"),
    123123                        p,
    124                         new String[] {tr("Export and Save"), tr("Cancel")}, 
    125                         new String[] {"exportgpx.png", "cancel.png"}).getValue(); 
     124                        new String[] {tr("Export and Save"), tr("Cancel")},
     125                        new String[] {"exportgpx.png", "cancel.png"}).getValue();
    126126        if (answer != 1)
    127127            return;
     
    140140        else
    141141            gpxData = OsmDataLayer.toGpxData(Main.ds, file);
    142        
     142
    143143        // add author and copyright details to the gpx data
    144144        if(author.isSelected()) {
     
    151151            if(copyrightYear.getText().length() > 0) gpxData.attr.put(GpxData.META_COPYRIGHT_YEAR, copyrightYear.getText());
    152152        }
    153        
     153
    154154        // add the description to the gpx data
    155155        if(desc.getText().length() > 0) gpxData.attr.put(GpxData.META_DESC, desc.getText());
    156        
     156
    157157        // add keywords to the gpx data
    158158        if(keywords.getText().length() > 0) gpxData.attr.put(GpxData.META_KEYWORDS, keywords.getText());
    159        
     159
    160160        try {
    161161            FileOutputStream fo = new FileOutputStream(file);
  • trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java

    r1586 r1677  
    3232    /**
    3333     * replies the base URL for browsing the the history of an OSM primitive
    34      * 
     34     *
    3535     * @return the base URL, i.e. http://api.openstreetmap.org/browse
    3636     */
     
    4343        }
    4444        return ret;
    45     }   
    46    
     45    }
     46
    4747    public void actionPerformed(ActionEvent e) {
    48         final Collection<Object> sel = new LinkedList<Object>();       
     48        final Collection<Object> sel = new LinkedList<Object>();
    4949        final String baseUrl  = getBaseURL();
    5050        new AbstractVisitor() {
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r1530 r1677  
    145145        for (HashSet<Node> nodelinks : backlinks.values()) {
    146146            if (!nodelinks.containsAll(allNodes)) {
    147                 int option = new ExtendedDialog(Main.parent, 
    148                         tr("Merge nodes with different memberships?"), 
     147                int option = new ExtendedDialog(Main.parent,
     148                        tr("Merge nodes with different memberships?"),
    149149                        tr("The selected nodes have differing relation memberships.  "
    150150                            + "Do you still want to merge them?"),
    151                         new String[] {tr("Merge Anyway"), tr("Cancel")}, 
    152                         new String[] {"mergenodes.png", "cancel.png"}).getValue(); 
     151                        new String[] {tr("Merge Anyway"), tr("Cancel")},
     152                        new String[] {"mergenodes.png", "cancel.png"}).getValue();
    153153                if (option == 1) break;
    154154                return null;
     
    186186
    187187        if (!components.isEmpty()) {
    188             int answer = new ExtendedDialog(Main.parent, 
    189                 tr("Enter values for all conflicts."), 
     188            int answer = new ExtendedDialog(Main.parent,
     189                tr("Enter values for all conflicts."),
    190190                p,
    191                 new String[] {tr("Solve Conflicts"), tr("Cancel")}, 
    192                 new String[] {"dialogs/conflict.png", "cancel.png"}).getValue(); 
     191                new String[] {tr("Solve Conflicts"), tr("Cancel")},
     192                new String[] {"dialogs/conflict.png", "cancel.png"}).getValue();
    193193            if (answer != 1)
    194194                return null;
  • trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java

    r1415 r1677  
    4343        all.add(urltext, GBC.eol());
    4444        all.add(layer, GBC.eol());
    45         int answer = new ExtendedDialog(Main.parent, 
    46                         tr("Download Location"), 
     45        int answer = new ExtendedDialog(Main.parent,
     46                        tr("Download Location"),
    4747                        all,
    48                         new String[] {tr("Download URL"), tr("Cancel")}, 
    49                         new String[] {"download.png", "cancel.png"}).getValue(); 
     48                        new String[] {tr("Download URL"), tr("Cancel")},
     49                        new String[] {"download.png", "cancel.png"}).getValue();
    5050        if (answer != 1) return;
    5151        openUrl(layer.isSelected(), urltext.getText());
  • trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java

    r1676 r1677  
    150150            if (gpxImExporter.acceptFile(file))
    151151                GpxExportAction.exportGpx(file, layer);
    152             else if (osmImExporter.acceptFile(file) 
     152            else if (osmImExporter.acceptFile(file)
    153153                    || osmGzipImporter.acceptFile(file)
    154                     || osmBzip2Importer.acceptFile(file)) 
     154                    || osmBzip2Importer.acceptFile(file))
    155155            {
    156156                // use a tmp file because if something errors out in the
     
    171171                    out = new CBZip2OutputStream(out);
    172172                }
    173                 Writer writer = new OutputStreamWriter(out, "UTF-8"); 
     173                Writer writer = new OutputStreamWriter(out, "UTF-8");
    174174
    175175                OsmWriter w = new OsmWriter(new PrintWriter(writer), false, layer.data.version);
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r1636 r1677  
    3535 *
    3636 * This is the opposite of the MergeNodesAction.
    37  * 
     37 *
    3838 * If a single node is selected, it will copy that node and remove all tags from the old one
    3939 */
     
    6262
    6363        Collection<OsmPrimitive> selection = Main.ds.getSelected();
    64        
     64
    6565        String errMsg = null;
    6666        if (checkSelection(selection)) {
     
    121121                   "own copy and all nodes will be selected.");
    122122        }
    123        
     123
    124124        if(errMsg != null)
    125125            JOptionPane.showMessageDialog(Main.parent, errMsg);
    126        
     126
    127127        selectedNode = null;
    128128        selectedWay = null;
    129129        selectedNodes = null;
    130130    }
    131    
     131
    132132    /**
    133133     * Assumes there is one tagged Node stored in selectedNode that it will try to unglue
     
    141141        c.selected = false;
    142142        cmds.add(new ChangeCommand(selectedNode, c));
    143        
     143
    144144        Node n = new Node(selectedNode);
    145145        n.id = 0;
    146        
     146
    147147        // If this wasn't called from menu, place it where the cursor is/was
    148148        if(e.getSource() instanceof JPanel) {
     
    150150            n.setEastNorth(mv.getEastNorth(mv.lastMEvent.getX(), mv.lastMEvent.getY()));
    151151        }
    152        
     152
    153153        cmds.add(new AddCommand(n));
    154        
     154
    155155        fixRelations(selectedNode, cmds, Collections.singletonList(n));
    156        
     156
    157157        Main.main.undoRedo.add(new SequenceCommand(tr("Unglued Node"), cmds));
    158158        Main.ds.setSelected(n);
    159159        Main.map.mapView.repaint();
    160160    }
    161    
     161
    162162    /**
    163163     * Checks if selection is suitable for ungluing. This is the case when there's a single,
    164164     * tagged node selected that's part of at least one way (ungluing an unconnected node does
    165165     * not make sense. Due to the call order in actionPerformed, this is only called when the
    166      * node is only part of one or less ways. 
    167      * 
     166     * node is only part of one or less ways.
     167     *
    168168     * @param The selection to check against
    169169     * @return Selection is suitable
     
    184184        if(!isPartOfWay)
    185185            return false;
    186        
     186
    187187        selectedNode = (Node)n;
    188188        return  selectedNode.isTagged();
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r1670 r1677  
    4242 * An dialog is displayed asking the user to specify a rectangle to grab.
    4343 * The url and account settings from the preferences are used.
    44  * 
     44 *
    4545 * If the upload fails this action offers various options to resolve conflicts.
    4646 *
     
    236236     * Synchronizes the local state of an {@see OsmPrimitive} with its state on the
    237237     * server. The method uses an individual GET for the primitive.
    238      * 
     238     *
    239239     * @param id the primitive ID
    240240     */
     
    286286    /**
    287287     * Synchronizes the local state of the dataset with the state on the server.
    288      * 
     288     *
    289289     * Reuses the functionality of {@see UpdateDataAction}.
    290      * 
     290     *
    291291     * @see UpdateDataAction#actionPerformed(ActionEvent)
    292292     */
     
    299299     * Handles the case that a conflict in a specific {@see OsmPrimitive} was detected while
    300300     * uploading
    301      * 
     301     *
    302302     * @param primitiveType  the type of the primitive, either <code>node</code>, <code>way</code> or
    303303     *    <code>relation</code>
     
    349349     * Handles the case that a conflict was detected while uploading where we don't
    350350     * know what {@see OsmPrimitive} actually caused the conflict (for whatever reason)
    351      * 
     351     *
    352352     */
    353353    protected void handleUploadConflictForUnknownConflict() {
     
    387387    /**
    388388     * handles an upload conflict, i.e. an error indicated by a HTTP return code 409.
    389      * 
     389     *
    390390     * @param e  the exception
    391391     */
     
    404404    /**
    405405     * Handles an upload error due to a violated precondition, i.e. a HTTP return code 412
    406      * 
     406     *
    407407     * @param e the exception
    408408     */
     
    428428     * {@see OsmPrimitive}, i.e. a HTTP response code 410, where we know what
    429429     * {@see OsmPrimitive} is responsible for the error.
    430      * 
     430     *
    431431     *  Reuses functionality of the {@see UpdateSelectionAction} to resolve
    432432     *  conflicts due to mismatches in the deleted state.
    433      * 
     433     *
    434434     * @param primitiveType the type of the primitive
    435435     * @param id the id of the primitive
    436      * 
     436     *
    437437     * @see UpdateSelectionAction#handlePrimitiveGoneException(long)
    438438     */
     
    446446     * {@see OsmPrimitive}, i.e. a HTTP response code 410, where we don't know which
    447447     * {@see OsmPrimitive} is causing the error.
    448      * 
     448     *
    449449     * @param e the exception
    450450     */
     
    472472     * Note that an <strong>update</strong> on an already deleted object results
    473473     * in a 409, not a 410.
    474      * 
     474     *
    475475     * @param e the exception
    476476     */
     
    490490    /**
    491491     * error handler for any exception thrown during upload
    492      * 
     492     *
    493493     * @param e the exception
    494494     */
     
    543543    /**
    544544     * handles an exception caught during OSM API initialization
    545      * 
     545     *
    546546     * @param e the exception
    547547     */
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r1457 r1677  
    131131        return tr("Click to delete. Shift: delete way segment. Alt: don't delete unused nodes when deleting a way. Ctrl: delete referring objects.");
    132132    }
    133    
     133
    134134    @Override public boolean layerIsSupported(Layer l) {
    135135        return l instanceof OsmDataLayer;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r1640 r1677  
    395395
    396396        // If the above does not apply, the selection is cleared and a new try is started
    397        
    398  
    399        
     397
    400398        boolean extendedWay = false;
    401399        boolean wayIsFinishedTemp = wayIsFinished;
    402400        wayIsFinished = false;
    403        
     401
    404402        // don't draw lines if shift is held
    405403        if (selection.size() > 0 && !shift) {
     
    925923            }
    926924        }
    927 
    928925        return rv;
    929926    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r1640 r1677  
    218218        mousePos = e.getPoint();
    219219        initialMousePos = e.getPoint();
    220        
     220
    221221        if(selectedSegment != null)
    222222            Main.ds.setSelected(selectedSegment.way);
     
    268268        }
    269269    }
    270                
    271                 @Override public boolean layerIsSupported(Layer l) {
    272                                 return l instanceof OsmDataLayer;
    273                 }
     270
     271        @Override public boolean layerIsSupported(Layer l) {
     272                return l instanceof OsmDataLayer;
     273        }
    274274}
  • trunk/src/org/openstreetmap/josm/actions/mapmode/MapMode.java

    r1379 r1677  
    7272            Main.map.selectMapMode(this);
    7373    }
    74    
     74
    7575    // By default, all tools will work with all layers. Can be overwritten to require
    7676    // a special type of layer
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r1641 r1677  
    8080
    8181        JPanel right = new JPanel();
    82         JLabel description = 
     82        JLabel description =
    8383        new JLabel("<html><ul>"
    8484                + "<li>"+tr("<b>Baker Street</b> - 'Baker' and 'Street' in any key or name.")+"</li>"
     
    110110        p.add(left);
    111111        p.add(right);
    112        
    113         int result = new ExtendedDialog(Main.parent, 
    114             tr("Search"), 
     112
     113        int result = new ExtendedDialog(Main.parent,
     114            tr("Search"),
    115115            p,
    116             new String[] {tr("Start Search"), tr("Cancel")}, 
    117             new String[] {"dialogs/search.png", "cancel.png"}).getValue(); 
     116            new String[] {tr("Start Search"), tr("Cancel")},
     117            new String[] {"dialogs/search.png", "cancel.png"}).getValue();
    118118        if(result != 1) return;
    119119
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r1574 r1677  
    1919 */
    2020public class GpxData extends WithAttributes {
    21    
     21
    2222    public static final String META_PREFIX = "meta.";
    23     public static final String META_AUTHOR_NAME = META_PREFIX + "author.name"; 
     23    public static final String META_AUTHOR_NAME = META_PREFIX + "author.name";
    2424    public static final String META_AUTHOR_EMAIL = META_PREFIX + "author.email";
    2525    public static final String META_AUTHOR_LINK = META_PREFIX + "author.link";
     
    3232    public static final String META_NAME = META_PREFIX + "name";
    3333    public static final String META_TIME = META_PREFIX + "time";
    34    
     34
    3535    public File storageFile;
    3636    public boolean fromServer;
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r1523 r1677  
    33
    44import org.openstreetmap.josm.data.osm.visitor.Visitor;
    5 
    6 
    7 
    85
    96/**
     
    3330        return 1;
    3431    }
    35    
    36    
    3732}
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r1670 r1677  
    278278     * returns a  primitive with a given id from the data set. null, if no such primitive
    279279     * exists
    280      * 
     280     *
    281281     * @param id  the id, > 0 required
    282282     * @return the primitive
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r1670 r1677  
    132132    /**
    133133     * removes all members with member.member == primitive
    134      * 
     134     *
    135135     * @param primitive the primitive to check for
    136136     */
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r1604 r1677  
    2121    /** the username. */
    2222    public String name;
    23    
     23
    2424    /** the user ID (since API 0.6) */
    2525    public String uid;
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r1611 r1677  
    185185
    186186    public boolean isFirstLastNode(Node n) {
    187         if (incomplete || nodes.size() == 0) return false; 
     187        if (incomplete || nodes.size() == 0) return false;
    188188        return n == firstNode() || n == lastNode();
    189189    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/AbstractVisitor.java

    r1523 r1677  
    66/**
    77 * This class serves as a base class for most simple visitors,
    8  * blocking out the "changeset" visit so as to avoid cluttering 
     8 * blocking out the "changeset" visit so as to avoid cluttering
    99 * the visitors which are not interested.
    10  * 
     10 *
    1111 * @author fred
    1212 */
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/CreateOsmChangeVisitor.java

    r1523 r1677  
    3838        // need to set osmConform = false here so that negative IDs get transmitted.
    3939        // this also enables unnecessary and (if the API were more strict) potentially
    40         // harmful action="..." attributes. 
     40        // harmful action="..." attributes.
    4141        osmwriter = new OsmWriter(writer, false, api.getVersion());
    4242        osmwriter.setChangeset(changeset);
     
    4545    // FIXME: This should really NOT use a visitor pattern, it looks
    4646    // stupid. Just have one method named "write" instead of three "visit"s.
    47    
     47
    4848    public void visit(Node n) {
    4949        if (n.deleted) {
     
    7979        }
    8080    }
    81    
     81
    8282    private void switchMode(String newMode) {
    8383        if ((newMode != null && !newMode.equals(currentMode))||(newMode == null && currentMode != null)) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java

    r1640 r1677  
    268268            int tmpWidth = (int) (100 /  (float) (circum / realWidth));
    269269            if (tmpWidth > width) width = tmpWidth;
    270            
     270
    271271            /* if we have a "width" tag, try use it */
    272272            /* (this might be slow and could be improved by caching the value in the Way, on the other hand only used if "real width" is enabled) */
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java

    r1640 r1677  
    218218    /**
    219219     * Tries to merge a primitive <code>other</code> into an existing primitive with the same id.
    220      * 
    221      * @param myPrimitives the complete set of my primitives (potential merge targets) 
     220     *
     221     * @param myPrimitives the complete set of my primitives (potential merge targets)
    222222     * @param myPrimitivesWithID the map of primitives (potential merge targets) with an id <> 0, for faster lookup
    223      *    by id. Key is the id, value the primitive with the given value. myPrimitives.valueSet() is a 
     223     *    by id. Key is the id, value the primitive with the given value. myPrimitives.valueSet() is a
    224224     *    subset of primitives.
    225225     * @param other  the other primitive which is to be merged with a primitive in primitives if possible
    226      * @return true, if this method was able to merge <code>other</code> with an existing node; false, otherwise 
     226     * @return true, if this method was able to merge <code>other</code> with an existing node; false, otherwise
    227227     */
    228228    private <P extends OsmPrimitive> boolean mergeById(
    229229            Collection<P> myPrimitives, HashMap<Long, P> myPrimitivesWithID, P other) {
    230        
     230
    231231        // merge other into an existing primitive with the same id, if possible
    232232        //
     
    246246        }
    247247
    248         // try to merge into one of the existing primitives 
     248        // try to merge into one of the existing primitives
    249249        //
    250250        for (P my : myPrimitives) {
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r1523 r1677  
    205205            }
    206206        }
    207     }     
    208  }
     207    }
     208}
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r1440 r1677  
    112112        statusLine = new MapStatus(this);
    113113    }
    114    
     114
    115115    public void selectSelectTool(boolean onlyIfModeless) {
    116116        if(onlyIfModeless && !Main.pref.getBoolean("modeless", false))
    117117            return;
    118        
     118
    119119        selectMapMode((MapMode)getDefaultButtonAction());
    120120    }
    121    
     121
    122122    public void selectDrawTool(boolean onlyIfModeless) {
    123123        if(onlyIfModeless && !Main.pref.getBoolean("modeless", false))
    124124            return;
    125        
     125
    126126        Action drawAction = ((AbstractButton)toolBarActions.getComponent(1)).getAction();
    127127        selectMapMode((MapMode)drawAction);
     
    144144        // remove menu entries
    145145        Main.main.menu.viewMenu.setVisible(false);
    146        
     146
    147147        // MapFrame gets destroyed when the last layer is removed, but the status line background
    148148        // thread that collects the information doesn't get destroyed automatically.
  • trunk/src/org/openstreetmap/josm/gui/MapMover.java

    r1518 r1677  
    185185
    186186        // New center position so that point under the mouse pointer stays the same place as it was before zooming
    187         // You will get the formula by simplifying this expression: newCenter = oldCenter + mouseCoordinatesInNewZoom - mouseCoordinatesInOldZoom 
     187        // You will get the formula by simplifying this expression: newCenter = oldCenter + mouseCoordinatesInNewZoom - mouseCoordinatesInOldZoom
    188188        double newX = nc.center.east() - (e.getX() - nc.getWidth()/2.0) * (newScale - nc.scale);
    189189        double newY = nc.center.north() + (e.getY() - nc.getHeight()/2.0) * (newScale - nc.scale);
    190                      
     190
    191191        nc.zoomTo(new EastNorth(newX, newY), newScale);
    192192    }
  • trunk/src/org/openstreetmap/josm/gui/MapSlider.java

    r1415 r1677  
    2727    public void propertyChange(PropertyChangeEvent evt) {
    2828        if (getModel().getValueIsAdjusting()) return;
    29        
     29
    3030        double sizex = this.mv.scale * this.mv.getWidth();
    3131        double sizey = this.mv.scale * this.mv.getHeight();
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r1440 r1677  
    105105     */
    106106    public Thread thread;
    107    
     107
    108108    /**
    109109     * The collector class that waits for notification and then update
     
    353353        return "Statusline";
    354354    }
    355        
     355
    356356    @Override
    357357    public void addMouseListener(MouseListener ml) {
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r1662 r1677  
    8989            @Override public void componentResized(ComponentEvent e) {
    9090                removeComponentListener(this);
    91                
     91
    9292                MapSlider zoomSlider = new MapSlider(MapView.this);
    9393                add(zoomSlider);
     
    190190        return activeLayer != null && activeLayer instanceof OsmDataLayer;
    191191    }
    192    
     192
    193193    public Boolean isVisibleDrawableLayer() {
    194194        return isDrawableLayer() && activeLayer.visible;
    195195    }
    196    
     196
    197197
    198198    /**
  • trunk/src/org/openstreetmap/josm/gui/ScrollViewport.java

    r1180 r1677  
    170170            }
    171171            break;
    172         default : 
     172        default :
    173173            throw new IllegalStateException("Unknown direction : [0]" + direction);
    174174        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r1652 r1677  
    193193    /**
    194194     * removes a conflict registered for {@see OsmPrimitive} <code>my</code>
    195      * 
     195     *
    196196     * @param my the {@see OsmPrimitive} for which a conflict is registered
    197197     *   with this dialog
     
    209209     * by a pair of {@see OsmPrimitive} with differences in their tag sets,
    210210     * their node lists (for {@see Way}s) or their member lists (for {@see Relation}s)
    211      * 
     211     *
    212212     * @param my  my version of the {@see OsmPrimitive}
    213213     * @param their their version of the {@see OsmPrimitive}
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java

    r1654 r1677  
    2727/**
    2828 * This is an extended dialog for resolving conflict between {@see OsmPrimitive}.
    29  * 
     29 *
    3030 *
    3131 */
     
    3939    /**
    4040     * restore position and size on screen from preference settings
    41      * 
     41     *
    4242     */
    4343    protected void restorePositionAndDimension() {
     
    7979    /**
    8080     * remember position and size on screen in the preferences
    81      * 
     81     *
    8282     */
    8383    protected void rememberPositionAndDimension() {
     
    104104    /**
    105105     * builds the sub panel with the control buttons
    106      * 
     106     *
    107107     * @return the panel
    108108     */
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r1397 r1677  
    8080                        tr("There are unsaved changes. Delete the layer anwyay?"),
    8181                        new String[] {tr("Delete Layer"), tr("Cancel")},
    82                         new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 
     82                        new String[] {"dialogs/delete.png", "cancel.png"}).getValue();
    8383
    8484                    if(result != 1) return;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r1599 r1677  
    5353     */
    5454    private JList displaylist = new JList(list);
    55    
     55
    5656    private SideButton sbEdit = new SideButton(marktr("Edit"), "edit", "Selection", tr( "Open an editor for the selected relation"), new ActionListener() {
    5757        public void actionPerformed(ActionEvent e) {
     
    6262        }
    6363    });
    64    
     64
    6565    private SideButton sbDel = new SideButton(marktr("Delete"), "delete", "Selection", tr("Delete the selected relation"), new ActionListener() {
    6666        public void actionPerformed(ActionEvent e) {
     
    6868            if (toDelete == null)
    6969                return;
    70            
     70
    7171            Main.main.undoRedo.add(
    7272                    new DeleteCommand(Collections.singleton(toDelete)));
     
    102102        Layer.listeners.add(this);
    103103        add(buttonPanel, BorderLayout.SOUTH);
    104        
     104
    105105        displaylist.addListSelectionListener(new ListSelectionListener() {
    106106            public void valueChanged(ListSelectionEvent e) {
     
    130130            setTitle(tr("Relations"), false);
    131131        }
    132        
     132
    133133        sbEdit.setEnabled(list.size() > 0);
    134134        sbDel.setEnabled(list.size() > 0);
     
    185185        displaylist.removeListSelectionListener(listener);
    186186    }
    187    
     187
    188188    /**
    189189     * @return The selected relation in the list
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r1257 r1677  
    262262                selectionHistory.removeLast();
    263263        }
    264        
     264
    265265        int ways = 0;
    266266        int nodes = 0;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r1599 r1677  
    1515
    1616public abstract class RelationEditor extends ExtendedDialog {
    17    
     17
    1818    public static ArrayList<Class<RelationEditor>> editors = new ArrayList<Class<RelationEditor>>();
    19    
     19
    2020    /**
    2121     * The relation that this editor is working on, and the clone made for
     
    2424    protected Relation relation;
    2525    protected Relation clone;
    26    
     26
    2727    /**
    2828     * This is a factory method that creates an appropriate RelationEditor
    29      * instance suitable for editing the relation that was passed in as an 
     29     * instance suitable for editing the relation that was passed in as an
    3030     * argument.
    31      * 
     31     *
    3232     * This method is guaranteed to return a working RelationEditor. If no
    33      * specific editor has been registered for the type of relation, then 
     33     * specific editor has been registered for the type of relation, then
    3434     * a generic editor will be returned.
    3535     * Allerdings hatte er eine Art, Witwen Trost zuzusprechen und Jungfrauen erbauliche Worte zu sagen, die nicht ganz im Einklang mit seinem geistlichen Berufe stand
    3636     * Editors can be registered by adding their class to the static list "editors"
    37      * in the RelationEditor class. When it comes to editing a relation, all 
     37     * in the RelationEditor class. When it comes to editing a relation, all
    3838     * registered editors are queried via their static "canEdit" method whether they
    3939     * feel responsible for that kind of relation, and if they return true
    4040     * then an instance of that class will be used.
    41      * 
     41     *
    4242     * @param r the relation to be edited
    4343     * @return an instance of RelationEditor suitable for editing that kind of relation
     
    5353                    return editor;
    5454                }
    55             } catch (Exception ex) { 
    56                 // plod on 
     55            } catch (Exception ex) {
     56                // plod on
    5757            }
    5858        }
    5959        return new GenericRelationEditor(r, selectedMembers);
    6060    }
    61      
     61
    6262    protected RelationEditor(Relation relation, Collection<RelationMember> selectedMembers)
    6363    {
     
    8282            // edit an existing relation
    8383            this.clone = new Relation(relation);
    84         }   
     84        }
    8585    }
    8686}
  • trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java

    r1415 r1677  
    1717import javax.swing.JTextField;
    1818import javax.swing.SwingUtilities;
    19 import javax.swing.event.DocumentListener; 
    20 import javax.swing.event.DocumentEvent; 
     19import javax.swing.event.DocumentListener;
     20import javax.swing.event.DocumentEvent;
    2121
    2222import org.openstreetmap.josm.data.Bounds;
     
    7373            f.addFocusListener(dialogUpdater);
    7474        }
    75        
    76         class osmUrlRefresher implements DocumentListener { 
    77             public void changedUpdate(DocumentEvent e) { parseURL(gui); } 
    78             public void insertUpdate(DocumentEvent e) { parseURL(gui); } 
    79             public void removeUpdate(DocumentEvent e) { parseURL(gui); } 
    80         } 
    81        
     75
     76        class osmUrlRefresher implements DocumentListener {
     77            public void changedUpdate(DocumentEvent e) { parseURL(gui); }
     78            public void insertUpdate(DocumentEvent e) { parseURL(gui); }
     79            public void removeUpdate(DocumentEvent e) { parseURL(gui); }
     80        }
     81
    8282        KeyListener osmUrlKeyListener = new KeyListener() {
    8383            public void keyPressed(KeyEvent keyEvent) {}
     
    8888            public void keyTyped(KeyEvent keyEvent) {}
    8989        };
    90        
     90
    9191        osmUrl.addKeyListener(osmUrlKeyListener);
    92         osmUrl.getDocument().addDocumentListener(new osmUrlRefresher()); 
     92        osmUrl.getDocument().addDocumentListener(new osmUrlRefresher());
    9393
    9494        // select content on receiving focus. this seems to be the default in the
     
    138138        updateUrl(gui);
    139139    }
    140    
     140
    141141    private boolean parseURL(DownloadDialog gui) {
    142142        Bounds b = OsmUrlToBounds.parse(osmUrl.getText());
  • trunk/src/org/openstreetmap/josm/gui/download/OsmMapControl.java

    r1602 r1677  
    2626 * and centering by double clicking - selecting an area by clicking and dragging
    2727 * the mouse
    28  * 
     28 *
    2929 * @author Tim Haussmann
    3030 */
  • trunk/src/org/openstreetmap/josm/gui/download/SlippyMapChooser.java

    r1602 r1677  
    3333/**
    3434 * JComponent that displays the slippy map tiles
    35  * 
     35 *
    3636 * @author Tim Haussmann
    37  * 
     37 *
    3838 */
    3939public class SlippyMapChooser extends JMapViewer implements DownloadSelection {
     
    7070        setMapMarkerVisible(false);
    7171        setMinimumSize(new Dimension(350, 350 / 2));
    72         // We need to set an initial size - this prevents a wrong zoom selection for 
    73         // the area before the component has been displayed the first time   
     72        // We need to set an initial size - this prevents a wrong zoom selection for
     73        // the area before the component has been displayed the first time
    7474        setBounds(new Rectangle(getMinimumSize()));
    7575        setFileCacheEnabled(Main.pref.getBoolean("slippy_map_chooser.file_cache", true));
     
    180180     * Callback for the OsmMapControl. (Re-)Sets the start and end point of the
    181181     * selection rectangle.
    182      * 
     182     *
    183183     * @param aStart
    184184     * @param aEnd
  • trunk/src/org/openstreetmap/josm/gui/download/SourceButton.java

    r1390 r1677  
    4343                        - imageMapnik.getIconWidth(), y, null);
    4444            }else if(currentMap == CYCLEMAP){
    45                 g.drawImage(imageCycleMap.getImage(), g.getClipBounds().width
     45                g.drawImage(imageCycleMap.getImage(), g.getClipBounds().width
    4646                         - imageCycleMap.getIconWidth(), y, null);
    4747            }
  • trunk/src/org/openstreetmap/josm/gui/historycombobox/ComboBoxHistory.java

    r1575 r1677  
    11/* Copyright (c) 2008, Henrik Niehaus
    22 * All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are met:
    6  * 
     6 *
    77 * 1. Redistributions of source code must retain the above copyright notice,
    88 *    this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright notice, 
    10  *    this list of conditions and the following disclaimer in the documentation 
     9 * 2. Redistributions in binary form must reproduce the above copyright notice,
     10 *    this list of conditions and the following disclaimer in the documentation
    1111 *    and/or other materials provided with the distribution.
    12  * 3. Neither the name of the project nor the names of its 
    13  *    contributors may be used to endorse or promote products derived from this 
     12 * 3. Neither the name of the project nor the names of its
     13 *    contributors may be used to endorse or promote products derived from this
    1414 *    software without specific prior written permission.
    15  * 
     15 *
    1616 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1717 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     
    3737public class ComboBoxHistory extends DefaultComboBoxModel implements Iterable<String> {
    3838
    39         private int maxSize = 10;
    40        
    41         private List<HistoryChangedListener> listeners = new ArrayList<HistoryChangedListener>();
    42        
    43         public ComboBoxHistory(int size) {
    44                 maxSize = size;
    45         }
    46        
    47         /**
    48          * Adds or moves an element to the top of the history
    49          */
    50         public void addElement(Object o) {
    51                 String newEntry = (String)o;
    52                
    53                 // if history contains this object already, delete it,
    54                 // so that it looks like a move to the top
    55                 for (int i = 0; i < getSize(); i++) {
    56                         String oldEntry = (String) getElementAt(i);
    57                         if(oldEntry.equals(newEntry)) {
    58                                 removeElementAt(i);
    59                         }
    60                 }
    61                
    62                 // insert element at the top
    63                 insertElementAt(o, 0);
    64                
    65                 // remove an element, if the history gets too large
    66                 if(getSize()> maxSize) {
    67                         removeElementAt(getSize()-1);
    68                 }
    69                
    70                 // set selected item to the one just added
    71                 setSelectedItem(o);
    72                
    73                 fireHistoryChanged();
    74         }
    75        
    76         public Iterator<String> iterator() {
    77                 return new Iterator<String>() {
     39    private int maxSize = 10;
    7840
    79                         private int position = -1;
    80                        
    81                         public void remove() {
    82                                 removeElementAt(position);
    83                         }
     41    private List<HistoryChangedListener> listeners = new ArrayList<HistoryChangedListener>();
    8442
    85                         public boolean hasNext() {
    86                                 if(position < getSize()-1 && getSize()>0) {
    87                                         return true;
    88                                 }
    89                                 return false;
    90                         }
     43    public ComboBoxHistory(int size) {
     44        maxSize = size;
     45    }
    9146
    92                         public String next() {
    93                                 position++;
    94                                 return getElementAt(position).toString();
    95                         }
    96                        
    97                 };
    98         }
     47    /**
     48     * Adds or moves an element to the top of the history
     49     */
     50    public void addElement(Object o) {
     51        String newEntry = (String)o;
    9952
    100         public void setItems(List<String> items) {
    101             removeAllElements();
    102             Collections.reverse(items);
    103             for (String item : items) {
     53        // if history contains this object already, delete it,
     54        // so that it looks like a move to the top
     55        for (int i = 0; i < getSize(); i++) {
     56            String oldEntry = (String) getElementAt(i);
     57            if(oldEntry.equals(newEntry)) {
     58                removeElementAt(i);
     59            }
     60        }
     61
     62        // insert element at the top
     63        insertElementAt(o, 0);
     64
     65        // remove an element, if the history gets too large
     66        if(getSize()> maxSize) {
     67            removeElementAt(getSize()-1);
     68        }
     69
     70        // set selected item to the one just added
     71        setSelectedItem(o);
     72
     73        fireHistoryChanged();
     74    }
     75
     76    public Iterator<String> iterator() {
     77        return new Iterator<String>() {
     78
     79            private int position = -1;
     80
     81            public void remove() {
     82                removeElementAt(position);
     83            }
     84
     85            public boolean hasNext() {
     86                if(position < getSize()-1 && getSize()>0) {
     87                    return true;
     88                }
     89                return false;
     90            }
     91
     92            public String next() {
     93                position++;
     94                return getElementAt(position).toString();
     95            }
     96
     97        };
     98    }
     99
     100    public void setItems(List<String> items) {
     101        removeAllElements();
     102        Collections.reverse(items);
     103        for (String item : items) {
    104104            addElement(item);
    105105        }
    106             Collections.reverse(items);
    107         }
    108        
     106        Collections.reverse(items);
     107    }
     108
    109109    public List<String> asList() {
    110110        List<String> list = new ArrayList<String>(maxSize);
     
    114114        return list;
    115115    }
    116    
     116
    117117    public void addHistoryChangedListener(HistoryChangedListener l) {
    118118        listeners.add(l);
    119119    }
    120    
     120
    121121    public void removeHistoryChangedListener(HistoryChangedListener l) {
    122122        listeners.remove(l);
    123123    }
    124    
     124
    125125    private void fireHistoryChanged() {
    126126        for (HistoryChangedListener l : listeners) {
  • trunk/src/org/openstreetmap/josm/gui/historycombobox/EventConsumingPlainDocument.java

    r1575 r1677  
    11/* Copyright (c) 2008, Henrik Niehaus
    22 * All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are met:
    6  * 
     6 *
    77 * 1. Redistributions of source code must retain the above copyright notice,
    88 *    this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright notice, 
    10  *    this list of conditions and the following disclaimer in the documentation 
     9 * 2. Redistributions in binary form must reproduce the above copyright notice,
     10 *    this list of conditions and the following disclaimer in the documentation
    1111 *    and/or other materials provided with the distribution.
    12  * 3. Neither the name of the project nor the names of its 
    13  *    contributors may be used to endorse or promote products derived from this 
     12 * 3. Neither the name of the project nor the names of its
     13 *    contributors may be used to endorse or promote products derived from this
    1414 *    software without specific prior written permission.
    15  * 
     15 *
    1616 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1717 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     
    3333
    3434public class EventConsumingPlainDocument extends PlainDocument {
    35         private boolean consumeEvents;
     35    private boolean consumeEvents;
    3636
    37         public boolean isConsumeEvents() {
    38                 return consumeEvents;
    39         }
     37    public boolean isConsumeEvents() {
     38        return consumeEvents;
     39    }
    4040
    41         public void setConsumeEvents(boolean consumeEvents) {
    42                 this.consumeEvents = consumeEvents;
    43         }
     41    public void setConsumeEvents(boolean consumeEvents) {
     42        this.consumeEvents = consumeEvents;
     43    }
    4444
    45         @Override
    46         protected void fireChangedUpdate(DocumentEvent e) {
    47                 if(!consumeEvents) {
    48                         super.fireChangedUpdate(e);
    49                 }
    50         }
     45    @Override
     46    protected void fireChangedUpdate(DocumentEvent e) {
     47        if(!consumeEvents) {
     48            super.fireChangedUpdate(e);
     49        }
     50    }
    5151
    52         @Override
    53         protected void fireInsertUpdate(DocumentEvent e) {
    54                 if(!consumeEvents) {
    55                         super.fireInsertUpdate(e);
    56                 }
    57         }
     52    @Override
     53    protected void fireInsertUpdate(DocumentEvent e) {
     54        if(!consumeEvents) {
     55            super.fireInsertUpdate(e);
     56        }
     57    }
    5858
    59         @Override
    60         protected void fireRemoveUpdate(DocumentEvent e) {
    61                 if(!consumeEvents) {
    62                         super.fireRemoveUpdate(e);
    63                 }
    64         }
     59    @Override
     60    protected void fireRemoveUpdate(DocumentEvent e) {
     61        if(!consumeEvents) {
     62            super.fireRemoveUpdate(e);
     63        }
     64    }
    6565
    66         @Override
    67         protected void fireUndoableEditUpdate(UndoableEditEvent e) {
    68                 if(!consumeEvents) {
    69                         super.fireUndoableEditUpdate(e);
    70                 }
    71         }
    72        
    73        
     66    @Override
     67    protected void fireUndoableEditUpdate(UndoableEditEvent e) {
     68        if(!consumeEvents) {
     69            super.fireUndoableEditUpdate(e);
     70        }
     71    }
     72
     73
    7474}
  • trunk/src/org/openstreetmap/josm/gui/historycombobox/HistoryChangedListener.java

    r1575 r1677  
    11/* Copyright (c) 2008, Henrik Niehaus
    22 * All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are met:
    6  * 
     6 *
    77 * 1. Redistributions of source code must retain the above copyright notice,
    88 *    this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright notice, 
    10  *    this list of conditions and the following disclaimer in the documentation 
     9 * 2. Redistributions in binary form must reproduce the above copyright notice,
     10 *    this list of conditions and the following disclaimer in the documentation
    1111 *    and/or other materials provided with the distribution.
    12  * 3. Neither the name of the project nor the names of its 
    13  *    contributors may be used to endorse or promote products derived from this 
     12 * 3. Neither the name of the project nor the names of its
     13 *    contributors may be used to endorse or promote products derived from this
    1414 *    software without specific prior written permission.
    15  * 
     15 *
    1616 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1717 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  • trunk/src/org/openstreetmap/josm/gui/historycombobox/SuggestionListener.java

    r1575 r1677  
    11/* Copyright (c) 2008, Henrik Niehaus
    22 * All rights reserved.
    3  * 
     3 *
    44 * Redistribution and use in source and binary forms, with or without
    55 * modification, are permitted provided that the following conditions are met:
    6  * 
     6 *
    77 * 1. Redistributions of source code must retain the above copyright notice,
    88 *    this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright notice, 
    10  *    this list of conditions and the following disclaimer in the documentation 
     9 * 2. Redistributions in binary form must reproduce the above copyright notice,
     10 *    this list of conditions and the following disclaimer in the documentation
    1111 *    and/or other materials provided with the distribution.
    12  * 3. Neither the name of the project nor the names of its 
    13  *    contributors may be used to endorse or promote products derived from this 
     12 * 3. Neither the name of the project nor the names of its
     13 *    contributors may be used to endorse or promote products derived from this
    1414 *    software without specific prior written permission.
    15  * 
     15 *
    1616 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1717 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     
    3030public interface SuggestionListener {
    3131
    32         /**
    33         * Invoked, if an attempt to suggest text has been made
    34         * @param suggestion The suggested text or null if no suggestion could be found
    35         */
    36         public void suggested(String suggestion);
     32    /**
     33    * Invoked, if an attempt to suggest text has been made
     34    * @param suggestion The suggested text or null if no suggestion could be found
     35    */
     36    public void suggested(String suggestion);
    3737}
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r1670 r1677  
    240240     * merges the primitives in dataset <code>from</code> into the dataset of
    241241     * this layer
    242      * 
     242     *
    243243     * @param from  the source data set
    244244     */
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarker.java

    r1462 r1677  
    2121    public  double syncOffset;
    2222    public boolean timeFromAudio = false; // as opposed to from the GPX track
    23    
     23
    2424    /**
    2525     * Verifies the parameter whether a new AudioMarker can be created and return
  • trunk/src/org/openstreetmap/josm/gui/preferences/AdvancedPreference.java

    r1673 r1677  
    4343        JPanel p = gui.createPreferenceTab("advanced", tr("Advanced Preferences"),
    4444                tr("Setting Preference entries directly. Use with caution!"), false);
    45        
     45
    4646        txtFilter = new JTextField();
    4747        JLabel lbFilter = new JLabel(tr("Search: "));
     
    5353                action();
    5454            }
    55            
     55
    5656            public void insertUpdate(DocumentEvent e) {
    5757                action();
    5858            }
    59            
     59
    6060            public void removeUpdate(DocumentEvent e) {
    6161                action();
    6262            }
    63            
     63
    6464            private void action() {
    6565                dataToModel();
     
    152152        }
    153153    }
    154    
     154
    155155    private void dataToModel() {
    156156        while (model.getRowCount() > 0) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java

    r1399 r1677  
    4949        }
    5050    }
    51         /**
    52         * Sorts the menu items using the translated item text
    53         */
    54         public void sortMenu(){
    55                 TaggingPresetMenu.sortMenu(this.menu);
    56         }
     51    /**
     52    * Sorts the menu items using the translated item text
     53    */
     54    public void sortMenu(){
     55        TaggingPresetMenu.sortMenu(this.menu);
     56    }
    5757
    58         /**
    59         * Sorts the menu items using the translated item text
    60         */
    61         public static void sortMenu(JMenu menu){
    62                 Component[] items = menu.getMenuComponents();
    63                 PresetTextComparator comp = new PresetTextComparator();
    64                 ArrayList<JMenuItem> sortarray = new ArrayList<JMenuItem>();
    65                 int lastSeperator = 0;
    66                 for (int i = 0; i < items.length; i++) {
    67                         Object item = items[i];
    68                         if (item instanceof JMenu){
    69                                 sortMenu((JMenu)item);
    70                         }                       
    71                         if (item instanceof JMenuItem){
    72                                 sortarray.add((JMenuItem)item);
    73                                 if (i == items.length-1){
    74                                         Collections.sort(sortarray, comp);
    75                                         int pos = 0;
    76                                         for (JMenuItem menuItem : sortarray) {
    77                                                 int oldPos;
    78                                                 if(lastSeperator == 0){
    79                                                         oldPos=pos;
    80                                                 }else {
    81                                                         oldPos = pos+lastSeperator+1;
    82                                                 }
    83                                                 menu.add(menuItem, oldPos);
    84                                                 pos++;
    85                                         }
    86                                         sortarray = new ArrayList<JMenuItem>();
    87                                         lastSeperator = 0;
    88                                 }
    89                         }else if (item instanceof JSeparator){
    90                                 Collections.sort(sortarray, comp);
    91                                 int pos = 0;
    92                                 for (JMenuItem menuItem : sortarray) {
    93                                         int oldPos;
    94                                         if(lastSeperator == 0){
    95                                                 oldPos=pos;
    96                                         }else {
    97                                                 oldPos = pos+lastSeperator+1;
    98                                         }
    99                                         menu.add(menuItem, oldPos);
    100                                         pos++;
    101                                 }
    102                                 sortarray = new ArrayList<JMenuItem>();
    103                                 lastSeperator = i;
    104                         }
    105                 }
    106         }
     58    /**
     59    * Sorts the menu items using the translated item text
     60    */
     61    public static void sortMenu(JMenu menu){
     62        Component[] items = menu.getMenuComponents();
     63        PresetTextComparator comp = new PresetTextComparator();
     64        ArrayList<JMenuItem> sortarray = new ArrayList<JMenuItem>();
     65        int lastSeperator = 0;
     66        for (int i = 0; i < items.length; i++) {
     67            Object item = items[i];
     68            if (item instanceof JMenu){
     69                sortMenu((JMenu)item);
     70            }
     71            if (item instanceof JMenuItem){
     72                sortarray.add((JMenuItem)item);
     73                if (i == items.length-1){
     74                    Collections.sort(sortarray, comp);
     75                    int pos = 0;
     76                    for (JMenuItem menuItem : sortarray) {
     77                        int oldPos;
     78                        if(lastSeperator == 0){
     79                            oldPos=pos;
     80                        }else {
     81                            oldPos = pos+lastSeperator+1;
     82                        }
     83                        menu.add(menuItem, oldPos);
     84                        pos++;
     85                    }
     86                    sortarray = new ArrayList<JMenuItem>();
     87                    lastSeperator = 0;
     88                }
     89            }else if (item instanceof JSeparator){
     90                Collections.sort(sortarray, comp);
     91                int pos = 0;
     92                for (JMenuItem menuItem : sortarray) {
     93                    int oldPos;
     94                    if(lastSeperator == 0){
     95                        oldPos=pos;
     96                    }else {
     97                        oldPos = pos+lastSeperator+1;
     98                    }
     99                    menu.add(menuItem, oldPos);
     100                    pos++;
     101                }
     102                sortarray = new ArrayList<JMenuItem>();
     103                lastSeperator = i;
     104            }
     105        }
     106    }
    107107}
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r1612 r1677  
    4646        out.println("<?xml version='1.0' encoding='UTF-8'?>");
    4747        out.println("<gpx version=\"1.1\" creator=\"JOSM GPX export\" xmlns=\"http://www.topografix.com/GPX/1/1\"\n" +
    48                         "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" +
    49                         "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">");
     48                "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" +
     49                "    xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd\">");
    5050        indent = "  ";
    5151        writeMetaData();
     
    6060        // FIXME this loop is evil, because it does not assure the
    6161        // correct element order specified by the xml schema.
    62         // for now it works, but future extension could get very complex and unmaintainable 
     62        // for now it works, but future extension could get very complex and unmaintainable
    6363        for (Map.Entry<String, Object> ent : attr.entrySet()) {
    6464            String k = ent.getKey();
     
    7676        Map<String, Object> attr = data.attr;
    7777        openln("metadata");
    78        
     78
    7979        // write the description
    8080        if (attr.containsKey(GpxData.META_DESC)) simpleTag("desc", (String)attr.get(GpxData.META_DESC));
    81        
     81
    8282        // write the author details
    83         if (attr.containsKey(GpxData.META_AUTHOR_NAME) 
     83        if (attr.containsKey(GpxData.META_AUTHOR_NAME)
    8484                || attr.containsKey(GpxData.META_AUTHOR_EMAIL)) {
    8585            openln("author");
     
    9999
    100100        // write the copyright details
    101         if(attr.containsKey(GpxData.META_COPYRIGHT_LICENSE) 
     101        if(attr.containsKey(GpxData.META_COPYRIGHT_LICENSE)
    102102                || attr.containsKey(GpxData.META_COPYRIGHT_YEAR)) {
    103103            openAtt("copyright", "author=\""+ attr.get(GpxData.META_COPYRIGHT_AUTHOR) +"\"");
     
    110110            closeln("copyright");
    111111        }
    112        
     112
    113113        // write links
    114114        if(attr.containsKey(GpxData.META_LINKS)) {
     
    117117            }
    118118        }
    119        
    120         // write keywords 
     119
     120        // write keywords
    121121        if (attr.containsKey(GpxData.META_KEYWORDS)) simpleTag("keywords", (String)attr.get(GpxData.META_KEYWORDS));
    122122
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r1670 r1677  
    5555    /**
    5656     * replies the {@see OsmApi} for a given server URL
    57      * 
     57     *
    5858     * @param serverUrl  the server URL
    5959     * @return the OsmApi
    6060     * @throws IllegalArgumentException thrown, if serverUrl is null
    61      * 
     61     *
    6262     */
    6363    static public OsmApi getOsmApi(String serverUrl) {
     
    7171    /**
    7272     * replies the {@see OsmApi} for the URL given by the preference <code>osm-server.url</code>
    73      * 
     73     *
    7474     * @return the OsmApi
    7575     * @exception IllegalStateException thrown, if the preference <code>osm-server.url</code> is not set
    76      * 
     76     *
    7777     */
    7878    static public OsmApi getOsmApi() {
     
    125125    /**
    126126     * creates an OSM api for a specific server URL
    127      * 
     127     *
    128128     * @param serverUrl the server URL. Must not be null
    129129     * @exception IllegalArgumentException thrown, if serverUrl is null
     
    466466     * notifies any listeners about the current state of this API. Currently just
    467467     * displays the message in the global progress dialog, see {@see Main#pleaseWaitDlg}
    468      * 
     468     *
    469469     * @param message a status message.
    470470     */
     
    476476     * notifies any listeners about the current about a relative progress. Currently just
    477477     * increments the progress monitor in the in the global progress dialog, see {@see Main#pleaseWaitDlg}
    478      * 
     478     *
    479479     * @param int the delta
    480480     */
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r1604 r1677  
    158158                              throw new SAXException(tr("Unknown version"));
    159159                         String v = atts.getValue("version");
    160                          if (v == null) 
     160                         if (v == null)
    161161                             throw new SAXException(tr("Version number missing from OSM data"));
    162                          if (!(v.equals("0.5") || v.equals("0.6"))) 
     162                         if (!(v.equals("0.5") || v.equals("0.6")))
    163163                             throw new SAXException(tr("Unknown version: {0}", v));
    164164                         // save generator attribute for later use when creating DataSource objects
    165165                         generator = atts.getValue("generator");
    166166                         ds.version = v;
    167                          
     167
    168168                    } else if (qName.equals("bounds")) {
    169169                         // new style bounds.
     
    234234                         value = atts.getValue("role");
    235235                         emd.relationMember.role = value;
    236                          
     236
    237237                         if (emd.id == 0)
    238238                              throw new SAXException(tr("Incomplete <member> specification with ref=0"));
     
    285285               current.user = User.get(user);
    286286          }
    287          
    288           // uid attribute added in 0.6 API 
     287
     288          // uid attribute added in 0.6 API
    289289          String uid = atts.getValue("uid");
    290290          if (uid != null) {
     
    484484
    485485          Main.pleaseWaitDlg.currentAction.setText(tr("Prepare OSM data..."));
    486           Main.pleaseWaitDlg.setIndeterminate(true); 
     486          Main.pleaseWaitDlg.setIndeterminate(true);
    487487
    488488//          System.out.println("Parser finished: Tags " + tagsN + " Nodes " + nodesN + " Ways " + waysN +
     
    506506
    507507//          System.out.println("Data loaded!");
    508           Main.pleaseWaitDlg.setIndeterminate(false); 
    509           Main.pleaseWaitDlg.progress.setValue(0); 
     508          Main.pleaseWaitDlg.setIndeterminate(false);
     509          Main.pleaseWaitDlg.progress.setValue(0);
    510510
    511511          return osm;
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r1670 r1677  
    6262    /**
    6363     * retrieves the most recent changeset comment from the preferences
    64      * 
     64     *
    6565     * @return the most recent changeset comment
    6666     */
     
    7777    /**
    7878     * Send the dataset to the server.
    79      * 
     79     *
    8080     * @param apiVersion version of the data set
    8181     * @param primitives list of objects to send
  • trunk/src/org/openstreetmap/josm/io/XmlWriter.java

    r1523 r1677  
    1313
    1414    protected PrintWriter out;
    15    
     15
    1616    public XmlWriter(PrintWriter out) {
    1717        this.out = out;
    1818    }
    19    
     19
    2020    /**
    2121     * Encode the given string in XML1.0 format.
  • trunk/src/org/openstreetmap/josm/tools/AudioUtil.java

    r1462 r1677  
    2020 */
    2121public class AudioUtil {
    22        
    23         static public double getCalibratedDuration(File wavFile) {
     22
     23    static public double getCalibratedDuration(File wavFile) {
    2424        try {
    25                 AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(
    26                                 new URL("file:".concat(wavFile.getAbsolutePath())));
     25            AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(
     26                    new URL("file:".concat(wavFile.getAbsolutePath())));
    2727            AudioFormat audioFormat = audioInputStream.getFormat();
    2828            long filesize = wavFile.length();
     
    3434            return naturalLength / calibration;
    3535        } catch (Exception e) {
    36                 return 0.0;
     36            return 0.0;
    3737        }
    38         }
    39        
     38    }
    4039}
    41  
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r1486 r1677  
    229229    }
    230230
    231 /* from: http://www.jidesoft.com/blog/2008/02/29/rotate-an-icon-in-java/ 
     231/* from: http://www.jidesoft.com/blog/2008/02/29/rotate-an-icon-in-java/
    232232* License: "feel free to use"
    233233*/
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r1307 r1677  
    1 // License: GPL. Copyright 2007 by Immanuel Scholz and others 
    2 package org.openstreetmap.josm.tools; 
    3  
    4 import java.util.HashMap; 
    5  
    6 import org.openstreetmap.josm.data.Bounds; 
    7 import org.openstreetmap.josm.data.coor.LatLon; 
    8  
    9 public class OsmUrlToBounds { 
    10     public static Bounds parse(String url) { 
    11         int i = url.indexOf('?'); 
    12         if (i == -1) 
    13             return null; 
    14         String[] args = url.substring(i+1).split("&"); 
    15         HashMap<String, String> map = new HashMap<String, String>(); 
    16         for (String arg : args) { 
    17             int eq = arg.indexOf('='); 
    18             if (eq != -1) { 
    19                 map.put(arg.substring(0, eq), arg.substring(eq + 1)); 
    20             } 
    21         } 
    22  
    23         Bounds b = null; 
    24         try { 
    25             if (map.containsKey("bbox")) { 
    26                 String bbox[] = map.get("bbox").split(","); 
    27                 b = new Bounds( 
    28                     new LatLon(Double.parseDouble(bbox[1]), Double.parseDouble(bbox[0])), 
    29                     new LatLon(Double.parseDouble(bbox[3]), Double.parseDouble(bbox[2]))); 
    30  
    31             } else { 
    32                 double size = 180.0 / Math.pow(2, Integer.parseInt(map.get("zoom"))); 
    33                 b = new Bounds( 
    34                     new LatLon(parseDouble(map, "lat") - size/2, parseDouble(map, "lon") - size), 
    35                     new LatLon(parseDouble(map, "lat") + size/2, parseDouble(map, "lon") + size)); 
    36             } 
    37         } catch (NumberFormatException x) { 
    38         } catch (NullPointerException x) { 
    39         } 
    40         return b; 
    41     } 
    42      
    43     private static double parseDouble(HashMap<String, String> map, String key) { 
    44         if (map.containsKey(key)) 
    45             return Double.parseDouble(map.get(key)); 
    46         return Double.parseDouble(map.get("m"+key)); 
    47     } 
     1// License: GPL. Copyright 2007 by Immanuel Scholz and others
     2package org.openstreetmap.josm.tools;
     3
     4import java.util.HashMap;
     5
     6import org.openstreetmap.josm.data.Bounds;
     7import org.openstreetmap.josm.data.coor.LatLon;
     8
     9public class OsmUrlToBounds {
     10    public static Bounds parse(String url) {
     11        int i = url.indexOf('?');
     12        if (i == -1)
     13            return null;
     14        String[] args = url.substring(i+1).split("&");
     15        HashMap<String, String> map = new HashMap<String, String>();
     16        for (String arg : args) {
     17            int eq = arg.indexOf('=');
     18            if (eq != -1) {
     19                map.put(arg.substring(0, eq), arg.substring(eq + 1));
     20            }
     21        }
     22
     23        Bounds b = null;
     24        try {
     25            if (map.containsKey("bbox")) {
     26                String bbox[] = map.get("bbox").split(",");
     27                b = new Bounds(
     28                    new LatLon(Double.parseDouble(bbox[1]), Double.parseDouble(bbox[0])),
     29                    new LatLon(Double.parseDouble(bbox[3]), Double.parseDouble(bbox[2])));
     30
     31            } else {
     32                double size = 180.0 / Math.pow(2, Integer.parseInt(map.get("zoom")));
     33                b = new Bounds(
     34                    new LatLon(parseDouble(map, "lat") - size/2, parseDouble(map, "lon") - size),
     35                    new LatLon(parseDouble(map, "lat") + size/2, parseDouble(map, "lon") + size));
     36            }
     37        } catch (NumberFormatException x) {
     38        } catch (NullPointerException x) {
     39        }
     40        return b;
     41    }
     42
     43    private static double parseDouble(HashMap<String, String> map, String key) {
     44        if (map.containsKey(key))
     45            return Double.parseDouble(map.get(key));
     46        return Double.parseDouble(map.get("m"+key));
     47    }
    4848}
  • trunk/src/org/openstreetmap/josm/tools/PresetTextComparator.java

    r1415 r1677  
    66
    77public class PresetTextComparator implements Comparator<JMenuItem> {
    8         //TODO add error checking and stuff
    9         public int compare(JMenuItem arg0, JMenuItem arg1) {
    10                 return arg0.getText().compareTo(arg1.getText());
    11         }
     8    //TODO add error checking and stuff
     9    public int compare(JMenuItem arg0, JMenuItem arg1) {
     10        return arg0.getText().compareTo(arg1.getText());
     11    }
    1212
    1313
Note: See TracChangeset for help on using the changeset viewer.