abstractpublic class GridComponent extends JPanel(Code)
This class is used to contain a JETABean in a cell on a form. It maintains
information about its cell such as row/column location as well as other cell
constraints.
A GridComponent also defines methods (using memento pattern) for serializing
itself to and from a persistent store. We don't use the standard Java
serialization because the Sun does not guarantee compatibility with future
versions of Java, and we need more fine-grained control of the serialization
process.
A GridComponent maintains a reference to keyboard and mouse handlers needed
during design mode. Different GridComonent types will have different types of
handlers.
author: Jeff Tassin
GridComponent() Creates an uninitialized GridComponent instance.
public
GridComponent(GridView parentView) Creates a GridComponent instance with the specified
GridView parent.
public
GridComponent(JETABean jbean, GridView parent) Creates a GridComponent instance with the specified
GridView parent and JETABean.
Parameters: jbean - the underyling JETABean.
Method Summary
public void
addListener(GridCellListener listener) Adds a listener that is interested in GridCellEvents from this component.
getState(StateRequest si) Returns the internal state of this component as a memento.
public boolean
hasBean() Returns true if this component contains a java bean.
public boolean
isSelected() Returns true if this component is currently selected.
public boolean
isShowing() Returns true if this component has a nonzero width and height.
public void
postInitialize(FormPanel panel) PostInitialize is called once after all components in a form have been
re-instantiated and the state has been set at runtime (not design time).
Creates a GridComponent instance with the specified
GridView parent and JETABean.
Parameters: jbean - the underyling JETABean. This object contains the Java Bean. Parameters: parent - the GridView that contains this component.
Adds a listener that is interested in GridCellEvents from this component.
This is only needed in design mode.
Parameters: listener - the listener to add
Notifies all GridCellListeners with the specified event. This is only
used in design mode.
Parameters: evt - the event to send to all registered listeners
Returns the component that is directly contained by the JETABean.
Normally, this would be the Java bean. However, in a few cases, the
JETABean does not directly contain the Java Bean. Scrollpanes are an
example of this.
the JETABean child component.
Returns the component constraints for this component. Component
constraints include the column, row, column span, and row span
assignments. They also include any alignment and inset values for this
component.
the component constraints associated with this component.
the minimum size for this component. When in design mode, we setthe min size to something like 4x4 to prevent the grid cells inthe GridView from being too small.
Returns the preferred size for this component. When in design mode, we
set the preferred size to some non-zero value to prevent the grid cells
in the GridView from being too small.
the preferred size for this component.
Returns the internal state of this component as a memento. This includes
the cell constraints as well as the properties for the underlying Java
bean.
Parameters: si - a request object that controls how much information should bestored in the memento.
Returns true if this component contains a java bean. In design mode empty
cells on the form will not contain a bean but will contain a valid
GridComponent
true if this component contains java bean
Returns true if this component has a nonzero width and height. This can
occur in some cases in the designer. If we have non visible component, we
show an icon so the user has some indication that it exists.
true if this component is large enough to be visible
PostInitialize is called once after all components in a form have been
re-instantiated and the state has been set at runtime (not design time).
This gives each property and component a chance to do some last minute
initializations that might depend on the top level parent.