Class EditContext
- All Implemented Interfaces:
HasHandlers
,HasEditMaskClickedHandlers
,HasEditNodeUpdatedHandlers
,HasNodeAddedHandlers
,HasSelectedEditNodesUpdatedHandlers
An EditContext is typically populated by
adding a series of EditNodes
created via a Palette
, either via drag and drop creation, or when loading from a saved version, via addFromPaletteNode()
or addPaletteNodesFromXML()
.
An EditContext then provides interfaces for further editing of the components represented by EditNodes.
Developers may explicitly define an edit
context and initialize it with a rootComponent
- the root
of the user interface being created. The EditContext itself is not visible to the user, but the root component's liveObject
may be.
As child editNodes are added to the
rootComponent node or its descendants, liveObjects in the user will update to reflect these changes. The live objects
for the edit nodes will be nested using the appropriate parent-child relationships, for the types of node in question.
For example Canvases will be added as members
of layouts
and FormItems will be added as fields
of DynamicForms.
To enable drag and drop creation of widgets from a Palette
, a developer can use
Canvas.setEditMode()
to enable editing behaviors on the live
object of the desired drop target (typically the root component).
To enable editNode creation via double-click on a
Palette
, developers can set the Palette.defaultEditContext
.
Developers can also make use of
EditPane
or EditTree
classes which provide a visual
interface for managing an EditContext.
- See Also:
-
Field Summary
Fields inherited from class com.smartgwt.client.core.BaseClass
config, configOnly, factoryCreated, factoryProperties, id, scClassName
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd a editMaskClicked handler.Add a editNodeUpdated handler.addFromPaletteNode
(PaletteNode paletteNode) Creates a new EditNode from a PaletteNode, using thedefaultPalette
.addFromPaletteNode
(PaletteNode paletteNode, EditNode parentNode) Creates a new EditNode from a PaletteNode, using thedefaultPalette
.EditNode[]
addFromPaletteNodes
(PaletteNode[] paletteNodes) Add the suppliedPaletteNodes
to the parentNode, preserving internal references from one supplied PaletteNode to another.EditNode[]
addFromPaletteNodes
(PaletteNode[] paletteNodes, EditNode parentNode) Add the suppliedPaletteNodes
to the parentNode, preserving internal references from one supplied PaletteNode to another.EditNode[]
addFromPaletteNodeTree
(Tree paletteNodeTree) Add the suppliedPaletteNode
tree to the parentNode, preserving internal references from one supplied PaletteNode to another.EditNode[]
addFromPaletteNodeTree
(Tree paletteNodeTree, EditNode parentNode) Add the suppliedPaletteNode
tree to the parentNode, preserving internal references from one supplied PaletteNode to another.Add a newEditNode
to the EditContext, under the specified parent.addNode
(EditNode newNode, EditNode parentNode, Integer index, String parentProperty, Boolean skipParentComponentAdd) addNode
(EditNode newNode, EditNode parentNode, Integer index, String parentProperty, Boolean skipParentComponentAdd, Boolean forceSingularFieldReplace) Add a newEditNode
to the EditContext, under the specified parent.addNodeAddedHandler
(NodeAddedHandler handler) Add a nodeAdded handler.void
addPaletteNodeFormItemConstructors
(Tree nodeTree) AddPaletteNode
constructors for the specific type ofFormItem
that will be created to the paletteNodes in the specified tree created bycreatePaletteNodeTree()
.void
addPaletteNodesFromJS
(String jsCode) AddPaletteNodes
from a JavaScript source representation.void
addPaletteNodesFromJS
(String jsCode, EditNode parentNode) void
addPaletteNodesFromJS
(String jsCode, EditNode parentNode, String[] globals) AddPaletteNodes
from a JavaScript source representation.void
addPaletteNodesFromJSON
(String jsonString) RecreateEditNodes
from a JSON representation ofPaletteNodes
(possibly created by callingserializeAllEditNodesAsJSON()
orserializeEditNodesAsJSON()
.void
addPaletteNodesFromJSON
(String jsonString, EditNode parentNode) void
addPaletteNodesFromJSON
(String jsonString, EditNode parentNode, String[] globals) void
addPaletteNodesFromJSON
(String jsonString, EditNode parentNode, String[] globals, Function callback) RecreateEditNodes
from a JSON representation ofPaletteNodes
(possibly created by callingserializeAllEditNodesAsJSON()
orserializeEditNodesAsJSON()
.void
addPaletteNodesFromXML
(String xmlString) RecreateEditNodes
from an XML representation ofPaletteNodes
(possibly created by callingserializeAllEditNodes()
orserializeEditNodes()
.void
addPaletteNodesFromXML
(String xmlString, EditNode parentNode) void
addPaletteNodesFromXML
(String xmlString, EditNode parentNode, String[] globals) void
addPaletteNodesFromXML
(String xmlString, EditNode parentNode, String[] globals, Function callback) RecreateEditNodes
from an XML representation ofPaletteNodes
(possibly created by callingserializeAllEditNodes()
orserializeEditNodes()
.Add a selectedEditNodesUpdated handler.void
convertedNode
(EditNode origNode, EditNode newNode, EditNode parentNode) Notification fired when anEditNode
is converted to a different type when moved from one container to another.void
copyEditNodes
(EditNode editNode) Copies the passed editNode or editNodes to an internal "clipboard" space, for later application viapasteEditNodes()
.void
copyEditNodes
(EditNode... editNode) Copies the passed editNode or editNodes to an internal "clipboard" space, for later application viapasteEditNodes()
.create()
createPaletteNodeTree
(PaletteNode... paletteNodes) Creates aTree
from the suppliedPaletteNodes
preserving internal references from one supplied PaletteNode to another.void
Deselect all EditNodes.void
deselectEditNodes
(List editNodes) Deselect a list of EditNodes.void
editNodeHasDataSource
(EditNode editNode) Does theeditNode
have a DataSource assigned?editNodeHasFields
(EditNode editNode) Does theeditNode
have at least one field assigned?void
enableEditing
(EditNode editNode) Enable edit mode for anEditNode
.Dropping a component near the edge of another component allows the component to be dropped through an ancestor component.Controls whether components can be dropped into other components which support child components.New nodes added to the editContext are automatically placed into edit mode if the new node's parent is in edit mode.Should the group selection box shown whencanGroupSelect
is true allow dragging the group as a whole?Should a group selection outline covering the outermost bounding boxes of all selected components be shown in this container?Should editNodes added to this EditContext be selectable? Whentrue
, eachEditProxy.canSelectChildren
property is enabled unless explicitly set tofalse
.Palette
to use when anEditNode
is being created directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from aTreePalette
, or clicking onMenuPalette
).The default parentEditNode
to be used when a new EditNode is added to the EditContext without a specified parent.Properties to apply to allEditProxy.editMask
s created for components in edit mode.EditNode[]
getEditNodesByType
(String types) ReturnsEditNodes
as an array that match the specified type or types.EditNode[]
getEditNodesByType
(String... types) ReturnsEditNodes
as an array that match the specified type or types.EditNode[]
getEditNodesByType
(String[] types, boolean strict) ReturnsEditNodes
as an array that match the specified type or types.Gets the tree of editNodes being edited by this editContext.Whether inline editing should be enabled for any components that are added and are placed into editMode.Palette[]
AdditionalPalettes
to consult for metadata when deserializingEdit Nodes
.Should the group selection box shown whencanGroupSelect
is true be hidden during drag?Defines the mode of inclusion for components encountered during hoop selection which is enabled whenselectionType
ismultiple
.Properties to apply toEditProxy.hoopSelector
.getJsObj()
void
getNodeProperty
(EditNode editNode, String name) Returns the specified property from the editNode's serializable "defaults".static EditContext
getOrCreateRef
(JavaScriptObject jsObj) void
getPaletteNodesFromJS
(String jsCode, PaletteNodeCallback callback) ObtainPaletteNodes
from a JavaScript source representation.void
getPaletteNodesFromJS
(String jsCode, PaletteNodeCallback callback, String[] globals) ObtainPaletteNodes
from a JavaScript source representation.void
getPaletteNodesFromXML
(String xmlString, PaletteNodeCallback callback) ObtainPaletteNodes
from an XML representation, but do not add them to the EditContext.When enabled, changes to aliveObject
's position and size will be persisted to theirEditNodes
by default.Root of data to edit.Returns the rootEditNode
of the EditContext typically created fromrootComponent
.Appearance that is applied to selected component.Set the CSS border to be applied to the selection outline of the selected components.Returns selected EditNode or first selected EditNode if multiple nodes are selected.EditNode[]
Returns all selected EditNodes as an Array.The background color for the selection outline label.Mask color applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".int
Opacity applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".Defines selection behavior when in edit mode.Should the selection outline show a label for selected components? A component may also be highlighted with the selection outline and label to indicate the target of a drop.Should the selection outline show a label when the component is selected? This property is similar toshowSelectedLabel
.void
inlineEditorShowing
(FormItem field, String type) Notification method fired when an inline title or value editor is shown or closed for a component in the designer pane.boolean
boolean
Returns true if the editNode is selected.boolean
isNodeEditingOn
(EditNode editNode) Returns true ifeditNode
is in edit mode.makeEditNode
(PaletteNode paletteNode) Creates and returns an EditNode using thedefaultPalette
.makePaletteNode
(EditNode editNode) makePaletteNodeTree
(EditNode editNode) Creates aTree
ofPaletteNodes
from anEditNode
in this context'seditNodeTree
, by usingmakePaletteNode()
on the passedEditNode
and its descendents within theeditNodeTree
.void
nodeMoved
(EditNode oldNode, EditNode oldParentNode, EditNode newNode, EditNode newParentNode, EditNode rootNode) Notification fired when anEditNode
has been moved to a new position in the component tree.void
nodeRemoved
(EditNode removedNode, EditNode parentNode, EditNode rootNode) Notification fired when anEditNode
has been removed from the EditContextvoid
"Pastes"editNodes
previously captured viacopyEditNodes()
.void
pasteEditNodes
(EditNode targetEditNode) "Pastes"editNodes
previously captured viacopyEditNodes()
.void
Removes allEditNodes
from the EditContext, but does not destroy theliveObjects
.void
removeNode
(EditNode editNode) RemovesEditNode
from the EditContext.void
removeNodeProperties
(EditNode editNode, String[] properties) Removes the specified properties from an editNode's serializable "defaults".void
Select all EditNodes.void
selectEditNode
(EditNode editNode) Select an EditNode.void
selectSingleEditNode
(EditNode editNode) Select a single EditNode and deselect everything else.Serialize the tree ofEditNodes
to an XML representation ofPaletteNodes
.serializeAllEditNodes
(SerializationSettings settings) Serialize the tree ofEditNodes
to an XML representation ofPaletteNodes
.Encode the tree ofEditNodes
to a JSON representation ofPaletteNodes
.Encode the tree ofEditNodes
to a JSON representation ofPaletteNodes
.serializeEditNodes
(EditNode[] nodes) Serialize the providedEditNodes
to an XML representation ofPaletteNodes
.serializeEditNodes
(EditNode[] nodes, SerializationSettings settings) Serialize the providedEditNodes
to an XML representation ofPaletteNodes
.serializeEditNodesAsJSON
(EditNode[] nodes) Serialize the providedEditNodes
to a JSON representation ofPaletteNodes
.serializeEditNodesAsJSON
(EditNode[] nodes, SerializationSettings settings) Serialize the providedEditNodes
to a JSON representation ofPaletteNodes
.setAllowDropThrough
(Boolean allowDropThrough) Dropping a component near the edge of another component allows the component to be dropped through an ancestor component.setAllowNestedDrops
(Boolean allowNestedDrops) Controls whether components can be dropped into other components which support child components.setAutoEditNewNodes
(Boolean autoEditNewNodes) New nodes added to the editContext are automatically placed into edit mode if the new node's parent is in edit mode.setCanDragGroup
(Boolean canDragGroup) Should the group selection box shown whencanGroupSelect
is true allow dragging the group as a whole?setCanGroupSelect
(Boolean canGroupSelect) Should a group selection outline covering the outermost bounding boxes of all selected components be shown in this container?setCanSelectEditNodes
(Boolean canSelectEditNodes) Should editNodes added to this EditContext be selectable? Whentrue
, eachEditProxy.canSelectChildren
property is enabled unless explicitly set tofalse
.setDefaultPalette
(Palette defaultPalette) Palette
to use when anEditNode
is being created directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from aTreePalette
, or clicking onMenuPalette
).setDefaultParent
(EditNode defaultParent) The default parentEditNode
to be used when a new EditNode is added to the EditContext without a specified parent.setEditMaskProperties
(Map editMaskProperties) Properties to apply to allEditProxy.editMask
s created for components in edit mode.void
setEditProxyProperties
(EditNode editNode, EditProxy properties) Update an editNode'sEditProxy
properties.setEnableInlineEdit
(Boolean enableInlineEdit) Whether inline editing should be enabled for any components that are added and are placed into editMode.setExtraPalettes
(Palette... extraPalettes) AdditionalPalettes
to consult for metadata when deserializingEdit Nodes
.setHideGroupBorderOnDrag
(Boolean hideGroupBorderOnDrag) Should the group selection box shown whencanGroupSelect
is true be hidden during drag?setHoopSelectionMode
(HoopSelectionStyle hoopSelectionMode) Defines the mode of inclusion for components encountered during hoop selection which is enabled whenselectionType
ismultiple
.setHoopSelectorProperties
(Map hoopSelectorProperties) Properties to apply toEditProxy.hoopSelector
.void
protected void
setNodeProperties
(EditNode editNode, JavaScriptObject properties) protected void
setNodeProperties
(EditNode editNode, JavaScriptObject properties, Boolean skipLiveObjectUpdate) void
setNodeProperties
(EditNode editNode, Canvas properties) Update an editNode's serializable "defaults" with the supplied properties.void
setNodeProperties
(EditNode editNode, Canvas properties, Boolean skipLiveObjectUpdate) Update an editNode's serializable "defaults" with the supplied properties.void
setNodeProperties
(EditNode editNode, DrawItem properties) Update an editNode's serializable "defaults" with the supplied properties.void
setNodeProperties
(EditNode editNode, DrawItem properties, Boolean skipLiveObjectUpdate) Update an editNode's serializable "defaults" with the supplied properties.setPersistCoordinates
(Boolean persistCoordinates) When enabled, changes to aliveObject
's position and size will be persisted to theirEditNodes
by default.setRootComponent
(PaletteNode rootComponent) Root of data to edit.setSelectedAppearance
(SelectedAppearance selectedAppearance) Appearance that is applied to selected component.setSelectedBorder
(String selectedBorder) Set the CSS border to be applied to the selection outline of the selected components.setSelectedLabelBackgroundColor
(String selectedLabelBackgroundColor) The background color for the selection outline label.setSelectedTintColor
(String selectedTintColor) Mask color applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".setSelectedTintOpacity
(int selectedTintOpacity) Opacity applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".setSelectionType
(SelectionStyle selectionType) Defines selection behavior when in edit mode.setShowSelectedLabel
(Boolean showSelectedLabel) Should the selection outline show a label for selected components? A component may also be highlighted with the selection outline and label to indicate the target of a drop.setShowSelectedLabelOnSelect
(Boolean showSelectedLabelOnSelect) Should the selection outline show a label when the component is selected? This property is similar toshowSelectedLabel
.setUseCopyPasteShortcuts
(Boolean useCopyPasteShortcuts) void
substitutedNode
(PaletteNode origNode, PaletteNode newNode, EditNode parentNode) Notification fired when a differentPaletteNode
is substituted for one being dropped into a container.Methods inherited from class com.smartgwt.client.core.BaseClass
addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, asSGWTComponent, clearDynamicProperty, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getRef, getRuleScope, getScClassName, getTestInstance, hasAutoAssignedID, hasDynamicProperty, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, onInit, registerID, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setConfig, setConfigOnly, setFactoryCreated, setID, setProperty, setProperty, setProperty, setProperty, setRuleScope, setScClassName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
-
Constructor Details
-
EditContext
public EditContext() -
EditContext
-
-
Method Details
-
getOrCreateRef
-
setJavaScriptObject
- Overrides:
setJavaScriptObject
in classBaseClass
-
create
-
isCreated
public boolean isCreated() -
getJsObj
-
getOrCreateJsObj
- Overrides:
getOrCreateJsObj
in classBaseClass
-
setAllowDropThrough
Dropping a component near the edge of another component allows the component to be dropped through an ancestor component. To suppress this action setallowDropThrough
to false.- Parameters:
allowDropThrough
- New allowDropThrough value. Default value is null- Returns:
EditContext
instance, for chaining setter calls
-
getAllowDropThrough
Dropping a component near the edge of another component allows the component to be dropped through an ancestor component. To suppress this action setallowDropThrough
to false.- Returns:
- Current allowDropThrough value. Default value is null
-
setAllowNestedDrops
Controls whether components can be dropped into other components which support child components.When enabled, during a drop interaction in which a
PaletteNode
orEditNode
is the drop data, theComponent Schema
of the current candidate drop target is inspected to see whether that parent allows children of the type being dropped. If it does, the drop will result in a call toaddNode()
for a paletteNode or for an existingEditNode
in the same tree.Specific components can disable nested drops by explicitly setting
EditProxy.allowNestedDrops
to false.This mode is enabled by default unless explicitly disabled by setting this property to false.
- Parameters:
allowNestedDrops
- New allowNestedDrops value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getAllowNestedDrops
Controls whether components can be dropped into other components which support child components.When enabled, during a drop interaction in which a
PaletteNode
orEditNode
is the drop data, theComponent Schema
of the current candidate drop target is inspected to see whether that parent allows children of the type being dropped. If it does, the drop will result in a call toaddNode()
for a paletteNode or for an existingEditNode
in the same tree.Specific components can disable nested drops by explicitly setting
EditProxy.allowNestedDrops
to false.This mode is enabled by default unless explicitly disabled by setting this property to false.
- Returns:
- Current allowNestedDrops value. Default value is null
-
setAutoEditNewNodes
New nodes added to the editContext are automatically placed into edit mode if the new node's parent is in edit mode. To suppress this action setautoEditNewNodes
to false.- Parameters:
autoEditNewNodes
- New autoEditNewNodes value. Default value is null- Returns:
EditContext
instance, for chaining setter calls
-
getAutoEditNewNodes
New nodes added to the editContext are automatically placed into edit mode if the new node's parent is in edit mode. To suppress this action setautoEditNewNodes
to false.- Returns:
- Current autoEditNewNodes value. Default value is null
-
setCanDragGroup
Should the group selection box shown whencanGroupSelect
is true allow dragging the group as a whole?Treated as
true
if not set andcanGroupSelect
is true.- Parameters:
canDragGroup
- New canDragGroup value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getCanDragGroup
Should the group selection box shown whencanGroupSelect
is true allow dragging the group as a whole?Treated as
true
if not set andcanGroupSelect
is true.- Returns:
- Current canDragGroup value. Default value is null
-
setCanGroupSelect
Should a group selection outline covering the outermost bounding boxes of all selected components be shown in this container?Treated as
true
if not set and hoop selection is enabled (seeEditProxy.canSelectChildren
andselectionType
.- Parameters:
canGroupSelect
- New canGroupSelect value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getCanGroupSelect
Should a group selection outline covering the outermost bounding boxes of all selected components be shown in this container?Treated as
true
if not set and hoop selection is enabled (seeEditProxy.canSelectChildren
andselectionType
.- Returns:
- Current canGroupSelect value. Default value is null
-
setCanSelectEditNodes
Should editNodes added to this EditContext be selectable? Whentrue
, eachEditProxy.canSelectChildren
property is enabled unless explicitly set tofalse
. This allows an individual component to override this setting.- Parameters:
canSelectEditNodes
- New canSelectEditNodes value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getCanSelectEditNodes
Should editNodes added to this EditContext be selectable? Whentrue
, eachEditProxy.canSelectChildren
property is enabled unless explicitly set tofalse
. This allows an individual component to override this setting.- Returns:
- Current canSelectEditNodes value. Default value is null
-
setDefaultPalette
Palette
to use when anEditNode
is being created directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from aTreePalette
, or clicking onMenuPalette
).If no defaultPalette is provided, the EditContext uses an automatically created
HiddenPalette
.
If this method is called after the component has been drawn/initialized:Palette
to use when anEditNode
is being created directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from aTreePalette
, or clicking onMenuPalette
).If no defaultPalette is provided, the EditContext uses an automatically created
HiddenPalette
.- Parameters:
defaultPalette
- the default Palette. Default value is null- Returns:
EditContext
instance, for chaining setter calls
-
getDefaultPalette
Palette
to use when anEditNode
is being created directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from aTreePalette
, or clicking onMenuPalette
).If no defaultPalette is provided, the EditContext uses an automatically created
HiddenPalette
.- Returns:
Palette
to use when anEditNode
is being created directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from aTreePalette
, or clicking onMenuPalette
).If no defaultPalette is provided, the EditContext uses an automatically created
HiddenPalette
. Default value is null
-
setDefaultParent
The default parentEditNode
to be used when a new EditNode is added to the EditContext without a specified parent. This commonly occurs when a paletteNode is double-clicked in a palette.If not specified, the root editNode (see
getRootEditNode()
) is used.Note: this property is automatically cleared if node is removed from the editTree such as on calls to
destroyAll()
orremoveNode()
.- Parameters:
defaultParent
- New defaultParent value. Default value is null- Returns:
EditContext
instance, for chaining setter calls
-
getDefaultParent
The default parentEditNode
to be used when a new EditNode is added to the EditContext without a specified parent. This commonly occurs when a paletteNode is double-clicked in a palette.If not specified, the root editNode (see
getRootEditNode()
) is used.Note: this property is automatically cleared if node is removed from the editTree such as on calls to
destroyAll()
orremoveNode()
.- Returns:
- Current defaultParent value. Default value is null
-
setEditMaskProperties
Properties to apply to allEditProxy.editMask
s created for components in edit mode. This mask can be modified when the node is selected byselectedBorder
,selectedTintColor
andselectedTintOpacity
depending on theselectedAppearance
setting.- Parameters:
editMaskProperties
- New editMaskProperties value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getEditMaskProperties
Properties to apply to allEditProxy.editMask
s created for components in edit mode. This mask can be modified when the node is selected byselectedBorder
,selectedTintColor
andselectedTintOpacity
depending on theselectedAppearance
setting.- Returns:
- Current editMaskProperties value. Default value is null
-
setEnableInlineEdit
Whether inline editing should be enabled for any components that are added and are placed into editMode. Enabling this will turn on inline edit for any EditProxy whereEditProxy.supportsInlineEdit
is true.- Parameters:
enableInlineEdit
- New enableInlineEdit value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getEnableInlineEdit
Whether inline editing should be enabled for any components that are added and are placed into editMode. Enabling this will turn on inline edit for any EditProxy whereEditProxy.supportsInlineEdit
is true.- Returns:
- Current enableInlineEdit value. Default value is null
-
setExtraPalettes
AdditionalPalettes
to consult for metadata when deserializingEdit Nodes
. Note that thedefaultPalette
is always consulted and need not be provided again here.- Parameters:
extraPalettes
- New extraPalettes value. Default value is null- Returns:
EditContext
instance, for chaining setter calls
-
getExtraPalettes
AdditionalPalettes
to consult for metadata when deserializingEdit Nodes
. Note that thedefaultPalette
is always consulted and need not be provided again here.- Returns:
- Current extraPalettes value. Default value is null
-
setHideGroupBorderOnDrag
public EditContext setHideGroupBorderOnDrag(Boolean hideGroupBorderOnDrag) throws IllegalStateException Should the group selection box shown whencanGroupSelect
is true be hidden during drag?Treated as
true
if not explicitly set to false.- Parameters:
hideGroupBorderOnDrag
- New hideGroupBorderOnDrag value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getHideGroupBorderOnDrag
Should the group selection box shown whencanGroupSelect
is true be hidden during drag?Treated as
true
if not explicitly set to false.- Returns:
- Current hideGroupBorderOnDrag value. Default value is null
-
setHoopSelectionMode
public EditContext setHoopSelectionMode(HoopSelectionStyle hoopSelectionMode) throws IllegalStateException Defines the mode of inclusion for components encountered during hoop selection which is enabled whenselectionType
ismultiple
.encloses
mode causes selection of components that are completely enclosed by the hoop.intersects
mode selects components that come into contact with the hoop.- Parameters:
hoopSelectionMode
- New hoopSelectionMode value. Default value is "encloses"- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getHoopSelectionMode
Defines the mode of inclusion for components encountered during hoop selection which is enabled whenselectionType
ismultiple
.encloses
mode causes selection of components that are completely enclosed by the hoop.intersects
mode selects components that come into contact with the hoop.- Returns:
- Current hoopSelectionMode value. Default value is "encloses"
- See Also:
-
setHoopSelectorProperties
public EditContext setHoopSelectorProperties(Map hoopSelectorProperties) throws IllegalStateException Properties to apply toEditProxy.hoopSelector
.- Parameters:
hoopSelectorProperties
- New hoopSelectorProperties value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getHoopSelectorProperties
Properties to apply toEditProxy.hoopSelector
.- Returns:
- Current hoopSelectorProperties value. Default value is null
-
setPersistCoordinates
When enabled, changes to aliveObject
's position and size will be persisted to theirEditNodes
by default. This applies to both programmatic calls and user interaction (drag reposition or drag resize).This feature can be disabled by either setting this property or
EditProxy.persistCoordinates
tofalse
. This property affects all nodes within the EditContext whereas the latter property affects children of a single node.In some use-cases, like Reify, coordinates should not be persisted except when a component explicitly enables this feature. By setting this property to
null
no component will persist coordinates of children unlessEditProxy.persistCoordinates
is explicitly set totrue
.- Parameters:
persistCoordinates
- New persistCoordinates value. Default value is true- Returns:
EditContext
instance, for chaining setter calls
-
getPersistCoordinates
When enabled, changes to aliveObject
's position and size will be persisted to theirEditNodes
by default. This applies to both programmatic calls and user interaction (drag reposition or drag resize).This feature can be disabled by either setting this property or
EditProxy.persistCoordinates
tofalse
. This property affects all nodes within the EditContext whereas the latter property affects children of a single node.In some use-cases, like Reify, coordinates should not be persisted except when a component explicitly enables this feature. By setting this property to
null
no component will persist coordinates of children unlessEditProxy.persistCoordinates
is explicitly set totrue
.- Returns:
- Current persistCoordinates value. Default value is true
-
setRootComponent
Root of data to edit. Must contain the "type" property, with the name of a validschema
or nothing will be able to be dropped on this EditContext. A "liveObject" property representing the rootComponent is also suggested. Otherwise, a live object will be created from the palette node.Can be retrieved at any time. Use
getRootEditNode()
to retrieve theEditNode
created from the rootComponent.- Parameters:
rootComponent
- New rootComponent value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getRootComponent
Root of data to edit. Must contain the "type" property, with the name of a validschema
or nothing will be able to be dropped on this EditContext. A "liveObject" property representing the rootComponent is also suggested. Otherwise, a live object will be created from the palette node.Can be retrieved at any time. Use
getRootEditNode()
to retrieve theEditNode
created from the rootComponent.- Returns:
- Current rootComponent value. Default value is null
- See Also:
-
setSelectedAppearance
public EditContext setSelectedAppearance(SelectedAppearance selectedAppearance) throws IllegalStateException Appearance that is applied to selected component.This value is applied as a default to
EditProxy.selectedAppearance
.- Parameters:
selectedAppearance
- New selectedAppearance value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getSelectedAppearance
Appearance that is applied to selected component.This value is applied as a default to
EditProxy.selectedAppearance
.- Returns:
- Current selectedAppearance value. Default value is null
- See Also:
-
setSelectedBorder
Set the CSS border to be applied to the selection outline of the selected components. This property is used whenEditProxy.selectedAppearance
isoutlineMask
oroutlineEdges
.This value is applied as a default to
EditProxy.selectedBorder
.- Parameters:
selectedBorder
- New selectedBorder value. Default value is "1px dashed #44ff44"- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getSelectedBorder
Set the CSS border to be applied to the selection outline of the selected components. This property is used whenEditProxy.selectedAppearance
isoutlineMask
oroutlineEdges
.This value is applied as a default to
EditProxy.selectedBorder
.- Returns:
- Current selectedBorder value. Default value is "1px dashed #44ff44"
-
setSelectedLabelBackgroundColor
public EditContext setSelectedLabelBackgroundColor(String selectedLabelBackgroundColor) throws IllegalStateException The background color for the selection outline label. The default is defined onSelectionOutline
.This value is applied as a default to
EditProxy.selectedLabelBackgroundColor
.NOTE: A selected component label is only supported when
EditProxy.selectedAppearance
is "outlineEdges".- Parameters:
selectedLabelBackgroundColor
- New selectedLabelBackgroundColor value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getSelectedLabelBackgroundColor
The background color for the selection outline label. The default is defined onSelectionOutline
.This value is applied as a default to
EditProxy.selectedLabelBackgroundColor
.NOTE: A selected component label is only supported when
EditProxy.selectedAppearance
is "outlineEdges".- Returns:
- Current selectedLabelBackgroundColor value. Default value is null
- See Also:
-
setSelectedTintColor
Mask color applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".This value is applied as a default to
EditProxy.selectedTintColor
.- Parameters:
selectedTintColor
- New selectedTintColor value. Default value is "#cccccc"- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getSelectedTintColor
Mask color applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".This value is applied as a default to
EditProxy.selectedTintColor
.- Returns:
- Current selectedTintColor value. Default value is "#cccccc"
- See Also:
-
setSelectedTintOpacity
Opacity applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".This value is applied as a default to
EditProxy.selectedTintOpacity
.- Parameters:
selectedTintOpacity
- New selectedTintOpacity value. Default value is 25- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created- See Also:
-
getSelectedTintOpacity
public int getSelectedTintOpacity()Opacity applied toeditMask
of selected component whenEditProxy.selectedAppearance
is "tintMask".This value is applied as a default to
EditProxy.selectedTintOpacity
.- Returns:
- Current selectedTintOpacity value. Default value is 25
- See Also:
-
setSelectionType
Defines selection behavior when in edit mode. Only two styles are supported: "single" and "multiple". Multiple enables hoop selection.- Parameters:
selectionType
- New selectionType value. Default value is "multiple"- Returns:
EditContext
instance, for chaining setter calls- See Also:
-
getSelectionType
Defines selection behavior when in edit mode. Only two styles are supported: "single" and "multiple". Multiple enables hoop selection.- Returns:
- Current selectionType value. Default value is "multiple"
- See Also:
-
setShowSelectedLabel
Should the selection outline show a label for selected components? A component may also be highlighted with the selection outline and label to indicate the target of a drop. To suppress showing a label at any time set this property tofalse
.To suppress labels during selection but still show them when targeted for a drop, see
showSelectedLabelOnSelect
.NOTE: A selected component label is only supported when
EditProxy.selectedAppearance
is "outlineEdges".- Parameters:
showSelectedLabel
- New showSelectedLabel value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getShowSelectedLabel
Should the selection outline show a label for selected components? A component may also be highlighted with the selection outline and label to indicate the target of a drop. To suppress showing a label at any time set this property tofalse
.To suppress labels during selection but still show them when targeted for a drop, see
showSelectedLabelOnSelect
.NOTE: A selected component label is only supported when
EditProxy.selectedAppearance
is "outlineEdges".- Returns:
- Current showSelectedLabel value. Default value is null
-
setShowSelectedLabelOnSelect
public EditContext setShowSelectedLabelOnSelect(Boolean showSelectedLabelOnSelect) throws IllegalStateException Should the selection outline show a label when the component is selected? This property is similar toshowSelectedLabel
. WhereasshowSelectedLabel
controls whether a label is shown at any time, this property allows normal selection to suppress the label but still show a label during the drop process on the target. LeaveshowSelectedLabel
unset and set this property tofalse
.NOTE: A selected component label is only supported when
EditProxy.selectedAppearance
is "outlineEdges".- Parameters:
showSelectedLabelOnSelect
- New showSelectedLabelOnSelect value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getShowSelectedLabelOnSelect
Should the selection outline show a label when the component is selected? This property is similar toshowSelectedLabel
. WhereasshowSelectedLabel
controls whether a label is shown at any time, this property allows normal selection to suppress the label but still show a label during the drop process on the target. LeaveshowSelectedLabel
unset and set this property tofalse
.NOTE: A selected component label is only supported when
EditProxy.selectedAppearance
is "outlineEdges".- Returns:
- Current showSelectedLabelOnSelect value. Default value is null
-
setUseCopyPasteShortcuts
public EditContext setUseCopyPasteShortcuts(Boolean useCopyPasteShortcuts) throws IllegalStateException If set, auto-enablesEditProxy.useCopyPasteShortcuts
on theEditProxy
for theroot editNode
. This works whether there is currently a root editNode or one is added later.- Parameters:
useCopyPasteShortcuts
- New useCopyPasteShortcuts value. Default value is null- Returns:
EditContext
instance, for chaining setter calls- Throws:
IllegalStateException
- this property cannot be changed after the underlying component has been created
-
getUseCopyPasteShortcuts
If set, auto-enablesEditProxy.useCopyPasteShortcuts
on theEditProxy
for theroot editNode
. This works whether there is currently a root editNode or one is added later.- Returns:
- Current useCopyPasteShortcuts value. Default value is null
-
addFromPaletteNode
Creates a new EditNode from a PaletteNode, using thedefaultPalette
. If you have an array of possibly inter-related PaletteNodes, then you should useaddFromPaletteNodes()
on the array instead, in order to preserve the relationships.- Parameters:
paletteNode
- the palette node to use to create the new node- Returns:
- the EditNode created from the paletteNode
- See Also:
-
addFromPaletteNode
Creates a new EditNode from a PaletteNode, using thedefaultPalette
. If you have an array of possibly inter-related PaletteNodes, then you should useaddFromPaletteNodes()
on the array instead, in order to preserve the relationships.- Parameters:
paletteNode
- the palette node to use to create the new nodeparentNode
- optional the parent node if the new node should appear under a specific parent- Returns:
- the EditNode created from the paletteNode
- See Also:
-
addFromPaletteNodes
Add the suppliedPaletteNodes
to the parentNode, preserving internal references from one supplied PaletteNode to another. This method should be used with an array of possibly inter-related PaletteNodes (for instance, those produced as a result of serialization viaserializeAllEditNodes()
) rather than callingaddFromPaletteNode()
on each individual PaletteNode.- Parameters:
paletteNodes
- array of PaletteNodes- Returns:
- an array of the EditNodes added to the parentNode
- See Also:
-
addFromPaletteNodes
Add the suppliedPaletteNodes
to the parentNode, preserving internal references from one supplied PaletteNode to another. This method should be used with an array of possibly inter-related PaletteNodes (for instance, those produced as a result of serialization viaserializeAllEditNodes()
) rather than callingaddFromPaletteNode()
on each individual PaletteNode.- Parameters:
paletteNodes
- array of PaletteNodesparentNode
- parent to add to (defaults to the root)- Returns:
- an array of the EditNodes added to the parentNode
- See Also:
-
addFromPaletteNodeTree
Add the suppliedPaletteNode
tree to the parentNode, preserving internal references from one supplied PaletteNode to another.- Parameters:
paletteNodeTree
- tree of PaletteNodes- Returns:
- an array of the EditNodes added to the parentNode
- See Also:
-
addFromPaletteNodeTree
Add the suppliedPaletteNode
tree to the parentNode, preserving internal references from one supplied PaletteNode to another.- Parameters:
paletteNodeTree
- tree of PaletteNodesparentNode
- parent to add to (defaults to the root)- Returns:
- an array of the EditNodes added to the parentNode
- See Also:
-
addNode
Add a newEditNode
to the EditContext, under the specified parent. If the parentNode is not provided it will be determined fromdefaultParent
.The EditContext will interrogate the parent and new nodes to determine what field within the parent allows a child of this type, and to find a method to add the newNode's liveObject to the parentNode's liveObject. The new relationship will then be stored in the tree of EditNodes.
For example, when a Tab is dropped on a TabSet, the field TabSet.tabs is discovered as the correct target field via naming conventions, and the method TabSet.addTab() is likewise discovered as the correct method to add a Tab to a TabSet.
- Parameters:
newNode
- new node to be added- Returns:
- newNodenode added
-
addNode
-
addNode
-
addNode
-
addNode
-
addNode
public EditNode addNode(EditNode newNode, EditNode parentNode, Integer index, String parentProperty, Boolean skipParentComponentAdd, Boolean forceSingularFieldReplace) Add a newEditNode
to the EditContext, under the specified parent. If the parentNode is not provided it will be determined fromdefaultParent
.The EditContext will interrogate the parent and new nodes to determine what field within the parent allows a child of this type, and to find a method to add the newNode's liveObject to the parentNode's liveObject. The new relationship will then be stored in the tree of EditNodes.
For example, when a Tab is dropped on a TabSet, the field TabSet.tabs is discovered as the correct target field via naming conventions, and the method TabSet.addTab() is likewise discovered as the correct method to add a Tab to a TabSet.
- Parameters:
newNode
- new node to be addedparentNode
- parent to add the new node under.index
- index within the parent's children arrayparentProperty
- the property of the liveParent to which the new node should be added, if not auto-discoverable from the schemaskipParentComponentAdd
- whether to skip adding the liveObject to the liveParent (default false)forceSingularFieldReplace
- whether to replace existing single field node if newNode liveObject is the same (default false)- Returns:
- newNodenode added
-
addPaletteNodeFormItemConstructors
AddPaletteNode
constructors for the specific type ofFormItem
that will be created to the paletteNodes in the specified tree created bycreatePaletteNodeTree()
.Normally, the specific FormItem is applied from the DataSource and DataBoundComponent at time of use but there are times when having the explicit constructor on the paletteNodes is helpful such as for validation or serialization.
Note that the paletteNodes are updated in place.
- Parameters:
nodeTree
- tree of PaletteNodes
-
addPaletteNodesFromJS
AddPaletteNodes
from a JavaScript source representation.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
jsCode
- JavaScript code to eval.
-
addPaletteNodesFromJS
- See Also:
-
addPaletteNodesFromJS
AddPaletteNodes
from a JavaScript source representation.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
jsCode
- JavaScript code to eval.parentNode
- parent node (defaults to the root)globals
- widgets to allow to take their global IDs
-
addPaletteNodesFromJSON
RecreateEditNodes
from a JSON representation ofPaletteNodes
(possibly created by callingserializeAllEditNodesAsJSON()
orserializeEditNodesAsJSON()
.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
jsonString
- JSON string representing an array of PaletteNodes- See Also:
-
addPaletteNodesFromJSON
-
addPaletteNodesFromJSON
-
addPaletteNodesFromJSON
public void addPaletteNodesFromJSON(String jsonString, EditNode parentNode, String[] globals, Function callback) RecreateEditNodes
from a JSON representation ofPaletteNodes
(possibly created by callingserializeAllEditNodesAsJSON()
orserializeEditNodesAsJSON()
.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
jsonString
- JSON string representing an array of PaletteNodesparentNode
- parent to add to (defaults to the root)globals
- widgets to allow to take their global IDscallback
- Callback to fire after nodes have been added- See Also:
-
addPaletteNodesFromXML
RecreateEditNodes
from an XML representation ofPaletteNodes
(possibly created by callingserializeAllEditNodes()
orserializeEditNodes()
.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
xmlString
- XML string- See Also:
-
addPaletteNodesFromXML
- See Also:
-
addPaletteNodesFromXML
- See Also:
-
addPaletteNodesFromXML
public void addPaletteNodesFromXML(String xmlString, EditNode parentNode, String[] globals, Function callback) RecreateEditNodes
from an XML representation ofPaletteNodes
(possibly created by callingserializeAllEditNodes()
orserializeEditNodes()
.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
xmlString
- XML stringparentNode
- parent node (defaults to the root)globals
- widgets to allow to take their global IDscallback
- Callback to fire after nodes have been added- See Also:
-
convertedNode
Notification fired when anEditNode
is converted to a different type when moved from one container to another.- Parameters:
origNode
- node that was being movednewNode
- node that was placed into new containerparentNode
- parent node of the drop
-
copyEditNodes
Copies the passed editNode or editNodes to an internal "clipboard" space, for later application viapasteEditNodes()
.- Parameters:
editNode
-
-
copyEditNodes
Copies the passed editNode or editNodes to an internal "clipboard" space, for later application viapasteEditNodes()
.- Parameters:
editNode
-
-
createPaletteNodeTree
Creates aTree
from the suppliedPaletteNodes
preserving internal references from one supplied PaletteNode to another. This method should be used with an array of possibly inter-related PaletteNodes (for instance, those produced as a result of serialization viaserializeAllEditNodes()
) rather than callingaddFromPaletteNode()
on each individual PaletteNode.- Parameters:
paletteNodes
- array of PaletteNodes- Returns:
- a tree of the PaletteNodes
- See Also:
-
deselectAllEditNodes
public void deselectAllEditNodes()Deselect all EditNodes. -
deselectEditNodes
Deselect a list of EditNodes.- Parameters:
editNodes
- editNodes to deselect
-
destroyAll
public void destroyAll() -
addEditMaskClickedHandler
Add a editMaskClicked handler.Executed when the left mouse is clicked (pressed and then released) on any selectable component with
EditProxy.editMask
enabled. implementation.- Specified by:
addEditMaskClickedHandler
in interfaceHasEditMaskClickedHandlers
- Parameters:
handler
- the editMaskClicked handler- Returns:
HandlerRegistration
used to remove this handler
-
editNodeHasDataSource
Does theeditNode
have a DataSource assigned?- Parameters:
editNode
- editNode to check for a DataSource- Returns:
- true if the editNode has a DataSource assigned
-
editNodeHasFields
Does theeditNode
have at least one field assigned?Note that if this method is called for a component editNode that could have child components rather than fields, it will return
true
if there are any child nodes other than a DataSource.- Parameters:
editNode
- editNode to check for fields- Returns:
- true if the editNode has fields or child nodes other than a DataSource
-
addEditNodeUpdatedHandler
Add a editNodeUpdated handler.Fires whenever editNode.defaults are modified by setNodeProperties() and/or editProxy features
- Specified by:
addEditNodeUpdatedHandler
in interfaceHasEditNodeUpdatedHandlers
- Parameters:
handler
- the editNodeUpdated handler- Returns:
HandlerRegistration
used to remove this handler
-
enableEditing
Enable edit mode for anEditNode
. This is a shortcut for callingCanvas.setEditMode()
.- Parameters:
editNode
- the EditNode on which to enable editing- See Also:
-
getEditNodesByType
ReturnsEditNodes
as an array that match the specified type or types. By default thetypes
are matched against theEditNode.type
or the general type of the component. By settingstrict
totrue
the match is made against the editNode type exactly.For example, searching for "Canvas" nodes will return nodes for any component that derives from Canvas unless
strict
is set. In the strict case, the search will only return nodes for explict Canvas nodes.- Parameters:
types
- type or types of nodes to find- Returns:
- the filtered list of EditNodes
-
getEditNodesByType
ReturnsEditNodes
as an array that match the specified type or types. By default thetypes
are matched against theEditNode.type
or the general type of the component. By settingstrict
totrue
the match is made against the editNode type exactly.For example, searching for "Canvas" nodes will return nodes for any component that derives from Canvas unless
strict
is set. In the strict case, the search will only return nodes for explict Canvas nodes.- Parameters:
types
- type or types of nodes to find- Returns:
- the filtered list of EditNodes
-
getEditNodesByType
ReturnsEditNodes
as an array that match the specified type or types. By default thetypes
are matched against theEditNode.type
or the general type of the component. By settingstrict
totrue
the match is made against the editNode type exactly.For example, searching for "Canvas" nodes will return nodes for any component that derives from Canvas unless
strict
is set. In the strict case, the search will only return nodes for explict Canvas nodes.- Parameters:
types
- type or types of nodes to findstrict
- true to match theEditNode.type
exactly- Returns:
- the filtered list of EditNodes
-
getEditNodeTree
Gets the tree of editNodes being edited by this editContext. Standard tree traversal methods can then be used to locate desired editNodes for interaction.Note: the returned tree is read-only and must only be modified by calling methods on EditContext like
addNode()
orsetNodeProperties()
.- Returns:
- the tree of EditNodes
-
getNodeProperty
Returns the specified property from the editNode's serializable "defaults".- Parameters:
editNode
- the editNode to queryname
- the property name to query- See Also:
-
getPaletteNodesFromJS
ObtainPaletteNodes
from a JavaScript source representation.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
jsCode
- JavaScript code to eval.callback
- Callback used to return the PaletteNodes
-
getPaletteNodesFromJS
ObtainPaletteNodes
from a JavaScript source representation.By default, components that have
global IDs
will not actually be allowed to take those global IDs - instead, only widgets that have one of the global IDs passed as theglobals
parameter will actually receive their global IDs. To override this behavior, pass the special valueALL_GLOBALS
for theglobals
parameter.- Parameters:
jsCode
- JavaScript code to eval.callback
- Callback used to return the PaletteNodesglobals
- widgets to allow to take their global IDs
-
getPaletteNodesFromXML
ObtainPaletteNodes
from an XML representation, but do not add them to the EditContext.- Parameters:
xmlString
- XML stringcallback
- Callback used to return the PaletteNodes- See Also:
-
getRootEditNode
Returns the rootEditNode
of the EditContext typically created fromrootComponent
.- Returns:
- the root EditNode
-
getSelectedEditNode
Returns selected EditNode or first selected EditNode if multiple nodes are selected.- Returns:
- the selected or first edit node
-
getSelectedEditNodes
Returns all selected EditNodes as an Array.- Returns:
- the selected edit nodes
-
inlineEditorShowing
Notification method fired when an inline title or value editor is shown or closed for a component in the designer pane.- Parameters:
field
- the field within the inline editor when showing. null if the editor is closed.type
- the type of editor showing: "title" or "value"
-
isEditNodeSelected
public boolean isEditNodeSelected()Returns true if the editNode is selected.- Returns:
- true if editNode is selected; false otherwise
-
isNodeEditingOn
Returns true ifeditNode
is in edit mode.- Parameters:
editNode
- the EditNode- Returns:
- true if node is in edit mode
-
makeEditNode
Creates and returns an EditNode using thedefaultPalette
. Does not add the newly created EditNode to an EditContext.- Parameters:
paletteNode
- the palette node to use to create the new node- Returns:
- the EditNode created from the paletteNode
-
makePaletteNode
Creates aPaletteNode
from anEditNode
in this context'seditNodeTree
.This essentially creates a new
PaletteNode
with theEditNode.defaults
from the passededitNode
. The returnedpaletteNode
could then be used withaddFromPaletteNode()
to effectively create a copy of the original editNode - specifically a new editNode with a newEditNode.liveObject
created from the same defaults.However note that
makePaletteNode()
does not copy descendant nodes - usemakePaletteNodeTree()
for that.May return null if the passed editNode cannot validly by transformed into a paletteNode, for example if
EditNode.canDuplicate
was set false.- Parameters:
editNode
- the editNode to use to make a paletteNode- Returns:
- paletteNode derived from the editNode or null
-
makePaletteNodeTree
Creates aTree
ofPaletteNodes
from anEditNode
in this context'seditNodeTree
, by usingmakePaletteNode()
on the passedEditNode
and its descendents within theeditNodeTree
.The root node of the returned
Tree
will be a PaletteNode derived from the passedEditNode
.- Parameters:
editNode
- root editNode to make Tree of PaletteNodes from- Returns:
- a Tree of paletteNodes or null
-
addNodeAddedHandler
Add a nodeAdded handler.Notification fired when an
EditNode
has been added to the EditContext- Specified by:
addNodeAddedHandler
in interfaceHasNodeAddedHandlers
- Parameters:
handler
- the nodeAdded handler- Returns:
HandlerRegistration
used to remove this handler
-
nodeMoved
public void nodeMoved(EditNode oldNode, EditNode oldParentNode, EditNode newNode, EditNode newParentNode, EditNode rootNode) Notification fired when anEditNode
has been moved to a new position in the component tree.- Parameters:
oldNode
- node that was removedoldParentNode
- parent node of the node that was removednewNode
- node that was addednewParentNode
- parent node of the node that was addedrootNode
- root node of the edit context
-
nodeRemoved
Notification fired when anEditNode
has been removed from the EditContext- Parameters:
removedNode
- node that was removedparentNode
- parent node of the node that was removedrootNode
- root node of the edit context
-
pasteEditNodes
public void pasteEditNodes()"Pastes"editNodes
previously captured viacopyEditNodes()
.New editNodes will be added as root-level nodes of the
editNodeTree
unless atargetEditNode
is passed. -
pasteEditNodes
"Pastes"editNodes
previously captured viacopyEditNodes()
.New editNodes will be added as root-level nodes of the
editNodeTree
unless atargetEditNode
is passed.- Parameters:
targetEditNode
-
-
removeAll
public void removeAll()Removes allEditNodes
from the EditContext, but does not destroy theliveObjects
. -
removeNode
RemovesEditNode
from the EditContext. The editNode liveObject is not destroyed.- Parameters:
editNode
- node to be removed
-
removeNodeProperties
Removes the specified properties from an editNode's serializable "defaults". Note that theliveObject
is not updated by this method. To set a property to null (rather than removing it), usesetNodeProperties()
instead.- Parameters:
editNode
- the editNode to updateproperties
- an array of property names to remove- See Also:
-
selectAllEditNodes
public void selectAllEditNodes()Select all EditNodes. -
addSelectedEditNodesUpdatedHandler
public HandlerRegistration addSelectedEditNodesUpdatedHandler(SelectedEditNodesUpdatedHandler handler) Add a selectedEditNodesUpdated handler.Called when editMode selection changes. Note this method fires exactly once for any given change.
This event is fired once after selection/deselection has completed. The result is one event per mouse-down event. For a drag selection there will be one event fired when the range is completed.
- Specified by:
addSelectedEditNodesUpdatedHandler
in interfaceHasSelectedEditNodesUpdatedHandlers
- Parameters:
handler
- the selectedEditNodesUpdated handler- Returns:
HandlerRegistration
used to remove this handler
-
selectEditNode
Select an EditNode.- Parameters:
editNode
- editNode to select
-
selectSingleEditNode
Select a single EditNode and deselect everything else.- Parameters:
editNode
- editNode to select
-
serializeAllEditNodes
Serialize the tree ofEditNodes
to an XML representation ofPaletteNodes
. The result can be supplied toaddPaletteNodesFromXML()
to recreate the EditNodes.- Returns:
- an XML representation of PaletteNodes which can be used to recreate the tree of EditNodes.
- See Also:
-
serializeAllEditNodes
Serialize the tree ofEditNodes
to an XML representation ofPaletteNodes
. The result can be supplied toaddPaletteNodesFromXML()
to recreate the EditNodes.- Parameters:
settings
- Additional serialization settings- Returns:
- an XML representation of PaletteNodes which can be used to recreate the tree of EditNodes.
- See Also:
-
serializeAllEditNodesAsJSON
Encode the tree ofEditNodes
to a JSON representation ofPaletteNodes
. The result can be supplied toaddPaletteNodesFromJSON()
to recreate the EditNodes.- Returns:
- a JSON representation of PaletteNodes which can be used to recreate the tree of EditNodes.
- See Also:
-
serializeAllEditNodesAsJSON
Encode the tree ofEditNodes
to a JSON representation ofPaletteNodes
. The result can be supplied toaddPaletteNodesFromJSON()
to recreate the EditNodes.- Parameters:
settings
- Additional serialization settings- Returns:
- a JSON representation of PaletteNodes which can be used to recreate the tree of EditNodes.
- See Also:
-
serializeEditNodes
Serialize the providedEditNodes
to an XML representation ofPaletteNodes
. Note that the EditNodes must have been added to this EditContext. The result can be supplied toaddPaletteNodesFromXML()
to recreate the EditNodes.- Parameters:
nodes
- EditNodes to be serialized- Returns:
- an XML representtion of the provided EditNodes
-
serializeEditNodes
Serialize the providedEditNodes
to an XML representation ofPaletteNodes
. Note that the EditNodes must have been added to this EditContext. The result can be supplied toaddPaletteNodesFromXML()
to recreate the EditNodes.- Parameters:
nodes
- EditNodes to be serializedsettings
- Additional serialization settings- Returns:
- an XML representtion of the provided EditNodes
-
serializeEditNodesAsJSON
Serialize the providedEditNodes
to a JSON representation ofPaletteNodes
. Note that the EditNodes must have been added to this EditContext. The result can be supplied toaddPaletteNodesFromJSON()
to recreate the EditNodes.- Parameters:
nodes
- EditNodes to be serialized- Returns:
- a JSON representtion of the provided EditNodes
-
serializeEditNodesAsJSON
Serialize the providedEditNodes
to a JSON representation ofPaletteNodes
. Note that the EditNodes must have been added to this EditContext. The result can be supplied toaddPaletteNodesFromJSON()
to recreate the EditNodes.- Parameters:
nodes
- EditNodes to be serializedsettings
- Additional serialization settings- Returns:
- a JSON representtion of the provided EditNodes
-
setEditProxyProperties
Update an editNode'sEditProxy
properties. If editProxy has not yet been created,editProxyProperties
is updated or created instead.- Parameters:
editNode
- the editNode to updateproperties
- the properties to apply
-
setNodeProperties
Update an editNode's serializable "defaults" with the supplied properties. If you wish to remove a property from the defaults (rather than setting it to null), then useremoveNodeProperties()
instead.- Parameters:
editNode
- the editNode to updateproperties
- the properties to apply- See Also:
-
setNodeProperties
Update an editNode's serializable "defaults" with the supplied properties. If you wish to remove a property from the defaults (rather than setting it to null), then useremoveNodeProperties()
instead.- Parameters:
editNode
- the editNode to updateproperties
- the properties to applyskipLiveObjectUpdate
- whether to skip updating theliveObject
, e.g. if you have already updated the liveObject- See Also:
-
substitutedNode
Notification fired when a differentPaletteNode
is substituted for one being dropped into a container.- Parameters:
origNode
- node that was originally droppednewNode
- node that was substitutedparentNode
- parent node of the drop
-
setNodeProperties
Update an editNode's serializable "defaults" with the supplied properties. If you wish to remove a property from the defaults (rather than setting it to null), then useremoveNodeProperties()
instead.- Parameters:
editNode
- the editNode to updateproperties
- the properties to apply- Throws:
IllegalStateException
- See Also:
-
setNodeProperties
public void setNodeProperties(EditNode editNode, DrawItem properties, Boolean skipLiveObjectUpdate) throws IllegalStateException Update an editNode's serializable "defaults" with the supplied properties. If you wish to remove a property from the defaults (rather than setting it to null), then useremoveNodeProperties()
instead.- Parameters:
editNode
- the editNode to updateproperties
- the properties to applyskipLiveObjectUpdate
- whether to skip updating theliveObject
, e.g. if you have already updated the liveObject- Throws:
IllegalStateException
- See Also:
-
setNodeProperties
-
setNodeProperties
protected void setNodeProperties(EditNode editNode, JavaScriptObject properties, Boolean skipLiveObjectUpdate)
-