001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.unifiedGui.interfaces;
032:
033: import java.awt.*;
034:
035: import javax.swing.*;
036:
037: import de.ug2t.kernel.*;
038: import de.ug2t.unifiedGui.*;
039:
040: /**
041: * @author Dirk
042: *
043: * date: 30.01.2005
044: *
045: * <p>
046: * Purpose: IUnSnapShotComponent is the common interface to snapshot widgets. A
047: * snapshot widget is a picture of a any Java Swing widget.
048: * </p>
049: */
050: public interface IUnSnapShotComponent {
051: /**
052: * @author Dirk
053: *
054: * date: 29.05.2007 project: WiSer-Framework
055: *
056: * <p>
057: * Factory is a convenience class to create components of the surrounding
058: * interface's type without taking care for the WidgetServer MultiChannel API.
059: * It's use is similar to a constructor.
060: * </p>
061: */
062: public static class Factory {
063: /**
064: * Creates a standard version of this component as described in the factory.
065: * If you create masses of components for e.g. within a renderer use
066: * <i> create(IUnApplication xAppl)</i> for performance
067: * reasons.
068: *
069: * @param xWidth
070: * width of the snapshot in pixel
071: * @param xHeight
072: * height of the snapshot in pixel
073: * @return new component
074: */
075: public static IUnSnapShotComponent create(int xWidth,
076: int xHeight) {
077: IUnApplication l_appl = (IUnApplication) KeRegisteredObject
078: .pcmf_getObjByName(IUnApplication.MY_APPL);
079: return (l_appl.pcmf_getComponentFactory()
080: .pcmf_createSnapShot(l_appl.pcmf_getApplType(), "",
081: xWidth, xHeight, l_appl));
082: }
083:
084: /**
085: * Creates a special version of this component as described in the factory
086: * configuration under the descriptor xFactoryDesc. If you create masses of
087: * components for e.g. within a renderer use <i>
088: * create(IUnApplication xAppl, String xFactoryDesc)</i> for performance
089: * reasons.
090: *
091: * @param xWidth
092: * width of the snapshot in pixel
093: * @param xHeight
094: * height of the snapshot in pixel
095: * @param xFactoryDesc
096: * descriptor
097: * @return new component
098: */
099: public static IUnSnapShotComponent create(int xWidth,
100: int xHeight, String xFactoryDesc) {
101: IUnApplication l_appl = (IUnApplication) KeRegisteredObject
102: .pcmf_getObjByName(IUnApplication.MY_APPL);
103: return (l_appl.pcmf_getComponentFactory()
104: .pcmf_createSnapShotPlugin(l_appl
105: .pcmf_getApplType(), "", xWidth, xHeight,
106: l_appl, xFactoryDesc));
107: }
108:
109: /**
110: * Creates a standard version of this component as described in the factory
111: * within the given application-context. If you create masses of components
112: * for e.g. within a renderer use this method for performance reasons.
113: *
114: * @param xWidth
115: * width of the snapshot in pixel
116: * @param xHeight
117: * height of the snapshot in pixel
118: * @param xAppl
119: * application in which context the component is created
120: * @return new component
121: */
122: public static IUnSnapShotComponent create(int xWidth,
123: int xHeight, IUnApplication xAppl) {
124: return (xAppl.pcmf_getComponentFactory()
125: .pcmf_createSnapShot(xAppl.pcmf_getApplType(), "",
126: xWidth, xHeight, xAppl));
127: }
128:
129: /**
130: * Creates a special version of this component as described in the factory
131: * configuration under the descriptor xFactoryDesc. If you create masses of
132: * components for e.g. within a renderer use this function for performance
133: * reasons.
134: *
135: * @param xWidth
136: * width of the snapshot in pixel
137: * @param xHeight
138: * height of the snapshot in pixel
139: * @param xFactoryDesc
140: * descriptor
141: * @param xAppl
142: * application in which context the component is created
143: * @return new component
144: */
145: public static IUnSnapShotComponent create(int xWidth,
146: int xHeight, IUnApplication xAppl, String xFactoryDesc) {
147: return (xAppl.pcmf_getComponentFactory()
148: .pcmf_createSnapShotPlugin(
149: xAppl.pcmf_getApplType(), "", xWidth,
150: xHeight, xAppl, xFactoryDesc));
151: }
152: }
153:
154: static class VWin {
155: private static JWindow pem_vwin;
156: static {
157: VWin.pem_vwin = new JWindow();
158: VWin.pem_vwin.setSize(0, 0);
159: }
160:
161: public static synchronized void pcmf_add(Component xComp) {
162: VWin.pem_vwin.getRootPane().add(xComp);
163: VWin.pem_vwin.setVisible(true);
164: }
165:
166: public static synchronized void pcmf_remove(Component xComp) {
167: VWin.pem_vwin.getRootPane().remove(xComp);
168: }
169:
170: public void finalize() throws Throwable {
171: VWin.pem_vwin.dispose();
172: }
173: }
174:
175: /**
176: * <p>
177: * Gets the associated gui-object which implements all common methods
178: * </p>
179: * <p>
180: *
181: * @return gui-object
182: * </p>
183: * <p>
184: * </p>
185: */
186: public UnComponent pcmf_getUnComponent();
187:
188: /**
189: * <p>
190: * Sets the Component object to insert the widgets to snapshot
191: * </p>
192: * <p>
193: *
194: * @return Graphics object
195: * </p>
196: * <p>
197: * </p>
198: */
199: public void pcmf_setSnapShotRoot(Component xWdg);
200:
201: /**
202: * <p>
203: * Sets the size of the widget
204: * </p>
205: * <p>
206: *
207: * </p>
208: * <p>
209: *
210: * @param x
211: * size in x direction in pixel
212: * @param y
213: * size in y direction in pixel
214: * </p>
215: */
216: public void pcmf_setWidgetSize(int x, int y);
217:
218: /**
219: * <p>
220: * Gets the size of the widget in x direction in pixel
221: * </p>
222: * <p>
223: *
224: * @return size in x direction in pixel
225: * </p>
226: * <p>
227: * </p>
228: */
229: public int pcmf_getWidgetSizeX();
230:
231: /**
232: * <p>
233: * Gets the size of the widget in y direction in pixel
234: * </p>
235: * <p>
236: *
237: * @return size in y direction in pixel
238: * </p>
239: * <p>
240: * </p>
241: */
242: public int pcmf_getWidgetSizeY();
243:
244: /**
245: * <p>
246: * Commits all changes, which means that the drawed Image is updated
247: * </p>
248: * <p>
249: *
250: * </p>
251: * <p>
252: * </p>
253: */
254: public void pcmf_commitWidget();
255:
256: }
|