Class Tab

java.lang.Object
org.openxava.tab.Tab
All Implemented Interfaces:
Serializable, Cloneable

public class Tab extends Object implements Serializable, Cloneable
Session object to work with tabular data.

Author:
Javier Paniza, Ana Andrés, Trifon Trifonov, Chungyen Tsai
See Also:
  • Field Details

  • Constructor Details

    • Tab

      public Tab()
    • Tab

      public Tab(boolean cancelSavingPreferences)
      Creates a tab that will not save the preferences values.
      Parameters:
      cancelSavingPreferences - If the parameter is true, no preferences are stored.
  • Method Details

    • setRefiner

      public static void setRefiner(Object newRefiner)
    • getMetaProperties

      public List<MetaProperty> getMetaProperties()
    • isColumnsToAddUntilSecondLevel

      public boolean isColumnsToAddUntilSecondLevel()
      Since:
      5.2
    • setColumnsToAddUntilSecondLevel

      public void setColumnsToAddUntilSecondLevel(boolean columnsToAddUntilSecondLevel)
      Since:
      5.2
    • getColumnsToAdd

      public Collection getColumnsToAdd() throws XavaException
      Throws:
      XavaException
    • getMetaPropertiesNotCalculated

      public List<MetaProperty> getMetaPropertiesNotCalculated() throws XavaException
      Throws:
      XavaException
    • getBaseCondition

      public String getBaseCondition() throws XavaException
      Throws:
      XavaException
    • setBaseCondition

      public void setBaseCondition(String condition) throws XavaException
      Throws:
      XavaException
    • setReferencesCollection

      public void setReferencesCollection(String model, 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(Map values) throws XavaException
      Throws:
      XavaException
    • getMetaTab

      public MetaTab getMetaTab() throws XavaException
      Throws:
      XavaException
    • setDefaultPropertiesNames

      public void setDefaultPropertiesNames(String properties)
      The default properties are the initial ones and those to show when the user reset his customizations.
      Since:
      4.1
    • getPropertiesNamesAsString

      public String getPropertiesNamesAsString()
      Returns:
      Comma separate list.

    • getColumnWidth

      public int getColumnWidth(int columnIndex)
    • setColumnWidth

      public void setColumnWidth(int columnIndex, int width)
    • getMetaProperty

      public MetaProperty getMetaProperty(int i)
    • getMetaProperty

      public MetaProperty getMetaProperty(String qualifiedName)
      Since:
      4.3
    • containsProperty

      public boolean containsProperty(String qualifiedName)
      Since:
      5.9
    • setMetaRowStyles

      public void setMetaRowStyles(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 Exception
      A table model with load all data at once.

      Suitable for report generation (for example).

      Throws:
      Exception
    • setTableModel

      public void setTableModel(IXTableModel tableModel)
    • reset

      public void reset()
    • getSelected

      public int[] getSelected()
      Deprecated.
      use getSelectedKeys
      index of selected rows in the range of load rows Deprecated since 4.7
    • hasSelected

      public boolean hasSelected()
    • setAllSelectedKeys

      public void setAllSelectedKeys(Map[] values)
    • setAllSelected

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

      Deprecated since 4.7

    • deselect

      public void deselect(int row)
    • friendExecuteJspDeselect

      public void friendExecuteJspDeselect(String deselect)
      Parameters:
      deselect - as 'ox_OpenXavaTest_Color__xava_tab:4,3,1'
    • deselect

      public void deselect(Map key)
    • setSelected

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

      Postcondition this.selectedKey == values is not fulfilled

    • setSelected

      public void setSelected(String[] values)
      Same that setSelected(int [] values) but from String [].

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

      public void clearCondition()
      Since:
      4.7.1
    • setConditionValues

      public void setConditionValues(Collection<String> values) throws XavaException
      Throws:
      XavaException
      Since:
      4.6
    • setConditionComparators

      public void setConditionComparators(Collection<String> comparators) throws XavaException
      Throws:
      XavaException
      Since:
      4.6
    • getConditionValues

      public String[] getConditionValues()
    • getConditionValuesTo

      public String[] getConditionValuesTo()
    • getConditionComparators

      public String[] getConditionComparators()
    • groupBy

      public void groupBy(String property)
    • getGroupBy

      public String getGroupBy()
    • getMetaPropertiesGroupBy

      public Collection<MetaProperty> getMetaPropertiesGroupBy()
    • orderBy

      public void orderBy(String property)
    • getOrderBy

      public String getOrderBy()
    • isOrderAscending

      public boolean isOrderAscending(String name)
    • isOrderDescending

      public boolean isOrderDescending(String name)
    • isOrderAscending2

      public boolean isOrderAscending2(String name)
    • isOrderDescending2

      public boolean isOrderDescending2(String name)
    • getModelName

      public String getModelName()
    • setModelName

      public void setModelName(String newModelName)
    • reloadMetaModel

      public void reloadMetaModel()
      Since:
      5.6
    • getTabName

      public String getTabName()
    • setTabName

      public void setTabName(String newTabName)
    • setRequest

      public void setRequest(javax.servlet.http.HttpServletRequest request)
    • setModuleManager

      public void setModuleManager(ModuleManager moduleManager)
      Since:
      7.7
    • filter

      public void filter()
      Since:
      5.9
    • filterByContentInAnyProperty

      public void filterByContentInAnyProperty(String content)
      Filter using like in any column.

      It does not work for Tab used for collections.

      Since:
      7.4.5
    • setConditionParameters

      public void setConditionParameters()
      Since:
      5.9
    • setTabObject

      public void setTabObject(String tabObject)
    • getPreferencesNodeName

      public String getPreferencesNodeName(String prefix)
    • getRequest

      public javax.servlet.http.HttpServletRequest getRequest()
    • isTitleVisible

      public boolean isTitleVisible()
    • setTitleVisible

      public void setTitleVisible(boolean b)
    • setTitleArgument

      public void setTitleArgument(Object v1)
    • setTitleArguments

      public void setTitleArguments(Object v1, Object v2)
    • setTitleArguments

      public void setTitleArguments(Object v1, Object v2, Object v3)
    • setTitleArguments

      public void setTitleArguments(Object v1, Object v2, Object v3, Object v4)
    • setTitleArguments

      public void setTitleArguments(Object[] valores)
    • createConfiguration

      public void createConfiguration()
      Since:
      6.5
    • saveConfiguration

      public void saveConfiguration()
    • getConfigurationsCount

      public int getConfigurationsCount()
      Since:
      6.5
    • getConfigurations

      public Collection<Tab.Configuration> getConfigurations()
    • setConfigurationId

      public void setConfigurationId(int configurationId)
    • setConfigurationName

      public void setConfigurationName(String newName)
    • removeConfiguration

      public void removeConfiguration() throws Exception
      Throws:
      Exception
      Since:
      5.7
    • getTitle

      public String getTitle() throws XavaException
      Throws:
      XavaException
    • getConfigurationName

      public String getConfigurationName() throws XavaException
      Throws:
      XavaException
    • isAllConfiguration

      public boolean isAllConfiguration()
      Since:
      6.5
    • setTitle

      public void setTitle(String title)
      Set the specific title as is.

      This title is used in list mode if the title is visible and as title for reports.
      If you want to use an i18n title use setTitleId(String titleId) instead.

      Since:
      4.6
    • getTitleI18n

      public static String getTitleI18n(Locale locale, String modelName, String tabName) throws XavaException
      Throws:
      XavaException
    • getBaseConditionForReference

      public String getBaseConditionForReference()
    • setBaseConditionForReference

      public void setBaseConditionForReference(String baseConditionForReference)
    • addProperty

      public void addProperty(String propertyName) throws XavaException
      Throws:
      XavaException
    • addProperty

      public void addProperty(int index, String propertyName) throws XavaException
      Throws:
      XavaException
    • addProperties

      public void addProperties(List<String> propertiesName, String[] conditionValues, String[] conditionValuesTo, String[] conditionComparators) throws XavaException
      Add properties without using old configuration.
      Throws:
      XavaException
      Since:
      7.1
    • addProperties

      public void addProperties(Collection properties) throws XavaException
      Throws:
      XavaException
    • setLabel

      public void setLabel(String propertyName, String label)
      Parameters:
      propertyName -
      label -
      Since:
      4.8
    • removeProperty

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

      public void removeProperty(String propertyName) throws XavaException
      Throws:
      XavaException
    • moveProperty

      public void moveProperty(int from, int to)
      Since:
      5.2
    • restoreDefaultProperties

      public void restoreDefaultProperties() throws XavaException
      Throws:
      XavaException
    • clearProperties

      public void clearProperties() 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
    • getTitleId

      public String getTitleId()
    • setTitleId

      public void setTitleId(String titleId)
      Set the title from an i18n id.

      This title is used in list mode if the title is visible and as title for reports.

    • getStyle

      public 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, 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)
    • getSelectedKeys

      public Map[] getSelectedKeys()
    • getAllKeys

      public 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(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(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 String toString()
      Overrides:
      toString in class Object
    • deselectAll

      public void deselectAll()
    • clearSelected

      public void clearSelected()
      Deprecated.
      Since v4.7, use deselectAll() instead
    • setConditionValue

      public void setConditionValue(String property, Object value)
      Since:
      4m6
    • hasTotal

      public boolean hasTotal(int column)
      Since:
      4.1
    • hasTotal

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

      public boolean isTotalEditable(int row, int column)
      Since:
      5.9
    • addSumProperty

      public void addSumProperty(String property)
      Add total property.

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

      Since:
      4.3
    • removeSumProperty

      public void removeSumProperty(String property)
      Remove total property.

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

      Since:
      4.1
    • getSumPropertiesNames

      public Set<String> getSumPropertiesNames()
      Since:
      4.3
    • getTotalPropertiesNames

      public Collection<String> getTotalPropertiesNames()
      Since:
      4.1
    • isTotalCapable

      public boolean isTotalCapable(int column)
      Since:
      4.1
    • isTotalCapable

      public boolean isTotalCapable(MetaProperty p)
      Since:
      4.8
    • isOrderCapable

      public boolean isOrderCapable(MetaProperty p)
      Since:
      6.4
    • isFromCollection

      public boolean isFromCollection(MetaProperty p)
      Since:
      6.4
    • isFixedTotal

      public boolean isFixedTotal(int column)
      Since:
      4.3
    • getTotal

      public Object getTotal(int column)
      Since:
      4.1
    • getTotal

      public Object getTotal(int row, int column)
      Since:
      4.3
    • getTotalLabel

      public String getTotalLabel(int row, int column)
      Since:
      4.3
    • getTotalPropertyName

      public String getTotalPropertyName(int row, int column)
      Since:
      5.9
    • getTotal

      public Object getTotal(String qualifiedPropertyName)
      Since:
      4.1
    • getAdditionalTotalsCount

      public int getAdditionalTotalsCount()
      Since:
      4.3
    • setIgnorePageRowCount

      public void setIgnorePageRowCount(boolean ignorePageRowCount)
    • isIgnorePageRowCount

      public boolean isIgnorePageRowCount()
    • cutOutRow

      public void cutOutRow(Map keyValues) throws XavaException
      Throws:
      XavaException
    • getErrors

      public Messages getErrors()
    • setErrors

      public void setErrors(Messages errors)
    • getEditor

      public String getEditor()
    • setEditor

      public void setEditor(String editor)
    • clone

      public Tab clone()
      Overrides:
      clone in class Object
      Since:
      5.9
    • isSaveConfigurationAllowed

      public boolean isSaveConfigurationAllowed()
      Since:
      6.5
    • isOptimizeChunkSize

      public boolean isOptimizeChunkSize()
    • setOptimizeChunkSize

      public void setOptimizeChunkSize(boolean optimizeChunkSize)
    • getMessages

      public Messages getMessages()
    • setMessages

      public void setMessages(Messages messages)
    • isPropertyEditable

      public boolean isPropertyEditable(String propertyName)
      Checks if a property is in the editable properties list. Delegates to the MetaTab implementation.
      Parameters:
      propertyName - The name of the property to check
      Returns:
      true if the property is editable, false otherwise
      Since:
      7.6