Interface JadicePageView
- All Superinterfaces:
com.google.gwt.user.client.ui.IsWidget,MenuContributor,ViewComponent
- All Known Subinterfaces:
PageView
-
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Clean up this view by removing a document currently being displayed.Return the current page.Returns the render controls of the current page.intReturn 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.LaidOutPageGet the LaidOutPage at the given position ornullif there is no such page.com.levigo.jadice.web.client.viewer.internal.LaidOutPageGet the LaidOutPage at the given position ornullif 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.intConvenience 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 usedRenderControlInventoryby thisJadicePageView.voidrepaint()Repaints this component.voidRepaint all of the given page.voidrepaint(Page p, Rectangle2D boundsDU) Repaint all of the given page.voidvoidscrollRectToTop(Page targetPage, Rectangle2D rectDU) Instructs theJadicePageViewto scroll to the giventargetPageand ensures that thetarget rectangleis visible and the top of the view is scrolled to the top of the rectangle.voidscrollRectToVisible(Page targetPage, Rectangle2D rectDU) Instructs theJadicePageViewto scroll to the giventargetPageand ensures that thetarget rectangleis visible.voidsetCurrentPage(Page page) Navigate to the given page.voidsetCurrentPageIndex(int i) Deprecated.Use setCurrentPage() instead (in order to support filtered documents)voidsetDocument(Document doc) Changes the document reference to be displayed within this page view instance.voidsetPageLayoutStyle(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
asWidgetMethods inherited from interface com.levigo.jadice.web.client.ui.menu.MenuContributor
contributeMethods 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 usedRenderControlInventoryby 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:JadicePageViewinstance 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 targetJadicePageViewinstance and do the changes.
It is not a guaranteed feature that the concluded changes are recognized by the targetJadicePageViewinstance. It is up to the developer to decide based on the type of changes whether to force aJadicePageViewupdate or not.- Returns:
- the currently used
RenderControlInventoryinstance
-
getCurrentPage
Page getCurrentPage()Return the current page.- Returns:
- the current page or
nullif there is none.
-
getPageAt
Get the LaidOutPage at the given position ornullif 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 ornullif 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
falseand 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 theJadicePageViewto scroll to the giventargetPageand ensures that thetarget rectangleis visible. TheDimension2Dtarget 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 theJadicePageViewto scroll to the giventargetPageand ensures that thetarget rectangleis visible and the top of the view is scrolled to the top of the rectangle. TheDimension2Dtarget 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:ViewComponentRepaints this component.If this component is a lightweight component, this method causes a call to this component's
paintmethod as soon as possible. Otherwise, this method causes a call to this component'supdatemethod as soon as possible.- Specified by:
repaintin interfaceViewComponent
-
repaint
- Specified by:
repaintin interfaceViewComponent
-
repaint
Repaint all of the given page.- Specified by:
repaintin interfaceViewComponent- Parameters:
p- the page to repaint
-
repaint
Repaint all of the given page.- Specified by:
repaintin 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:
cleanupin interfaceViewComponent
-
getPresentationRuleManager
PresentationRuleManager getPresentationRuleManager()- Returns:
- the PresentationRuleManager
-