com.jrefinery.report.preview
Class PreviewProxyBase

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.jrefinery.report.preview.PreviewProxyBase
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class PreviewProxyBase
extends javax.swing.JComponent

A preview proxy.

Author:
Thomas Morgner.
See Also:
Serialized Form

Nested Class Summary
protected  class PreviewProxyBase.ZoomSetAction
          A zoom set action.
 
Field Summary
static java.lang.String BASE_RESOURCE_CLASS
          The base class for localised resources.
static int DEFAULT_REPORT_PANE_HEIGHT
          The default height of the report pane.
static int DEFAULT_REPORT_PANE_WIDTH
          The default width of the report pane.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PreviewProxyBase(PreviewProxy proxy)
          Creates a preview proxy.
 
Method Summary
protected  javax.swing.JButton createButton(javax.swing.Action action)
          Creates a button using the given action properties for the button's initialisation.
protected  javax.swing.Action createDefaultAboutAction()
          Creates the AboutAction used in this previewframe.
protected  javax.swing.Action createDefaultFirstPageAction()
          Creates the FirstPageAction used in this previewframe.
protected  javax.swing.Action createDefaultGotoAction()
          Creates the GotoPageAction used in this previewframe.
protected  javax.swing.Action createDefaultLastPageAction()
          Creates the LastPageAction used in this previewframe.
protected  javax.swing.Action createDefaultNextPageAction()
          Creates the NextPageAction used in this previewframe.
protected  javax.swing.Action createDefaultPreviousPageAction()
          Creates the PreviousPageAction used in this previewframe.
protected  javax.swing.Action createDefaultZoomInAction()
          Creates the ZoomInAction used in this previewframe.
protected  javax.swing.Action createDefaultZoomOutAction()
          Creates the ZoomOutAction used in this previewframe.
protected  javax.swing.JMenuBar createMenuBar()
          Creates and returns a menu-bar for the frame.
protected  javax.swing.JMenuItem createMenuItem(javax.swing.Action action)
          Creates a menu item based on the supplied action.
protected  ReportPane createReportPane(JFreeReport report)
          Creates the ReportPane for the report.
protected  com.jrefinery.report.preview.PreviewProxyBase.ReportPanePropertyChangeListener createReportPanePropertyChangeListener()
          Creates a report pane listener.
protected  javax.swing.JPanel createStatusBar()
          Creates the statusbar for this frame.
protected  javax.swing.JToolBar createToolBar()
          Creates and returns a toolbar containing controls for print, page forward and backward, zoom in and out, and an about box.
protected  javax.swing.JComponent createZoomPane()
          Creates a panel containing a combobox with available zoom-values.
protected  javax.swing.Action createZoomSelectAction()
          Creates a zoom select action.
protected  void decreasePageNumber()
          Decreases the page number.
protected  void decreaseZoom()
          Decreases the zoom factor for the report pane (unless it is already at the minimum zoom).
protected  void disableButtons()
          Disables the buttons.
 void dispose()
          Disposes the preview frame.
protected  void firstPage()
          Activates the display of the first page, if not already on the first page.
 javax.swing.Action getAboutAction()
          Returns the 'About' action.
 javax.swing.Action getCloseAction()
          Returns the 'Close' action.
 javax.swing.Action getFirstPageAction()
          Returns the 'First Page' action.
 javax.swing.Action getGotoAction()
          Returns the 'Goto' action.
 javax.swing.Action getLastPageAction()
          Returns the 'Last Page' action.
 java.awt.Dimension getMaximumSize()
          Returns the maximum size of this container.
 javax.swing.Action getNextPageAction()
          Returns the 'Next Page' action.
protected  java.awt.print.Pageable getPageable()
          Returns the report pane, which implements the Pageable interface.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size of this container.
 javax.swing.Action getPreviousPageAction()
          Returns the 'Previous Page' action.
protected  java.awt.print.Printable getPrintable()
          Returns the report pane, which implements the Printable interface.
 java.util.ResourceBundle getResources()
          Retrieves the resources for this PreviewFrame.
 java.lang.String getStatusText()
          Returns the status label used to display the text.
protected  Worker getWorker()
          Returns the worker.
 float getZoomFactor()
          Returns the current zoom factor.
 javax.swing.Action getZoomInAction()
          Returns the 'Zoom In' action.
 javax.swing.Action getZoomOutAction()
          Returns the 'Zoom Out' action.
protected  void increasePageNumber()
          Increases the page number.
protected  void increaseZoom()
          Increases the zoom factor for the report pane (unless it is already at maximum zoom).
 void init(JFreeReport report)
          Initialises the preview dialog.
 boolean isLargeIconsEnabled()
          Returns true if large icons are enabled for the toolbar.
 boolean isToolbarFloatable()
          Returns true, if the toolbar is floatable, false otherwise.
protected  void lastPage()
          Method lastPage moves to the last page.
 void performPagination()
          Paginates the report.
protected  void registerAction(javax.swing.Action action)
          Checks whether this action has a keystroke assigned.
 void setAboutAction(javax.swing.Action aboutAction)
          Sets the 'About' action.
 void setCloseAction(javax.swing.Action closeAction)
          Sets the 'Close' action.
 void setFirstPageAction(javax.swing.Action firstPageAction)
          Sets the 'First Page' action.
 void setGotoAction(javax.swing.Action gotoAction)
          Sets the 'Goto' action.
 void setLargeIconsEnabled(boolean b)
          Sets a flag that controls whether or not large icons are used in the toolbar.
 void setLastPageAction(javax.swing.Action lastPageAction)
          Sets the 'Last Page' action.
 void setMaximumSize(java.awt.Dimension maximumSize)
          defines the maximum size of this container.
 void setNextPageAction(javax.swing.Action nextPageAction)
          Sets the 'Next Page' action.
 void setPreferredSize(java.awt.Dimension preferredSize)
          defines the preferred size of this container.
 void setPreviousPageAction(javax.swing.Action previousPageAction)
          Sets the 'Previous Page' action.
 void setStatusText(java.lang.String text)
           
 void setToolbarFloatable(boolean b)
          Defines whether the toolbar is floatable.
 void setZoomFactor(int index)
          Sets the zoomfactor of the report pane.
 void setZoomInAction(javax.swing.Action zoomInAction)
          Sets the 'Zoom In' action.
 void setZoomOutAction(javax.swing.Action zoomOutAction)
          Sets the 'Zoom Out' action.
protected  void showExceptionDialog(java.lang.String localisationBase, java.lang.Exception e)
          Shows the exception dialog by using localized messages.
 void updatePageFormat(java.awt.print.PageFormat pf)
          Updates the pageformat of the ReportPane.
protected  void validateButtons()
          Updates the states of all buttons to reflect the state of the assigned ReportPane.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMinimumSize, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_REPORT_PANE_WIDTH

public static final int DEFAULT_REPORT_PANE_WIDTH
The default width of the report pane.

See Also:
Constant Field Values

DEFAULT_REPORT_PANE_HEIGHT

public static final int DEFAULT_REPORT_PANE_HEIGHT
The default height of the report pane.

See Also:
Constant Field Values

BASE_RESOURCE_CLASS

public static final java.lang.String BASE_RESOURCE_CLASS
The base class for localised resources.

See Also:
Constant Field Values
Constructor Detail

PreviewProxyBase

public PreviewProxyBase(PreviewProxy proxy)
Creates a preview proxy.

Parameters:
proxy - the proxy.
Method Detail

getWorker

protected Worker getWorker()
Returns the worker.

Returns:
The worker.

init

public void init(JFreeReport report)
          throws ReportProcessingException
Initialises the preview dialog.

Parameters:
report - the report.
Throws:
ReportProcessingException - if there is a problem processing the report.

getMaximumSize

public java.awt.Dimension getMaximumSize()
Returns the maximum size of this container.

Overrides:
getMaximumSize in class javax.swing.JComponent
Returns:
the maximum size of the dialog
See Also:
getPreferredSize()

setMaximumSize

public void setMaximumSize(java.awt.Dimension maximumSize)
defines the maximum size of this container.

Overrides:
setMaximumSize in class javax.swing.JComponent
Parameters:
maximumSize - the maximum size of the dialog
See Also:
setPreferredSize(java.awt.Dimension)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size of this container.

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
an instance of Dimension that represents the preferred size of this container.
See Also:
JComponent.getMinimumSize(), Container.getLayout(), LayoutManager.preferredLayoutSize(java.awt.Container), Component.getPreferredSize()

setPreferredSize

public void setPreferredSize(java.awt.Dimension preferredSize)
defines the preferred size of this container.

Overrides:
setPreferredSize in class javax.swing.JComponent
Parameters:
preferredSize - defines the preferred size for the PreviewComponent.
See Also:
setPreferredSize(java.awt.Dimension)

createReportPanePropertyChangeListener

protected com.jrefinery.report.preview.PreviewProxyBase.ReportPanePropertyChangeListener createReportPanePropertyChangeListener()
Creates a report pane listener.

Returns:
the listener.

createReportPane

protected ReportPane createReportPane(JFreeReport report)
                               throws ReportProcessingException
Creates the ReportPane for the report.

Parameters:
report - the report for this pane.
Returns:
the report pane.
Throws:
ReportProcessingException - if there is a problem processing the report.

getResources

public java.util.ResourceBundle getResources()
Retrieves the resources for this PreviewFrame. If the resources are not initialized, they get loaded on the first call to this method.

Returns:
this frames ResourceBundle.

getZoomFactor

public float getZoomFactor()
Returns the current zoom factor.

Returns:
The current zoom factor.

getPageable

protected java.awt.print.Pageable getPageable()
Returns the report pane, which implements the Pageable interface.

Returns:
the report pane.

getPrintable

protected java.awt.print.Printable getPrintable()
Returns the report pane, which implements the Printable interface.

Returns:
the report pane.

showExceptionDialog

protected void showExceptionDialog(java.lang.String localisationBase,
                                   java.lang.Exception e)
Shows the exception dialog by using localized messages. The message base is used to construct the localisation key by appending ".title" and ".message" to the base name.

Parameters:
localisationBase - the resource key prefix.
e - the exception.

lastPage

protected void lastPage()
Method lastPage moves to the last page.


increasePageNumber

protected void increasePageNumber()
Increases the page number.


firstPage

protected void firstPage()
Activates the display of the first page, if not already on the first page.


decreasePageNumber

protected void decreasePageNumber()
Decreases the page number.


increaseZoom

protected void increaseZoom()
Increases the zoom factor for the report pane (unless it is already at maximum zoom).


decreaseZoom

protected void decreaseZoom()
Decreases the zoom factor for the report pane (unless it is already at the minimum zoom).


setZoomFactor

public void setZoomFactor(int index)
Sets the zoomfactor of the report pane.

Parameters:
index - the index into the array of standard zoom factors.

registerAction

protected void registerAction(javax.swing.Action action)
Checks whether this action has a keystroke assigned. If it has one, the keystroke is assigned to the frame.

Parameters:
action - the action.

createDefaultNextPageAction

protected javax.swing.Action createDefaultNextPageAction()
Creates the NextPageAction used in this previewframe.

Returns:
the 'next page' action.

createDefaultPreviousPageAction

protected javax.swing.Action createDefaultPreviousPageAction()
Creates the PreviousPageAction used in this previewframe.

Returns:
the 'previous page' action.

createDefaultZoomInAction

protected javax.swing.Action createDefaultZoomInAction()
Creates the ZoomInAction used in this previewframe.

Returns:
the 'zoom in' action.

createDefaultZoomOutAction

protected javax.swing.Action createDefaultZoomOutAction()
Creates the ZoomOutAction used in this previewframe.

Returns:
the 'zoom out' action.

createDefaultAboutAction

protected javax.swing.Action createDefaultAboutAction()
Creates the AboutAction used in this previewframe.

If you subclass PreviewFrame, and override this method, you can display your own 'about' dialog.

Returns:
the 'about' action.

createZoomSelectAction

protected javax.swing.Action createZoomSelectAction()
Creates a zoom select action.

Returns:
the action.

createDefaultGotoAction

protected javax.swing.Action createDefaultGotoAction()
Creates the GotoPageAction used in this previewframe.

Returns:
the 'goto' action.

createDefaultFirstPageAction

protected javax.swing.Action createDefaultFirstPageAction()
Creates the FirstPageAction used in this previewframe.

Returns:
the 'first page' action.

createDefaultLastPageAction

protected javax.swing.Action createDefaultLastPageAction()
Creates the LastPageAction used in this previewframe.

Returns:
the 'last page' action.

getStatusText

public java.lang.String getStatusText()
Returns the status label used to display the text.

Returns:
the status label.

setStatusText

public void setStatusText(java.lang.String text)

createStatusBar

protected javax.swing.JPanel createStatusBar()
Creates the statusbar for this frame. Use setStatus() to display text on the status bar.

Returns:
the status bar.

createMenuBar

protected javax.swing.JMenuBar createMenuBar()
Creates and returns a menu-bar for the frame.

Returns:
A ready-made JMenuBar.

createButton

protected javax.swing.JButton createButton(javax.swing.Action action)
Creates a button using the given action properties for the button's initialisation.

Parameters:
action - the action used to set up the button.
Returns:
a button based on the supplied action.

createMenuItem

protected javax.swing.JMenuItem createMenuItem(javax.swing.Action action)
Creates a menu item based on the supplied action.

Parameters:
action - the action.
Returns:
the menu item.

createToolBar

protected javax.swing.JToolBar createToolBar()
Creates and returns a toolbar containing controls for print, page forward and backward, zoom in and out, and an about box.

Returns:
A completely initialized JToolBar.

isToolbarFloatable

public boolean isToolbarFloatable()
Returns true, if the toolbar is floatable, false otherwise.

Returns:
true when the toolbar is floatable.

setToolbarFloatable

public void setToolbarFloatable(boolean b)
Defines whether the toolbar is floatable.

Parameters:
b - a flag that indicates whether or not the toolbar is floatable.

createZoomPane

protected javax.swing.JComponent createZoomPane()
Creates a panel containing a combobox with available zoom-values.

Returns:
a panel containing a combobox with zoom values.

validateButtons

protected void validateButtons()
Updates the states of all buttons to reflect the state of the assigned ReportPane.


disableButtons

protected void disableButtons()
Disables the buttons.


isLargeIconsEnabled

public boolean isLargeIconsEnabled()
Returns true if large icons are enabled for the toolbar.

Returns:
true if large icons are enabled.

setLargeIconsEnabled

public void setLargeIconsEnabled(boolean b)
Sets a flag that controls whether or not large icons are used in the toolbar.

Parameters:
b - the new value of the flag.

dispose

public void dispose()
Disposes the preview frame.


getAboutAction

public javax.swing.Action getAboutAction()
Returns the 'About' action.

Returns:
the 'About' action.

setAboutAction

public void setAboutAction(javax.swing.Action aboutAction)
Sets the 'About' action.

Parameters:
aboutAction - the 'About' action.

getCloseAction

public javax.swing.Action getCloseAction()
Returns the 'Close' action.

Returns:
the 'Close' action.

setCloseAction

public void setCloseAction(javax.swing.Action closeAction)
Sets the 'Close' action.

Parameters:
closeAction - the 'Close' action.

getFirstPageAction

public javax.swing.Action getFirstPageAction()
Returns the 'First Page' action.

Returns:
the 'First Page' action.

setFirstPageAction

public void setFirstPageAction(javax.swing.Action firstPageAction)
Sets the 'First Page' action.

Parameters:
firstPageAction - the 'First Page' action.

getLastPageAction

public javax.swing.Action getLastPageAction()
Returns the 'Last Page' action.

Returns:
the 'Last Page' action.

setLastPageAction

public void setLastPageAction(javax.swing.Action lastPageAction)
Sets the 'Last Page' action.

Parameters:
lastPageAction - the 'Last Page' action.

getNextPageAction

public javax.swing.Action getNextPageAction()
Returns the 'Next Page' action.

Returns:
the 'Next Page' action.

setNextPageAction

public void setNextPageAction(javax.swing.Action nextPageAction)
Sets the 'Next Page' action.

Parameters:
nextPageAction - the 'Next Page' action.

getPreviousPageAction

public javax.swing.Action getPreviousPageAction()
Returns the 'Previous Page' action.

Returns:
the 'Previous Page' action.

setPreviousPageAction

public void setPreviousPageAction(javax.swing.Action previousPageAction)
Sets the 'Previous Page' action.

Parameters:
previousPageAction - the 'Previous Page' action.

getZoomInAction

public javax.swing.Action getZoomInAction()
Returns the 'Zoom In' action.

Returns:
the 'Zoom In' action.

setZoomInAction

public void setZoomInAction(javax.swing.Action zoomInAction)
Sets the 'Zoom In' action.

Parameters:
zoomInAction - the 'Zoom In' action.

getZoomOutAction

public javax.swing.Action getZoomOutAction()
Returns the 'Zoom Out' action.

Returns:
the 'Zoom Out' action.

setZoomOutAction

public void setZoomOutAction(javax.swing.Action zoomOutAction)
Sets the 'Zoom Out' action.

Parameters:
zoomOutAction - the 'Zoom Out' action.

getGotoAction

public javax.swing.Action getGotoAction()
Returns the 'Goto' action.

Returns:
the 'Goto' action.

setGotoAction

public void setGotoAction(javax.swing.Action gotoAction)
Sets the 'Goto' action.

Parameters:
gotoAction - the 'Goto' action.

updatePageFormat

public void updatePageFormat(java.awt.print.PageFormat pf)
Updates the pageformat of the ReportPane.

Parameters:
pf -

performPagination

public void performPagination()
Paginates the report.