|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.ui.painter.imp.PainterContextImp
This class encapsulates all the necessary objects for painting the control.
Field Summary | |
private java.util.Hashtable |
attributes
Attributes |
private java.util.Stack |
attributesSave
Stack for saving the whole Attribute collection |
private Control |
control
Instance of the Control |
private PainterFactory |
factory
The Painter Factory |
private java.util.Locale |
locale
The Locale for this Painter |
private javax.servlet.jsp.PageContext |
pageContext
PageContext of the JSP-Page |
private PainterContext |
parentContext
The nesting Painter Context when the actual control is nested within another control e.g. form elements |
private Principal |
principal
The Principal Object. |
Constructor Summary | |
PainterContextImp(javax.servlet.jsp.PageContext pageContext,
Control control)
Constructor |
Method Summary | |
java.lang.String |
attr(java.lang.Object raw)
Converts a String to an equivalent HTML-String |
java.lang.String |
attr(java.lang.Object raw,
boolean filter)
Converts a String to an equivalent HTML-String |
java.lang.String |
attr(java.lang.Object raw,
boolean filter,
int maxlength)
Converts a String to an equivalent HTML-String |
void |
close()
After the painter context has been used it has to be closed. |
ActionPainter |
createActionPainter(ControlActionDef action)
Creates an ActionPainter. |
ActionPainter |
createActionPainter(ControlActionDef action,
java.lang.String actionName)
Creates an ActionPainter. |
org.apache.ecs.html.IMG |
createImage(ImageModel image)
Retrieves an image for the specified Id |
org.apache.ecs.html.IMG |
createImage(int size,
java.lang.String resourceId)
Retrieves an image for the specified Id |
org.apache.ecs.html.IMG |
createImage(java.lang.String resourceId)
Retrieves an image for the specified Id |
org.apache.ecs.html.IMG |
createImage(java.lang.String resourceId,
java.lang.Object param)
Retrieves an image for the specified Id |
org.apache.ecs.html.Input |
createInput(ImageModel image)
Retrieves an image for the specified Id |
org.apache.ecs.html.Input |
createInput(java.lang.String resourceId)
Retrieves an image for the specified Id |
java.lang.String |
decorateURL(java.lang.String url)
Decorates the URL with RequestDecorator settings and appends the JSESSIONID when URL-rewriting is enabled to track sessions Every URL has to be decorated this way! |
java.lang.String |
getAsString(Converter converter,
java.lang.Object value)
Uses a Bean Converter to convert the given object to a String representation. |
java.lang.Object |
getAttribute(java.lang.String key,
boolean searchParent)
Gets an Attribute from the Painter Context hierarchy |
java.lang.Object |
getAttribute(java.lang.String name,
HttpScope scope)
Returns the attribute with the given name from the specified scope |
java.awt.Color |
getAwtColor(java.lang.String resourceId)
Retrieves an color for the specified Id |
Color |
getColor(java.lang.String resourceId)
Retrieves an color for the specified Id |
protected java.util.Stack |
getContextStack()
Retrieves the painter context stack for the current request. |
Control |
getControl()
|
java.lang.String |
getElementName()
Retrieves the name of the HTML element. |
java.lang.String |
getFrameworkString(java.lang.String resourceId)
Returns a framework string resource |
java.lang.String |
getFrameworkString(java.lang.String resourceId,
java.lang.Object[] arguments)
Returns a framework string resource |
ImageModel |
getImage(int size,
java.lang.String resourceId)
Retrieves an image for the specified Id |
ImageModel |
getImage(java.lang.String resourceId)
Retrieves an image for the specified Id |
ImageModel |
getImage(java.lang.String resourceId,
java.lang.Object param)
Retrieves an image for the specified Id |
java.lang.String |
getImageSrc(int size,
java.lang.String resourceId)
Retrieves an image for the specified Id |
java.lang.String |
getImageSrc(java.lang.String resourceId)
Retrieves an image for the specified Id |
java.lang.String |
getImageSrc(java.lang.String resourceId,
java.lang.Object param)
Retrieves an image for the specified Id |
java.util.Locale |
getLocale()
Gets the Locale Setting for this Control |
RequestContext |
getNestedContext()
Gets the nested Action Context |
javax.servlet.jsp.PageContext |
getPageContext()
Gets the Page Context |
Principal |
getPrincipal()
Returns the Principal Object in the current User session |
javax.servlet.http.HttpServletRequest |
getRequest()
Deprecated. use request() |
java.lang.String |
getResourceDir()
Returns the base directory used for resource by the painter factory |
javax.servlet.http.HttpServletResponse |
getResponse()
Deprecated. use response() |
javax.servlet.ServletContext |
getServletContext()
Returns the Servlet Context |
javax.servlet.http.HttpSession |
getSession()
Deprecated. use session() |
java.lang.String |
getSource(ImageModel image)
Gets the localized resource name |
java.lang.String |
getSource(java.lang.String base,
java.lang.String src)
Returns the localized Image resource name |
java.lang.String |
getStringResource(java.lang.String stringOrKey)
Returns a string resource |
java.lang.String |
getStyleId()
Returns the Style Id of the control. |
boolean |
hasAttribute(java.lang.String key,
boolean searchParent)
Gets an Attribute from the Painter Context hierarchy |
java.lang.String |
html(java.lang.Object raw)
Converts a String to an equivalent HTML-String |
java.lang.String |
html(java.lang.Object raw,
boolean filter)
Converts a String to an equivalent HTML-String |
java.lang.String |
html(java.lang.Object raw,
boolean filter,
int maxlength)
Converts a String to an equivalent HTML-String |
protected void |
initLocale()
Sets the locale configuration for this Painter Context. |
boolean |
isDisplayOnly()
This method checks if a control that is rendered within this Painter context has to be "display only" |
boolean |
isRunAtClient()
This Method checks if the control should run on the client |
java.lang.String |
localize(java.lang.String keyOrString)
Localizes a string depending on the localization settings of the Painter context |
java.lang.String |
localize(java.lang.String keyOrString,
java.util.Locale locale)
Localizes a string depending on the localization settings of the Painter context |
java.lang.String |
localize(java.lang.String keyOrString,
java.lang.Object[] arguments)
Localizes a string depending on the localization settings of the Painter context |
java.lang.String |
localizeKey(java.lang.String resourceId,
java.lang.Object[] arguments,
boolean returnNull)
Localizes a string depending on the localization settings of the Painter context. |
void |
open()
The painter context has to be opened before it can be used. |
void |
popAttributes()
Restores the attributes from the Stack all current attributes are lost |
void |
pushAttributes()
Pushes the current attributes on a stack for later restore |
java.lang.Object |
removeAttribute(java.lang.String key)
Removes an Attribute for this Painter |
java.lang.String |
removeHtml(java.lang.Object html)
Removes all HTML formatting from the given HTML-String |
java.lang.String |
removeHtml(java.lang.Object html,
boolean filter)
Removes all HTML formatting from the given HTML-String depending on the filter setting |
javax.servlet.http.HttpServletRequest |
request()
Returns the HTTP Request |
javax.servlet.http.HttpServletResponse |
response()
Returns the HTTP Response |
javax.servlet.http.HttpSession |
session()
Gets the session object |
void |
setAttribute(java.lang.String key,
java.lang.Object value)
Sets an Attribute for this Painter |
void |
setFactory(PainterFactory factory)
Sets the painter factory |
boolean |
showComments()
This method checks if HTML comments should be written to the output |
java.lang.String |
truncate(java.lang.Object obj,
int maxlength)
Truncates a given string to a maximum number of characters |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private javax.servlet.jsp.PageContext pageContext
private Control control
private java.util.Locale locale
private PainterContext parentContext
private Principal principal
private PainterFactory factory
private java.util.Hashtable attributes
private java.util.Stack attributesSave
Constructor Detail |
public PainterContextImp(javax.servlet.jsp.PageContext pageContext, Control control)
pageContext
- the JSP-PageContextcontrol
- The selected ControlMethod Detail |
protected java.util.Stack getContextStack()
public void open()
open
in interface PainterContext
public void close()
close
in interface PainterContext
public java.lang.String getElementName()
getElementName
in interface PainterContext
protected void initLocale()
public void setFactory(PainterFactory factory)
setFactory
in interface PainterContext
factory
- Painter factorypublic javax.servlet.jsp.PageContext getPageContext()
getPageContext
in interface PainterContext
public RequestContext getNestedContext()
RequestContext
getNestedContext
in interface RequestContext
RequestContext.getNestedContext()
public Principal getPrincipal()
RequestContext
getPrincipal
in interface RequestContext
RequestContext.getPrincipal()
public javax.servlet.http.HttpSession getSession()
null
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public java.lang.String getAsString(Converter converter, java.lang.Object value) throws ConverterException
getAsString
in interface PainterContext
converter
- The converter to use or null
to use a default
Convertervalue
- The Bean to convert
null
ConverterException
- Is thrown when a conversion exception occurspublic java.lang.String decorateURL(java.lang.String url)
decorateURL
in interface PainterContext
url
- the URL to encode
public java.lang.String getResourceDir()
getResourceDir
in interface PainterContext
public java.lang.String getStringResource(java.lang.String stringOrKey)
getStringResource
in interface PainterContext
stringOrKey
- Id of the resource/key
public java.lang.String getFrameworkString(java.lang.String resourceId)
getFrameworkString
in interface PainterContext
resourceId
- Id of the resource/key
public java.lang.String getFrameworkString(java.lang.String resourceId, java.lang.Object[] arguments)
getFrameworkString
in interface PainterContext
resourceId
- Id of the resource/keyarguments
- MessageFormat arguments
public ImageModel getImage(java.lang.String resourceId)
getImage
in interface PainterContext
resourceId
- Image Code
null
public ImageModel getImage(int size, java.lang.String resourceId)
getImage
in interface PainterContext
size
- Image sizeresourceId
- Image Code
null
public ImageModel getImage(java.lang.String resourceId, java.lang.Object param)
getImage
in interface PainterContext
resourceId
- Image Codeparam
- Markup parameter
null
public java.lang.String getImageSrc(java.lang.String resourceId)
getImageSrc
in interface PainterContext
resourceId
- Image Code
public java.lang.String getImageSrc(java.lang.String resourceId, java.lang.Object param)
getImageSrc
in interface PainterContext
resourceId
- Image Codeparam
- Markup Parameter
public java.lang.String getImageSrc(int size, java.lang.String resourceId)
getImageSrc
in interface PainterContext
size
- Image sizeresourceId
- Image Code
public Color getColor(java.lang.String resourceId)
getColor
in interface PainterContext
resourceId
- Color Code
null
public java.awt.Color getAwtColor(java.lang.String resourceId)
getAwtColor
in interface PainterContext
resourceId
- Color Code
null
public Control getControl()
getControl
in interface PainterContext
public boolean isRunAtClient()
isRunAtClient
in interface PainterContext
true
when the component should run on the
clientpublic java.lang.String getStyleId()
getStyleId
in interface PainterContext
public boolean showComments()
showComments
in interface PainterContext
false
when comments should be hiddenpublic boolean isDisplayOnly()
isDisplayOnly
in interface PainterContext
true
if a control should be rendered as
display onlypublic ActionPainter createActionPainter(ControlActionDef action)
createActionPainter
in interface PainterContext
action
- ControlAction
public ActionPainter createActionPainter(ControlActionDef action, java.lang.String actionName)
createActionPainter
in interface PainterContext
action
- ControlActionactionName
- Additional Action Name
public org.apache.ecs.html.Input createInput(ImageModel image)
createInput
in interface PainterContext
image
- Image
null
public org.apache.ecs.html.Input createInput(java.lang.String resourceId)
createInput
in interface PainterContext
resourceId
- Image Code
null
public org.apache.ecs.html.IMG createImage(ImageModel image)
createImage
in interface PainterContext
image
- Image
null
public org.apache.ecs.html.IMG createImage(java.lang.String resourceId)
createImage
in interface PainterContext
resourceId
- Image Code
null
public org.apache.ecs.html.IMG createImage(java.lang.String resourceId, java.lang.Object param)
createImage
in interface PainterContext
resourceId
- Image Codeparam
- Markup parameter
null
public org.apache.ecs.html.IMG createImage(int size, java.lang.String resourceId)
createImage
in interface PainterContext
size
- Image sizeresourceId
- Image Code
null
public java.util.Locale getLocale()
getLocale
in interface PainterContext
public java.lang.String localize(java.lang.String keyOrString)
localize
in interface PainterContext
keyOrString
- String Literal or Resource Key
public java.lang.String localize(java.lang.String keyOrString, java.util.Locale locale)
localize
in interface PainterContext
keyOrString
- String Literal or Resource Keylocale
- the locale to use
public java.lang.String localize(java.lang.String keyOrString, java.lang.Object[] arguments)
localize
in interface PainterContext
keyOrString
- String Literal or Resource Keyarguments
- MessageFormat arguments
public java.lang.String localizeKey(java.lang.String resourceId, java.lang.Object[] arguments, boolean returnNull)
localizeKey
in interface PainterContext
resourceId
- The resource key.arguments
- MessageFormat arguments or null
returnNull
- controls whether to return null or a not present indicator
public java.lang.String removeHtml(java.lang.Object html)
PainterContext
removeHtml
in interface PainterContext
html
- Object in HTML format
PainterContext.removeHtml(java.lang.Object)
public java.lang.String removeHtml(java.lang.Object html, boolean filter)
PainterContext
removeHtml
in interface PainterContext
html
- Object in HTML formatfilter
- Filter
PainterContext.removeHtml(java.lang.Object, boolean)
public java.lang.String html(java.lang.Object raw)
html
in interface PainterContext
raw
- Object
public java.lang.String html(java.lang.Object raw, boolean filter)
html
in interface PainterContext
raw
- Objectfilter
- Filter
public java.lang.String html(java.lang.Object raw, boolean filter, int maxlength)
html
in interface PainterContext
raw
- Objectfilter
- Filtermaxlength
- The maximum number of visible characters
public java.lang.String attr(java.lang.Object raw)
attr
in interface PainterContext
raw
- Object
public java.lang.String attr(java.lang.Object raw, boolean filter)
attr
in interface PainterContext
raw
- Objectfilter
- Filter
public java.lang.String attr(java.lang.Object raw, boolean filter, int maxlength)
attr
in interface PainterContext
raw
- Objectfilter
- Filtermaxlength
- The maximum number of visible characters
public java.lang.String truncate(java.lang.Object obj, int maxlength)
truncate
in interface PainterContext
obj
- The string to truncatemaxlength
- The maximum number of characters
public java.lang.String getSource(java.lang.String base, java.lang.String src)
getSource
in interface PainterContext
base
- Base Directory or resource Identifiersrc
- Resource name
public java.lang.String getSource(ImageModel image)
getSource
in interface PainterContext
image
- Image Model
public void setAttribute(java.lang.String key, java.lang.Object value)
setAttribute
in interface PainterContext
key
- Attribute Keyvalue
- Attribute Valuepublic java.lang.Object removeAttribute(java.lang.String key)
removeAttribute
in interface PainterContext
key
- Attribute Key
null
public java.lang.Object getAttribute(java.lang.String key, boolean searchParent)
getAttribute
in interface PainterContext
key
- Attribute KeysearchParent
- if set to true
the attribute will be search up
the PainterContext hierarchy
null
public boolean hasAttribute(java.lang.String key, boolean searchParent)
hasAttribute
in interface PainterContext
key
- Attribute KeysearchParent
- if set to true
the attribute will be search up
the PainterContext hierarchy
null
public void pushAttributes()
pushAttributes
in interface PainterContext
public void popAttributes()
popAttributes
in interface PainterContext
public java.lang.Object getAttribute(java.lang.String name, HttpScope scope)
HttpContext
getAttribute
in interface HttpContext
name
- the attribute namescope
- the scope to search
null
HttpContext.getAttribute(java.lang.String, com.cc.framework.http.HttpScope)
public javax.servlet.ServletContext getServletContext()
HttpContext
getServletContext
in interface HttpContext
HttpContext.getServletContext()
public javax.servlet.http.HttpServletRequest request()
HttpContext
request
in interface HttpContext
HttpContext.request()
public javax.servlet.http.HttpServletResponse response()
HttpContext
response
in interface HttpContext
HttpContext.response()
public javax.servlet.http.HttpSession session()
HttpContext
session
in interface HttpContext
HttpContext.session()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |