Changeset 15649 in osm for applications/editors/josm
- Timestamp:
- 2009-06-05T16:17:33+02:00 (15 years ago)
- Location:
- applications/editors/josm
- Files:
-
- 9 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/CzechAddressPlugin.java
r15582 r15649 21 21 import org.openstreetmap.josm.gui.MainMenu; 22 22 import org.openstreetmap.josm.gui.MapFrame; 23 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 23 24 import org.openstreetmap.josm.plugins.Plugin; 24 25 import org.openstreetmap.josm.plugins.czechaddress.actions.ConflictResolveAction; … … 190 191 } 191 192 } 193 194 @Override 195 public PreferenceSetting getPreferenceSetting() { 196 return Preferences.getInstance(); 197 } 198 199 200 192 201 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/FactoryAction.java
r15582 r15649 9 9 import org.openstreetmap.josm.data.osm.Node; 10 10 import org.openstreetmap.josm.gui.MapFrame; 11 import org.openstreetmap.josm.plugins.czechaddress.Preferences; 11 12 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House; 12 13 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner; 14 import org.openstreetmap.josm.plugins.czechaddress.proposal.AddKeyValueProposal; 13 15 import org.openstreetmap.josm.plugins.czechaddress.proposal.ProposalContainer; 14 16 import org.openstreetmap.josm.tools.ImageProvider; … … 79 81 public void mouseClicked(MouseEvent e) { 80 82 super.mouseClicked(e); 83 Preferences p = Preferences.getInstance(); 81 84 82 85 // Get the currently selected House in the FactoryDialog. … … 90 93 ProposalContainer container = new ProposalContainer(newNode); 91 94 container.setProposals(house.getDiff(newNode)); 95 if (p.addNewTag) 96 container.addProposal(new AddKeyValueProposal(p.addNewTagKey, p.addNewTagValue)); 92 97 container.applyAll(); 93 98 -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java
r15585 r15649 64 64 65 65 /** 66 * Returns the number unique in a suburb (číslo popisné) 67 */ 68 public void setCP(String cp) { 69 this.cp = cp; 70 this.name = generateName(this.cp, this.co); 71 } 72 73 /** 74 * Returns the number unique in a street (číslo orientační) 75 */ 76 public void setCO(String co) { 77 this.co = co; 78 this.name = generateName(this.cp, this.co); 79 } 80 81 /** 66 82 * Generates a name from house numbers. 67 83 * -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java
r15585 r15649 293 293 if (obec.getSuburbs().size() > 0) { 294 294 Object[] suburbs = new Object[obec.getSuburbs().size() + 1]; 295 suburbs[0] = obec;296 295 for (int i=0; i<obec.getSuburbs().size(); i++) 297 suburbs[i+1] = obec.getSuburbs().get(i); 296 suburbs[i] = obec.getSuburbs().get(i); 297 suburbs[obec.getSuburbs().size()] = obec; 298 298 suburbComboBox.setModel(new DefaultComboBoxModel(suburbs)); 299 299 } else … … 361 361 if (value instanceof ViToCi) { 362 362 setFont(getFont().deriveFont(Font.BOLD)); 363 setText(((ViToCi) value).getName() + ", všechny části obce"); 363 // setText(((ViToCi) value).getName() + ", všechny části [experimentální]"); 364 setText("všechny části obce [experimentální]"); 364 365 } else 365 366 setFont(getFont().deriveFont(Font.PLAIN)); -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java
r15585 r15649 17 17 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Suburb; 18 18 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ViToCi; 19 import org.openstreetmap.josm.plugins.czechaddress.gui.databaseeditors. StreetEditor;19 import org.openstreetmap.josm.plugins.czechaddress.gui.databaseeditors.EditorFactory; 20 20 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalTreeRenderer; 21 21 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Capitalizator; 22 22 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner; 23 import org.openstreetmap.josm.tools.ImageProvider; 23 24 24 25 /** … … 40 41 dbTree.setModel(new DatabaseModel()); 41 42 dbTree.setCellRenderer(new UniversalTreeRenderer()); 43 44 dbEditButton.setIcon(ImageProvider.get("actions", "edit.png")); 42 45 43 46 Capitalizator cap = new Capitalizator( … … 325 328 private void dbTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_dbTreeValueChanged 326 329 dbTreeValue = (AddressElement) dbTree.getSelectionPath().getLastPathComponent(); 327 dbEditButton.setEnabled( dbTreeValue instanceof Street);330 dbEditButton.setEnabled( EditorFactory.isEditable(dbTreeValue) ); 328 331 }//GEN-LAST:event_dbTreeValueChanged 329 332 330 333 private void dbEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbEditButtonActionPerformed 331 if ( dbTreeValue instanceof Street)332 if ( StreetEditor.editStreet((Street) dbTreeValue))334 if (EditorFactory.isEditable(dbTreeValue)) { 335 if (EditorFactory.edit((AddressElement) dbTreeValue)) 333 336 dbTree.repaint(); 337 } else 338 dbEditButton.setEnabled(false); 334 339 }//GEN-LAST:event_dbEditButtonActionPerformed 335 340 -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java
r15585 r15649 15 15 import org.openstreetmap.josm.plugins.czechaddress.CzechAddressPlugin; 16 16 import org.openstreetmap.josm.plugins.czechaddress.NotNullList; 17 import org.openstreetmap.josm.plugins.czechaddress.Preferences; 17 18 import org.openstreetmap.josm.plugins.czechaddress.PrimUtils; 18 19 import org.openstreetmap.josm.plugins.czechaddress.StatusListener; … … 21 22 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalListRenderer; 22 23 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner; 24 import org.openstreetmap.josm.plugins.czechaddress.proposal.AddKeyValueProposal; 23 25 import org.openstreetmap.josm.plugins.czechaddress.proposal.Proposal; 24 26 import org.openstreetmap.josm.plugins.czechaddress.proposal.ProposalContainer; … … 302 304 303 305 if (matchesComboBox.getSelectedItem() == null) return; 304 AddressElement selectedElement 305 = (AddressElement) matchesComboBox.getSelectedItem(); 306 307 proposalContainer.setProposals(selectedElement.getDiff( 308 proposalContainer.getTarget())); 306 AddressElement selectedElement = (AddressElement) matchesComboBox.getSelectedItem(); 307 proposalContainer.setProposals(selectedElement.getDiff(proposalContainer.getTarget())); 308 309 Preferences p = Preferences.getInstance(); 310 if (p.addNewTag && proposalContainer.getTarget().keySet().size() == 0) 311 proposalContainer.addProposal(new AddKeyValueProposal( 312 p.addNewTagKey, p.addNewTagValue)); 313 309 314 }//GEN-LAST:event_matchChanged 310 315 -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/StreetEditor.form
r15585 r15649 15 15 <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> 16 16 <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> 17 <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-10 5,0,0,1,-112"/>17 <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-103,0,0,1,-112"/> 18 18 </AuxValues> 19 19 … … 36 36 <EmptySpace max="-2" attributes="0"/> 37 37 <Group type="103" groupAlignment="1" attributes="0"> 38 <Component id="jScrollPane1" pref="344" max="32767" attributes="0"/>39 38 <Component id="nameField" alignment="0" pref="344" max="32767" attributes="0"/> 40 <Component id="parentField" alignment="0" pref="344" max="32767" attributes="0"/> 39 <Group type="102" alignment="0" attributes="0"> 40 <Component id="parentField" pref="310" max="32767" attributes="0"/> 41 <EmptySpace max="-2" attributes="0"/> 42 <Component id="parentEditButton" min="-2" max="-2" attributes="0"/> 43 </Group> 44 <Group type="102" alignment="0" attributes="0"> 45 <Component id="jScrollPane1" min="-2" pref="308" max="-2" attributes="0"/> 46 <EmptySpace max="-2" attributes="0"/> 47 <Component id="houseEditButton" min="-2" max="-2" attributes="0"/> 48 <EmptySpace min="-2" pref="2" max="-2" attributes="0"/> 49 </Group> 41 50 </Group> 42 51 </Group> … … 49 58 <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> 50 59 <Component id="parentField" alignment="3" min="-2" max="-2" attributes="0"/> 60 <Component id="parentEditButton" alignment="3" min="-2" max="-2" attributes="0"/> 51 61 </Group> 52 62 <EmptySpace max="-2" attributes="0"/> … … 58 68 <Group type="103" groupAlignment="0" attributes="0"> 59 69 <Component id="jLabel3" min="-2" max="-2" attributes="0"/> 70 <Component id="houseEditButton" min="-2" max="-2" attributes="0"/> 60 71 <Component id="jScrollPane1" min="-2" pref="77" max="-2" attributes="0"/> 61 72 </Group> … … 79 90 <Properties> 80 91 <Property name="editable" type="boolean" value="false"/> 81 <Property name="text" type="java.lang.String" value="jTextField2"/>82 92 </Properties> 83 93 </Component> … … 88 98 </Component> 89 99 <Component class="javax.swing.JTextField" name="nameField"> 90 <Properties>91 <Property name="text" type="java.lang.String" value="jTextField3"/>92 </Properties>93 100 </Component> 94 101 <Component class="javax.swing.JLabel" name="jLabel3"> … … 107 114 <Properties> 108 115 <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> 109 <StringArray count="5"> 110 <StringItem index="0" value="Item 1"/> 111 <StringItem index="1" value="Item 2"/> 112 <StringItem index="2" value="Item 3"/> 113 <StringItem index="3" value="Item 4"/> 114 <StringItem index="4" value="Item 5"/> 115 </StringArray> 116 <StringArray count="0"/> 116 117 </Property> 117 118 </Properties> 119 <Events> 120 <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="houseListChanged"/> 121 </Events> 118 122 </Component> 119 123 </SubComponents> 120 124 </Container> 125 <Component class="javax.swing.JButton" name="parentEditButton"> 126 <Properties> 127 <Property name="text" type="java.lang.String" value=" "/> 128 </Properties> 129 <Events> 130 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="parentEditButtonActionPerformed"/> 131 </Events> 132 </Component> 133 <Component class="javax.swing.JButton" name="houseEditButton"> 134 <Properties> 135 <Property name="text" type="java.lang.String" value=" "/> 136 </Properties> 137 <Events> 138 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="houseEditButtonActionPerformed"/> 139 </Events> 140 </Component> 121 141 </SubComponents> 122 142 </Container> -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/StreetEditor.java
r15585 r15649 4 4 import org.openstreetmap.josm.Main; 5 5 import org.openstreetmap.josm.gui.ExtendedDialog; 6 import org.openstreetmap.josm.gui.preferences.PreferenceDialog; 7 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement; 8 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House; 6 9 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Street; 7 10 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalListRenderer; 8 import org.openstreetmap.josm. plugins.czechaddress.intelligence.Reasoner;11 import org.openstreetmap.josm.tools.ImageProvider; 9 12 10 13 /** … … 15 18 public class StreetEditor extends ExtendedDialog { 16 19 17 public static boolean editStreet(Street street) { 18 StreetEditor dialog = new StreetEditor(street); 19 dialog.setVisible(true); 20 if (dialog.getValue() == 1) { 21 street.setName(dialog.nameField.getText()); 22 Reasoner.getInstance().update(street); 23 return true; 24 } 25 return false; 26 } 20 Street street = null; 21 AddressElement parent = null; 27 22 28 /** Creates new form StreetEditor */ 29 private StreetEditor(Street street) { 23 public StreetEditor(Street street) { 30 24 super(Main.parent, "Upravit ulici", new String[] {"OK", "Zrušit"}, true); 31 25 initComponents(); 32 26 33 if (street.getParent() != null) 34 parentField.setText(street.getParent().getName()); 27 this.street = street; 28 this.parent = street.getParent(); 29 if (parent != null) 30 parentField.setText(parent.getName()); 31 else 32 parentField.setEnabled(false); 33 34 parentEditButton.setIcon(ImageProvider.get("actions", "edit.png")); 35 parentEditButton.setText(""); 36 parentEditButton.setEnabled(EditorFactory.isEditable(parent)); 35 37 36 38 nameField.setText(street.getName()); … … 38 40 houseList.setCellRenderer(new UniversalListRenderer()); 39 41 42 houseEditButton.setIcon(ImageProvider.get("actions", "edit.png")); 43 houseEditButton.setText(""); 44 houseListChanged(null); 45 40 46 // And finalize initializing the form. 41 47 setupDialog(mainPanel, new String[] {"ok.png", "cancel.png"}); 48 } 49 50 public String getStreetName() { 51 return nameField.getText(); 42 52 } 43 53 … … 60 70 jScrollPane1 = new javax.swing.JScrollPane(); 61 71 houseList = new javax.swing.JList(); 72 parentEditButton = new javax.swing.JButton(); 73 houseEditButton = new javax.swing.JButton(); 62 74 63 setLayout(new java.awt.GridLayout(1, 0));75 getContentPane().setLayout(new java.awt.GridLayout(1, 0)); 64 76 65 77 jLabel1.setText("Rodič:"); … … 68 80 69 81 parentField.setEditable(false); 70 parentField.setText("jTextField2");71 82 72 83 jLabel2.setText("Jméno:"); 73 84 74 nameField.setText("jTextField3");75 76 85 jLabel3.setText("Domy:"); 77 86 78 houseList. setModel(new javax.swing.AbstractListModel() {79 String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };80 public int getSize() { return strings.length; }81 public Object getElementAt(int i) { return strings[i];}87 houseList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { 88 public void valueChanged(javax.swing.event.ListSelectionEvent evt) { 89 houseListChanged(evt); 90 } 82 91 }); 83 92 jScrollPane1.setViewportView(houseList); 93 94 parentEditButton.setText(" "); 95 parentEditButton.addActionListener(new java.awt.event.ActionListener() { 96 public void actionPerformed(java.awt.event.ActionEvent evt) { 97 parentEditButtonActionPerformed(evt); 98 } 99 }); 100 101 houseEditButton.setText(" "); 102 houseEditButton.addActionListener(new java.awt.event.ActionListener() { 103 public void actionPerformed(java.awt.event.ActionEvent evt) { 104 houseEditButtonActionPerformed(evt); 105 } 106 }); 84 107 85 108 javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel); … … 94 117 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 95 118 .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 96 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)97 119 .addComponent(nameField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) 98 .addComponent(parentField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE))) 120 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup() 121 .addComponent(parentField, javax.swing.GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE) 122 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 123 .addComponent(parentEditButton)) 124 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup() 125 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 308, javax.swing.GroupLayout.PREFERRED_SIZE) 126 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 127 .addComponent(houseEditButton) 128 .addGap(2, 2, 2)))) 99 129 ); 100 130 mainPanelLayout.setVerticalGroup( … … 103 133 .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 104 134 .addComponent(jLabel1) 105 .addComponent(parentField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 135 .addComponent(parentField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 136 .addComponent(parentEditButton)) 106 137 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 107 138 .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) … … 111 142 .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 112 143 .addComponent(jLabel3) 144 .addComponent(houseEditButton) 113 145 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)) 114 146 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 115 147 ); 116 148 117 add(mainPanel);149 getContentPane().add(mainPanel); 118 150 }// </editor-fold>//GEN-END:initComponents 151 152 private House selectedHouse = null; 153 154 private void houseListChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_houseListChanged 155 selectedHouse = (House) houseList.getSelectedValue(); 156 houseEditButton.setEnabled(EditorFactory.isEditable(selectedHouse)); 157 }//GEN-LAST:event_houseListChanged 158 159 private void houseEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_houseEditButtonActionPerformed 160 assert selectedHouse != null; 161 if (EditorFactory.editHouse(selectedHouse)) 162 houseList.setModel(new DefaultComboBoxModel(street.getHouses().toArray())); 163 }//GEN-LAST:event_houseEditButtonActionPerformed 164 165 private void parentEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_parentEditButtonActionPerformed 166 assert parent != null; 167 if (EditorFactory.edit(parent)) 168 parentField.setText(parent.getName()); 169 }//GEN-LAST:event_parentEditButtonActionPerformed 119 170 120 171 121 172 // Variables declaration - do not modify//GEN-BEGIN:variables 173 private javax.swing.JButton houseEditButton; 122 174 private javax.swing.JList houseList; 123 175 private javax.swing.JLabel jLabel1; … … 128 180 private javax.swing.JPanel mainPanel; 129 181 private javax.swing.JTextField nameField; 182 private javax.swing.JButton parentEditButton; 130 183 private javax.swing.JTextField parentField; 131 184 // End of variables declaration//GEN-END:variables -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java
r15091 r15649 1 1 package wmsplugin; 2 2 3 import java.awt.BorderLayout;4 3 import java.awt.FlowLayout; 5 4 import javax.swing.JCheckBox;
Note:
See TracChangeset
for help on using the changeset viewer.