Interface JadicePageView
- All Superinterfaces:
com.google.gwt.user.client.ui.IsWidget
,MenuContributor
,ViewComponent
- All Known Subinterfaces:
PageView
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Clean up this view by removing a document currently being displayed.Return the current page.Returns the render controls of the current page.int
Return the current page index.Get the bounds of the viewport with respect to the currently focused page.Returns the render controls for the current document.com.levigo.jadice.web.client.viewer.internal.LaidOutPage
Get the LaidOutPage at the given position ornull
if there is no such page.com.levigo.jadice.web.client.viewer.internal.LaidOutPage
Get the LaidOutPage at the given position ornull
if there is no such page.getPageControls
(Page page) Returns the render controls of the given page.getPageControls
(Page Page, boolean create) Returns the render controls of the given page.int
Convenience getter for the total number of pages.Return the coordinate of the top left point of the current page's visible area in document units.Returns the currently usedRenderControlInventory
by thisJadicePageView
.void
repaint()
Repaints this component.void
Repaint all of the given page.void
repaint
(Page p, Rectangle2D boundsDU) Repaint all of the given page.void
void
scrollRectToTop
(Page targetPage, Rectangle2D rectDU) Instructs theJadicePageView
to scroll to the giventargetPage
and ensures that thetarget rectangle
is visible and the top of the view is scrolled to the top of the rectangle.void
scrollRectToVisible
(Page targetPage, Rectangle2D rectDU) Instructs theJadicePageView
to scroll to the giventargetPage
and ensures that thetarget rectangle
is visible.void
setCurrentPage
(Page page) Navigate to the given page.void
setCurrentPageIndex
(int i) Deprecated.Use setCurrentPage() instead (in order to support filtered documents)void
setDocument
(Document doc) Changes the document reference to be displayed within this page view instance.void
setPageLayoutStyle
(PageView.Layout pageLayout) Changes the layout style responsible for laying out pages to be displayed in page view.Methods inherited from interface com.google.gwt.user.client.ui.IsWidget
asWidget
Methods inherited from interface com.levigo.jadice.web.client.ui.menu.MenuContributor
contribute
Methods inherited from interface com.levigo.jadice.web.client.ViewComponent
getDocument, getToolManager, getToolMangerConnection, getVisibleRect, repaintAnnosAndTools, repaintAnnosAndTools, repaintAnnosAndTools, repaintAnnosAndTools, resetScrollPosition, scrollRectToVisible
-
Method Details
-
setDocument
Changes the document reference to be displayed within this page view instance.- Parameters:
doc
- the document to set- Throws:
IllegalStateException
- if the calling thread is not the @ link EventQueue Event Dispatch Thread}
-
getRenderControlsInventory
RenderControlInventory getRenderControlsInventory()Returns the currently usedRenderControlInventory
by thisJadicePageView
.To support multi viewer usage of one single document instance, viewers always works on snapshots of document render control inventories. As a consequence, changes done to this snapshot inventory are not recognized by any other
If developers want to change render settings in a render control inventory, it is strongly recommended to use only one of the two following recommended ways:JadicePageView
instance and the lifetime of this snapshot ends when the document will be exchanged with a call ofsetDocument(Document)
.Recommendation Document is used in at least in one viewer? Recommended way to do changes Yes Use getRenderControlsInventory()
method of the targetJadicePageView
instance and do the changes.
It is not a guaranteed feature that the concluded changes are recognized by the targetJadicePageView
instance. It is up to the developer to decide based on the type of changes whether to force aJadicePageView
update or not.- Returns:
- the currently used
RenderControlInventory
instance
-
getCurrentPage
Page getCurrentPage()Return the current page.- Returns:
- the current page or
null
if there is none.
-
getPageAt
Get the LaidOutPage at the given position ornull
if there is no such page.- Parameters:
p
- Point in px coordinates- Returns:
- an ArrangedPage
-
getPageAt
com.levigo.jadice.web.client.viewer.internal.LaidOutPage getPageAt(Point p, boolean ignoreDistantPages) Get the LaidOutPage at the given position ornull
if there is no such page.- Parameters:
p
- Point in px coordinatesignoreDistantPages
- whether pages should be ignored which are far away from the given point- Returns:
- an
LaidOutPage
-
getDocumentControls
RenderControls getDocumentControls()Returns the render controls for the current document. If no current document is available, a default render controls object will be returned.Modifications of the render controls are allowed, but should be done carefully. The recommended way to change render controls should be done via a reference of a
RenderControlInventory
. See thegetRenderControlsInventory()
comment for the recommended ways.- Returns:
- the document controls
-
getCurrentPageControls
RenderControls getCurrentPageControls()Returns the render controls of the current page. Modifications of the render controls are allowed, but should be done carefully. The recommended way to change render controls should be done via the
RenderControlInventory
.If no render control is available for the current page, the document render control will be returned.
- Returns:
- the render controls reference of the current page, either based on a per-page controls instance or the document controls.
-
getPageControls
Returns the render controls of the given page. Modifications of the render controls are allowed, but should be done carefully. The recommended way to change render controls should be done via the
RenderControlInventory
.If no render control is available for the given page, the document render control will be returned.
- Parameters:
page
- the page the lookup should be done for- Returns:
- the render controls reference of the given page, either based on a per-page controls instance or the document controls.
-
getPageControls
Returns the render controls of the given page.If no render controls is available for given page, the create parameter decides whether it should be created and returned. If the create parameter is
false
and no page render controls is available, the document render controls will be returned.Modifications of the render controls are allowed, but should be done carefully. The recommended way to change render controls should be done via a reference of a
RenderControlInventory
. SeegetRenderControlsInventory()
comment for the recommended ways.- Parameters:
Page
- the page the lookup should be done forcreate
- whether a render controls instance should be created if not available- Returns:
- the render controls reference of the given page. If no render controls instance is available for the given page, the parameter create decides, whether a new one should be created or not. If not available and it should not be created, the document render controls will be returned.
- Throws:
IllegalArgumentException
- if the given page isnull
-
setCurrentPageIndex
Deprecated.Use setCurrentPage() instead (in order to support filtered documents)Navigate to the given page number. This is a zero-based index.- Parameters:
i
- the page index to be navigated to- Throws:
NullPointerException
- if there is no document to be displayedIllegalStateException
- if the calling thread is not the @ link EventQueue Event Dispatch Thread}
-
setCurrentPage
Navigate to the given page.- Parameters:
page
- the page to be navigated to
-
getCurrentPageIndex
int getCurrentPageIndex()Return the current page index. This is a zero-based value.
It is up to the page layout to determine the current page index. Please note that, depending on the page layout, the current page number may or may not be the one you most recently navigated to.
In other words:
pageView.setCurrentPageIndex(x); assert pageView.getCurrentPageIndex() == x;
Does not necessarily hold.- Returns:
- the current page number as determined by the current page layout.
-
getPageCount
int getPageCount()Convenience getter for the total number of pages. If there is a document, it is equivalent togetDocument().getPageCount()
. Otherwise it returns 0.- Returns:
- the document's page count or 0
-
getPanPoint
Point getPanPoint()Return the coordinate of the top left point of the current page's visible area in document units. This is equivalent togetCurrentPageVisibleBounds()
.getLocation()
.- Returns:
- the pan point
-
getCurrentPageVisibleBounds
Rectangle getCurrentPageVisibleBounds()Get the bounds of the viewport with respect to the currently focused page. The bounds are normalized to document space.- Returns:
- Rectangle the intersection of the viewport bounds and visible page part
-
setPageLayoutStyle
Changes the layout style responsible for laying out pages to be displayed in page view.- Parameters:
pageLayout
- the new layout style to display the pages. For the available layout styles seePageLayout
- Throws:
IllegalStateException
- if the calling thread is not the @ link EventQueue Event Dispatch Thread}NullPointerException
- if given layout style parameter isnull
- See Also:
-
getPageLayoutStyle
PageView.Layout getPageLayoutStyle() -
scrollRectToVisible
Instructs theJadicePageView
to scroll to the giventargetPage
and ensures that thetarget rectangle
is visible. TheDimension2D
target rectangle} is expressed indocument base coordinates
.- Parameters:
targetPage
- the page to scroll to visibilityrectDU
- the bounds to scroll to visibility in document units.
-
scrollRectToTop
Instructs theJadicePageView
to scroll to the giventargetPage
and ensures that thetarget rectangle
is visible and the top of the view is scrolled to the top of the rectangle. TheDimension2D
target rectangle} is expressed indocument base coordinates
.- Parameters:
targetPage
- the page to scroll to visibilityrectDU
- the bounds to scroll to visibility in document units.
-
repaint
void repaint()Description copied from interface:ViewComponent
Repaints this component.If this component is a lightweight component, this method causes a call to this component's
paint
method as soon as possible. Otherwise, this method causes a call to this component'supdate
method as soon as possible.- Specified by:
repaint
in interfaceViewComponent
-
repaint
- Specified by:
repaint
in interfaceViewComponent
-
repaint
Repaint all of the given page.- Specified by:
repaint
in interfaceViewComponent
- Parameters:
p
- the page to repaint
-
repaint
Repaint all of the given page.- Specified by:
repaint
in interfaceViewComponent
- Parameters:
p
- the page to repaintboundsDU
- the bounds within the page to repaint.
-
cleanup
void cleanup()Clean up this view by removing a document currently being displayed. Also multiple ressources are freed. When removing the viewer associated with this page view this method should be called to prevent a memory leak.- Specified by:
cleanup
in interfaceViewComponent
-
getPresentationRuleManager
PresentationRuleManager getPresentationRuleManager()- Returns:
- the PresentationRuleManager
-