001: /*
002: * Copyright Javelin Software, All rights reserved.
003: */
004:
005: package com.javelin.swinglets.plaf.wml;
006:
007: import java.awt.*;
008: import java.awt.event.*;
009: import java.util.*;
010: import java.io.*;
011:
012: import com.javelin.swinglets.*;
013: import com.javelin.swinglets.plaf.*;
014:
015: /**
016: * WMLComponentUI defines a look and feel for WML.
017: *
018: * @author Robin Sharp
019: */
020:
021: public abstract class WMLComponentUI implements SComponentUI {
022: /**
023: * Get the look and feel class for this UI.
024: */
025: public Class getLookAndFeel() {
026: return WMLLookAndFeel.class;
027: }
028:
029: /**
030: * Render the UI on the Object, in the header.
031: */
032: public void updateHeader(Object out, SComponent c) {
033: updateHeader((PrintWriter) out, c);
034: }
035:
036: /**
037: * Render the script code for a text the Header.
038: */
039: public void updateScript(Object out, SComponent c) {
040: updateScript((PrintWriter) out, c);
041: }
042:
043: /**
044: * Update the component header.
045: */
046: public void updateComponentHeader(Object out, SComponent c) {
047: updateComponentHeader((PrintWriter) out, c);
048: };
049:
050: /**
051: * Render the UI on the Object, in the body.
052: */
053: public void update(Object out, SComponent c) {
054: update((PrintWriter) out, c);
055: }
056:
057: /**
058: * Update the component footer.
059: */
060: public void updateComponentFooter(Object out, SComponent c) {
061: updateComponentFooter((PrintWriter) out, c);
062: }
063:
064: /**
065: * Render the script event handling on the Object
066: */
067: public void updateEvent(Object out, SComponent c) {
068: updateEvent((PrintWriter) out, c);
069: }
070:
071: /**
072: * Render the UI on the output, in the header.
073: */
074: public void updateHeader(PrintWriter out, SComponent c) {
075: }
076:
077: /**
078: * Render the script code for a text the Header.
079: */
080: public void updateScript(PrintWriter out, SComponent c) {
081: }
082:
083: /**
084: * Update the component header.
085: */
086: public void updateComponentHeader(PrintWriter out, SComponent c) {
087: };
088:
089: /**
090: * Render the UI on the PrintWriter, in the body.
091: */
092: public void update(PrintWriter out, SComponent c) {
093: }
094:
095: /**
096: * Update the component footer.
097: */
098: public void updateComponentFooter(PrintWriter out, SComponent c) {
099: }
100:
101: /**
102: * Render the script event handling on the Object
103: */
104: public void updateEvent(PrintWriter out, SComponent c) {
105: }
106:
107: /**
108: * Tell the underlying UI that the component has been changed.
109: */
110: public void update(SComponent c, int id, int index) {
111: };
112:
113: /**
114: * Tell the underlying UI that the component has been changed.
115: */
116: public void update(SComponent c, int id, Object constraint) {
117: };
118:
119: // EVENTS ///////////////////////////////////////////////////////////////
120:
121: /**
122: * @see com.javelin.swinglets.plaf.SComponentUI.addListener()
123: */
124: public void addListener(EventListener listener) {
125: addInternal(listener);
126: }
127:
128: /**
129: * @see com.javelin.swinglets.plaf.SComponentUI.removeListener()
130: */
131: public void removeListener(EventListener listener) {
132: addInternal(listener);
133: }
134:
135: /**
136: * Adds the listeners to receive component events from
137: * the SComponent at initialisation.
138: */
139: public void addListeners(SComponent component) {
140: }
141:
142: /**
143: * Removes all the listeners that received component events from
144: * the SComponent at initialisation.
145: */
146: public void removeListeners(SComponent component) {
147: }
148:
149: protected void addInternal(EventListener listener) {
150: if (swingletListeners == null) {
151: swingletListeners = new Vector();
152: }
153:
154: swingletListeners.addElement(listener);
155: }
156:
157: protected void removeInternal(EventListener listener) {
158: if (swingletListeners != null) {
159: swingletListeners.removeElement(listener);
160: }
161: }
162:
163: protected Vector swingletListeners;
164:
165: }
|