source: trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCView.java @ 2044

Last change on this file since 2044 was 2044, checked in by pharms, 9 years ago
  • added correct handling of views and GUI element distance calculation
File size: 3.1 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.plugin.jfc.guimodel;
16
17import de.ugoe.cs.autoquest.eventcore.guimodel.GUIModel;
18import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
19import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIView;
20
21/**
22 * <p>
23 * A wrapper for JFC GUI elements which need to be considered a view. Usually, these are frames,
24 * dialogs, and child panels of tabbed panes. The class delegates calls to the wrapped GUI element.
25 * </p>
26 *
27 * @author Patrick Harms
28 */
29public class JFCView implements IGUIView {
30
31    /**  */
32    private static final long serialVersionUID = 1L;
33   
34    /** */
35    private JFCGUIElement delegate;
36   
37    /**
38     * The default constructor taking the GUI element being the view as parameter
39     */
40    JFCView(JFCGUIElement delegate) {
41        this.delegate = delegate;
42    }
43
44    /* (non-Javadoc)
45     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIView#isModal()
46     */
47    @Override
48    public boolean isModal() {
49        return delegate instanceof JFCDialog;
50    }
51
52    /**
53     * @return
54     * @see de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement#getPlatform()
55     */
56    public String getPlatform() {
57        return delegate.getPlatform();
58    }
59
60    /**
61     * @return
62     * @see de.ugoe.cs.autoquest.eventcore.guimodel.AbstractDefaultGUIElement#getParent()
63     */
64    public IGUIElement getParent() {
65        return delegate.getParent();
66    }
67
68    /**
69     * @return
70     * @see de.ugoe.cs.autoquest.eventcore.guimodel.AbstractDefaultGUIElement#getGUIModel()
71     */
72    public GUIModel getGUIModel() {
73        return delegate.getGUIModel();
74    }
75
76    /**
77     * @return
78     * @see de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement#getName()
79     */
80    public String getName() {
81        return delegate.getName();
82    }
83
84    /**
85     * @param other
86     * @return
87     * @see de.ugoe.cs.autoquest.eventcore.guimodel.AbstractDefaultGUIElement#equals(java.lang.Object)
88     */
89    public final boolean equals(Object other) {
90        if (other instanceof JFCView) {
91            return delegate.equals(((JFCView) other).delegate);
92        }
93        else {
94            return false;
95        }
96    }
97
98    /**
99     * @return
100     * @see de.ugoe.cs.autoquest.eventcore.guimodel.AbstractDefaultGUIElement#hashCode()
101     */
102    public final int hashCode() {
103        return delegate.hashCode();
104    }
105
106    /**
107     * @return
108     * @see de.ugoe.cs.autoquest.plugin.jfc.guimodel.JFCGUIElement#toString()
109     */
110    public String toString() {
111        return delegate.toString();
112    }
113
114}
Note: See TracBrowser for help on using the repository browser.