com.sage.swt.client.widget
Class SwtCaptionPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.sage.swt.client.widget.AbstractSwtWidget
                  extended by com.sage.swt.client.widget.SwtCaptionPanel
All Implemented Interfaces:
com.google.gwt.event.dom.client.HasAllMouseHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasMouseMoveHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers, com.google.gwt.event.dom.client.HasMouseUpHandlers, com.google.gwt.event.dom.client.HasMouseWheelHandlers, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.IsWidget, HasPropertyChangeHandlers, PropertyBag, RestrictDNDChildWidget, HandlesPasteWidget, HasAfterWidgetKeyChangedHandlers, HasBeforeWidgetKeyChangedHandlers, HasDropController, SwtWidget, java.lang.Iterable<com.google.gwt.user.client.ui.Widget>

public class SwtCaptionPanel
extends AbstractSwtWidget
implements com.google.gwt.user.client.ui.HasWidgets, HasDropController, RestrictDNDChildWidget, HandlesPasteWidget

This is the SWT-ized version of GWT's CaptionPanel. It's properties are customizable - so it should be constructed using the SwtWidgetFactory.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
SwtCaptionPanel()
          Default constructor.
SwtCaptionPanel(WidgetKey widgetKey, SwtErrorStack errorStack)
          Constructor.
SwtCaptionPanel(WidgetKey widgetKey, SwtErrorStack errorStack, java.lang.String captionText)
          Constructor.
SwtCaptionPanel(WidgetKey widgetKey, SwtErrorStack errorStack, java.lang.String captionText, com.google.gwt.user.client.ui.Widget widget)
          Constructor.
 
Method Summary
 void add(com.google.gwt.user.client.ui.Widget w)
          
 void addDragDrop(PickupDragController dragController, java.lang.String style)
          Sets up the widget to be used in drag and drop mode drop allowing the user to drop widgets into the widget (as is the case when it is used by the UI Designer).
 void clear()
          
 Caption getCaption()
          Gets the caption for the panel.
 com.google.gwt.user.client.ui.Widget getContentWidget()
          Accesses the content widget, if present.
static WidgetCategory getDesignerCategory()
          Gets the widget's category in the designer.
static ImageBundleMgr.BundledImage getDesignerImage()
          Get the image ENUM that will be used to render a graphic for this widget in the Widget List in UI Designer
static java.lang.String getDesignerTooltip()
          Gets the widget's tooltip in the designer.
static java.lang.String getDesignerTypeName()
          Gets the widget's type name as displayed in the designer.
 java.util.Collection<Property> getProperties()
          Gets the collection of properties contained in this bag.
protected  com.google.gwt.user.client.ui.Widget getWidget()
          Gets the topmost underlying widget that is being wrapped by this SWT widget.
static SwtWidgetCreator getWidgetCreator()
          Returns the widget creator for this widget.
 boolean isAllowDNDWidgetToDrop()
          Returns whether or not the HasWidget allow to add child widget.
 java.util.Iterator<com.google.gwt.user.client.ui.Widget> iterator()
          
 boolean pasteWidget(com.google.gwt.user.client.ui.Widget w)
          Paste the specified widget in the empty position.
 boolean remove(com.google.gwt.user.client.ui.Widget w)
          
 void removeDragDrop()
          Removes drag and drop support from the widget.
 void setCaption(Caption caption)
          Sets the caption for the panel
 void setCaption(java.lang.String text, boolean isHTML)
          Sets the caption for the panel to the specified text.
 void setContentWidget(com.google.gwt.user.client.ui.Widget w)
          Sets or replaces the content widget within the CaptionPanel.
 void setPropertyValue(Property property, java.lang.Object newValue)
          Sets the value of a property.
protected  void setupPropertyDefaultValues()
          Stores the current value of the widget properties as the default values.
 
Methods inherited from class com.sage.swt.client.widget.AbstractSwtWidget
addAfterWidgetKeyChangedHandler, addBeforeWidgetKeyChangedHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addPropertyChangeHandler, changeAlignmentInParent, forceBrowserRepaint, getDatasourceID, getDefaultProperties, getErrorStack, getHelpID, getHorizontalAlignmentInParent, getInstanceContext, getPreferenceBinding, getPreferenceStoreID, getPropertyDefaultValue, getPropertyValue, getSymbolID, getTitle, getVerticalAlignmentInParent, getWidgetHelper, getWidgetKey, isEnabled, isVisible, setClientProperty, setDatasourceID, setDefaultPropertyValue, setElementID, setEnabled, setHelpID, setHorizontalAlignmentInParent, setInstanceContext, setPreferenceBinding, setPreferenceStoreID, setPropertyDefaultValue, setSymbolID, setTitle, setupAlignmentInParentProperties, setupDefaultAlignmentInParentProperties, setupDefaultHeightProperty, setupDefaultWidthProperty, setVerticalAlignmentInParent, setVisible, setWidgetKey
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

SwtCaptionPanel

public SwtCaptionPanel()
Default constructor.


SwtCaptionPanel

public SwtCaptionPanel(WidgetKey widgetKey,
                       SwtErrorStack errorStack)
Constructor. Constructs an SwtCaptionPanel with an empty caption.

Parameters:
widgetKey - The WidgetKey for the widget.
errorStack - The SwtErrorStack that stores the list of UI errors.

SwtCaptionPanel

public SwtCaptionPanel(WidgetKey widgetKey,
                       SwtErrorStack errorStack,
                       java.lang.String captionText)
Constructor. Constructs an SwtCaptionPanel with specified caption text.

Parameters:
widgetKey - The WidgetKey for the widget.
errorStack - The SwtErrorStack that stores the list of UI errors.
captionText - the text of the caption, which is automatically escaped

SwtCaptionPanel

public SwtCaptionPanel(WidgetKey widgetKey,
                       SwtErrorStack errorStack,
                       java.lang.String captionText,
                       com.google.gwt.user.client.ui.Widget widget)
Constructor. Constructs an SwtCaptionPanel with specified caption text and child widget.

Parameters:
widgetKey - The WidgetKey for the widget.
errorStack - The SwtErrorStack that stores the list of UI errors.
captionText - the text of the caption, which is automatically escaped
widget - The child widget (usually a panel) that is enclosed by the caption panel's border.
Method Detail

getWidget

protected com.google.gwt.user.client.ui.Widget getWidget()
Gets the topmost underlying widget that is being wrapped by this SWT widget.

Specified by:
getWidget in class AbstractSwtWidget
Returns:
The topmost underlying widget that is being wrapped by this SWT widget.

getDesignerTypeName

public static java.lang.String getDesignerTypeName()
Gets the widget's type name as displayed in the designer. (For example, a "SpecialButton" class might have "Special Button" as the type name displayed in the designer.)

Returns:
The widget's displayed type name.

getDesignerTooltip

public static java.lang.String getDesignerTooltip()
Gets the widget's tooltip in the designer. (For example, a "SpecialButton" class might have a tooltip of "Button that does something special".)

Returns:
The widget's designer tooltip.

getDesignerImage

public static ImageBundleMgr.BundledImage getDesignerImage()
Get the image ENUM that will be used to render a graphic for this widget in the Widget List in UI Designer

Returns:
The image ENUM

getDesignerCategory

public static WidgetCategory getDesignerCategory()
Gets the widget's category in the designer. The widget's are grouped in widget area with respect to category.

Returns:
The category of the widget.

getWidgetCreator

public static SwtWidgetCreator getWidgetCreator()
Returns the widget creator for this widget.

Returns:
The widget creator for this widget.

addDragDrop

public void addDragDrop(PickupDragController dragController,
                        java.lang.String style)
Sets up the widget to be used in drag and drop mode drop allowing the user to drop widgets into the widget (as is the case when it is used by the UI Designer).

Specified by:
addDragDrop in interface HasDropController
Parameters:
dragController - The dragController for the DND. The widget should call the PickupDragController's registerDropController method to register its DropController class.
style - (optional)Specify the special styling that you want to apply to the widget when it is in dnd mode.

removeDragDrop

public void removeDragDrop()
Removes drag and drop support from the widget. The widget must call the PickupDragController's unregisterDropControler method to unregister its DropController.

Specified by:
removeDragDrop in interface HasDropController

getCaption

public Caption getCaption()
Gets the caption for the panel.

Returns:
The caption for the panel.

setCaption

public void setCaption(java.lang.String text,
                       boolean isHTML)
Sets the caption for the panel to the specified text.

Parameters:
text - The text to display as the panel's caption
isHTML - Whether the text that is specified is HTML

setCaption

public void setCaption(Caption caption)
Sets the caption for the panel

Parameters:
caption - The caption to display in the panel

setPropertyValue

public void setPropertyValue(Property property,
                             java.lang.Object newValue)
Sets the value of a property.

Specified by:
setPropertyValue in interface PropertyBag
Parameters:
property - The property in question.
newValue - The new value of the property.

setupPropertyDefaultValues

protected void setupPropertyDefaultValues()
Stores the current value of the widget properties as the default values. This information is then used when saving the declarative layout to determine whether or not the user has changed the value of that property to something other than the default (if they haven't - then the property is not saved). If there is no default value for a property - and the user changes it to a non-null, non-blank value, then the property will be saved.

The "default value" concept is only applicable for those properties that have an initial (i.e. non-null, non-blank) value. This value can be set automatically by the DOM or by code within the widget.

Properties that are not set to an initial value by the DOM or GWT or the widget programmer, do not belong in this function.

For example: when a widget is first created in the DOM - it has an intrinsic value for the Enabled property (true). Therefore, the Enabled property has a default value of true. The Title property on the other hand does not have an initial value in the DOM - so it does not have a default value, and should not be included in this method.

Note: This function should be called immediately after your widget has been created and its initial properties have been set. Only properties that are not set by parameters in your widget's constructor should be specified here (i.e. optional properties).

Overrides:
setupPropertyDefaultValues in class AbstractSwtWidget

getProperties

public java.util.Collection<Property> getProperties()
Gets the collection of properties contained in this bag.

Specified by:
getProperties in interface PropertyBag
Overrides:
getProperties in class AbstractSwtWidget
Returns:
The collection of properties contained in this bag. Implementors should make sure that this collection is unmodifiable.

add

public void add(com.google.gwt.user.client.ui.Widget w)

Specified by:
add in interface com.google.gwt.user.client.ui.HasWidgets

clear

public void clear()

Specified by:
clear in interface com.google.gwt.user.client.ui.HasWidgets

iterator

public java.util.Iterator<com.google.gwt.user.client.ui.Widget> iterator()

Specified by:
iterator in interface com.google.gwt.user.client.ui.HasWidgets
Specified by:
iterator in interface java.lang.Iterable<com.google.gwt.user.client.ui.Widget>

remove

public boolean remove(com.google.gwt.user.client.ui.Widget w)

Specified by:
remove in interface com.google.gwt.user.client.ui.HasWidgets

getContentWidget

public com.google.gwt.user.client.ui.Widget getContentWidget()
Accesses the content widget, if present.

Returns:
the content widget specified previously in setContentWidget(Widget)

setContentWidget

public void setContentWidget(com.google.gwt.user.client.ui.Widget w)
Sets or replaces the content widget within the CaptionPanel.

Parameters:
w - the content widget to be set

isAllowDNDWidgetToDrop

public boolean isAllowDNDWidgetToDrop()
Returns whether or not the HasWidget allow to add child widget.

Specified by:
isAllowDNDWidgetToDrop in interface RestrictDNDChildWidget
Returns:
Whether or not there is chance to allow child widget.

pasteWidget

public boolean pasteWidget(com.google.gwt.user.client.ui.Widget w)
Paste the specified widget in the empty position.

Specified by:
pasteWidget in interface HandlesPasteWidget
Parameters:
w - The widget to paste
Returns:
Returns the status of the paste action.(true - paste action success, false - widget is not pasted in the selected widget). i.e the specified widget is pasted into the selected widget.


Copyright © 2011 Sage Software, Inc. All rights reserved.