org.formaria.swt
Class SwtTarget

java.lang.Object
  extended by Composite
      extended by org.formaria.swt.SwtTarget
All Implemented Interfaces:
ContentHolder

public class SwtTarget
extends Composite
implements ContentHolder

When using framesets the 'screen' is devided up into a number of different target areas. Each target area may contain a page. The content for each target area is set by naming the target area when calling displayPage. This class provides support for this behaviour by wrapping the Container class to ensure the target area is properly sized. How the target areas are actually laid out depends on the layout manager being used.

Copyright: Copyright (c) Formaria Ltd., 2008

$Revision: 1.5 $


Constructor Summary
SwtTarget(Composite parent)
          Setup a new target area and set its size
 
Method Summary
 void add(java.lang.Object c, java.lang.Object constraint)
          Add a child component
protected  void checkSubclass()
          Suppress the subclassing exception
 void doLayout()
          Do the container layout
 java.lang.Object getChildComponent(int i)
          Get a child component
 java.lang.String getContent()
          Get the content of this target
 boolean getHasListeners()
          Get the hasListeners flag
 java.lang.String getName()
          Get the name of the content holder
 java.lang.String getToolTip()
          Get the tooltip text
 void remove(java.lang.Object c)
          Remove a child component
 void setContent(java.lang.String pageName)
          Set the content of this target
 void setHasListeners(boolean value)
          Set the hasListeners flag
 void setNextAttributes(java.lang.Object attribs)
          Set the attributes for the next component being added
 void setToolTip(java.lang.String text)
          Set the tooltip text
 void setup(java.lang.String name, int width, int height, java.util.Hashtable params)
          Sets up the new target
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwtTarget

public SwtTarget(Composite parent)
Setup a new target area and set its size

Parameters:
parent - parent object
Method Detail

checkSubclass

protected void checkSubclass()
Suppress the subclassing exception


setNextAttributes

public void setNextAttributes(java.lang.Object attribs)
Set the attributes for the next component being added

Specified by:
setNextAttributes in interface ContentHolder
Parameters:
attribs - a table of attributes

setup

public void setup(java.lang.String name,
                  int width,
                  int height,
                  java.util.Hashtable params)
Sets up the new target

Specified by:
setup in interface ContentHolder
Parameters:
params - extra parameters for the target
name - set the container name
width - the desired width
height - the desired height

getChildComponent

public java.lang.Object getChildComponent(int i)
Get a child component

Specified by:
getChildComponent in interface ContentHolder
Parameters:
i - the index of the child within the container
Returns:
the child component

add

public void add(java.lang.Object c,
                java.lang.Object constraint)
Add a child component

Specified by:
add in interface ContentHolder
Parameters:
c - the child component
constraint - the layout constraint

remove

public void remove(java.lang.Object c)
Remove a child component

Specified by:
remove in interface ContentHolder
Parameters:
c - the child component

getHasListeners

public boolean getHasListeners()
Get the hasListeners flag

Returns:
the value

setHasListeners

public void setHasListeners(boolean value)
Set the hasListeners flag

Parameters:
value - the new value

getContent

public java.lang.String getContent()
Get the content of this target

Returns:
the content or page name

setContent

public void setContent(java.lang.String pageName)
Set the content of this target

Specified by:
setContent in interface ContentHolder
Parameters:
pageName - the content page name

doLayout

public void doLayout()
Do the container layout

Specified by:
doLayout in interface ContentHolder

getName

public java.lang.String getName()
Get the name of the content holder

Specified by:
getName in interface ContentHolder
Returns:
the name

setToolTip

public void setToolTip(java.lang.String text)
Set the tooltip text

Parameters:
text - the new text

getToolTip

public java.lang.String getToolTip()
Get the tooltip text

Returns:
the existing text if any