Statistics
| Revision:

root / trunk / frameworks / _fwAndami / src / com / iver / andami / ui / mdiManager / ViewInfo.java @ 902

History | View | Annotate | Download (4.63 KB)

1
package com.iver.andami.ui.mdiManager;
2

    
3
import java.beans.PropertyChangeListener;
4
import java.beans.PropertyChangeSupport;
5

    
6

    
7
/**
8
 * DOCUMENT ME!
9
 *
10
 * @author Fernando Gonz?lez Cort?s
11
 */
12
public class ViewInfo {
13
    /** DOCUMENT ME! */
14
    public static final int RESIZABLE = 1;
15

    
16
    /** DOCUMENT ME! */
17
    public static final int MAXIMIZABLE = 2;
18

    
19
    /** DOCUMENT ME! */
20
    public static final int ICONIFIABLE = 4;
21

    
22
    /** DOCUMENT ME! */
23
    public static final int MODALDIALOG = 8;
24
    public static final int MODELESSDIALOG = 16;
25
    private PropertyChangeSupport support = new PropertyChangeSupport(this);
26

    
27
    /** DOCUMENT ME! */
28
    private boolean resizable = false;
29

    
30
    /** DOCUMENT ME! */
31
    private boolean maximizable = false;
32

    
33
    /** DOCUMENT ME! */
34
    private boolean iconifiable = false;
35

    
36
    /** DOCUMENT ME! */
37
    private boolean modal = false;
38
    private boolean modeless = false;
39

    
40
    /** DOCUMENT ME! */
41
    private int width = -1;
42

    
43
    /** DOCUMENT ME! */
44
    private int height = -1;
45
    private int x = 0;
46
    private int y = 0;
47
    private boolean visible = true;
48

    
49
    /** DOCUMENT ME! */
50
    private String title;
51
    
52
    private int id;
53

    
54
    /**
55
     * DOCUMENT ME!
56
     *
57
     * @return Returns the x.
58
     */
59
    public int getX() {
60
        return x;
61
    }
62

    
63
    /**
64
     * DOCUMENT ME!
65
     *
66
     * @param x The x to set.
67
     */
68
    public void setX(int x) {
69
            support.firePropertyChange("x", this.x, x);
70
            this.x = x;
71
    }
72

    
73
    /**
74
     * DOCUMENT ME!
75
     *
76
     * @return Returns the y.
77
     */
78
    public int getY() {
79
        return y;
80
    }
81

    
82
    /**
83
     * DOCUMENT ME!
84
     *
85
     * @param y The y to set.
86
     */
87
    public void setY(int y) {
88
            support.firePropertyChange("y", this.y, y);
89
        this.y = y;
90
    }
91

    
92
    /**
93
     * DOCUMENT ME!
94
     *
95
     * @param listener
96
     */
97
    public void addPropertyChangeListener(PropertyChangeListener listener) {
98
        support.addPropertyChangeListener(listener);
99
    }
100

    
101
    /**
102
     * DOCUMENT ME!
103
     *
104
     * @param listener
105
     */
106
    public void removePropertyChangeListener(PropertyChangeListener listener) {
107
        support.removePropertyChangeListener(listener);
108
    }
109

    
110
    /**
111
     * Establece las propiedades de la vista
112
     *
113
     * @param code Bit-or de las propiedades de la vista
114
     *
115
     * @throws IllegalStateException DOCUMENT ME!
116
     */
117
    public ViewInfo(int code) {
118
        resizable = (code % 2) > 0;
119
        code = code / 2;
120
        maximizable = (code % 2) > 0;
121
        code = code / 2;
122
        iconifiable = (code % 2) > 0;
123
        code = code / 2;
124
        modal = (code % 2) > 0;
125
        code = code / 2;
126
        modeless = (code % 2) > 0;
127

    
128
        if (modal && modeless) {
129
            throw new IllegalStateException("modal && modeless");
130
        }
131
    }
132
    
133
    public ViewInfo(){
134
            
135
    }
136

    
137
    /**
138
     * Si es iconificable
139
     *
140
     * @return
141
     */
142
    public boolean isIconifiable() {
143
        return iconifiable;
144
    }
145

    
146
    /**
147
     * Si es maximizable
148
     *
149
     * @return
150
     */
151
    public boolean isMaximizable() {
152
        return maximizable;
153
    }
154

    
155
    /**
156
     * Si es resizable
157
     *
158
     * @return
159
     */
160
    public boolean isResizable() {
161
        return resizable;
162
    }
163

    
164
    /**
165
     * Devuelve si el di?logo es modal
166
     *
167
     * @return
168
     */
169
    public boolean isModal() {
170
        return modal;
171
    }
172

    
173
    /**
174
     * Obtiene la altura de la vista
175
     *
176
     * @return
177
     */
178
    public int getHeight() {
179
        return height;
180
    }
181

    
182
    /**
183
     * Obtiene la anchura de la vista
184
     *
185
     * @return
186
     */
187
    public int getWidth() {
188
        return width;
189
    }
190

    
191
    /**
192
     * establece la propiedad altura
193
     *
194
     * @param i
195
     */
196
    public void setHeight(int i) {
197
            support.firePropertyChange("height", this.height, i);
198
        height = i;
199
    }
200

    
201
    /**
202
     * establece la propiedad anchura
203
     *
204
     * @param i
205
     */
206
    public void setWidth(int i) {
207
            support.firePropertyChange("width", this.width, i);
208
        width = i;
209
    }
210

    
211
    /**
212
     * obtiene la propiedad titulo
213
     *
214
     * @return
215
     */
216
    public String getTitle() {
217
        return title;
218
    }
219

    
220
    /**
221
     * establece la propiedad titulo
222
     *
223
     * @param string
224
     */
225
    public void setTitle(String string) {
226
            support.firePropertyChange("title", this.title, string);
227
        title = string;
228
    }
229

    
230
    /**
231
     * DOCUMENT ME!
232
     *
233
     * @return
234
     */
235
    public boolean isModeless() {
236
        return modeless;
237
    }
238

    
239
    /**
240
     * DOCUMENT ME!
241
     *
242
     * @return
243
     */
244
    public boolean isVisible() {
245
        return visible;
246
    }
247
    
248
    public void setId(int id){
249
            this.id = id;
250
    }
251
    
252
    public int getId(){
253
            return id;
254
    }
255
}