Runtime

org.eclipse.gmf.runtime.draw2d.ui.figures
Class OneLineBorder

java.lang.Object
  extended by org.eclipse.draw2d.AbstractBorder
      extended by org.eclipse.draw2d.LineBorder
          extended by org.eclipse.gmf.runtime.draw2d.ui.figures.OneLineBorder
All Implemented Interfaces:
Border

public class OneLineBorder
extends LineBorder

This is a border that only draws a line at one position around the shape based on a position constant. This is useful for cases where it may be necessary to draw a separator between shapes without instantiating a new figure.


Field Summary
 
Fields inherited from class org.eclipse.draw2d.AbstractBorder
tempRect
 
Constructor Summary
OneLineBorder()
           
OneLineBorder(Color color)
          Constructor
OneLineBorder(Color color, int width, int position)
          Constructor
OneLineBorder(int width, int position)
          Constructor
 
Method Summary
 Insets getInsets(IFigure figure)
           
 int getPosition()
           
 void paint(IFigure figure, Graphics graphics, Insets insets)
          Paints the border based on the inputs given.
 void setPosition(int position)
           
 
Methods inherited from class org.eclipse.draw2d.LineBorder
getColor, getWidth, isOpaque, setColor, setWidth
 
Methods inherited from class org.eclipse.draw2d.AbstractBorder
getPaintRectangle, getPreferredSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OneLineBorder

public OneLineBorder()

OneLineBorder

public OneLineBorder(int width,
                     int position)
Constructor

Parameters:
width - the width of the line in relative coordinates
position - the value should be one of PositionConstants.TOP, PositionConstants.BOTTOM, PositionConstants.LEFT, PositionConstants.RIGHT

OneLineBorder

public OneLineBorder(Color color)
Constructor

Parameters:
color - The color of the border.

OneLineBorder

public OneLineBorder(Color color,
                     int width,
                     int position)
Constructor

Parameters:
color - The color of the border.
width - the width of the line in relative coordinates
position - the value should be one of PositionConstants.TOP, PositionConstants.BOTTOM, PositionConstants.LEFT, PositionConstants.RIGHT
Method Detail

getPosition

public int getPosition()
Returns:
Returns the position.

setPosition

public void setPosition(int position)
Parameters:
position - The position to set.

getInsets

public Insets getInsets(IFigure figure)
Specified by:
getInsets in interface Border
Overrides:
getInsets in class LineBorder

paint

public void paint(IFigure figure,
                  Graphics graphics,
                  Insets insets)
Paints the border based on the inputs given.

Specified by:
paint in interface Border
Overrides:
paint in class LineBorder
Parameters:
figure - IFigure for which this is the border.
graphics - Graphics handle for drawing the border.
insets - Space to be taken up by this border.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.