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.channel.markup.generic;
032:
033: import java.util.*;
034:
035: import de.ug2t.channel.markup.html.renderer.*;
036: import de.ug2t.connector.*;
037: import de.ug2t.kernel.*;
038: import de.ug2t.unifiedGui.*;
039: import de.ug2t.unifiedGui.interfaces.*;
040:
041: public class MuGenericBox extends MuGenericComponent implements IUnBox,
042: IKePoolable {
043: private UnBoxStyle pem_box = new UnBoxStyle();
044:
045: private IUnImage pem_bg = null;
046:
047: private int pem_gap = 0;
048: private int pem_hvbox = IUnBox.HBOX;
049: private int pem_type = IUnBox.LAYOUTED;
050: private HashMap pem_constraints = null;
051:
052: private IKeView pem_view = new HtmlBoxRenderer();
053:
054: public MuGenericBox(String xID, ACoDataGetter xTplGetter,
055: Object xTplName, MuGenericApplication xAppl)
056: throws Exception {
057: super ("", xTplGetter, xTplName, xAppl);
058:
059: this .pcmf_setView(pem_view);
060: this .pcmf_setValue(xID);
061:
062: return;
063: };
064:
065: // @@
066:
067: public void pcmf_setGap(int xGap) {
068: this .pem_gap = xGap;
069: }
070:
071: public void pcmf_setBoxHVType(int xType) {
072: this .pem_hvbox = xType;
073: }
074:
075: public void pcmf_setBoxType(int xType) {
076: this .pem_type = xType;
077: }
078:
079: public int pcmf_getGap() {
080: return (this .pem_gap);
081: }
082:
083: public int pcmf_getBoxHVType() {
084: return (this .pem_hvbox);
085: }
086:
087: public int pcmf_getBoxType() {
088: return (this .pem_type);
089: }
090:
091: public void pcmf_setBorder(int xDir, String xCol, int xWidth,
092: int xStyle) {
093: this .pem_box.pcmf_setBorder(xDir, xCol, xWidth, xStyle);
094: }
095:
096: public void pcmf_setBoxAlign(String xAlign) {
097: this .pem_box.pcmf_setAlign(xAlign);
098: }
099:
100: public void pcmf_setPadding(int xDir, int xWidth) {
101: this .pem_box.pcmf_setPadding(xDir, xWidth);
102: }
103:
104: public void pcmf_setMargin(int xDir, int xWidth) {
105: this .pem_box.pcmf_setMargin(xDir, xWidth);
106: }
107:
108: public IUnImage pcmf_getBgImage() {
109: return (this .pem_bg);
110: }
111:
112: public UnBoxBorder pcmf_getBorder(int xDir) {
113: return (this .pem_box.pcmf_getBorder(xDir));
114: }
115:
116: public String pcmf_getBoxAlign() {
117: return (this .pem_box.pcmf_getAlign());
118: }
119:
120: public int pcmf_getPadding(int xDir) {
121: return (this .pem_box.pcmf_getPadding(xDir));
122: }
123:
124: public int pcmf_getMargin(int xDir) {
125: return (this .pem_box.pcmf_getMargin(xDir));
126: }
127:
128: public boolean pcmf_isLayout() {
129: return (true);
130: };
131:
132: public void pcmf_setBgImage(IUnImage xImg) {
133: this .pem_bg = xImg;
134: }
135:
136: public void pcmf_addWidget(String xName, UnComponent xObj) {
137: this .pcmf_addNode(xName, xObj);
138: };
139:
140: public UnComponent pcmf_removeWidget(String xName) {
141: return ((UnComponent) this .pcmf_removeNode(xName));
142: };
143:
144: public UnComponent pcmf_removeWidget(UnComponent xObj) {
145: return ((UnComponent) this .pcmf_removeNode(xObj));
146: };
147:
148: public UnComponent pcmf_getWidget(String xName) {
149: return ((UnComponent) this .pcmf_getSubNode(xName));
150: };
151:
152: public boolean pcmf_contains(UnComponent xObj) {
153: return (super .pcmf_contains(xObj));
154: };
155:
156: // New methods (delegates only) due to interface harmonisation
157: public void pcmf_addWidget(String xName, IUnComponent xObj) {
158: this .pcmf_addWidget(xName, (UnComponent) xObj);
159: }
160:
161: public boolean pcmf_contains(IUnComponent xObj) {
162: return (super .pcmf_contains((UnComponent) xObj));
163: }
164:
165: public IUnComponent pcmf_getWidgetbyName(String xName) {
166: return ((IUnComponent) this .pcmf_getWidget(xName));
167: }
168:
169: public IUnComponent pcmf_removeWidget(IUnComponent xObj) {
170: return ((IUnComponent) this
171: .pcmf_removeWidget((UnComponent) xObj));
172: }
173:
174: public void pcmf_setContraint(UnComponent xObj, int xConstraint) {
175: if (this .pem_constraints == null)
176: this .pem_constraints = new HashMap();
177:
178: if (this .pcmf_contains(xObj))
179: this .pem_constraints.put(xObj, new Integer(xConstraint));
180: else
181: KeLog.pcmf_log("ug2t",
182: "can not set constraint, component not found",
183: this , KeLog.MESSAGE);
184: };
185:
186: public int pcmf_getConstaint(UnComponent xObj) {
187: if (this .pem_constraints == null)
188: return (IUnBox.BOX_CONSTRAINT_NONE);
189:
190: Object l_obj = this .pem_constraints.get(xObj);
191: if (l_obj == null)
192: return (IUnBox.BOX_CONSTRAINT_NONE);
193: else
194: return (((Integer) l_obj).intValue());
195: }
196:
197: public void pcmf_checkConstraints() {
198: if (this .pem_constraints == null)
199: return;
200:
201: Iterator l_it = this .pcmf_getSubIterator();
202: HashMap l_newConstraints = new HashMap();
203: while (l_it.hasNext()) {
204: Object l_obj = l_it.next();
205: Object l_constraint = this .pem_constraints.get(l_obj);
206: if (l_constraint != null)
207: l_newConstraints.put(l_obj, l_constraint);
208: }
209: this .pem_constraints = l_newConstraints;
210: }
211:
212: // @@
213: }
|