org.xulux.guilayer.swing.layouts
Class XYLayout

java.lang.Object
  extended by org.xulux.guilayer.swing.layouts.SwingLayoutAbstract
      extended by org.xulux.guilayer.swing.layouts.XYLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable, org.xulux.api.gui.IXuluxLayout

public class XYLayout
extends SwingLayoutAbstract
implements java.awt.LayoutManager2, java.io.Serializable

A layout manager that positions it's controls using the size and the position of the control

Version:
$Id: XYLayout.java,v 1.8 2004/10/14 14:34:20 mvdb Exp $
Author:
Martin van den Bemt
See Also:
Serialized Form

Field Summary
protected  java.util.HashMap map
          the map with widgets
 
Fields inherited from class org.xulux.guilayer.swing.layouts.SwingLayoutAbstract
parentWidget
 
Constructor Summary
XYLayout()
           
XYLayout(org.xulux.api.gui.IWidget parent)
          Use this contructor if used inside nyx.
 
Method Summary
 void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
          The contraints is the widget itself.
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
           
 void addWidget(org.xulux.api.gui.IWidget widget)
           
 void destroy()
           
 float getLayoutAlignmentX(java.awt.Container target)
           
 float getLayoutAlignmentY(java.awt.Container target)
           
protected  java.awt.Dimension getLayoutSize(java.awt.Container parent)
          is almost the same as layoutContainer, except using setBounds.
 java.awt.Rectangle getRectangle(java.awt.Component component, java.awt.Insets insets)
          This is mainly used for swing components that are layed "invisibly" on top of nyx.
 java.awt.Rectangle getRectangle(org.xulux.api.gui.IWidget widget, java.awt.Component component)
          The preferred size of the component is used, when the widget size isn't really useable...
 void invalidateLayout(java.awt.Container target)
           
protected  boolean isFirstLayout()
           
 void layoutContainer(java.awt.Container parent)
           
 java.awt.Dimension maximumLayoutSize(java.awt.Container target)
           
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
           
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
           
 void removeLayoutComponent(java.awt.Component comp)
           
 void removeWidget(org.xulux.api.gui.IWidget widget)
           
protected  void setFirstLayout(boolean firstLayout)
          Set if this is the first time that we layout or not
 
Methods inherited from class org.xulux.guilayer.swing.layouts.SwingLayoutAbstract
getParent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected java.util.HashMap map
the map with widgets

Constructor Detail

XYLayout

public XYLayout()

XYLayout

public XYLayout(org.xulux.api.gui.IWidget parent)
Use this contructor if used inside nyx.

Parameters:
parent - the creator of the XYLayout
Method Detail

addLayoutComponent

public void addLayoutComponent(java.awt.Component comp,
                               java.lang.Object constraints)
The contraints is the widget itself.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager2
See Also:
LayoutManager2.addLayoutComponent(Component, Object)

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container target)
Specified by:
getLayoutAlignmentX in interface java.awt.LayoutManager2
See Also:
LayoutManager2.getLayoutAlignmentX(Container)

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container target)
Specified by:
getLayoutAlignmentY in interface java.awt.LayoutManager2
See Also:
LayoutManager2.getLayoutAlignmentY(Container)

invalidateLayout

public void invalidateLayout(java.awt.Container target)
Specified by:
invalidateLayout in interface java.awt.LayoutManager2
See Also:
LayoutManager2.invalidateLayout(Container)

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2
See Also:
LayoutManager2.maximumLayoutSize(Container)

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Specified by:
addLayoutComponent in interface java.awt.LayoutManager
See Also:
LayoutManager.addLayoutComponent(String, Component)

layoutContainer

public void layoutContainer(java.awt.Container parent)
Specified by:
layoutContainer in interface java.awt.LayoutManager
See Also:
LayoutManager.layoutContainer(Container)

getRectangle

public java.awt.Rectangle getRectangle(org.xulux.api.gui.IWidget widget,
                                       java.awt.Component component)
The preferred size of the component is used, when the widget size isn't really useable...

Parameters:
widget - the widget to get the size from
component - the component to get the size from
Returns:
the rectangle of the component

getRectangle

public java.awt.Rectangle getRectangle(java.awt.Component component,
                                       java.awt.Insets insets)
This is mainly used for swing components that are layed "invisibly" on top of nyx. You should use setLocation(x,y) to position the Swing component correctly.

Parameters:
component - the component
insets - the insets
Returns:
the rectangle for a native swing component

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
See Also:
LayoutManager.minimumLayoutSize(Container)

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
See Also:
LayoutManager.preferredLayoutSize(Container)

getLayoutSize

protected java.awt.Dimension getLayoutSize(java.awt.Container parent)
is almost the same as layoutContainer, except using setBounds. If the size of the widget is not set (0 or less than zero) it will use the preferredsize of the native component, which is gotten from getRectangle().

Parameters:
parent - the parent container
Returns:
the layoutsize

setFirstLayout

protected void setFirstLayout(boolean firstLayout)
Set if this is the first time that we layout or not

Parameters:
firstLayout - true or false

isFirstLayout

protected boolean isFirstLayout()
Returns:
if the layout still needs to process it's first layout

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
See Also:
LayoutManager.removeLayoutComponent(Component)

destroy

public void destroy()
Specified by:
destroy in interface org.xulux.api.gui.IXuluxLayout
Specified by:
destroy in class SwingLayoutAbstract
See Also:
org.xulux.gui.IXuluxLayout#destroy()

addWidget

public void addWidget(org.xulux.api.gui.IWidget widget)
Specified by:
addWidget in interface org.xulux.api.gui.IXuluxLayout
See Also:
IXuluxLayout.addWidget(org.xulux.api.gui.IWidget)

removeWidget

public void removeWidget(org.xulux.api.gui.IWidget widget)
Specified by:
removeWidget in interface org.xulux.api.gui.IXuluxLayout
See Also:
IXuluxLayout.removeWidget(org.xulux.api.gui.IWidget)


Copyright © 2002-2007 Martin van den Bemt. All Rights Reserved.