KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > formview > displayer > Behaviour


1 package net.sourceforge.formview.displayer;
2
3 import java.util.Map JavaDoc;
4
5 import net.sourceforge.formview.FieldView;
6
7 /**
8  * Description : Behaviour loaded with displayers-config.xml
9  * XML file. This class describe how HTML element
10  * must be rendered for this behaviour.
11  * Behaviour is defined with name (READ-WRITE, READ-ONLY, INVISIBLE)
12  * For this behaviour HTML element can be updated
13  * by adding attributes, by inserting other HTML content
14  * after, before HTML element or replacing bay new HTML content.
15  * (eg : HTML select element
16  * <select name="selectName" ><option value="MY_VALUE" >MY_LABEL</option></select>
17  * can be replaced by two HTML inputs with behaviour READ-ONLY, like this
18  * <input type="hidden" name="selectName" value="MY_VALUE" />
19  * <input type="text" name="selectNameLabel" value="MY_LABEL" readonly="readonly" />
20  * )
21  *
22  * @see net.sourceforge.formview.displayer.BaseElement
23  *
24  * @version 1.0.0
25  * @author <a HREF="mailto:angelo.zerr@gmail.com">Angelo ZERR</a>
26  *
27  */

28 public class Behaviour extends BaseElement {
29
30     /**
31      *
32      */

33     public void processHTML(FieldView field, String JavaDoc defaultBehaviour, Map JavaDoc contextValuesMap, StringBuffer JavaDoc htmlContentToInsertBefore, StringBuffer JavaDoc htmlContentToInsertAfter, StringBuffer JavaDoc htmlContentToReplace, Map JavaDoc attributeMap) {
34         // Get behaviour of field
35
// if behaviour of field is not filled, the behaviour is the defaultBehaviour
36
String JavaDoc behaviour = defaultBehaviour;
37         if (field != null && field.getBehaviour() != null && field.getBehaviour().length() > 0)
38             behaviour = field.getBehaviour();
39         if (getName().equalsIgnoreCase(behaviour)) {
40             super.processHTML(field, defaultBehaviour, contextValuesMap, htmlContentToInsertBefore, htmlContentToInsertAfter, htmlContentToReplace, attributeMap);
41         }
42     }
43 }
44
Popular Tags