Interface ArrayPane
-
- All Superinterfaces:
SimpleGraphicElement
- All Known Implementing Classes:
AbstractArrayPane
,ArrayPaneSilverpeasV5
,ArrayPaneWithDataSource
public interface ArrayPane extends SimpleGraphicElement
The ArrayPane interface gives us the skeleton for all funtionnalities we need to display typical WA array table pane. Exemple :
// Build a new ArrayPane.
ArrayPane arrayPane = graphicFactory.getArrayPane("MyTodoArrayPane", pageContext);
// Add two columns.
arrayPane.addArrayColumn("Nom");
arrayPane.addArrayColumn("Priorite");
arrayPane.addArrayColumnWithAlignement("degres","center");
// Add one line.
ArrayLine arrayLine = arrayPane.addArrayLine();
arrayLine.addArrayCellText();
arrayLine.addArrayCellText();
arrayLine.addArrayCellLink("Un nom", "javascript:onClick=viewToDo()");
- Version:
- 1.0
- Author:
- squere
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTION_PARAMETER_NAME
static String
CACHE_COLUMNS_KEY_SUFFIX
static String
CACHE_LINES_KEY_SUFFIX
static String
COLUMN_PARAMETER_NAME
static String
TARGET_PARAMETER_NAME
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description ArrayColumn
addArrayColumn(String title)
Add a new column to the table.ArrayLine
addArrayLine()
Add a line to the table.static <T> T
computeDataUserSessionIfAbsent(javax.servlet.http.HttpServletRequest request, String cacheKey, Supplier<T> valueSupplier)
Gets data from session from a given cache key or compute them from the given supplier if absent.int
getColumnToSort()
Get the column to be sortedString
getExportDataURL()
String
getName()
Get the unique namestatic <O> O
getOrderByFrom(javax.portlet.RenderRequest renderRequest, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex)
Gets order by from given request and possible orderBies.static <O> O
getOrderByFrom(javax.portlet.RenderRequest renderRequest, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex, String defaultArrayPaneName)
Gets order by from given request and possible orderBies.static <O> O
getOrderByFrom(javax.servlet.http.HttpServletRequest request, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex)
Gets order by from given request and possible orderBies.static <O> O
getOrderByFrom(javax.servlet.http.HttpServletRequest request, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex, String defaultArrayPaneName)
Gets order by from given request and possible orderBies.static <O> O
getOrderByFrom(javax.servlet.http.HttpServletRequest request, Map<String,String> params, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex, String defaultArrayPaneName)
Gets order by from given request and possible orderBies.static PaginationPage
getPaginationPageFrom(javax.portlet.RenderRequest renderRequest)
Gets new pagination page of array from given request.static PaginationPage
getPaginationPageFrom(javax.portlet.RenderRequest renderRequest, String defaultArrayPaneName)
Gets new pagination page of array from given request.static PaginationPage
getPaginationPageFrom(javax.servlet.http.HttpServletRequest request)
Gets new pagination page of array from given request.static PaginationPage
getPaginationPageFrom(javax.servlet.http.HttpServletRequest request, String defaultArrayPaneName)
Gets new pagination page of array from given request.static PaginationPage
getPaginationPageFrom(javax.servlet.http.HttpServletRequest request, Map<String,String> params, String defaultArrayPaneName)
Gets new pagination page of array from given request.javax.servlet.ServletRequest
getRequest()
Get the request that can contains some parameters for the ArrayPane (sort action...)javax.servlet.http.HttpSession
getSession()
Get the session in which the ArrayPane will keep its state.boolean
getSortable()
Get global array columns behaviour for sort.String
getSummary()
Gets a summary about the content of the array pane.String
getTitle()
Get the titlevoid
init(String name, String url, javax.servlet.ServletRequest request, javax.servlet.http.HttpSession session)
void
init(String name, javax.servlet.jsp.PageContext pageContext)
Generic class to display a typical WA array table pane.void
init(String name, javax.servlet.ServletRequest request, javax.servlet.http.HttpSession session)
boolean
isExportData()
String
print()
Print the array line in an html format.void
setColumnToSort(int columnNumber)
Modify the column number the sort will be based on.void
setExportData(boolean export)
void
setExportDataURL(String exportDataURL)
void
setLineMoveCallback(String callback)
Sets a Javascript function to call when one or more lines of the array are moved between them.void
setMovableLines(boolean movableLines)
Indicates if the lines of the array can be moved, reordered by hand by the user.void
setRoutingAddress(String address)
change the routing address (the url of the page to which the column header refer) in the rare cases when you may not want it to be derived from the calling page.void
setSortable(boolean sortable)
Set all array columns to be sortable or not.void
setSummary(String summary)
Sets the array pane summary.void
setTitle(String title)
Set the array title, to be displayed on the first html table.void
setVisibleLineNumber(int maximum)
Set the maximum line number visible in the table.
-
-
-
Field Detail
-
ACTION_PARAMETER_NAME
static final String ACTION_PARAMETER_NAME
- See Also:
- Constant Field Values
-
TARGET_PARAMETER_NAME
static final String TARGET_PARAMETER_NAME
- See Also:
- Constant Field Values
-
COLUMN_PARAMETER_NAME
static final String COLUMN_PARAMETER_NAME
- See Also:
- Constant Field Values
-
CACHE_COLUMNS_KEY_SUFFIX
static final String CACHE_COLUMNS_KEY_SUFFIX
- See Also:
- Constant Field Values
-
CACHE_LINES_KEY_SUFFIX
static final String CACHE_LINES_KEY_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOrderByFrom
static <O> O getOrderByFrom(javax.portlet.RenderRequest renderRequest, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex)
Gets order by from given request and possible orderBies. The name of the array can be specified via the attributes of given request withTARGET_PARAMETER_NAME
key.- Parameters:
renderRequest
- the request.orderBiesByColumnIndex
- the possible order by indexed by the column index which starts at 1.- Returns:
- the order by.
-
getOrderByFrom
static <O> O getOrderByFrom(javax.portlet.RenderRequest renderRequest, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex, String defaultArrayPaneName)
Gets order by from given request and possible orderBies. The name of the array can be specified via the attributes of given request withTARGET_PARAMETER_NAME
key.- Parameters:
renderRequest
- the request.orderBiesByColumnIndex
- the possible order by indexed by the column index which starts at 1.defaultArrayPaneName
- the name of the array to search for in session in order to get state and provide the right order by.- Returns:
- the order by.
-
getOrderByFrom
static <O> O getOrderByFrom(javax.servlet.http.HttpServletRequest request, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex)
Gets order by from given request and possible orderBies. The name of the array can be specified via the attributes of given request withTARGET_PARAMETER_NAME
key.- Parameters:
request
- the request.orderBiesByColumnIndex
- the possible order by indexed by the column index which starts at 1.- Returns:
- the order by.
-
getOrderByFrom
static <O> O getOrderByFrom(javax.servlet.http.HttpServletRequest request, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex, String defaultArrayPaneName)
Gets order by from given request and possible orderBies. If no order by is defined into request, then the order by is retrieved from session if defaultArrayPaneName parameter is defined.- Parameters:
request
- the request.orderBiesByColumnIndex
- the possible order by indexed by the column index which starts at 1.defaultArrayPaneName
- the name of the array to search for in session in order to get state and provide the right order by.- Returns:
- the order by.
-
getOrderByFrom
static <O> O getOrderByFrom(javax.servlet.http.HttpServletRequest request, Map<String,String> params, Map<Integer,org.apache.commons.lang3.tuple.Pair<O,O>> orderBiesByColumnIndex, String defaultArrayPaneName)
Gets order by from given request and possible orderBies. If no order by is defined into request, then the order by is retrieved from session if defaultArrayPaneName parameter is defined.- Parameters:
request
- the request.params
- the request params.orderBiesByColumnIndex
- the possible order by indexed by the column index which starts at 1.defaultArrayPaneName
- the name of the array to search for in session in order to get state and provide the right order by.- Returns:
- the order by.
-
getPaginationPageFrom
static PaginationPage getPaginationPageFrom(javax.portlet.RenderRequest renderRequest)
Gets new pagination page of array from given request.- Parameters:
renderRequest
- the request.- Returns:
- a pagination page.
-
getPaginationPageFrom
static PaginationPage getPaginationPageFrom(javax.portlet.RenderRequest renderRequest, String defaultArrayPaneName)
Gets new pagination page of array from given request.- Parameters:
renderRequest
- the request.defaultArrayPaneName
- the name of the array to search for in session in order to get current pagination.- Returns:
- a pagination page.
-
getPaginationPageFrom
static PaginationPage getPaginationPageFrom(javax.servlet.http.HttpServletRequest request)
Gets new pagination page of array from given request.- Parameters:
request
- the request.- Returns:
- a pagination page.
-
getPaginationPageFrom
static PaginationPage getPaginationPageFrom(javax.servlet.http.HttpServletRequest request, String defaultArrayPaneName)
Gets new pagination page of array from given request.- Parameters:
request
- the request.defaultArrayPaneName
- the name of the array to search for in session in order to get current pagination.- Returns:
- a pagination page.
-
getPaginationPageFrom
static PaginationPage getPaginationPageFrom(javax.servlet.http.HttpServletRequest request, Map<String,String> params, String defaultArrayPaneName)
Gets new pagination page of array from given request.- Parameters:
request
- the request.params
- the request params.defaultArrayPaneName
- the name of the array to search for in session in order to get current pagination.- Returns:
- a pagination page.
-
computeDataUserSessionIfAbsent
static <T> T computeDataUserSessionIfAbsent(javax.servlet.http.HttpServletRequest request, String cacheKey, Supplier<T> valueSupplier)
Gets data from session from a given cache key or compute them from the given supplier if absent.If the parameter ajaxRequest (set automatically by sp.arrayPane JavaScript API) exists, then the data are retrieved from the user session.
- Type Parameters:
T
- the type of data.- Parameters:
request
- the HTTP request.cacheKey
- the key into the cache.valueSupplier
- the data supplier.- Returns:
- the data.
-
init
void init(String name, javax.servlet.jsp.PageContext pageContext)
Generic class to display a typical WA array table pane. A unique name identifier is to be used in html pages for this array specific actions (exemple : sort on a specific column)- Parameters:
name
- A unique name in the page to display
-
init
void init(String name, javax.servlet.ServletRequest request, javax.servlet.http.HttpSession session)
-
init
void init(String name, String url, javax.servlet.ServletRequest request, javax.servlet.http.HttpSession session)
-
addArrayColumn
ArrayColumn addArrayColumn(String title)
Add a new column to the table.- Parameters:
title
- The column title to display- Returns:
- The new column header. You can use this object to modify the default display options.
-
addArrayLine
ArrayLine addArrayLine()
Add a line to the table. Be carefull : each line form the array has to contain the same cell number. If not, the array will contain some empty cells, and won't be sortable.- Returns:
- an ArrayLine, to be used to add cells and to modify default display options.
-
getTitle
String getTitle()
Get the title- Returns:
- The title
-
setTitle
void setTitle(String title)
Set the array title, to be displayed on the first html table.- Parameters:
title
- The title
-
getName
String getName()
Get the unique name- Returns:
- The name of this object in the http page
-
setVisibleLineNumber
void setVisibleLineNumber(int maximum)
Set the maximum line number visible in the table. If the number of line is greater than this maximum, only the first lines will be visible, and some buttons to view next and previous lines will be added.- Parameters:
maximum
- The maximum number of visible lines
-
getColumnToSort
int getColumnToSort()
Get the column to be sorted- Returns:
- The column number.
-
setColumnToSort
void setColumnToSort(int columnNumber)
Modify the column number the sort will be based on.- Parameters:
columnNumber
- The column to be sorted
-
print
String print()
Print the array line in an html format.- Specified by:
print
in interfaceSimpleGraphicElement
- Returns:
- The html code, representing the array pane
-
getSession
javax.servlet.http.HttpSession getSession()
Get the session in which the ArrayPane will keep its state.- Returns:
- The session
-
getRequest
javax.servlet.ServletRequest getRequest()
Get the request that can contains some parameters for the ArrayPane (sort action...)- Returns:
- The entering request
-
setRoutingAddress
void setRoutingAddress(String address)
change the routing address (the url of the page to which the column header refer) in the rare cases when you may not want it to be derived from the calling page. This method is called by the constructor if you precise an url to the GraphicElementFactory.
-
getSortable
boolean getSortable()
Get global array columns behaviour for sort. By default, all columns are sortable.- Returns:
- True, if the array is sortable, false if not.
-
setSortable
void setSortable(boolean sortable)
Set all array columns to be sortable or not. By default, all columns are sortable.- Parameters:
sortable
- Set sortable to false if you want all the table to be unsortable.
-
setLineMoveCallback
void setLineMoveCallback(String callback)
Sets a Javascript function to call when one or more lines of the array are moved between them.- Parameters:
callback
- a function to invoke.
-
getSummary
String getSummary()
Gets a summary about the content of the array pane.- Returns:
- the summary.
-
setSummary
void setSummary(String summary)
Sets the array pane summary.- Parameters:
summary
- a summary.
-
isExportData
boolean isExportData()
- Returns:
- true if the current array pane can be exported, false else if
-
setExportData
void setExportData(boolean export)
- Parameters:
export
- enable/disable export data from array pane
-
getExportDataURL
String getExportDataURL()
- Returns:
- export data URL used to export current ArrayPane data
-
setExportDataURL
void setExportDataURL(String exportDataURL)
- Parameters:
exportDataURL
- the URL to set used to export array pane data
-
setMovableLines
void setMovableLines(boolean movableLines)
Indicates if the lines of the array can be moved, reordered by hand by the user.- Parameters:
movableLines
- true if the lines can be moved.
-
-