Class FacadeHandlerContextImpl
java.lang.Object
ch.tocco.nice2.netui.impl.bind.form.FacadeHandlerContextImpl
- All Implemented Interfaces:
FacadeHandlerContext
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the current component, which in fact is just the one you expect, because you already have told the system within the method.<T extends Component>
TgetComponent
(Class<T> clazz) Type-safe equivalent to theFacadeHandlerContext.getComponent()
method<T extends ComponentFacade>
TgetCurrentFacade
(Class<T> clazz) Get the parent facade.@Nullable String
Get the current path identifiert.boolean
matchesScope
(Set<String> scopes) Compares if the current form scope is included in @param scopes.void
setComponent
(Component component) void
setFormScope
(String formScope) void
setParentFacade
(@Nullable ComponentFacade parentFacade) void
setPathIdentifier
(@Nullable String pathIdentifier) void
setTextResources
(TextResources textResources)
-
Constructor Details
-
FacadeHandlerContextImpl
public FacadeHandlerContextImpl()
-
-
Method Details
-
getFormScope
- Specified by:
getFormScope
in interfaceFacadeHandlerContext
-
matchesScope
Compares if the current form scope is included in @param scopes.- Parameters:
scopes
- The scopes to compare to with the current form scope.- Returns:
true
if it is included, or scopes is empty which means all are ok.
-
setFormScope
-
getTextResources
- Specified by:
getTextResources
in interfaceFacadeHandlerContext
-
setTextResources
-
setComponent
-
getComponent
Description copied from interface:FacadeHandlerContext
Returns the current component, which in fact is just the one you expect, because you already have told the system within the method. UseFacadeHandlerContext.getComponent(Class)
when you don't want to cast. This is save because you know the type.- Specified by:
getComponent
in interfaceFacadeHandlerContext
- Returns:
- the current component
-
getParentFacade
Description copied from interface:FacadeHandlerContext
Get the parent facade. When we need it, we can extend theComponentFacade
interface so we can browse the already constructed structure a bit better. But in some cases (eg. the table column) we know exacly what the parent must be and thus we can cast or useFacadeHandlerContext.getCurrentFacade(Class)
to retrieve facade.- Specified by:
getParentFacade
in interfaceFacadeHandlerContext
- Returns:
- the parent facade
-
setPathIdentifier
-
getPathIdentifier
Description copied from interface:FacadeHandlerContext
Get the current path identifiert. eg. 'firstname', 'relPrincipal', 'Address' ...- Specified by:
getPathIdentifier
in interfaceFacadeHandlerContext
- Returns:
- The identifier, or null if it's not a data component.
-
setParentFacade
-
getComponent
Description copied from interface:FacadeHandlerContext
Type-safe equivalent to theFacadeHandlerContext.getComponent()
method- Specified by:
getComponent
in interfaceFacadeHandlerContext
- Type Parameters:
T
- type parameter- Parameters:
clazz
- the class- Returns:
- component in expected type
- Throws:
RuntimeException
- with cause ClassCastException
-
getCurrentFacade
Description copied from interface:FacadeHandlerContext
SeeFacadeHandlerContext.getParentFacade()
. Additional possibility to move the cast into the context.- Specified by:
getCurrentFacade
in interfaceFacadeHandlerContext
- Type Parameters:
T
- the type in which we expect the facade to be- Parameters:
clazz
- the class in which we expect the facade to be- Returns:
- the facade in the specific type
-