eu.livotov.tpt.gui.vdv
Class DocumentViewer

java.lang.Object
  extended by com.vaadin.ui.AbstractComponent
      extended by com.vaadin.ui.AbstractComponentContainer
          extended by com.vaadin.ui.AbstractLayout
              extended by com.vaadin.ui.AbstractOrderedLayout
                  extended by com.vaadin.ui.VerticalLayout
                      extended by eu.livotov.tpt.gui.vdv.DocumentViewer
All Implemented Interfaces:
com.vaadin.event.MethodEventSource, com.vaadin.terminal.Paintable, com.vaadin.terminal.Sizeable, com.vaadin.terminal.VariableOwner, com.vaadin.ui.Component, com.vaadin.ui.ComponentContainer, com.vaadin.ui.Layout, com.vaadin.ui.Layout.AlignmentHandler, com.vaadin.ui.Layout.MarginHandler, com.vaadin.ui.Layout.SpacingHandler, java.io.Serializable, java.util.EventListener

public class DocumentViewer
extends com.vaadin.ui.VerticalLayout

The actual viewer component which should be used in applications.

Author:
dlivotov
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponent.ComponentErrorEvent, com.vaadin.ui.AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Layout
com.vaadin.ui.Layout.AlignmentHandler, com.vaadin.ui.Layout.MarginHandler, com.vaadin.ui.Layout.MarginInfo, com.vaadin.ui.Layout.SpacingHandler
 
Nested classes/interfaces inherited from interface com.vaadin.ui.ComponentContainer
com.vaadin.ui.ComponentContainer.ComponentAttachEvent, com.vaadin.ui.ComponentContainer.ComponentAttachListener, com.vaadin.ui.ComponentContainer.ComponentDetachEvent, com.vaadin.ui.ComponentContainer.ComponentDetachListener
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.ErrorListener, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable
com.vaadin.terminal.Paintable.RepaintRequestEvent, com.vaadin.terminal.Paintable.RepaintRequestListener
 
Field Summary
private  int currentPage
           
private  DocumentRasterProvider document
           
private  int rotationFactor
           
private  TPTMultiView viewController
           
private  PageMode viewMode
           
private  float zoomFactor
           
 
Fields inherited from class com.vaadin.ui.AbstractOrderedLayout
components
 
Fields inherited from class com.vaadin.ui.AbstractLayout
margins
 
Fields inherited from interface com.vaadin.ui.Layout.AlignmentHandler
ALIGNMENT_BOTTOM, ALIGNMENT_HORIZONTAL_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TOP, ALIGNMENT_VERTICAL_CENTER
 
Fields inherited from interface com.vaadin.terminal.Sizeable
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
DocumentViewer()
          Creates the new empty viewer component
DocumentViewer(DocumentRasterProvider document)
          Creates the new viewer component and the sets a document to view
DocumentViewer(java.io.File document)
          Creates the new viewer component and loads the specified document.
 
Method Summary
 void closeDocument()
          Closes the current document
 int getCurrentPage()
          Provides number of current page we're viewing
 int getPagesCount()
          Provides number of pages in currently opened document
 int getRotation()
          Provides the current rotation mode.
 PageMode getViewMode()
          Provides the current display mode of the document.
 float getZoom()
          Provides the current zoom factor
 void goPage(int pageNumber)
          Navigates viewer to specified page
 void loadDocument(DocumentRasterProvider document)
          Loads a new document to display
 void loadDocument(java.io.File document)
          Loads a new document to display.
 void setRotation(int rotationFactor)
          Sets document rotation mode.
 void setViewMode(PageMode viewMode)
          Sets the document display mode.
 void setZoom(float zoomFactor)
          Sets the new zoom factor for the document
 
Methods inherited from class com.vaadin.ui.AbstractOrderedLayout
addComponent, addComponent, addComponentAsFirst, addListener, changeVariables, getComponentAlignment, getComponentIterator, getExpandRatio, isSpacing, isSpacingEnabled, paintContent, removeComponent, removeListener, replaceComponent, setComponentAlignment, setComponentAlignment, setComponentAlignment, setExpandRatio, setSpacing
 
Methods inherited from class com.vaadin.ui.AbstractLayout
getMargin, setMargin, setMargin, setMargin
 
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeAllComponents, removeListener, removeListener, requestRepaintAll, setEnabled, setHeight, setWidth
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addListener, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, focus, getApplication, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getLocale, getParent, getStyle, getStyleName, getTag, getWidth, getWidthUnits, getWindow, handleError, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeight, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth, setWidthUnits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.ComponentContainer
addListener, addListener, moveComponentsFrom, removeAllComponents, removeListener, removeListener, requestRepaintAll
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, childRequestedRepaint, detach, getApplication, getCaption, getIcon, getLocale, getParent, getStyleName, getWindow, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setParent, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.vaadin.terminal.Paintable
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId
 
Methods inherited from interface com.vaadin.terminal.VariableOwner
isImmediate
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidth, setWidthUnits
 

Field Detail

document

private DocumentRasterProvider document

zoomFactor

private float zoomFactor

rotationFactor

private int rotationFactor

viewMode

private PageMode viewMode

currentPage

private int currentPage

viewController

private TPTMultiView viewController
Constructor Detail

DocumentViewer

public DocumentViewer()
Creates the new empty viewer component


DocumentViewer

public DocumentViewer(java.io.File document)
Creates the new viewer component and loads the specified document.

Parameters:
document - document file to display. Note, that only PDF files are supported at the moment.

DocumentViewer

public DocumentViewer(DocumentRasterProvider document)
Creates the new viewer component and the sets a document to view

Parameters:
document - document raster provider
Method Detail

loadDocument

public void loadDocument(java.io.File document)
Loads a new document to display. Do not forget to call closeDocument(); if you had previous document open.

Parameters:
document - new document file to display. Note, that only PDF files are supported at the moment

loadDocument

public void loadDocument(DocumentRasterProvider document)
Loads a new document to display

Parameters:
document - raster provider instance which represents the data of new document

closeDocument

public void closeDocument()
Closes the current document


getPagesCount

public int getPagesCount()
Provides number of pages in currently opened document

Returns:
number of pages

goPage

public void goPage(int pageNumber)
Navigates viewer to specified page

Parameters:
pageNumber - new page number to navigate to

getCurrentPage

public int getCurrentPage()
Provides number of current page we're viewing

Returns:
current page

setZoom

public void setZoom(float zoomFactor)
Sets the new zoom factor for the document

Parameters:
zoomFactor - new zoom factor in form of 0.1 .... 9.99 , where 1.0 is a 100% of the document

getZoom

public float getZoom()
Provides the current zoom factor

Returns:
current zoom factor value

setRotation

public void setRotation(int rotationFactor)
Sets document rotation mode. NOT SUPPORTED now

Parameters:
rotationFactor -

getRotation

public int getRotation()
Provides the current rotation mode. NOT SUPPORTED NOW

Returns:
current rotation mode

setViewMode

public void setViewMode(PageMode viewMode)
Sets the document display mode. NOT SUPPORTED NOW

Parameters:
viewMode - new display mode

getViewMode

public PageMode getViewMode()
Provides the current display mode of the document. NOT SUPPORTED NOW

Returns:
current display mode