Class CSSEditor

All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, LogicalStructure, HasClearHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragMoveHandlers, HasDragRepositionMoveHandlers, HasDragRepositionStartHandlers, HasDragRepositionStopHandlers, HasDragResizeMoveHandlers, HasDragResizeStartHandlers, HasDragResizeStopHandlers, HasDragStartHandlers, HasDragStopHandlers, HasDropHandlers, HasDropMoveHandlers, HasDropOutHandlers, HasDropOverHandlers, HasFocusChangedHandlers, HasHoverHandlers, HasHoverHiddenHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseStillDownHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasMovedHandlers, HasParentMovedHandlers, HasResizedHandlers, HasRightMouseDownHandlers, HasRuleContextChangedHandlers, HasScrolledHandlers, HasShowContextMenuHandlers, HasVisibilityChangedHandlers, HasMembersChangedHandlers, HasEditCompleteHandlers, HasValuesChangedHandlers

public class CSSEditor extends VLayout implements HasEditCompleteHandlers, HasValuesChangedHandlers
A Layout-based component for editing groups of styling settings. Changes are reflected in a preview canvas and can be retrieved as a block of properties or as a string of CSS text.

Note: this feature requires Smart GWT Enterprise.

  • Constructor Details

    • CSSEditor

      public CSSEditor()
    • CSSEditor

      public CSSEditor(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static CSSEditor getOrCreateRef(JavaScriptObject jsObj)
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, Canvas defaults)
      Changes the defaults for Canvas AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - Canvas defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • changeAutoChildDefaults

      public static void changeAutoChildDefaults(String autoChildName, FormItem defaults)
      Changes the defaults for FormItem AutoChildren named autoChildName.
      Parameters:
      autoChildName - name of an AutoChild to customize the defaults for.
      defaults - FormItem defaults to apply. These defaults override any existing properties without destroying or wiping out non-overridden properties. For usage tips on this param, see SGWTProperties.
      See Also:
    • create

      protected JavaScriptObject create()
      Overrides:
      create in class VLayout
    • setGroups

      public CSSEditor setGroups(StyleGroup... groups)
      The set of StyleGroups to show for editing.

      If this method is called after the component has been drawn/initialized: Set the list of style-groups to display for editing. The parameter can be an array of valid StyleGroups (or objects with at least a "name" property), or a list of the names of predefined groups.
      Parameters:
      groups - array of StyleGroup objects or names. Default value is null
      Returns:
      CSSEditor instance, for chaining setter calls
    • getGroups

      public StyleGroup[] getGroups()
      The set of StyleGroups to show for editing.
      Returns:
      Current groups value. Default value is null
    • setValues

      public CSSEditor setValues(Map values)
      The set of values to apply to editors.
      Parameters:
      values - New values value. Default value is null
      Returns:
      CSSEditor instance, for chaining setter calls
    • getValues

      public Map getValues()
      The set of values to apply to editors.
      Returns:
      Current values value. Default value is null
    • clearGroups

      public void clearGroups()
      Clear the current style-groups from the editor.
    • editCancelled

      public void editCancelled()
      Notification fired when the cancelButton is clicked.
    • addEditCompleteHandler

      public HandlerRegistration addEditCompleteHandler(EditCompleteHandler handler)
      Add a editComplete handler.

      Notification fired when the okButton is clicked.

      Specified by:
      addEditCompleteHandler in interface HasEditCompleteHandlers
      Parameters:
      handler - the editComplete handler
      Returns:
      HandlerRegistration used to remove this handler
    • getCSSProperties

      public Map getCSSProperties()
      Returns the values being edited as a block of CSS properties.
      Returns:
      an ordinary object representing the current values from the editor
    • getCSSText

      public String getCSSText()
      Returns the values being edited as a single string of CSSText.
      Returns:
      string of CSS. See CSSText
    • addValuesChangedHandler

      public HandlerRegistration addValuesChangedHandler(ValuesChangedHandler handler)
      Add a valuesChanged handler.

      Notification fired when values in the editor are changed. The latest values are passed in the values parameter. You can use getCSSText() to retrieve the values as a single piece of CSS-text.

      Specified by:
      addValuesChangedHandler in interface HasValuesChangedHandlers
      Parameters:
      handler - the valuesChanged handler
      Returns:
      HandlerRegistration used to remove this handler
    • setDefaultProperties

      public static void setDefaultProperties(CSSEditor cSSEditorProperties)
      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
      cSSEditorProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(CSSEditorLogicalStructure s)
      Setter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
    • getLogicalStructure

      public LogicalStructureObject getLogicalStructure()
      Getter implementing the LogicalStructure interface, which supports Eclipse's logical structure debugging facility.
      Specified by:
      getLogicalStructure in interface LogicalStructure
      Overrides:
      getLogicalStructure in class VLayout