Class EditProxy

java.lang.Object
com.smartgwt.client.core.BaseClass
com.smartgwt.client.tools.EditProxy
All Implemented Interfaces:
HasHandlers
Direct Known Subclasses:
CanvasEditProxy, DrawItemEditProxy, FacetChartEditProxy, FormItemEditProxy

public class EditProxy extends BaseClass
An EditProxy is attached to an editable component when editMode is enabled. This proxy has methods and properties which affect the component during editing.
See Also:
  • Constructor Details

    • EditProxy

      public EditProxy()
    • EditProxy

      public EditProxy(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static EditProxy getOrCreateRef(JavaScriptObject jsObj)
    • setJavaScriptObject

      public void setJavaScriptObject(JavaScriptObject jsObj)
      Overrides:
      setJavaScriptObject in class BaseClass
    • create

      public JavaScriptObject create()
      Specified by:
      create in class BaseClass
    • isCreated

      public boolean isCreated()
      Overrides:
      isCreated in class BaseClass
    • getJsObj

      public JavaScriptObject getJsObj()
      Overrides:
      getJsObj in class BaseClass
    • getOrCreateJsObj

      public JavaScriptObject getOrCreateJsObj()
      Overrides:
      getOrCreateJsObj in class BaseClass
    • setAllowNestedDrops

      public EditProxy setAllowNestedDrops(Boolean allowNestedDrops) throws IllegalStateException
      This property acts as a component-specific override for the EditContext.allowNestedDrops property. Unless explicitly set to false, the EditContext.allowNestedDrops controls whether a drop can be made into this component.
      Parameters:
      allowNestedDrops - New allowNestedDrops value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getAllowNestedDrops

      public Boolean getAllowNestedDrops()
      This property acts as a component-specific override for the EditContext.allowNestedDrops property. Unless explicitly set to false, the EditContext.allowNestedDrops controls whether a drop can be made into this component.
      Returns:
      Current allowNestedDrops value. Default value is null
    • setAutoMaskChildren

      public EditProxy setAutoMaskChildren(Boolean autoMaskChildren) throws IllegalStateException
      When child nodes are added to an EditContext, should they be masked by setting useEditMask true if not explicitly set?
      Parameters:
      autoMaskChildren - New autoMaskChildren value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getAutoMaskChildren

      public Boolean getAutoMaskChildren()
      When child nodes are added to an EditContext, should they be masked by setting useEditMask true if not explicitly set?
      Returns:
      Current autoMaskChildren value. Default value is null
    • setBringToFrontOnSelect

      public EditProxy setBringToFrontOnSelect(Boolean bringToFrontOnSelect) throws IllegalStateException
      Should component be brought to front when selected? Applies when useEditMask:true.
      Parameters:
      bringToFrontOnSelect - New bringToFrontOnSelect value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getBringToFrontOnSelect

      public Boolean getBringToFrontOnSelect()
      Should component be brought to front when selected? Applies when useEditMask:true.
      Returns:
      Current bringToFrontOnSelect value. Default value is null
    • setCanSelect

      public EditProxy setCanSelect(Boolean canSelect) throws IllegalStateException
      Can this component be selected? Selection is allowed unless this property is set to false.
      Parameters:
      canSelect - New canSelect value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getCanSelect

      public Boolean getCanSelect()
      Can this component be selected? Selection is allowed unless this property is set to false.
      Returns:
      Current canSelect value. Default value is null
    • setCanSelectChildren

      public EditProxy setCanSelectChildren(Boolean canSelectChildren)
      Whether to allow selection of the children of this EditNode. The appearance and behavior of selected components is controlled by SelectedAppearance, or centrally across an EditContext via EditContext.selectedAppearance.

      Individual children can be marked non-selectable via setting canSelect to false.

      Use the EditContext to access and manipulate the currently selected set of EditNodes, via APIs such as EditContext.getSelectedEditNode(), EditContext.selectSingleEditNode() and EditContext.selectedEditNodesUpdated().

      If this method is called after the component has been drawn/initialized: Setter for canSelectChildren.

      Parameters:
      canSelectChildren - the new canSelectChildren. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      See Also:
    • getCanSelectChildren

      public Boolean getCanSelectChildren()
      Whether to allow selection of the children of this EditNode. The appearance and behavior of selected components is controlled by SelectedAppearance, or centrally across an EditContext via EditContext.selectedAppearance.

      Individual children can be marked non-selectable via setting canSelect to false.

      Use the EditContext to access and manipulate the currently selected set of EditNodes, via APIs such as EditContext.getSelectedEditNode(), EditContext.selectSingleEditNode() and EditContext.selectedEditNodesUpdated().

      Returns:
      Current canSelectChildren value. Default value is null
      See Also:
    • setChildrenSnapResizeToGrid

      public EditProxy setChildrenSnapResizeToGrid(Boolean childrenSnapResizeToGrid)
      If not null the Canvas.childrenSnapResizeToGrid on the component represented by this EditProxy is set to this value only while in edit mode. This allows snapResizeToGrid functionality to be enforced during edit mode but not when live.
      Parameters:
      childrenSnapResizeToGrid - New childrenSnapResizeToGrid value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      See Also:
    • getChildrenSnapResizeToGrid

      public Boolean getChildrenSnapResizeToGrid()
      If not null the Canvas.childrenSnapResizeToGrid on the component represented by this EditProxy is set to this value only while in edit mode. This allows snapResizeToGrid functionality to be enforced during edit mode but not when live.
      Returns:
      Current childrenSnapResizeToGrid value. Default value is null
      See Also:
    • setChildrenSnapToGrid

      public EditProxy setChildrenSnapToGrid(Boolean childrenSnapToGrid)
      If not null the Canvas.childrenSnapToGrid on the component represented by this EditProxy is set to this value only while in edit mode. This allows snapToGrid functionality to be enforced during edit mode but not when live.
      Parameters:
      childrenSnapToGrid - New childrenSnapToGrid value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      See Also:
    • getChildrenSnapToGrid

      public Boolean getChildrenSnapToGrid()
      If not null the Canvas.childrenSnapToGrid on the component represented by this EditProxy is set to this value only while in edit mode. This allows snapToGrid functionality to be enforced during edit mode but not when live.
      Returns:
      Current childrenSnapToGrid value. Default value is null
      See Also:
    • getEditMask

      public Canvas getEditMask() throws IllegalStateException
      An editMask is created for any component placed into editMode with useEditMask:true.

      Common customization properties can be provided by EditContext.editMaskProperties.

      This component is an AutoChild named "editMask". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current editMask value. Default value is null
      Throws:
      IllegalStateException - if the underlying component has not yet been created.
    • getHoopSelector

      public Canvas getHoopSelector() throws IllegalStateException
      Hoop selector canvas used for selecting multiple components.

      Common customization properties can be provided by EditContext.hoopSelectorProperties.

      This component is an AutoChild named "hoopSelector". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current hoopSelector value. Default value is null
      Throws:
      IllegalStateException - if the underlying component has not yet been created.
    • setInlineEditEvent

      public EditProxy setInlineEditEvent(InlineEditEvent inlineEditEvent) throws IllegalStateException
      Event that triggers inline editing, showing the inlineEditForm, which consists of a single text input (single or multi-line according to inlineEditMultiline) shown in the inlineEditForm AutoChild.

      The initial value in the form comes from getInlineEditText() and is applied via setInlineEditText().

      Many EditProxy subclasses have built-in modes for inline editing.

      Parameters:
      inlineEditEvent - New inlineEditEvent value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getInlineEditEvent

      public InlineEditEvent getInlineEditEvent()
      Event that triggers inline editing, showing the inlineEditForm, which consists of a single text input (single or multi-line according to inlineEditMultiline) shown in the inlineEditForm AutoChild.

      The initial value in the form comes from getInlineEditText() and is applied via setInlineEditText().

      Many EditProxy subclasses have built-in modes for inline editing.

      Returns:
      Current inlineEditEvent value. Default value is null
    • getInlineEditForm

      public DynamicForm getInlineEditForm()
      Note : This API is non-functional (always returns null) and exists only to make you aware that this MultiAutoChild exists. See Using AutoChildren for details.

      See inlineEditEvent.

      Returns:
      null
    • getInlineEditInstructionLabel

      public Label getInlineEditInstructionLabel() throws IllegalStateException
      Label AutoChild used to display inlineEditInstructions below the text entry area if provided. Defaults to the same styling as the system Hover.

      This component is an AutoChild named "inlineEditInstructionLabel". For an overview of how to use and configure AutoChildren, see Using AutoChildren.

      Returns:
      Current inlineEditInstructionLabel value. Default value is null
      Throws:
      IllegalStateException - if the underlying component has not yet been created.
    • setInlineEditInstructions

      public EditProxy setInlineEditInstructions(String inlineEditInstructions) throws IllegalStateException
      Instructions that appear below the text entry area if inline editing is enabled. See inlineEditEvent and inlineEditInstructionLabel.
      Parameters:
      inlineEditInstructions - New inlineEditInstructions value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
      See Also:
    • getInlineEditInstructions

      public String getInlineEditInstructions()
      Instructions that appear below the text entry area if inline editing is enabled. See inlineEditEvent and inlineEditInstructionLabel.
      Returns:
      Current inlineEditInstructions value. Default value is null
      See Also:
    • setInlineEditMultiline

      public EditProxy setInlineEditMultiline(Boolean inlineEditMultiline) throws IllegalStateException
      Whether inline editing should be single or multi-line.

      Single-line input appears at the control's top-left corner, multiline covers the control.

      Parameters:
      inlineEditMultiline - New inlineEditMultiline value. Default value is false
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getInlineEditMultiline

      public Boolean getInlineEditMultiline()
      Whether inline editing should be single or multi-line.

      Single-line input appears at the control's top-left corner, multiline covers the control.

      Returns:
      Current inlineEditMultiline value. Default value is false
    • setInlineEditOnDrop

      public EditProxy setInlineEditOnDrop(Boolean inlineEditOnDrop) throws IllegalStateException
      Should the inline editor be shown when new component is first dropped?
      Parameters:
      inlineEditOnDrop - New inlineEditOnDrop value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getInlineEditOnDrop

      public Boolean getInlineEditOnDrop()
      Should the inline editor be shown when new component is first dropped?
      Returns:
      Current inlineEditOnDrop value. Default value is null
    • setPersistCoordinates

      public EditProxy setPersistCoordinates(Boolean persistCoordinates)
      Changes to all child liveObject's position and size can be persisted to their EditNodes based on this attribute setting and EditContext.persistCoordinates. This applies to both programmatic calls and user interaction (drag reposition or drag resize).

      The default value of null allows EditContext.persistCoordinates to control all coordinate persistence. An explicit value of false overrides the EditContext setting so that no children of the component save coordinates.

      All coordinate persisting can be disabled with EditContext.persistCoordinates. Additionally, all control of persistence can be deferred to each EditProxy by setting EditContext.persistCoordinates to null.

      Parameters:
      persistCoordinates - New persistCoordinates value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
    • getPersistCoordinates

      public Boolean getPersistCoordinates()
      Changes to all child liveObject's position and size can be persisted to their EditNodes based on this attribute setting and EditContext.persistCoordinates. This applies to both programmatic calls and user interaction (drag reposition or drag resize).

      The default value of null allows EditContext.persistCoordinates to control all coordinate persistence. An explicit value of false overrides the EditContext setting so that no children of the component save coordinates.

      All coordinate persisting can be disabled with EditContext.persistCoordinates. Additionally, all control of persistence can be deferred to each EditProxy by setting EditContext.persistCoordinates to null.

      Returns:
      Current persistCoordinates value. Default value is null
    • setSelectedAppearance

      public EditProxy setSelectedAppearance(SelectedAppearance selectedAppearance) throws IllegalStateException
      Appearance that is applied to selected component. Default value is determined from EditContext.selectedAppearance.

      When value is null the appearance is determined by:

      • If multiple selection is enabled, "tintMask" is used
      • Otherwise, "outlineMask" is used
      Parameters:
      selectedAppearance - New selectedAppearance value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
      See Also:
    • getSelectedAppearance

      public SelectedAppearance getSelectedAppearance()
      Appearance that is applied to selected component. Default value is determined from EditContext.selectedAppearance.

      When value is null the appearance is determined by:

      • If multiple selection is enabled, "tintMask" is used
      • Otherwise, "outlineMask" is used
      Returns:
      Current selectedAppearance value. Default value is null
      See Also:
    • setSelectedBorder

      public EditProxy setSelectedBorder(String selectedBorder) throws IllegalStateException
      Set the CSS border to be applied to the selection outline of the selected components. Default value is determined from EditContext.selectedBorder. This property is used when selectedAppearance is outlineMask or outlineEdges.
      Parameters:
      selectedBorder - New selectedBorder value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getSelectedBorder

      public String getSelectedBorder()
      Set the CSS border to be applied to the selection outline of the selected components. Default value is determined from EditContext.selectedBorder. This property is used when selectedAppearance is outlineMask or outlineEdges.
      Returns:
      Current selectedBorder value. Default value is null
    • setSelectedLabelBackgroundColor

      public EditProxy setSelectedLabelBackgroundColor(String selectedLabelBackgroundColor) throws IllegalStateException
      The background color for the selection outline label. The default is defined on SelectionOutline or EditContext.selectedLabelBackgroundColor.

      NOTE: A selected component label is only supported when selectedAppearance is "outlineEdges".

      Parameters:
      selectedLabelBackgroundColor - New selectedLabelBackgroundColor value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getSelectedLabelBackgroundColor

      public String getSelectedLabelBackgroundColor()
      The background color for the selection outline label. The default is defined on SelectionOutline or EditContext.selectedLabelBackgroundColor.

      NOTE: A selected component label is only supported when selectedAppearance is "outlineEdges".

      Returns:
      Current selectedLabelBackgroundColor value. Default value is null
    • setSelectedTintColor

      public EditProxy setSelectedTintColor(String selectedTintColor) throws IllegalStateException
      Mask color applied to editMask of selected component when selectedAppearance is "tintMask". Default value is determined from EditContext.selectedTintColor.
      Parameters:
      selectedTintColor - New selectedTintColor value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
      See Also:
    • getSelectedTintColor

      public String getSelectedTintColor()
      Mask color applied to editMask of selected component when selectedAppearance is "tintMask". Default value is determined from EditContext.selectedTintColor.
      Returns:
      Current selectedTintColor value. Default value is null
      See Also:
    • setSelectedTintOpacity

      public EditProxy setSelectedTintOpacity(Integer selectedTintOpacity) throws IllegalStateException
      Opacity applied to editMask of selected component when selectedAppearance is "tintMask".
      Parameters:
      selectedTintOpacity - New selectedTintOpacity value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
      See Also:
    • getSelectedTintOpacity

      public Integer getSelectedTintOpacity()
      Opacity applied to editMask of selected component when selectedAppearance is "tintMask".
      Returns:
      Current selectedTintOpacity value. Default value is null
      See Also:
    • setShowDragHandle

      public EditProxy setShowDragHandle(Boolean showDragHandle) throws IllegalStateException
      Should drag handles or thumb be shown when this component is selected? These are shown unless this property is set to false.
      Parameters:
      showDragHandle - New showDragHandle value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getShowDragHandle

      public Boolean getShowDragHandle()
      Should drag handles or thumb be shown when this component is selected? These are shown unless this property is set to false.
      Returns:
      Current showDragHandle value. Default value is null
    • setSupportsInlineEdit

      public EditProxy setSupportsInlineEdit(Boolean supportsInlineEdit) throws IllegalStateException
      Whether this EditProxy has an inline edit behavior, which allows an end user to configure a component by editing a simple text representation of its configuration.

      For example, when inline edit is enabled, a SelectItem allows editing its valueMap as a comma-separated string, and a ListGrid's columns and data can be edited as several lines of comma-separated headings and data values.

      See inlineEditEvent for more details and configuration options.

      Parameters:
      supportsInlineEdit - New supportsInlineEdit value. Default value is true
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getSupportsInlineEdit

      public Boolean getSupportsInlineEdit()
      Whether this EditProxy has an inline edit behavior, which allows an end user to configure a component by editing a simple text representation of its configuration.

      For example, when inline edit is enabled, a SelectItem allows editing its valueMap as a comma-separated string, and a ListGrid's columns and data can be edited as several lines of comma-separated headings and data values.

      See inlineEditEvent for more details and configuration options.

      Returns:
      Current supportsInlineEdit value. Default value is true
    • setUseCopyPasteShortcuts

      public EditProxy setUseCopyPasteShortcuts(Boolean useCopyPasteShortcuts) throws IllegalStateException
      Whether to enable keyboard shortcuts to copy and paste editNodes.

      Enabled by default if selection of children is also enabled.

      For pasting, if EditContext.allowNestedDrops is enabled, only one editNode is selected and it is a valid container for the contents of the clipboard, editNodes will be pasted as new children of the selected container. Otherwise, they will be pasted at the root level of the editNodeTree.

      useCopyPasteShortcuts may only be set on the root editNode within any one editNodeTree.

      Parameters:
      useCopyPasteShortcuts - New useCopyPasteShortcuts value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getUseCopyPasteShortcuts

      public Boolean getUseCopyPasteShortcuts()
      Whether to enable keyboard shortcuts to copy and paste editNodes.

      Enabled by default if selection of children is also enabled.

      For pasting, if EditContext.allowNestedDrops is enabled, only one editNode is selected and it is a valid container for the contents of the clipboard, editNodes will be pasted as new children of the selected container. Otherwise, they will be pasted at the root level of the editNodeTree.

      useCopyPasteShortcuts may only be set on the root editNode within any one editNodeTree.

      Returns:
      Current useCopyPasteShortcuts value. Default value is null
    • setUseEditMask

      public EditProxy setUseEditMask(Boolean useEditMask) throws IllegalStateException
      When true an editMask will be auto-generated and placed over the component to allow selection, positioning and resizing.

      If this property is not set it will enabled when added to an EditContext if its parent component has an editProxy and autoMaskChildren is true.

      Parameters:
      useEditMask - New useEditMask value. Default value is null
      Returns:
      EditProxy instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the underlying component has been created
    • getUseEditMask

      public Boolean getUseEditMask()
      When true an editMask will be auto-generated and placed over the component to allow selection, positioning and resizing.

      If this property is not set it will enabled when added to an EditContext if its parent component has an editProxy and autoMaskChildren is true.

      Returns:
      Current useEditMask value. Default value is null
    • getInlineEditText

      public void getInlineEditText()
      Returns the text based on the current component state to be edited inline. Called by the inlineEditForm to obtain the starting edit value.

      For a canvas with isGroup enabled, the groupTitle is returned. Otherwise the contents is returned.

    • setInlineEditText

      public void setInlineEditText(String newValue)
      Save the new value into the component's state. Called by the inlineEditForm to commit the change.

      For a canvas with isGroup enabled, the groupTitle is updated. Otherwise the contents is updated.

      Parameters:
      newValue - the new component state
    • showSelectedAppearance

      public void showSelectedAppearance(boolean show)
      This method applies the selectedAppearance to the selected component or resets it to the non-selected appearance. Override this method to create a custom appearance.
      Parameters:
      show - true to show component as selected, false otherwise
    • startInlineEditing

      public void startInlineEditing()
      Manual means of triggering inline editing. See InlineEditEvent.
    • startInlineEditing

      public void startInlineEditing(String appendChar)
      Manual means of triggering inline editing. See InlineEditEvent.
      Parameters:
      appendChar - optional String to append to current value as editing starts