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.
 int oid
           
 
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 clearProperties()
           
 void clearStyle()
          Clear the effect of all calls to setStyle(int, String)
 void deselectAll()
           
 void deselectVisualizedRows()
           
 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.lang.String[] getConditionComparators()
           
 java.lang.String[] getConditionValues()
           
 IFilter getFilter()
          Filter used currently by this tab.
 int getFinalIndex()
           
 int getInitialIndex()
           
 int getLastPage()
           
 java.util.List getMetaProperties()
           
 java.util.List getMetaPropertiesNotCalculated()
           
 MetaProperty getMetaProperty(int i)
           
 java.lang.String getModelName()
           
 java.lang.String getOrderBy()
           
 int getPage()
           
 int getPageRowCount()
           
 java.lang.String getPropertiesNamesAsString()
           
 java.util.Collection getRemainingPropertiesNames()
           
 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.
 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()
           
 int getTotalSize()
           
 void goPage(int page)
          1 is the first page
 boolean hasSelected()
           
 void hideRows()
           
 boolean isCustomize()
           
 boolean isFilterVisible()
           
 boolean isLastPage()
           
 boolean isNotResetNextTime()
           
 boolean isOrderAscending(java.lang.String name)
           
 boolean isOrderDescending(java.lang.String name)
           
 boolean isRowsHidden()
           
 boolean isSelected(int row)
           
 boolean isSortRemainingProperties()
           
 boolean isTitleVisible()
           
 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 reset()
           
 void restoreDefaultProperties()
           
 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 setCustomize(boolean customize)
           
 void setDefaultOrder(java.lang.String defaultOrder)
          Set the default order for this Tab in runtime.
 void setFilter(IFilter filter)
          Sets the filter for this tab in runtime.
 void setFilterVisible(boolean filterVisible)
           
 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 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 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

oid

public int oid
Constructor Detail

Tab

public Tab()
Method Detail

getMetaProperties

public java.util.List getMetaProperties()

getRemainingPropertiesNames

public java.util.Collection getRemainingPropertiesNames()
                                                 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

getPropertiesNamesAsString

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


getMetaProperty

public MetaProperty getMetaProperty(int i)

setMetaRowStyles

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

getTableModel

public IXTableModel getTableModel()
                           throws java.lang.Exception
A table model with on-demand data reading.

Suitable for UI.

Throws:
java.lang.Exception

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()

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()

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)

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)

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

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