org.fuin.utils4swing.layout.scalable
Class AbstractScalableLayout

java.lang.Object
  extended by org.fuin.utils4swing.layout.scalable.AbstractScalableLayout
All Implemented Interfaces:
LayoutManager
Direct Known Subclasses:
ScalableLayout, ScalableLayout2

public abstract class AbstractScalableLayout
extends Object
implements LayoutManager

A layout manager that resizes the content along to a given factor.


Constructor Summary
protected AbstractScalableLayout(ScalableLayoutRegistry registry, Container container)
          Constructor with container.
 
Method Summary
 void addLayoutComponent(String name, Component comp)
          
protected  void addScaledComponent(Component comp)
          Adds a component to the internal list of scaled components.
abstract  void afterComponentsScaled(double factor)
          This method will be called after all components are scaled.
protected  ScaledComponent findScaledComponent(Component comp)
          Returns the corresponding scaled component.
protected  Container getContainer()
          Returns the container this layout depends to.
 double getFactor()
          Returns the current scaling factor.
 void layoutContainer(Container container)
          
 Dimension minimumLayoutSize(Container container)
          
 Dimension preferredLayoutSize(Container container)
          
 void removeLayoutComponent(Component comp)
          
 void setFactor(double factor)
          Sets the scaling factor to a new value.
 void setFactorRecursive(double factor)
          Sets the scaling factor to a new value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractScalableLayout

protected AbstractScalableLayout(ScalableLayoutRegistry registry,
                                 Container container)
Constructor with container.

Parameters:
registry - Registry to use - Cannot be null.
container - Container this layout should be applied to - Cannot be null.
Method Detail

addLayoutComponent

public final void addLayoutComponent(String name,
                                     Component comp)

Specified by:
addLayoutComponent in interface LayoutManager

addScaledComponent

protected final void addScaledComponent(Component comp)
Adds a component to the internal list of scaled components.

Parameters:
comp - Component to add.

removeLayoutComponent

public final void removeLayoutComponent(Component comp)

Specified by:
removeLayoutComponent in interface LayoutManager

findScaledComponent

protected final ScaledComponent findScaledComponent(Component comp)
Returns the corresponding scaled component.

Parameters:
comp - Component to lookup a scaled component for.
Returns:
Scaled component or null if not found.

preferredLayoutSize

public final Dimension preferredLayoutSize(Container container)

Specified by:
preferredLayoutSize in interface LayoutManager

minimumLayoutSize

public final Dimension minimumLayoutSize(Container container)

Specified by:
minimumLayoutSize in interface LayoutManager

getFactor

public final double getFactor()
Returns the current scaling factor.

Returns:
Factor.

setFactor

public final void setFactor(double factor)
Sets the scaling factor to a new value.

Parameters:
factor - Factor to set.

setFactorRecursive

public final void setFactorRecursive(double factor)
Sets the scaling factor to a new value. If any of the components also has a scalable layout it's setFactorRecursive(double) method will be called too.

Parameters:
factor - Factor to set.

afterComponentsScaled

public abstract void afterComponentsScaled(double factor)
This method will be called after all components are scaled.

Parameters:
factor - Factor used.

layoutContainer

public final void layoutContainer(Container container)

Specified by:
layoutContainer in interface LayoutManager

getContainer

protected final Container getContainer()
Returns the container this layout depends to.

Returns:
Container.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.