Package snap.view

Class BrowserView<T>

All Implemented Interfaces:
PropChange.DoChange, Selectable<T>, XMLArchiver.Archivable

public class BrowserView<T> extends ParentView implements Selectable<T>
A browser class.
  • Field Details

  • Constructor Details

    • BrowserView

      public BrowserView()
      Creates a new BrowserView.
  • Method Details

    • getScrollView

      public ScrollView getScrollView()
      Returns the ScrollView.
    • getPrefColCount

      public int getPrefColCount()
      Returns the preferred number of visible columns in the browser.
    • setPrefColCount

      public void setPrefColCount(int aValue)
      Sets the preferred number of visible columns in the browser.
    • getPrefColWidth

      public int getPrefColWidth()
      Returns the preferred column width.
    • setPrefColWidth

      public void setPrefColWidth(int aWidth)
      Sets the preferred column width.
    • getRowHeight

      public int getRowHeight()
      Returns the row height.
    • setRowHeight

      public void setRowHeight(int aValue)
      Sets the row height.
    • getCellConfigure

      public Consumer<ListCell<T>> getCellConfigure()
      Called to set method for rendering.
    • setCellConfigure

      public void setCellConfigure(Consumer<ListCell<T>> aCC)
      Called to set method for rendering.
    • getItemsList

      public List<T> getItemsList()
      Returns the items.
      Specified by:
      getItemsList in interface Selectable<T>
    • setItemsList

      public void setItemsList(List<T> theItems)
      Sets the items.
      Specified by:
      setItemsList in interface Selectable<T>
    • setItems

      public void setItems(T[] theItems)
      Sets the items.
      Specified by:
      setItems in interface Selectable<T>
    • updateItems

      public void updateItems(T[] theItems)
      Called to update items that have changed.
    • getResolver

      public TreeResolver<T> getResolver()
      Returns the resolver.
    • setResolver

      public void setResolver(TreeResolver<T> aResolver)
      Sets the resolver.
    • getColCount

      public int getColCount()
      Returns the column count.
    • getCol

      public BrowserCol<T> getCol(int anIndex)
      Returns the browser column list at given index.
    • getColLast

      public BrowserCol<T> getColLast()
      Returns the last column.
    • getCols

      public BrowserCol<T>[] getCols()
      Returns the browser columns.
    • addCol

      protected BrowserCol<T> addCol()
      Adds a column.
    • removeCol

      protected void removeCol(int anIndex)
      Removes a column.
    • getSelCol

      public BrowserCol<T> getSelCol()
      Returns the currently selected column.
    • getSelColIndex

      public int getSelColIndex()
      Returns the currently selected column.
    • setSelColIndex

      protected void setSelColIndex(int anIndex)
      Sets the selected column index.
    • getSelIndex

      public int getSelIndex()
      Returns the selected index.
      Specified by:
      getSelIndex in interface Selectable<T>
    • setSelIndex

      public void setSelIndex(int anIndex)
      Sets the selected index.
      Specified by:
      setSelIndex in interface Selectable<T>
    • getSelItem

      public T getSelItem()
      Returns the selected item.
      Specified by:
      getSelItem in interface Selectable<T>
    • setSelItem

      public void setSelItem(T anItem)
      Sets the selected item.
      Specified by:
      setSelItem in interface Selectable<T>
    • scrollSelToVisible

      public void scrollSelToVisible()
      Scrolls current selection to visible.
    • getColWithSelItem

      protected BrowserCol<T> getColWithSelItem(T anItem)
      Returns the column that has selected item.
    • getSelPathForSeparator

      public String getSelPathForSeparator(String aSeparator)
      Returns the path constructed by appending the selected item in each column by a separator string.
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Process events.
      Overrides:
      processEvent in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      PreferredSize.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • layoutImpl

      protected void layoutImpl()
      Override to layout ScrollView.
      Overrides:
      layoutImpl in class ParentView
    • resetColViewWidth

      protected void resetColViewWidth()
      Called when Column count or width changes to reset ColView.PrefWidth.
    • setWidth

      public void setWidth(double aValue)
      Override to update ColView.PrefWidth.
      Overrides:
      setWidth in class View
    • configureBrowserCell

      protected void configureBrowserCell(BrowserCol<T> aCol, ListCell<T> aCell)
      Called to configure browser cell.
    • getBranchImage

      public Image getBranchImage()
      Returns the icon to indicate branch nodes in a browser (right arrow by default).
    • toXMLView

      public XMLElement toXMLView(XMLArchiver anArchiver)
      XML archival.
      Overrides:
      toXMLView in class ParentView
    • fromXMLView

      public void fromXMLView(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Overrides:
      fromXMLView in class ParentView