public class EditContext extends BaseClass implements HasEditMaskClickedHandlers, 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.
An EditContext is initialized by setting
rootComponent
.
config, factoryCreated, factoryProperties, id, scClassName
Constructor and Description |
---|
EditContext() |
EditContext(com.google.gwt.core.client.JavaScriptObject jsObj) |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addEditMaskClickedHandler(EditMaskClickedHandler handler)
Add a editMaskClicked handler.
|
EditNode |
addFromPaletteNode(PaletteNode paletteNode)
Creates a new EditNode from a PaletteNode, using the
defaultPalette . |
EditNode |
addFromPaletteNode(PaletteNode paletteNode,
EditNode parentNode)
Creates a new EditNode from a PaletteNode, using the
defaultPalette . |
EditNode[] |
addFromPaletteNodes(PaletteNode[] paletteNodes)
Add the supplied
PaletteNodes to the parentNode, preserving internal
references from one supplied PaletteNode to another. |
EditNode[] |
addFromPaletteNodes(PaletteNode[] paletteNodes,
EditNode parentNode)
Add the supplied
PaletteNodes to the parentNode, preserving internal
references from one supplied PaletteNode to another. |
EditNode |
addNode(EditNode newNode)
Add a new
EditNode to the EditContext, under the specified parent. |
EditNode |
addNode(EditNode newNode,
EditNode parentNode) |
EditNode |
addNode(EditNode newNode,
EditNode parentNode,
java.lang.Integer index) |
EditNode |
addNode(EditNode newNode,
EditNode parentNode,
java.lang.Integer index,
java.lang.String parentProperty) |
EditNode |
addNode(EditNode newNode,
EditNode parentNode,
java.lang.Integer index,
java.lang.String parentProperty,
java.lang.Boolean skipParentComponentAdd)
Add a new
EditNode to the EditContext, under the specified parent. |
com.google.gwt.event.shared.HandlerRegistration |
addNodeAddedHandler(NodeAddedHandler handler)
Add a nodeAdded handler.
|
void |
addPaletteNodesFromJS(java.lang.String jsCode)
Add
PaletteNodes from a JavaScript source representation. |
void |
addPaletteNodesFromJS(java.lang.String jsCode,
EditNode parentNode) |
void |
addPaletteNodesFromJS(java.lang.String jsCode,
EditNode parentNode,
java.lang.String[] globals)
Add
PaletteNodes from a JavaScript source representation. |
void |
addPaletteNodesFromJSON(java.lang.String jsonString)
Recreate
EditNodes from a JSON representation of PaletteNodes (possibly created by calling EditContext.serializeAllEditNodesAsJSON() or EditContext.serializeEditNodesAsJSON() . |
void |
addPaletteNodesFromJSON(java.lang.String jsonString,
EditNode parentNode) |
void |
addPaletteNodesFromJSON(java.lang.String jsonString,
EditNode parentNode,
java.lang.String[] globals) |
void |
addPaletteNodesFromJSON(java.lang.String jsonString,
EditNode parentNode,
java.lang.String[] globals,
Function callback)
Recreate
EditNodes from a JSON representation of PaletteNodes (possibly created by calling EditContext.serializeAllEditNodesAsJSON() or EditContext.serializeEditNodesAsJSON() . |
void |
addPaletteNodesFromXML(java.lang.String xmlString)
Recreate
EditNodes from an XML representation of PaletteNodes (possibly created by calling EditContext.serializeAllEditNodes() or EditContext.serializeEditNodes() . |
void |
addPaletteNodesFromXML(java.lang.String xmlString,
EditNode parentNode) |
void |
addPaletteNodesFromXML(java.lang.String xmlString,
EditNode parentNode,
java.lang.String[] globals) |
void |
addPaletteNodesFromXML(java.lang.String xmlString,
EditNode parentNode,
java.lang.String[] globals,
Function callback)
Recreate
EditNodes from an XML representation of PaletteNodes (possibly created by calling EditContext.serializeAllEditNodes() or EditContext.serializeEditNodes() . |
com.google.gwt.event.shared.HandlerRegistration |
addSelectedEditNodesUpdatedHandler(SelectedEditNodesUpdatedHandler handler)
Add a selectedEditNodesUpdated handler.
|
com.google.gwt.core.client.JavaScriptObject |
create() |
void |
deselectAllEditNodes()
Deselect all EditNodes.
|
void |
deselectEditNodes(java.util.List editNodes)
Deselect a list of EditNodes.
|
void |
destroyAll()
|
void |
enableEditing(EditNode editNode)
Enable edit mode for an
EditNode . |
java.lang.Boolean |
getAllowNestedDrops()
Controls whether components can be dropped into other components which support child components.
|
java.lang.Boolean |
getAutoEditNewNodes()
New nodes added to the editContext are automatically placed into edit mode if the new node's parent is in edit mode.
|
java.lang.Boolean |
getCanDragGroup()
Should the group selection box shown when
canGroupSelect
is true allow dragging the group as a whole? |
java.lang.Boolean |
getCanGroupSelect()
Should a group selection outline covering the outermost bounding boxes of all selected components be shown in this
container?
|
Palette |
getDefaultPalette()
Palette to use when an EditNode is being created
directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from a
TreePalette , or clicking on MenuPalette ). |
EditNode |
getDefaultParent()
The default parent
EditNode to be used when a new EditNode is added to the EditContext
without a specified parent. |
java.util.Map |
getEditMaskProperties()
Properties to apply to all
editMask s created for components in
edit mode. |
Tree |
getEditNodeTree()
Gets the tree of editNodes being edited by this editContext.
|
java.lang.Boolean |
getEnableInlineEdit()
Whether inline editing should be enabled for any components that are added and are placed into editMode.
|
Palette[] |
getExtraPalettes()
Additional
Palettes to consult for metadata when deserializing Edit Nodes . |
java.lang.Boolean |
getHideGroupBorderOnDrag()
Should the group selection box shown when
canGroupSelect
is true be hidden during drag? |
HoopSelectionStyle |
getHoopSelectionMode()
Defines the mode of inclusion for components encountered during hoop selection which is enabled when
selectionType is multiple . |
java.util.Map |
getHoopSelectorProperties()
Properties to apply to
hoopSelector . |
com.google.gwt.core.client.JavaScriptObject |
getJsObj() |
com.google.gwt.core.client.JavaScriptObject |
getOrCreateJsObj() |
static EditContext |
getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj) |
void |
getPaletteNodesFromJS(java.lang.String jsCode,
PaletteNodeCallback callback)
Obtain
PaletteNodes from a JavaScript source representation. |
void |
getPaletteNodesFromJS(java.lang.String jsCode,
PaletteNodeCallback callback,
java.lang.String[] globals)
Obtain
PaletteNodes from a JavaScript source representation. |
void |
getPaletteNodesFromXML(java.lang.String xmlString,
PaletteNodeCallback callback)
Obtain
PaletteNodes from an XML representation, but do not add them to the
EditContext. |
java.lang.Boolean |
getPersistCoordinates()
When enabled, changes to a
liveObject 's position and size will
be persisted to their EditNodes by default. |
PaletteNode |
getRootComponent()
Root of data to edit.
|
EditNode |
getRootEditNode()
Returns the root
EditNode of the EditContext typically created from rootComponent . |
SelectedAppearance |
getSelectedAppearance()
Appearance that is applied to selected component.
|
java.lang.String |
getSelectedBorder()
Set the CSS border to be applied to the selection outline of the selected components.
|
EditNode |
getSelectedEditNode()
Returns selected EditNode or first selected EditNode if multiple nodes are selected.
|
EditNode[] |
getSelectedEditNodes()
Returns all selected EditNodes as an Array.
|
java.lang.String |
getSelectedLabelBackgroundColor()
The background color for the selection outline label.
|
java.lang.String |
getSelectedTintColor()
Mask color applied to
editMask of selected component when selectedAppearance is "tintMask". |
int |
getSelectedTintOpacity()
Opacity applied to
editMask of selected component when selectedAppearance is "tintMask". |
SelectionStyle |
getSelectionType()
Defines selection behavior when in edit mode.
|
java.lang.Boolean |
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.
|
java.lang.Boolean |
getShowSelectedLabelOnSelect()
Should the selection outline show a label when the component is selected? This property is similar to
showSelectedLabel . |
boolean |
isCreated() |
boolean |
isEditNodeSelected()
Returns true if the editNode is selected.
|
boolean |
isNodeEditingOn(EditNode editNode)
Returns true if
editNode is in edit mode. |
EditNode |
makeEditNode(PaletteNode paletteNode)
Creates and returns an EditNode using the
defaultPalette . |
void |
removeAll()
Removes all
EditNodes from the EditContext, but does not destroy the liveObjects . |
void |
removeNode(EditNode editNode)
Removes
EditNode from the EditContext. |
void |
removeNodeProperties(EditNode editNode,
java.lang.String[] properties)
Removes the specified properties from an editNode's serializable "defaults".
|
void |
selectAllEditNodes()
Select all EditNodes.
|
void |
selectEditNode(EditNode editNode)
Select an EditNode.
|
void |
selectSingleEditNode(EditNode editNode)
Select a single EditNode and deselect everything else.
|
java.lang.String |
serializeAllEditNodes()
Serialize the tree of
EditNodes to an XML representation of PaletteNodes . |
java.lang.String |
serializeAllEditNodes(SerializationSettings settings)
Serialize the tree of
EditNodes to an XML representation of PaletteNodes . |
java.lang.String |
serializeAllEditNodesAsJSON()
Encode the tree of
EditNodes to a JSON representation of PaletteNodes . |
java.lang.String |
serializeAllEditNodesAsJSON(SerializationSettings settings)
Encode the tree of
EditNodes to a JSON representation of PaletteNodes . |
java.lang.String |
serializeEditNodes(EditNode[] nodes)
Serialize the provided
EditNodes to an XML representation of PaletteNodes . |
java.lang.String |
serializeEditNodes(EditNode[] nodes,
SerializationSettings settings)
Serialize the provided
EditNodes to an XML representation of PaletteNodes . |
java.lang.String |
serializeEditNodesAsJSON(EditNode[] nodes)
Serialize the provided
EditNodes to a JSON representation of PaletteNodes . |
java.lang.String |
serializeEditNodesAsJSON(EditNode[] nodes,
SerializationSettings settings)
Serialize the provided
EditNodes to a JSON representation of PaletteNodes . |
void |
setAllowNestedDrops(java.lang.Boolean allowNestedDrops)
Controls whether components can be dropped into other components which support child components.
|
void |
setAutoEditNewNodes(java.lang.Boolean autoEditNewNodes)
New nodes added to the editContext are automatically placed into edit mode if the new node's parent is in edit mode.
|
void |
setCanDragGroup(java.lang.Boolean canDragGroup)
Should the group selection box shown when
canGroupSelect
is true allow dragging the group as a whole? |
void |
setCanGroupSelect(java.lang.Boolean canGroupSelect)
Should a group selection outline covering the outermost bounding boxes of all selected components be shown in this
container?
|
void |
setDefaultPalette(Palette defaultPalette)
Palette to use when an EditNode is being created
directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from a
TreePalette , or clicking on MenuPalette ). |
void |
setDefaultParent(EditNode defaultParent)
The default parent
EditNode to be used when a new EditNode is added to the EditContext
without a specified parent. |
void |
setEditMaskProperties(java.util.Map editMaskProperties)
Properties to apply to all
editMask s created for components in
edit mode. |
void |
setEnableInlineEdit(java.lang.Boolean enableInlineEdit)
Whether inline editing should be enabled for any components that are added and are placed into editMode.
|
void |
setExtraPalettes(Palette... extraPalettes)
Additional
Palettes to consult for metadata when deserializing Edit Nodes . |
void |
setHideGroupBorderOnDrag(java.lang.Boolean hideGroupBorderOnDrag)
Should the group selection box shown when
canGroupSelect
is true be hidden during drag? |
void |
setHoopSelectionMode(HoopSelectionStyle hoopSelectionMode)
Defines the mode of inclusion for components encountered during hoop selection which is enabled when
selectionType is multiple . |
void |
setHoopSelectorProperties(java.util.Map hoopSelectorProperties)
Properties to apply to
hoopSelector . |
void |
setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj) |
void |
setNodeProperties(EditNode editNode,
Canvas properties)
Update an editNode's serializable "defaults" with the supplied properties.
|
void |
setNodeProperties(EditNode editNode,
Canvas properties,
java.lang.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,
java.lang.Boolean skipLiveObjectUpdate)
Update an editNode's serializable "defaults" with the supplied properties.
|
protected void |
setNodeProperties(EditNode editNode,
com.google.gwt.core.client.JavaScriptObject properties) |
protected void |
setNodeProperties(EditNode editNode,
com.google.gwt.core.client.JavaScriptObject properties,
java.lang.Boolean skipLiveObjectUpdate) |
void |
setPersistCoordinates(java.lang.Boolean persistCoordinates)
When enabled, changes to a
liveObject 's position and size will
be persisted to their EditNodes by default. |
void |
setRootComponent(PaletteNode rootComponent)
Root of data to edit.
|
void |
setSelectedAppearance(SelectedAppearance selectedAppearance)
Appearance that is applied to selected component.
|
void |
setSelectedBorder(java.lang.String selectedBorder)
Set the CSS border to be applied to the selection outline of the selected components.
|
void |
setSelectedLabelBackgroundColor(java.lang.String selectedLabelBackgroundColor)
The background color for the selection outline label.
|
void |
setSelectedTintColor(java.lang.String selectedTintColor)
Mask color applied to
editMask of selected component when selectedAppearance is "tintMask". |
void |
setSelectedTintOpacity(int selectedTintOpacity)
Opacity applied to
editMask of selected component when selectedAppearance is "tintMask". |
void |
setSelectionType(SelectionStyle selectionType)
Defines selection behavior when in edit mode.
|
void |
setShowSelectedLabel(java.lang.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.
|
void |
setShowSelectedLabelOnSelect(java.lang.Boolean showSelectedLabelOnSelect)
Should the selection outline show a label when the component is selected? This property is similar to
showSelectedLabel . |
applyFactoryProperties, asSGWTComponent, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getRef, getScClassName, getTestInstance, hasAutoAssignedID, internalSetID, internalSetID, 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, setFactoryCreated, setID, setProperty, setProperty, setProperty, setProperty, setScClassName
public EditContext()
public EditContext(com.google.gwt.core.client.JavaScriptObject jsObj)
public static EditContext getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)
public void setJavaScriptObject(com.google.gwt.core.client.JavaScriptObject jsObj)
setJavaScriptObject
in class BaseClass
public com.google.gwt.core.client.JavaScriptObject create()
public com.google.gwt.core.client.JavaScriptObject getJsObj()
public com.google.gwt.core.client.JavaScriptObject getOrCreateJsObj()
getOrCreateJsObj
in class BaseClass
public void setAllowNestedDrops(java.lang.Boolean allowNestedDrops) throws java.lang.IllegalStateException
When enabled,
during a drop interaction in which a PaletteNode
or EditNode
is the drop data, the Component
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 to EditContext.addNode()
for a paletteNode or for an existing EditNode
in the same tree.
Specific components can disable nested drops by explicitly setting allowNestedDrops
to false.
This mode is enabled by default unless explicitly disabled by setting this property to false.
allowNestedDrops
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getAllowNestedDrops()
When enabled,
during a drop interaction in which a PaletteNode
or EditNode
is the drop data, the Component
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 to EditContext.addNode()
for a paletteNode or for an existing EditNode
in the same tree.
Specific components can disable nested drops by explicitly setting allowNestedDrops
to false.
This mode is enabled by default unless explicitly disabled by setting this property to false.
public void setAutoEditNewNodes(java.lang.Boolean autoEditNewNodes)
autoEditNewNodes
to false.autoEditNewNodes
- Default value is nullpublic java.lang.Boolean getAutoEditNewNodes()
autoEditNewNodes
to false.public void setCanDragGroup(java.lang.Boolean canDragGroup) throws java.lang.IllegalStateException
canGroupSelect
is true allow dragging the group as a whole? Treated as true
if not set and canGroupSelect
is true.
canDragGroup
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getCanDragGroup()
canGroupSelect
is true allow dragging the group as a whole? Treated as true
if not set and canGroupSelect
is true.
public void setCanGroupSelect(java.lang.Boolean canGroupSelect) throws java.lang.IllegalStateException
Treated as true
if not set and hoop selection is enabled (see canSelectChildren
and selectionType
.
canGroupSelect
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getCanGroupSelect()
Treated as true
if not set and hoop selection is enabled (see canSelectChildren
and selectionType
.
public void setDefaultPalette(Palette defaultPalette)
Palette
to use when an EditNode
is being created
directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from a
TreePalette
, or clicking on MenuPalette
). 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 an EditNode
is being created directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from a TreePalette
, or clicking on MenuPalette
).
If no defaultPalette is provided, the EditContext uses an automatically created HiddenPalette
.
defaultPalette
- the default Palette. Default value is nullpublic Palette getDefaultPalette()
Palette
to use when an EditNode
is being created
directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from a
TreePalette
, or clicking on MenuPalette
). If no
defaultPalette is provided, the EditContext uses an automatically created HiddenPalette
.
Palette
to use when an EditNode
is being created
directly by this EditContext, instead of being created due to a user interaction with a palette (eg dragging from a
TreePalette
, or clicking on MenuPalette
). If no
defaultPalette is provided, the EditContext uses an automatically created HiddenPalette
.
public void setDefaultParent(EditNode defaultParent)
EditNode
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 EditContext.getRootEditNode()
) is used.
Note: this property is automatically cleared if node is removed from the
editTree such as on calls to EditContext.destroyAll()
or EditContext.removeNode()
.
defaultParent
- Default value is nullpublic EditNode getDefaultParent()
EditNode
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 EditContext.getRootEditNode()
) is used.
Note: this property is automatically cleared if node is removed from the
editTree such as on calls to EditContext.destroyAll()
or EditContext.removeNode()
.
public void setEditMaskProperties(java.util.Map editMaskProperties) throws java.lang.IllegalStateException
editMask
s created for components in
edit mode. This mask can be modified when the node is selected by selectedBorder
, selectedTintColor
and selectedTintOpacity
depending on the selectedAppearance
setting.editMaskProperties
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.util.Map getEditMaskProperties()
editMask
s created for components in
edit mode. This mask can be modified when the node is selected by selectedBorder
, selectedTintColor
and selectedTintOpacity
depending on the selectedAppearance
setting.public void setEnableInlineEdit(java.lang.Boolean enableInlineEdit) throws java.lang.IllegalStateException
supportsInlineEdit
is true.enableInlineEdit
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getEnableInlineEdit()
supportsInlineEdit
is true.public void setExtraPalettes(Palette... extraPalettes)
Palettes
to consult for metadata when deserializing Edit Nodes
. Note that the defaultPalette
is always consulted and need not be provided
again here.extraPalettes
- Default value is nullpublic Palette[] getExtraPalettes()
Palettes
to consult for metadata when deserializing Edit Nodes
. Note that the defaultPalette
is always consulted and need not be provided
again here.public void setHideGroupBorderOnDrag(java.lang.Boolean hideGroupBorderOnDrag) throws java.lang.IllegalStateException
canGroupSelect
is true be hidden during drag? Treated as true
if not explicitly set to false.
hideGroupBorderOnDrag
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getHideGroupBorderOnDrag()
canGroupSelect
is true be hidden during drag? Treated as true
if not explicitly set to false.
public void setHoopSelectionMode(HoopSelectionStyle hoopSelectionMode) throws java.lang.IllegalStateException
selectionType
is multiple
. encloses
mode causes selection of components that are completely enclosed by the hoop. intersects
mode selects
components that come into contact with the hoop.hoopSelectionMode
- Default value is "encloses"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdHoopSelectionStyle
public HoopSelectionStyle getHoopSelectionMode()
selectionType
is multiple
. encloses
mode causes selection of components that are completely enclosed by the hoop. intersects
mode selects
components that come into contact with the hoop.HoopSelectionStyle
public void setHoopSelectorProperties(java.util.Map hoopSelectorProperties) throws java.lang.IllegalStateException
hoopSelector
.hoopSelectorProperties
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.util.Map getHoopSelectorProperties()
hoopSelector
.public void setPersistCoordinates(java.lang.Boolean persistCoordinates)
liveObject
's position and size will
be persisted to their EditNodes
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 persistCoordinates
to false
.
This property affects all nodes within the EditContext whereas the latter property affects children of a single node.
In some use-cases, like VisualBuilder, 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
unless EditProxy.persistCoordinates
is explicitly set to true
.
persistCoordinates
- Default value is truepublic java.lang.Boolean getPersistCoordinates()
liveObject
's position and size will
be persisted to their EditNodes
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 persistCoordinates
to false
.
This property affects all nodes within the EditContext whereas the latter property affects children of a single node.
In some use-cases, like VisualBuilder, 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
unless EditProxy.persistCoordinates
is explicitly set to true
.
public void setRootComponent(PaletteNode rootComponent) throws java.lang.IllegalStateException
schema
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 EditContext.getRootEditNode()
to retrieve the EditNode
created from the
rootComponent.
rootComponent
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdDevTools overview and related methods
public PaletteNode getRootComponent()
schema
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 EditContext.getRootEditNode()
to retrieve the EditNode
created from the
rootComponent.
DevTools overview and related methods
public void setSelectedAppearance(SelectedAppearance selectedAppearance) throws java.lang.IllegalStateException
This value is applied as a default to selectedAppearance
.
selectedAppearance
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdsetSelectedBorder(java.lang.String)
,
setSelectedTintColor(java.lang.String)
,
setSelectedTintOpacity(int)
public SelectedAppearance getSelectedAppearance()
This value is applied as a default to selectedAppearance
.
getSelectedBorder()
,
getSelectedTintColor()
,
getSelectedTintOpacity()
public void setSelectedBorder(java.lang.String selectedBorder) throws java.lang.IllegalStateException
selectedAppearance
is outlineMask
or
outlineEdges
. This value is applied as a default to selectedBorder
.
selectedBorder
- Default value is "1px dashed #44ff44"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.String getSelectedBorder()
selectedAppearance
is outlineMask
or
outlineEdges
. This value is applied as a default to selectedBorder
.
public void setSelectedLabelBackgroundColor(java.lang.String selectedLabelBackgroundColor) throws java.lang.IllegalStateException
SelectionOutline
. This value is applied as a default to selectedLabelBackgroundColor
.
NOTE: A selected
component label is only supported when selectedAppearance
is "outlineEdges".
selectedLabelBackgroundColor
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdsetShowSelectedLabel(java.lang.Boolean)
public java.lang.String getSelectedLabelBackgroundColor()
SelectionOutline
. This value is applied as a default to selectedLabelBackgroundColor
.
NOTE: A selected
component label is only supported when selectedAppearance
is "outlineEdges".
getShowSelectedLabel()
public void setSelectedTintColor(java.lang.String selectedTintColor) throws java.lang.IllegalStateException
editMask
of selected component when selectedAppearance
is "tintMask". This value is applied
as a default to selectedTintColor
.
selectedTintColor
- See CSSColor
. Default value is "#cccccc"java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdsetSelectedTintOpacity(int)
public java.lang.String getSelectedTintColor()
editMask
of selected component when selectedAppearance
is "tintMask". This value is applied
as a default to selectedTintColor
.
CSSColor
getSelectedTintOpacity()
public void setSelectedTintOpacity(int selectedTintOpacity) throws java.lang.IllegalStateException
editMask
of selected component when selectedAppearance
is "tintMask". This value is applied
as a default to selectedTintOpacity
.
selectedTintOpacity
- Default value is 25java.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdsetSelectedTintColor(java.lang.String)
public int getSelectedTintOpacity()
editMask
of selected component when selectedAppearance
is "tintMask". This value is applied
as a default to selectedTintOpacity
.
getSelectedTintColor()
public void setSelectionType(SelectionStyle selectionType)
selectionType
- Default value is "multiple"SelectionStyle
public SelectionStyle getSelectionType()
SelectionStyle
public void setShowSelectedLabel(java.lang.Boolean showSelectedLabel) throws java.lang.IllegalStateException
false
. 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 selectedAppearance
is "outlineEdges".
showSelectedLabel
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getShowSelectedLabel()
false
. 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 selectedAppearance
is "outlineEdges".
public void setShowSelectedLabelOnSelect(java.lang.Boolean showSelectedLabelOnSelect) throws java.lang.IllegalStateException
showSelectedLabel
. Whereas showSelectedLabel
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. Leave showSelectedLabel
unset and set this
property to false
. NOTE: A selected component label is only supported when selectedAppearance
is "outlineEdges".
showSelectedLabelOnSelect
- Default value is nulljava.lang.IllegalStateException
- this property cannot be changed after the underlying component has been createdpublic java.lang.Boolean getShowSelectedLabelOnSelect()
showSelectedLabel
. Whereas showSelectedLabel
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. Leave showSelectedLabel
unset and set this
property to false
. NOTE: A selected component label is only supported when selectedAppearance
is "outlineEdges".
public EditNode addFromPaletteNode(PaletteNode paletteNode)
defaultPalette
. If you have an array of possibly inter-related PaletteNodes, then you should use addFromPaletteNodes()
on the array instead, in order to
preserve the relationships.paletteNode
- the palette node to use to create the new nodeaddFromPaletteNodes(com.smartgwt.client.tools.PaletteNode[])
public EditNode addFromPaletteNode(PaletteNode paletteNode, EditNode parentNode)
defaultPalette
. If you have an array of possibly inter-related PaletteNodes, then you should use addFromPaletteNodes()
on the array instead, in order to
preserve the relationships.paletteNode
- the palette node to use to create the new nodeparentNode
- optional the parent node if the new node should appear under a specific parentaddFromPaletteNodes(com.smartgwt.client.tools.PaletteNode[])
public EditNode[] addFromPaletteNodes(PaletteNode[] paletteNodes)
PaletteNodes
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 via serializeAllEditNodes()
, rather than calling addFromPaletteNode()
on each individual PaletteNode.paletteNodes
- array of PaletteNodesaddFromPaletteNode(com.smartgwt.client.tools.PaletteNode)
public EditNode[] addFromPaletteNodes(PaletteNode[] paletteNodes, EditNode parentNode)
PaletteNodes
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 via serializeAllEditNodes()
, rather than calling addFromPaletteNode()
on each individual PaletteNode.paletteNodes
- array of PaletteNodesparentNode
- parent to add to (defaults to the root)addFromPaletteNode(com.smartgwt.client.tools.PaletteNode)
public EditNode addNode(EditNode newNode)
EditNode
to the EditContext, under the specified parent. If the parentNode
is not provided it will be determined from defaultParent
.
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.
newNode
- new node to be addedpublic EditNode addNode(EditNode newNode, EditNode parentNode, java.lang.Integer index, java.lang.String parentProperty)
public EditNode addNode(EditNode newNode, EditNode parentNode, java.lang.Integer index, java.lang.String parentProperty, java.lang.Boolean skipParentComponentAdd)
EditNode
to the EditContext, under the specified parent. If the parentNode
is not provided it will be determined from defaultParent
.
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.
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)public void addPaletteNodesFromJS(java.lang.String jsCode)
PaletteNodes
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 the globals
parameter
will actually receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
jsCode
- JavaScript code to eval.public void addPaletteNodesFromJS(java.lang.String jsCode, EditNode parentNode)
public void addPaletteNodesFromJS(java.lang.String jsCode, EditNode parentNode, java.lang.String[] globals)
PaletteNodes
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 the globals
parameter
will actually receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
jsCode
- JavaScript code to eval.parentNode
- parent node (defaults to the root)globals
- widgets to allow to take their global IDspublic void addPaletteNodesFromJSON(java.lang.String jsonString)
EditNodes
from a JSON representation of PaletteNodes
(possibly created by calling EditContext.serializeAllEditNodesAsJSON()
or EditContext.serializeEditNodesAsJSON()
. 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 the globals
parameter
will actually receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
jsonString
- JSON stringserializeAllEditNodesAsJSON()
,
serializeEditNodesAsJSON(com.smartgwt.client.tools.EditNode[])
public void addPaletteNodesFromJSON(java.lang.String jsonString, EditNode parentNode)
public void addPaletteNodesFromJSON(java.lang.String jsonString, EditNode parentNode, java.lang.String[] globals)
public void addPaletteNodesFromJSON(java.lang.String jsonString, EditNode parentNode, java.lang.String[] globals, Function callback)
EditNodes
from a JSON representation of PaletteNodes
(possibly created by calling EditContext.serializeAllEditNodesAsJSON()
or EditContext.serializeEditNodesAsJSON()
. 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 the globals
parameter
will actually receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
jsonString
- JSON stringparentNode
- parent node (defaults to the root)globals
- widgets to allow to take their global IDscallback
- Callback to fire after nodes have been addedserializeAllEditNodesAsJSON()
,
serializeEditNodesAsJSON(com.smartgwt.client.tools.EditNode[])
public void addPaletteNodesFromXML(java.lang.String xmlString)
EditNodes
from an XML representation of PaletteNodes
(possibly created by calling EditContext.serializeAllEditNodes()
or EditContext.serializeEditNodes()
. 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 the globals
parameter will actually
receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
xmlString
- XML stringserializeAllEditNodes()
,
serializeEditNodes(com.smartgwt.client.tools.EditNode[])
public void addPaletteNodesFromXML(java.lang.String xmlString, EditNode parentNode)
public void addPaletteNodesFromXML(java.lang.String xmlString, EditNode parentNode, java.lang.String[] globals)
public void addPaletteNodesFromXML(java.lang.String xmlString, EditNode parentNode, java.lang.String[] globals, Function callback)
EditNodes
from an XML representation of PaletteNodes
(possibly created by calling EditContext.serializeAllEditNodes()
or EditContext.serializeEditNodes()
. 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 the globals
parameter will actually
receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
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 addedserializeAllEditNodes()
,
serializeEditNodes(com.smartgwt.client.tools.EditNode[])
public void deselectAllEditNodes()
public void deselectEditNodes(java.util.List editNodes)
editNodes
- editNodes to deselectpublic void destroyAll()
public com.google.gwt.event.shared.HandlerRegistration addEditMaskClickedHandler(EditMaskClickedHandler handler)
Executed when the left mouse is clicked (pressed and then released) on any selectable component with editMask
enabled. implementation.
addEditMaskClickedHandler
in interface HasEditMaskClickedHandlers
handler
- the editMaskClicked handlerHandlerRegistration
used to remove this handlerpublic void enableEditing(EditNode editNode)
EditNode
. This is a shortcut for calling Canvas.setEditMode()
.editNode
- the EditNode on which to enable editingCanvas.setEditMode(boolean)
,
isNodeEditingOn(com.smartgwt.client.tools.EditNode)
public Tree getEditNodeTree()
Note: the returned tree is read-only and must only be modified by calling
methods on EditContext like EditContext.addNode()
or EditContext.setNodeProperties()
.
public void getPaletteNodesFromJS(java.lang.String jsCode, PaletteNodeCallback callback)
PaletteNodes
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 the globals
parameter will actually receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
jsCode
- JavaScript code to eval.callback
- Callback used to return the PaletteNodespublic void getPaletteNodesFromJS(java.lang.String jsCode, PaletteNodeCallback callback, java.lang.String[] globals)
PaletteNodes
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 the globals
parameter will actually receive their global IDs. To override this behavior, pass the special value ALL_GLOBALS
for the globals
parameter.
jsCode
- JavaScript code to eval.callback
- Callback used to return the PaletteNodesglobals
- widgets to allow to take their global IDspublic void getPaletteNodesFromXML(java.lang.String xmlString, PaletteNodeCallback callback)
PaletteNodes
from an XML representation, but do not add them to the
EditContext.xmlString
- XML stringcallback
- Callback used to return the PaletteNodesserializeAllEditNodes()
,
serializeEditNodes(com.smartgwt.client.tools.EditNode[])
public EditNode getRootEditNode()
EditNode
of the EditContext typically created from rootComponent
.public EditNode getSelectedEditNode()
public EditNode[] getSelectedEditNodes()
public boolean isEditNodeSelected()
public boolean isNodeEditingOn(EditNode editNode)
editNode
is in edit mode.editNode
- the EditNodepublic EditNode makeEditNode(PaletteNode paletteNode)
defaultPalette
. Does not add the newly created EditNode to an EditContext.paletteNode
- the palette node to use to create the new nodepublic com.google.gwt.event.shared.HandlerRegistration addNodeAddedHandler(NodeAddedHandler handler)
Notification fired when an EditNode
has been added to the EditContext
addNodeAddedHandler
in interface HasNodeAddedHandlers
handler
- the nodeAdded handlerHandlerRegistration
used to remove this handlerpublic void removeAll()
EditNodes
from the EditContext, but does not destroy the liveObjects
.public void removeNode(EditNode editNode)
EditNode
from the EditContext. The editNode liveObject is not
destroyed.editNode
- node to be removedpublic void removeNodeProperties(EditNode editNode, java.lang.String[] properties)
liveObject
is not updated by this method. To set a property to
null (rather than removing it), use setNodeProperties()
instead.editNode
- the editNode to updateproperties
- an array of property names to removesetNodeProperties(com.smartgwt.client.tools.EditNode, com.smartgwt.client.widgets.Canvas)
public void selectAllEditNodes()
public com.google.gwt.event.shared.HandlerRegistration addSelectedEditNodesUpdatedHandler(SelectedEditNodesUpdatedHandler 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.
addSelectedEditNodesUpdatedHandler
in interface HasSelectedEditNodesUpdatedHandlers
handler
- the selectedEditNodesUpdated handlerHandlerRegistration
used to remove this handlerpublic void selectEditNode(EditNode editNode)
editNode
- editNode to selectpublic void selectSingleEditNode(EditNode editNode)
editNode
- editNode to selectpublic java.lang.String serializeAllEditNodes()
EditNodes
to an XML representation of PaletteNodes
. The result can be supplied to addPaletteNodesFromXML()
to recreate the EditNodes.addPaletteNodesFromXML(java.lang.String)
public java.lang.String serializeAllEditNodes(SerializationSettings settings)
EditNodes
to an XML representation of PaletteNodes
. The result can be supplied to addPaletteNodesFromXML()
to recreate the EditNodes.settings
- Additional serialization settingsaddPaletteNodesFromXML(java.lang.String)
public java.lang.String serializeAllEditNodesAsJSON()
EditNodes
to a JSON representation of PaletteNodes
. The result can be supplied to addPaletteNodesFromJSON()
to recreate the EditNodes.addPaletteNodesFromJSON(java.lang.String)
public java.lang.String serializeAllEditNodesAsJSON(SerializationSettings settings)
EditNodes
to a JSON representation of PaletteNodes
. The result can be supplied to addPaletteNodesFromJSON()
to recreate the EditNodes.settings
- Additional serialization settingsaddPaletteNodesFromJSON(java.lang.String)
public java.lang.String serializeEditNodes(EditNode[] nodes)
EditNodes
to an XML representation of PaletteNodes
. Note that the EditNodes must have been added to this EditContext.
The result can be supplied to addPaletteNodesFromXML()
to recreate the EditNodes.nodes
- EditNodes to be serializedpublic java.lang.String serializeEditNodes(EditNode[] nodes, SerializationSettings settings)
EditNodes
to an XML representation of PaletteNodes
. Note that the EditNodes must have been added to this EditContext.
The result can be supplied to addPaletteNodesFromXML()
to recreate the EditNodes.nodes
- EditNodes to be serializedsettings
- Additional serialization settingspublic java.lang.String serializeEditNodesAsJSON(EditNode[] nodes)
EditNodes
to a JSON representation of PaletteNodes
. Note that the EditNodes must have been added to this EditContext.
The result can be supplied to addPaletteNodesFromJSON()
to recreate the EditNodes.nodes
- EditNodes to be serializedpublic java.lang.String serializeEditNodesAsJSON(EditNode[] nodes, SerializationSettings settings)
EditNodes
to a JSON representation of PaletteNodes
. Note that the EditNodes must have been added to this EditContext.
The result can be supplied to addPaletteNodesFromJSON()
to recreate the EditNodes.nodes
- EditNodes to be serializedsettings
- Additional serialization settingspublic void setNodeProperties(EditNode editNode, Canvas properties)
removeNodeProperties()
instead.editNode
- the editNode to updateproperties
- the properties to applyremoveNodeProperties(com.smartgwt.client.tools.EditNode, java.lang.String[])
public void setNodeProperties(EditNode editNode, Canvas properties, java.lang.Boolean skipLiveObjectUpdate)
removeNodeProperties()
instead.editNode
- the editNode to updateproperties
- the properties to applyskipLiveObjectUpdate
- whether to skip updating the liveObject
, e.g. if you have
already updated the liveObjectremoveNodeProperties(com.smartgwt.client.tools.EditNode, java.lang.String[])
public void setNodeProperties(EditNode editNode, DrawItem properties) throws java.lang.IllegalStateException
removeNodeProperties()
instead.editNode
- the editNode to updateproperties
- the properties to applyjava.lang.IllegalStateException
removeNodeProperties(com.smartgwt.client.tools.EditNode, java.lang.String[])
public void setNodeProperties(EditNode editNode, DrawItem properties, java.lang.Boolean skipLiveObjectUpdate) throws java.lang.IllegalStateException
removeNodeProperties()
instead.editNode
- the editNode to updateproperties
- the properties to applyskipLiveObjectUpdate
- whether to skip updating the liveObject
, e.g. if you have
already updated the liveObjectjava.lang.IllegalStateException
removeNodeProperties(com.smartgwt.client.tools.EditNode, java.lang.String[])
protected void setNodeProperties(EditNode editNode, com.google.gwt.core.client.JavaScriptObject properties)
protected void setNodeProperties(EditNode editNode, com.google.gwt.core.client.JavaScriptObject properties, java.lang.Boolean skipLiveObjectUpdate)