Ignore:
Timestamp:
2009-05-25T02:34:09+02:00 (15 years ago)
Author:
rcernoch
Message:

CzechAddress: 0.1.1

Location:
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/CzechAddressPlugin.java

    r15201 r15203  
    2727import org.openstreetmap.josm.plugins.czechaddress.actions.ModifierAction;
    2828import org.openstreetmap.josm.plugins.czechaddress.actions.SplitAreaByEmptyWayAction;
     29import org.openstreetmap.josm.plugins.czechaddress.gui.DatabaseModifier;
    2930import org.openstreetmap.josm.plugins.czechaddress.gui.FactoryDialog;
    3031import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner;
     
    7071        final MvcrParser parser = new MvcrParser();
    7172        //parser.setFilter(null, null, null, "");
    72         parser.setFilter("HUSTOPEČE", "HUSTOPEČE", null, null);
     73        //parser.setFilter("HUSTOPEČE", "HUSTOPEČE", null, null);
    7374        parser.setTargetDatabase(mainDatabase);
    7475        parser.setStorageDir(pluginDir);
     
    119120        for (House house : houses) pool.add(house);
    120121
    121 
    122         /*Capitalizator cap = new Capitalizator(Main.ds.allPrimitives(),
    123                                               location.getStreets());
    124         for (Street s : cap.getClassifiedItems())
    125             System.out.println(s.toString() + " --> " + cap.translate(s).getName());*/
     122        // Update database according to the map
     123        (new DatabaseModifier()).setVisible(true);
    126124
    127125        // And add them to the reasoner.
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java

    r15201 r15203  
    4040            throw new NullPointerException("You must specify the name of this AddressElement");
    4141        this.name = capitalize(name);
     42    }
     43
     44    /**
     45     * Sets the new name of this element.
     46     *
     47     * <p><b>NOTE:</b> Unlike in the default constructor, the name is <b>not</b>
     48     * capitalized.</p>
     49     */
     50    public void setName(String newName) {
     51        name = newName;
    4252    }
    4353
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/House.java

    r15201 r15203  
    199199        // If we have added any proposal so far, add the source info as well.
    200200        if (props.size() > 0)
    201             props.add(getListFieldDiff("source", prim.get("source:addr"), "mvcr:adresa"));
     201            props.add(getListFieldDiff("source:addr", prim.get("source:addr"), "mvcr:adresa"));
    202202
    203203        return props;
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/DatabaseModifier.java

    r15201 r15203  
    5959
    6060        streetTable.setModel(streetModel);
    61         streetTable.setDefaultRenderer( Street.class,
    62                                         new StreetRenderer());
     61        streetTable.setDefaultRenderer( AddressElement.class,
     62                                        new AddressElementRenderer());
    6363
    6464        // And finalize initializing the form.
    6565        setupDialog(mainPanel, new String[] { "ok.png", "cancel.png" });
    66         setAlwaysOnTop(false);
    67 
    68         // TODO: Why does it always crash if the modality is set in constructor?
    69         setModal(false);
    7066    }
    7167
     
    7369    protected void buttonAction(ActionEvent evt) {
    7470        super.buttonAction(evt);
     71
     72        if (getValue() == 1) {
     73            assert streetModel.elems.size() == streetModel.names.size();
     74           
     75            for(int i=0; i<streetModel.elems.size(); i++)
     76                streetModel.elems.get(i).setName(streetModel.names.get(i));
     77        }
     78
    7579        setVisible(false);
    7680    }
     
    151155    // End of variables declaration//GEN-END:variables
    152156
    153     private class StreetRenderer extends DefaultTableCellRenderer {
     157    private class AddressElementRenderer extends DefaultTableCellRenderer {
     158
     159        public AddressElementRenderer() {}
    154160
    155161        @Override
    156         public Component getTableCellRendererComponent(JTable table,
    157                 Object value, boolean isSelected, boolean hasFocus,
    158                 int row, int column) {
    159             Component c =  super.getTableCellRendererComponent(table, value,
    160                     isSelected, hasFocus, row, column);
    161 
    162             System.out.println("Tady som! " + value);
     162        protected void setValue(Object value) {
     163            super.setValue(value);
    163164
    164165            if (value instanceof AddressElement)
    165166                setText(((AddressElement) value).getName() );
    166 
    167             return c;
    168167        }
    169168    }
  • applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java

    r15166 r15203  
    3131 * Dialog for adding/editing an address of a single primitive.
    3232 *
     33 * <p><b>TODO:</b> This dialog does not dispose and disconnect from
     34 * message handling system after being closed. Reproduce: Create a node
     35 * using this dialog, delete it and update reasoner.</p>
     36 *
    3337 * @author radomir.cernoch@gmail.com
    3438 */
    3539public class PointManipulatorDialog extends ExtendedDialog implements StatusListener {
    3640
    37     private Timer  updateMatchesTimes = null;
     41    private Timer  updateMatchesTimer = null;
    3842    private Action updateMatchesAction;
    3943    private ProposalContainer proposalContainer;
     
    8892        super.buttonAction(evt);
    8993        if (getValue() == 1) {
     94           
     95            if (updateMatchesTimer.isRunning()) {
     96                updateMatchesTimer.stop();
     97                updateMatches();
     98            }
     99
    90100            proposalContainer.applyAll();
    91101
     
    291301
    292302    private void keyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_keyReleased
    293         if (updateMatchesTimes != null)
    294             updateMatchesTimes.stop();
    295        
    296         updateMatchesTimes = new Timer(300, updateMatchesAction);
    297         updateMatchesTimes.setRepeats(false);
    298         updateMatchesTimes.start();
     303        if (updateMatchesTimer != null)
     304            updateMatchesTimer.stop();
     305       
     306        updateMatchesTimer = new Timer(300, updateMatchesAction);
     307        updateMatchesTimer.setRepeats(false);
     308        updateMatchesTimer.start();
    299309    }//GEN-LAST:event_keyReleased
    300310
Note: See TracChangeset for help on using the changeset viewer.