Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d
Class AbstractLabeledBorder

java.lang.Object
  extended by

org.eclipse.draw2d.AbstractBorder
      extended by
org.eclipse.draw2d.AbstractLabeledBorder
All Implemented Interfaces:
Border, LabeledBorder
Direct Known Subclasses:
GroupBoxBorder, TitleBarBorder

public abstract class AbstractLabeledBorder
extends AbstractBorder
implements LabeledBorder

Provides support for a border with a label describing the contents of which it is surrounding.


Field Summary
 
Fields inherited from class org.eclipse.draw2d. AbstractBorder
tempRect
 
Constructor Summary
AbstractLabeledBorder ()
          Constructs a default AbstractLabeledBorder with the name of this class set as its label.
AbstractLabeledBorder (java.lang.String s)
          Constructs a border with the label set to the String passed in as input.
 
Method Summary
protected abstract   Insets calculateInsets ( IFigure figure)
          Calculates insets based on the current font and other attributes.
protected  Font getFont ( IFigure f)
          Returns the font that this border will use.
  Insets getInsets ( IFigure fig)
          Returns the insets, or space associated for this border.
 java.lang.String getLabel ()
          Returns the label for this Border.
  Dimension getPreferredSize ( IFigure fig)
          Returns the preferred width and height that this border would like to display itself properly.
 Color getTextColor ()
          Returns the text Color of this AbstractLabeledBorder's label.
protected   Dimension getTextExtents ( IFigure f)
          Calculates and returns the size required by this border's label.
protected  void invalidate ()
          Resets the internal values and state so that they can be recalculated.
 void setFont (Font font)
          Sets the Font of this border to the input value, and invalidates the border forcing an update of internal parameters of insets and text extents.
 void setLabel (java.lang.String s)
          Sets the text to be displayed as the label for this Border.
 void setTextColor (Color color)
          Sets the color for this border's text.
 
Methods inherited from class org.eclipse.draw2d. AbstractBorder
getPaintRectangle, isOpaque
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.draw2d. Border
isOpaque, paint
 

Constructor Detail

AbstractLabeledBorder

public AbstractLabeledBorder()
Constructs a default AbstractLabeledBorder with the name of this class set as its label.

Since:
2.0

AbstractLabeledBorder

public AbstractLabeledBorder(java.lang.String s)
Constructs a border with the label set to the String passed in as input.

Parameters:
s - Label to be set on the border
Since:
2.0
Method Detail

calculateInsets

protected abstract 
Insets calculateInsets(
IFigure figure)
Calculates insets based on the current font and other attributes. This value will be cached until invalidate() is called.

Parameters:
figure - The figure to which the border is being applied
Returns:
The Insets

getFont

protected Font getFont(
IFigure f)
Returns the font that this border will use. If no Font has been specified, the font associated with the input Figure will be used.

Parameters:
f - Figure used to get a default font
Returns:
The font for this border

getInsets

public 
Insets getInsets(
IFigure fig)
Returns the insets, or space associated for this border. Returns any previously set value if present, else calculates it from the Figure provided in as input.

Specified by:
getInsets in interface Border
Parameters:
fig - Figure used to calculate insets
Returns:
The insets

getLabel

public java.lang.String getLabel()
Description copied from interface: LabeledBorder
Returns the label for this Border.

Specified by:
getLabel in interface LabeledBorder
Returns:
The label for this Border
See Also:
LabeledBorder.getLabel()

getPreferredSize

public 
Dimension getPreferredSize(
IFigure fig)
Description copied from interface: Border
Returns the preferred width and height that this border would like to display itself properly.

Specified by:
getPreferredSize in interface Border
Overrides:
getPreferredSize in class AbstractBorder
See Also:
Border.getPreferredSize(IFigure)

getTextColor

public Color getTextColor()
Returns the text Color of this AbstractLabeledBorder's label.

Returns:
The text color
Since:
2.0

getTextExtents

protected 
Dimension getTextExtents(
IFigure f)
Calculates and returns the size required by this border's label.

Parameters:
f - IFigure on which the calculations are to be made
Returns:
Dimensions required by the text of this border's label
Since:
2.0

invalidate

protected void invalidate()
Resets the internal values and state so that they can be recalculated. Called whenever a state change has occurred that effects the insets or text extents of this border.


setFont

public void setFont(Font font)
Sets the Font of this border to the input value, and invalidates the border forcing an update of internal parameters of insets and text extents.

Specified by:
setFont in interface LabeledBorder
Parameters:
font - The font

setLabel

public void setLabel(java.lang.String s)
Description copied from interface: LabeledBorder
Sets the text to be displayed as the label for this Border.

Specified by:
setLabel in interface LabeledBorder
Parameters:
s - The text
See Also:
LabeledBorder.setLabel(String)

setTextColor

public void setTextColor(Color color)
Sets the color for this border's text.

Parameters:
color - Color to be set for this border's text
Since:
2.0

Eclipse Draw2d
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire