Class AbstractPropertyUI<C extends IJspUIContext>
java.lang.Object
com.jalios.jcms.member.profile.ui.AbstractPropertyUI<C>
- Type Parameters:
C- type of context
- Direct Known Subclasses:
AbstractPropertyUIList,AbstractPropertyUIListItem
public abstract class AbstractPropertyUI<C extends IJspUIContext>
extends Object
implements IJspUI<C>
An user interface (UI) rendered by a JSP, and an optional label.
Instances are loaded using JProperties given a property prefix.
Custom fields can be implemented by providing getters (eg: isEnabled() and
ENABLED_PROP_SUFFIX).
Example of UI configuration:
# property prefix: foo.ui.foo-ui foo.ui.foo-ui.jsp: plugin/FooPlugin/jsp/foo-ui.jsp foo.ui.foo-ui.enabled: true | falseSubclass to provide custom fields like:
# custom property foo.ui.foo-ui.bar: baz
- Since:
- jplatform-11
- Author:
- Sylvain Devaux
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPropertyUI(AbstractPropertyUI<C> other) AbstractPropertyUI(String property, C context) Inits.jspsub properties. -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected booleancanIncludeJsp(String jsp, String property) protected booleancanIncludeJsp(String jsp, String property, boolean validateExists) voiddisable(javax.servlet.http.HttpServletRequest request) Allow to skip this UI using custom request attribute.booleangetBooleanPropertyValue(String suffix, boolean defaultValue) getId()intgetIntegerProperty(String suffix, int defaultValue) getJsp()Returns JSP path from sub properties.Resolve the label from the exact same property but located in lang prop filesgetLangProperty(String userLang, String suffix) getProperty(String property, String defaultValue) getPropertyKey(String suffix) Computes a property key based ongetProperty()and given suffix, appended after a ".".getPropertyValue(String suffix) Defaults on property's key when not translated to help debuggetPropertyValue(String suffix, String defaultValue) protected StringgetRealPath(String relativeFilePath) booleanAllow to skip UI rendering by property configuration (SeeENABLED_PROP_SUFFIX).booleanisEnabled(javax.servlet.http.HttpServletRequest request) Returns weither UI should be displayed or not.protected StringvoidtoString()
-
Field Details
-
LOGGER
protected static final org.apache.log4j.Logger LOGGER -
ENABLED_PROP_SUFFIX
Sub property for "enabled/disabled" state.- See Also:
-
ENABLED_REQ_ATTR
Request attr. name to disabled UI at runtime. -
JSP_PROP_SUFFIX
Sub property to declare jsp path.- See Also:
-
-
Constructor Details
-
AbstractPropertyUI
Inits.jspsub properties.Example: if propertyIdentifier is
jcmsplugin.foo.foo-ui, it will resolve:jcmsplugin.foo.foo-ui.jsp: path/to/foo.jsp
- Parameters:
property- property prefixcontext- init context- Throws:
IllegalArgumentException- if property is null- See Also:
-
AbstractPropertyUI
-
-
Method Details
-
canInclude
public boolean canInclude()- Specified by:
canIncludein interfaceIJspUI<C extends IJspUIContext>- Returns:
- true if JSP file exists.
-
isEnabled
public boolean isEnabled(javax.servlet.http.HttpServletRequest request) Returns weither UI should be displayed or not.Can be skipped using request using
disable(HttpServletRequest).- Parameters:
request- current request- Returns:
- true (by default) to validate UI can be rendered
- See Also:
-
getProperty
-
getContext
- Specified by:
getContextin interfaceIJspUI<C extends IJspUIContext>- Returns:
- the context
-
getId
- Specified by:
getIdin interfaceIJspUI<C extends IJspUIContext>- Returns:
- ui identifier
- See Also:
-
getJsp
Returns JSP path from sub properties.- Specified by:
getJspin interfaceIJspUI<C extends IJspUIContext>- Returns:
- relative path of JSP file to render UI.
- See Also:
-
getLabel
Resolve the label from the exact same property but located in lang prop files- Parameters:
userLang- the lang to resolve the label- Returns:
- the label if defined in lang properties
-
setLabel
-
isEnabled
public boolean isEnabled()Allow to skip UI rendering by property configuration (SeeENABLED_PROP_SUFFIX).- Specified by:
isEnabledin interfaceIUI<C extends IJspUIContext>- Returns:
- true to allow this ui
-
disable
public void disable(javax.servlet.http.HttpServletRequest request) Allow to skip this UI using custom request attribute.- Parameters:
request- current request
-
canIncludeJsp
- Parameters:
jsp- the jsp pathproperty- jsp property (For logging purpose)- Returns:
- true in case of JUnit.
-
canIncludeJsp
- Parameters:
jsp- the jsp pathproperty- jsp property (For logging purpose)validateExists- will validate a JSP file exist relatively from the webapp- Returns:
- true in case of JUnit.
-
getPropertyKey
Computes a property key based ongetProperty()and given suffix, appended after a ".".Eg: suffix="index" and property="foo.ui.foo"-> returns "foo.ui.foo.index"
- Parameters:
suffix- the subproperties' suffix- Returns:
- a full property with given suffix
-
getProperty
-
getPropertyValue
Defaults on property's key when not translated to help debug- Parameters:
suffix- prop suffix- Returns:
- value bound to property.suffix
-
getRealPath
-
getPropertyValue
-
getIntegerProperty
-
getBooleanPropertyValue
-
getLangProperty
-
logPrefix
-
toString
-