fi.hut.tml.xsmiles.gui.components.awt
Class ComponentWithCaption

java.lang.Object
  extended byfi.hut.tml.xsmiles.gui.components.awt.ComponentWithCaption
Direct Known Subclasses:
AWTComponent

public abstract class ComponentWithCaption
extends java.lang.Object

The base base class for all AWT & Swing components that have a caption

Author:
Mikko Honkala

Field Summary
protected  boolean actionable
           
protected  int axis
          the axis depends on the caption side CSS attribute
protected  AWTCaption caption
          the caption component
protected  java.awt.Container container
          the top-level container, containing the caption and the content component
protected  AWTStylableComponent content
          the content component (e.g.
protected  double currentZoom
           
protected  boolean layoutDone
           
static int X_AXIS
          Specifies that components should be laid out left to right.
static int Y_AXIS
          Specifies that components should be laid out top to bottom.
 
Constructor Summary
ComponentWithCaption()
           
 
Method Summary
 void addActionListener(java.awt.event.ActionListener al)
           
protected abstract  void addCaption(java.lang.String text)
           
 void addFocusListener(java.awt.event.FocusListener fl)
           
 void addHelpListener(java.awt.event.ActionListener fl)
          add a listener for help events
 void addMouseListener(java.awt.event.MouseListener ml)
           
 boolean getActionable()
          By default components are inactive
 java.awt.Component getComponent()
           
 java.awt.Color getDefaultBackgroundColor()
          the default background color for this type of component null = transparent.
 int getHeight()
           
 java.awt.Dimension getMinimumSize()
          return the minimum size for this component at zoom level 1.0
 java.awt.Dimension getSize()
           
 org.w3c.dom.css.CSSStyleDeclaration getStyle()
           
 int getWidth()
           
 int getX()
           
 int getY()
           
 void init()
          in init the subclass always creates its component first and then calls super.init (SwingComponent or AWTComponent)
protected  void layoutComponent()
          layouts the component using the caption, content and the main container parts of the control
 void removeActionListener(java.awt.event.ActionListener al)
           
 void removeFocusListener(java.awt.event.FocusListener fl)
           
 void removeHelpListener(java.awt.event.ActionListener fl)
          remove a listener for help events
 void removeMouseListener(java.awt.event.MouseListener ml)
           
 void setActionable(boolean a)
           
 void setBackground(java.awt.Color bg)
          set the background, if null, then reset to default
 void setBounds(int x, int y, int width, int height)
          Set the bounds of Container
 void setCaptionStyle(org.w3c.dom.css.CSSStyleDeclaration style)
           
 void setCaptionText(java.lang.String text)
          set the text shown in the caption
 void setEnabled(boolean b)
           
 void setFocus()
          set the focus to this control
 void setFont(java.awt.Font f)
          Sets the components font
 void setForeground(java.awt.Color bg)
          set the foreground
abstract  void setHintText(java.lang.String hint)
          Sets the components Tooltip (Hint) text
 void setStyle(org.w3c.dom.css.CSSStyleDeclaration style)
           
 void setVisible(boolean v)
          Set this drawing area visible.
 void setZoom(double zoom)
          Set's this components zoom (1.0 is the default).
protected  void sizeComponent(double zoom)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_AXIS

public static final int X_AXIS
Specifies that components should be laid out left to right.

See Also:
Constant Field Values

Y_AXIS

public static final int Y_AXIS
Specifies that components should be laid out top to bottom.

See Also:
Constant Field Values

content

protected AWTStylableComponent content
the content component (e.g. the slider of range). The subclass will generate this


container

protected java.awt.Container container
the top-level container, containing the caption and the content component


caption

protected AWTCaption caption
the caption component


axis

protected int axis
the axis depends on the caption side CSS attribute


actionable

protected boolean actionable

layoutDone

protected boolean layoutDone

currentZoom

protected double currentZoom
Constructor Detail

ComponentWithCaption

public ComponentWithCaption()
Method Detail

init

public void init()
in init the subclass always creates its component first and then calls super.init (SwingComponent or AWTComponent)


layoutComponent

protected void layoutComponent()
layouts the component using the caption, content and the main container parts of the control


setCaptionStyle

public void setCaptionStyle(org.w3c.dom.css.CSSStyleDeclaration style)

setStyle

public void setStyle(org.w3c.dom.css.CSSStyleDeclaration style)

getStyle

public org.w3c.dom.css.CSSStyleDeclaration getStyle()

getActionable

public boolean getActionable()
By default components are inactive

Returns:
Is can compnent be active?

setActionable

public void setActionable(boolean a)
Parameters:
a - The value of actionable

getComponent

public java.awt.Component getComponent()

addCaption

protected abstract void addCaption(java.lang.String text)

setCaptionText

public void setCaptionText(java.lang.String text)
set the text shown in the caption


setZoom

public void setZoom(double zoom)
Set's this components zoom (1.0 is the default).


sizeComponent

protected void sizeComponent(double zoom)

setFont

public void setFont(java.awt.Font f)
Sets the components font


setHintText

public abstract void setHintText(java.lang.String hint)
Sets the components Tooltip (Hint) text


setVisible

public void setVisible(boolean v)
Set this drawing area visible.

Parameters:
v - true=visible, false=invisible

setEnabled

public void setEnabled(boolean b)
Parameters:
b - Active or not active

getDefaultBackgroundColor

public java.awt.Color getDefaultBackgroundColor()
the default background color for this type of component null = transparent.


getMinimumSize

public java.awt.Dimension getMinimumSize()
return the minimum size for this component at zoom level 1.0


setBackground

public void setBackground(java.awt.Color bg)
set the background, if null, then reset to default


setForeground

public void setForeground(java.awt.Color bg)
set the foreground


setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Set the bounds of Container

Parameters:
x - X location
y - X location
width - X location
height - X location

getX

public int getX()
Returns:
The original coordinated, and the default size of component

getY

public int getY()

getWidth

public int getWidth()

getHeight

public int getHeight()

getSize

public java.awt.Dimension getSize()

addActionListener

public void addActionListener(java.awt.event.ActionListener al)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener al)

addFocusListener

public void addFocusListener(java.awt.event.FocusListener fl)

removeFocusListener

public void removeFocusListener(java.awt.event.FocusListener fl)

addMouseListener

public void addMouseListener(java.awt.event.MouseListener ml)

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener ml)

setFocus

public void setFocus()
set the focus to this control


addHelpListener

public void addHelpListener(java.awt.event.ActionListener fl)
add a listener for help events


removeHelpListener

public void removeHelpListener(java.awt.event.ActionListener fl)
remove a listener for help events



X-Smiles 1.2