class: ListUI

public abstract class: ListUI
Author: : Thomas Diebäcker, created 30.08.2007
Project: Phase: 1.0; Status: Proposed; Version: : $Revision: 1850 $ $LastChangedDate: 2008-12-17 1; Complexity: 1
Dates: Created: 16.07.2009 15:33:35; Modified: 16.07.2009 15:33:35;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {7A68C045-5AA2-4ff9-AC8F-CD2521FAF92F}
Superclass for lists with a paginator and all functions to navigate through them.
 

Goto: Custom Properties, Fields, Methods

Extends: ContainerPanelUI

See also: ReleaseListUI, UIPaginatorControl, UIPaginatorControl, ContainerPanelUI

Appears in: ui

Connections
 
Custom Properties
 
ListUI Attributes
Attribute Details
protected String
  actionMethodForTitle
Initial: null
private ArrayList
  allObjects
Initial: new ArrayList()
Notes: the lists of objects
protected int
  currentPage
Initial: 1
Notes: the page that is currently shown
private static Logger
  logger
Initial: Logger.getLogger(ListUI.class)
annotations=@SuppressWarnings("unused")
private static const int
  MAX_NUMBER_OF_PAGE_BUTTONS
Initial: 9
Notes: should not be less than 4!
private static const int
  NUMBER_OF_LAST_BUTTONS_IF_MAX_IS_EXCEEDED
Initial: 2
protected HtmlInputHidden
  numberSelectedObjects
Initial: new HtmlInputHidden()
Notes: this is the index for SHOW_ITEMS_PER_PAGE[] not the value itself! Inserted by FrM, 8.11.07: Set number of selected items for delete confirmation.
private ArrayList
  objectsToDisplay
Initial: new ArrayList()
private UIPaginatorControl
  paginatorControlBottom
Initial: new UIPaginatorControl()
private UIPaginatorControl
  paginatorControlTop
Initial: new UIPaginatorControl()
public static const int
  SHOW_ITEMS_PER_PAGE
Initial: { 10, 25, 50, 100, 250 }
Notes: constants for comboBoxes
public static const int
  SHOW_ITEMS_PER_PAGE_DEFAULT
Initial: 0
Notes: should not be greater than MAX_NUMBER_OF_PAGE_BUTTONS!
public static const SelectItem
  SHOW_SELECTITEMS
Initial: new SelectItem[] { new SelectItem("0", new Integer(SHOW_ITEMS_PER_PAGE[0]).toString()), new SelectItem("1", new Integer(SHOW_ITEMS_PER_PAGE[1]).toString()), new SelectItem("2", new Integer(SHOW_ITEMS_PER_PAGE[2]).toString()), new SelectItem("3", new Integer(SHOW_ITEMS_PER_PAGE[3]).toString()), new SelectItem("4", new Integer(SHOW_ITEMS_PER_PAGE[4]).toString()) }
private boolean
  singleView
Initial: false
 
ListUI Methods
Operation Details
private
calculateFirstObjectsToDisplay():List
Sequential
Notes: Calculates the objects that should be displayed.
private
calculateNumberOfObjectsPerPage():int
Sequential
Notes: Returns the number of objects as chosen in the ComboBox cboNumberOfItemsToShow or returns the first Step (default: 10) in the constants if the number has not been chosen yet (e.g. the page is still initializing).
@return the numberOfObjectsPerPage
private
calculateNumberOfPages():int
Sequential
Notes: Calculates the number of pages that are needed with the currently selected values.
@return the number of pages
private
calculateObjectsForPage(
   int page):List
Sequential
Notes: Calculates the objects that should be displayed on a certain page.
private
calculatePageForObject(
   ValueObjectWrapper object):int
Sequential
Notes: Calculates the page where an object will be displayed.
@return the page where the object would be displayed
private
createPageButton(
   String value):HtmlCommandButton
Sequential
Notes: Creates a single PageButton with the given text.
@return a PageButton for the Paginator
private
createPageButtons():ArrayList
Sequential
Notes: Creates PageButtons for the Paginator.
@return List of PageButtons
private
createSplittedPageButtons():ArrayList
Sequential
Notes: Create a splitted row of page buttons.
@return a row of page buttons
protected abstract
displayObject(
   ValueObjectWrapper valueObjectWrapper):ContainerPanelUI
Sequential
Notes: Instanciates a new single item and adds it to the container for display.
@return the ContainerPanelUI in which the new Item is displayed
protected
displayObjects():void
Sequential
Notes: Displays all objects that are currently in the list of objects to display.
protected
getAllObjects():List
Sequential
public
getNumberOfSelectedObjects():int
Sequential
Notes: Returns the number of valueObjects that are currently selected. Author: FrM, 7.11.2007
@return the number of valueObjects that are currently selected
public
getNumberSelectedObjects():HtmlInputHidden
Sequential
protected
getObjectsToDisplay():List
Sequential
public
getSelectedObjects():List
Sequential
Notes: Returns all valueObjects that are currently selected.
@return all valueObjects that are currently selected
public
ListUI():
Sequential
Notes: Default constructor.
public
ListUI(
   List allObjects):
Sequential
Notes: Public constructor.
public
ListUI(
   List allObjects,
   String actionMethodForTitle):
Sequential
Notes: Public constructor.
public
ListUI(
   List allObjects,
   boolean singleView,
   String actionMethodForTitle):
Sequential
Notes: Public constructor.
public
processAction(
   ActionEvent event):void
Sequential
Notes: Action handler for user actions.
public
processValueChange(
   ValueChangeEvent event):void
Sequential
Notes: ValueChange handler for comboBoxes.
private
refreshPageButtons():void
Sequential
Notes: Refreshes the page buttons.
protected
setAllObjects(
   List allObjects):void
Sequential
Notes: Sets all Objects in the lists and initially set the first objects to be displayed.
public
setNumberSelectedObjects(
   HtmlInputHidden numberSelectedObjects):void
Sequential
private
setObjectsToDisplay(
   int page,
   List objectsToDisplay):void
Sequential
Notes: Sets the objects that should be displayed. This list is displayed be the method displayObjects(). Also sets the current page and disables back and forward buttons if needed.
public
sortObjectList(
   Comparator comparator,
   boolean sortOrderAscending):void
Sequential
Notes: Sorts the object list.
@param sortOrder the sorting order