Class de.unikl.AWTNode.FileNodeLayout
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class de.unikl.AWTNode.FileNodeLayout

java.lang.Object
   |
   +----de.unikl.AWTNode.FileNodeLayout

public class FileNodeLayout
extends Object
implements LayoutManager
This LayoutManager layouts the Components in a "FileTree" eg:

  ...+ ----hgapRoot
  +--|----------------------------------------+
  |  Y                                        |
  | * AAAAAAAAAA                              |
  |           *                               | vgap1 <-- vertikal spacing
  |           +*******BBBBBBBBBB              |
  | 	      *                               |
  |           -*******CCCCCCCCCC              |
  |           *           *                   |
  |           *           +******DDDDDDDDDDD  |
  |           *                               |
  |           +*******EEEEEEEEEE              |
  |                                           |
  +-------------------------------------------+
  .....|hgap1|  |hgap2|
  .....  ^       ^
  .....  +-------+----- horizontal spacing in this Layout Manager
  

Note:

Only works properly with "Node"-Containers !!!!!!! and if the size of in NodeContainer is small in contrast to the size of (In fact it must be granted CheckComponent.height() <= Description.height)

Internal implementation:

Like in BorderLayout in the JDK I have implemented identifiers which describe the "kind" of a Component in the NodeContainer. They don't call "South" "West" but :

  "stdNode"
  "description"
  "check"
  "thischeck"
  

The identifier "stdNode" describes all Components which are "add" with the normal Mehtod : add(Component comp) to the NodeContainer. I have overloaded this Method in NodeContainer. It simply invokes add("stdNode",comp) Thus these are the "contents" of the Container. (In a FileNodeLayout these are the File-Names)

The identifiers "description" and "check" describe Components which are for the graphical representation of the NodeContainer itself. The "check" allows to hide/show the "stNode" Components and the "description" Component is "its description-Name". (In a FileNodeLayout the name of the directory)

The "thischeck" describes the Checkbox of the NodeContainer to which this Layout belongs.

Note:

the "thischeck" is only in the Conatiner if and only if the this NodeContainer has nor parent NodeContainer. Thus the "thischeck" is only a member of the NodeContainer if it is the "root" NodeContainer. Depending ob the Status getpaint() we draw this "root"-Checkbox or not.

Constructor Index

 o FileNodeLayout()
Constructs a new FileNodeLayout with standard-spacing
 o FileNodeLayout(int, int, int, int)
Constructs a new FileNodeLayout with the specified gap values

Method Index

 o addLayoutComponent(String, Component)
Adds the specified component to the layout.
 o layoutContainer(Container)
Lays out the container.
 o minimumLayoutSize(Container)
Returns the minimum dimensions needed to layout the components contained in the specified target container.
 o preferredLayoutSize(Container)
Returns the preferred dimensions for this layout given the components in the specified target container.
 o removeLayoutComponent(Component)
Removes the specified component from the layout.
 o toString()
Returns the String representation of this FileNodeLayout's values.

Constructors

 o FileNodeLayout
  public FileNodeLayout()
Constructs a new FileNodeLayout with standard-spacing
 o FileNodeLayout
  public FileNodeLayout(int hgap1,
                        int hgap2,
                        int vgap1,
                        int hgapRoot)
Constructs a new FileNodeLayout with the specified gap values
Parameters:
hgap1 - the "left" horizontal gab variable
hgap2 - the "right" horizontal gap variable
vgap1 - the vertical gap variable

Methods

 o addLayoutComponent
  public void addLayoutComponent(String name,
                                 Component comp)
Adds the specified component to the layout. Not used by this class.
Parameters:
name - the name of the component
comp - the the component to be added
 o removeLayoutComponent
  public void removeLayoutComponent(Component comp)
Removes the specified component from the layout. Not used by this class.
Parameters:
comp - the component to remove
 o preferredLayoutSize
  public Dimension preferredLayoutSize(Container target)
Returns the preferred dimensions for this layout given the components in the specified target container. Note: The target must be a NodeContainer (!)
Parameters:
target - the component which needs to be laid out
See Also:
Container, minimumLayoutSize
 o minimumLayoutSize
  public Dimension minimumLayoutSize(Container target)
Returns the minimum dimensions needed to layout the components contained in the specified target container. Note: The parameter is a NodeContainer (and we call preferredLayoutSize...)
Parameters:
target - the component which needs to be laid out
See Also:
preferredLayoutSize
 o layoutContainer
  public void layoutContainer(Container target)
Lays out the container. This method will actually reshape the components in the target in order to satisfy the constraints of the FileNodeLayout object. Note: The parameter must be a NodeContainer (!)
Parameters:
target - the specified component being laid out.
See Also:
Container
 o toString
  public String toString()
Returns the String representation of this FileNodeLayout's values.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index