Class EventCanvas

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
Direct Known Subclasses:
IndicatorCanvas, ZoneCanvas

public class EventCanvas extends VLayout
The EventCanvas component is a lightweight layout subclass for displaying a CalendarEvent in a CalendarView.

Each instance can be styled, and can render a single area, or separate header and body areas, for the look of a Window.

The component's close and context buttons, and any necessary resizers, are shown on rollover.

  • Constructor Details

    • EventCanvas

      public EventCanvas()
    • EventCanvas

      public EventCanvas(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static EventCanvas 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
    • setBodyStyle

      public EventCanvas setBodyStyle(String bodyStyle)
      CSS class for the body area of the EventCanvas. If unset, defaults to the base styleName with the suffix "Body".
      Parameters:
      bodyStyle - New bodyStyle value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      See Also:
    • getBodyStyle

      public String getBodyStyle()
      CSS class for the body area of the EventCanvas. If unset, defaults to the base styleName with the suffix "Body".
      Returns:
      Current bodyStyle value. Default value is null
      See Also:
    • setCalendar

      public EventCanvas setCalendar(Calendar calendar) throws IllegalStateException
      The Calendar in which this EventCanvas is being rendered.
      Parameters:
      calendar - New calendar value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCalendar

      public Calendar getCalendar()
      The Calendar in which this EventCanvas is being rendered.
      Returns:
      Current calendar value. Default value is null
    • setCalendarView

      public EventCanvas setCalendarView(CalendarView calendarView) throws IllegalStateException
      The CalendarView in which this EventCanvas is being rendered.
      Parameters:
      calendarView - New calendarView value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getCalendarView

      public CalendarView getCalendarView()
      The CalendarView in which this EventCanvas is being rendered.
      Returns:
      Current calendarView value. Default value is null
    • setEscapeHTML

      public EventCanvas setEscapeHTML(Boolean escapeHTML)
      When set to true, escapes the HTML displayed in this EventCanvas and it's hover.
      Parameters:
      escapeHTML - New escapeHTML value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
    • getEscapeHTML

      public Boolean getEscapeHTML()
      When set to true, escapes the HTML displayed in this EventCanvas and it's hover.
      Returns:
      Current escapeHTML value. Default value is null
    • setEvent

      public EventCanvas setEvent(CalendarEvent event) throws IllegalStateException
      The event associated with this EventCanvas.

      If this method is called after the component has been drawn/initialized: Assigns a new event to this EventCanvas, including updates to drag, style and rollover properties.
      Parameters:
      event - the new event to apply to this EventCanvas. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getEvent

      public CalendarEvent getEvent()
      The event associated with this EventCanvas.
      Returns:
      Current event value. Default value is null
    • getGripper

      public Img getGripper() throws IllegalStateException
      When showGripper is true, this is the component that will be rendered adjacent to the canvas and allow the canvas to be moved with the mouse.

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

      Returns:
      Current gripper value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setGripperIcon

      public EventCanvas setGripperIcon(String gripperIcon)
      The source for the icon displayed as the "gripper" that snaps to the top of an event canvas and allows an event to be dragged with the mouse.
      Parameters:
      gripperIcon - New gripperIcon value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      See Also:
    • getGripperIcon

      public String getGripperIcon()
      The source for the icon displayed as the "gripper" that snaps to the top of an event canvas and allows an event to be dragged with the mouse.
      Returns:
      Current gripperIcon value. Default value is null
      See Also:
    • setHeaderHeight

      public EventCanvas setHeaderHeight(Integer headerHeight)
      The height for the header area, when headerWrap is false and showBody is true. If showBody is false, the header area fills the canvas.
      Parameters:
      headerHeight - New headerHeight value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      See Also:
    • getHeaderHeight

      public Integer getHeaderHeight()
      The height for the header area, when headerWrap is false and showBody is true. If showBody is false, the header area fills the canvas.
      Returns:
      Current headerHeight value. Default value is null
      See Also:
    • setHeaderStyle

      public EventCanvas setHeaderStyle(String headerStyle)
      CSS class for the header area of the EventCanvas. If unset, defaults to the base styleName with the suffix "Header".
      Parameters:
      headerStyle - New headerStyle value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      See Also:
    • getHeaderStyle

      public String getHeaderStyle()
      CSS class for the header area of the EventCanvas. If unset, defaults to the base styleName with the suffix "Header".
      Returns:
      Current headerStyle value. Default value is null
      See Also:
    • setHeaderWrap

      public EventCanvas setHeaderWrap(Boolean headerWrap)
      Whether the header area should autosize vertically to display all contents. If true, the header will wrap to multiple lines. If false, the header will be sized according to the specified height, or to the full height of the canvas is showBody is false.
      Parameters:
      headerWrap - New headerWrap value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
      See Also:
    • getHeaderWrap

      public Boolean getHeaderWrap()
      Whether the header area should autosize vertically to display all contents. If true, the header will wrap to multiple lines. If false, the header will be sized according to the specified height, or to the full height of the canvas is showBody is false.
      Returns:
      Current headerWrap value. Default value is null
      See Also:
    • getIsIndicatorCanvas

      public boolean getIsIndicatorCanvas() throws IllegalStateException
      Readonly property dictating whether this is a special IndicatorCanvas subclass.

      Note : This method should be called only after the widget has been rendered.

      Returns:
      Current isIndicatorCanvas value. Default value is false
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • getIsZoneCanvas

      public boolean getIsZoneCanvas() throws IllegalStateException
      Readonly property indicating whether this is a special ZoneCanvas subclass.

      Note : This method should be called only after the widget has been rendered.

      Returns:
      Current isZoneCanvas value. Default value is false
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • getLabel

      public Label getLabel() throws IllegalStateException
      When showLabel is true, this autoChild is used to display the header text, adjacent to this eventCanvas.

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

      Returns:
      Current label value. Default value is null
      Throws:
      IllegalStateException - if this widget has not yet been rendered.
    • setShowBody

      public EventCanvas setShowBody(Boolean showBody)
      Renders a body DIV that fills the main area of the canvas, or all of it if no header is shown. This area typically displays an event description. This area can be styled via bodyStyle and the HTML it shows is retrieved from a call to getBodyHTML(). The default is taken from Calendar.showEventDescriptions.
      Parameters:
      showBody - New showBody value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
    • getShowBody

      public Boolean getShowBody()
      Renders a body DIV that fills the main area of the canvas, or all of it if no header is shown. This area typically displays an event description. This area can be styled via bodyStyle and the HTML it shows is retrieved from a call to getBodyHTML(). The default is taken from Calendar.showEventDescriptions.
      Returns:
      Current showBody value. Default value is null
    • setShowContextButton

      public EventCanvas setShowContextButton(Boolean showContextButton)
      When set to true, shows a small icon in the top corner of an EventCanvas, beside the close-icon. When clicked, shows a context menu containing items applicable to this canvas.
      Parameters:
      showContextButton - New showContextButton value. Default value is false
      Returns:
      EventCanvas instance, for chaining setter calls
    • getShowContextButton

      public Boolean getShowContextButton()
      When set to true, shows a small icon in the top corner of an EventCanvas, beside the close-icon. When clicked, shows a context menu containing items applicable to this canvas.
      Returns:
      Current showContextButton value. Default value is false
    • setShowGripper

      public EventCanvas setShowGripper(Boolean showGripper)
      When set to true, shows the gripper component, which snaps, centered, to the top edge of the eventCanvas and can be used to move it with the mouse.
      Parameters:
      showGripper - New showGripper value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
    • getShowGripper

      public Boolean getShowGripper()
      When set to true, shows the gripper component, which snaps, centered, to the top edge of the eventCanvas and can be used to move it with the mouse.
      Returns:
      Current showGripper value. Default value is null
    • setShowHeader

      public EventCanvas setShowHeader(Boolean showHeader)
      Renders a header DIV above the main body of the event, an area of limited height, styled to stand out from the main body of the event, and typically showing a name or title - like a Window. This header area can be styled via headerStyle and the HTML it shows is retrieved from a call to getHeaderHTML(). The default is taken from Calendar.showEventHeaders.
      Parameters:
      showHeader - New showHeader value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
    • getShowHeader

      public Boolean getShowHeader()
      Renders a header DIV above the main body of the event, an area of limited height, styled to stand out from the main body of the event, and typically showing a name or title - like a Window. This header area can be styled via headerStyle and the HTML it shows is retrieved from a call to getHeaderHTML(). The default is taken from Calendar.showEventHeaders.
      Returns:
      Current showHeader value. Default value is null
    • setShowLabel

      public EventCanvas setShowLabel(Boolean showLabel)
      When set to true, the header text for the associated event is not rendered inside the eventCanvas itself.

      Instead, it is rendered in it's own label and shown as a peer of this eventCanvas, immediately outside of it.

      Parameters:
      showLabel - New showLabel value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
    • getShowLabel

      public Boolean getShowLabel()
      When set to true, the header text for the associated event is not rendered inside the eventCanvas itself.

      Instead, it is rendered in it's own label and shown as a peer of this eventCanvas, immediately outside of it.

      Returns:
      Current showLabel value. Default value is null
    • setShowRolloverControls

      public EventCanvas setShowRolloverControls(Boolean showRolloverControls)
      When set to the default value of true, this attribute causes a set of components to be shown when the mouse rolls over this EventCanvas. These components include the close and context buttons, the latter's context menu and the images used for drag-resizing.

      Using rollover controls is more efficient that showing static buttons in each eventCanvas, so this is the default behavior. See Calendar.useEventCanvasRolloverControls for the alternative.

      Parameters:
      showRolloverControls - New showRolloverControls value. Default value is true
      Returns:
      EventCanvas instance, for chaining setter calls
    • getShowRolloverControls

      public Boolean getShowRolloverControls()
      When set to the default value of true, this attribute causes a set of components to be shown when the mouse rolls over this EventCanvas. These components include the close and context buttons, the latter's context menu and the images used for drag-resizing.

      Using rollover controls is more efficient that showing static buttons in each eventCanvas, so this is the default behavior. See Calendar.useEventCanvasRolloverControls for the alternative.

      Returns:
      Current showRolloverControls value. Default value is true
    • setStyleName

      public void setStyleName(String styleName)
      The CSS class for this EventCanvas. Defaults to the style on eventCanvas.event, if specified, or on the calendar otherwise.

      Also see headerStyle and bodyStyle.

      Overrides:
      setStyleName in class Canvas
      Parameters:
      styleName - New styleName value. Default value is null
      See Also:
    • getStyleName

      public String getStyleName()
      The CSS class for this EventCanvas. Defaults to the style on eventCanvas.event, if specified, or on the calendar otherwise.

      Also see headerStyle and bodyStyle.

      Overrides:
      getStyleName in class Canvas
      Returns:
      Current styleName value. Default value is null
      See Also:
    • setVerticalResize

      public EventCanvas setVerticalResize(Boolean verticalResize)
      Indicates the orientation of the event in its containing view. Affects drag and resize orientation and which edges of the canvas are available for resizing.
      Parameters:
      verticalResize - New verticalResize value. Default value is null
      Returns:
      EventCanvas instance, for chaining setter calls
    • getVerticalResize

      public Boolean getVerticalResize()
      Indicates the orientation of the event in its containing view. Affects drag and resize orientation and which edges of the canvas are available for resizing.
      Returns:
      Current verticalResize value. Default value is null
    • getBodyHTML

      public String getBodyHTML()
      Return the HTML to show in the body of this EventCanvas. The default implementation calls Calendar.getEventBodyHTML(), which returns the value of the description field for the current event.
      Returns:
      HTML to display in the body of the canvas. See HTMLString
      See Also:
    • getHeaderHTML

      public String getHeaderHTML()
      Returns the HTML to show in the header of this EventCanvas. The default implementation returns the name of the current event.
      Returns:
      HTML to display in the header of the canvas. See HTMLString
      See Also:
    • setDefaultProperties

      public static void setDefaultProperties(EventCanvas eventCanvasProperties)
      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:
      eventCanvasProperties - properties that should be used as new defaults when instances of this class are created
      See Also:
    • setLogicalStructure

      public LogicalStructureObject setLogicalStructure(EventCanvasLogicalStructure 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