com.cc.framework.ui.control
Class SimpleListControl

java.lang.Object
  extended bycom.cc.framework.ui.control.Control
      extended bycom.cc.framework.ui.control.ListControl
          extended bycom.cc.framework.ui.control.SimpleListControl
All Implemented Interfaces:
AccessControlled, ActionBehavior, ClientHandler, ListStateModel, java.io.Serializable, StateModel

public class SimpleListControl
extends ListControl
implements ListStateModel

The SimpleListControl

Since:
1.0
Version:
$Revision: 1.65 $
Author:
Harald Schulz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.cc.framework.ui.control.ListControl
ListControl.RowFilter
 
Field Summary
private  ListDataModel dataModel
          The data model
private  ListDesignModel designModel
          The Designmodel
private static long serialVersionUID
          Serial Version UID
private  ListStateModel stateModel
          The state model
 
Fields inherited from class com.cc.framework.ui.control.Control
log
 
Fields inherited from interface com.cc.framework.ui.model.ListStateModel
PROP_PAGE
 
Fields inherited from interface com.cc.framework.ui.model.StateModel
PROP_CONTROL
 
Constructor Summary
SimpleListControl()
          Constructor
 
Method Summary
 int calcAbsoulteRowIndex(int relRowIndex)
          Berechent anhand eines seitenrelativen Zeilenindex einen absoluten Index.
 int calcRelativeRowIndex(int absRowIndex)
          Berechent anhand eines absoluten Zeilenindex einen seitenrelativen Index.
protected  ListStateModel doCreateStatemodel()
          Creates the state model for this control instance
 int getCellPadding()
          Returns the cell padding for the list cells
 int getCellSpacing()
          Returns the cell spacing for the list cells
 ColumnDesignModel[] getColumns()
          Returns an Array with all columns.
 int getCurrentPage()
          Returns the zero based index of the page which is currently display.
 DataModel getDataModel()
          Returns the data model of the Control
 ControlDesignModel getDesignModel()
          Returns the design model of the control
 java.lang.String[] getDetailText()
          Returns the detail text which is displayed in the caption in the format "3 to 10 from 2000"
 java.lang.String getEmptyText()
          A text that is output in the body of the list element if there are no lines available (size() == 0)
 ImageModel getImage()
          Returns the image for the frames title
 InnerFrame[] getInnerFrames(java.lang.Object layoutHint)
          Retrieves a list of inner frames that are matching the given layout hint
 LineIterator getLineIterator(boolean positioned)
          Creates a line iterator
 java.lang.String[] getMarked()
          Retrieves all marked items
 int getMinRowCount()
          Returns the minimal number of rows on the page.
 int getPageButtons()
          Returns the number of page buttons.
 LineIterator getPageLineIterator()
          Creates a line iterator for the current page
 java.lang.Object getRowFromKey(java.lang.String rowkey)
          Retrieves the row bean for the given key
 int getRowsOnCurrentPage()
          Calculates the Number of rows which should be displayed on the Page
 int getRowsPerPage()
          Returns the number of rows on the page.
 java.lang.String getScrollHeight()
          Retrieves the height of the scroll container
 SelectMode getSelectMode()
          Return the selection mode of the list.
 java.lang.String getSortColumn()
          Returns the name of the column which is currently used for sorting.
 SortOrder getSortOrder()
          Returns the sort order
 SortOrder getSortOrder(java.lang.String column)
          Returns the sort order for the specified column.
 StateModel getStateModel()
          Returns the state model of the control
 OrientationType getTabOrientation()
          Retrieves the tabulator orientation
 java.lang.String getTitle()
          Returns the Title
 int getTotalPages()
          Returns the total number of pages.
 int getTotalRowCount()
          Returns the Number of total Rows in the data model
 boolean isFirstPage()
          Returns true if the First Page is displayed
 boolean isLastPage()
          Returns true if the Last Page is displayed
 boolean isMarked(java.lang.String uniqueKey)
          Checks if the specified row is selected.
 void mark(java.lang.String uniqueKey)
          Selects a specified row.
 void onCheck(ControlRequestContext ctx, java.lang.String key, SelectMode mode, boolean check)
          Default handler for the Check Event
 void onCheckAll(ControlRequestContext ctx, SelectMode mode, boolean check)
          Default handler for the CheckAll Event
 void onCheckColumn(ControlRequestContext ctx, java.lang.String column, boolean check)
          Default handler for the CheckColumn Event
 void onPage(ControlRequestContext ctx, int newPage)
          Default handler for the Page Event
 void onSort(ControlRequestContext ctx, java.lang.String column, SortOrder direction)
          Default handler for the Sort Event
 void reset()
          Resets the actual state of a control to the initial state
 void resetSortInfo()
          Resets any sorting Information
protected  void setCheckboxValue(RequestContext ctx, ControlValuePath path, java.lang.Object rowbean, java.lang.String property, boolean checked, SelectMode selectmode)
          This method is called to set the value of a checkbox column
 void setCurrentPage(int page)
          Sets the index for the page which is currently display to another value.
 void setDataModel(ListDataModel dataModel)
          Sets the data model
 void setDataModel(ListDataModel dataModel, boolean keepState)
          Sets the data model
 void setDesignModel(ListDesignModel designModel)
          Sets the DesignModel
protected  void setRadioValue(RequestContext ctx, ControlValuePath path, java.lang.Object rowbean, java.lang.String property, java.lang.String value)
          This method is called to set the value of a radio button column
 void setSortInfo(java.lang.String column, SortOrder direction)
          Sets the sort order for the specified column
 void setStateModel(ListStateModel stateModel)
          Sets the StateModel
 boolean showButton(ControlButton button)
          This Method is called by the Painter before rendering a Button.
 boolean showFrame()
          Returns true if the frame should be painted
 boolean showHeader()
          Returns true if the header should be painted
 void unmark(java.lang.String uniqueKey)
          Unselects a specified row.
 void unmarkAll()
          Unselects all selected rows
 
Methods inherited from class com.cc.framework.ui.control.ListControl
allowAjaxRendering, getAjaxId, getNavigationPosition, getVisibleColumns, onAdd, onCellClick, onCollapse, onCreate, onDelete, onDrilldown, onEdit, onExpand, onExpandEx, onExportList, onPrintList, onRefresh, onSelect, setControlValue, setValue
 
Methods inherited from class com.cc.framework.ui.control.Control
addButton, execute, execute, execute, execute, execute, execute, execute, getAction, getButtons, getControlName, getDesignRules, getFrameworkString, getHandler, getHandlers, getHeight, getHelp, getId, getLocaleName, getName, getPermission, getPrincipal, getProperty, getRunAt, getStyle, getStyleClass, getStyleId, getSummary, getTabIndex, getTooltip, getTransaction, getUniqueStyleId, getWidth, isAjaxEnabled, isDisabled, isFormElement, markDirty, onHelp, setAjaxAttribute, setHandler, setPrincipal, show, synchronizeState, synchronizeState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cc.framework.ui.model.StateModel
synchronizeState
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial Version UID

See Also:
Constant Field Values

dataModel

private ListDataModel dataModel
The data model


designModel

private ListDesignModel designModel
The Designmodel


stateModel

private ListStateModel stateModel
The state model

Constructor Detail

SimpleListControl

public SimpleListControl()
Constructor

Method Detail

doCreateStatemodel

protected ListStateModel doCreateStatemodel()
Creates the state model for this control instance

Returns:
State model instance

getDataModel

public DataModel getDataModel()
Description copied from class: Control
Returns the data model of the Control

Specified by:
getDataModel in class Control
Returns:
The data model
See Also:
Control.getDataModel()

setDataModel

public void setDataModel(ListDataModel dataModel)
Sets the data model

Parameters:
dataModel - DataModel

setDataModel

public void setDataModel(ListDataModel dataModel,
                         boolean keepState)
Sets the data model

Parameters:
dataModel - TreeGroupDataModel
keepState - when set to true the treelist control will keep its current state (Expanded nodes current page etc.)

getDesignModel

public ControlDesignModel getDesignModel()
Description copied from class: Control
Returns the design model of the control

Specified by:
getDesignModel in class Control
Returns:
The ControlDesignModel
See Also:
Control.getDesignModel()

setDesignModel

public void setDesignModel(ListDesignModel designModel)
Sets the DesignModel

Parameters:
designModel - ListDesignModel

getStateModel

public StateModel getStateModel()
Description copied from class: Control
Returns the state model of the control

Specified by:
getStateModel in class Control
Returns:
The state model
See Also:
Control.getStateModel()

setStateModel

public void setStateModel(ListStateModel stateModel)
Sets the StateModel

Parameters:
stateModel - ListStateModel

getPageButtons

public int getPageButtons()
Description copied from class: ListControl
Returns the number of page buttons.

Specified by:
getPageButtons in class ListControl
Returns:
The number of page buttons
See Also:
ListControl.getPageButtons()

showFrame

public boolean showFrame()
Description copied from class: ListControl
Returns true if the frame should be painted

Specified by:
showFrame in class ListControl
Returns:
true if the frame should be painted
See Also:
ListControl.showFrame()

showHeader

public boolean showHeader()
Description copied from class: ListControl
Returns true if the header should be painted

Specified by:
showHeader in class ListControl
Returns:
true if the header should be painted
See Also:
ListControl.showHeader()

getCellPadding

public int getCellPadding()
Description copied from class: ListControl
Returns the cell padding for the list cells

Specified by:
getCellPadding in class ListControl
Returns:
Padding factor
See Also:
ListControl.getCellPadding()

getCellSpacing

public int getCellSpacing()
Description copied from class: ListControl
Returns the cell spacing for the list cells

Specified by:
getCellSpacing in class ListControl
Returns:
spacing factor
See Also:
ListControl.getCellSpacing()

getTabOrientation

public OrientationType getTabOrientation()
Description copied from class: ListControl
Retrieves the tabulator orientation

Specified by:
getTabOrientation in class ListControl
Returns:
the orientation
See Also:
ListControl.getTabOrientation()

showButton

public boolean showButton(ControlButton button)
Description copied from class: Control
This Method is called by the Painter before rendering a Button. By overwriting this method a derived class can show or hide buttons.

Overrides:
showButton in class Control
Parameters:
button - ControlButton
Returns:
boolean
See Also:
Control.showButton(com.cc.framework.ui.control.ControlButton)

getColumns

public ColumnDesignModel[] getColumns()
Description copied from class: ListControl
Returns an Array with all columns.

Specified by:
getColumns in class ListControl
Returns:
ColumnDesignModel
See Also:
ListControl.getColumns()

getLineIterator

public LineIterator getLineIterator(boolean positioned)
Description copied from class: ListControl
Creates a line iterator

Specified by:
getLineIterator in class ListControl
Parameters:
positioned - if set to true the method returns a iterator which is positioned on the first line on the current page.
Returns:
LineIterator
See Also:
ListControl.getLineIterator(boolean)

getPageLineIterator

public LineIterator getPageLineIterator()
Description copied from class: ListControl
Creates a line iterator for the current page

Specified by:
getPageLineIterator in class ListControl
Returns:
LineIterator
See Also:
ListControl.getPageLineIterator()

getInnerFrames

public InnerFrame[] getInnerFrames(java.lang.Object layoutHint)
Retrieves a list of inner frames that are matching the given layout hint

Specified by:
getInnerFrames in class ListControl
Parameters:
layoutHint - The layout hint that specifies what frames should be selected:
AlignmentType.TOP
header frames
AlignmentType.BOTTOM
footer frames
Returns:
Frame list

getCurrentPage

public int getCurrentPage()
Description copied from interface: ListStateModel
Returns the zero based index of the page which is currently display.

Specified by:
getCurrentPage in interface ListStateModel
Specified by:
getCurrentPage in class ListControl
Returns:
The number of the current page
See Also:
ListControl.getCurrentPage()

setCurrentPage

public void setCurrentPage(int page)
Description copied from interface: ListStateModel
Sets the index for the page which is currently display to another value.

Specified by:
setCurrentPage in interface ListStateModel
Parameters:
page - The new page index
See Also:
ListStateModel.setCurrentPage(int)

getSortColumn

public java.lang.String getSortColumn()
Description copied from interface: ListStateModel
Returns the name of the column which is currently used for sorting.

Specified by:
getSortColumn in interface ListStateModel
Returns:
The name of the column which is currently used for sorting
See Also:
ListStateModel.getSortColumn()

getSortOrder

public SortOrder getSortOrder()
Description copied from interface: ListStateModel
Returns the sort order

Specified by:
getSortOrder in interface ListStateModel
Returns:
The sort order
See Also:
ListStateModel.getSortOrder()

getSortOrder

public SortOrder getSortOrder(java.lang.String column)
Description copied from class: ListControl
Returns the sort order for the specified column.

Specified by:
getSortOrder in class ListControl
Parameters:
column - The name of the column
Returns:
SortOrder
See Also:
ListControl.getSortOrder(java.lang.String)

setSortInfo

public void setSortInfo(java.lang.String column,
                        SortOrder direction)
Sets the sort order for the specified column

Specified by:
setSortInfo in interface ListStateModel
Parameters:
column - Name of the column
direction - The sort order

resetSortInfo

public void resetSortInfo()
Description copied from interface: ListStateModel
Resets any sorting Information

Specified by:
resetSortInfo in interface ListStateModel
See Also:
ListStateModel.resetSortInfo()

reset

public void reset()
Description copied from interface: StateModel
Resets the actual state of a control to the initial state

Specified by:
reset in interface StateModel
See Also:
StateModel.reset()

getRowsPerPage

public int getRowsPerPage()
Description copied from class: ListControl
Returns the number of rows on the page. Returns -1 if all rows should be displayed.

Specified by:
getRowsPerPage in class ListControl
Returns:
The number of rows on the page
See Also:
ListControl.getRowsPerPage()

getMinRowCount

public int getMinRowCount()
Description copied from class: ListControl
Returns the minimal number of rows on the page. Returns -1 no empty lines should be displayed.

Specified by:
getMinRowCount in class ListControl
Returns:
The minimal number of rows on the page
See Also:
ListControl.getMinRowCount()

getTotalRowCount

public int getTotalRowCount()
Returns the Number of total Rows in the data model

Specified by:
getTotalRowCount in class ListControl
Returns:
number of rows. Returns -1 when the number of rows is unknown

getTotalPages

public int getTotalPages()
Description copied from class: ListControl
Returns the total number of pages.

Specified by:
getTotalPages in class ListControl
Returns:
The total number of pages. Returns -1 if the number of pages is unknown
See Also:
ListControl.getTotalPages()

getRowsOnCurrentPage

public int getRowsOnCurrentPage()
Calculates the Number of rows which should be displayed on the Page

Returns:
row count

calcAbsoulteRowIndex

public int calcAbsoulteRowIndex(int relRowIndex)
Berechent anhand eines seitenrelativen Zeilenindex einen absoluten Index.

Parameters:
relRowIndex - nullbasierter seitenrelativer Zeilenindex
Returns:
Liefert einen nullbasierten absoluten Zeilenindex zurück

calcRelativeRowIndex

public int calcRelativeRowIndex(int absRowIndex)
Berechent anhand eines absoluten Zeilenindex einen seitenrelativen Index.

Parameters:
absRowIndex - nullbasierter sabsoluter Zeilenindex
Returns:
Liefert einen nullbasierten seitenrelativen Zeilenindex zurück

getTitle

public java.lang.String getTitle()
Description copied from class: ListControl
Returns the Title

Specified by:
getTitle in class ListControl
Returns:
String
See Also:
ListControl.getTitle()

getDetailText

public java.lang.String[] getDetailText()
Description copied from class: ListControl
Returns the detail text which is displayed in the caption in the format "3 to 10 from 2000"

Specified by:
getDetailText in class ListControl
Returns:
String
See Also:
ListControl.getDetailText()

getImage

public ImageModel getImage()
Description copied from class: ListControl
Returns the image for the frames title

Specified by:
getImage in class ListControl
Returns:
ImageModel
See Also:
ListControl.getImage()

getEmptyText

public java.lang.String getEmptyText()
Description copied from class: ListControl
A text that is output in the body of the list element if there are no lines available (size() == 0)

Specified by:
getEmptyText in class ListControl
Returns:
String
See Also:
ListControl.getEmptyText()

getSelectMode

public SelectMode getSelectMode()
Description copied from class: ListControl
Return the selection mode of the list.

Specified by:
getSelectMode in class ListControl
Returns:
SelectMode
See Also:
ListControl.getSelectMode()

getScrollHeight

public java.lang.String getScrollHeight()
Description copied from class: ListControl
Retrieves the height of the scroll container

Specified by:
getScrollHeight in class ListControl
Returns:
height
See Also:
ListControl.getScrollHeight()

isFirstPage

public boolean isFirstPage()
Returns true if the First Page is displayed

Returns:
boolean

isLastPage

public boolean isLastPage()
Returns true if the Last Page is displayed

Returns:
boolean

getRowFromKey

public java.lang.Object getRowFromKey(java.lang.String rowkey)
Description copied from class: ListControl
Retrieves the row bean for the given key

Specified by:
getRowFromKey in class ListControl
Parameters:
rowkey - The rows unique key
Returns:
Row Bean or null
See Also:
ListControl.getRowFromKey(java.lang.String)

setCheckboxValue

protected void setCheckboxValue(RequestContext ctx,
                                ControlValuePath path,
                                java.lang.Object rowbean,
                                java.lang.String property,
                                boolean checked,
                                SelectMode selectmode)
                         throws java.lang.Exception
This method is called to set the value of a checkbox column

Overrides:
setCheckboxValue in class ListControl
Parameters:
ctx - The Control action context
path - Path Name of the input element
rowbean - The row bean
property - The Column name
checked - true if the checkbox is checked
selectmode - the selection mode of the column
Throws:
java.lang.Exception - a derived class can throw an exception if the value could not be set

setRadioValue

protected void setRadioValue(RequestContext ctx,
                             ControlValuePath path,
                             java.lang.Object rowbean,
                             java.lang.String property,
                             java.lang.String value)
                      throws java.lang.Exception
This method is called to set the value of a radio button column

Overrides:
setRadioValue in class ListControl
Parameters:
ctx - The control action context
path - Path Name of the input element
rowbean - The row bean
property - The Column name
value - the radio button value
Throws:
java.lang.Exception - a derived class can throw an exception if the value could not be set

isMarked

public boolean isMarked(java.lang.String uniqueKey)
Description copied from interface: ListStateModel
Checks if the specified row is selected.

Specified by:
isMarked in interface ListStateModel
Parameters:
uniqueKey - The unique key
Returns:
boolean Returns true if the row is selected; false otherwise
See Also:
ListStateModel.isMarked(java.lang.String)

getMarked

public java.lang.String[] getMarked()
Description copied from interface: ListStateModel
Retrieves all marked items

Specified by:
getMarked in interface ListStateModel
Returns:
Array with the keys of the marked items
See Also:
ListStateModel.getMarked()

mark

public void mark(java.lang.String uniqueKey)
Description copied from interface: ListStateModel
Selects a specified row.

Specified by:
mark in interface ListStateModel
Parameters:
uniqueKey - The unique key of the row which should be selected
See Also:
ListStateModel.mark(java.lang.String)

unmark

public void unmark(java.lang.String uniqueKey)
Description copied from interface: ListStateModel
Unselects a specified row.

Specified by:
unmark in interface ListStateModel
Parameters:
uniqueKey - The unique key of the row which should be unselected
See Also:
ListStateModel.unmark(java.lang.String)

unmarkAll

public void unmarkAll()
Description copied from interface: ListStateModel
Unselects all selected rows

Specified by:
unmarkAll in interface ListStateModel
See Also:
ListStateModel.unmarkAll()

onPage

public void onPage(ControlRequestContext ctx,
                   int newPage)
            throws java.lang.Exception
Default handler for the Page Event

Overrides:
onPage in class ListControl
Parameters:
ctx - ControlRequestContext
newPage - Number of the new Page
Throws:
java.lang.Exception - is thrown when an error occurs

onCheck

public void onCheck(ControlRequestContext ctx,
                    java.lang.String key,
                    SelectMode mode,
                    boolean check)
             throws java.lang.Exception
Default handler for the Check Event

Overrides:
onCheck in class ListControl
Parameters:
ctx - ControlRequestContext
key - Unique Id as generated by the data model to identify the Row
mode - SelectMode
check - true if checked
Throws:
java.lang.Exception - Indicates an error while iterating and executing the algorithm

onCheckAll

public void onCheckAll(ControlRequestContext ctx,
                       SelectMode mode,
                       boolean check)
                throws java.lang.Exception
Default handler for the CheckAll Event

Overrides:
onCheckAll in class ListControl
Parameters:
ctx - ControlRequestContext
mode - SelectMode
check - true if checked
Throws:
java.lang.Exception - Indicates an error while iterating and executing the algorithm

onCheckColumn

public void onCheckColumn(ControlRequestContext ctx,
                          java.lang.String column,
                          boolean check)
                   throws java.lang.Exception
Default handler for the CheckColumn Event

Overrides:
onCheckColumn in class ListControl
Parameters:
ctx - ControlRequestContext
column - the column
check - true if checked
Throws:
java.lang.Exception - Indicates an error while iterating and executing the algorithm

onSort

public void onSort(ControlRequestContext ctx,
                   java.lang.String column,
                   SortOrder direction)
            throws java.lang.Exception
Default handler for the Sort Event

Overrides:
onSort in class ListControl
Parameters:
ctx - ControlRequestContext
column - Name of the Column
direction - SortOrder
Throws:
java.lang.Exception - is thrown when an error occurs


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.