All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.netobjects.nfx.wizard.WizardPageView

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.JPanel
                                   |
                                   +----com.netobjects.nfx.wizard.WizardPageView

public class WizardPageView
extends JPanel
This class is the view corrisponding to the wizard-page class which is the model portion. The controller is replaced by the java Observable/Observer mechanism. It takes care of creation, display and layout of UI controls etc...

The purpose for the full model-view-controller approach is not just that it is good design practice but that we want the ability to load page objects into the wizard without initially creating all the expensive and numerous Swing UI controls. If the user gets only a couple of pages into the wizard and hits 'finish', all subsequent view pages will never get created.

Version:
1.0
Author:
Scott Cinnamond

Variable Index

 o dmContentPanel
 o dmImagePanel
 o dmPagePanel
 o dmPagePanelLeftInset
 o dmTextCanvas
 o dmTextPanel
 o dmWizardPage

Constructor Index

 o WizardPageView()
Constructor.
 o WizardPageView(WizardPage)
Constructor.

Method Index

 o clipIndexOf(String, int, int, FontMetrics)
Return the last index within the given string which will fit within the given pixel width.
 o createComponents()
 o createControls()
Create the UI controls.
 o createImagePanel()
 o createTextCanvas()
 o getContentPanel()
Get the content panel for this view.
 o getExceptionHandler()
 o getModel()
Get the wizard page-model associated with this view.
 o getWizard()
Get the wizard associated with this view.
 o getWizardPage()
Get the wizard page-model associated with this view.
 o isValid()
Return true if data in controls is valid such that we may proceed to the next panel.
 o layoutComponents()
 o setDirty(boolean)
A comvienence method which flags the page/model as dirty.
 o setModel(WizardPage)
Set the wizard page-model associated with this view.
 o toLines(String, int, int, FontMetrics)
Return the last index within the given string which will fit within the given pixel width.
 o validate()
Validate the view.

Variables

 o dmWizardPage
 private WizardPage dmWizardPage
 o dmImagePanel
 private JPanel dmImagePanel
 o dmPagePanel
 private JPanel dmPagePanel
 o dmTextPanel
 private JPanel dmTextPanel
 o dmContentPanel
 private JPanel dmContentPanel
 o dmTextCanvas
 private WizardPageView. ImageCanvas dmTextCanvas
 o dmPagePanelLeftInset
 private int dmPagePanelLeftInset

Constructors

 o WizardPageView
 public WizardPageView()
Constructor.

 o WizardPageView
 public WizardPageView(WizardPage page)
Constructor.

Parameters:
page - the page model.

Methods

 o createComponents
 protected void createComponents()
 o layoutComponents
 protected void layoutComponents()
 o createControls
 public void createControls()
Create the UI controls.

 o createImagePanel
 private void createImagePanel()
 o createTextCanvas
 private void createTextCanvas()
 o validate
 public void validate()
Validate the view.

Overrides:
validate in class Container
 o getWizardPage
 public WizardPage getWizardPage()
Get the wizard page-model associated with this view.

Returns:
the model.
 o getModel
 public WizardPage getModel()
Get the wizard page-model associated with this view.

Returns:
the model.
 o setModel
 public void setModel(WizardPage model)
Set the wizard page-model associated with this view.

Parameters:
model - the wizard-page model.
 o getWizard
 public Wizard getWizard()
Get the wizard associated with this view.

Returns:
the wizard.
 o getExceptionHandler
 public ExceptionHandler getExceptionHandler()
 o setDirty
 public void setDirty(boolean set)
A comvienence method which flags the page/model as dirty.

Parameters:
set - true/false.
 o getContentPanel
 protected JPanel getContentPanel()
Get the content panel for this view.

Returns:
the panel.
 o isValid
 public boolean isValid()
Return true if data in controls is valid such that we may proceed to the next panel.

Overrides:
isValid in class Component
 o toLines
 private Vector toLines(String s,
                        int width,
                        int maxLines,
                        FontMetrics fm)
Return the last index within the given string which will fit within the given pixel width. Tokenize the string finding the total width after each token.

Parameters:
s - the string
width - the width in pixels to clip the string to.
maxLines - the maximum number of output lines desired.
fm - the font metrics
Returns:
the clip index or -1 if the first token will not fit within the given width.
 o clipIndexOf
 private int clipIndexOf(String s,
                         int idx,
                         int width,
                         FontMetrics fm)
Return the last index within the given string which will fit within the given pixel width. Tokenize the string finding the total width after each token.

Parameters:
s - the string
idx - the start index
width - the width in pixels to clip the string to.
fm - the font metrics
Returns:
the clip index or -1 if the first token will not fit within the given width.

All Packages  Class Hierarchy  This Package  Previous  Next  Index