Class ListArea<E>

java.lang.Object
org.luwrain.controls.ListArea<E>
All Implemented Interfaces:
ClipboardTranslator.Provider, RegionTextQueryTranslator.Provider, Area, HotPoint, Lines
Direct Known Subclasses:
CommanderArea, EditableListArea, ListPopup2, ListPopupBase, MainMenu, MarkableListArea, TreeListArea

public class ListArea<E> extends Object implements Area, ClipboardTranslator.Provider, RegionTextQueryTranslator.Provider
  • Field Details

  • Constructor Details

  • Method Details

    • setListClickHandler

      public void setListClickHandler(ListArea.ClickHandler<E> clickHandler)
    • getListModel

      public ListArea.Model<E> getListModel()
    • getListAppearance

      public ListArea.Appearance<E> getListAppearance()
    • selected

      public final E selected()
      Returns the object in the model corresponding to current hot point position. If the model is empty or hot point is on an empty line, this method always returns null.
      Returns:
      The object in the model associated with the currently selected line or null if there is no any
    • selectedIndex

      public final int selectedIndex()
      The index of the item in the model which is under the hot point in this list. This method returns the index in the model, not on the screen. It means that the value returned by this method may be different than the value returned by getHotPointY() (but may be equal as well). If the list is empty or an empty line is selected, this method returns -1.
      Returns:
      The index of the selected line in the model or -1 if there is no any
    • select

      public boolean select(E obj, boolean announce)
      Searches for the item in the model and sets hot point on it. Given an arbitrary object, this method looks through all items in the model and does a couple of checks: literal pointers equality and a check with equals() method. If at least one of these checks succeeds, the item is considered equal to the given one, and hot points is set on it.
      Parameters:
      obj - The object to search for
      announce - Must be true if it is necessary to introduce the object, once it's found
      Returns:
      True if the request object is found, false otherwise
    • select

      public boolean select(int index, boolean announce)
      Selects the item by its index. Given the non-negative integer value as an index, this method sets the hot point on the item addressed with this index, checking only that index is in appropriate bounds. Index must address the object as a number in the model, ignoring any empty lines.
      Parameters:
      index - The item index to select
      announce - Must be true, if it is necessary to announce the item , once it has been selected
      Returns:
      True if the index is valid and the item gets hot point on it
    • selectEmptyLineBottom

      public boolean selectEmptyLineBottom(boolean announce)
    • getExistingItemIndexOnLine

      public int getExistingItemIndexOnLine(int lineIndex)
    • getItemIndexOnLine

      public int getItemIndexOnLine(int index)
    • getLineIndexByItemIndex

      public int getLineIndexByItemIndex(int index)
    • getItemOnLine

      public E getItemOnLine(int lineIndex)
    • getListItemCount

      public int getListItemCount()
    • reset

      public void reset(boolean announce)
    • resetHotPoint

      public void resetHotPoint()
    • resetHotPoint

      public void resetHotPoint(boolean introduce)
    • announceSelected

      public void announceSelected()
    • refresh

      public void refresh()
      Refreshes the content of the list. This method calls refresh() method of the model and displays new items. It does not produce any speech announcement of the change. HotPointY is preserved if it is possible (meaning, the new number of lines not less than old value of hotPointY), but hotPointX is moved to the beginning of the line.
    • redraw

      public void redraw()
    • isEmpty

      public boolean isEmpty()
    • onInputEvent

      public boolean onInputEvent(InputEvent event)
      Specified by:
      onInputEvent in interface Area
    • onSystemEvent

      public boolean onSystemEvent(SystemEvent event)
      Specified by:
      onSystemEvent in interface Area
    • onAreaQuery

      public boolean onAreaQuery(AreaQuery query)
      Specified by:
      onAreaQuery in interface Area
    • getAreaActions

      public Action[] getAreaActions()
      Specified by:
      getAreaActions in interface Area
    • getLineCount

      public int getLineCount()
      Specified by:
      getLineCount in interface Lines
    • getLine

      public String getLine(int index)
      Specified by:
      getLine in interface Lines
    • getHotPointX

      public int getHotPointX()
      Specified by:
      getHotPointX in interface Area
      Specified by:
      getHotPointX in interface HotPoint
    • getHotPointY

      public int getHotPointY()
      Specified by:
      getHotPointY in interface Area
      Specified by:
      getHotPointY in interface HotPoint
    • getAreaName

      public String getAreaName()
      Specified by:
      getAreaName in interface Area
    • setAreaName

      public void setAreaName(String areaName)
    • onAnnounce

      protected boolean onAnnounce()
      Announces the list area. If the area is created with AREA_ANNOUNCE_SELECTED flag, this method speaks the screen text of the currently selected item or the area name otherwise (without the flag or if there is no selected item).
    • onAnnounceLine

      protected boolean onAnnounceLine()
    • onMoveHotPoint

      protected boolean onMoveHotPoint(MoveHotPointEvent event)
    • onBeginListeningQuery

      protected boolean onBeginListeningQuery(BeginListeningQuery query)
    • onListeningFinishedEvent

      protected boolean onListeningFinishedEvent(ListeningFinishedEvent event)
    • onChar

      protected boolean onChar(InputEvent event)
    • onMoveDown

      protected boolean onMoveDown(InputEvent event, boolean briefAnnouncement)
    • onMoveUp

      protected boolean onMoveUp(InputEvent event, boolean briefAnnouncement)
    • onPageDown

      protected boolean onPageDown(InputEvent event, boolean briefAnnouncement)
    • onPageUp

      protected boolean onPageUp(InputEvent event, boolean briefAnnouncement)
    • onEnd

      protected boolean onEnd(InputEvent event)
    • onHome

      protected boolean onHome(InputEvent event)
    • onTransition

      protected boolean onTransition(ListArea.Transition.Type type, Hint hint, boolean briefAnnouncement)
    • onMoveRight

      protected boolean onMoveRight(InputEvent event)
    • onMoveLeft

      protected boolean onMoveLeft(InputEvent event)
    • onAltRight

      protected boolean onAltRight(InputEvent event)
    • onAltLeft

      protected boolean onAltLeft(InputEvent event)
    • onAltEnd

      protected boolean onAltEnd(InputEvent event)
    • onAltHome

      protected boolean onAltHome(InputEvent event)
    • onEnter

      protected boolean onEnter(InputEvent event)
    • onOk

      protected boolean onOk(SystemEvent event)
    • onRegionTextQuery

      public String onRegionTextQuery(int fromX, int fromY, int toX, int toY)
      Specified by:
      onRegionTextQuery in interface RegionTextQueryTranslator.Provider
    • onClipboardCopyAll

      public boolean onClipboardCopyAll()
      Specified by:
      onClipboardCopyAll in interface ClipboardTranslator.Provider
    • onClipboardCopy

      public boolean onClipboardCopy(int fromX, int fromY, int toX, int toY, boolean withDeleting)
      Specified by:
      onClipboardCopy in interface ClipboardTranslator.Provider
    • onDeleteRegion

      public boolean onDeleteRegion(int fromX, int fromY, int toX, int toY)
      Specified by:
      onDeleteRegion in interface ClipboardTranslator.Provider
    • onNewHotPointY

      protected void onNewHotPointY(boolean briefAnnouncement)
    • getObservableSubstr

      protected String getObservableSubstr(E item)
    • noContentStr

      protected String noContentStr()
    • announceChar

      protected void announceChar(String line, int pos, int rightBound)
    • noContent

      protected boolean noContent()