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.base.IControl
017: * Created on 21.12.2005
018: * $Id: IControl.java,v 1.1 2006/01/16 08:30:40 lordsam Exp $
019: */
020: package de.jwic.base;
021:
022: /**
023: * Interface for the Control object. This interface has been (re-)implemented
024: * to make the usage of Interfaces for custom controls easier.
025: *
026: * @author Florian Lippisch
027: * @version $Revision: 1.1 $
028: */
029: public interface IControl {
030:
031: /**
032: * A user has clicked on a link that was generated by this control.
033: * Links are generated with the <code>createActionURL</code> function.
034: */
035: public abstract void actionPerformed(String actionId,
036: String parameter);
037:
038: /**
039: * This method is invoked when the control is removed from the container.
040: */
041: public abstract void destroy();
042:
043: /**
044: * Removes the field with the given name.
045: * @param name
046: */
047: public abstract void removeField(String name);
048:
049: /**
050: * Removes the field from the fieldlist.
051: * @param field
052: */
053: public abstract void removeField(Field field);
054:
055: /**
056: * Returns the field with the specified name.
057: * @param name
058: * @return
059: */
060: public abstract Field getField(String name);
061:
062: /**
063: * Create an URL with the specified action and parameter. If the user
064: * clicks on this link, the <code>actionPerformed(..)</code> method is
065: * invoked.
066: * @param action
067: * @param acpara
068: */
069: public abstract String createActionURL(String action, String acpara);
070:
071: /**
072: * Returns the container where this control is nested in.
073: */
074: public abstract IControlContainer getContainer();
075:
076: /**
077: * Returns the ID of the control.
078: * @return String
079: */
080: public abstract java.lang.String getControlID();
081:
082: /**
083: * Returns the SessionContext object, this control lives in.
084: */
085: public abstract SessionContext getSessionContext();
086:
087: /**
088: * Returns true if the control has been changed since the last rendering
089: * and must be rendered again to reflect the last changes.
090: * @return boolean
091: */
092: public abstract boolean isRequireRedraw();
093:
094: /**
095: * Returns true if the control should be rendered.
096: * @return boolean
097: */
098: public abstract boolean isVisible();
099:
100: /**
101: * Set to true if the control needs to be rendered again to reflect the changes
102: * of the control since it was last rendered.
103: * @param requireRedraw
104: */
105: public abstract void setRequireRedraw(boolean requireRedraw);
106:
107: /**
108: * Set the visibility flag of this control.
109: * @param newVisible boolean
110: */
111: public abstract void setVisible(boolean newVisible);
112:
113: /**
114: * Returns the name of the Control.
115: */
116: public abstract String getName();
117:
118: /**
119: * Returns the renderer implementation.
120: * @return Returns the renderer.
121: */
122: public abstract String getRendererId();
123:
124: /**
125: * Sets the renderer used to render this control into HTML code.
126: * @param renderer The renderer to set.
127: */
128: public abstract void setRendererId(String rendererId);
129:
130: /**
131: * Returns the name of the template used to render this control.
132: * By default, the name of the template is the name of the control class.
133: * @return Returns the templateName.
134: */
135: public abstract String getTemplateName();
136:
137: /**
138: * Sets the name of the template used to render this control.
139: * @param templateName The templateName to set.
140: */
141: public abstract void setTemplateName(String templateName);
142:
143: }
|