|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.ui.painter.PainterFactory
A painter factory is responsible for the rendering of HTML control elements like lists, trees or tabsets. A painter creates a special GUI layout (skin). For example the default painter from the painter.def package generates the GUI which is shown in the trial version. New user interfaces can be provided by customizing the stylesheet which comes with the default painter or by creating new painters. Customizing the stylesheets can be done in future with the ResourceFactory Tool. The application must register a painter at startup. This can be done in the application or the session scope. If a painter is registered in the application scope the GUI (skin) will be offered to all users. If a user should select between different GUI layouts (skins) the painters must be registered in the users session.
Example: register a painter in the session scope. This can be done in the logon action of the application
// select a special painter for the user session.setAttribute(PainterFactory.SESSION_PAINTER, new MyPainterFactory());
Example: register the painter in the application scope. This can be done in
the GenericServlet.init()
method of the controller
servlet.
// register a painter for the application getServletContext().setAttribute(PainterFactory.APPLICATION_PAINTER, new MyPainterFactory());
The framework selects a painter in the following way.
DefPainterFactory
Field Summary | |
private static java.lang.ThreadLocal |
painterStackIterator
Iterator to iterate all registered painter factories. |
private ResourceMap |
resources
The Resource Map. |
private static long |
serialVersionUID
Serial Version UID |
Constructor Summary | |
PainterFactory()
Constructor |
Method Summary | |
static ActionPainter |
createActionPainter(PainterContext ctx,
ControlAction action)
Creates an ActionPainter. |
static FramePainter |
createFramePainter(ControlPainter controlPainter)
Helper Function. |
static void |
createHeaderIncludes(javax.servlet.jsp.PageContext pageContext)
Creates all Include-Tags in the HTML-Pages which are necessary for the Framework to work well (css, javascripts, ...). |
static ControlPainter |
createPainter(javax.servlet.jsp.PageContext pageContext,
Control ctrl)
Helper Function. |
static PainterContext |
createPainterContext(javax.servlet.jsp.PageContext pageContext,
Control ctrl)
Creates the painter context |
protected abstract ResourceMap |
createResourceMap()
Creates the Painters Resource Map |
protected ActionPainter |
doCreateActionPainter(PainterContext ctx,
ControlAction action)
Creates an ActionPainter. |
protected FramePainter |
doCreateFramePainter(PainterContext painterContext,
Control ctrl)
Creates a frame painter for the control specified in the argument. |
protected abstract void |
doCreateHeaderIncludes(javax.servlet.jsp.JspWriter writer)
Creates all Include-Tags in the HTML-Pages which are necessary for the Framework to work well (css, javascripts, ...). |
protected abstract ControlPainter |
doCreatePainter(PainterContext painterContext,
Control ctrl)
Creates a painter for the control specified in the argument. |
PainterContext |
doCreatePainterContext(javax.servlet.jsp.PageContext pageContext,
Control ctrl)
Creates the painter context |
boolean |
equals(java.lang.Object obj)
|
static Color |
getColorResource(javax.servlet.jsp.PageContext pageContext,
java.lang.String resourceKey)
Retrieves the value for the given color key |
abstract java.lang.String |
getFactoryId()
Returns an unique String which identifies the PainterFactory. |
static java.util.List |
getFactoyStack(javax.servlet.jsp.PageContext pageContext)
Returns the registered painter factories. |
static ImageModel |
getImageResource(javax.servlet.jsp.PageContext pageContext,
int size,
java.lang.String resourceKey)
Retrieves the value for the given resource key |
static ImageModel |
getImageResource(javax.servlet.jsp.PageContext pageContext,
java.lang.String resourceKey)
Retrieves the value for the given resource key |
ResourceMap |
getResources()
Gets the painters Resource Map |
static java.lang.String |
getStringResource(javax.servlet.jsp.PageContext pageContext,
java.lang.String resourceKey)
Retrieves the value for the given resource key |
static java.lang.String |
getStringResource(javax.servlet.jsp.PageContext pageContext,
java.lang.String resourceKey,
boolean returnNull)
Retrieves the value for the given resource key |
static java.lang.String |
getStringResource(javax.servlet.jsp.PageContext pageContext,
java.lang.String resourceKey,
java.lang.Object[] params,
boolean returnNull)
Retrieves the value for the given resource key |
int |
hashCode()
|
static boolean |
isFactorySelected(javax.servlet.jsp.PageContext pageContext,
java.lang.String factoryId)
Checks if the specified Factory is registered |
protected static boolean |
isRegisteredInScopeList(PainterFactory painter,
java.util.List painterList)
Checks if a painter is already registered in the painter list |
static java.util.Iterator |
iterator(javax.servlet.jsp.PageContext pageContext,
boolean topDown)
Returns an iterator to iterate all registered painter factories. |
static PainterFactory |
lookupFactory(javax.servlet.jsp.PageContext pageContext,
java.lang.String factoryId)
Returns the specified painter factory by its factory id |
static void |
registerApplicationPainter(javax.servlet.ServletContext ctx,
PainterFactory painter)
Registers a Painter in the Application Scope |
static void |
registerApplicationPainters(javax.servlet.ServletContext ctx)
Registers the global painters in the Application Scope (ajax,html and global) |
static void |
registerRequestPainter(javax.servlet.http.HttpServletRequest request,
PainterFactory painter)
Registers a Painter in the Session Scope. |
static void |
registerSessionPainter(javax.servlet.http.HttpSession session,
PainterFactory painter)
Registers a Painter in the Session Scope. |
static void |
resetApplicationPainter(javax.servlet.ServletContext ctx)
Resets the PainterFactory at application scope |
static void |
resetSessionPainter(javax.servlet.http.HttpServletRequest request)
Resets the PainterFactory at request scope |
static void |
resetSessionPainter(javax.servlet.http.HttpSession session)
Resets the PainterFactory at session scope |
java.lang.String |
toString()
Returns the unique id of the painter factory |
static void |
unregisterApplicationPainter(javax.servlet.ServletContext ctx,
PainterFactory painter)
Unregisters a Painter from the Application Scope |
static void |
unregisterRequestPainter(javax.servlet.http.HttpServletRequest request,
PainterFactory painter)
Unregisters a Painter from the request Scope |
static void |
unregisterSessionPainter(javax.servlet.http.HttpSession session,
PainterFactory painter)
Unregisters a Painter from the Session Scope |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final long serialVersionUID
private static java.lang.ThreadLocal painterStackIterator
Since the iterator is thread local you can not store it. otherwise it's internal state my be changed by another method!
private ResourceMap resources
Constructor Detail |
public PainterFactory()
Method Detail |
public abstract java.lang.String getFactoryId()
public ResourceMap getResources()
public boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object)
public int hashCode()
Object.hashCode()
public java.lang.String toString()
protected abstract ResourceMap createResourceMap()
protected abstract ControlPainter doCreatePainter(PainterContext painterContext, Control ctrl)
Note: This method will be called from the PainterFactory!
painterContext
- The context of the JSP page where the control is defined. So
it is possible for the painter to get the ActionMappings if
required. The ActionMappings are necessary for the generation
of hyperlinks.ctrl
- The instance of the control for which a painter should be
created
protected FramePainter doCreateFramePainter(PainterContext painterContext, Control ctrl)
Note: This method will be called from the PainterFactory!
painterContext
- The context of the JSP page where the control is defined. So
it is possible for the painter to get the ActionMappings if
required. The ActionMappings are necessary for the generation
of hyperlinks.ctrl
- The instance of the control for which a frame painter should
be created
protected ActionPainter doCreateActionPainter(PainterContext ctx, ControlAction action)
ctx
- The Painter Contextaction
- ControlAction
public PainterContext doCreatePainterContext(javax.servlet.jsp.PageContext pageContext, Control ctrl)
pageContext
- PageContextctrl
- Control
protected abstract void doCreateHeaderIncludes(javax.servlet.jsp.JspWriter writer) throws java.io.IOException
writer
- The JspWriter
java.io.IOException
- If an input or output exception occurredpublic static void createHeaderIncludes(javax.servlet.jsp.PageContext pageContext)
pageContext
- The PageContextpublic static ControlPainter createPainter(javax.servlet.jsp.PageContext pageContext, Control ctrl)
pageContext
- PageContextctrl
- Control
public static FramePainter createFramePainter(ControlPainter controlPainter)
controlPainter
- The ControlPainter
null
public static ActionPainter createActionPainter(PainterContext ctx, ControlAction action)
ctx
- The Painter Contextaction
- ControlAction
public static PainterContext createPainterContext(javax.servlet.jsp.PageContext pageContext, Control ctrl)
pageContext
- PageContextctrl
- Control
public static boolean isFactorySelected(javax.servlet.jsp.PageContext pageContext, java.lang.String factoryId)
pageContext
- The PageContextfactoryId
- The unique Id of the factory
public static PainterFactory lookupFactory(javax.servlet.jsp.PageContext pageContext, java.lang.String factoryId)
pageContext
- The PageContextfactoryId
- The unique id of the factory
null
public static java.lang.String getStringResource(javax.servlet.jsp.PageContext pageContext, java.lang.String resourceKey, java.lang.Object[] params, boolean returnNull)
pageContext
- JSP Page ContextresourceKey
- the resource keyparams
- Array with parameters for markup substitutionreturnNull
- controls whether to return null or a not present indicator
null
public static java.lang.String getStringResource(javax.servlet.jsp.PageContext pageContext, java.lang.String resourceKey, boolean returnNull)
pageContext
- JSP Page ContextresourceKey
- the resource keyreturnNull
- controls whether to return null or a not present indicator
null
public static java.lang.String getStringResource(javax.servlet.jsp.PageContext pageContext, java.lang.String resourceKey)
pageContext
- JSP Page ContextresourceKey
- the resource key
null
public static Color getColorResource(javax.servlet.jsp.PageContext pageContext, java.lang.String resourceKey)
pageContext
- JSP Page ContextresourceKey
- the resource key
null
public static ImageModel getImageResource(javax.servlet.jsp.PageContext pageContext, java.lang.String resourceKey)
pageContext
- JSP Page ContextresourceKey
- the resource key
null
public static ImageModel getImageResource(javax.servlet.jsp.PageContext pageContext, int size, java.lang.String resourceKey)
pageContext
- JSP Page Contextsize
- Image SizeresourceKey
- the resource key
null
public static java.util.Iterator iterator(javax.servlet.jsp.PageContext pageContext, boolean topDown)
Since the iterator is thread local you can not store it. otherwise it's internal state my be changed by another method!
pageContext
- JSP Page ContexttopDown
- creates an top down iterator when true
.
Creates a reverse iterator when false>
PainterFactory
elementspublic static java.util.List getFactoyStack(javax.servlet.jsp.PageContext pageContext)
pageContext
- PageContext
public static void resetSessionPainter(javax.servlet.http.HttpServletRequest request)
request
- HttpServletRequestpublic static void resetSessionPainter(javax.servlet.http.HttpSession session)
session
- HttpSessionpublic static void resetApplicationPainter(javax.servlet.ServletContext ctx)
ctx
- ServletContextpublic static void registerRequestPainter(javax.servlet.http.HttpServletRequest request, PainterFactory painter)
request
- HttpServletRequestpainter
- PainterFactorypublic static void unregisterRequestPainter(javax.servlet.http.HttpServletRequest request, PainterFactory painter)
request
- HttpServletRequestpainter
- PainterFactory to unregisterpublic static void registerSessionPainter(javax.servlet.http.HttpSession session, PainterFactory painter)
session
- HttpSessionpainter
- PainterFactorypublic static void unregisterSessionPainter(javax.servlet.http.HttpSession session, PainterFactory painter)
session
- HttpSessionpainter
- PainterFactory to unregisterpublic static void registerApplicationPainters(javax.servlet.ServletContext ctx)
ctx
- ServletContextpublic static void registerApplicationPainter(javax.servlet.ServletContext ctx, PainterFactory painter)
ctx
- ServletContextpainter
- PainterFactory to registerpublic static void unregisterApplicationPainter(javax.servlet.ServletContext ctx, PainterFactory painter)
ctx
- ServletContextpainter
- PainterFactory to unregisterprotected static boolean isRegisteredInScopeList(PainterFactory painter, java.util.List painterList)
painter
- the painter to checkpainterList
- the painter list to search
true
if the painter is already registered
in the list
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |