001: /*
002: * de.jwic.controls.WindowControl
003: * $Id: WindowControl.java,v 1.1 2006/01/16 08:31:12 lordsam Exp $
004: */
005: package de.jwic.controls;
006:
007: import de.jwic.base.ControlContainer;
008: import de.jwic.base.IControlContainer;
009: import de.jwic.base.IOuterLayout;
010:
011: /**
012: * Displays the contained controls within a table that looks like a window with
013: * a title.
014: * @author Florian Lippisch
015: * @version $Revision: 1.1 $
016: */
017: public class WindowControl extends ControlContainer implements
018: IOuterLayout {
019:
020: private static final long serialVersionUID = 1L;
021:
022: private String outerTemplateName = WindowControl.class.getName();
023: private String title = null;
024: private String align = "left";
025: private String width = "100%";
026:
027: /**
028: * @param container
029: */
030: public WindowControl(IControlContainer container) {
031: super (container);
032: init();
033: }
034:
035: /**
036: * @param container
037: * @param name
038: */
039: public WindowControl(IControlContainer container, String name) {
040: super (container, name);
041: init();
042: }
043:
044: /**
045: * Initialize the control.
046: */
047: private void init() {
048: setRendererId(DEFAULT_OUTER_RENDERER);
049: title = getName();
050: }
051:
052: /**
053: * @return Returns the align.
054: */
055: public String getAlign() {
056: return align;
057: }
058:
059: /**
060: * @return Returns the width.
061: */
062: public String getWidth() {
063: return width;
064: }
065:
066: /**
067: * Returns <code>null</code> if the class has not been extended and
068: * no template name has been set.
069: * @see de.jwic.base.Control#getTemplateName()
070: */
071: public String getTemplateName() {
072: String tmpl = super .getTemplateName();
073: if (tmpl.equals(outerTemplateName)
074: || tmpl.equals(WindowControl.class.getName())) {
075: return null;
076: }
077: return super .getTemplateName();
078: }
079:
080: /**
081: * @return Returns the title.
082: */
083: public String getTitle() {
084: return title;
085: }
086:
087: /**
088: * @param title The title to set.
089: */
090: public void setTitle(String title) {
091: this .title = title;
092: requireRedraw();
093: }
094:
095: /* (non-Javadoc)
096: * @see de.jwic.base.IOuterLayout#getOuterTemplateName()
097: */
098: public String getOuterTemplateName() {
099: return outerTemplateName;
100: }
101:
102: /**
103: * The outerTemplateName to set.
104: * @param outerTemplateName
105: */
106: public void setOuterTemplateName(String outerTemplateName) {
107: this .outerTemplateName = outerTemplateName;
108: }
109:
110: /**
111: * @param string
112: */
113: public void setAlign(String string) {
114: align = string;
115: requireRedraw();
116:
117: }
118:
119: /**
120: * @param string
121: */
122: public void setWidth(String string) {
123: width = string;
124: requireRedraw();
125: }
126:
127: }
|