public class BehaviorUtil
extends java.lang.Object
Constructor and Description |
---|
BehaviorUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
childrenAllowed(org.w3c.dom.Element target)
Test if the target element can have children
|
static boolean |
childrenAllowed(org.w3c.dom.Element target,
org.w3c.dom.Element toDrop)
Test if an element can be add into another one
|
static java.lang.String |
getAddText(org.eclipse.jface.viewers.IStructuredSelection sel)
Get the add text.
The text can change depending on the selected node and desactivated if there is no possibility |
static java.util.List<org.w3c.dom.Element> |
getSameLevelElement(java.util.List<org.w3c.dom.Element> listElement)
If elements are on differents level, filter only element on the same level
|
static boolean |
insertElementInTree(org.w3c.dom.Element newNode,
org.w3c.dom.Element selectedNode,
org.w3c.dom.Element rootBehaviourNode,
ActionPlacement actionPlacement)
Insert a new node in the document dependending on the selected node and the placement required
|
static boolean |
isAllowedToMove(org.w3c.dom.Element target) |
static boolean |
isParent(org.w3c.dom.Element target,
java.lang.String id)
Test if an element target is a child of an element
|
static boolean |
siblingAllowed(org.w3c.dom.Element target,
org.w3c.dom.Element newNode)
Test if the target can posses sibling
|
static ActionPlacement |
validatePlacement(org.w3c.dom.Element nodeToAdd,
org.w3c.dom.Element node,
ActionPlacement actionPlacement)
Validate and change the action Placement depending on the targeted node
|
public static boolean isParent(org.w3c.dom.Element target, java.lang.String id)
target
- the supposed childid
- id of parent elementpublic static boolean childrenAllowed(org.w3c.dom.Element target, org.w3c.dom.Element toDrop)
target
- the selected element where new element will be addedtoDrop
- the element to addpublic static boolean siblingAllowed(org.w3c.dom.Element target, org.w3c.dom.Element newNode)
target
- Target element to testnewNode
- Node to insertpublic static boolean childrenAllowed(org.w3c.dom.Element target)
target
- element to testpublic static boolean isAllowedToMove(org.w3c.dom.Element target)
public static java.lang.String getAddText(org.eclipse.jface.viewers.IStructuredSelection sel)
sel
- public static boolean insertElementInTree(org.w3c.dom.Element newNode, org.w3c.dom.Element selectedNode, org.w3c.dom.Element rootBehaviourNode, ActionPlacement actionPlacement)
newNode
- Node to addselectedNode
- The selected node. May be nullrootBehaviourNode
- The root behavior element. Used to insert at the begin or at the endactionPlacement
- Place to insert the new nodepublic static ActionPlacement validatePlacement(org.w3c.dom.Element nodeToAdd, org.w3c.dom.Element node, ActionPlacement actionPlacement)
nodeToAdd
- Node to insertnode
- Target nodeactionPlacement
- Placement of the node to insert @return Valide placement to insert a new nodepublic static java.util.List<org.w3c.dom.Element> getSameLevelElement(java.util.List<org.w3c.dom.Element> listElement)
listElement
- List of element to filter