Class ServerTableView

All Implemented Interfaces:
Serializable, EntityContainer, overit.geocall.clipboard.XClip, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, AjaxableComponent, Badgeable, DAViewManager, DBViewManager, DraggableDroppable, Hideable, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable
Direct Known Subclasses:
CalendarView, CardView, EventServerTableView, ServerTableViewWithCount, SynchronizedPlanningMonitorTableView

@Component public class ServerTableView extends TableView implements DBViewManager, DAViewManager
The class extends TableView and implements a table, the user interface element that allows to arranges the data in tabular format and manages the behaviors of the child components, that are mainly columns and some particular kind of buttons.
The ServerTableView it's the "server table", the component that can be used to keep all data in memory or, if the amount of data is big, load the data on demand. Furthermore this container, being managed on server side, provides a whole series of additional interactions and better user interface behaviors that make it the right object to use to create tables in all the application.
See Also:
GCApi:
component
  • Field Details

    • _da

      protected DABase _da
    • _dao

      protected DAO _dao
    • _dao0

      protected DAO0 _dao0
    • _queryid

      protected int _queryid
    • _queryCommand

      protected Command _queryCommand
    • _params

      protected HashGetter _params
    • _orderFields

      protected String _orderFields
    • _queryExecuted

      protected boolean _queryExecuted
    • _lastButton

      protected boolean _lastButton
    • _maxrows

      protected int _maxrows
    • _initRows

      protected int _initRows
    • _extension

      protected int _extension
    • haveMore

      protected boolean haveMore
  • Constructor Details

    • ServerTableView

      public ServerTableView()
  • Method Details

    • inMemory

      public boolean inMemory()
      to inspect if the ServerTableView works in-memory by setting a DBView or if it is feeded by DAO, DAO0 or DABase
      Returns:
      true if the ServerTableView works in memory by setting a DBView, false otherwise
    • setLASTBUTTON

      public void setLASTBUTTON(String s)
      Makes visible the "go to the last page" button when the pagination is active on the table.
      Clicking on the button, the table will display the very last records of the table with the side effect to load the whole data set. This can be dangerous if the number of the records is very large, and can saturate the memory
      Parameters:
      s - true if the "go to last page" must be shown, false otherwise.
    • setMAXROWS

      public void setMAXROWS(String s)
      Sets the maximum number of records to fetch from the database.
      Parameters:
      s - Maximum number of rows, if 0 no limit will be applied
    • setEXTENSION

      public void setEXTENSION(String s)
      When used, it will appear a button at the bottom of the table, used to load more rows.
      The number of rows loaded on every click is the number passed as parameter.
      Parameters:
      s - Number of rows to be loaded via the button
    • setROWS

      public void setROWS(String s)
      Sets the number of the rows of the table to be displayed.
      If the total number of rows in the table is greater than the number of rows set by this method, the table will be paginated and will appear the arrows with the possibility to browse through the pages.
      Overrides:
      setROWS in class TableView
      Parameters:
      s - The number of rows to be displayed (on every page)
    • getExtensionRow

      protected org.apache.ecs.Element getExtensionRow(int end)
      Overrides:
      getExtensionRow in class TableView
    • getExtensionLabel

      protected String getExtensionLabel()
    • setDA

      public void setDA(Object o)
      Sets the DA DABase used to do the queries that fetches the data from the database
      Parameters:
      o - The DA used by the table
    • setDAO

      public void setDAO(Object o)
      Sets the DAO DAO used to do the queries that fetches the data from the database
      Parameters:
      o - The DAO used by the table
    • setDAO0

      @Deprecated public void setDAO0(Object o)
      Deprecated.
      use DAO instead Sets the DAO0 DAO0 used to do the queries that fetches the data from the database
      Parameters:
      o - The DAO used by the table
    • setQUERY

      public void setQUERY(String query)
      Sets the string that defines the name of the query that will be used to fetch the data from the database.
      Parameters:
      query - The query used by the table. Pay attention to match with one of the constant's names defined in the DABase set by the method setDA(obj) or setDA(da)
    • onNextPage

      public boolean onNextPage(Object obj)
      Loads the next page of the table. Called when the user click on the "go to next page" button of the navigation bar of the table.
      Parameters:
      obj - Not used
      Returns:
      true
    • onPreviousPage

      public boolean onPreviousPage(Object obj)
      Loads the previous page of the table. Called when the user click on the "go to previous page" button of the navigation bar of the table.
      Parameters:
      obj - Not used
      Returns:
      true
    • onFirstPage

      public boolean onFirstPage(Object obj)
      Loads the first page of the table. Called when the user click on the "go to first page" button of the navigation bar of the table.
      Parameters:
      obj - Not used
      Returns:
      true
    • onLastPage

      public boolean onLastPage(Object obj)
      Loads the last page of the table. Called when the user click on the "go to last page" button (if present, see setLASTBUTTON(java.lang.String)) of the navigation bar of the table.
      Parameters:
      obj - Not used
      Returns:
      true
    • onExtends

      public boolean onExtends(UIMessage uim)
      Loads and displays some more rows of the table. The number of new rows loaded depends on the attribute extension, settet with setEXTENSION(java.lang.String). It's the method called when the user click on the button that appears on the bottom of the table
      Parameters:
      uim - Not used
      Returns:
      true
    • needsNavBar

      protected boolean needsNavBar(int pages)
      Overrides:
      needsNavBar in class TableView
    • getNavBar

      protected org.apache.ecs.Element getNavBar(EntitySet es, int currPage, int pages)
      Overrides:
      getNavBar in class TableView
    • setupRanges

      protected int setupRanges()
    • updateCurrentRowsForPage

      protected void updateCurrentRowsForPage(int newRows)
      Overrides:
      updateCurrentRowsForPage in class TableView
    • changed

      public void changed(overit.geocall.ux.servlet.processor.Change change)
      Defines the morphing of the table element that occurs when there is an Ajax interaction
      Implements the AjaxableComponent interface.
      Specified by:
      changed in interface AjaxableComponent
      Overrides:
      changed in class TableView
      Parameters:
      change - The Change object that defines the specific morphing type for the table
    • getFrameHtml

      public org.apache.ecs.Element getFrameHtml(overit.geocall.ux.servlet.processor.Change change, EntitySet es)
      Defines the html part of the table that changes when an Ajax interaction occurs.
      Implements the AjaxableComponent interface.
      Specified by:
      getFrameHtml in interface AjaxableComponent
      Overrides:
      getFrameHtml in class TableView
      Parameters:
      change - The Change object that defines the specific morphing type for the table
      es - The EntitySet to which the element belongs
      Returns:
      The html part of the table that changes when an Ajax interaction occurs
    • pageExtension

      protected org.apache.ecs.Element pageExtension(EntitySet es, int n, int pages)
    • setDBView

      public void setDBView(DBView dbv)
      Sets the DBView, i.e. the logical view of a portion of a database table usually obtained as a result of a query, to the ServerTableView.
      Implements the DBViewManager interface.
      Specified by:
      setDBView in interface DBViewManager
      Overrides:
      setDBView in class TableView
      Parameters:
      dbv - The DBView that we want to set to the table
    • getDa

      public DABase getDa()
      Returns the DA used to fetch the records
      Specified by:
      getDa in interface DAViewManager
      Returns:
      The DA associated to the table
    • getDAO

      public DAO getDAO()
      Returns the DAO used to fetch the records
      Returns:
      The DAO associated to the table
    • getDAO0

      @Deprecated public DAO0 getDAO0()
      Deprecated.
      use DAO instead Returns the DAO0 used to fetch the records
      Returns:
      The DAO0 associated to the table
    • getParams

      public HashGetter getParams()
      Returns the HashGetter that contains the values that will be associated to the parameters of the query used to fetch the records of the table (see DABase)
      Specified by:
      getParams in interface DAViewManager
      Returns:
      The HashGetter of the parameters used for the query
    • getQueryId

      public int getQueryId()
      Returns the id of the query used to fetch the records of the table (see DABase)
      Specified by:
      getQueryId in interface DAViewManager
      Returns:
      The id of the query
    • setDa

      public void setDa(DABase da)
      Sets the DA DABase used to do the queries that fetches the data from the database
      Specified by:
      setDa in interface DAViewManager
      Parameters:
      da - The DA used by the table
    • setDao

      public void setDao(DAO dao)
      Sets the DAO DAO used to do the queries that fetches the data from the database
      Parameters:
      dao - The DAO used by the table
    • setDao0

      @Deprecated public void setDao0(DAO0 dao0)
      Deprecated.
      use DAO instead Sets the DAO0 DAO0 used to do the queries that fetches the data from the database
      Parameters:
      dao0 - The DAO0 used by the table
    • setParams

      public void setParams(HashGetter params)
      Sets the HashGetter that contains the values that will be associated to the parameters of the query used to fetch the records of the table (see DABase)
      Specified by:
      setParams in interface DAViewManager
      Parameters:
      params - The HashGetter of the parameters used for the query
    • setQueryId

      public void setQueryId(int id)
      Sets the id of the query used to fetch the records of the table (see DABase)
      Specified by:
      setQueryId in interface DAViewManager
      Parameters:
      id - The id of the query
    • setQueryCommand

      public void setQueryCommand(Command c)
      Sets the Command that will be used to fetch the records of the table (see DAO)
      Parameters:
      c - The Command that will be execute in order to retrieve the records from the database.
    • onNewDBView

      protected void onNewDBView(DBView dbv)
    • load

      public void load(int page)
      Loads the records of the specific page of the table. It's the method that makes the queries.
      Parameters:
      page - The number of the page to be loaded
    • fetchRange

      protected DBView fetchRange(int maxrows, int skiprows)
    • load

      protected void load(int page, boolean extension)
    • getMode

      public String getMode()
      Returns the current active mode of the table (see setMode(mode))
      Specified by:
      getMode in interface DBViewManager
      Overrides:
      getMode in class TableView
      Returns:
      The string that defines the current active mode of the table
    • setMode

      public void setMode(String mode)
      Defines the mode of the table. It is possible to indicate the name of the query used to fetch the records, or the name of the field used to sort all the records in ascending or descending order (see TableView.setMode(java.lang.String)); it is possible to define both, using the # character to divide the name of the query from the names of the fields used for the sorting
      Specified by:
      setMode in interface DBViewManager
      Overrides:
      setMode in class TableView
      Parameters:
      mode - The name of the query used to fetch the records, or the name of the field(s) used for sorting.
    • onSelectCurrPage

      public boolean onSelectCurrPage(Object o)
      Selects all the rows of the current page of the table
      Parameters:
      o - Not used
      Returns:
      false
    • onDeSelectCurrPage

      public boolean onDeSelectCurrPage(Object o)
      Deselects all the rows of the current page of the table
      Parameters:
      o - Not used
      Returns:
      false
    • buildLoadPageScript

      protected void buildLoadPageScript(StringBuilder sb)
      Overrides:
      buildLoadPageScript in class TableView