SilverStream
Application Server 3.5

com.sssw.shr.page
Class AgpTag

java.lang.Object
 |
 +--com.sssw.shr.page.AgpTag
All Implemented Interfaces:
AgiJavaScriptEnhanced, AgiPageControl, Cloneable, Externalizable, Serializable
Direct Known Subclasses:
AgpControlBase

public class AgpTag
extends Object
implements AgiPageControl, Externalizable, AgiJavaScriptEnhanced, Cloneable

Base class that, together with its inherited class AgpControlBase, provides a convenient base implementation for serialization and HTML generation.

See Also:
AgpControlBase, Serialized Form

Field Summary
static int UNIT_PERCENT
           
static int UNIT_PIXEL
           
 
Constructor Summary
AgpTag()
           
 
Method Summary
 boolean getBoolProperty(String name)
          Returns the boolean value of the specified property.
 boolean getEnableHTMLGeneration()
          Returns whether HTML generation is enabled.
 int[] getIntArrayProperty(String name)
          Returns an int array property which has been stored as int using the delimiter ','.
 int getIntProperty(String name)
          Returns the integer value of the specified property.
 int getIntPropertyUnit(String name)
          Returns the int property unit.
 Object getProperty(String prop)
          Returns the value of the HTML tag set through a call to the setProperty() method.
 String[] getStringArrayProperty(String name)
          Returns a string array property which has been stored as a string using the delimiter ','.
 void invalidateHTML()
          Invalidate.
 void removeProperty(String prop)
          Removes a tag property.
 void setEnableHTMLGeneration(boolean enable)
          Specifies whether HTML generation is enabled.
 void setIntProperty(String prop, int value, int unit)
          Sets an integer property.
 boolean setProperty(String prop, Object value)
          Sets the value of an attribute associated with an HTML tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods implemented from interface com.sssw.shr.page.AgiJavaScriptEnhanced
generateFunction, generateRepaintScript, generateScriptInitializers, getFunctionNameForMethod, getFunctionNames, getMethodNames, getScriptObjectName, isHTMLRepaintPending, isJavaScriptRepaintPending
 
Methods implemented from interface com.sssw.shr.page.AgiPageControl
generateHTML, getPrefix, notifyPageLoaded, notifyPageRequestBegin, notifyPageRequestEnd, notifyPostValue, notifyPostValues
 
Methods implemented from interface java.io.Externalizable
readExternal, writeExternal
 

Field Detail

UNIT_PIXEL

public static final int UNIT_PIXEL

UNIT_PERCENT

public static final int UNIT_PERCENT
Constructor Detail

AgpTag

public AgpTag()
Method Detail

getProperty

public Object getProperty(String prop)
Returns the value of the HTML tag set through a call to the setProperty() method. Returns null if no value is set.
Parameters:
prop - a string representing the HTML tag.
Example:
String ml = (String) Field1.getProperty("MAXLENGTH");
See Also:
AgpTag.setProperty(String prop, Object value)

getBoolProperty

public boolean getBoolProperty(String name)
Returns the boolean value of the specified property.
Parameters:
name - a string representing the name.
Example:
 

getIntProperty

public int getIntProperty(String name)
Returns the integer value of the specified property.
Parameters:
name - a string representing the name.
Example:
 
See Also:
AgpTag.getIntArrayProperty(String name)

getIntPropertyUnit

public int getIntPropertyUnit(String name)
Returns the int property unit.
Parameters:
name - a string representing the name.
Returns:
The possible values are: 1 = pixel, 2 = percent.
Example:
 

getStringArrayProperty

public String[] getStringArrayProperty(String name)
Returns a string array property which has been stored as a string using the delimiter ','.
Parameters:
name - a string representing the name.
Example:
 

getIntArrayProperty

public int[] getIntArrayProperty(String name)
Returns an int array property which has been stored as int using the delimiter ','.
Parameters:
name - a string representing the name.
Example:
 
See Also:
AgpTag.getIntProperty(String name)

setProperty

public boolean setProperty(String prop,
                           Object value)
Sets the value of an attribute associated with an HTML tag.
Parameters:
prop - a string representing the HTML attribute.
value - an object representing the HTML attribute's value.
Usage:

SilverStream does no error checking for the values that you set. Whatever value you set will show up as-is in the HTML stream. If the browser does not know how to render the property and value that you set, it is ignored. If you set a nonexistent HTML tag property (for example, Field1.setProperty("MYPROPERTY", "123");) the property appears in the HTML, but the browser ignores it. The getProperty method will return a value for an invalid property even though the property does not exist. If you do not set a value, then getProperty() returns null.

Example:

The following statement sets the initial value of a text field control. In the resulting HTML, the VALUE attribute of the <INPUT> tag is set to "John Smith". Field1.setProperty("VALUE", "John Smith");

The following code fragment defines the tabbing order for several text field controls on a form. In the resulting HTML, the TABINDEX attribute of each generated <INPUT> tag is set to a number indicating its order in the tab sequence.

	
 firstname.setProperty("TABINDEX", "2");
 lastname.setProperty("TABINDEX", "1");
 employeeid.setProperty("TABINDEX", "3");
 
The following example shows code that could be used in the rowGenerateBegin event for an HTML data view. This code alternates row colors in the view by modifying the value of the BGCOLOR attribute for each <TR> tag in the resulting HTML table.
 AgpTag trTag = (AgpTag) evt.getArgument(); 
    if (m_green) 
       trTag.setProperty("BGCOLOR", "#F0FFF0");  // green 
    else 
       trTag.setProperty("BGCOLOR", "#FFFFFF");  // white 
    // Invert the boolean variable for the next row. 
    m_green = !m_green; 
 
See Also:
AgpTag.getProperty(String prop)

setIntProperty

public void setIntProperty(String prop,
                           int value,
                           int unit)
Sets an integer property.
Parameters:
prop - a string representing the property.
value - an int representing the value.
unit - an int representing the unit. The possible values are:
  • 0 = normal
  • 1 = percent
Example:
 
See Also:
AgpTag.getIntProperty(String name), AgpTag.getIntPropertyUnit(String name)

removeProperty

public void removeProperty(String prop)
Removes a tag property.
Parameters:
prop - a string representing the property to be removed.
Example:
 

invalidateHTML

public void invalidateHTML()
Invalidate.
Example:
 

getEnableHTMLGeneration

public boolean getEnableHTMLGeneration()
Returns whether HTML generation is enabled.
Specified by:
getEnableHTMLGeneration in interface AgiJavaScriptEnhanced
See Also:
Enable HTML Generation property, AgpTag.setEnableHTMLGeneration(boolean enable)

setEnableHTMLGeneration

public void setEnableHTMLGeneration(boolean enable)
Specifies whether HTML generation is enabled.
Parameters:
enable - true if HTML generation should be enabled, otherwise false.
Example:
 
See Also:
Enable HTML Generation property, AgpTag.getEnableHTMLGeneration()

SilverStream
Application Server 3.5