Class FIXGRIDListBinding<ItemClass extends FIXGRIDItem>

java.lang.Object
org.eclnt.jsfserver.elements.impl.FIXGRIDBinding<ItemClass>
org.eclnt.jsfserver.elements.impl.FIXGRIDListBinding<ItemClass>
All Implemented Interfaces:
Serializable, IConfiguredByLayout, IFIXGRIDBinding<ItemClass>, IListWithChangeIndexListener, IDynamicContentBindingObject
Direct Known Subclasses:
ARRAYGRIDListBinding, DynBeanUI.Grid, FIXGRIDBeanListBinding, FIXGRIDPivotListBinding, IdAttributesSelection.IdAttributesLineGrid, IdTextSelection.IdTextLineGrid, SPANGRIDListBinding

public class FIXGRIDListBinding<ItemClass extends FIXGRIDItem> extends FIXGRIDBinding<ItemClass> implements IFIXGRIDBinding<ItemClass>, Serializable, IListWithChangeIndexListener
Binding class for FIXGRID component. Used as server counter part of a client side grid - when the grid renders a list of items. The items are managed in a list, that is accessed by getItems(). This list can be changed from outside. - The class does all the "handshaking" between the client's view on data and the server's view: the client only knows the visible items, the server knows all items. Every time the client scrolls then actually the server side FIXGRIDListBinding passes a "window of data" to the client which represents the visible view. All this management is done by this class without letting the user know - the user only knows the getItems()-list to deal with.

PAY ATTENTION: references to FIXGRIDListBinding must be "stable references". I.e.: use getItems().clear() for clearing the list, do not re-create list instances.
See Also:
  • Constructor Details

    • FIXGRIDListBinding

      public FIXGRIDListBinding()
    • FIXGRIDListBinding

      public FIXGRIDListBinding(boolean changeIndexIsSupported)
      Constructor which allows to switch on performance optimized data management. See FIXGRIDBinding(boolean).
  • Method Details

    • createItems

      protected IListWithChangeIndex<ItemClass> createItems()
      Factory method for creating the item object that is internally used when the FIXGRIDListBinding object is created. By default an implementation of ArrayListWithChangeIndex is returned. You can override an add you own implementation.
      The method is called within the constructor of FIXGRIDListBinding.
    • setItems

      public void setItems(IListWithChangeIndex<ItemClass> items)
      The original item list can be changed during the lifecycle of FIXGRIDListBinding by passing a new instance via this method.
    • getRows

      public List<ItemClass> getRows()
      Passes back these items which are currently visible to the user interface. This is NOT the list of all items - use getItems() to access the whole list.
      Specified by:
      getRows in interface IFIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • getSbmaximum

      public int getSbmaximum()
      Maximum number of items. Represents the size of the list that is managed internally.
      Specified by:
      getSbmaximum in interface IFIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • getItems

      public List<ItemClass> getItems()
      Get list of managed items. Using prorgrams can do "anything" they want with the list. I.e. clear it, append items, ...
    • setSbvalue

      public void setSbvalue(String value)
      Set the top index of what is currently passed to the client. With a fresh list the top index is 0 by default, but you can set the top index to any value (which is below the size of the list) in order to scroll to a certain component.
      Specified by:
      setSbvalue in interface IFIXGRIDBinding<ItemClass extends FIXGRIDItem>
      Overrides:
      setSbvalue in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • listChanged

      public void listChanged(IListWithChangeIndex list)
      Used internally.
      Specified by:
      listChanged in interface IListWithChangeIndexListener
    • listItemWasRemoved

      public void listItemWasRemoved(IListWithChangeIndex list, Object concreteItem)
      Specified by:
      listItemWasRemoved in interface IListWithChangeIndexListener
    • listItemWasAdded

      public void listItemWasAdded(IListWithChangeIndex list, Object concreteItem)
      Specified by:
      listItemWasAdded in interface IListWithChangeIndexListener
    • ensureItemToBeDisplayed

      public void ensureItemToBeDisplayed(ItemClass item)
      While the server side grid may have 1000s of items, only a few of them is rendered on client side. By calling this method you ensure that a certain item is in the "window of items" that is brought to the client. The grid will scroll so that this item will be visible to the user.
      Specified by:
      ensureItemToBeDisplayed in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • ensureItemToBeDisplayed

      public void ensureItemToBeDisplayed(int index)
      Same as #ensureItemToBeDisplayed(Object), but now with the index of the item as parameter.
    • setSbvalue

      public void setSbvalue(int value)
      Description copied from class: FIXGRIDBinding
      Sets the top index of the grid. Using this method you can scroll the grid to any top position. Please make sure that the value passed is a correct index into your grid.
      Overrides:
      setSbvalue in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • getSelectedItemsAsSequence

      public Collection<ItemClass> getSelectedItemsAsSequence()
      Returns all selected items in the sequence they occur within the grid. Use getSelectedItems() returning a Set for normal operations - it is much faster. Only use this method when really requiring the order of items.
    • selectItem

      public void selectItem(int index)
      Selects the item with the index passed. Use either this method or the FIXGRIDBinding.selectItem(IFIXGRIDItem) in order to select a grid item.

      Please pay attention: in case of using "lazy loading of grid items / load on demand" you need to make sure that there actually is a value behind the index.
    • deselectItem

      public void deselectItem(int index)
      De-selects item with certain index. Use either this method or FIXGRIDBinding.deselectItem(IFIXGRIDItem) in order to de-select items.

      Please pay attention: in case of using "lazy loading of grid items / load on demand" you need to make sure that there actually is a value behind the index.
    • fillShiftSelection

      protected void fillShiftSelection()
      Description copied from class: FIXGRIDBinding
      Default implementation: no shift selection, but just normal selection
      Overrides:
      fillShiftSelection in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • getListOfItems

      protected List<ItemClass> getListOfItems()
      Implementation for the grid. This returns the getItems() collection. You may override this function in case you load your grid data step by step.
      Specified by:
      getListOfItems in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • sortGrid

      protected void sortGrid(String sortReference, String objectBindingString, boolean ascending)
      Description copied from class: FIXGRIDBinding
      Actual sorting of grid. This method needs to be overridden by grid implementations.
      Specified by:
      sortGrid in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • sortGridByOriginalIndex

      protected void sortGridByOriginalIndex()
      Description copied from class: FIXGRIDBinding
      In case the grid is supporting "triplesort": this is the method to sort the grid by its original index
      Specified by:
      sortGridByOriginalIndex in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • applyOriginalIndexToCurrentContent

      public void applyOriginalIndexToCurrentContent()
      Description copied from interface: IFIXGRIDBinding
      When using triple state sorting then the original index of the items needs to be stored in the items. This method assigns this original index.
      Specified by:
      applyOriginalIndexToCurrentContent in interface IFIXGRIDBinding<ItemClass extends FIXGRIDItem>
    • processSearch

      protected void processSearch(String searchString, String sortReference)
      Default implementation: positions the grid onto the first item that starts with the searchString. Only works if sortReference is not null. This method needs to be overridden when applying own searches or when not all data is loaded into the FIXGRIDListBinding yet.
      Overrides:
      processSearch in class FIXGRIDBinding<ItemClass extends FIXGRIDItem>