Documentation


SEARCH

TABLE OF CONTENT

    1. Getting started 2. Basic concepts 3. Request dispatching 4. Context container 5. Dual MVC 6. Component model: 7. Security 8. Configuration 9. Session handling 10. I18n 11. Cache 12. Logging 13. Error handling 14. Advanced Topics 15. API reference

      Tutorials: Frequently Asqued Questions

      See also:


      Class: __ItemListComponent


      Class Overview

      Base class for list based components, as the combobox, the listbox, ...

      list based components are item containers basically. They contains a collection of items.
      As __IValueHolder component, the value of a list corresponds to the value of all the selected items.

      A list based component doesn't have any tag by default, but the subclasses.

      A list based component has 2 selection modes:

      • single (__ItemListComponent::SELECTION_MODE_SINGLE), which allows the selection of one item at the same time.
      • multiple (__ItemListComponent::SELECTION_MODE_MULTIPLE), which allows the selection of more than one item at the same time.

      A list based component is able to sort his items by setting the sorted property to true. In that sense, items will be sorted by the text property.



      Author:  Antonio Parraga Navarro
      Version:  1.4
      Copyright:  Copyright (c) 2010 Antonio Parraga Navarro
      See:  __ComboBoxComponent, __ListBoxComponent, __ItemComponent
      __UIComponent
         |
         --__UIContainer
            |
            --__InputComponent
               |
               --__ItemListComponent

      Properties

      Methods

      [ Top ]

      Direct descendents

      Child Class Description
      __ComboBoxComponent Combobox is a combination of a drop-down list or list box and a single-line textbox, allowing the user either to choose from the list of existing options.

      [ Top ]

      Inherited Properties, Constants, and Methods

      Inherited Properties Inherited Methods Inherited Constants

      Inherited From __InputComponent

      Inherited From __UIContainer

      Inherited From __UIComponent

      Inherited From __InputComponent

      Inherited From __UIContainer

      Inherited From __UIComponent


      [ Top ]

      Constant Summary


      [ Top ]

      Properties Summary

      mixed   $_items  
      mixed   $_selection_mode  
      mixed   $_sorted  
      mixed   $_to_sort  

      [ Top ]

      Method Summary

      __ItemListComponent   addComponent()   Add a child component to current one.
      void   addItem()   Adds an __ItemComponent instance to the current list.
      void   clear()   Removes all the items from current list
      numeric   cmpItems()   Compares two items and return a numeric value representing the comparison result
      __ItemComponent   getItem()   Gets an item by his index within a list
      array   &getItems()   Gets the items of current component
      array   getItemValues()   Get an array of pair key,values representing items contained within the current list component
      bool   getOrdered()   Alias of getSorted
      integer   getSelectedIndex()   Gets the index of the first selected item
      array   getSelectedIndexes()   Gets the indexes of all selected items
      __ItemComponent   &getSelectedItem()   Gets the first selected item within the current list.
      array   &getSelectedItems()   Gets all selected items
      string   getSelectionMode()   Get an string representing the selection mode set to the current list component
      integer   getSize()   Gets the number of items contained within the current list component
      bool   getSorted()   Gets if the item list is sorted
      mixed   getValue()   Gets the value of the first selected item
      void   reset()   Overwrite the __InputComponent reset method to avoid
      void   setItems()   Sets the items for current component.
      void   setItemValues()   Set an array of pair key,values representing items to be contained within the current list component
      void   setOrdered()   Alias of setSorted
      void   setSelectedIndex()   Sets the index for the first selected item
      void   setSelectedIndexes()   Sets indexes for selected items
      void   setSelectedItem()   Sets the first selected item within the current list.
      void   setSelectionMode()   Set an string representing the selection mode, as one of the following:
      • single (__ListBoxComponent::SELECTION_MODE_SINGLE)
      • multiple (__ListBoxComponent::SELECTION_MODE_MULTIPLE)
      void   setSorted()   Sets if the item list is sorted
      void   setValue()   Sets the value of the first selected item
      void   _sortItems()  

      [ Top ]

      Properties

      mixed   $_items = array()
      Access:  protected


      mixed   $_selection_mode = __ItemListComponent::SELECTION_MODE_SINGLE
      Access:  protected


      mixed   $_sorted = false
      Access:  protected


      mixed   $_to_sort = false
      Access:  protected


      Methods

      addComponent


        __ItemListComponent addComponent( __IComponent &$component  )

      Add a child component to current one.

      If a __ItemComponent instance is received, it will also be added to the item list



      Parameters:
      TypeNameDescription
      __IComponent &$component The component to add to

      Return:  A reference to the current component
      Access:  public


      Redefinition of:
      __UIContainer::addComponent()


      addItem


        void addItem( __ItemComponent &$item  )

      Adds an __ItemComponent instance to the current list.

      This method calls internally to the __ItemListComponent::addComponent() method



      Parameters:
      TypeNameDescription
      __ItemComponent &$item The item to add to

      Access:  public



      clear


        void clear( )

      Removes all the items from current list

      Access:  public



      cmpItems


        numeric cmpItems( __ItemComponent $item1, __ItemComponent $item2  )

      Compares two items and return a numeric value representing the comparison result


      Parameters:
      TypeNameDescription
      __ItemComponent $item1
      __ItemComponent $item2

      Return:  0: equals, -1: item1<item2, 1: item1>item2
      Access:  public



      getItem


        __ItemComponent getItem( integer $index  )

      Gets an item by his index within a list


      Parameters:
      TypeNameDescription
      integer $index The item index

      Access:  public



      getItems


        array &getItems( )

      Gets the items of current component

      Access:  public



      getItemValues


        array getItemValues( )

      Get an array of pair key,values representing items contained within the current list component

      Access:  public



      getOrdered


        bool getOrdered( )

      Alias of getSorted

      Access:  public



      getSelectedIndex


        integer getSelectedIndex( )

      Gets the index of the first selected item

      Access:  public



      getSelectedIndexes


        array getSelectedIndexes( )

      Gets the indexes of all selected items

      Access:  public



      getSelectedItem


        __ItemComponent &getSelectedItem( )

      Gets the first selected item within the current list.

      This method returns null if no selected items are found


      Return:  The first selected item
      Access:  public



      getSelectedItems


        array &getSelectedItems( )

      Gets all selected items

      Access:  public



      getSelectionMode


        string getSelectionMode( )

      Get an string representing the selection mode set to the current list component

      Access:  public



      getSize


        integer getSize( )

      Gets the number of items contained within the current list component

      Access:  public



      getSorted


        bool getSorted( )

      Gets if the item list is sorted

      Access:  public



      getValue


        mixed getValue( )

      Gets the value of the first selected item

      Return:  value
      Access:  public


      Redefinition of:
      __InputComponent::getValue()


      reset


        void reset( )

      Overwrite the __InputComponent reset method to avoid

      change the value to the selected item (which is the current behavior of setValue method)


      Access:  public


      Redefinition of:
      __InputComponent::reset()


      setItems


        void setItems( &$items  )

      Sets the items for current component.

      Note that this method will clear any existing item within the current instance



      Parameters:
      TypeNameDescription
      &$items

      Access:  public



      setItemValues


        void setItemValues( $item_values  )

      Set an array of pair key,values representing items to be contained within the current list component


      Parameters:
      TypeNameDescription
      $item_values

      Access:  public



      setOrdered


        void setOrdered( bool $ordered  )

      Alias of setSorted


      Parameters:
      TypeNameDescription
      bool $ordered

      Access:  public



      setSelectedIndex


        void setSelectedIndex( numeric $selected_index  )

      Sets the index for the first selected item


      Parameters:
      TypeNameDescription
      numeric $selected_index

      Access:  public



      setSelectedIndexes


        void setSelectedIndexes( $selected_indexes  )

      Sets indexes for selected items


      Parameters:
      TypeNameDescription
      $selected_indexes

      Access:  public



      setSelectedItem


        void setSelectedItem( __ItemComponent &$item  )

      Sets the first selected item within the current list.


      Parameters:
      TypeNameDescription
      __ItemComponent &$item The item to select to

      Access:  public



      setSelectionMode


        void setSelectionMode( string $selection_mode  )

      Set an string representing the selection mode, as one of the following:
      • single (__ListBoxComponent::SELECTION_MODE_SINGLE)
      • multiple (__ListBoxComponent::SELECTION_MODE_MULTIPLE)



      Parameters:
      TypeNameDescription
      string $selection_mode

      Access:  public



      setSorted


        void setSorted( bool $sorted  )

      Sets if the item list is sorted


      Parameters:
      TypeNameDescription
      bool $sorted

      Access:  public



      setValue


        void setValue( mixed $value  )

      Sets the value of the first selected item


      Parameters:
      TypeNameDescription
      mixed $value The value to set to

      Access:  public


      Redefinition of:
      __InputComponent::setValue()


      _sortItems


        void _sortItems( )

      Access:  protected



      Constants

      SELECTION_MODE_MULTIPLE =  'multiple'


      [ Top ]

      SELECTION_MODE_SINGLE =  'single'


      [ Top ]