kcl.waterloo.swing.layout
Class GraphUnitLayout
- java.lang.Object
-
- javax.swing.SpringLayout
-
- kcl.waterloo.swing.layout.GraphUnitLayout
-
- All Implemented Interfaces:
- java.awt.LayoutManager, java.awt.LayoutManager2
- Direct Known Subclasses:
- GraphContainerLayout, GraphLayout
public abstract class GraphUnitLayout extends javax.swing.SpringLayoutGraphUnitLayoutextendsSpringLayoutto provide support for components that are positioned in graph coordinate space. Use theputGraphicConstraintmethod to add components in graph space. Note that theputConstraintmethod may still be used to position components using pixel coordinates.GraphUnitLayoutis an abstract class.
-
-
Constructor Summary
Constructors Constructor and Description GraphUnitLayout()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddoSuperLayoutContainer(java.awt.Container c)This method does nothing and needs to be overridden.java.util.LinkedHashMap<java.awt.Component,GraphicConstraint>getComponentMap()Returns theLinkedHashMapofComponentsto be laid out using graph coordinates.java.util.ArrayList<java.awt.Dimension>getDimensions()Returns an ArrayList of the preferredSize of each component in the componentMap.voidputGraphicConstraint(java.awt.Component c, double x, double y, int alignX, int alignY)Registers the specified component to be laid out using graph units.voidsetComponentMap(java.util.LinkedHashMap<java.awt.Component,GraphicConstraint> map)Adds the input to the existing component map.voidsetDimensions(java.util.ArrayList<java.awt.Dimension> dim)Sets the dimensions of components in the componentMap.-
Methods inherited from class javax.swing.SpringLayout
addLayoutComponent, addLayoutComponent, getConstraint, getConstraints, getLayoutAlignmentX, getLayoutAlignmentY, invalidateLayout, layoutContainer, maximumLayoutSize, minimumLayoutSize, preferredLayoutSize, putConstraint, putConstraint, removeLayoutComponent
-
-
-
-
Method Detail
-
putGraphicConstraint
public void putGraphicConstraint(java.awt.Component c, double x, double y, int alignX, int alignY)Registers the specified component to be laid out using graph units.- Parameters:
c- theComponentx- x-position in graph unitsy- y-position in graph unitsalignX- relative X alignment specified using aSwingConstantsvalue.alignY- relative Y alignment specified using aSwingConstantsvalue.
-
getComponentMap
public java.util.LinkedHashMap<java.awt.Component,GraphicConstraint> getComponentMap()
Returns theLinkedHashMapofComponentsto be laid out using graph coordinates.- Returns:
- the
LinkedHashMapofComponents
-
setComponentMap
public void setComponentMap(java.util.LinkedHashMap<java.awt.Component,GraphicConstraint> map)
Adds the input to the existing component map. Entries for components already present will be updated. Entries for components not present in the existing componenMap will be added.- Parameters:
map-
-
getDimensions
public java.util.ArrayList<java.awt.Dimension> getDimensions()
Returns an ArrayList of the preferredSize of each component in the componentMap. This method will be used in serialization/deserialization to preserve the dimensions of Swing annotations.- Returns:
- ArrayList of Dimensions
-
setDimensions
public void setDimensions(java.util.ArrayList<java.awt.Dimension> dim)
Sets the dimensions of components in the componentMap. The input size must match the componentMap size.This method will be used in serialization/deserialization to preserve the dimensions of Swing annotations.- Parameters:
dim- ArrayList of Dimensions
-
doSuperLayoutContainer
public void doSuperLayoutContainer(java.awt.Container c)
This method does nothing and needs to be overridden.- Parameters:
c-
-
-
DMelt 3.0 © DataMelt by jWork.ORG