Changeset 1433


Ignore:
Timestamp:
03/04/14 12:19:00 (10 years ago)
Author:
pharms
Message:
  • added support to retrieve the GUI model to which a GUI element belongs from the GUI element itself
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/guimodel/MockGUIElement.java

    r1396 r1433  
    5050 
    5151    @Override 
     52    public GUIModel getGUIModel() { 
     53        return null; 
     54    } 
     55 
     56    @Override 
    5257    public void updateSpecification(IGUIElementSpec furtherSpec) { } 
    5358 
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElement.java

    r1385 r1433  
    6565    /** 
    6666     * <p> 
     67     * the reference to the GUI model to which this GUI element belongs. 
     68     * </p> 
     69     */ 
     70    private GUIModel guiModel; 
     71 
     72    /** 
     73     * <p> 
    6774     * Constructor. Creates a new AbstractDefaultGUIElement. 
    6875     * </p> 
     
    97104    public IGUIElement getParent() { 
    98105        return parent; 
     106    } 
     107 
     108    /* (non-Javadoc) 
     109     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#getGUIModel() 
     110     */ 
     111    @Override 
     112    public GUIModel getGUIModel() { 
     113       return guiModel; 
    99114    } 
    100115 
     
    233248            } 
    234249        } 
    235  
     250    } 
     251 
     252    /** 
     253     * <p> 
     254     * used to set the GUI model to which this GUI element belongs. Will be set automatically, if 
     255     * used in combination with {@link GUIModel}; 
     256     * </p> 
     257     * 
     258     * @param guiModel 
     259     */ 
     260    void setGUIModel(GUIModel guiModel) { 
     261        this.guiModel = guiModel; 
    236262    } 
    237263 
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIElementGroup.java

    r1274 r1433  
    5050     * @param groupName the name of the GUI element group 
    5151     * @param parent    the optional parent GUI element of the group 
     52     * @param guiModel  the GUI model to which the group will belong 
    5253     */ 
    53     public GUIElementGroup(String groupName, IGUIElement parent) { 
     54    public GUIElementGroup(String groupName, IGUIElement parent, GUIModel guiModel) { 
    5455        super(new GroupSpecification(groupName), parent); 
     56        super.setGUIModel(guiModel); 
    5557    } 
    5658 
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIModel.java

    r1360 r1433  
    352352         
    353353        TreeNode replacement = new TreeNode(); 
    354         replacement.guiElement = new GUIElementGroup(groupName, parent.guiElement); 
     354        replacement.guiElement = new GUIElementGroup(groupName, parent.guiElement, this); 
    355355         
    356356        for (TreeNode child : nodesToGroup) { 
     
    487487     *             thrown in cases such as the GUI element object could not be instantiated 
    488488     */ 
    489     private IGUIElement integratePath(TreeNode parentNode, 
     489    private IGUIElement integratePath(TreeNode                        parentNode, 
    490490                                      List<? extends IGUIElementSpec> remainingPath, 
    491                                       IGUIElementFactory guiElementFactory) 
     491                                      IGUIElementFactory              guiElementFactory) 
    492492        throws GUIModelException 
    493493    { 
     
    500500                                                        parentNode.guiElement); 
    501501 
     502            if (newElement instanceof AbstractDefaultGUIElement) { 
     503                ((AbstractDefaultGUIElement) newElement).setGUIModel(this); 
     504            } 
     505             
    502506            child = parentNode.addChild(newElement); 
    503507            allNodes.put(child.guiElement, child); 
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/IGUIElement.java

    r1051 r1433  
    4545    public IGUIElement getParent(); 
    4646 
     47    /** 
     48     * <p> 
     49     * returns the GUI model to which this GUI element belongs 
     50     * </p> 
     51     */ 
     52    public GUIModel getGUIModel(); 
     53     
    4754    /** 
    4855     * <p> 
Note: See TracChangeset for help on using the changeset viewer.