Package com.jbstrap.ui
Interface Fetchable<T extends Component<?>>
- Type Parameters:
T
- The component type
- All Known Implementing Classes:
ActivityStream
,Calendar
,ComboboxItem
,DualListBox
,ListGrid
,RadioButtonItem
,Sparkline
,Timeline
,Treeview
public interface Fetchable<T extends Component<?>>
Interface for marking components that can fetch data.
- Since:
- 4.0
- Author:
- JBStrap
-
Method Summary
Modifier and TypeMethodDescriptiondefault T
addFetchDoneHandler
(FetchDoneEventHandler handler) Adds a fetch done handler to the component.This method implements actual data retrieval.Fetches datadefault void
Fires a fetch done event on the component with the specified error class.boolean
Determines if the component can fetch data from the database automatically.setAutoFetchData
(boolean autoFetch) Sets if the component can fetch data from the database automatically.
-
Method Details
-
fetch
List<Record> fetch(int startRow, int endRow, Criteria criteria, List<Order> orders, Client client) throws FindException, DataAccessException This method implements actual data retrieval. ThefetchData()
function runs callback methods on the returned records.- Parameters:
startRow
- The first row of the query that appears in the returned listendRow
- The last row of the query that appears in the returned listcriteria
- The criteria used during the query Ifnull
, no criteria will be used, every record is queried.orders
- The orderings that will be applied to the query results. Ifnull
, the data will not be ordered.client
- The client that started the query. Ifnull
, the query will happen without checking for access rights.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException
- Occurs if an error was encountered during the queryDataAccessException
- Occurs if the user in the specified client has no access to read the data
-
fetchData
T fetchData()Fetches data- Returns:
- The component
-
setAutoFetchData
Sets if the component can fetch data from the database automatically. By default, the fetch is automatic.- Parameters:
autoFetch
- Iftrue
, then the auto fetch is enabled. If disabled, the query must be started manually, through code.- Returns:
- The component
-
isAutoFetchData
boolean isAutoFetchData()Determines if the component can fetch data from the database automatically.- Returns:
- If
true
, then the auto fetch is enabled.
-
addFetchDoneHandler
Adds a fetch done handler to the component. The event will run if the component finishes a data fetch.- Parameters:
handler
- TheFetchDoneEventHandler
implementation- Returns:
- The component
-
fireFetchDoneEvent
Fires a fetch done event on the component with the specified error class. If the fetch was successful, it must be specified asnull
- Parameters:
e
- The error that occurred during the query, or if the query was successful,null
-