jimm.datavision.layout.swing
Class SwingPageContents

java.lang.Object
  extended by jimm.datavision.layout.swing.SwingPageContents

 class SwingPageContents
extends java.lang.Object

Holds report page contents and creates SwingPage instances when requested.

Author:
Jim Menard, jimm@io.com
See Also:
SwingLE, SwingPageField

Field Summary
(package private)  java.lang.Thread buildThread
           
(package private)  SwingPage page
           
(package private)  java.awt.Dimension pageDim
           
(package private)  java.util.ArrayList pageFields
           
(package private)  int pageNumber
           
(package private)  javax.swing.JPanel parent
           
 
Constructor Summary
SwingPageContents(javax.swing.JPanel parent, int pageNumber, java.awt.Dimension dim)
          Constructor.
 
Method Summary
(package private)  void add(Field f, java.lang.String v, java.awt.Rectangle r)
          Adds a new field, its display value, and its position on the page.
(package private)  void buildPage()
          Builds the swing page and adds it to the parent.
(package private)  void forgetPage()
          Forgets the page we have built, removes it from its parent, and restores the field information so we can build the page later.
(package private)  SwingPage getPage()
          Returns the swing page.
(package private)  boolean isPageBuilt()
          Returns true if the swing page has been built.
(package private)  void prebuildPage()
          Builds the swing page and adds it to the parent, all in a separate thread.
(package private)  void showPage()
          Displays the swing page, building it first if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pageFields

java.util.ArrayList pageFields

page

SwingPage page

pageNumber

int pageNumber

parent

javax.swing.JPanel parent

pageDim

java.awt.Dimension pageDim

buildThread

java.lang.Thread buildThread
Constructor Detail

SwingPageContents

SwingPageContents(javax.swing.JPanel parent,
                  int pageNumber,
                  java.awt.Dimension dim)
Constructor.

Parameters:
parent - the panel in which this page will be displayed; its layout must be a CardLayout
pageNumber - the page number, starting at 1
dim - the page dimensions
Method Detail

add

void add(Field f,
         java.lang.String v,
         java.awt.Rectangle r)
Adds a new field, its display value, and its position on the page.

Parameters:
f - a report field
v - the field's display value (retrieved from the database or otherwise calculated)
r - the display position and size

isPageBuilt

boolean isPageBuilt()
Returns true if the swing page has been built.


getPage

SwingPage getPage()
Returns the swing page. If the page is being built, wait for the page building to complete before returning the page. If page construction has not started, build the page and return it.

Returns:
a SwingPage

showPage

void showPage()
Displays the swing page, building it first if necessary.


prebuildPage

void prebuildPage()
Builds the swing page and adds it to the parent, all in a separate thread. Calls buildPage().

This isn't entirely thread safe, but it's close enough for our purposes.


buildPage

void buildPage()
Builds the swing page and adds it to the parent.


forgetPage

void forgetPage()
Forgets the page we have built, removes it from its parent, and restores the field information so we can build the page later.