001: /*
002: * Copyright 2005 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.HTMLElement
017: * Created on 09.08.2006
018: * $Id: HTMLElement.java,v 1.4 2006/08/17 10:19:20 lordsam Exp $
019: */
020: package de.jwic.controls;
021:
022: import de.jwic.base.Control;
023: import de.jwic.base.IControlContainer;
024:
025: /**
026: * Implements the common methods/properties defined by the IHTMLElement interface.
027: *
028: * @author Florian Lippisch
029: * @version $Revision: 1.4 $
030: */
031: public abstract class HTMLElement extends Control implements
032: IHTMLElement {
033:
034: protected String cssClass = null;
035: protected boolean enabled = true;
036: /** sets the width of the control to 100% to fill the available space **/
037: protected boolean fillWidth = false;
038: protected int width = 0; // 0 = not set
039: protected int height = 0; // 0 = not set
040:
041: /**
042: * @param container
043: * @param name
044: */
045: public HTMLElement(IControlContainer container, String name) {
046: super (container, name);
047: }
048:
049: /* (non-Javadoc)
050: * @see de.jwic.controls.IHTMLElement#getCssClass()
051: */
052: public String getCssClass() {
053: return cssClass;
054: }
055:
056: /* (non-Javadoc)
057: * @see de.jwic.controls.IHTMLElement#setCssClass(java.lang.String)
058: */
059: public void setCssClass(String cssClass) {
060: this .cssClass = cssClass;
061: requireRedraw();
062: }
063:
064: /* (non-Javadoc)
065: * @see de.jwic.controls.IHTMLElement#isEnabled()
066: */
067: public boolean isEnabled() {
068: return enabled;
069: }
070:
071: /* (non-Javadoc)
072: * @see de.jwic.controls.IHTMLElement#setEnabled(boolean)
073: */
074: public void setEnabled(boolean enabled) {
075: if (enabled != this .enabled) {
076: requireRedraw();
077: }
078: this .enabled = enabled;
079: }
080:
081: /* (non-Javadoc)
082: * @see de.jwic.controls.IHTMLElement#getHeight()
083: */
084: public int getHeight() {
085: return height;
086: }
087:
088: /* (non-Javadoc)
089: * @see de.jwic.controls.IHTMLElement#setHeight(int)
090: */
091: public void setHeight(int height) {
092: if (this .height != height) {
093: requireRedraw();
094: }
095: this .height = height;
096: }
097:
098: /* (non-Javadoc)
099: * @see de.jwic.controls.IHTMLElement#getWidth()
100: */
101: public int getWidth() {
102: return width;
103: }
104:
105: /* (non-Javadoc)
106: * @see de.jwic.controls.IHTMLElement#setWidth(int)
107: */
108: public void setWidth(int width) {
109: if (this .width != width) {
110: requireRedraw();
111: }
112: this .width = width;
113: }
114:
115: /*
116: * (non-Javadoc)
117: * @see de.jwic.controls.IHTMLElement#isFillWidth()
118: */
119: public boolean isFillWidth() {
120: return fillWidth;
121: }
122:
123: /*
124: * (non-Javadoc)
125: * @see de.jwic.controls.IHTMLElement#setFillWidth(boolean)
126: */
127: public void setFillWidth(boolean fillWidth) {
128: if (this .fillWidth != fillWidth) {
129: requireRedraw();
130: }
131: this .fillWidth = fillWidth;
132: }
133:
134: /* (non-Javadoc)
135: * @see de.jwic.controls.IHTMLElement#forceFocus()
136: */
137: public boolean forceFocus() {
138: return false;
139: }
140:
141: }
|