Changeset 15649 in osm for applications/editors/josm


Ignore:
Timestamp:
2009-06-05T16:17:33+02:00 (15 years ago)
Author:
rcernoch
Message:

CzechAddress: Version 0.2.0 release

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  
    2121import org.openstreetmap.josm.gui.MainMenu;
    2222import org.openstreetmap.josm.gui.MapFrame;
     23import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    2324import org.openstreetmap.josm.plugins.Plugin;
    2425import org.openstreetmap.josm.plugins.czechaddress.actions.ConflictResolveAction;
     
    190191        }
    191192    }
     193
     194    @Override
     195    public PreferenceSetting getPreferenceSetting() {
     196        return Preferences.getInstance();
     197    }
     198
     199
     200
    192201}
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/FactoryAction.java

    r15582 r15649  
    99import org.openstreetmap.josm.data.osm.Node;
    1010import org.openstreetmap.josm.gui.MapFrame;
     11import org.openstreetmap.josm.plugins.czechaddress.Preferences;
    1112import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House;
    1213import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
     14import org.openstreetmap.josm.plugins.czechaddress.proposal.AddKeyValueProposal;
    1315import org.openstreetmap.josm.plugins.czechaddress.proposal.ProposalContainer;
    1416import org.openstreetmap.josm.tools.ImageProvider;
     
    7981    public void mouseClicked(MouseEvent e) {
    8082        super.mouseClicked(e);
     83        Preferences p = Preferences.getInstance();
    8184
    8285        // Get the currently selected House in the FactoryDialog.
     
    9093        ProposalContainer container = new ProposalContainer(newNode);
    9194        container.setProposals(house.getDiff(newNode));
     95        if (p.addNewTag)
     96            container.addProposal(new AddKeyValueProposal(p.addNewTagKey, p.addNewTagValue));
    9297        container.applyAll();
    9398
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java

    r15585 r15649  
    6464
    6565    /**
     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    /**
    6682     * Generates a name from house numbers.
    6783     *
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java

    r15585 r15649  
    293293        if (obec.getSuburbs().size() > 0) {
    294294            Object[] suburbs = new Object[obec.getSuburbs().size() + 1];
    295             suburbs[0] = obec;
    296295            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;
    298298            suburbComboBox.setModel(new DefaultComboBoxModel(suburbs));
    299299        } else
     
    361361            if (value instanceof ViToCi) {
    362362                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í]");
    364365            } else
    365366                setFont(getFont().deriveFont(Font.PLAIN));
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java

    r15585 r15649  
    1717import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Suburb;
    1818import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ViToCi;
    19 import org.openstreetmap.josm.plugins.czechaddress.gui.databaseeditors.StreetEditor;
     19import org.openstreetmap.josm.plugins.czechaddress.gui.databaseeditors.EditorFactory;
    2020import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalTreeRenderer;
    2121import org.openstreetmap.josm.plugins.czechaddress.intelligence.Capitalizator;
    2222import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
     23import org.openstreetmap.josm.tools.ImageProvider;
    2324
    2425/**
     
    4041        dbTree.setModel(new DatabaseModel());
    4142        dbTree.setCellRenderer(new UniversalTreeRenderer());
     43
     44        dbEditButton.setIcon(ImageProvider.get("actions", "edit.png"));
    4245
    4346        Capitalizator cap = new Capitalizator(
     
    325328    private void dbTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_dbTreeValueChanged
    326329        dbTreeValue = (AddressElement) dbTree.getSelectionPath().getLastPathComponent();
    327         dbEditButton.setEnabled(dbTreeValue instanceof Street);
     330        dbEditButton.setEnabled( EditorFactory.isEditable(dbTreeValue) );
    328331    }//GEN-LAST:event_dbTreeValueChanged
    329332
    330333    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))
    333336                dbTree.repaint();
     337        } else
     338            dbEditButton.setEnabled(false);
    334339    }//GEN-LAST:event_dbEditButtonActionPerformed
    335340
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java

    r15585 r15649  
    1515import org.openstreetmap.josm.plugins.czechaddress.CzechAddressPlugin;
    1616import org.openstreetmap.josm.plugins.czechaddress.NotNullList;
     17import org.openstreetmap.josm.plugins.czechaddress.Preferences;
    1718import org.openstreetmap.josm.plugins.czechaddress.PrimUtils;
    1819import org.openstreetmap.josm.plugins.czechaddress.StatusListener;
     
    2122import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalListRenderer;
    2223import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
     24import org.openstreetmap.josm.plugins.czechaddress.proposal.AddKeyValueProposal;
    2325import org.openstreetmap.josm.plugins.czechaddress.proposal.Proposal;
    2426import org.openstreetmap.josm.plugins.czechaddress.proposal.ProposalContainer;
     
    302304
    303305        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
    309314    }//GEN-LAST:event_matchChanged
    310315
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/StreetEditor.form

    r15585 r15649  
    1515    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
    1616    <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,-105,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"/>
    1818  </AuxValues>
    1919
     
    3636                  <EmptySpace max="-2" attributes="0"/>
    3737                  <Group type="103" groupAlignment="1" attributes="0">
    38                       <Component id="jScrollPane1" pref="344" max="32767" attributes="0"/>
    3938                      <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>
    4150                  </Group>
    4251              </Group>
     
    4958                      <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
    5059                      <Component id="parentField" alignment="3" min="-2" max="-2" attributes="0"/>
     60                      <Component id="parentEditButton" alignment="3" min="-2" max="-2" attributes="0"/>
    5161                  </Group>
    5262                  <EmptySpace max="-2" attributes="0"/>
     
    5868                  <Group type="103" groupAlignment="0" attributes="0">
    5969                      <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
     70                      <Component id="houseEditButton" min="-2" max="-2" attributes="0"/>
    6071                      <Component id="jScrollPane1" min="-2" pref="77" max="-2" attributes="0"/>
    6172                  </Group>
     
    7990          <Properties>
    8091            <Property name="editable" type="boolean" value="false"/>
    81             <Property name="text" type="java.lang.String" value="jTextField2"/>
    8292          </Properties>
    8393        </Component>
     
    8898        </Component>
    8999        <Component class="javax.swing.JTextField" name="nameField">
    90           <Properties>
    91             <Property name="text" type="java.lang.String" value="jTextField3"/>
    92           </Properties>
    93100        </Component>
    94101        <Component class="javax.swing.JLabel" name="jLabel3">
     
    107114              <Properties>
    108115                <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"/>
    116117                </Property>
    117118              </Properties>
     119              <Events>
     120                <EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="houseListChanged"/>
     121              </Events>
    118122            </Component>
    119123          </SubComponents>
    120124        </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>
    121141      </SubComponents>
    122142    </Container>
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/databaseeditors/StreetEditor.java

    r15585 r15649  
    44import org.openstreetmap.josm.Main;
    55import org.openstreetmap.josm.gui.ExtendedDialog;
     6import org.openstreetmap.josm.gui.preferences.PreferenceDialog;
     7import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement;
     8import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House;
    69import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Street;
    710import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalListRenderer;
    8 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
     11import org.openstreetmap.josm.tools.ImageProvider;
    912
    1013/**
     
    1518public class StreetEditor extends ExtendedDialog {
    1619
    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;
    2722
    28     /** Creates new form StreetEditor */
    29     private StreetEditor(Street street) {
     23    public StreetEditor(Street street) {
    3024        super(Main.parent, "Upravit ulici", new String[] {"OK", "Zrušit"}, true);
    3125        initComponents();
    3226
    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));
    3537
    3638        nameField.setText(street.getName());
     
    3840        houseList.setCellRenderer(new UniversalListRenderer());
    3941
     42        houseEditButton.setIcon(ImageProvider.get("actions", "edit.png"));
     43        houseEditButton.setText("");
     44        houseListChanged(null);
     45
    4046        // And finalize initializing the form.
    4147        setupDialog(mainPanel, new String[] {"ok.png", "cancel.png"});
     48    }
     49
     50    public String getStreetName() {
     51        return nameField.getText();
    4252    }
    4353
     
    6070        jScrollPane1 = new javax.swing.JScrollPane();
    6171        houseList = new javax.swing.JList();
     72        parentEditButton = new javax.swing.JButton();
     73        houseEditButton = new javax.swing.JButton();
    6274
    63         setLayout(new java.awt.GridLayout(1, 0));
     75        getContentPane().setLayout(new java.awt.GridLayout(1, 0));
    6476
    6577        jLabel1.setText("Rodič:");
     
    6880
    6981        parentField.setEditable(false);
    70         parentField.setText("jTextField2");
    7182
    7283        jLabel2.setText("Jméno:");
    7384
    74         nameField.setText("jTextField3");
    75 
    7685        jLabel3.setText("Domy:");
    7786
    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            }
    8291        });
    8392        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        });
    84107
    85108        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
     
    94117                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    95118                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    96                     .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
    97119                    .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))))
    99129        );
    100130        mainPanelLayout.setVerticalGroup(
     
    103133                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    104134                    .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))
    106137                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    107138                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
     
    111142                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    112143                    .addComponent(jLabel3)
     144                    .addComponent(houseEditButton)
    113145                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
    114146                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    115147        );
    116148
    117         add(mainPanel);
     149        getContentPane().add(mainPanel);
    118150    }// </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
    119170
    120171
    121172    // Variables declaration - do not modify//GEN-BEGIN:variables
     173    private javax.swing.JButton houseEditButton;
    122174    private javax.swing.JList houseList;
    123175    private javax.swing.JLabel jLabel1;
     
    128180    private javax.swing.JPanel mainPanel;
    129181    private javax.swing.JTextField nameField;
     182    private javax.swing.JButton parentEditButton;
    130183    private javax.swing.JTextField parentField;
    131184    // End of variables declaration//GEN-END:variables
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPreferenceEditor.java

    r15091 r15649  
    11package wmsplugin;
    22
    3 import java.awt.BorderLayout;
    43import java.awt.FlowLayout;
    54import javax.swing.JCheckBox;
Note: See TracChangeset for help on using the changeset viewer.