Class NodePickerController
java.lang.Object
org.hippoecm.frontend.plugins.standards.picker.NodePickerController
- All Implemented Interfaces:
Serializable
,org.apache.wicket.model.IDetachable
,org.apache.wicket.util.io.IClusterable
public abstract class NodePickerController
extends Object
implements org.apache.wicket.model.IDetachable
- See Also:
-
Constructor Summary
ConstructorDescriptionNodePickerController
(IPluginContext context, NodePickerControllerSettings settings) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.wicket.Component
void
detach()
protected org.apache.wicket.model.IModel<Node>
A hook that allows subclasses to specify a default location.org.apache.wicket.model.IModel<Node>
Helper method to retrieve the current folder modelprotected abstract org.apache.wicket.model.IModel<Node>
Return the initially selected modelprotected org.apache.wicket.model.IModel<Node>
Check the IPreferencesStore for a last visited location (a node path) and if found, return it in a new JcrNodeModel, otherwise return null.String[]
org.apache.wicket.model.IModel<Node>
void
Try to determine which model should be used as initial selection.protected boolean
isLinkable
(Node node) Determine if the provided node is of nodeType["mix:referenceable"] and if it's not a hippo:document below a hippo:handle.boolean
protected boolean
isValidNodeType
(Node node) Determine if the node type of the provided node is valid.protected boolean
isValidSelection
(org.apache.wicket.model.IModel<Node> targetModel) This method determines the validity of the selected node in context of this dialog.final void
onClose()
protected void
onFolderSelected
(org.apache.wicket.model.IModel<Node> model) protected void
onSelect
(boolean isValid) This method is called when a new model is selected.void
setSelectedFolder
(org.apache.wicket.model.IModel<Node> model)
-
Constructor Details
-
NodePickerController
-
-
Method Details
-
create
-
setSelectedFolder
-
getSettings
-
onFolderSelected
-
initSelection
public void initSelection()Try to determine which model should be used as initial selection. First, retrieve the model that represents the actual selected node and see if it is valid. If so, select it and return, if not, see if a last visited model is set and if so select it and return. If not, see if a default model is set, if so, select it and return. If not, fallback to the model currently in the selectionModelReference. TODO: We should try and see if the last-visited model is visible in the browser, if not, go on to default model -
getBaseModel
A hook that allows subclasses to specify a default location.- Returns:
- An model used as default initial selection
-
getSelectedModel
-
getInitialModel
Return the initially selected model- Returns:
- The model that is initially selected
-
onSelect
protected void onSelect(boolean isValid) This method is called when a new model is selected.- Parameters:
isValid
- If the model is considered a valid selection model, value will be true, otherwise false.
-
isValidSelection
This method determines the validity of the selected node in context of this dialog. Null values are always considered invalid. Validity is based on whether the nodetype is allowed and if the node is linkable.- Parameters:
targetModel
- The model providing the node to be validated.- Returns:
- If the provided node is a valid dialog selection.
-
isLinkable
Determine if the provided node is of nodeType["mix:referenceable"] and if it's not a hippo:document below a hippo:handle.- Parameters:
node
- Node to test for linkability- Returns:
- If this node is linkable
- Throws:
RepositoryException
- Something went wrong in the repository
-
isValidNodeType
Determine if the node type of the provided node is valid. In case a handle is passed, it will use the nested hippo-document node, or, if none found (in case of a delete), return false.
By default, only documents are considered valid. To use more fine-grained validation, like for example, only allow document types "foo" & "bar", or allow folders as well, a list of allowedNodeTypes can be set during construction of the dialog.
- Parameters:
node
- The node to be validated. If it is of nodeType["hippo:handle"], the first childNode with the same name will be used instead.- Returns:
- If the node type is considered valid.
- Throws:
RepositoryException
- Something went wrong in the repository
-
getRenderer
-
onClose
public final void onClose() -
detach
public void detach()- Specified by:
detach
in interfaceorg.apache.wicket.model.IDetachable
-
getLastVisitedFromPreferences
Check the IPreferencesStore for a last visited location (a node path) and if found, return it in a new JcrNodeModel, otherwise return null.- Returns:
- A new JcrNodeModel pointing to the last visited location (a node path) or null
-
getFolderModel
Helper method to retrieve the current folder model- Returns:
- The folder model
-
getRootPath
-
getRootPaths
-
isStrictRootPath
public boolean isStrictRootPath()
-