001: /*
002: * Copyright (C) 2004 TiongHiang Lee
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: * Email: thlee@onemindsoft.org
019: */
020:
021: package org.onemind.swingweb.client.awt.ui;
022:
023: import java.awt.*;
024: import java.awt.event.WindowEvent;
025: import java.awt.event.WindowListener;
026: import org.onemind.swingweb.client.core.AbstractClient;
027: import org.onemind.swingweb.client.dom.DomNode;
028:
029: public class WindowUIHandler extends ContainerUIHandler implements
030: WindowListener {
031:
032: public WindowUIHandler(AbstractClient client) {
033: super (client);
034: }
035:
036: public Object createComponentInstance(Object parent, DomNode element) {
037: Window window = null;
038: if (window instanceof Frame) {
039: window = new Window((Frame) parent);
040: } else {
041: window = new Window((Window) parent);
042: }
043: return window;
044: }
045:
046: /**
047: * {@inheritDoc}
048: */
049: protected void handleChildren(AbstractClient rootHandler,
050: Container c, Container contentPane, DomNode element) {
051: super .handleChildren(rootHandler, c, contentPane, element);
052: ((Window) c).validate();
053: }
054:
055: /**
056: * {@inheritDoc}
057: */
058: public void windowActivated(WindowEvent e) {
059: // TODO Auto-generated method stub
060: }
061:
062: /**
063: * {@inheritDoc}
064: */
065: public void windowClosed(WindowEvent e) {
066: // TODO Auto-generated method stub
067: }
068:
069: /**
070: * {@inheritDoc}
071: */
072: public void windowClosing(WindowEvent e) {
073: postEvent(e.getSource(), "close", true);
074: }
075:
076: /**
077: * {@inheritDoc}
078: */
079: public void windowDeactivated(WindowEvent e) {
080: handleEvent(e);
081: }
082:
083: /**
084: * {@inheritDoc}
085: */
086: public void windowDeiconified(WindowEvent e) {
087: handleEvent(e);
088: }
089:
090: /**
091: * {@inheritDoc}
092: */
093: public void windowIconified(WindowEvent e) {
094: handleEvent(e);
095: }
096:
097: /**
098: * {@inheritDoc}
099: */
100: public void windowOpened(WindowEvent e) {
101: handleEvent(e);
102: }
103:
104: /**
105: * {@inheritDoc}
106: */
107: protected void registerListeners(Object com) {
108: super .registerListeners(com);
109: ((Window) com).addWindowListener(this );
110: }
111:
112: public void handleEvent(AWTEvent e) {
113: }
114: }
|