com.novell.emframe.dev
Class UiHandler

java.lang.Object
  extended bycom.novell.emframe.dev.UiHandler

public abstract class UiHandler
extends java.lang.Object

Abstract class to implement to plug-in to iManager to handle custom UI for a specific attribute.


Field Summary
protected  UiHandlerContext context
          UiHandlerContext object for this UiHandler.
protected  java.util.Hashtable m_parameterValues
          Parameter key/value pairs for this UiHandler.
protected  java.util.ArrayList m_params
          Each UiHandler can present params to the user through Plug-in Studio, this is a list of params.
static java.lang.String PARAM_CUSTOM_LABEL
          PARAM_CUSTOM_LABEL = "customLabel".
static java.lang.String PARAM_HIDE_LABEL
          PARAM_HIDE_LABEL = "hideLabel".
static java.lang.String PARAM_REGULAR_EXPRESSION
          PARAM_REGULAR_EXPRESSION = "regularExpression".
static java.lang.String PARAM_REGULAR_EXPRESSION_ERROR_MSG
          PARAM_REGULAR_EXPRESSION_ERROR_MSG = "regularExpressionErrorMsg".
 
Constructor Summary
UiHandler()
           
 
Method Summary
 java.lang.String getActionHandlerName()
          Returns the JavaScript method that will handle all actions for the UI control.
 java.lang.String getAttributeName()
          Returns the name of attribute this UiHandler will control.
 java.lang.String getEncodedAttributeName()
          Safename for the name of the attribute (non-alphanumeric chars replaced with '_').
 java.lang.String getId()
          Plug-in Id from XML descriptor registering the UI Handler.
 org.jdom.Element[] getNeedUrlParams()
          Allows the UiHandler to add UrlParams to the task or page descriptor.
 java.lang.String getNotificationName()
          Returns the JavaScript method that will handle notifications to the UI control when the PropertyBookPage is exiting.
 java.lang.String getParameterValue(java.lang.String name)
          Returns the value of a key for this UiHandler.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the multiple values of a key for this UiHandler.
 java.lang.String[] getSharedHeaderCode()
          Returns any shared files to include in the head element.
 void init(UiHandlerContext context)
          This must be called to initialize all uihandlers.
 boolean isEDirAttribute()
          If this is an eDirectory attribute, attributes rights will be added to the XML descriptor for use by RBS.
 boolean isForceReadOnly()
          Returns whether the attribute is forced to be in read only mode.
 boolean makeMultiPartFrom()
          Returns whether this UiHandler requires a MultiPart Form for uploading files.
 void printExitCode(java.io.PrintWriter pw, java.lang.String indent)
          Prints JavaScript code called when page is being submitted.
 void printFocus(java.io.PrintWriter pw, java.lang.String indent)
          Called if this is the first control on the page; will ask for focus.
protected  void printHiddenInput(java.io.PrintWriter pw, java.lang.String indent)
          Called by UiHandler.printLabelLeftOfControl and UiHandler.printLabelAboveControl.
 void printInitCode(java.io.PrintWriter pw, java.lang.String indent)
          Prints JavaScript code for initializing the control.
 void printLabel(java.io.PrintWriter pw, java.lang.String indent)
          Prints a label above the control.
 void printLabelAboveControl(java.io.PrintWriter pw, java.lang.String indent)
          General implementation of this method should simply call printlabel and printUiCode surrounded with the appropriate formating code.
 void printLabelLeftOfControl(java.io.PrintWriter pw, java.lang.String indent)
          General implementation of this method should simply call printlabel and printUiCode surrounded with the appropriate formatting code.
 void printMandatoryCheckCode(java.io.PrintWriter pw, java.lang.String indent, boolean forceMandatory)
          Called by TemplateBuilder.
protected  void printModeSelectorCode(java.io.PrintWriter pw, java.lang.String indent)
          Prints HTML code to display mode selector widgit (ignore, set, add, remove).
 void printScript(java.io.PrintWriter pw, java.lang.String indent)
          Optionally print:
-javascript call addToNotificationList if it needs to be notified on exit
-javascript call addActionHandler if the control can accept actions
-javascript call addEventListener if the control needs to listen to any other controls events
-javascript window.uiObject_attributename Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.
protected  void printUiCode(java.io.PrintWriter pw, java.lang.String indent)
          This will be the code within a form that actually creates ui control.
 void processParam(org.jdom.Element element)
          Each control can have params described in their UiHandler XML descriptor.
 void setParameterValue(java.lang.String name, java.lang.String value)
          Sets a parameter key/value pair for this UiHandler.
 void setParameterValues(java.lang.String name, java.lang.String[] values)
          Sets a parameter key with multiple values for this UiHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected UiHandlerContext context
UiHandlerContext object for this UiHandler.


m_parameterValues

protected java.util.Hashtable m_parameterValues
Parameter key/value pairs for this UiHandler.


m_params

protected java.util.ArrayList m_params
Each UiHandler can present params to the user through Plug-in Studio, this is a list of params.


PARAM_CUSTOM_LABEL

public static final java.lang.String PARAM_CUSTOM_LABEL
PARAM_CUSTOM_LABEL = "customLabel".

See Also:
Constant Field Values

PARAM_HIDE_LABEL

public static final java.lang.String PARAM_HIDE_LABEL
PARAM_HIDE_LABEL = "hideLabel".

See Also:
Constant Field Values

PARAM_REGULAR_EXPRESSION

public static final java.lang.String PARAM_REGULAR_EXPRESSION
PARAM_REGULAR_EXPRESSION = "regularExpression".

See Also:
Constant Field Values

PARAM_REGULAR_EXPRESSION_ERROR_MSG

public static final java.lang.String PARAM_REGULAR_EXPRESSION_ERROR_MSG
PARAM_REGULAR_EXPRESSION_ERROR_MSG = "regularExpressionErrorMsg".

See Also:
Constant Field Values
Constructor Detail

UiHandler

public UiHandler()
Method Detail

getActionHandlerName

public java.lang.String getActionHandlerName()
Returns the JavaScript method that will handle all actions for the UI control.

Returns:
String containing the name JavaScript method that will handle actions for this control. Can be null. Returns null by default.

getAttributeName

public java.lang.String getAttributeName()
Returns the name of attribute this UiHandler will control.

Returns:
String containing the attribute name

getEncodedAttributeName

public java.lang.String getEncodedAttributeName()
Safename for the name of the attribute (non-alphanumeric chars replaced with '_').

Returns:
String containing the encoded attribute name

getId

public java.lang.String getId()
Plug-in Id from XML descriptor registering the UI Handler. Used by the Plug-in Studio to save off description of the plug-in.

Returns:
String containing the unique ID of this plug-in

getNeedUrlParams

public org.jdom.Element[] getNeedUrlParams()
Allows the UiHandler to add UrlParams to the task or page descriptor.

Returns:
XML elements to add to task XML descriptor. Returns null by default.

getNotificationName

public java.lang.String getNotificationName()
Returns the JavaScript method that will handle notifications to the UI control when the PropertyBookPage is exiting.

Returns:
String containing the JavaScript method that will be called to notify this control that page is exiting. Can be null. Returns null by default.

getParameterValue

public java.lang.String getParameterValue(java.lang.String name)
Returns the value of a key for this UiHandler.

Parameters:
name - String containing the key
Returns:
String containing the value
See Also:
setParameterValue(java.lang.String, java.lang.String)

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns the multiple values of a key for this UiHandler.

Parameters:
name - String containing the key
Returns:
String array containing the values
See Also:
setParameterValues(java.lang.String, java.lang.String[])

getSharedHeaderCode

public java.lang.String[] getSharedHeaderCode()
Returns any shared files to include in the head element. Though multiple handlers may request these lines, they will only appear in the JSP template once. These will appear in the <HEAD> section.
Example1: "js:myJavasciptLibrary.js" => <SCRIPT src=myJavascriptLibrary.js></SCRIPT> will be added to JSP template.
Example2: "inc:myInclude.inc" => {INCLUDE myInclude.inc} will be added to JSP template.

Returns:
String array containing the shared headers to include

init

public final void init(UiHandlerContext context)
This must be called to initialize all uihandlers.

Parameters:
context - UiHandlerContext of the plug-in

isEDirAttribute

public boolean isEDirAttribute()
If this is an eDirectory attribute, attributes rights will be added to the XML descriptor for use by RBS. Returns true by default if not overwritten.

Returns:
boolean: true if the control is being used to edit an eDirectory attribute, false if otherwise

isForceReadOnly

public boolean isForceReadOnly()
Returns whether the attribute is forced to be in read only mode. The UiHandler must not allow the user to edit the attribute in read only mode.

Returns:
boolean: true if this attribute is forced to be read only, false if otheriwse.

makeMultiPartFrom

public boolean makeMultiPartFrom()
Returns whether this UiHandler requires a MultiPart Form for uploading files.

Returns:
boolean: true if this uihandler is uploading files which requires the form be made a multi-part form, false if no uploading of files is required. Returns false by default.

printExitCode

public void printExitCode(java.io.PrintWriter pw,
                          java.lang.String indent)
Prints JavaScript code called when page is being submitted. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent

printFocus

public void printFocus(java.io.PrintWriter pw,
                       java.lang.String indent)
Called if this is the first control on the page; will ask for focus. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent

printHiddenInput

protected void printHiddenInput(java.io.PrintWriter pw,
                                java.lang.String indent)
Called by UiHandler.printLabelLeftOfControl and UiHandler.printLabelAboveControl.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent
See Also:
printLabelLeftOfControl(java.io.PrintWriter, java.lang.String), printLabelAboveControl(java.io.PrintWriter, java.lang.String)

printInitCode

public void printInitCode(java.io.PrintWriter pw,
                          java.lang.String indent)
Prints JavaScript code for initializing the control. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent

printLabel

public void printLabel(java.io.PrintWriter pw,
                       java.lang.String indent)
Prints a label above the control. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent

printLabelAboveControl

public void printLabelAboveControl(java.io.PrintWriter pw,
                                   java.lang.String indent)
General implementation of this method should simply call printlabel and printUiCode surrounded with the appropriate formating code. Called by UiHandler.printLabelLeftOfControl and UiHandler.printLabelAboveControl. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent
See Also:
printLabelLeftOfControl(java.io.PrintWriter, java.lang.String), printLabelAboveControl(java.io.PrintWriter, java.lang.String)

printLabelLeftOfControl

public void printLabelLeftOfControl(java.io.PrintWriter pw,
                                    java.lang.String indent)
General implementation of this method should simply call printlabel and printUiCode surrounded with the appropriate formatting code. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent
See Also:
printLabel(java.io.PrintWriter, java.lang.String), printUiCode(java.io.PrintWriter, java.lang.String)

printMandatoryCheckCode

public void printMandatoryCheckCode(java.io.PrintWriter pw,
                                    java.lang.String indent,
                                    boolean forceMandatory)
Called by TemplateBuilder. Should print JavaScript to validate that mandatory attributes has been valued. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent
forceMandatory - boolean: true allows the process building the JSP to force the field to be mandatory (even if the uihandler.m_forceMandatory is false), false if otherwise

printModeSelectorCode

protected void printModeSelectorCode(java.io.PrintWriter pw,
                                     java.lang.String indent)
Prints HTML code to display mode selector widgit (ignore, set, add, remove). Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent

printScript

public void printScript(java.io.PrintWriter pw,
                        java.lang.String indent)
Optionally print:
-javascript call addToNotificationList if it needs to be notified on exit
-javascript call addActionHandler if the control can accept actions
-javascript call addEventListener if the control needs to listen to any other controls events
-javascript window.uiObject_attributename Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent

printUiCode

protected void printUiCode(java.io.PrintWriter pw,
                           java.lang.String indent)
This will be the code within a form that actually creates ui control. Always print like: pw.println(indent + "my code"); This will make sure the code is pretty printed.

Parameters:
pw - PrintWriter to use to write
indent - String containing the amount to indent

processParam

public void processParam(org.jdom.Element element)
Each control can have params described in their UiHandler XML descriptor. The Plug-in Studio allows the plug-in developer to enter values for these parameters. This method is then called, so the UiHandler can receive the values.

Parameters:
element - XML Element containing the parameters entered by the plug-in developer

setParameterValue

public void setParameterValue(java.lang.String name,
                              java.lang.String value)
Sets a parameter key/value pair for this UiHandler.

Parameters:
name - String containing the key
value - String containing the value
See Also:
getParameterValue(java.lang.String)

setParameterValues

public void setParameterValues(java.lang.String name,
                               java.lang.String[] values)
Sets a parameter key with multiple values for this UiHandler.

Parameters:
name - String containing the key
values - String array containing the values
See Also:
getParameterValues(java.lang.String)


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.