com.levigo.jadice.swing.pageview
Class AbstractContinuousLayout

java.lang.Object
  extended by com.levigo.jadice.swing.pageview.AbstractContinuousLayout
All Implemented Interfaces:
ListEventListener<Page>, EventListener

public abstract class AbstractContinuousLayout
extends Object


Field Summary
protected  Rectangle aggregateBounds
           
protected  int currentPageIndexCache
           
protected  EventList<Page> pageList
           
protected  ArrayList<com.levigo.jadice.swing.pageview.RenderedPage> renderedPages
           
protected  AtomicBoolean renderingValid
           
protected  PageView view
           
 
Constructor Summary
AbstractContinuousLayout(PageView view)
           
 
Method Summary
 boolean canHandle(Document document)
          Verify whether this PageLayout is prepared to deal with the given document.
protected abstract  void doLayout()
          This method must be implemented in order to provide the actual layout functionality.
abstract  com.levigo.jadice.swing.pageview.RenderedPage findPageNextTo(Point p)
          Find the page closest to the given point.
 int getAdjacentNavigationIndex(Rectangle visibleRect, Position.Bias bias)
          By default, we assume a navigation increment of one.
 Rectangle getAggregateBounds()
           
 int getCurrentPageIndex(Rectangle visibleRect)
           
 com.levigo.jadice.swing.pageview.RenderedPage getCurrentRenderedPage(Rectangle visibleRect)
           
 Dimension getPreferredSize(Dimension viewportSize)
          Return the preferred size occupied by the laid-out pages based on the given viewport size.
 com.levigo.jadice.swing.pageview.RenderedPage getRenderedPage(Page p)
           
 List<com.levigo.jadice.swing.pageview.RenderedPage> getRenderedPages()
           
 void invalidate()
          Invalidate the layout.
 void listChanged(ListEvent<Page> listChanges)
          When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.
protected  void revalidateView()
          Synchronously invalidate then validate the view size, so that the view size is updated immediately.
 void setCurrentPageIndex(int index)
           
 void setPageList(EventList<Page> pageList)
          Set the current document.
 void validate()
          Validate the layout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentPageIndexCache

protected int currentPageIndexCache

renderedPages

protected final ArrayList<com.levigo.jadice.swing.pageview.RenderedPage> renderedPages

aggregateBounds

protected final Rectangle aggregateBounds

renderingValid

protected final AtomicBoolean renderingValid

view

protected final PageView view

pageList

protected EventList<Page> pageList
Constructor Detail

AbstractContinuousLayout

public AbstractContinuousLayout(PageView view)
Method Detail

setPageList

public void setPageList(EventList<Page> pageList)
Set the current document.


setCurrentPageIndex

public void setCurrentPageIndex(int index)

getRenderedPages

public List<com.levigo.jadice.swing.pageview.RenderedPage> getRenderedPages()

getAggregateBounds

public Rectangle getAggregateBounds()

getCurrentPageIndex

public int getCurrentPageIndex(Rectangle visibleRect)

listChanged

public void listChanged(ListEvent<Page> listChanges)
Description copied from interface: ListEventListener
When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.

It is mandatory that the calling thread has obtained the write lock on the source list. This is because the calling thread will have written to the source list to cause this event. This condition guarantees that no writes can occur while the listener is handling this event. It is an error to write to the source list while processing an event.


getCurrentRenderedPage

public com.levigo.jadice.swing.pageview.RenderedPage getCurrentRenderedPage(Rectangle visibleRect)

getRenderedPage

public com.levigo.jadice.swing.pageview.RenderedPage getRenderedPage(Page p)

canHandle

public boolean canHandle(Document document)
Verify whether this PageLayout is prepared to deal with the given document. A reason for not being able to handle it could be, for example, a very large number of pages which would negatively impact the layout performance.

Returns:

validate

public void validate()
Validate the layout. This will re-layout the pages, if the layout has been found to be invalid. This method is supposed to be called rather frequently. Implementations are therefore expected to do as little work as possible.


invalidate

public void invalidate()
Invalidate the layout. This method is usually called in response to fundamental state changes requiring a complete re-layout.


doLayout

protected abstract void doLayout()
This method must be implemented in order to provide the actual layout functionality.


findPageNextTo

public abstract com.levigo.jadice.swing.pageview.RenderedPage findPageNextTo(Point p)
Find the page closest to the given point. Return null if there is no page at all.

Returns:
the rendered page

getAdjacentNavigationIndex

public int getAdjacentNavigationIndex(Rectangle visibleRect,
                                      Position.Bias bias)
By default, we assume a navigation increment of one.

Parameters:
visibleRect - the visible region
bias - the direction for which to return the next index. See Position.Bias.Forward, Position.Bias.Backward.
Returns:
the adjacent page index
See Also:
PageLayout.getAdjacentNavigationIndex(java.awt.Rectangle, javax.swing.text.Position.Bias)

revalidateView

protected void revalidateView()
Synchronously invalidate then validate the view size, so that the view size is updated immediately.


getPreferredSize

public Dimension getPreferredSize(Dimension viewportSize)
Return the preferred size occupied by the laid-out pages based on the given viewport size. Please note that the viewport size may be null, if the client PageView doesn't reside within a viewport.

Returns:


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.