org.fuin.utils4swing.layout.scalable
Class DefaultScalableLayoutRegistry

java.lang.Object
  extended by org.fuin.utils4swing.layout.scalable.DefaultScalableLayoutRegistry
All Implemented Interfaces:
ScalableLayoutRegistry

public final class DefaultScalableLayoutRegistry
extends java.lang.Object
implements ScalableLayoutRegistry

default registry for scalers.


Constructor Summary
DefaultScalableLayoutRegistry()
          No argument constructor.
 
Method Summary
 void addScaler(BorderScaler scaler)
          Add a new scaler to the registry.
 void addScaler(ComponentScaler scaler)
          Add a new scaler to the registry.
 BorderScaler getBorderScaler(java.lang.Class<? extends javax.swing.border.Border> borderClass)
          Returns a helper class that can be used to scale a border.
 ComponentScaler getComponentScaler(java.lang.Class<? extends java.awt.Component> componentClass)
          Returns a helper class that can be used to scale a component.
 AbstractScalableLayout getScalableLayout(ScalableLayoutRegistry registry, java.awt.Container container)
          Returns a scalable replacement for the original layout manager.
 boolean isContainer(java.awt.Component container)
          Checks if a given component should be treated as container.
 void putScalableLayout(java.lang.Class<? extends java.awt.LayoutManager> layoutManagerClass, java.lang.Class<? extends ScalableLayout> scalableLayoutClass)
          Adds a layout manager class mapping to the registry.
 void putScalableLayout2(java.lang.Class<? extends java.awt.LayoutManager2> layoutManager2Class, java.lang.Class<? extends ScalableLayout2> scalableLayout2Class)
          Adds a layout manager class mapping to the registry.
 void removeScalableLayout(java.lang.Class<? extends java.awt.LayoutManager> layoutManagerClass)
          Removes a layout manager class mapping from the registry.
 void removeScalableLayout2(java.lang.Class<? extends java.awt.LayoutManager2> layoutManager2Class)
          Removes a layout manager class mapping from the registry.
 boolean removeScaler(BorderScaler scaler)
          Remove a scaler from the registry.
 boolean removeScaler(ComponentScaler scaler)
          Remove a scaler from the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultScalableLayoutRegistry

public DefaultScalableLayoutRegistry()
No argument constructor.

Method Detail

addScaler

public final void addScaler(ComponentScaler scaler)
Add a new scaler to the registry.

Parameters:
scaler - Scaler to add.

removeScaler

public final boolean removeScaler(ComponentScaler scaler)
Remove a scaler from the registry.

Parameters:
scaler - Scaler to remove.
Returns:
If the list contained the element true else false.

getComponentScaler

public final ComponentScaler getComponentScaler(java.lang.Class<? extends java.awt.Component> componentClass)
Returns a helper class that can be used to scale a component.

Specified by:
getComponentScaler in interface ScalableLayoutRegistry
Parameters:
componentClass - Class to find a scaler for.
Returns:
Class used to scale that type of component - Always non-null!

addScaler

public final void addScaler(BorderScaler scaler)
Add a new scaler to the registry.

Parameters:
scaler - Scaler to add.

removeScaler

public final boolean removeScaler(BorderScaler scaler)
Remove a scaler from the registry.

Parameters:
scaler - Scaler to remove.
Returns:
If the list contained the element true else false.

getBorderScaler

public final BorderScaler getBorderScaler(java.lang.Class<? extends javax.swing.border.Border> borderClass)
Returns a helper class that can be used to scale a border.

Specified by:
getBorderScaler in interface ScalableLayoutRegistry
Parameters:
borderClass - Class to find a scaler for.
Returns:
Class used to scale that type of border - Always non-null!

putScalableLayout2

public final void putScalableLayout2(java.lang.Class<? extends java.awt.LayoutManager2> layoutManager2Class,
                                     java.lang.Class<? extends ScalableLayout2> scalableLayout2Class)
Adds a layout manager class mapping to the registry.

Parameters:
layoutManager2Class - Layout manager 2 to replace with scalableLayout2Class.
scalableLayout2Class - Scalable layout manager class to add. The class must have a constructor with exact two arguments: ScalableLayoutRegistry and Container (in this order).

removeScalableLayout2

public final void removeScalableLayout2(java.lang.Class<? extends java.awt.LayoutManager2> layoutManager2Class)
Removes a layout manager class mapping from the registry.

Parameters:
layoutManager2Class - Scalable layout manager class to remove.

putScalableLayout

public final void putScalableLayout(java.lang.Class<? extends java.awt.LayoutManager> layoutManagerClass,
                                    java.lang.Class<? extends ScalableLayout> scalableLayoutClass)
Adds a layout manager class mapping to the registry.

Parameters:
layoutManagerClass - Layout manager to replace with scalableLayoutClass.
scalableLayoutClass - Scalable layout manager class to add. The class must have a constructor with exact two arguments: ScalableLayoutRegistry and Container (in this order).

removeScalableLayout

public final void removeScalableLayout(java.lang.Class<? extends java.awt.LayoutManager> layoutManagerClass)
Removes a layout manager class mapping from the registry.

Parameters:
layoutManagerClass - Layout manager class to remove.

getScalableLayout

public final AbstractScalableLayout getScalableLayout(ScalableLayoutRegistry registry,
                                                      java.awt.Container container)
Returns a scalable replacement for the original layout manager.

Specified by:
getScalableLayout in interface ScalableLayoutRegistry
Parameters:
registry - Registry to use.
container - Container with the original layout.
Returns:
Scalable layout manager - Always non-null!

isContainer

public boolean isContainer(java.awt.Component container)
Checks if a given component should be treated as container. This method will be used when setting scalable layout managers recursive.

Specified by:
isContainer in interface ScalableLayoutRegistry
Parameters:
container - Component to check.
Returns:
If it's a container (means no controls like "JTextField", "JButton"...) true else false.


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