001: /*
002: * Copyright 2005-2007 jWic group (http://www.jwic.de)
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: *
016: * de.jwic.controls.GroupControl
017: * Created on Mar 30, 2007
018: * $Id: GroupControl.java,v 1.4 2007/04/02 09:28:20 aroncotrau Exp $
019: */
020: package de.jwic.controls;
021:
022: import de.jwic.base.ControlContainer;
023: import de.jwic.base.IControlContainer;
024: import de.jwic.base.IOuterLayout;
025:
026: /**
027: * This class defines the Group Control.
028: *
029: * @author Aron Cotrau
030: */
031: public class GroupControl extends ControlContainer implements
032: IHTMLElement, IOuterLayout {
033:
034: private String outerTemplateName = GroupControl.class.getName();
035: private String title = null;
036: private String cssClass = null;
037: private boolean enabled = true;
038: private boolean fillWidth = false;
039: private int width = 0; // 0 = not set
040: private int height = 0; // 0 = not set
041:
042: /**
043: * @param container
044: */
045: public GroupControl(IControlContainer container) {
046: super (container);
047: init();
048: }
049:
050: /**
051: * @param container
052: * @param name
053: */
054: public GroupControl(IControlContainer container, String name) {
055: super (container, name);
056: init();
057: }
058:
059: /**
060: * Initialize the control.
061: */
062: private void init() {
063: setRendererId(DEFAULT_OUTER_RENDERER);
064: title = getName();
065: setCssClass("grpDefault");
066: }
067:
068: /**
069: * Returns <code>null</code> if the class has not been extended and no
070: * template name has been set.
071: *
072: * @see de.jwic.base.Control#getTemplateName()
073: */
074: public String getTemplateName() {
075: String tmpl = super .getTemplateName();
076: if (tmpl.equals(outerTemplateName)
077: || tmpl.equals(GroupControl.class.getName())) {
078: return null;
079: }
080: return super .getTemplateName();
081: }
082:
083: /*
084: * (non-Javadoc)
085: *
086: * @see de.jwic.controls.IHTMLElement#forceFocus()
087: */
088: public boolean forceFocus() {
089: return false;
090: }
091:
092: /*
093: * (non-Javadoc)
094: *
095: * @see de.jwic.controls.IHTMLElement#getCssClass()
096: */
097: public String getCssClass() {
098: return cssClass;
099: }
100:
101: /*
102: * (non-Javadoc)
103: *
104: * @see de.jwic.controls.IHTMLElement#getHeight()
105: */
106: public int getHeight() {
107: return height;
108: }
109:
110: /*
111: * (non-Javadoc)
112: *
113: * @see de.jwic.controls.IHTMLElement#getWidth()
114: */
115: public int getWidth() {
116: return width;
117: }
118:
119: /*
120: * (non-Javadoc)
121: *
122: * @see de.jwic.controls.IHTMLElement#isEnabled()
123: */
124: public boolean isEnabled() {
125: return enabled;
126: }
127:
128: /*
129: * (non-Javadoc)
130: *
131: * @see de.jwic.controls.IHTMLElement#isFillWidth()
132: */
133: public boolean isFillWidth() {
134: return fillWidth;
135: }
136:
137: /*
138: * (non-Javadoc)
139: *
140: * @see de.jwic.controls.IHTMLElement#setCssClass(java.lang.String)
141: */
142: public void setCssClass(String cssClass) {
143: this .cssClass = cssClass;
144: requireRedraw();
145: }
146:
147: /*
148: * (non-Javadoc)
149: *
150: * @see de.jwic.controls.IHTMLElement#setEnabled(boolean)
151: */
152: public void setEnabled(boolean enabled) {
153: }
154:
155: /*
156: * (non-Javadoc)
157: *
158: * @see de.jwic.controls.IHTMLElement#setFillWidth(boolean)
159: */
160: public void setFillWidth(boolean fillWidth) {
161: if (this .fillWidth != fillWidth) {
162: requireRedraw();
163: }
164: this .fillWidth = fillWidth;
165: }
166:
167: /*
168: * (non-Javadoc)
169: *
170: * @see de.jwic.controls.IHTMLElement#setHeight(int)
171: */
172: public void setHeight(int height) {
173: if (this .height != height) {
174: requireRedraw();
175: }
176: this .height = height;
177: }
178:
179: /*
180: * (non-Javadoc)
181: *
182: * @see de.jwic.controls.IHTMLElement#setWidth(int)
183: */
184: public void setWidth(int width) {
185: if (this .width != width) {
186: requireRedraw();
187: }
188: this .width = width;
189: }
190:
191: /**
192: * @return the title
193: */
194: public String getTitle() {
195: return title;
196: }
197:
198: /**
199: * @param title
200: * the title to set
201: */
202: public void setTitle(String title) {
203: this .title = title;
204: requireRedraw();
205: }
206:
207: public String getOuterTemplateName() {
208: return outerTemplateName;
209: }
210:
211: /**
212: * The outerTemplateName to set.
213: *
214: * @param outerTemplateName
215: */
216: public void setOuterTemplateName(String outerTemplateName) {
217: this.outerTemplateName = outerTemplateName;
218: }
219: }
|