Style Intelligence v12.0

inetsoft.report
Class Previewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by inetsoft.report.Previewer
All Implemented Interfaces:
PreviewView, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class Previewer
extends Frame
implements PreviewView, ActionListener

The Previewer class can be used to preview a document before it's actually printed. The Previewer is very easy to use. Its main API is consisted of one method, Previewer.print(ReportSheet). To add preview capability to your application, simply create a Previewer, pack and set it to visible like any window, and call the print() method with the created report.

Previewer implements the PreviewView interface, which defines the API used for previewing a report. The Style Report supports three variations of previewer. The Previewer class is AWT based and has no dependency on the Swing package, and uses JDK1.1 only API. The JPreviewer is JDK1.1 based previewer but uses Swing for the GUI components. The Previewer2D is JDK1.2 based and supports the advanced Java2D API.

The Previewer provides a convenience method, createPreviewer() to create a previewer based on the program's runtime. If a program is running in JDK1.2, the createPreviewer() constructs a Previewer2D object. Otherwise, if Swing is accessible in the runtime, it constructs a JPreviewer object. If none of the above condition is satisfied, it creates a plain Previewer that only requires the core JDK1.1 support. Since all three previewer variants implements the PreviewView interface, it should be used to access the previewer API.

    PreviewView previewer = Previewer.createPreviewer();
    previewer.pack();
    previewer.setVisible(true);
    previewer.print(report);
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  PreviewPane pane
           
protected  ReportSheet sheet
           
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface inetsoft.report.PreviewView
CLOSE_BUTTON, FULL_SCREEN_BUTTON, N_PAGE_BUTTON, ONE_PAGE_BUTTON, PRINT_BUTTON, ZOOM_BUTTON
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Previewer()
          Create an empty previewer.
Previewer(String title)
          Create a previewer with specified title.
Previewer(String title, boolean fullpage)
          Create a previewer with specified title.
Previewer(String title, int w, int h)
          Create a previewer with specified title and size.
Previewer(String title, PrintJob job, boolean fullpage)
          Create a previewer with specified title.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Start printing.
 void addDisposeListener(ActionListener listener)
          Add a dispose listener which will be notified when the preview view be disposed.
 void addSelectionListener(SelectionListener l)
          Add a selection listener.
 void addToolbarComponent(Component comp)
          Add a component to the toolbar.
protected  PreviewPane createPane()
          Create the main preview pane.
static PreviewView createPreviewer()
          Create a new PreviewView object according to the runtime environment.
 void dispose()
          Dispose the preview window.
 int getOrientation()
          Returns the orientation of this PageFormat.
 double getPageHeight()
          Get the page height in inches.
 int getPageResolution()
          Deprecated. as of 5.1.
 double getPageWidth()
          Get the page width in inches.
 Dimension getPreferredSize()
          The previewer defaults to full screen size.
 ReportSheet getReport()
          Get the report displayed in this previewer.
 Enumeration getStylePages()
          Get the style pages in the preview frame.
 double getZoom()
          Get the zoom percentage.
static void main(String[] args)
          Run previewer as a standalone program to view a saved report.
 void print(ReportSheet sheet)
          Print the report in this previewer.
 void printAction()
          Start printing to printer.
 void removeSelectionListener(SelectionListener l)
          Remove a selection listener.
 void setExitOnClose(boolean exitit)
          If the ExitOnClose is set to true, the Previewer exits from the application when the previewer window is closed.
 void setOrientation(int orientation)
          Deprecated. as of 5.1.
 void setPageHeight(double height)
          Deprecated. as of 5.1.
 void setPageResolution(int res)
          Deprecated. as of 5.1.
 void setPages(int rows, int cols)
          Set the multi-page dimension.
 void setPageWidth(double width)
          Deprecated. as of 5.1.
 void setPreferredSize(Dimension size)
          Set the preferred size of the previewer window.
 void setStylePages(Enumeration pages)
          Display the StylePages in the preview pane.
 void setToolbarButtons(int buttons)
          Set the buttons on the toolbar.
 void update(Graphics g)
           
 void writeReport(OutputStream os)
          Writes the previewed report into a .sro file.
 void zoom(double perc)
          Set the zooming percentage.
 
Methods inherited from class java.awt.Frame
addNotify, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface inetsoft.report.PreviewView
pack, setTitle, setVisible
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

pane

protected PreviewPane pane

sheet

protected ReportSheet sheet
Constructor Detail

Previewer

public Previewer()
Create an empty previewer.


Previewer

public Previewer(String title,
                 boolean fullpage)
Create a previewer with specified title. If the fullpage is true, display the pages in one page per screen view. Otherwise, display the page in full size (100%).

Parameters:
title - previewer title.
fullpage - true to show pages in one pg/screen.

Previewer

public Previewer(String title,
                 PrintJob job,
                 boolean fullpage)
Create a previewer with specified title. If the fullpage is true, display the pages in one page per screen view. Otherwise, display the page in full size (100%).

The PrintJob is used for printing when the previewer print button is pressed. The page size information is also extracted from the PrintJob object.

Parameters:
title - previewer title.
job - print job.
fullpage - true to show pages in one pg/screen.

Previewer

public Previewer(String title)
Create a previewer with specified title.

Parameters:
title - previewer title.

Previewer

public Previewer(String title,
                 int w,
                 int h)
Create a previewer with specified title and size.

Parameters:
title - window title.
w - window width.
h - window height.
Method Detail

createPreviewer

public static PreviewView createPreviewer()
Create a new PreviewView object according to the runtime environment.

Returns:
PreviewView object.

createPane

protected PreviewPane createPane()
Create the main preview pane.

Returns:
preview pane object.

printAction

public void printAction()
Start printing to printer. This will popup the print dialog. It has the same effect as an user clicking on the 'printer' button.

Specified by:
printAction in interface PreviewView

setToolbarButtons

public void setToolbarButtons(int buttons)
Set the buttons on the toolbar.

Specified by:
setToolbarButtons in interface PreviewView
Parameters:
buttons - bit-wise OR of the button masks.

addToolbarComponent

public void addToolbarComponent(Component comp)
Add a component to the toolbar.

Specified by:
addToolbarComponent in interface PreviewView

actionPerformed

public void actionPerformed(ActionEvent e)
Start printing.

Specified by:
actionPerformed in interface ActionListener

getPreferredSize

public Dimension getPreferredSize()
The previewer defaults to full screen size.

Overrides:
getPreferredSize in class Container

setPreferredSize

public void setPreferredSize(Dimension size)
Set the preferred size of the previewer window.

Specified by:
setPreferredSize in interface PreviewView
Overrides:
setPreferredSize in class Component

setPageWidth

public void setPageWidth(double width)
Deprecated. as of 5.1.

Set the page width in inches. This is the height after the orientation is taken into account.

Specified by:
setPageWidth in interface PreviewView
Parameters:
width - page width.

getPageWidth

public double getPageWidth()
Get the page width in inches.

Specified by:
getPageWidth in interface PreviewView
Returns:
page width.

setPageHeight

public void setPageHeight(double height)
Deprecated. as of 5.1.

Set the page height in inches. This is the height after the orientation is taken into account.

Specified by:
setPageHeight in interface PreviewView
Parameters:
height - page height.

getPageHeight

public double getPageHeight()
Get the page height in inches.

Specified by:
getPageHeight in interface PreviewView
Returns:
page height.

setOrientation

public void setOrientation(int orientation)
Deprecated. as of 5.1.

Sets the page orientation. orientation must be one of the constants: PORTRAIT, LANDSCAPE.

Specified by:
setOrientation in interface PreviewView
Parameters:
orientation - the new orientation for the page

getOrientation

public int getOrientation()
Returns the orientation of this PageFormat.

Specified by:
getOrientation in interface PreviewView
Returns:
this PageFormat object's orientation.

setPageResolution

public void setPageResolution(int res)
Deprecated. as of 5.1.

Set the page resolution, as number of dots per inch. The default is 72.

Specified by:
setPageResolution in interface PreviewView
Parameters:
res - page resolution.

getPageResolution

public int getPageResolution()
Deprecated. as of 5.1.

Get the page resolution.

Specified by:
getPageResolution in interface PreviewView
Returns:
page resolution.

getStylePages

public Enumeration getStylePages()
Get the style pages in the preview frame.

Specified by:
getStylePages in interface PreviewView

setStylePages

public void setStylePages(Enumeration pages)
Display the StylePages in the preview pane.

Specified by:
setStylePages in interface PreviewView
Parameters:
pages - return a collection of StylePage objects.

print

public void print(ReportSheet sheet)
Print the report in this previewer.

Specified by:
print in interface PreviewView
Parameters:
sheet - report.

getReport

public ReportSheet getReport()
Get the report displayed in this previewer.

Specified by:
getReport in interface PreviewView

zoom

public void zoom(double perc)
Set the zooming percentage. 100% is 1.0.

Specified by:
zoom in interface PreviewView
Parameters:
perc - zooming percentage.

getZoom

public double getZoom()
Get the zoom percentage.

Specified by:
getZoom in interface PreviewView

setExitOnClose

public void setExitOnClose(boolean exitit)
If the ExitOnClose is set to true, the Previewer exits from the application when the previewer window is closed.

Specified by:
setExitOnClose in interface PreviewView

addSelectionListener

public void addSelectionListener(SelectionListener l)
Add a selection listener. The listener is notified if an user clicks inside a report element;

Specified by:
addSelectionListener in interface PreviewView

removeSelectionListener

public void removeSelectionListener(SelectionListener l)
Remove a selection listener.

Specified by:
removeSelectionListener in interface PreviewView

setPages

public void setPages(int rows,
                     int cols)
Set the multi-page dimension.

Parameters:
rows - the number of rows.
cols - the number of columns.

update

public void update(Graphics g)
Overrides:
update in class Container

dispose

public void dispose()
Dispose the preview window.

Overrides:
dispose in class Window

addDisposeListener

public void addDisposeListener(ActionListener listener)
Description copied from interface: PreviewView
Add a dispose listener which will be notified when the preview view be disposed.

Specified by:
addDisposeListener in interface PreviewView

writeReport

public void writeReport(OutputStream os)
Writes the previewed report into a .sro file.

Specified by:
writeReport in interface PreviewView

main

public static void main(String[] args)
Run previewer as a standalone program to view a saved report. The report file must be saved with the Builder.REPORT option.
   Usage:  java inetsoft.report.Previewer report
 


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.