|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.levigo.jadice.swing.ViewComponent com.levigo.jadice.swing.pageview.PageView
public class PageView
Displays a Document
's Page
s using instances of PageLayout
to arrange
them.
Nested Class Summary | |
---|---|
static class |
PageView.Layout
These layout style constants define a set of well-known page layout styles. |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
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 | |
---|---|
static String |
CURRENT_PAGE_CONTROLS_PROPERTY
Property key prefix for the getCurrentPageControls() . |
static String |
CURRENT_PAGE_INDEX_PROPERTY
Property key for the getCurrentPageIndex() . |
static String |
DOCUMENT_PROPERTY
Property key for the currently displayed document. |
static String |
DOCUMENT_STATE_PROPERTY
Property key for the pseudo-property getDocumentState() . |
static String |
PAGE_COUNT_PROPERTY
Property key for the pseudo-property getPageCount() . |
static String |
PAGE_LAYOUT_STYLE_PROPERTY
|
static String |
RENDER_CONTROLS_INVENTORY_PROPERTY
|
static Insets |
scrollInsets
|
static String |
UI_CLASS_ID
|
static String |
VISIBLE_RECT_PROPERTY
|
Fields inherited from class com.levigo.jadice.swing.ViewComponent |
---|
toolManager |
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 | |
---|---|
PageView()
|
Method Summary | |
---|---|
void |
addNotify()
|
void |
autoscroll(Point location)
|
void |
cleanup()
Releases references to the Document currently referenced by this ViewComponent ,
if any. |
protected void |
finalize()
Finalization-cleanup. |
int |
getAdjacentNavigationIndex(Position.Bias bias)
Return the index of the next (following) or previous page for navigation purposes. |
Insets |
getAutoscrollInsets()
|
Page |
getCurrentPage()
Return the current page. |
Border |
getCurrentPageBorder()
|
RenderControls |
getCurrentPageControls()
Returns the render controls of the current page. |
int |
getCurrentPageIndex()
Return the current page index. |
Rectangle |
getCurrentPageVisibleBounds()
Get the bounds of the viewport with respect to the currently focused page. |
UIDocument<Component> |
getDocument()
|
RenderControls |
getDocumentControls()
Returns the render controls for the current document. |
Document.State |
getDocumentState()
Convenience getter for the document state. |
com.levigo.jadice.swing.pageview.RenderedPage |
getPageAt(Point p)
Get the RenderedPage at the given position or null if there is no such page. |
Border |
getPageBorder()
|
RenderControls |
getPageControls(Page page)
Returns the render controls of the given page. |
RenderControls |
getPageControls(Page page,
boolean create)
Returns the render controls of the given page. |
int |
getPageCount()
Convenience getter for the total number of pages. |
PageView.Layout |
getPageLayoutStyle()
Returns the currently applied page layout. |
Point |
getPanPoint()
Return the coordinate of the top left point of the current page's visible area in document units. |
Dimension |
getPreferredScrollableViewportSize()
|
Prefetcher |
getPrefetcher()
|
int |
getPrefetchRange()
|
PresentationRuleManager |
getPresentationRuleManager()
|
RenderControlInventory |
getRenderControlsInventory()
Returns the currently used RenderControlInventory by this PageView . |
int |
getRepaintDelay()
|
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
PageViewUI |
getUI()
Returns the PageViewUI (!) |
String |
getUIClassID()
Returns "ListUI" , the UIDefaults key used to look up the name of the
javax.swing.plaf.ListUI class that defines the look and feel for this component. |
boolean |
isFocusTraversable()
Deprecated. Yes, I know. |
boolean |
isPrefetchEnabled()
|
boolean |
isPreserveRenderSettingsOnDocumentChange()
Return whether the render settings are shared. |
void |
paint(Graphics g)
|
protected void |
processComponentKeyEvent(KeyEvent e)
|
void |
removeNotify()
|
void |
repaint(Page p)
Repaint all of the given page. |
void |
repaint(Page p,
Rectangle2D boundsDU)
Repaint part of the given page, as specified by the given bounds. |
void |
reshape(int x,
int y,
int w,
int h)
|
void |
scrollRectToVisible(Page targetPage,
Rectangle2D rectDU)
Instructs the PageView to scroll to the given targetPage and ensures that
the target rectangle is visible. |
void |
setCurrentPageBorder(Border currentPageBorder)
|
void |
setCurrentPageIndex(int i)
Navigate to the given page number. |
void |
setDocument(Document doc)
Changes the Document to be displayed within this PageView instance. |
void |
setPageBorder(Border pageBorder)
Set the page decoration border. |
void |
setPageLayoutStyle(PageView.Layout layout)
Changes the layout style responsible for laying out pages to be displayed in page view. |
void |
setPrefetchEnabled(boolean prefetchEnabled)
|
void |
setPrefetcher(Prefetcher prefetcher)
|
void |
setPrefetchRange(int prefetchRange)
|
void |
setPreserveRenderSettingsOnDocumentChange(boolean preserveRenderSettings)
Set whether to use shared render settings ( true ) or private ones (
false ). |
void |
setRepaintDelay(int repaintDelay)
|
void |
setUI(PageViewUI ui)
Sets the PageViewUI , the look and feel object that renders this component. |
void |
updateUI()
Resets the UI property with the value from the current look and feel. |
Methods inherited from class com.levigo.jadice.swing.ViewComponent |
---|
contribute, findViewport, getToolManager |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PAGE_LAYOUT_STYLE_PROPERTY
public static final String RENDER_CONTROLS_INVENTORY_PROPERTY
public static final String VISIBLE_RECT_PROPERTY
public static final Insets scrollInsets
public static final String UI_CLASS_ID
public static final String CURRENT_PAGE_CONTROLS_PROPERTY
getCurrentPageControls()
. For convenience reasons, a
change for this property is fired, whenever some aspect of the RenderControls changes. However,
this very key is never used, instead a hierarchical property key is formed in the following
way: currentPageControls.[RenderControlsClassName].[propertyName]
. So, for
instance, a change of the zoom property is propagated as
currentPageControls.BaseRenderSettings.zoom
.
getCurrentPageControls()
,
Constant Field Valuespublic static final String CURRENT_PAGE_INDEX_PROPERTY
getCurrentPageIndex()
.
getCurrentPageIndex()
,
Constant Field Valuespublic static final String PAGE_COUNT_PROPERTY
getPageCount()
.
getPageCount()
,
Constant Field Valuespublic static final String DOCUMENT_STATE_PROPERTY
getDocumentState()
.
getDocumentState()
,
Constant Field Valuespublic static final String DOCUMENT_PROPERTY
getDocument()
,
setDocument(Document)
,
Constant Field ValuesConstructor Detail |
---|
@CallOnEDT public PageView()
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
Method Detail |
---|
@CallableOffEDT public UIDocument<Component> getDocument()
getDocument
in class ViewComponent
Document
instance currently displayed by this ViewComponent
.@CallOnEDT public void setDocument(Document doc)
Document
to be displayed within this PageView
instance. If no
Document
shall be displayed, use null
as parameter.
NOTE: This method must not be called on a thread other than the Event
Dispatch Thread
. For details please see: TGASwingUtil.ensureEventDispatchThread()
.
doc
- the Document
to be displayed, or null
in order to clear the
PageView
.
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallableOffEDT public void cleanup()
Document
currently referenced by this ViewComponent
,
if any. This method is intended for final clean-up purposes exclusively and may be called
off-EDT. It can be used in situations where it is not possible to call
setDocument(Document)
(with null
parameter). Typically this would be the
case where it is not possible to wait for the next EDT cycle.
Note that this method is not an off-EDT replacement for setDocument(Document)
(with
parameter null
). It mainly releases references; it doesn't necessarily perform all
the steps which would be taken in setDocument(Document)
(with parameter
null
). The usage of setDocument(Document)
should therefore be preferred
whenever possible.
cleanup
in class ViewComponent
setDocument(Document)
@CallOnEDT public RenderControlInventory getRenderControlsInventory()
RenderControlInventory
by this PageView
.
To support multi viewer usage of one single document instance, viewers always works on
snapshots of document render control inventories. As a consequence the returned inventory
instance must not be the same instance returned by a call of
RenderControlInventory.get(Document)
or
RenderControlInventory.get(Document, boolean)
.
For the same reason, changes done to this snapshot inventory are not recognized by any
other PageView
instance and the lifetime of this snapshot ends when the document will
be exchanged with a call of setDocument(Document)
.
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:
Document is used in a PageView instance? | Recommended way to do changes |
---|---|
Yes | Use getRenderControlsInventory() method of the target PageView instance
and do the changes. It is not a guaranteed feature that the concluded changes are recognized by the target PageView instance. It is up to the developer to decide based on the type of changes
whether to force a PageView update or not. |
No | Use RenderControlInventory.get(Document) or
RenderControlInventory.get(Document, boolean) to get an inventory reference and do the
desired modifications. |
RenderControlInventory
instance@CallOnEDT public Page getCurrentPage()
null
if there is none.@CallOnEDT public com.levigo.jadice.swing.pageview.RenderedPage getPageAt(Point p)
null
if there is no such page.
p
-
public void addNotify()
addNotify
in class JComponent
JComponent.addNotify()
@CallOnEDT public void autoscroll(Point location)
autoscroll
in interface Autoscroll
Autoscroll.autoscroll(java.awt.Point)
protected void finalize() throws Throwable
finalize
in class Object
Throwable
Object.finalize()
@CallOnEDT public Insets getAutoscrollInsets()
getAutoscrollInsets
in interface Autoscroll
Autoscroll.getAutoscrollInsets()
@CallableOffEDT public String getUIClassID()
"ListUI"
, the UIDefaults
key used to look up the name of the
javax.swing.plaf.ListUI
class that defines the look and feel for this component.
getUIClassID
in class JComponent
UI_CLASS_ID
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
protected void processComponentKeyEvent(KeyEvent e)
processComponentKeyEvent
in class JComponent
@Deprecated @CallOnEDT public boolean isFocusTraversable()
isFocusTraversable
in class Component
Component.isFocusTraversable()
@CallOnEDT public void paint(Graphics g)
paint
in class JComponent
JComponent.paint(java.awt.Graphics)
@CallOnEDT public RenderControls getDocumentControls()
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 the getRenderControlsInventory()
comment for the
recommended ways.
@CallOnEDT public RenderControls getCurrentPageControls()
RenderControlInventory
.
If no render control is available for the current page, the document render control will be returned.
@CallOnEDT public RenderControls getPageControls(Page page)
RenderControlInventory
.
If no render control is available for the given page, the document render control will be returned.
page
- the page the lookup should be done for
@CallOnEDT public RenderControls getPageControls(Page page, boolean create)
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
. See getRenderControlsInventory()
comment for the
recommended ways.
page
- the page the lookup should be done forcreate
- whether a render controls instance should be created if not available
IllegalArgumentException
- if the given page is null
public void removeNotify()
removeNotify
in class JComponent
JComponent.removeNotify()
@CallOnEDT public void reshape(int x, int y, int w, int h)
reshape
in class JComponent
@CallOnEDT public void setUI(PageViewUI ui)
PageViewUI
, the look and feel object that renders this component.
ui
- the PageViewUI
object
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
UIDefaults.getUI(javax.swing.JComponent)
@CallOnEDT public void updateUI()
updateUI
in class JComponent
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
UIManager.getUI(javax.swing.JComponent)
@CallOnEDT public PageViewUI getUI()
PageViewUI
(!) used to render this component.
PageViewUI
object that renders this component@CallOnEDT public void setCurrentPageIndex(int i)
NOTE: This method must not be called on a thread other than the Event
Dispatch Thread
. For details please see: TGASwingUtil.ensureEventDispatchThread()
i
- the page index to be navigated to
NullPointerException
- if there is no document to be displayed
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public int getCurrentPageIndex()
pageView.setCurrentPageIndex(x);
assert pageView.getCurrentPageIndex() == x;
Does not necessarily hold.
@CallOnEDT public int getAdjacentNavigationIndex(Position.Bias bias)
getCurrentPageIndex()
.
assert pageView.getCurrentPageIndex() + 1 == pageView.getAdjacentNavigationIndex(Bias.Forward);
Does not necessarily hold.
bias
- the direction for which to return the next index. See Position.Bias.Forward
,
Position.Bias.Backward
.
public int getPageCount()
getDocument().getPageCount()
. Otherwise it returns 0.
public Document.State getDocumentState()
getDocument().getState()
. Otherwise it returns Document.BasicState.UNKNOWN
.
Document.BasicState.UNKNOWN
@CallOnEDT public Point getPanPoint()
getCurrentPageVisibleBounds()
.getLocation()
.
@CallOnEDT public Rectangle getCurrentPageVisibleBounds()
@CallOnEDT public PageView.Layout getPageLayoutStyle()
PageView.Layout
@CallOnEDT public void setPageLayoutStyle(PageView.Layout layout)
NOTE: This method must not be called on a thread other than the Event
Dispatch Thread
. For details please see: TGASwingUtil.ensureEventDispatchThread()
layout
- the new layout style to display the pages. For the available layout styles see
PageView.Layout
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
NullPointerException
- if given layout style parameter is null
PageView.Layout.PAGE
,
PageView.Layout.CONTINUOUS_PAGE
,
PageView.Layout.SPREAD
,
PageView.Layout.CONTINUOUS_SPREAD
,
PageView.Layout.GRID
@CallOnEDT public void setPageBorder(Border pageBorder)
pageBorder
-
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
@CallOnEDT public Border getPageBorder()
@CallOnEDT public void scrollRectToVisible(Page targetPage, Rectangle2D rectDU)
PageView
to scroll to the given targetPage
and ensures that
the target rectangle
is visible. The target rectangle
is expressed in document base coordinates
.
targetPage
- the page to scroll to visibilityrectDU
- the bounds to scroll to visibility in document units.public void repaint(Page p)
ViewComponent
repaint
in class ViewComponent
p
- the page to repaintpublic void repaint(Page p, Rectangle2D boundsDU)
ViewComponent
repaint
in class ViewComponent
p
- the page to repaintboundsDU
- the bounds within the page to repaint.@CallOnEDT public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
@CallOnEDT public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
@CallOnEDT public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
@CallOnEDT public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
@CallOnEDT public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
public PresentationRuleManager getPresentationRuleManager()
@CallOnEDT public Border getCurrentPageBorder()
@CallOnEDT public void setCurrentPageBorder(Border currentPageBorder)
IllegalStateException
- if the calling thread is not the Event Dispatch
Thread
public void setPrefetcher(Prefetcher prefetcher)
public Prefetcher getPrefetcher()
public void setPreserveRenderSettingsOnDocumentChange(boolean preserveRenderSettings)
true
) or private ones (
false
). When using shared render settings the settings are stored with the
document, and shared with other PageViews in which this document is displayed.
preserveRenderSettings
- public boolean isPreserveRenderSettingsOnDocumentChange()
true
if the render settings are sharedpublic void setPrefetchEnabled(boolean prefetchEnabled)
public boolean isPrefetchEnabled()
public void setPrefetchRange(int prefetchRange)
public int getPrefetchRange()
public void setRepaintDelay(int repaintDelay)
public int getRepaintDelay()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2017 levigo holding gmbh. All rights reserved. |