org.ow2.weblab.portlet.tool
Class MediaUnitSplitter

java.lang.Object
  extended by org.ow2.weblab.portlet.tool.MediaUnitSplitter

public class MediaUnitSplitter
extends java.lang.Object

MediaUnitSplitter manage splitted Text media units for pagination. It split a given media unit in pages of given size. It manage page navigation to get page offset of the current part.

Author:
emilien

Constructor Summary
MediaUnitSplitter()
           
MediaUnitSplitter(org.ow2.weblab.core.model.MediaUnit unit, int textSize)
          Constructor
 
Method Summary
 int getAvaiblePageCount()
          Number of page for this splitter
 int getCurrentPageEndOffset()
          The end offset of text in the current page
 int getCurrentPageIndex()
          Current page number
 int getCurrentPageStartOffset()
          The start offset of text in the current page
 org.ow2.weblab.core.model.MediaUnit getMediaUnit()
           
 int getTextSize()
           
 int nextPage()
          change current page to the next page, if exist.
 int prevPage()
          change current page to the previous page, if exist.
 int setCurrentPageIndex(int currentPage)
          Set the current page for this splitter
 void setMediaUnit(org.ow2.weblab.core.model.MediaUnit mu)
           
 void setTextSize(int textSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MediaUnitSplitter

public MediaUnitSplitter()

MediaUnitSplitter

public MediaUnitSplitter(org.ow2.weblab.core.model.MediaUnit unit,
                         int textSize)
Constructor

Parameters:
unit - the unit to split
textSize - the size of each parts
Method Detail

getCurrentPageStartOffset

public int getCurrentPageStartOffset()
The start offset of text in the current page

Returns:
the text offset of current page

getCurrentPageEndOffset

public int getCurrentPageEndOffset()
The end offset of text in the current page

Returns:
the text offset of current page

nextPage

public int nextPage()
change current page to the next page, if exist.

Returns:
the new current page number

prevPage

public int prevPage()
change current page to the previous page, if exist.

Returns:
the new current page number

getAvaiblePageCount

public int getAvaiblePageCount()
Number of page for this splitter

Returns:
the number of page of this splitter

getCurrentPageIndex

public int getCurrentPageIndex()
Current page number

Returns:
Current page number

setCurrentPageIndex

public int setCurrentPageIndex(int currentPage)
Set the current page for this splitter

Parameters:
currentPage - the page number to set
Returns:
the new current page number

getMediaUnit

public org.ow2.weblab.core.model.MediaUnit getMediaUnit()

setMediaUnit

public void setMediaUnit(org.ow2.weblab.core.model.MediaUnit mu)

getTextSize

public int getTextSize()

setTextSize

public void setTextSize(int textSize)


Copyright © 2004-2011. All Rights Reserved.