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 Object
implements DialogControl

Version:
2.0
Author:
Vinzenz Wyser

Field Summary
static String DEFAULT_VALUE_PROPERTY
           
static String SESSION_ATTRIBUTENAME_DIALOGOBJECT
           
static String SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE
           
static String VALIDATION_PATTERN_PROPERTY
           
protected  String value
           
 
Constructor Summary
DialogControlImpl()
           
 
Method Summary
 void addOption(Object o)
           
 void addSub(Object o)
           
protected  void clearWebsiteNode()
          Deprecated. websitenode should only be set in init(), this is a workaround used in DialogDate
 void drawHtml(Writer out)
          Actually draw the dialog content.
protected  void drawHtmlPostSubs(Writer out)
           
protected  void drawHtmlPreSubs(Writer out)
           
protected  void drawSubs(Writer out)
           
 String getConfigValue(String key)
           
 String getConfigValue(String key, String nullValue)
           
 String getDescription()
           
 String getId()
           
 String getLabel()
           
 String getMessage(String key)
          Get the message.
 String getMessage(String key, Object[] args)
          Get the message with replacement strings.
protected  Messages getMessages()
          Get the AbstractMessagesImpl object for this dialog/control.
 String getName()
          Return the configured name of this control (not the id).
 List getOptions()
           
 DialogControlImpl getParent()
           
 javax.servlet.http.HttpServletRequest getRequest()
           
protected  javax.servlet.http.HttpServletResponse getResponse()
           
 Content getStorageNode()
           
 DialogControlImpl getSub(String name)
          Find a control by its name
 List getSubs()
           
 DialogControlImpl getTopParent()
           
 String getValidationPattern()
           
 String getValue()
           
 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  String readValue()
           
protected  List readValues()
           
 void removeSessionAttribute()
           
 void setConfig(String key, boolean value)
           
 void setConfig(String key, int value)
           
 void setConfig(String key, String value)
           
 void setDescription(String s)
           
 void setLabel(String s)
           
 void setName(String s)
          Set the name of this control.
 void setOptions(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(String msg)
           
 void setValue(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 String VALIDATION_PATTERN_PROPERTY
See Also:
Constant Field Values

DEFAULT_VALUE_PROPERTY

public static final String DEFAULT_VALUE_PROPERTY
See Also:
Constant Field Values

SESSION_ATTRIBUTENAME_DIALOGOBJECT

public static final String SESSION_ATTRIBUTENAME_DIALOGOBJECT
See Also:
Constant Field Values

SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE

public static final String SESSION_ATTRIBUTENAME_DIALOGOBJECT_REMOVE
See Also:
Constant Field Values

value

protected 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(Writer out)
              throws IOException
Description copied from interface: DialogControl
Actually draw the dialog content.

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

addSub

public void addSub(Object o)

setConfig

public void setConfig(String key,
                      String value)

setConfig

public void setConfig(String key,
                      boolean value)

setConfig

public void setConfig(String key,
                      int value)

getConfigValue

public String getConfigValue(String key,
                             String nullValue)

getConfigValue

public String getConfigValue(String key)

setValue

public void setValue(String s)

getValue

public String getValue()

readValue

protected String readValue()

setSaveInfo

public void setSaveInfo(boolean b)

setName

public void setName(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 String getName()
Return the configured name of this control (not the id).

Returns:
the name

addOption

public void addOption(Object o)

getStorageNode

public Content getStorageNode()

setLabel

public void setLabel(String s)

setDescription

public void setDescription(String s)

removeSessionAttribute

public void removeSessionAttribute()

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

setOptions

public void setOptions(List options)

drawHtmlPreSubs

protected void drawHtmlPreSubs(Writer out)
                        throws IOException
Throws:
IOException

drawSubs

protected void drawSubs(Writer out)
                 throws IOException
Throws:
IOException

drawHtmlPostSubs

protected void drawHtmlPostSubs(Writer out)
                         throws IOException
Throws:
IOException

getParent

public DialogControlImpl getParent()

setTopParent

protected void setTopParent(DialogControlImpl top)

getTopParent

public DialogControlImpl getTopParent()

getSubs

public List getSubs()

getSub

public DialogControlImpl getSub(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

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


getId

public String getId()

getLabel

public String getLabel()

getDescription

public String getDescription()

getOptions

public List getOptions()

getValues

public List getValues()

readValues

protected 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 String getMessage(String key)
Get the message.

Parameters:
key - key
Returns:
message

getMessage

public String getMessage(String key,
                         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(String msg)

getValidationPattern

public 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

public Content getWebsiteNode()
Deprecated. use getStorageNode()



Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.