org.openxava.tab
Class Tab

java.lang.Object
  extended by org.openxava.tab.Tab
All Implemented Interfaces:
java.io.Serializable

public class Tab
extends java.lang.Object
implements java.io.Serializable

Session object to work with tabular data.

Author:
Javier Paniza
See Also:
Serialized Form

Field Summary
static java.lang.String COLLECTION_PREFIX
          Prefix used for naming (in session) to the tab objects used for collections.
static java.lang.String TAB_RESETED_PREFIX
           
 
Constructor Summary
Tab()
           
 
Method Summary
 void addProperties(java.util.Collection properties)
           
 void addProperty(int index, java.lang.String propertyName)
           
 void addProperty(java.lang.String propertyName)
           
 void addSumProperty(java.lang.String property)
          Add total property.
 void clearProperties()
           
 void clearSelected()
           
 void clearStyle()
          Clear the effect of all calls to setStyle(int, String)
 void deselectAll()
           
 void deselectVisualizedRows()
           
static int friendViewGetDefaultColumnWidth(MetaProperty p)
           
 int getAddColumnsLastPage()
           
 int getAddColumnsPage()
           
 int getAddColumnsPageRowCount()
           
 int getAdditionalTotalsCount()
           
 IXTableModel getAllDataTableModel()
          A table model with load all data at once.
 java.util.Map[] getAllKeys()
          An array with the keys (in Map format) of the all rows.
 java.lang.String getBaseCondition()
           
 java.lang.String getBaseConditionForReference()
           
 View getCollectionView()
          If this tab represents a collection the collection view of that collection.
 java.util.Collection getColumnsToAdd()
           
 int getColumnWidth(int columnIndex)
           
 java.lang.String[] getConditionComparators()
           
 java.lang.String[] getConditionValues()
           
 java.lang.String[] getConditionValuesTo()
           
 IFilter getFilter()
          Filter used currently by this tab.
 int getFinalIndex()
           
 int getInitialIndex()
           
 int getLastPage()
           
 java.util.List<MetaProperty> getMetaProperties()
           
 java.util.List getMetaPropertiesNotCalculated()
           
 MetaProperty getMetaProperty(int i)
           
 MetaProperty getMetaProperty(java.lang.String qualifiedName)
           
 java.lang.String getModelName()
           
 java.lang.String getOrderBy()
           
 int getPage()
           
 int getPageRowCount()
           
 java.lang.String getPropertiesNamesAsString()
           
 HttpServletRequest getRequest()
           
 int[] getSelected()
           
 java.util.Map[] getSelectedKeys()
          An array with the keys (in Map format) of the selected rows.
 java.lang.String getStyle(int row)
          The CSS style associated to the specified row.
 java.util.Set<java.lang.String> getSumPropertiesNames()
           
 IXTableModel getTableModel()
          A table model with on-demand data reading.
 java.lang.String getTabName()
           
 java.lang.String getTitle()
           
static java.lang.String getTitleI18n(java.util.Locale locale, java.lang.String modelName, java.lang.String tabName)
           
 java.lang.String getTitleId()
           
 java.lang.Object getTotal(int column)
           
 java.lang.Object getTotal(int row, int column)
           
 java.lang.Object getTotal(java.lang.String qualifiedPropertyName)
           
 java.lang.String getTotalLabel(int row, int column)
           
 java.util.Collection<java.lang.String> getTotalPropertiesNames()
           
 java.lang.String getTotalPropertiesNamesAsString()
           
 int getTotalSize()
           
 void goAddColumnsPage(int page)
           
 void goPage(int page)
          1 is the first page
 boolean hasSelected()
           
 boolean hasTotal(int column)
           
 boolean hasTotal(int row, int column)
           
 void hideRows()
           
 boolean isCustomize()
           
 boolean isCustomizeAllowed()
           
 boolean isFilterVisible()
           
 boolean isFixedTotal(int column)
           
 boolean isIgnorePageRowCount()
           
 boolean isLastPage()
           
 boolean isNotResetNextTime()
           
 boolean isOrderAscending(java.lang.String name)
           
 boolean isOrderAscending2(java.lang.String name)
           
 boolean isOrderDescending(java.lang.String name)
           
 boolean isOrderDescending2(java.lang.String name)
           
 boolean isResizeColumns()
           
 boolean isRowsHidden()
           
 boolean isSelected(int row)
           
 boolean isSortRemainingProperties()
           
 boolean isTitleVisible()
           
 boolean isTotalCapable(int column)
           
 void movePropertyToLeft(int index)
           
 void movePropertyToRight(int index)
           
 void orderBy(java.lang.String property)
           
 void pageBack()
           
 void pageForward()
           
 void removeProperty(int index)
           
 void removeProperty(java.lang.String propertyName)
           
 void removeSumProperty(java.lang.String property)
          Remove total property.
 void reset()
           
 void restoreDefaultProperties()
           
 void setAddColumnsPageRowCount(int addColumnsPageRowCount)
           
 void setAllSelected(int[] values)
          Change all selected.
 void setBaseCondition(java.lang.String condition)
           
 void setBaseConditionForReference(java.lang.String baseConditionForReference)
           
 void setBaseConditionValuesForReference(java.util.Map values)
           
 void setCollectionView(View collectionView)
          If this tab represents a collection the collection view of that collection.
 void setColumnWidth(int columnIndex, int width)
           
 void setConditionValue(java.lang.String property, java.lang.Object value)
           
 void setCustomize(boolean customize)
           
 void setCustomizeAllowed(boolean customizeAllowed)
           
 void setDefaultOrder(java.lang.String defaultOrder)
          Set the default order for this Tab in runtime.
 void setDefaultPropertiesNames(java.lang.String properties)
          The default properties are the initial ones and those to show when the user reset his customizations.
 void setFilter(IFilter filter)
          Sets the filter for this tab in runtime.
 void setFilterVisible(boolean filterVisible)
           
 void setIgnorePageRowCount(boolean ignorePageRowCount)
           
 void setMetaRowStyles(java.util.Collection styles)
           
 void setModelName(java.lang.String newModelName)
           
 void setNotResetNextTime(boolean b)
           
 void setPageRowCount(int pageRowCount)
           
 void setPropertiesNames(java.lang.String propertiesNames)
          Set the properties to be displayed by this Tab in runtime.
 void setReferencesCollection(java.lang.String model, java.lang.String collectionName)
          This is an alternative to setModelName, and is used when this tab represent a collection of references.
 void setRequest(HttpServletRequest request)
           
 void setResizeColumns(boolean resizeColumns)
           
 void setRowsHidden(boolean rowsHidden)
          If you like show or hide rows is better calling to showRows() and hideRows().
 void setSelected(int[] values)
          Change the selected ones only within the current page range.
 void setSelected(java.lang.String[] values)
          Same that #setSelectec(int [] values) but from String [].
 void setSortRemainingProperties(boolean sortRemainingProperties)
           
 void setStyle(int row, java.lang.String style)
          Set the CSS style associated to the specified row.
 void setTableModel(IXTableModel tableModel)
           
 void setTabName(java.lang.String newTabName)
           
 void setTabObject(java.lang.String tabObject)
           
 void setTitleArgument(java.lang.Object v1)
           
 void setTitleArguments(java.lang.Object[] valores)
           
 void setTitleArguments(java.lang.Object v1, java.lang.Object v2)
           
 void setTitleArguments(java.lang.Object v1, java.lang.Object v2, java.lang.Object v3)
           
 void setTitleArguments(java.lang.Object v1, java.lang.Object v2, java.lang.Object v3, java.lang.Object v4)
           
 void setTitleId(java.lang.String titleId)
           
 void setTitleVisible(boolean b)
           
 void showRows()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COLLECTION_PREFIX

public static final java.lang.String COLLECTION_PREFIX
Prefix used for naming (in session) to the tab objects used for collections.

See Also:
Constant Field Values

TAB_RESETED_PREFIX

public static final java.lang.String TAB_RESETED_PREFIX
See Also:
Constant Field Values
Constructor Detail

Tab

public Tab()
Method Detail

getMetaProperties

public java.util.List<MetaProperty> getMetaProperties()

getColumnsToAdd

public java.util.Collection getColumnsToAdd()
                                     throws XavaException
Throws:
XavaException

getMetaPropertiesNotCalculated

public java.util.List getMetaPropertiesNotCalculated()
                                              throws XavaException
Throws:
XavaException

getBaseCondition

public java.lang.String getBaseCondition()
                                  throws XavaException
Throws:
XavaException

setBaseCondition

public void setBaseCondition(java.lang.String condition)
                      throws XavaException
Throws:
XavaException

setReferencesCollection

public void setReferencesCollection(java.lang.String model,
                                    java.lang.String collectionName)
                             throws XavaException
This is an alternative to setModelName, and is used when this tab represent a collection of references.

Throws:
XavaException

setBaseConditionValuesForReference

public void setBaseConditionValuesForReference(java.util.Map values)
                                        throws XavaException
Throws:
XavaException

setDefaultPropertiesNames

public void setDefaultPropertiesNames(java.lang.String properties)
The default properties are the initial ones and those to show when the user reset his customizations.

Since:
4.1

getPropertiesNamesAsString

public java.lang.String getPropertiesNamesAsString()
Returns:
Comma separate list.


getColumnWidth

public int getColumnWidth(int columnIndex)

friendViewGetDefaultColumnWidth

public static int friendViewGetDefaultColumnWidth(MetaProperty p)

setColumnWidth

public void setColumnWidth(int columnIndex,
                           int width)

getMetaProperty

public MetaProperty getMetaProperty(int i)

getMetaProperty

public MetaProperty getMetaProperty(java.lang.String qualifiedName)
Since:
4.3

setMetaRowStyles

public void setMetaRowStyles(java.util.Collection styles)
                      throws XavaException
Throws:
XavaException

getTableModel

public IXTableModel getTableModel()
A table model with on-demand data reading.

Suitable for UI.


getAllDataTableModel

public IXTableModel getAllDataTableModel()
                                  throws java.lang.Exception
A table model with load all data at once.

Suitable for report generation (for example).

Throws:
java.lang.Exception

setTableModel

public void setTableModel(IXTableModel tableModel)

reset

public void reset()

getSelected

public int[] getSelected()

hasSelected

public boolean hasSelected()

setAllSelected

public void setAllSelected(int[] values)
Change all selected.

Postcondition: this.selected == values


deselectVisualizedRows

public void deselectVisualizedRows()

setSelected

public void setSelected(int[] values)
Change the selected ones only within the current page range.

Postcondition this.selected == values is not fulfilled


setSelected

public void setSelected(java.lang.String[] values)
Same that #setSelectec(int [] values) but from String [].


deselectAll

public void deselectAll()

isSelected

public boolean isSelected(int row)

getInitialIndex

public int getInitialIndex()

getFinalIndex

public int getFinalIndex()

isLastPage

public boolean isLastPage()

pageForward

public void pageForward()

isNotResetNextTime

public boolean isNotResetNextTime()

setNotResetNextTime

public void setNotResetNextTime(boolean b)

getLastPage

public int getLastPage()

getAddColumnsLastPage

public int getAddColumnsLastPage()

getAddColumnsPage

public int getAddColumnsPage()

goAddColumnsPage

public void goAddColumnsPage(int page)

pageBack

public void pageBack()

goPage

public void goPage(int page)
1 is the first page

Parameters:
page -

getPage

public int getPage()

getTotalSize

public int getTotalSize()

getConditionValues

public java.lang.String[] getConditionValues()

getConditionValuesTo

public java.lang.String[] getConditionValuesTo()

getConditionComparators

public java.lang.String[] getConditionComparators()

orderBy

public void orderBy(java.lang.String property)

getOrderBy

public java.lang.String getOrderBy()

isOrderAscending

public boolean isOrderAscending(java.lang.String name)

isOrderDescending

public boolean isOrderDescending(java.lang.String name)

isOrderAscending2

public boolean isOrderAscending2(java.lang.String name)

isOrderDescending2

public boolean isOrderDescending2(java.lang.String name)

getModelName

public java.lang.String getModelName()

setModelName

public void setModelName(java.lang.String newModelName)

getTabName

public java.lang.String getTabName()

setTabName

public void setTabName(java.lang.String newTabName)

setRequest

public void setRequest(HttpServletRequest request)

setTabObject

public void setTabObject(java.lang.String tabObject)

getRequest

public HttpServletRequest getRequest()

isTitleVisible

public boolean isTitleVisible()

setTitleVisible

public void setTitleVisible(boolean b)

setTitleArgument

public void setTitleArgument(java.lang.Object v1)

setTitleArguments

public void setTitleArguments(java.lang.Object v1,
                              java.lang.Object v2)

setTitleArguments

public void setTitleArguments(java.lang.Object v1,
                              java.lang.Object v2,
                              java.lang.Object v3)

setTitleArguments

public void setTitleArguments(java.lang.Object v1,
                              java.lang.Object v2,
                              java.lang.Object v3,
                              java.lang.Object v4)

setTitleArguments

public void setTitleArguments(java.lang.Object[] valores)

getTitle

public java.lang.String getTitle()
                          throws XavaException
Throws:
XavaException

getTitleI18n

public static java.lang.String getTitleI18n(java.util.Locale locale,
                                            java.lang.String modelName,
                                            java.lang.String tabName)
                                     throws XavaException
Throws:
XavaException

getBaseConditionForReference

public java.lang.String getBaseConditionForReference()

setBaseConditionForReference

public void setBaseConditionForReference(java.lang.String baseConditionForReference)

addProperty

public void addProperty(java.lang.String propertyName)
                 throws XavaException
Throws:
XavaException

addProperty

public void addProperty(int index,
                        java.lang.String propertyName)
                 throws XavaException
Throws:
XavaException

addProperties

public void addProperties(java.util.Collection properties)
                   throws XavaException
Throws:
XavaException

removeProperty

public void removeProperty(java.lang.String propertyName)
                    throws XavaException
Throws:
XavaException

removeProperty

public void removeProperty(int index)
                    throws XavaException
Throws:
XavaException

movePropertyToRight

public void movePropertyToRight(int index)
                         throws XavaException
Throws:
XavaException

movePropertyToLeft

public void movePropertyToLeft(int index)
                        throws XavaException
Throws:
XavaException

clearProperties

public void clearProperties()
                     throws XavaException
Throws:
XavaException

restoreDefaultProperties

public void restoreDefaultProperties()
                              throws XavaException
Throws:
XavaException

isCustomizeAllowed

public boolean isCustomizeAllowed()
Since:
4m5

setCustomizeAllowed

public void setCustomizeAllowed(boolean customizeAllowed)
Since:
4m5

isResizeColumns

public boolean isResizeColumns()
Since:
4m5

setResizeColumns

public void setResizeColumns(boolean resizeColumns)
Since:
4m5

isCustomize

public boolean isCustomize()

setCustomize

public void setCustomize(boolean customize)

getTitleId

public java.lang.String getTitleId()

setTitleId

public void setTitleId(java.lang.String titleId)

getStyle

public java.lang.String getStyle(int row)
The CSS style associated to the specified row.

Returns:
A string with the CSS style suitable to use in a 'class' attribute in HTML.

setStyle

public void setStyle(int row,
                     java.lang.String style)
Set the CSS style associated to the specified row.

Parameters:
row - Row number affected by this style.
style - A string with the CSS style suitable to use in a 'class' attribute in HTML.

clearStyle

public void clearStyle()
Clear the effect of all calls to setStyle(int, String)


isSortRemainingProperties

public boolean isSortRemainingProperties()

setSortRemainingProperties

public void setSortRemainingProperties(boolean sortRemainingProperties)

getSelectedKeys

public java.util.Map[] getSelectedKeys()
An array with the keys (in Map format) of the selected rows.

Returns:
Never null

getAllKeys

public java.util.Map[] getAllKeys()
An array with the keys (in Map format) of the all rows.

Returns:
Never null

hideRows

public void hideRows()

showRows

public void showRows()

isRowsHidden

public boolean isRowsHidden()

setRowsHidden

public void setRowsHidden(boolean rowsHidden)
If you like show or hide rows is better calling to showRows() and hideRows().


getPageRowCount

public int getPageRowCount()

setPageRowCount

public void setPageRowCount(int pageRowCount)

getFilter

public IFilter getFilter()
                  throws XavaException
Filter used currently by this tab.

By default the filter is the defined one in the <tab/> of the component or using the filter attribute of @Tab annotation.
But, it's possible to assign in runtime other filter using the setFilter(IFilter) method.

Returns:
Can be null.
Throws:
XavaException

setFilter

public void setFilter(IFilter filter)
Sets the filter for this tab in runtime.

This override the filter defined using <tab> or @Tab.


setPropertiesNames

public void setPropertiesNames(java.lang.String propertiesNames)
                        throws XavaException
Set the properties to be displayed by this Tab in runtime.

This override the properties defined using <tab> or @Tab.

Throws:
XavaException

setDefaultOrder

public void setDefaultOrder(java.lang.String defaultOrder)
                     throws XavaException
Set the default order for this Tab in runtime.

This override the default order defined using <tab> or @Tab.

Throws:
XavaException

getCollectionView

public View getCollectionView()
If this tab represents a collection the collection view of that collection.

If this tab does not represents a collection collectionView will be null.


setCollectionView

public void setCollectionView(View collectionView)
If this tab represents a collection the collection view of that collection.

If this tab does not represents a collection collectionView will be null.


isFilterVisible

public boolean isFilterVisible()

setFilterVisible

public void setFilterVisible(boolean filterVisible)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAddColumnsPageRowCount

public int getAddColumnsPageRowCount()

setAddColumnsPageRowCount

public void setAddColumnsPageRowCount(int addColumnsPageRowCount)

clearSelected

public void clearSelected()

setConditionValue

public void setConditionValue(java.lang.String property,
                              java.lang.Object value)
Since:
4m6

hasTotal

public boolean hasTotal(int column)
Since:
4.1

hasTotal

public boolean hasTotal(int row,
                        int column)
Since:
4.3

addSumProperty

public void addSumProperty(java.lang.String property)
Add total property.

It was created in v4.1 with the name addTotalProperty()

Since:
4.3

removeSumProperty

public void removeSumProperty(java.lang.String property)
Remove total property.

It was created in v4.1 with the name removeTotalProperty()

Since:
4.1

getSumPropertiesNames

public java.util.Set<java.lang.String> getSumPropertiesNames()
Since:
4.3

getTotalPropertiesNames

public java.util.Collection<java.lang.String> getTotalPropertiesNames()
Since:
4.1

isTotalCapable

public boolean isTotalCapable(int column)
Since:
4.1

isFixedTotal

public boolean isFixedTotal(int column)
Since:
4.3

getTotal

public java.lang.Object getTotal(int column)
Since:
4.1

getTotal

public java.lang.Object getTotal(int row,
                                 int column)
Since:
4.3

getTotalLabel

public java.lang.String getTotalLabel(int row,
                                      int column)
Since:
4.3

getTotal

public java.lang.Object getTotal(java.lang.String qualifiedPropertyName)
Since:
4.1

getAdditionalTotalsCount

public int getAdditionalTotalsCount()
Since:
4.3

getTotalPropertiesNamesAsString

public java.lang.String getTotalPropertiesNamesAsString()
Since:
4.1

setIgnorePageRowCount

public void setIgnorePageRowCount(boolean ignorePageRowCount)

isIgnorePageRowCount

public boolean isIgnorePageRowCount()