Ignore:
Timestamp:
08/23/12 14:07:41 (12 years ago)
Author:
pharms
Message:
  • added reference to parent nodes to GUI elements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/quest-core-events/src/main/java/de/ugoe/cs/quest/eventcore/guimodel/AbstractDefaultGUIElement.java

    r576 r603  
    2121    private IGUIElementSpec specification; 
    2222 
     23    /** the reference to the parent element */ 
     24    private IGUIElement parent; 
     25 
    2326    /** 
    2427     * <p> 
     
    2831     * @param specification 
    2932     */ 
    30     public AbstractDefaultGUIElement(IGUIElementSpec specification) { 
     33    public AbstractDefaultGUIElement(IGUIElementSpec specification, IGUIElement parent) { 
    3134        this.specification = specification; 
     35        this.parent = parent; 
    3236    } 
    3337 
     
    4246    } 
    4347 
     48    /* (non-Javadoc) 
     49     * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#getParent() 
     50     */ 
     51    @Override 
     52    public IGUIElement getParent() { 
     53        return parent; 
     54    } 
     55 
    4456    /* 
    4557     * (non-Javadoc) 
     
    4759     * @see GUIElement#equals(GUIElement) 
    4860     */ 
    49     public boolean equals(IGUIElement other) { 
    50         if (this == other) 
    51         { 
    52             return true; 
    53         } 
    54          
    55         if (!this.getClass().isInstance(other)) { 
    56             return false; 
    57         } 
    58          
    59         AbstractDefaultGUIElement otherElem = (AbstractDefaultGUIElement) other; 
    60          
    61         return 
    62             ((otherElem.specification == specification) || 
    63              ((specification != null) && specification.equals(otherElem.specification))); 
     61    public final boolean equals(Object other) { 
     62        // implement final, as GUI elments are all singletons and the equal only if they are the 
     63        // same object 
     64        return super.equals(other); 
     65    } 
     66 
     67    /* (non-Javadoc) 
     68     * @see java.lang.Object#hashCode() 
     69     */ 
     70    @Override 
     71    public final int hashCode() { 
     72        // implement final, as GUI elments are all singletons and the equal only if they are the 
     73        // same object 
     74        return super.hashCode(); 
    6475    } 
    6576 
Note: See TracChangeset for help on using the changeset viewer.