Changeset 2083 in josm for trunk


Ignore:
Timestamp:
2009-09-09T00:46:01+02:00 (15 years ago)
Author:
Gubaer
Message:

Removed deprecated constructors in ExtendedDialog
Turned most of the fields in the OSM data classes into private fields

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

Legend:

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

    r2082 r2083  
    7575
    7676    /**
    77      * Registers an upload hook. Adds the hook to the end of the list of upload hooks.
     77     * Registers an upload hook. Adds the hook at the first position of the upload hooks.
    7878     *
    7979     * @param hook the upload hook. Ignored if null.
     
    8282        if(hook == null) return;
    8383        if (!uploadHooks.contains(hook)) {
    84             uploadHooks.add(hook);
     84            uploadHooks.add(0,hook);
    8585        }
    8686    }
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r2070 r2083  
    9797     * the respective class.
    9898     *
    99      * @deprecated use {@see #getId()} and {@see #setId()}. Don't assign an id, create a primitive with
    100      * the respective constructors.
    101      */
    102     @Deprecated
    103     public long id = 0;
     99     */
     100    private long id = 0;
    104101
    105102    /**
     
    109106     * the modified is ignored and the object is added to the server.
    110107     *
    111      * @deprecated Please use {@see #setModified()} and {@see #getModified()}
    112      */
    113     @Deprecated
    114     public boolean modified = false;
     108     */
     109    private boolean modified = false;
    115110
    116111    /**
    117112     * <code>true</code>, if the object has been deleted.
    118113     *
    119      * @deprecated use {@see #delete()} and {@see #isDeleted()}
    120      */
    121     @Deprecated
    122     public boolean deleted = false;
     114     */
     115    private boolean deleted = false;
    123116
    124117    /**
     
    127120     * (they will have visible=false).
    128121     *
    129      * @deprecated use {@see #isVisible()} and {@see #setVisible(boolean)}
    130      */
    131     @Deprecated
    132     public boolean visible = true;
     122     */
     123    private boolean visible = true;
    133124
    134125    /**
     
    141132     * If set to true, this object is currently selected.
    142133     *
    143      * @deprecated use {@see #isSelected()} and {@see #setSelected(boolean)}
    144      */
    145     @Deprecated
    146     public volatile boolean selected = false;
     134     */
     135    private volatile boolean selected = false;
    147136
    148137    /**
     
    155144     * Contains the version number as returned by the API. Needed to
    156145     * ensure update consistency
    157      * @deprecated use {@see #getVersion()} and {@see #setVersion(long)}
    158      */
    159     @Deprecated
    160     public int version = 0;
    161 
     146     */
     147    private int version = 0;
    162148
    163149    /**
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r2077 r2083  
    2020     * makeBackReferences and/or removeBackReferences should be called.
    2121     *
    22      * @deprecated use the improved API instead of accessing this list directly
    23      */
    24     @Deprecated
    25     public final List<RelationMember> members = new ArrayList<RelationMember>();
     22     */
     23    private final List<RelationMember> members = new ArrayList<RelationMember>();
    2624
    2725    /**
  • trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java

    r2070 r2083  
    1111    /**
    1212     *
    13      * @deprecated use {@see #getRole()} or create a clone in order to assign a new role
    1413     */
    15     @Deprecated
    16     public String role;
     14    private String role;
    1715
    1816    /**
    1917     *
    20      * @deprecated use {@see #getMember()} or create a clone in order to assign a new member
    2118     */
    22     @Deprecated
    23     public OsmPrimitive member;
     19    private OsmPrimitive member;
    2420
    2521    /**
     
    106102    }
    107103
    108 
    109     /**
    110      * Default constructor. Does nothing.
    111      * @deprecated Use other constructors because RelationMember class will become immutable
    112      * in the future
    113      */
    114     @Deprecated
    115     public RelationMember() { }
    116 
    117104    public RelationMember(String role, OsmPrimitive member) {
    118105        this.role = role;
  • trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java

    r2037 r2083  
    8888
    8989    /**
    90      * Sets up the dialog. The first button is always the default.
    91      * @param parent The parent element that will be used for position and maximum size
    92      * @param title The text that will be shown in the window titlebar
    93      * @param content Any component that should be show above the buttons (e.g. JLabel)
    94      * @param buttonTexts The labels that will be displayed on the buttons
    95      * @param buttonIcons The path to the icons that will be displayed on the buttons. Path is relative to JOSM's image directory. File extensions need to be included. If a button should not have an icon pass null.
    96      */
    97     @Deprecated public ExtendedDialog(Component parent, String title, Component content,
    98             String[] buttonTexts, String[] buttonIcons) {
    99         super(JOptionPane.getFrameForComponent(parent), title, true /* modal */);
    100         this.parent = parent;
    101         bTexts = buttonTexts;
    102         this.content = content;
    103         this.bIcons = buttonIcons;
    104         setupDialog();
    105         setVisible(true);
    106     }
    107 
    108     @Deprecated public ExtendedDialog(Component parent, String title, Component content,
    109             String[] buttonTexts) {
    110         this(parent, title, content, buttonTexts, null);
    111     }
    112 
    113     /**
    114      * Sets up the dialog and displays the given message in a breakable label
    115      */
    116     @Deprecated public ExtendedDialog(Component parent, String title, String message,
    117             String[] buttonTexts, String[] buttonIcons) {
    118         this(parent, title, string2label(message), buttonTexts, buttonIcons);
    119     }
    120 
    121     @Deprecated public ExtendedDialog(Component parent, String title, String message,
    122             String[] buttonTexts) {
    123         this(parent, title, message, buttonTexts, null);
    124     }
    125 
    126     /**
    12790     * Allows decorating the buttons with icons. Expects an String[] with paths
    12891     * to images relative to JOSM/images.
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java

    r2070 r2083  
    4242            public boolean isCellEditable(int row, int column) {
    4343                switch(column) {
    44                     case 1: return true;
    45                     default: return false;
     44                case 1: return true;
     45                default: return false;
    4646                }
    4747            }
     
    5252    protected void setValueAt(DefaultTableModel model, Object value, int row, int col) {
    5353        if (model == getMergedTableModel() && col == 1) {
    54             RelationMember member = getMergedEntries().get(row);
    55             member.role = (String)value;
     54            RelationMember memberOld = getMergedEntries().get(row);
     55            RelationMember memberNew = new RelationMember((String)value,memberOld.getMember());
     56            getMergedEntries().remove(row);
     57            getMergedEntries().add(row,memberNew);
    5658            fireModelDataChanged();
    5759        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r2077 r2083  
    106106    public void setValueAt(Object value, int rowIndex, int columnIndex) {
    107107        RelationMember member = members.get(rowIndex);
    108         member.role = value.toString();
     108        RelationMember newMember = new RelationMember(value.toString(), member.getMember());
     109        members.remove(rowIndex);
     110        members.add(rowIndex, newMember);
    109111    }
    110112
     
    198200
    199201    public void updateMemberReferences(DataSet ds) {
    200         for (RelationMember member : members) {
     202        for (int i=0; i< members.size();i++) {
     203            RelationMember member = members.get(i);
    201204            if (member.getMember().getId() == 0) {
    202205                continue;
     
    204207            OsmPrimitive primitive = ds.getPrimitiveById(member.getMember().getId(), OsmPrimitiveType.from(member.getMember()));
    205208            if (primitive != null) {
    206                 member.member = primitive;
     209                RelationMember newMember = new RelationMember(member.getRole(), primitive);
     210                members.remove(i);
     211                members.add(i, newMember);
    207212            }
    208213        }
     
    351356            return;
    352357        for (int row : idx) {
    353             members.get(row).role = role;
     358            RelationMember oldMember = members.get(row);
     359            RelationMember newMember = new RelationMember(role, oldMember.getMember());
     360            members.remove(row);
     361            members.add(row, newMember);
    354362        }
    355363        fireTableDataChanged();
Note: See TracChangeset for help on using the changeset viewer.