ReportCat 1.1

li.netcat.print
Class PreviewPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byli.netcat.print.PreviewPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class PreviewPanel
extends javax.swing.JComponent

Defaut implementation of a print preview panel. This panel can be used to visualize one page of a Print. If more than one PreviewPanel is used to view different pages of the same Print, make shure that all PreviewPanels use the same PrintManager as it's model.

This implementation allows the user to modify the print margins interactively.

Author:
Arthur Marxer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int MODE_HEAVY
          Defines the mode of interactivity to "heavy", i.e. the layout is done during the drag operation.
static int MODE_LIGHT
          Defines the mode of interactivity to "light", i.e. the layout is done only once after the drag operation.
static int MODE_NONE
          Defines the mode of interactivity to "none", i.e. the borders cannot be modified interactively.
 
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
PreviewPanel(Print print)
          Constructs a new PreviewPanel using the given Print.
PreviewPanel(PrintManager printManager)
          Constructs a new PreviewPanel using the given PrintManager.
 
Method Summary
 void doLayout()
           
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 PrintManager getPrintManager()
          Returns the PrintManager associated with this preview.
 java.awt.Color getResizeBorderColor()
          Returns the color of the resize border.
 double getZoom()
          Returns the current zoom value.
 void nextPage()
          Increments the pageIndex by 1.
 void paint(java.awt.Graphics g)
           
protected  void paintEmptyPage(java.awt.Graphics g, int width, int height, int paperX, int paperY, int paperWidth, int paperHeight)
          Override this method for a custom look.
protected  void paintNoPage(java.awt.Graphics g, int width, int height, int paperX, int paperY, int paperWidth, int paperHeight)
          Override this method for a custom look.
 void previousPage()
          Decrements the pageIndex by 1.
 void setAutoPageIndex(boolean b)
          If autoPageIndex is set to true (default), the pageIndex is automatically set to the last page of the report if the report has less pages than the current value of pageIndex.
 void setBounds(int x, int y, int width, int height)
           
 void setPageIndex(int index)
          Sets the index of the current page to be displayed.
 void setResizeBorderColor(java.awt.Color color)
          Sets the color of the resize border.
 void setResizeMode(int mode)
          Sets the resize mode.
 void setZoom(double zoom)
          Sets the current zoon value.
 
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, getMaximumSize, 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, 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, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, 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, 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, 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

MODE_NONE

public static int MODE_NONE
Defines the mode of interactivity to "none", i.e. the borders cannot be modified interactively.


MODE_LIGHT

public static int MODE_LIGHT
Defines the mode of interactivity to "light", i.e. the layout is done only once after the drag operation.


MODE_HEAVY

public static int MODE_HEAVY
Defines the mode of interactivity to "heavy", i.e. the layout is done during the drag operation. This is the default.

Constructor Detail

PreviewPanel

public PreviewPanel(Print print)
Constructs a new PreviewPanel using the given Print.

Parameters:
print - The Print to be previewed, might be null.

PreviewPanel

public PreviewPanel(PrintManager printManager)
Constructs a new PreviewPanel using the given PrintManager.

Parameters:
printManager - The PrintManager used for layouting, must not be null.
Method Detail

getPrintManager

public PrintManager getPrintManager()
Returns the PrintManager associated with this preview. Use the manager to modify layout specific properties like the PageFormat.

Returns:
The PrintManager associated with this preview, is never null.

nextPage

public void nextPage()
Increments the pageIndex by 1.


previousPage

public void previousPage()
Decrements the pageIndex by 1.


setPageIndex

public void setPageIndex(int index)
Sets the index of the current page to be displayed.

Parameters:
index - The index of the pageto be displayed, the first page has an index of 0.

setAutoPageIndex

public void setAutoPageIndex(boolean b)
If autoPageIndex is set to true (default), the pageIndex is automatically set to the last page of the report if the report has less pages than the current value of pageIndex.

Parameters:
b - The new value of the autoPageIndex property.

setResizeMode

public void setResizeMode(int mode)
Sets the resize mode.

Parameters:
mode - One of the values MODE_*.

getResizeBorderColor

public java.awt.Color getResizeBorderColor()
Returns the color of the resize border.

Returns:
The color of the resize border.

setResizeBorderColor

public void setResizeBorderColor(java.awt.Color color)
Sets the color of the resize border.

Parameters:
color - The color of the resize border or null, if no border should be painted.

getZoom

public double getZoom()
Returns the current zoom value. A value of 1.0 defines no zoom, a value < 1.0 zooms out and a value > 1.0 zooms in.

Returns:
The current zoom value.

setZoom

public void setZoom(double zoom)
Sets the current zoon value. A value of 1.0 defines no zoom, a value < 1.0 zooms out and a value > 1.0 zooms in.

Parameters:
zoom - The new zoom value.

paintNoPage

protected void paintNoPage(java.awt.Graphics g,
                           int width,
                           int height,
                           int paperX,
                           int paperY,
                           int paperWidth,
                           int paperHeight)
Override this method for a custom look.

Parameters:
g - The Graphics object.
width - The width of the panel.
height - The height of the panel.
paperX - The x offset of the paper.
paperY - The y offset of the paper.
paperWidth - The width of the paper.
paperHeight - The height of the paper.

paintEmptyPage

protected void paintEmptyPage(java.awt.Graphics g,
                              int width,
                              int height,
                              int paperX,
                              int paperY,
                              int paperWidth,
                              int paperHeight)
Override this method for a custom look.

Parameters:
g - The Graphics object.
width - The width of the panel.
height - The height of the panel.
paperX - The x offset of the paper.
paperY - The y offset of the paper.
paperWidth - The width of the paper.
paperHeight - The height of the paper.

getMinimumSize

public java.awt.Dimension getMinimumSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)

doLayout

public void doLayout()

paint

public void paint(java.awt.Graphics g)

ReportCat 1.1

Copyright 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation, Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation, Print,Printing,Printer,Java,Java Print,SDK,Java Printing,Printing Java,Print Java,Library,Java Library,Print Library,Report,Reports,Java Report,Java Programming,Java Output,Layout,Page,API,Preview,Print Preview,Content,A4,Free,Output,Header,Footer,Download,Package,Jar,Evaluation