Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


oracle.javatools.columnlayout
Class LayoutLeaf

java.lang.Object
  extended by oracle.javatools.columnlayout.LayoutLeaf

All Implemented Interfaces:
LayoutComponent

public class LayoutLeaf
extends java.lang.Object
implements LayoutComponent

A LayoutLeaf wraps a single UI component that can span multiple rows and columns and be resizable.


Constructor Summary
LayoutLeaf(java.awt.Component component, java.awt.Insets insets, int columnSpan, boolean isRowResizable, boolean isColumnResizable, int anchor, int fill)
          Create a LayoutLeaf for a UI component.

 

Method Summary
 void addToPanel(java.awt.Container container, int baseRow, int baseColumn, boolean[] rowConstraints, boolean[] columnConstraints, int rowSpan)
          We add the component to the container with appropriate GridBagConstraints.
 void areColumnsResizable(boolean[] columnConstraints, int baseColumn)
          If the LayoutLeaf is resizable and only spans one column then the column is resizable.
 void areRowsResizable(boolean[] rowConstraints, int baseRow, int rowSpan)
          If the LayoutLeaf is resizable and only spans one row then the row is resizable.
 int getColumnCount()
          The number of columns for a LayoutLeaf is the same as its wrapped object.
 int getRowCount()
          A LayoutLeaf only ever has a single row.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

LayoutLeaf

public LayoutLeaf(java.awt.Component component,
                  java.awt.Insets insets,
                  int columnSpan,
                  boolean isRowResizable,
                  boolean isColumnResizable,
                  int anchor,
                  int fill)
Create a LayoutLeaf for a UI component.
Parameters:
component - the component to be wrapped, must not be null.
insets - the insets for the component within its cell, if null is passed then (0, 0, 0, 0) is used.
columnSpan - the number of columns the component occupies, must be >0
isRowResizable - is the component vertically resizable
isColumnResizable - is the component horizontally resizable
anchor - the anchor position for the component, one of the grid bag layout compass points.
fill - whether the component should fill all its given space, one of the grid bag layout horizontal or vertical constraints.

Method Detail

areRowsResizable

public void areRowsResizable(boolean[] rowConstraints,
                             int baseRow,
                             int rowSpan)
If the LayoutLeaf is resizable and only spans one row then the row is resizable. If the LayoutLeaf is resizable and spans multiple rows then it is only resizable if one of those rows is resizable - we don't change the constraints.
Specified by:
areRowsResizable in interface LayoutComponent
Parameters:
rowConstraints - the out parameter
baseRow - the position to start from in the rowConstraints
rowSpan - the length of the rowConstraints which can be changed

areColumnsResizable

public void areColumnsResizable(boolean[] columnConstraints,
                                int baseColumn)
If the LayoutLeaf is resizable and only spans one column then the column is resizable. If the LayoutLeaf is resizable and spans multiple columns then it is only resizable if one of those columns is resizable - we don't change the constraints.
Specified by:
areColumnsResizable in interface LayoutComponent

getColumnCount

public int getColumnCount()
The number of columns for a LayoutLeaf is the same as its wrapped object.
Specified by:
getColumnCount in interface LayoutComponent

getRowCount

public int getRowCount()
A LayoutLeaf only ever has a single row.
Specified by:
getRowCount in interface LayoutComponent
Returns:
1

addToPanel

public void addToPanel(java.awt.Container container,
                       int baseRow,
                       int baseColumn,
                       boolean[] rowConstraints,
                       boolean[] columnConstraints,
                       int rowSpan)
We add the component to the container with appropriate GridBagConstraints. Any component in a resizable row or column is resizable, even if it isn't resizable itself. Components which are themselves resizable always fill the available space. Otherwise the supplied fill values are used. Usually the supplied insets are used, but for any component touching the edge of the panel the insets are ignored, ie set to zero for that edge. Thus components are always flush to the edge of the panel. (The UI component may not be depending on the anchor and fill constraints.)

Unfortunately GridBagLayout uses the preferred size of a component as the initial size for a row or column. For resizable components it then adds extra space to this. We actually want to ignore the preferred size of components in resizable rows or columns, so we need to pretend it is 0 in that dimension. To achieve this the resizable component is wrapped in a JPanel subclass which fakes the preferred size using the components preferred size. This is dynamic: if the components preferred size changes the JPanel's returned size will match in the non-resizable dimensions.

Specified by:
addToPanel in interface LayoutComponent
Parameters:
container - the container to add to
baseRow - components must be added relative to this
baseColumn - components must be added relative to this
rowConstraints - whether each row is resizable or not, these are for the whole container
columnConstraints - same as rowConstraints but for columns
rowSpan - the number of rows which the LayoutComponent occupies this will be at least equal to the LayoutComponent's row count

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


Copyright © 1997, 2013, Oracle. All rights reserved.