JIDE 3.5.15

com.jidesoft.grid
Class Field

java.lang.Object
  extended by com.jidesoft.grid.Field
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
PivotField

public class Field
extends Object
implements Serializable

A class representing a column in the table model.

See Also:
Serialized Form

Field Summary
protected  ConverterContext _converterContext
           
protected  EditorContext _editorContext
           
protected  boolean _isConverterContextSet
           
protected  boolean _isEditorContextSet
           
protected  int _modelIndex
           
protected  int _sortOrder
           
protected  TableModel _tableModel
           
protected  PropertyChangeSupport changeSupport
           
static String PROPERTY_ASCENDING
           
static String PROPERTY_CONVERTER_CONTEXT
           
static String PROPERTY_CUSTOMIZABLE
           
static String PROPERTY_DESCRIPTION
           
static String PROPERTY_DESELECTED_POSSIBLE_VALUES
           
static String PROPERTY_EDITOR_CONTEXT
           
static String PROPERTY_EXPANDABLE
           
static String PROPERTY_FILTER
           
static String PROPERTY_FILTERABLE
           
static String PROPERTY_ICON
           
static String PROPERTY_NAME
           
static String PROPERTY_PREFER_SELECTED_VALUES
           
static String PROPERTY_SELECTED_POSSIBLE_VALUES
           
static String PROPERTY_SORT_ORDER
           
static String PROPERTY_SORTABLE
           
static String PROPERTY_TITLE
           
static String PROPERTY_TYPE
           
static String PROPERTY_VISIBLE
           
static int SORT_ORDER_ASCENDING
           
static int SORT_ORDER_DESCENDING
           
static int SORT_ORDER_UNSORTED
           
 
Constructor Summary
Field()
           
Field(String name)
           
Field(String name, Class<?> type)
           
Field(String name, String title, Class<?> type)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list for a specific property.
protected  void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
          Support for reporting bound property changes for boolean properties.
protected  void firePropertyChange(String propertyName, int oldValue, int newValue)
          Support for reporting bound property changes for integer properties.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Support for reporting bound property changes for Object properties.
 Filter getActualFilter()
          Gets the actual filter that is in effect.
 ComparatorContext getComparatorContext()
          Gets the comparator context.
 ConverterContext getConverterContext()
           
 String getDescription()
           
 EditorContext getEditorContext()
           
 Filter getFilter()
          Gets the Filter that will be applied to the PivotDataSource.
 Object[] getFilteredPossibleValues()
          Returns the filtered possible values of the field.
 Icon getIcon()
          Gets the icon.
 int getModelIndex()
          Gets the column index in the table model.
 String getName()
           
 int getPreferredWidth()
          Gets the preferred width.
 PropertyChangeListener[] getPropertyChangeListeners()
          Returns an array of all the property change listeners registered on this component.
 PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Returns an array of all the listeners which have been associated with the named property.
 Object[] getSelectedPossibleValues()
          Returns the selected possible values of the field.
 int getSortOrder()
          Gets the field sort order.
 TableModel getTableModel()
          Gets the table model.
 String getTitle()
           
 Class<?> getType()
           
 boolean isAscending()
          Gets the sort order.
 boolean isCustomFilterAllowed()
          Checks if the custom filter is allowed in the drop down list.
 boolean isCustomizable()
          Checks if the field settings can be customized by end users.
 boolean isDuplicated()
          Gets the flag indicating if this field is duplicated from another field.
 boolean isExpandable()
          Checks if the field can be expanded in the header tables.
 boolean isFilterable()
          Checks if the field can be filtered.
 boolean isNullValueAllowed()
          Checks if null value is allowed in the filter.
 boolean isPreferSelectedPossibleValues()
          Get the flag indicating if selected possible values will be used or filtered possible values.
 boolean isSortable()
          Checks if the field can be sorted by the user.
 boolean isVisible()
          Checks if the field is visible.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list for a specific property.
 void setAscending(boolean ascending)
          Sets the sort order.
 void setComparatorContext(ComparatorContext comparatorContext)
          Sets the comparator context.
 void setConverterContext(ConverterContext converterContext)
           
 void setCustomFilterAllowed(boolean isCustomFilterAllowed)
          Sets the flag if the custom filter is allowed.
 void setCustomizable(boolean customizable)
          Sets the flag if the field settings can be customized by end users.
 void setDescription(String description)
           
 void setDuplicated(boolean duplicated)
          Sets the flag indicating if this field is duplicated from another field.
 void setEditorContext(EditorContext editorContext)
           
 void setExpandable(boolean expandable)
          Sets the flag if the field can be expanded in the header tables.
 void setFilter(Filter filter)
          Sets the Filter that will be applied to the PivotDataSource.
 void setFilterable(boolean filterable)
          Sets the flag if the field can be filtered.
 void setFilteredPossibleValues(Object[] filteredPossibleValues)
          Sets the filtered possible values for this field.
 void setIcon(Icon icon)
          Sets the icon.
 void setName(String name)
           
 void setNullValueAllowed(boolean nullValueAllowed)
          Sets if the null value is allowed.
 void setPreferredWidth(int preferredWidth)
          Sets the preferred width.
 void setPreferSelectedPossibleValues(boolean preferSelectedPossibleValues)
          Set the flag indicating if selected possible values will be used or filtered possible values.
 void setSelectedPossibleValues(Object[] selectedPossibleValues)
          Sets the selected possible values for this field.
 void setSortable(boolean sortable)
          Sets the flag if the field can be sorted by the user.
 void setSortOrder(int sortOrder)
          Sets the sort order.
 void setTitle(String title)
           
 void setType(Class<?> type)
           
 void setVisible(boolean visible)
          Sets the flag if the field is visible.
 void toggleAscending()
          Toggles the sort order.
 void updateFromTableModel(TableModel tableModel, int modelIndex)
          Updates the table model and model index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_converterContext

protected ConverterContext _converterContext

_editorContext

protected EditorContext _editorContext

_sortOrder

protected int _sortOrder

SORT_ORDER_ASCENDING

public static final int SORT_ORDER_ASCENDING
See Also:
Constant Field Values

SORT_ORDER_DESCENDING

public static final int SORT_ORDER_DESCENDING
See Also:
Constant Field Values

SORT_ORDER_UNSORTED

public static final int SORT_ORDER_UNSORTED
See Also:
Constant Field Values

PROPERTY_NAME

public static final String PROPERTY_NAME
See Also:
Constant Field Values

PROPERTY_TITLE

public static final String PROPERTY_TITLE
See Also:
Constant Field Values

PROPERTY_DESCRIPTION

public static final String PROPERTY_DESCRIPTION
See Also:
Constant Field Values

PROPERTY_ICON

public static final String PROPERTY_ICON
See Also:
Constant Field Values

PROPERTY_TYPE

public static final String PROPERTY_TYPE
See Also:
Constant Field Values

PROPERTY_CONVERTER_CONTEXT

public static final String PROPERTY_CONVERTER_CONTEXT
See Also:
Constant Field Values

PROPERTY_EDITOR_CONTEXT

public static final String PROPERTY_EDITOR_CONTEXT
See Also:
Constant Field Values

PROPERTY_FILTERABLE

public static final String PROPERTY_FILTERABLE
See Also:
Constant Field Values

PROPERTY_SORTABLE

public static final String PROPERTY_SORTABLE
See Also:
Constant Field Values

PROPERTY_EXPANDABLE

public static final String PROPERTY_EXPANDABLE
See Also:
Constant Field Values

PROPERTY_VISIBLE

public static final String PROPERTY_VISIBLE
See Also:
Constant Field Values

PROPERTY_CUSTOMIZABLE

public static final String PROPERTY_CUSTOMIZABLE
See Also:
Constant Field Values

PROPERTY_SELECTED_POSSIBLE_VALUES

public static final String PROPERTY_SELECTED_POSSIBLE_VALUES
See Also:
Constant Field Values

PROPERTY_DESELECTED_POSSIBLE_VALUES

public static final String PROPERTY_DESELECTED_POSSIBLE_VALUES
See Also:
Constant Field Values

PROPERTY_FILTER

public static final String PROPERTY_FILTER
See Also:
Constant Field Values

PROPERTY_SORT_ORDER

public static final String PROPERTY_SORT_ORDER
See Also:
Constant Field Values

PROPERTY_PREFER_SELECTED_VALUES

public static final String PROPERTY_PREFER_SELECTED_VALUES
See Also:
Constant Field Values

changeSupport

protected PropertyChangeSupport changeSupport

_tableModel

protected TableModel _tableModel

_modelIndex

protected int _modelIndex

_isConverterContextSet

protected boolean _isConverterContextSet

_isEditorContextSet

protected boolean _isEditorContextSet

PROPERTY_ASCENDING

public static final String PROPERTY_ASCENDING
See Also:
Constant Field Values
Constructor Detail

Field

public Field()

Field

public Field(String name)

Field

public Field(String name,
             Class<?> type)

Field

public Field(String name,
             String title,
             Class<?> type)
Method Detail

getName

public String getName()

setName

public void setName(String name)

getTitle

public String getTitle()

setTitle

public void setTitle(String title)

getDescription

public String getDescription()

setDescription

public void setDescription(String description)

getIcon

public Icon getIcon()
Gets the icon. The icon is displayed before the title in the pivot table's field areas.

Returns:
the icon.

setIcon

public void setIcon(Icon icon)
Sets the icon.

This is a bounded property. Property change event will be fired if the icon is changed.

Parameters:
icon - the new icon

getType

public Class<?> getType()

setType

public void setType(Class<?> type)

getConverterContext

public ConverterContext getConverterContext()

setConverterContext

public void setConverterContext(ConverterContext converterContext)

getEditorContext

public EditorContext getEditorContext()

setEditorContext

public void setEditorContext(EditorContext editorContext)

getComparatorContext

public ComparatorContext getComparatorContext()
Gets the comparator context. Default is null. You need to call setComparatorContext to set one if you want to use a different comparator for this PivotField which will be used by pivot table to sort.

Returns:
the comparator context.

setComparatorContext

public void setComparatorContext(ComparatorContext comparatorContext)
Sets the comparator context.

Parameters:
comparatorContext - the comparator context.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.

Parameters:
listener - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(), addPropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.

If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(), removePropertyChangeListener(String,java.beans.PropertyChangeListener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component.

Returns:
all of this component's PropertyChangeListeners or an empty array if no property change listeners are currently registered
Since:
1.4
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(String), PropertyChangeSupport.getPropertyChangeListeners()

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.

Parameters:
propertyName - one of the property names listed above
listener - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(String,java.beans.PropertyChangeListener), getPropertyChangeListeners(String), addPropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific bound property.

If listener is null, no exception is thrown and no action is performed.

Parameters:
propertyName - a valid property name
listener - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(String,java.beans.PropertyChangeListener), getPropertyChangeListeners(String), removePropertyChangeListener(java.beans.PropertyChangeListener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property.

Parameters:
propertyName - the property name.
Returns:
all of the PropertyChangeListeners associated with the named property or an empty array if no listeners have been added
See Also:
addPropertyChangeListener(String,java.beans.PropertyChangeListener), removePropertyChangeListener(String,java.beans.PropertyChangeListener), getPropertyChangeListeners()

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
Support for reporting bound property changes for Object properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  boolean oldValue,
                                  boolean newValue)
Support for reporting bound property changes for boolean properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  int oldValue,
                                  int newValue)
Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

getPreferredWidth

public int getPreferredWidth()
Gets the preferred width.

Returns:
the preferred width.

setPreferredWidth

public void setPreferredWidth(int preferredWidth)
Sets the preferred width.

Parameters:
preferredWidth - the new preferred width.

setSelectedPossibleValues

public void setSelectedPossibleValues(Object[] selectedPossibleValues)
Sets the selected possible values for this field.

Sets this field will invoke setFilteredPossibleValues(Object[]) to set that field to null.

Parameters:
selectedPossibleValues - new selected possible values.

getSelectedPossibleValues

public Object[] getSelectedPossibleValues()
Returns the selected possible values of the field. This is used to filter the table model. It returns null if "(All)" is selected, empty array if nothing is selected and otherwise the selected values.

Returns:
the selected possible values.

setFilteredPossibleValues

public void setFilteredPossibleValues(Object[] filteredPossibleValues)
Sets the filtered possible values for this field.

Sets this field will invoke setSelectedPossibleValues(Object[]) to set that field to null.

Parameters:
filteredPossibleValues - new filtered possible values.

getFilteredPossibleValues

public Object[] getFilteredPossibleValues()
Returns the filtered possible values of the field. This is used to filter the table model. It returns null if "(All)" is selected, otherwise the filtered values.

Returns:
the filtered possible values.

isPreferSelectedPossibleValues

public boolean isPreferSelectedPossibleValues()
Get the flag indicating if selected possible values will be used or filtered possible values.

The default value is changed to false. In this way, if you input a new record to the PivotTablePane, the new record will stay. If you want the new record to be filtered away, please try to set this flag to true.

Returns:
true if the selected possible values will be used. Otherwise false.
See Also:
setSelectedPossibleValues(Object[]), setFilteredPossibleValues(Object[])

setPreferSelectedPossibleValues

public void setPreferSelectedPossibleValues(boolean preferSelectedPossibleValues)
Set the flag indicating if selected possible values will be used or filtered possible values.

Parameters:
preferSelectedPossibleValues - the flag
See Also:
isPreferSelectedPossibleValues()

isNullValueAllowed

public boolean isNullValueAllowed()
Checks if null value is allowed in the filter.

Returns:
true or false.

setNullValueAllowed

public void setNullValueAllowed(boolean nullValueAllowed)
Sets if the null value is allowed. If true, an "" row will appear in the drop down list of the field. Otherwise, we will not show it.

Parameters:
nullValueAllowed - true or false.

isCustomFilterAllowed

public boolean isCustomFilterAllowed()
Checks if the custom filter is allowed in the drop down list.

Returns:
true or false.

setCustomFilterAllowed

public void setCustomFilterAllowed(boolean isCustomFilterAllowed)
Sets the flag if the custom filter is allowed. If true, an "" row will appear in the drop down list of the field. Otherwise, we will not show it.

Parameters:
isCustomFilterAllowed - true or false.

isCustomizable

public boolean isCustomizable()
Checks if the field settings can be customized by end users. If true, it means user can right click to see "Field Settings" menu item on the popup menu. Clicking on it will show a dialog to allow them to customize the setting of this field.

Returns:
true if the field settings can be customized by end user.

setCustomizable

public void setCustomizable(boolean customizable)
Sets the flag if the field settings can be customized by end users. If true, it means user can right click to see "Field Settings" menu item on the popup menu. Clicking on it will show a dialog to allow them to customize the setting of this field.

Parameters:
customizable - true or false.

isFilterable

public boolean isFilterable()
Checks if the field can be filtered. If true, it means a filter button will be shown on the field box to allow user to select the value to be filtered.

Returns:
true or false.

setFilterable

public void setFilterable(boolean filterable)
Sets the flag if the field can be filtered. If true, it means a filter button will be shown on the field box to allow user to select the value to be filtered.

Parameters:
filterable - true or false.

isExpandable

public boolean isExpandable()
Checks if the field can be expanded in the header tables. If true, it means a +/- icon will be displayed in the cell to allow user to click on it to expand/collapse it.

Returns:
true or false.

setExpandable

public void setExpandable(boolean expandable)
Sets the flag if the field can be expanded in the header tables. If true, it means a +/- icon will be displayed in the cell to allow user to click on it to expand/collapse it.

Parameters:
expandable - true or false.

isSortable

public boolean isSortable()
Checks if the field can be sorted by the user. If true, it means user can click on the field to toggle the sorting order. If false, user will not be able to do it. However developer can still set the sort order to ascending or descending using code.

Returns:
true or false.

setSortable

public void setSortable(boolean sortable)
Sets the flag if the field can be sorted by the user. If true, it means user can click on the field to toggle the sorting order. If false, user will not be able to do it. However developer can still set the sort order to ascending or descending using code.

Parameters:
sortable - true or false.

isVisible

public boolean isVisible()
Checks if the field is visible. If true, it means the field will appear in filter chooser is unassigned.

Returns:
true or false.

setVisible

public void setVisible(boolean visible)
Sets the flag if the field is visible. If true, it means the field will appear in filter chooser is unassigned.

Parameters:
visible - true or false.

getActualFilter

public Filter getActualFilter()
Gets the actual filter that is in effect. This method will consider getFilter(), getSelectedPossibleValues() and getFilteredPossibleValues() to construct a filter that is in effect.

Returns:
the filter in effect.
Since:
3.4.8

getFilter

public Filter getFilter()
Gets the Filter that will be applied to the PivotDataSource.

Returns:
the Filter.

setFilter

public void setFilter(Filter filter)
Sets the Filter that will be applied to the PivotDataSource.

Parameters:
filter - the Filter.

getSortOrder

public int getSortOrder()
Gets the field sort order.

Returns:
true or false.

setSortOrder

public void setSortOrder(int sortOrder)
Sets the sort order.

Parameters:
sortOrder - the sort order. It can be SORT_ORDER_ASCENDING, SORT_ORDER_DESCENDING, or SORT_ORDER_UNSORTED.

updateFromTableModel

public void updateFromTableModel(TableModel tableModel,
                                 int modelIndex)
Updates the table model and model index.

Parameters:
tableModel - the table model.
modelIndex - the model index.

getTableModel

public TableModel getTableModel()
Gets the table model. There is no setter for it. The table model is the one that pass in through the constructor of PivotField.

Returns:
the table model.

getModelIndex

public int getModelIndex()
Gets the column index in the table model. There is no setter for it. The model index is the one that pass in through the constructor of PivotField.

Returns:
the column index.

isAscending

public boolean isAscending()
Gets the sort order.

Returns:
the sort order. True if ascending. False is descending. There is no unsorted option.

toggleAscending

public void toggleAscending()
Toggles the sort order.


setAscending

public void setAscending(boolean ascending)
Sets the sort order. This method will call setSorted(true).

Parameters:
ascending - true or false.

isDuplicated

public boolean isDuplicated()
Gets the flag indicating if this field is duplicated from another field.

Returns:
true if this field is duplicated. Otherwise false.
Since:
3.3.8

setDuplicated

public void setDuplicated(boolean duplicated)
Sets the flag indicating if this field is duplicated from another field.

Parameters:
duplicated - the flag
Since:
3.3.8

JIDE 3.5.15