Package org.hippoecm.frontend.model
Class JcrNodeModel
- java.lang.Object
-
- org.hippoecm.frontend.model.ItemModelWrapper<Node>
-
- org.hippoecm.frontend.model.JcrNodeModel
-
- All Implemented Interfaces:
Serializable
,org.apache.wicket.model.IDetachable
,org.apache.wicket.model.IModel<Node>
,org.apache.wicket.util.io.IClusterable
,IObservable
public class JcrNodeModel extends ItemModelWrapper<Node> implements IObservable
The model for a JCRNode
. It maintains a reference to a (possibly null) Node object. In addition, it isIObservable
, broadcasting JCREvent
s for property changes and child node additions or removals.In general, no guarantees are made on the existence of the Node. I.e. the referenced node may disappear or it may even never have existed.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JcrNodeModel(String path)
Create a JcrNodeModel based on an absolute JCR path.JcrNodeModel(Node node)
Create a JcrNodeModel based on a JCR Node.JcrNodeModel(JcrItemModel model)
Create a JcrNodeModel based on an JcrItemModel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detach()
boolean
equals(Object object)
Equivalence of observables; observation will only be started on one instance.Node
getNode()
Retrieve the node from the repository.Node
getObject()
JcrNodeModel
getParentModel()
Retrieve a JcrNodeModel for the parent node.int
hashCode()
void
setObservationContext(IObservationContext<? extends IObservable> context)
Store the observation context to be used to dispatch events.void
startObservation()
Start the observation by listening to JCREvent
s.void
stopObservation()
Stop listening to JCREvent
s.String
toString()
-
Methods inherited from class org.hippoecm.frontend.model.ItemModelWrapper
getItemModel, setItemModel, setObject
-
-
-
-
Constructor Detail
-
JcrNodeModel
public JcrNodeModel(JcrItemModel model)
Create a JcrNodeModel based on an JcrItemModel. The JcrItemModel should provide access to the Node to be wrapped by this model.- Parameters:
model
- the Item model
-
JcrNodeModel
public JcrNodeModel(Node node)
Create a JcrNodeModel based on a JCR Node.- Parameters:
node
- the node to wrap
-
JcrNodeModel
public JcrNodeModel(String path)
Create a JcrNodeModel based on an absolute JCR path.- Parameters:
path
- the JCR path to the Node.
-
-
Method Detail
-
getNode
public Node getNode()
Retrieve the node from the repository. May return null when the node no longer exists or the model was initially created with a null object.
-
getObject
public Node getObject()
- Specified by:
getObject
in interfaceorg.apache.wicket.model.IModel<Node>
- Overrides:
getObject
in classItemModelWrapper<Node>
-
getParentModel
public JcrNodeModel getParentModel()
Retrieve a JcrNodeModel for the parent node.- Returns:
- a model for the parent Node
-
detach
public void detach()
- Specified by:
detach
in interfaceorg.apache.wicket.model.IDetachable
- Specified by:
detach
in interfaceorg.apache.wicket.model.IModel<Node>
- Overrides:
detach
in classItemModelWrapper<Node>
-
setObservationContext
public void setObservationContext(IObservationContext<? extends IObservable> context)
Store the observation context to be used to dispatch events.- Specified by:
setObservationContext
in interfaceIObservable
-
startObservation
public void startObservation()
Start the observation by listening to JCREvent
s.- Specified by:
startObservation
in interfaceIObservable
-
stopObservation
public void stopObservation()
Stop listening to JCREvent
s.- Specified by:
stopObservation
in interfaceIObservable
-
equals
public boolean equals(Object object)
Description copied from interface:IObservable
Equivalence of observables; observation will only be started on one instance.- Specified by:
equals
in interfaceIObservable
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceIObservable
- Overrides:
hashCode
in classObject
- See Also:
IObservable.equals(Object)
-
-