info.magnolia.cms.gui.dialog
Class DialogControlImpl

java.lang.Object
  extended by info.magnolia.cms.gui.dialog.DialogControlImpl
All Implemented Interfaces:
DialogControl
Direct Known Subclasses:
Dialog, DialogBox, DialogTab, SearchOnly

public abstract class DialogControlImpl
extends java.lang.Object
implements DialogControl

Version:
2.0
Author:
Vinzenz Wyser

Field Summary
static java.lang.String DEFAULT_VALUE_PROPERTY
           
static java.lang.String SESSION_ATTRIBUTENAME_DIALOGOBJECT
           
static java.lang.String SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE
           
static java.lang.String VALIDATION_PATTERN_PROPERTY
           
protected  java.lang.String value
           
 
Constructor Summary
DialogControlImpl()
           
 
Method Summary
 void addOption(java.lang.Object o)
           
 void addSub(java.lang.Object o)
           
protected  void clearWebsiteNode()
          Deprecated. websitenode should only be set in init(), this is a workaround used in DialogDate
 void drawHtml(java.io.Writer out)
          Actually draw the dialog content.
protected  void drawHtmlPostSubs(java.io.Writer out)
           
protected  void drawHtmlPreSubs(java.io.Writer out)
           
protected  void drawSubs(java.io.Writer out)
           
 java.lang.String getConfigValue(java.lang.String key)
           
 java.lang.String getConfigValue(java.lang.String key, java.lang.String nullValue)
           
 java.lang.String getDescription()
           
 java.lang.String getId()
           
 java.lang.String getLabel()
           
 java.lang.String getMessage(java.lang.String key)
          Get the message.
 java.lang.String getMessage(java.lang.String key, java.lang.Object[] args)
          Get the message with replacement strings.
protected  Messages getMessages()
          Get the AbstractMessagesImpl object for this dialog/control.
 java.lang.String getName()
          Return the configured name of this control (not the id).
 java.util.List getOptions()
           
 DialogControlImpl getParent()
           
 javax.servlet.http.HttpServletRequest getRequest()
           
protected  javax.servlet.http.HttpServletResponse getResponse()
           
 Content getStorageNode()
           
 DialogControlImpl getSub(java.lang.String name)
          Find a control by its name
 java.util.List getSubs()
           
 DialogControlImpl getTopParent()
           
 java.lang.String getValidationPattern()
           
 java.lang.String getValue()
           
 java.util.List getValues()
           
 Content getWebsiteNode()
          Deprecated. use getStorageNode()
 void init(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Content storageNode, Content configNode)
          Initialize a Dialog.
 boolean isRequired()
          True if a value is required.
protected  java.lang.String readValue()
           
protected  java.util.List readValues()
           
 void removeSessionAttribute()
           
 void setConfig(java.lang.String key, boolean value)
           
 void setConfig(java.lang.String key, int value)
           
 void setConfig(java.lang.String key, java.lang.String value)
           
 void setDescription(java.lang.String s)
           
 void setLabel(java.lang.String s)
           
 void setName(java.lang.String s)
          Set the name of this control.
 void setOptions(java.util.List options)
           
 void setRequired(boolean required)
           
 void setSaveInfo(boolean b)
           
 void setSessionAttribute()
          This method sets a control into the session
protected  void setTopParent(DialogControlImpl top)
           
protected  void setValidationMessage(java.lang.String msg)
           
 void setValue(java.lang.String s)
           
 boolean validate()
          If the validation fails the code will set a message in the context using the AlertUtil.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_PATTERN_PROPERTY

public static final java.lang.String VALIDATION_PATTERN_PROPERTY
See Also:
Constant Field Values

DEFAULT_VALUE_PROPERTY

public static final java.lang.String DEFAULT_VALUE_PROPERTY
See Also:
Constant Field Values

SESSION_ATTRIBUTENAME_DIALOGOBJECT

public static final java.lang.String SESSION_ATTRIBUTENAME_DIALOGOBJECT
See Also:
Constant Field Values

SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE

public static final java.lang.String SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE
See Also:
Constant Field Values

value

protected java.lang.String value
Constructor Detail

DialogControlImpl

public DialogControlImpl()
Method Detail

init

public void init(javax.servlet.http.HttpServletRequest request,
                 javax.servlet.http.HttpServletResponse response,
                 Content storageNode,
                 Content configNode)
          throws javax.jcr.RepositoryException
Description copied from interface: DialogControl
Initialize a Dialog. This method is guaranteed to be called just after the control instantiation.

Specified by:
init in interface DialogControl
Parameters:
request - current HttpServletRequest
response - current HttpServletResponse
storageNode - current website node
configNode - configuration node for the dialog
Throws:
javax.jcr.RepositoryException

drawHtml

public void drawHtml(java.io.Writer out)
              throws java.io.IOException
Description copied from interface: DialogControl
Actually draw the dialog content.

Specified by:
drawHtml in interface DialogControl
Parameters:
out - Writer
Throws:
java.io.IOException - exceptions thrown when writing to the Writer can be safely rethrown by the dialog
See Also:
DialogControl.drawHtml(Writer)

addSub

public void addSub(java.lang.Object o)

setConfig

public void setConfig(java.lang.String key,
                      java.lang.String value)

setConfig

public void setConfig(java.lang.String key,
                      boolean value)

setConfig

public void setConfig(java.lang.String key,
                      int value)

getConfigValue

public java.lang.String getConfigValue(java.lang.String key,
                                       java.lang.String nullValue)

getConfigValue

public java.lang.String getConfigValue(java.lang.String key)

setValue

public void setValue(java.lang.String s)

getValue

public java.lang.String getValue()

readValue

protected java.lang.String readValue()

setSaveInfo

public void setSaveInfo(boolean b)

setName

public void setName(java.lang.String s)
Set the name of this control. This is not the same value as the id setted by the parent. In common this value is setted in the dialog configuration.


getName

public java.lang.String getName()
Return the configured name of this control (not the id).

Returns:
the name

addOption

public void addOption(java.lang.Object o)

getStorageNode

public Content getStorageNode()

setLabel

public void setLabel(java.lang.String s)

setDescription

public void setDescription(java.lang.String s)

removeSessionAttribute

public void removeSessionAttribute()

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

setOptions

public void setOptions(java.util.List options)

drawHtmlPreSubs

protected void drawHtmlPreSubs(java.io.Writer out)
                        throws java.io.IOException
Throws:
java.io.IOException

drawSubs

protected void drawSubs(java.io.Writer out)
                 throws java.io.IOException
Throws:
java.io.IOException

drawHtmlPostSubs

protected void drawHtmlPostSubs(java.io.Writer out)
                         throws java.io.IOException
Throws:
java.io.IOException

getParent

public DialogControlImpl getParent()

setTopParent

protected void setTopParent(DialogControlImpl top)

getTopParent

public DialogControlImpl getTopParent()

getSubs

public java.util.List getSubs()

getSub

public DialogControlImpl getSub(java.lang.String name)
Find a control by its name

Parameters:
name - the name of the control to find
Returns:
the found control or null

getResponse

protected javax.servlet.http.HttpServletResponse getResponse()

clearWebsiteNode

@Deprecated
protected void clearWebsiteNode()
Deprecated. websitenode should only be set in init(), this is a workaround used in DialogDate


getId

public java.lang.String getId()

getLabel

public java.lang.String getLabel()

getDescription

public java.lang.String getDescription()

getOptions

public java.util.List getOptions()

getValues

public java.util.List getValues()

readValues

protected java.util.List readValues()

setSessionAttribute

public void setSessionAttribute()
This method sets a control into the session


getMessages

protected Messages getMessages()
Get the AbstractMessagesImpl object for this dialog/control. It checks first if there was a bundle defined i18nBasename, then it tries to find the parent with the first definition.

Returns:

getMessage

public java.lang.String getMessage(java.lang.String key)
Get the message.

Parameters:
key - key
Returns:
message

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.Object[] args)
Get the message with replacement strings. Use the {nr} syntax

Parameters:
key - key
args - replacement strings
Returns:
message

validate

public boolean validate()
If the validation fails the code will set a message in the context using the AlertUtil.

Returns:
true if valid

setValidationMessage

protected void setValidationMessage(java.lang.String msg)

getValidationPattern

public java.lang.String getValidationPattern()

isRequired

public boolean isRequired()
True if a value is required. Set it in the configuration

Returns:

setRequired

public void setRequired(boolean required)

getWebsiteNode

@Deprecated
public Content getWebsiteNode()
Deprecated. use getStorageNode()



Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.