Changeset 741


Ignore:
Timestamp:
01/23/14 09:38:55 (10 years ago)
Author:
jts21
Message:

Items now keep their old ID when being anchored on the same frame as they were picked up from, unless the frame already has an item with that ID

Location:
trunk/src/org/expeditee
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/agents/HFormat.java

    r427 r741  
    11package org.expeditee.agents;
    22
     3import java.util.ArrayList;
    34import java.util.Collection;
     5import java.util.List;
    46
    57import org.expeditee.gui.Frame;
     8import org.expeditee.items.Item;
    69import org.expeditee.items.Text;
    710
     
    2528                        return null;
    2629               
     30                List<Item> changedItems = new ArrayList<Item>();
     31               
    2732                float anchorY = 0F;
    2833                float yThreshold = 0F;
  • trunk/src/org/expeditee/items/Item.java

    r737 r741  
    366366
    367367        private Frame _parent = null;
     368        private Frame _oldParent = null;
    368369
    369370        protected int _highlightThickness = 2;
     
    17841785
    17851786        public void setParent(Frame frame) {
     1787                _oldParent = _parent;
    17861788                _parent = frame;
    17871789
     
    21642166        public void anchor() {
    21652167                Frame current = getParentOrCurrentFrame();
    2166                 setID(current.getNextItemID());
     2168                // only set the id if we've moved to a different frame, or if the frame already has an item with that id
     2169                if(!current.equals(_oldParent) || current.getItemWithID(getID()) != null) {
     2170                        int id = _id;
     2171                        setID(current.getNextItemID());
     2172                        // System.out.println(this + " - Set ID to " + _id + " (was " + id + ")");
     2173                } else {
     2174                        // System.out.println(this + " - Kept old ID of " + _id);
     2175                }
    21672176                setOffset(0, 0);
    21682177                setParent(current);
Note: See TracChangeset for help on using the changeset viewer.