com.sun.rave.designtime.markup
Class BasicMarkupMouseRegion


java.lang.Object

  extended bycom.sun.rave.designtime.markup.BasicMarkupMouseRegion

All Implemented Interfaces:
DisplayItem, MarkupMouseRegion

public class BasicMarkupMouseRegion
extends java.lang.Object
implements MarkupMouseRegion

A basic implementation of MarkupMouseRegion to use for convenience.

Version:
1.0
Author:
Joe Nuxoll
See Also:
MarkupMouseRegion

Field Summary
protected  java.lang.String description
           
protected  java.lang.String displayName
           
protected  java.lang.String helpKey
           
protected  java.awt.Image largeIcon
           
protected  java.awt.Image smallIcon
           
 
Constructor Summary
BasicMarkupMouseRegion()
           
BasicMarkupMouseRegion(java.lang.String displayName)
           
BasicMarkupMouseRegion(java.lang.String displayName, java.lang.String description)
           
BasicMarkupMouseRegion(java.lang.String displayName, java.lang.String description, java.lang.String helpKey)
           
 
Method Summary
 boolean canLinkBeans(DesignBean targetBean, DesignBean sourceBean, java.lang.Class sourceClass)
          This method is called when an object from a design surface or palette is being dragged 'over' a region represented by this MarkupMouseRegion.
 DisplayAction[] getContextItems()
          Returns an array of DisplayAction objects - used to render a right-click context menu when the user right-clicks on this mouse region.
 java.lang.String getDescription()
          Returns a description for this item.
 java.lang.String getDisplayName()
          Returns a display name for this item.
 java.lang.String getHelpKey()
          Returns the help key for this item.
 java.awt.Image getLargeIcon()
          Returns a large image icon for this item.
 java.awt.Image getSmallIcon()
          Returns a small image icon for this item.
 boolean isClickable()
          Returns true if this markup region wishes to respond to a mouse click (or series of clicks).
 Result linkBeans(DesignBean targetBean, DesignBean sourceBean)
          This method is called when an object from a design surface or palette has been dropped 'on' a region represented by this MarkupMouseRegion (to establish a link).
 Result regionClicked(int clickCount)
          This method is called when a user clicks the mouse within the bounds of this mouse region.
 void setDescription(java.lang.String description)
           
 void setDisplayName(java.lang.String displayName)
           
 void setHelpKey(java.lang.String helpKey)
           
 void setLargeIcon(java.awt.Image largeIcon)
           
 void setSmallIcon(java.awt.Image smallIcon)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description


protected java.lang.String description

displayName


protected java.lang.String displayName

helpKey


protected java.lang.String helpKey

largeIcon


protected java.awt.Image largeIcon

smallIcon


protected java.awt.Image smallIcon
Constructor Detail

BasicMarkupMouseRegion


public BasicMarkupMouseRegion()

BasicMarkupMouseRegion


public BasicMarkupMouseRegion(java.lang.String displayName)

BasicMarkupMouseRegion


public BasicMarkupMouseRegion(java.lang.String displayName,
                              java.lang.String description)

BasicMarkupMouseRegion


public BasicMarkupMouseRegion(java.lang.String displayName,
                              java.lang.String description,
                              java.lang.String helpKey)
Method Detail

canLinkBeans


public boolean canLinkBeans(DesignBean targetBean,
                            DesignBean sourceBean,
                            java.lang.Class sourceClass)
Description copied from interface: MarkupMouseRegion
This method is called when an object from a design surface or palette is being dragged 'over' a region represented by this MarkupMouseRegion. If the 'sourceBean' or 'sourceClass' is of interest to the 'targetBean' instance (they can be "linked"), this method should return true. The user will then be presented with visual cues that this is an appropriate place to 'drop' the item and establish a link. If the user decides to drop the item on this targetBean, the 'linkBeans' method will be called. Note that the 'sourceBean' argument may be null if this drag operation is originating from the palette, because an instance of the bean will not have been created yet.

Specified by:
canLinkBeans in interface MarkupMouseRegion
Parameters:
targetBean - The DesignBean instance that the user is 'hovering' the mouse over
sourceBean - The DesignBean instance that the user may potentially 'drop' to link - may be null if this drag operation originated from the palette, because the instance will not have been created yet
sourceClass - The class type of the object that the user may potentially 'drop' to link
Returns:
true if the 'targetBean' cares to have an instance of type 'sourceClass' linked to it, false if not
See Also:
MarkupMouseRegion.linkBeans(DesignBean, DesignBean)

getContextItems


public DisplayAction[] getContextItems()
Description copied from interface: MarkupMouseRegion
Returns an array of DisplayAction objects - used to render a right-click context menu when the user right-clicks on this mouse region.

Specified by:
getContextItems in interface MarkupMouseRegion
Returns:
An array of DisplayAction objects

getDescription


public java.lang.String getDescription()
Description copied from interface: DisplayItem
Returns a description for this item. This will be used as a tooltip in a menu or on a button, depending on the subinterface.

Specified by:
getDescription in interface DisplayItem
Returns:
A String representing the description for this item.

getDisplayName


public java.lang.String getDisplayName()
Description copied from interface: DisplayItem
Returns a display name for this item. This will be used to show in a menu or as a button label, depending on the subinterface.

Specified by:
getDisplayName in interface DisplayItem
Returns:
A String representing the display name for this item.

getHelpKey


public java.lang.String getHelpKey()
Description copied from interface: DisplayItem
Returns the help key for this item. This is usually a key used to look up a help context item in an online help facility.

Specified by:
getHelpKey in interface DisplayItem
Returns:
A String representing the help key for this item.

getLargeIcon


public java.awt.Image getLargeIcon()
Description copied from interface: DisplayItem
Returns a large image icon for this item. Generally "large" means 32x32 pixels.

Specified by:
getLargeIcon in interface DisplayItem
Returns:
An Image representing the large icon for this item.

getSmallIcon


public java.awt.Image getSmallIcon()
Description copied from interface: DisplayItem
Returns a small image icon for this item. Generally "small" means 16x16 pixels.

Specified by:
getSmallIcon in interface DisplayItem
Returns:
An Image representing the large icon for this item.

isClickable


public boolean isClickable()
Description copied from interface: MarkupMouseRegion
Returns true if this markup region wishes to respond to a mouse click (or series of clicks).

Specified by:
isClickable in interface MarkupMouseRegion
Returns:
true if mouse clicks should be sent to this mouse region, false if not
See Also:
MarkupMouseRegion.regionClicked(int)

linkBeans


public Result linkBeans(DesignBean targetBean,
                        DesignBean sourceBean)
Description copied from interface: MarkupMouseRegion

This method is called when an object from a design surface or palette has been dropped 'on' a region represented by this MarkupMouseRegion (to establish a link). This method will not be called unless the corresponding 'canLinkBeans' method call returned true. Typically, this results in property settings on potentially both of the DesignBean objects.

Specified by:
linkBeans in interface MarkupMouseRegion
Parameters:
targetBean - The target DesignBean instance that the user has 'dropped' an object onto to establish a link
sourceBean - The DesignBean instance that has been 'dropped'
Returns:
A Result object, indicating success or failure and including messages for the user
See Also:
MarkupMouseRegion.canLinkBeans(DesignBean, DesignBean, Class)

regionClicked


public Result regionClicked(int clickCount)
Description copied from interface: MarkupMouseRegion
This method is called when a user clicks the mouse within the bounds of this mouse region. This method is only called if the 'isClickable()' method returns true.

Specified by:
regionClicked in interface MarkupMouseRegion
Parameters:
clickCount - The count of mouse clicks
Returns:
A Result object
See Also:
MarkupMouseRegion.isClickable()

setDescription


public void setDescription(java.lang.String description)

setDisplayName


public void setDisplayName(java.lang.String displayName)

setHelpKey


public void setHelpKey(java.lang.String helpKey)

setLargeIcon


public void setLargeIcon(java.awt.Image largeIcon)

setSmallIcon


public void setSmallIcon(java.awt.Image smallIcon)