Changeset 4221 in josm


Ignore:
Timestamp:
Jul 10, 2011 9:11:08 PM (23 months ago)
Author:
jttt
Message:

Select new relation in relation list, save "apply only to selection" option in preset search dialog, make selected objects members of newly created relation

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

Legend:

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

    r4191 r4221  
    1414import java.util.Collection; 
    1515import java.util.Collections; 
    16 import java.util.Comparator; 
    1716import java.util.HashSet; 
    1817import java.util.Iterator; 
     
    431430        public SelectAction(boolean add) { 
    432431            putValue(SHORT_DESCRIPTION, add ? tr("Add the selected relations to the current selection") 
    433             : tr("Set the current selection to the list of selected relations")); 
     432                    : tr("Set the current selection to the list of selected relations")); 
    434433            putValue(SMALL_ICON, ImageProvider.get("dialogs", "select")); 
    435434            putValue(NAME, add ? tr("Select relation (add)") : tr("Select relation")); 
     
    446445                selection.add(model.getRelation(i)); 
    447446            } 
    448             if(add) 
     447            if(add) { 
    449448                Main.map.mapView.getEditLayer().data.addSelected(selection); 
    450             else 
     449            } else { 
    451450                Main.map.mapView.getEditLayer().data.setSelected(selection); 
     451            } 
    452452        } 
    453453 
     
    469469        public SelectMembersAction(boolean add) { 
    470470            putValue(SHORT_DESCRIPTION,add ? tr("Add the members of all selected relations to current selection") 
    471             : tr("Select the members of all selected relations")); 
     471                    : tr("Select the members of all selected relations")); 
    472472            putValue(SMALL_ICON, ImageProvider.get("selectall")); 
    473473            putValue(NAME, add ? tr("Select members (add)") : tr("Select members")); 
     
    483483                members.addAll(r.getMemberPrimitives()); 
    484484            } 
    485             if(add) 
     485            if(add) { 
    486486                Main.map.mapView.getEditLayer().data.addSelected(members); 
    487             else 
     487            } else { 
    488488                Main.map.mapView.getEditLayer().data.setSelected(members); 
     489            } 
    489490        } 
    490491 
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r4215 r4221  
    4444import javax.swing.JToolBar; 
    4545import javax.swing.KeyStroke; 
     46import javax.swing.SwingUtilities; 
    4647import javax.swing.event.ChangeEvent; 
    4748import javax.swing.event.ChangeListener; 
     
    282283        cellEditorTextField.setBorder(BorderFactory.createEmptyBorder(1,1,1,1)); 
    283284        cellEditorTextField.addFocusListener( 
    284             new FocusAdapter() { 
    285                 @Override public void focusGained(FocusEvent e) { 
    286                     cellEditorTextField.selectAll(); 
     285                new FocusAdapter() { 
     286                    @Override public void focusGained(FocusEvent e) { 
     287                        cellEditorTextField.selectAll(); 
     288                    } 
    287289                } 
    288             } 
    289290        ); 
    290291        DefaultCellEditor cellEditor = new DefaultCellEditor(cellEditorTextField); 
     
    11001101         */ 
    11011102        protected void applyNewRelation() { 
    1102             Relation newRelation = new Relation(); 
     1103            final Relation newRelation = new Relation(); 
    11031104            tagEditorPanel.getModel().applyToPrimitive(newRelation); 
    11041105            memberTableModel.applyToRelation(newRelation); 
     
    11301131                    GenericRelationEditor.this 
    11311132            ); 
     1133            SwingUtilities.invokeLater(new Runnable() { 
     1134                @Override 
     1135                public void run() { 
     1136                        // Relation list gets update in EDT so selecting my be postponed to following EDT run 
     1137                    Main.map.relationListDialog.selectRelation(newRelation); 
     1138                } 
     1139            }); 
    11321140        } 
    11331141 
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r4218 r4221  
    785785            if (rows != -1) 
    786786            { 
    787                 double height = renderer.getListCellRendererComponent(list,  
    788                     new PresetListEntry("x"), 0, false, false).getPreferredSize().getHeight() * rows; 
     787                double height = renderer.getListCellRendererComponent(list, 
     788                        new PresetListEntry("x"), 0, false, false).getPreferredSize().getHeight() * rows; 
    789789                sp.setPreferredSize(new Dimension((int) sp.getPreferredSize().getWidth(), (int) height)); 
    790790            } 
     
    10981098        putValue("toolbar", "tagging_" + getRawName()); 
    10991099        putValue(OPTIONAL_TOOLTIP_TEXT, (group != null ? 
    1100             tr("Use preset ''{0}'' of group ''{1}''", getLocaleName(), group.getName()) : 
    1101             tr("Use preset ''{0}''", getLocaleName()))); 
    1102    } 
     1100                tr("Use preset ''{0}'' of group ''{1}''", getLocaleName(), group.getName()) : 
     1101                    tr("Use preset ''{0}''", getLocaleName()))); 
     1102    } 
    11031103 
    11041104    public String getLocaleName() { 
     
    13691369            } 
    13701370        } else if (answer == DIALOG_ANSWER_NEW_RELATION) { 
    1371             List<Command> cmds = new ArrayList<Command>(2); 
    13721371            final Relation r = new Relation(); 
    13731372            final Collection<RelationMember> members = new HashSet<RelationMember>(); 
     
    13751374                r.put(t.getKey(), t.getValue()); 
    13761375            } 
    1377             for(OsmPrimitive osm : sel) { 
     1376            for(OsmPrimitive osm : Main.main.getCurrentDataSet().getSelected()) { 
    13781377                RelationMember rm = new RelationMember("", osm); 
    13791378                r.addMember(rm); 
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetSearchDialog.java

    r3720 r4221  
    4040import org.openstreetmap.josm.data.osm.Relation; 
    4141import org.openstreetmap.josm.data.osm.Way; 
     42import org.openstreetmap.josm.data.preferences.BooleanProperty; 
    4243import org.openstreetmap.josm.gui.ExtendedDialog; 
    4344import org.openstreetmap.josm.gui.preferences.TaggingPresetPreference; 
     
    5657    private int CLASSIFICATION_GROUP_MATCH = 200; 
    5758    private int CLASSIFICATION_TAGS_MATCH = 100; 
     59 
     60    private final BooleanProperty SEARCH_IN_TAGS = new BooleanProperty("taggingpreset.dialog.search-in-tags", true); 
     61    private final BooleanProperty ONLY_APPLICABLE  = new BooleanProperty("taggingpreset.dialog.only-applicable-to-selection", true); 
    5862 
    5963    private static class ResultListCellRenderer extends DefaultListCellRenderer { 
     
    286290            ckOnlyApplicable.setEnabled(false); 
    287291        } else { 
    288             ckOnlyApplicable.setSelected(true); 
     292            ckOnlyApplicable.setSelected(ONLY_APPLICABLE.get()); 
    289293            ckOnlyApplicable.addItemListener(new ItemListener() { 
    290294                @Override 
     
    297301        ckSearchInTags = new JCheckBox(); 
    298302        ckSearchInTags.setText(tr("Search in tags")); 
    299         ckSearchInTags.setSelected(Main.pref.getBoolean("taggingpreset.dialog.search-in-tags", true)); 
     303        ckSearchInTags.setSelected(SEARCH_IN_TAGS.get()); 
    300304        ckSearchInTags.addItemListener(new ItemListener() { 
    301305            @Override 
     
    432436        } 
    433437 
    434         Main.pref.put("taggingpreset.dialog.search-in-tags", ckSearchInTags.isSelected()); 
     438        SEARCH_IN_TAGS.put(ckSearchInTags.isSelected()); 
     439        if (ckOnlyApplicable.isEnabled()) { 
     440            ONLY_APPLICABLE.put(ckOnlyApplicable.isSelected()); 
     441        } 
    435442    } 
    436443 
Note: See TracChangeset for help on using the changeset viewer.