ibm_ilog.diagram.editor.EditingUtils (version 1.1-SNAPSHOT)
Object » ibm_ilog.diagram.editor.EditingUtils
Method Summary
- addItermediatePoint(D, link, point, index) adds a intermediate point to the given link, in the specified index. diagram: ibm_ilog.diagram.widget.Diagram the diagram where the elements are deleted.
- alignBottom(diagram, elements, pivotElement) Align the elements based on the pivotElement bottom side.
- alignHCenter(diagram, elements, pivotElement) Align the elements based on the pivotElement horizontal center.
- alignLeft(diagram, elements, pivotElement) Align the elements based on the pivotElement left side.
- alignRight(diagram, elements, pivotElement) Align the elements based on the pivotElement right side.
- alignTop(diagram, elements, pivotElement) Align the elements based on the pivotElement top side.
- alignVCenter(diagram, elements, pivotElement) Align the elements based on the pivotElement vertical center.
- alignWithPivot(diagram, elements, pivotElement, getBBPivot) Align the elements based on the pivotElement and the getBBPivot function.
- bringForward(selectedElements) Send the selected elements one position front.
- bringToFront(selectedElements) Send the selected elements to the front.
- classifyList(childList, in_b, scope) evaluates each element in the with the in_b function, and add it to the a list if true, and to the b one if false.
- createAddItermediatePointUndoAction(diagram, link, point, index) creates the undo action
- createDeleteUndoAction(diagram, targetSet) creates the move undo action, based on the target.
- createGroupUndoAction(subgraph, elements) creates the group undo action.
- createInvertLinkUndoAction(link)
- createMoveUndoAction(target, oldTransformation, newTransformation) ibm_ilog.diagram.editor.undo.UngroupAction creates the move undo action, based on the target.
- createOnDropAction(D, droppedItem, p, elements) ibm_ilog.diagram.editor.undo.DropAction creates the drop undo action.
- createUngroupUndoAction(diagram, subgraphId, elements, deleteAction, sgTransform) ibm_ilog.diagram.editor.undo.UngroupAction creates the ungroup undo action.
- deleteGraphElements(diagram, elements, doDeleteFunction) returns ibm_ilog.diagram.editor.undo.Action deletes the elements from the diagram
- doDeleteAction(diagram, shapes) returns ibm_ilog.diagram.editor.undo.DeleteAction Deletes the specified shapes from the given diagram and returns a corresponding undo Action.
- findElementsToDelete(diagram, elements, result) iterate over the elements and add to the result all the children and the connected links.
- groupElements(diagram, elements, subgraphName) Creates a new subgraph, and moves all the elements inside it. This method return a JSObject with the created subgraph and the Undo Action: { subgraph:sg , action:action }
- groupReparent(diagram, elements, newParent, oldParent) Change the parent of all the elements given by parameter.
- invertLink(link)
- prepareDeletedSet(diagram, elements) returns ibm_ilog.diagram.GraphElement[] Computes the set of GraphElement to delete based on the specified elements list.
- reorderSelection(selectedElements, childrenReorderer) get the selection, and iterates over the selection parents, calling the childrenReorderer function passed as parameter, with each parent element and the list of selected elements ids.
- reorderedParents(graphElements) given a list of GraphElements, return and array list with the parents of the elements, and a dictionary of the elements, with the Id as keys.
- reparentTransform(diagram, element, newParent, oldParent) Apply the transformation to reparent an element without noticeable transformation change.
- sendBackward(selectedElements) Send the selected elements one position back.
- sendToBack(selectedElements) Send the selected elements to back .
- setChildrenOrder(order) order the elements in the order parameter, as they are passed. This cause a reverse z-order (the last element is the Front one, and the other way about).
- startDropAction(droppedItem, p, D, elements, dropAction) starts a drop action. This method cam be called externally, from the DropInteractor or from an DropAction (redo).
- ungroupElements(diagram, subgraph) Deletes the subgraph and moves all its children to its parent.
Methods
adds a intermediate point to the given link, in the specified index.
diagram: ibm_ilog.diagram.widget.Diagram
the diagram where the elements are deleted.
Parameter | Type | Description |
---|---|---|
D | ||
link | ibm_ilog.diagram.Link | the link to be modified |
point | point | the point to be added |
index | integer | the position where to be added (between the intermediate points). |
Align the elements based on the pivotElement bottom side.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are aligned. |
elements | array | of ibm_ilog.diagram.Node the target set to be aligned. |
pivotElement | ibm_ilog.diagram.Node | the element taken as pivot for alignment. |
Align the elements based on the pivotElement horizontal center.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are aligned. |
elements | array | of ibm_ilog.diagram.Node the target set to be aligned. |
pivotElement | ibm_ilog.diagram.Node | the element taken as pivot for alignment. |
Align the elements based on the pivotElement left side.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are aligned. |
elements | array | of ibm_ilog.diagram.Node the target set to be aligned. |
pivotElement | ibm_ilog.diagram.Node | the element taken as pivot for alignment. |
Align the elements based on the pivotElement right side.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are aligned. |
elements | array | of ibm_ilog.diagram.Node the target set to be aligned. |
pivotElement | ibm_ilog.diagram.Node | the element taken as pivot for alignment. |
Align the elements based on the pivotElement top side.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are aligned. |
elements | array | of ibm_ilog.diagram.Node the target set to be aligned. |
pivotElement | ibm_ilog.diagram.Node | the element taken as pivot for alignment. |
Align the elements based on the pivotElement vertical center.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are aligned. |
elements | array | of ibm_ilog.diagram.Node the target set to be aligned. |
pivotElement | ibm_ilog.diagram.Node | the element taken as pivot for alignment. |
Align the elements based on the pivotElement and the getBBPivot function.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are aligned. |
elements | array | of ibm_ilog.diagram.Node the target set to be aligned. |
pivotElement | ibm_ilog.diagram.Node | the element taken as pivot for alignment. |
getBBPivot | Function | this function determines the alignment position. |
Send the selected elements one position front.
Parameter | Type | Description |
---|---|---|
selectedElements | array | of ibm_ilog.diagram.GraphElement the elements to be arranged. |
Send the selected elements to the front.
Parameter | Type | Description |
---|---|---|
selectedElements | array | of ibm_ilog.diagram.GraphElement the elements to be arranged |
evaluates each element in the with the in_b function,
and add it to the a list if true, and to the b one if false.
Parameter | Type | Description |
---|---|---|
childList | array | of ibm_ilog.diagram.GraphElement the elements to be order |
in_b | Function | the function to evaluate. |
scope | Scope | the scope where to evaluate the in_b function. |
creates the undo action
Parameter | Type | Description |
---|---|---|
diagram | ||
link | ||
point | ||
index |
creates the move undo action, based on the target.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are deleted. |
targetSet | array | of ibm_ilog.diagram.GraphElement the target set to be deleted |
creates the group undo action.
Parameter | Type | Description |
---|---|---|
subgraph | ibm_ilog.diagram.Subgraph | the created subgraph, that groups the elements. |
elements | array | of ibm_ilog.diagram.GraphElement the elements that have been group. |
ibm_ilog.diagram.editor.undo.UngroupAction
creates the move undo action, based on the target.
Parameter | Type | Description |
---|---|---|
target | ibm_ilog.diagram.GraphElement | the element that has been moved. |
oldTransformation | dojox.gfx.matrix | the old transformation matrix. |
newTransformation | dojox.gfx.matrix | the new transformation matrix. |
ibm_ilog.diagram.editor.undo.DropAction
creates the drop undo action.
Parameter | Type | Description |
---|---|---|
D | ||
droppedItem | ibm_ilog.diagram.GraphElement | the item that has been dropped. |
p | Point | the dropping point. |
elements | array | of ibm_ilog.diagram.GraphElement the elements that have been detected behind the point |
ibm_ilog.diagram.editor.undo.UngroupAction
creates the ungroup undo action.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram where the elements are ungroup. subgraph: String the deleted subgraph Id. |
subgraphId | ||
elements | array | of ibm_ilog.diagram.GraphElement the elements that have been ungroup. |
deleteAction | ibm_ilog.diagram.editor.undo.DeleteAction | the created deleteAction, obtained when deleting the subgraph. |
sgTransform |
Returns ibm_ilog.diagram.editor.undo.Action: The Action corresponding to the delete operation.
deletes the elements from the diagram
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram from where to delete |
elements | ibm_ilog.diagram.GraphElement[] | the elements set to be deleted |
doDeleteFunction | Function | Optional. an optional Function to perform the deletion. |
Returns ibm_ilog.diagram.editor.undo.DeleteAction: The action to undo the delete operation.
This implementation removes the specified shapes from the diagram graph and dispose them. Note that it does not handle any data store-related tasks.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | The diagram instance to remove the shapes from. |
shapes | ibm_ilog.diagram.GraphElement[] | An array of ibm_ilog.diagram.GraphElement to remove. |
iterate over the elements and add to the result all the children and the connected links.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram from where to delete |
elements | array | of ibm_ilog.diagram.GraphElement the elements set to be deleted |
result | array | of ibm_ilog.diagram.GraphElement the resulting array. |
Creates a new subgraph, and moves all the elements inside it.
This method return a JSObject with the created subgraph and the Undo Action: { subgraph:sg , action:action }
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram from where to group |
elements | array | of ibm_ilog.diagram.GraphElement the elements set to be group |
subgraphName | String | the new subgraph label return: { subgraph: ibm_ilog.diagram.Subgraph , action: ibm_ilog.diagram.editor.undo.GroupAction } |
Change the parent of all the elements given by parameter.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram from where to reparent |
elements | array | of ibm_ilog.diagram.GraphElement the elements to be reparented. |
newParent | ibm_ilog.diagram.Subgraph | or ibm_ilog.diagram.Graph the new parent |
oldParent | ibm_ilog.diagram.Subgraph | or ibm_ilog.diagram.Graph the old parent |
Returns ibm_ilog.diagram.GraphElement[]: the list of GraphElement to delete.
This method processes the specified elements array to ensures children (if any) and connected links are deleted too.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | The diagram instance to remove the shapes from. |
elements | ibm_ilog.diagram.GraphElement[] | the elements set to be deleted |
get the selection, and iterates over the selection parents,
calling the childrenReorderer function passed as parameter,
with each parent element and the list of selected elements ids.
Parameter | Type | Description |
---|---|---|
selectedElements | array | of ibm_ilog.diagram.GraphElement the elements to be arranged. |
childrenReorderer | Function | the function to be called with each selection parent. |
given a list of GraphElements, return and array list with the parents of the elements,
and a dictionary of the elements, with the Id as keys.
Parameter | Type | Description |
---|---|---|
graphElements | array | of ibm_ilog.diagram.GraphElement the elements to be processed. return: {parents:dojox.collections.ArrayList,ids:{}} |
Apply the transformation to reparent an element without noticeable transformation change.
Parameter | Type | Description |
---|---|---|
diagram | ibm_ilog.diagram.widget.Diagram | the diagram from where to reparent |
element | ibm_ilog.diagram.GraphElement | the element to be reparented. |
newParent | ibm_ilog.diagram.Subgraph | or ibm_ilog.diagram.Graph the new parent |
oldParent | ibm_ilog.diagram.Subgraph | or ibm_ilog.diagram.Graph the old parent (can be null) |
Send the selected elements one position back.
Parameter | Type | Description |
---|---|---|
selectedElements | array | of ibm_ilog.diagram.GraphElement the elements to be arranged. |
Send the selected elements to back .
Parameter | Type | Description |
---|---|---|
selectedElements | array | of ibm_ilog.diagram.GraphElement the elements to be arranged |
order the elements in the order parameter, as they are passed.
This cause a reverse z-order (the last element is the Front one, and the other way about).
Parameter | Type | Description |
---|---|---|
order | array | of ibm_ilog.diagram.GraphElement the elements to be order |
starts a drop action.
This method cam be called externally, from the DropInteractor or from an DropAction (redo).
Parameter | Type | Description |
---|---|---|
droppedItem | ibm_ilog.diagram.GraphElement | the item that has been dropped. |
p | Point | the dropping point. |
D | ||
elements | array | of ibm_ilog.diagram.GraphElement the elements that have been detected behind the point |
dropAction | ibm_ilog.diagram.editor.undo.UngroupAction | the droped action involved in the operation |