com.guiseframework.component.layout
Interface Layout<T extends Constraints>

Type Parameters:
T - The type of layout constraints associated with each component. This interface and subclasses represent layout definitions, not layout implementations. If the property of a component's constraints changes, a subclass of LayoutConstraintsPropertyChangeEvent will be fired indicating the associated component and constraints for which the value changed.
All Superinterfaces:
com.globalmentor.beans.PropertyBindable
All Known Implementing Classes:
AbstractFlowLayout, AbstractLayout, AbstractValueLayout, CardLayout, FlowLayout, MenuLayout, ReferenceLayout, RegionLayout, TabLayout

public interface Layout<T extends Constraints>
extends com.globalmentor.beans.PropertyBindable

Contains layout information for a layout component.

Author:
Garret Wilson

Method Summary
 void addComponent(Component component)
          Adds a component to the layout.
 T createDefaultConstraints()
          Creates default constraints for the layout component.
 T getConstraints(Component component)
          Retreives layout constraints associated with a component.
 java.lang.Class<? extends T> getConstraintsClass()
           
 LayoutComponent getOwner()
           
 GuiseSession getSession()
           
 void removeComponent(Component component)
          Removes a component from the layout.
 void setOwner(LayoutComponent newLayoutComponent)
          Sets the layout component that owns this layout This method is managed by layout components, and normally should not be called by applications.
 
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 

Method Detail

getSession

GuiseSession getSession()
Returns:
The Guise session that owns this layout.

getOwner

LayoutComponent getOwner()
Returns:
The layout component that owns this layout, or null if this layout has not been installed into a layout component.

getConstraintsClass

java.lang.Class<? extends T> getConstraintsClass()
Returns:
The class representing the type of constraints appropriate for this layout.

setOwner

void setOwner(LayoutComponent newLayoutComponent)
Sets the layout component that owns this layout This method is managed by layout components, and normally should not be called by applications. A layout cannot be given a layout component if it is already installed in another layout component. Once a layout is installed in a layout component, it cannot be uninstalled. A layout cannot be given a layout component unless that layout component already recognizes this layout as its layout. If a layout is given the same layout component it already has, no action occurs.

Parameters:
newLayoutComponent - The new layout component for this layout.
Throws:
java.lang.NullPointerException - if the given layout component is null.
java.lang.IllegalStateException - if a different layout component is provided and this layout already has a layout component.
java.lang.IllegalArgumentException - if a different layout component is provided and the given layout component does not already recognize this layout as its layout.

addComponent

void addComponent(Component component)
Adds a component to the layout. Called immediately after a component is added to the associated layout component. This method is called by the associated layout component, and should not be called directly by application code.

Parameters:
component - The component to add to the layout.
Throws:
java.lang.IllegalStateException - if this layout has not yet been installed into a layout component.

removeComponent

void removeComponent(Component component)
Removes a component from the layout. Called immediately before a component is removed from the associated layout component. This method is called by the associated layout component, and should not be called directly by application code.

Parameters:
component - The component to remove from the layout.

getConstraints

T getConstraints(Component component)
Retreives layout constraints associated with a component. If the constraints currently associated with the component are not compatible with this layout, or if no constraints are associated with the given component, default constraints are created and associated with the component.

Parameters:
component - The component for which layout metadata is being requested.
Returns:
The constraints associated with the component.
Throws:
java.lang.IllegalStateException - if this layout has not yet been installed into a layout component.
java.lang.IllegalStateException - if no constraints are associated with the given component and this layout does not support default constraints.
See Also:
getConstraintsClass(), Component.getConstraints(), Component.setConstraints(Constraints)

createDefaultConstraints

T createDefaultConstraints()
Creates default constraints for the layout component.

Returns:
New default constraints for the layout component.
Throws:
java.lang.IllegalStateException - if this layout does not support default constraints.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.