Package jadex.commons.gui
Class ObjectCardLayout
- java.lang.Object
-
- jadex.commons.gui.ObjectCardLayout
-
- All Implemented Interfaces:
java.awt.LayoutManager,java.awt.LayoutManager2
public class ObjectCardLayout extends java.lang.Object implements java.awt.LayoutManager2A ObjectCardLayout is an object based cardlayout.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Object,java.awt.Component>componentsThe components.protected java.lang.ObjectcurkeyThe key of the current component (if any).protected java.awt.ComponentcurrentThe current component (if any).static java.lang.StringDEFAULT_COMPONENTThe default component (used when no other component is shown).protected inthgapThe horizontal gap.protected intvgapThe vertical gap.
-
Constructor Summary
Constructors Constructor Description ObjectCardLayout()Construct a new layout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLayoutComponent(java.awt.Component component, java.lang.Object constraints)Will be called from the container, when a new component with constraint object was added.voidaddLayoutComponent(java.lang.String name, java.awt.Component comp)A component was added to the container.java.awt.ComponentgetComponent(java.lang.Object object)Get a component for the given identifier.java.lang.ObjectgetCurrentKey()Get the key of the currently shown component (if any).floatgetLayoutAlignmentX(java.awt.Container target)Get the component interest where to be aligned.floatgetLayoutAlignmentY(java.awt.Container target)Get the component interest where to be aligned.voidinvalidateLayout(java.awt.Container target)When called, all values are recalculated.booleanisAvailable(java.lang.Object object)Test if there is a panel for a object available.voidlayoutContainer(java.awt.Container parent)Set the components bounds in the parent.java.awt.DimensionmaximumLayoutSize(java.awt.Container target)Compute the maximum layout size.java.awt.DimensionminimumLayoutSize(java.awt.Container parent)Compute the minimum layout size.java.awt.DimensionpreferredLayoutSize(java.awt.Container parent)Compute the preferred layout size.voidremoveLayoutComponent(java.awt.Component comp)Will be called from the container, when a component was removed.voidshow(java.lang.Object object)Shows the component in the parent.java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_COMPONENT
public static final java.lang.String DEFAULT_COMPONENT
The default component (used when no other component is shown).- See Also:
- Constant Field Values
-
hgap
protected int hgap
The horizontal gap.
-
vgap
protected int vgap
The vertical gap.
-
components
protected java.util.Map<java.lang.Object,java.awt.Component> components
The components.
-
current
protected java.awt.Component current
The current component (if any).
-
curkey
protected java.lang.Object curkey
The key of the current component (if any).
-
-
Method Detail
-
show
public void show(java.lang.Object object)
Shows the component in the parent.- Parameters:
object- The object.parent- The parent.
-
isAvailable
public boolean isAvailable(java.lang.Object object)
Test if there is a panel for a object available.- Parameters:
object- The object.- Returns:
- True, if it exists a panel.
-
getComponent
public java.awt.Component getComponent(java.lang.Object object)
Get a component for the given identifier.
-
getCurrentKey
public java.lang.Object getCurrentKey()
Get the key of the currently shown component (if any).
-
addLayoutComponent
public void addLayoutComponent(java.lang.String name, java.awt.Component comp)A component was added to the container.- Specified by:
addLayoutComponentin interfacejava.awt.LayoutManager- Parameters:
name- The constraint in a string.comp- The component.
-
layoutContainer
public void layoutContainer(java.awt.Container parent)
Set the components bounds in the parent.- Specified by:
layoutContainerin interfacejava.awt.LayoutManager- Parameters:
parent- The container.
-
minimumLayoutSize
public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Compute the minimum layout size.- Specified by:
minimumLayoutSizein interfacejava.awt.LayoutManager- Parameters:
parent- The container.- Returns:
- The minimum layout size.
-
preferredLayoutSize
public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Compute the preferred layout size.- Specified by:
preferredLayoutSizein interfacejava.awt.LayoutManager- Parameters:
parent- The container.- Returns:
- The preferred layout size.
-
removeLayoutComponent
public void removeLayoutComponent(java.awt.Component comp)
Will be called from the container, when a component was removed.- Specified by:
removeLayoutComponentin interfacejava.awt.LayoutManager- Parameters:
comp- The component.
-
addLayoutComponent
public void addLayoutComponent(java.awt.Component component, java.lang.Object constraints)Will be called from the container, when a new component with constraint object was added.- Specified by:
addLayoutComponentin interfacejava.awt.LayoutManager2- Parameters:
component- The component.constraints- The constraints.
-
getLayoutAlignmentX
public float getLayoutAlignmentX(java.awt.Container target)
Get the component interest where to be aligned. (not used).- Specified by:
getLayoutAlignmentXin interfacejava.awt.LayoutManager2- Parameters:
target- The container.- Returns:
- Always 0.5 (centered).
-
getLayoutAlignmentY
public float getLayoutAlignmentY(java.awt.Container target)
Get the component interest where to be aligned. (not used).- Specified by:
getLayoutAlignmentYin interfacejava.awt.LayoutManager2- Parameters:
target- The container.- Returns:
- Always 0.5 (centered).
-
invalidateLayout
public void invalidateLayout(java.awt.Container target)
When called, all values are recalculated.- Specified by:
invalidateLayoutin interfacejava.awt.LayoutManager2- Parameters:
target- The container.
-
maximumLayoutSize
public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
Compute the maximum layout size.- Specified by:
maximumLayoutSizein interfacejava.awt.LayoutManager2- Parameters:
target- The container.- Returns:
- The maximum layout size.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-