Rational Developer for Power Systems Software
V7.6

com.ibm.etools.systems.application.visual.editor.ui.figures.impl
Class BinaryContainerFigure

java.lang.Object
  extended by NodeFigure
      extended by com.ibm.etools.systems.application.visual.editor.ui.figures.impl.AbstractFeedbackNodeFigure
          extended by com.ibm.etools.systems.application.visual.editor.ui.figures.impl.AbstractCollapsableFigure
              extended by com.ibm.etools.systems.application.visual.editor.ui.figures.impl.BinaryContainerFigure
All Implemented Interfaces:
ICollapsableArtifactFigure, IFeedbackFigure, INamedFigure

public class BinaryContainerFigure
extends AbstractCollapsableFigure
implements INamedFigure

Default containment figure for BinaryArtifact of Application Diagram. Logically, this composite figure has following children figures: 1. ShapeTitleLabel to display the shape title text. 2. Shape image to represent the model type. 3. A set of resizable compartment figures to render the children of BinaryArtifact, ie, modules. 4. A collapse toggle image to toggle collapse / expand state of the figure. These children figures are organized as two subpanes. ShapeTitlePane: hold ShapeTitleLabel ShapeChildrenPane: hold resizable compartment figures. This pane is also used as the contentPane of the BinaryContainerFigure, in order for the model children figures to be added into it. The shape image and collapse toggle image will be drawn directly in paintFigure instead of being separate figures. The positions of each child figures follow the media design blueprints.


Field Summary
 int arcHeight_inner
           
 int arcHeight_outer
           
 int arcWidth_inner
           
 int arcWidth_outer
           
 Color background_gradient
           
 int childrenPane_top_padding
           
 Image collapsedTwistieImage
           
 int collapseImage_height
           
 int collapseImage_shiftX
           
 int collapseImage_shiftY
           
 int collapseImage_width
           
 int collapseLine_fill_gap
           
 int collapseLine_gap
           
 Rectangle collapseTwistieArea
           
static String copyright
           
 RGB defaultInnerLineColor
           
 RGB defaultOuterLineColor
           
 Image expandTwistieImage
           
 Color foreground_gradient
           
 int inner_item_gap
           
 int max_outer_borderline_width
           
 int min_childrenPane_height
           
 int min_childrenPane_width
           
 int outer_inner_bottom_gap
           
 int outer_inner_left_gap
           
 int outer_inner_right_gap
           
 int outer_inner_top_gap
           
 int outerBorderLineStyle
           
 int outerBorderLineWidth
           
 int outerRectangle_shiftX
           
 int outerRectangle_shiftY
           
 int shapeImage_height
           
 int shapeImage_width
           
 int titleLabel_left_padding
           
 int titleLabel_right_padding
           
 int titleLabel_top_padding
           
 
Fields inherited from class com.ibm.etools.systems.application.visual.editor.ui.figures.impl.AbstractCollapsableFigure
hasCollapsedFigure
 
Fields inherited from class com.ibm.etools.systems.application.visual.editor.ui.figures.impl.AbstractFeedbackNodeFigure
editPart, feedbackStateManager, mapMode
 
Fields inherited from interface com.ibm.etools.systems.application.visual.editor.ui.figures.IFeedbackFigure
STATE_ASSOCIATED_CLEAR, STATE_ASSOCIATED_SOURCE, STATE_ASSOCIATED_TARGET, STATE_HOVER, STATE_NONE, STATE_SELECTED, STATE_TARGET, STATE_TARGET_HOVER
 
Constructor Summary
BinaryContainerFigure(Image shapeImage, String shapeTitle, IMapMode mapMode, IGraphicalEditPart editPart)
          Creat a container figure.
 
Method Summary
protected  void changeCollapseState(boolean collapsed)
          Change collpase state of figure.
 void cleanUp()
          Clean up resources.
 void collapse()
           
protected  void drawOuterBorder(Graphics graphics, Rectangle outRect, String feedbackState)
          Draw outer border for this figure according to the current state.
 void expand()
           
protected  IFigure getChildrenPane()
          Get children Pane.
protected  Rectangle getCollapseIconArea()
          Return the rectangle where collapsable toggler icon is.
protected  Rectangle getCollapseTwistieArea()
          Return collapse twistie area.
 IFigure getContentPane()
          Get content pane
 Rectangle getFeedbackFigureBounds()
          Return feedback figure bound.
 Rectangle getHandleBounds()
          Returns the Rectangle around which handles are to be placed.
protected  IconRetriever getIconRetriever()
          Get icon retriever.
protected  Image getImage(String id, String size)
          Get image.
 WrappingLabel getNameLabel()
          Get name label.
protected  IFigure getTitlePane()
          Get title Pane.
protected  Image getTwistieImage(boolean isCollapsed)
          Return collapse twistie image.
protected  void init()
          Initialize the figure.
 void invalidate()
           
 boolean isInCollapseTwistieArea(Point currentMousePoint)
          Return true if current mouse points to collapse twistie area.
 boolean needTwistie()
           
protected  void paintCollapseImageArea(Rectangle collapseImgRect, Graphics graphics)
          Paint toggle area.
protected  void paintFigure(Graphics graphics)
          Paint figure.
 boolean requireCollapseableTwistie()
          Return true if there is at least two collapseable children figures, false otherwise.
 void setFillColor(RGB shapeFillRGB)
          Set fill color
 void setFont(Font newFont)
          Set the font.
 void setFontColor(Color color)
          Set Font color.
 void setForegroundColor(Color color)
          Set ForegroundColor.
 void setGradientBackgroundColor(Color backgroundColor)
          Set background color for gradient
 void setGradientForegroundColor(Color foregroundColor)
          Set foreground color for gradient
 void setInnerLineColor(RGB innerLineRGB)
          Set line color that is used in inner rectangle border.
 void setOutBorderLineStyle(int lineStyle)
          Set line style of outer border
 void setOutBorderLineWidth(int lineWidth)
          Set line style of outer border
 void setOutLineColor(RGB outerLineRGB)
          Set line color that is used in outer rectangle border.
protected  void setupChildrenPane()
          Setup children pane
protected  void setupDefaultColors()
          Setup default colors
protected  void setupLayout()
          Setup layout.
protected  void setupTitlePane()
          Setup title pane.
 
Methods inherited from class com.ibm.etools.systems.application.visual.editor.ui.figures.impl.AbstractCollapsableFigure
getInitialCollapseState, initCollapseState, isCollapsed, isCollapseIconArea, setCollapsed
 
Methods inherited from class com.ibm.etools.systems.application.visual.editor.ui.figures.impl.AbstractFeedbackNodeFigure
blendColor, getAssociatedSourceColor, getAssociatedTargetColor, getFeedbackState, setFeedbackState, setFeedbackStateManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

shapeImage_width

public int shapeImage_width

shapeImage_height

public int shapeImage_height

arcWidth_outer

public int arcWidth_outer

arcHeight_outer

public int arcHeight_outer

outerRectangle_shiftX

public int outerRectangle_shiftX

outerRectangle_shiftY

public int outerRectangle_shiftY

max_outer_borderline_width

public int max_outer_borderline_width

outerBorderLineStyle

public int outerBorderLineStyle

outerBorderLineWidth

public int outerBorderLineWidth

arcWidth_inner

public int arcWidth_inner

arcHeight_inner

public int arcHeight_inner

outer_inner_top_gap

public int outer_inner_top_gap

outer_inner_left_gap

public int outer_inner_left_gap

outer_inner_right_gap

public int outer_inner_right_gap

outer_inner_bottom_gap

public int outer_inner_bottom_gap

inner_item_gap

public int inner_item_gap

collapseImage_shiftX

public int collapseImage_shiftX

collapseImage_shiftY

public int collapseImage_shiftY

collapseImage_width

public int collapseImage_width

collapseImage_height

public int collapseImage_height

collapseTwistieArea

public Rectangle collapseTwistieArea

collapsedTwistieImage

public Image collapsedTwistieImage

expandTwistieImage

public Image expandTwistieImage

collapseLine_gap

public int collapseLine_gap

collapseLine_fill_gap

public int collapseLine_fill_gap

titleLabel_top_padding

public int titleLabel_top_padding

titleLabel_left_padding

public int titleLabel_left_padding

titleLabel_right_padding

public int titleLabel_right_padding

childrenPane_top_padding

public int childrenPane_top_padding

min_childrenPane_width

public int min_childrenPane_width

min_childrenPane_height

public int min_childrenPane_height

foreground_gradient

public Color foreground_gradient

background_gradient

public Color background_gradient

defaultOuterLineColor

public RGB defaultOuterLineColor

defaultInnerLineColor

public RGB defaultInnerLineColor
Constructor Detail

BinaryContainerFigure

public BinaryContainerFigure(Image shapeImage,
                             String shapeTitle,
                             IMapMode mapMode,
                             IGraphicalEditPart editPart)
Creat a container figure.

Parameters:
shapeImage: - the icon displays in shape top-left corner.
shapeTitle: - the text displays in shape title area.
mapMode: - the map mode is used by the diagram.
Method Detail

init

protected void init()
Initialize the figure.


cleanUp

public void cleanUp()
Clean up resources.


setupTitlePane

protected void setupTitlePane()
Setup title pane. The title pane will hold : 1. shape title The shape image will be drawn directly in painFigure method. This method also uses MarginBorder as border to position itself in the layout of container.


setupChildrenPane

protected void setupChildrenPane()
Setup children pane


getTitlePane

protected IFigure getTitlePane()
Get title Pane.


getChildrenPane

protected IFigure getChildrenPane()
Get children Pane.


setupLayout

protected void setupLayout()
Setup layout.


setupDefaultColors

protected void setupDefaultColors()
Setup default colors


getContentPane

public IFigure getContentPane()
Get content pane


paintFigure

protected void paintFigure(Graphics graphics)
Paint figure.


drawOuterBorder

protected void drawOuterBorder(Graphics graphics,
                               Rectangle outRect,
                               String feedbackState)
Draw outer border for this figure according to the current state.

Parameters:
graphics -
outRect -
feedbackState2 -

setFillColor

public void setFillColor(RGB shapeFillRGB)
Set fill color

Parameters:
shapeFillRGB -

setOutLineColor

public void setOutLineColor(RGB outerLineRGB)
Set line color that is used in outer rectangle border.

Parameters:
outerLineRGB: - given color of outer line.

setInnerLineColor

public void setInnerLineColor(RGB innerLineRGB)
Set line color that is used in inner rectangle border.

Parameters:
innerLineRGB: - given color of outer line.

setGradientForegroundColor

public void setGradientForegroundColor(Color foregroundColor)
Set foreground color for gradient


setGradientBackgroundColor

public void setGradientBackgroundColor(Color backgroundColor)
Set background color for gradient


requireCollapseableTwistie

public boolean requireCollapseableTwistie()
Return true if there is at least two collapseable children figures, false otherwise. The return value will be used to decide if we need to draw collapseable image twistie.


setOutBorderLineStyle

public void setOutBorderLineStyle(int lineStyle)
Set line style of outer border


setOutBorderLineWidth

public void setOutBorderLineWidth(int lineWidth)
Set line style of outer border


getHandleBounds

public Rectangle getHandleBounds()
Returns the Rectangle around which handles are to be placed. The Rectangle should be in the same coordinate system as the figure itself.

Returns:
The rectangle used for handles
See Also:
org.eclipse.gef.handles.HandleBounds

isInCollapseTwistieArea

public boolean isInCollapseTwistieArea(Point currentMousePoint)
Return true if current mouse points to collapse twistie area. False otherwise.

Parameters:
currentMousePoint: - current mouse point.
Returns:

getCollapseTwistieArea

protected Rectangle getCollapseTwistieArea()
Return collapse twistie area.


getTwistieImage

protected Image getTwistieImage(boolean isCollapsed)
Return collapse twistie image.


paintCollapseImageArea

protected void paintCollapseImageArea(Rectangle collapseImgRect,
                                      Graphics graphics)
Paint toggle area.


getFeedbackFigureBounds

public Rectangle getFeedbackFigureBounds()
Description copied from interface: IFeedbackFigure
Return feedback figure bound.

Specified by:
getFeedbackFigureBounds in interface IFeedbackFigure
Specified by:
getFeedbackFigureBounds in class AbstractFeedbackNodeFigure

collapse

public void collapse()

expand

public void expand()

changeCollapseState

protected void changeCollapseState(boolean collapsed)
Change collpase state of figure.


needTwistie

public boolean needTwistie()

setForegroundColor

public void setForegroundColor(Color color)
Set ForegroundColor.


setFontColor

public void setFontColor(Color color)
Set Font color.


getNameLabel

public WrappingLabel getNameLabel()
Description copied from interface: INamedFigure
Get name label.

Specified by:
getNameLabel in interface INamedFigure

invalidate

public void invalidate()
See Also:
IFigure#invalidate()

getImage

protected Image getImage(String id,
                         String size)
Get image.

Parameters:
id - id string used in image registry.
size - size of image

getIconRetriever

protected IconRetriever getIconRetriever()
Get icon retriever.


getCollapseIconArea

protected Rectangle getCollapseIconArea()
Description copied from class: AbstractCollapsableFigure
Return the rectangle where collapsable toggler icon is.

Specified by:
getCollapseIconArea in class AbstractCollapsableFigure

setFont

public void setFont(Font newFont)
Set the font.


Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.