Class VSTable
- java.lang.Object
- com.iizix.prop.GProp<GProp<?>[]>
- com.iizix.prop.PropCnr
- com.iizix.prop.vs.VSComponent
- com.iizix.prop.vs.VSTable
- All Implemented Interfaces:
EventListener
,IFocusComp
,IMessageBox
,ICustomDataProvider
,IGProp<GProp<?>[]>
,IPropCnr
,IVSComponent
,IVSComponentListener
,IVSComponentState
,IVSMessageComponent
,java.lang.Cloneable
- Direct Known Subclasses:
EditorVSTable
public class VSTable extends VSComponent implements IVSMessageComponent
The VirtualSpace Table property class holds the property name, value and optionally has a parent and/or property listener(s).It is used to hold a table with a column count with a variable number of rows. It has an optional header row.
- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from interface com.iizix.gyro.IMessageBox
IMessageBox.Icon
Nested classes/interfaces inherited from interface com.iizix.prop.vs.IVSComponentState
IVSComponentState.State
Field Summary
Fields Modifier and Type Field Description static IVSTableListener[]
EMPTY_LISTENERS
Empty list of listeners.protected VSRow
header
The header property.protected VSRows
rows
The rows property.Fields inherited from class com.iizix.prop.vs.VSComponent
statesMap
Fields inherited from class com.iizix.prop.PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_ID
Fields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2
Fields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
Fields inherited from interface com.iizix.gyro.IMessageBox
ICON_ERROR, ICON_INFORMATION, ICON_MAP, ICON_NONE, ICON_QUESTION, ICON_WARNING
Fields inherited from interface com.iizix.prop.vs.IVSComponent
ERROR, INFORMATION, NONE, PN_IGNORE_UI_FOCUS, WARNING
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addListener(IVSTableListener listener)
Adds a new listener to the VS table.boolean
addListener(IVSTableRowSelectionListener listener)
Adds a new table row selection listener.protected void
addPredefinedProps()
Adds the predefined containers for identifications, fields and actions.VSRow
addRow(VSField[] fields)
Adds a row of VSField's.VSRow
addRow(Value[] values)
Adds a row of Value's.boolean
clear()
Clears the table, i.e.boolean
clearSelection()
Clears the selection without trigger component.boolean
clearSelection(IGProp<?> trigger)
Clears the selection with optional trigger component.VSTable
clone()
Clones the VirtualSpace Table.protected VSRow
createHeader()
Creates the header property container.protected VSRow
createRow(Atom a, VSColumnHeader[] columns)
Creates a row property with column headers.protected VSRow
createRow(Atom a, VSField[] fields)
Creates a row property with fields.protected VSRow
createRow(Atom a, Value[] values)
Creates a row property with values.protected VSRows
createRows()
Creates the rows property container.void
fireRowSelection()
Fires the current row selection to listeners if the table is of single or multiple selection.int
getColumnCount()
Gets the column count.VSColumnHeader
getColumnHeader(int columnIndex)
Gets the headers columns for the row.VSColumnHeader
getColumnHeader(java.lang.String columnName)
Gets the header column by name.VSColumnHeader[]
getColumnHeaders()
Gets the headers columns for the table.java.lang.String
getComponentIsDisabled()
Gets the focus message for "Component is disabled" but for the component in question.java.lang.String
getComponentIsHidden()
Gets the focus message for "Component is hidden" but for the component in question.VSRow
getFirstSelectedRow()
Gets the first selected row in the table if the selection type is single or multiple.VSRow
getHeader()
Gets the header.protected void
getPredefinedProps()
Adds the predefined containers for identifications, fields and actions.VSRow
getRow(int row)
Gets the row of a certain index.int
getRowCount()
Gets the row count.VSField[]
getRowFields(int row)
Gets the fields for a row of a certain index.VSRow[]
getRows()
Gets the rows in this table.VSRows
getRowsContainer()
Gets the rows property container.Value[]
getRowValues(int row)
Gets the values for a row of a certain index.int
getSelectedIndex()
Gets the first selected row index in the table if the selection type is single or multiple.int[]
getSelectedIndicies()
Gets the selected row indicies in the table if the selection type is single or multiple.VSRow[]
getSelectedRows()
Gets the rows that are selected.int
getSelectionType()
Gets the selection type.IVSTableListener[]
getTableListeners()
Gets the listeners of the VS table events.VSRow
insertRow(VSField[] fields, int before)
Inserts a row of VSField's.VSRow
insertRow(Value[] values, int before)
Inserts a row of Value's.void
invokeVSChange(GProp<?> trigger)
Invokes the VSChange method on the table.boolean
isSelectionRequired()
Returns the selection required flag.void
onEventSelf(GEvent event)
Checks for state change events and fires it to listeners.protected void
onListenerChanged(IVSTableListener listener)
Called when a listener is added or removed.void
onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean stateValue)
Invokes the parent state notification function for the component.int
refreshContentProviders()
Refreshes all connected content providers.boolean
removeListener(IVSTableListener listener)
Removes a listener from the VS table.boolean
removeListener(IVSTableRowSelectionListener listener)
Removes a table row selection listener.boolean
removeRow(int row)
Removes a row.boolean
setHeader(VSColumnHeader[] columns)
Sets the header.boolean
setRow(VSField[] fields, int row)
Sets a row's all fields without affecting the state of the row.boolean
setSelection(int index)
Sets the single selection index without trigger component.boolean
setSelection(int[] indicies)
Sets the selection indicies without trigger component.boolean
setSelection(int[] indicies, IGProp<?> trigger)
Sets the selection indicies with optional trigger component.boolean
setSelection(int index, IGProp<?> trigger)
Sets the single selection index with optional trigger component.Methods inherited from class com.iizix.prop.vs.VSComponent
addListener, areFree, areFree, canRequestFocus, couldRequestFocusIfVirtualized, forbiddenGetCustomDataMap, getClientSessionGyro, getComponentListeners, getDescription, getNonVirtualized, getVirtualSpace, initPropCnr, isFree, isFree, onFocusGained, onFocusLost, onListenerChanged, onPrepare, onPropDispose, onRemoteEvent, onVirtualizationCompleted, onVirtualized, removeListener
Methods inherited from class com.iizix.prop.PropCnr
__transferChildProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, doVirtualizePropCnr, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getReferences, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isSibling, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropRemoved, onPropTreeInitialized, onReferenceEvent, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualize
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, extendsClone, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParent, getTreeLock, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onPropInvalidateCache, onPropParentChanged, onPropValueSet, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, verifyHasPropertyItem, warning, warning, warning
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.prop.ICustomDataProvider
forbiddenGetCustomDataMap, getCustomData, putCustomData, putCustomDataIfAbsent
Methods inherited from interface com.iizix.gyro.IFocusComp
onFocusGained, onFocusLost, requestFocus, requestFocus, requestFocusEx, requestFocusEx
Methods inherited from interface com.iizix.prop.IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropBaseReference, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getReferences, getRelativePropName, getRootParent, getTreeLock, getValueClasses, getVSReference, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCommunicating, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, list, list, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onPropTreeInitialized, onRemoteEvent, removePropError, removePropListener, renameProp, resolveRuntimeReferences, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toElementString, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, validatePropType, validatePropValue, verify, verifyHasPropertyItem, warning, warning, warning
Methods inherited from interface com.iizix.gyro.IMessageBox
messageBox, messageBox
Methods inherited from interface com.iizix.prop.IPropCnr
addProp, addProp, addProp2, addProp2, canRequestFocus, canRequestFocus, canRequestFocus, containsProp, containsProp, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, enablePropCommunication, enablePropHashMap, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsError, getExtendsName, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropCnr, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getString, getString, getString, getString, hasFocus, initializeExtendsFramework, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsRoot, isPropAddRemoveAllowed, isPropExtended, isSibling, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, requestFocus, requestFocusEx, setBool, setBool, setBool, setBool, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, usePropHashMap, usesPropIndex, validateClassInstances
Methods inherited from interface com.iizix.prop.vs.IVSComponent
getAction, getAction2, getActionNull, getActionNull2, getDescription, getField, getField2, getFieldNull, getFieldNull2, getGroup, getGroup2, getGroupNull, getGroupNull2, getNonVirtualized, getTable, getTable2, getTableNull, getTableNull2, getVirtualizedVirtualSpace, getVirtualSpace, getVSComponent, getVSComponent2, getVSComponentNull, getVSComponentNull2, getVSRef, isEnabled, isEnabledInParent, isReadOnly, isReadOnlyInParent, isSelected, isVisible, isVisibleInParent, messageBox, setEnabled, setEnabled, setIgnoreFocusFromUI, setReadOnly, setReadOnly, setSelected, setSelected, setVirtualizeSupportFocus, setVirtualizeSupportFocus, setVisible, setVisible, shouldIgnoreFocusFromUI
Methods inherited from interface com.iizix.prop.vs.IVSMessageComponent
clearMessage, getMessage, getMessageCategory, getMessageString, isValid, setErrorMessage, setMessage, setMessage
Field Detail
EMPTY_LISTENERS
public static final IVSTableListener[] EMPTY_LISTENERS
Empty list of listeners.
header
protected VSRow header
The header property.
rows
protected VSRows rows
The rows property.
Constructor Detail
VSTable
public VSTable()
Creates a VirtualSpace Table property with the specified name with a null value.
VSTable
public VSTable(Atom propertyAtom)
Creates a VirtualSpace Table property with the specified name with a null value.- Parameters:
propertyAtom
- the property atom.
Method Detail
clone
public VSTable clone()
Clones the VirtualSpace Table.- Overrides:
clone
in classVSComponent
addPredefinedProps
protected void addPredefinedProps() throws PropException
Adds the predefined containers for identifications, fields and actions.- Overrides:
addPredefinedProps
in classPropCnr
- Throws:
PropException
- for property exceptions.
getPredefinedProps
protected void getPredefinedProps()
Adds the predefined containers for identifications, fields and actions. This method is overridden fully by the Editor versions of the class.- Overrides:
getPredefinedProps
in classPropCnr
getComponentIsHidden
public java.lang.String getComponentIsHidden()
Gets the focus message for "Component is hidden" but for the component in question.- Specified by:
getComponentIsHidden
in classVSComponent
getComponentIsDisabled
public java.lang.String getComponentIsDisabled()
Gets the focus message for "Component is disabled" but for the component in question.- Specified by:
getComponentIsDisabled
in classVSComponent
onEventSelf
public void onEventSelf(GEvent event)
Checks for state change events and fires it to listeners.- Specified by:
onEventSelf
in interfaceIGProp<GProp<?>[]>
- Overrides:
onEventSelf
in classVSComponent
- Parameters:
event
- The property event.
onParentStateChanged
public void onParentStateChanged(IVSComponent parent, IVSComponentState.State state, boolean stateValue)
Invokes the parent state notification function for the component.- Specified by:
onParentStateChanged
in interfaceIVSComponentListener
- Parameters:
parent
- The parent who's state was changed.state
- The state that changed.stateValue
- The new state value.
addListener
public boolean addListener(IVSTableListener listener)
Adds a new listener to the VS table.- Parameters:
listener
- The listener for VS table events.- Returns:
- true for success, false if the listener already is added.
removeListener
public boolean removeListener(IVSTableListener listener)
Removes a listener from the VS table.- Parameters:
listener
- The existing listener for VS table events.- Returns:
- true for success, false if the listener has not been added.
onListenerChanged
protected void onListenerChanged(IVSTableListener listener)
Called when a listener is added or removed. This method is overridden by the Designer to update connections.
getTableListeners
public IVSTableListener[] getTableListeners()
Gets the listeners of the VS table events.- Returns:
- A cached array of listeners for the value, retrieved without synchronization if possible.
createRows
protected VSRows createRows()
Creates the rows property container.
createRow
protected VSRow createRow(Atom a, VSColumnHeader[] columns) throws PropException
Creates a row property with column headers.- Throws:
PropException
- For creation error.
createRow
protected VSRow createRow(Atom a, VSField[] fields) throws PropException
Creates a row property with fields.- Throws:
PropException
- For creation error.
createRow
protected VSRow createRow(Atom a, Value[] values) throws PropException
Creates a row property with values.- Throws:
PropException
- For creation error.
getRowCount
public int getRowCount()
Gets the row count.
getRows
public VSRow[] getRows()
Gets the rows in this table.- Returns:
- The array of rows.
getRow
public VSRow getRow(int row)
Gets the row of a certain index.Note: a warning message is logged if the operation fails.
- Parameters:
row
- The row index to get, must be zero to count of rows - 1 inclusive.- Returns:
- The VSRowProp of VSFields, null if row is invalid.
getRowFields
public VSField[] getRowFields(int row)
Gets the fields for a row of a certain index.- Parameters:
row
- The row index to get, must be zero to count of rows - 1 inclusive.- Returns:
- The array of VSFields, null if row is invalid.
getRowValues
public Value[] getRowValues(int row)
Gets the values for a row of a certain index.- Parameters:
row
- The row index to get, must be zero to count of rows - 1 inclusive.- Returns:
- The array of VSFields, null if row is invalid.
addRow
public VSRow addRow(VSField[] fields)
Adds a row of VSField's.Note: a warning message is logged if the operation fails.
Note 2: the operation will fail if any of the fields in the array are not new instances from a "new" or "clone" operation. This means that they cannot have been attached to a VS container previously.
- Parameters:
fields
- The row of fields to add as an array.- Returns:
- The
VSRow
inserted if successful,null
for failure.
addRow
public VSRow addRow(Value[] values)
Adds a row of Value's.Note: a warning message is logged if the operation fails.
Note 2: the operation will fail if the values do not correspond to the column header field settings, i.e. null allowed and the value type of the column.
- Parameters:
values
- The row of values to add as an array.- Returns:
- The
VSRow
inserted if successful,null
for failure.
insertRow
public VSRow insertRow(VSField[] fields, int before)
Inserts a row of VSField's.A selection event is not fired, even if the selection changes, e.g. if the row inserted caused the selection index or indicies to change. If you need to fire a selection change, you may do so by calling the method
.fireRowSelection()
Note: a warning message is logged if the operation fails.
Note 2: the operation will fail if any of the fields in the array are not new instances from a "new" or "clone" operation. This means that they cannot have been attached to a VS container previously.
- Parameters:
fields
- The row of fields to add as an array.before
- The row index that will these fields will be inserted before, -1 to add last in table.- Returns:
- The
VSRow
inserted if successful,null
for failure.
insertRow
public VSRow insertRow(Value[] values, int before)
Inserts a row of Value's.A selection event is not fired, even if the selection changes, e.g. if the row inserted caused the selection index or indicies to change. If you need to fire a selection change, you may do so by calling the method
.fireRowSelection()
Note: a warning message is logged if the operation fails.
Note 2: the operation will fail if the values do not correspond to the column header field settings, i.e. null allowed and the value type of the column.
- Parameters:
values
- The row of values to add as an array.before
- The row index that will these fields will be inserted before, -1 to add last in table.- Returns:
- The
VSRow
inserted if successful,null
for failure.
setRow
public boolean setRow(VSField[] fields, int row)
Sets a row's all fields without affecting the state of the row.Note: a warning message is logged if the operation fails.
- Parameters:
fields
- The row of fields to set as an array.row
- The row index to set, must be zero to count of rows - 1 inclusive.- Returns:
- true if this changed successfully the table, false otherwise.
removeRow
public boolean removeRow(int row)
Removes a row.A selection event is not fired, even if the selection changes, e.g. if the row deleted was selected. If you need to fire a selection change, you may do so by calling the method
.fireRowSelection()
Note: a warning message is logged if the operation fails.
- Parameters:
row
- The row index to remove, must be zero to count of rows - 1 inclusive.- Returns:
- true if this changed successfully the table, false otherwise.
clear
public boolean clear()
Clears the table, i.e. removes all rows.A selection event is not fired. If you need to fire a selection change, you may do so by calling the method
.fireRowSelection()
Note: a warning message is logged if the operation fails.
- Returns:
- true if this changed successfully the table, false otherwise.
getRowsContainer
public VSRows getRowsContainer()
Gets the rows property container.- Returns:
- The VSRows container.
invokeVSChange
public void invokeVSChange(GProp<?> trigger)
Invokes the VSChange method on the table.- Parameters:
trigger
- The trigger property, e.g. row added, etc.
createHeader
protected VSRow createHeader()
Creates the header property container.
getHeader
public VSRow getHeader()
Gets the header.- Returns:
- The row of VSColumnHeader properties of the header.
getColumnHeaders
public VSColumnHeader[] getColumnHeaders()
Gets the headers columns for the table.- Returns:
- The array of VSColumnHeader for the table.
getColumnHeader
public VSColumnHeader getColumnHeader(int columnIndex)
Gets the headers columns for the row.- Parameters:
columnIndex
- The index of the column.- Returns:
- The column of requested index, null if the column index is out of range.
getColumnHeader
public VSColumnHeader getColumnHeader(java.lang.String columnName)
Gets the header column by name.- Parameters:
columnName
- The column name.- Returns:
- The column header, or null if the column name is not found.
getColumnCount
public int getColumnCount()
Gets the column count.- Returns:
- The count of columns.
setHeader
public boolean setHeader(VSColumnHeader[] columns)
Sets the header.Note: a warning message is logged if the operation fails.
- Parameters:
columns
- The header columns to set as an array.- Returns:
- true if this changed successfully the table, false otherwise.
getSelectionType
public int getSelectionType()
Gets the selection type.- Returns:
- The table selection type: 0=none, 1=single (default), 2=multiple.
isSelectionRequired
public boolean isSelectionRequired()
Returns the selection required flag.- Returns:
- true if selection is required, false otherwise (default).
getFirstSelectedRow
public VSRow getFirstSelectedRow()
Gets the first selected row in the table if the selection type is single or multiple.- Returns:
- The selected row, null for none.
getSelectedRows
public VSRow[] getSelectedRows()
Gets the rows that are selected.- Returns:
- An array with the selected rows, never null.
getSelectedIndex
public int getSelectedIndex()
Gets the first selected row index in the table if the selection type is single or multiple.- Returns:
- The selected row index, or -1 for none.
getSelectedIndicies
public int[] getSelectedIndicies()
Gets the selected row indicies in the table if the selection type is single or multiple.- Returns:
- An array of the selected row indicies, or an empty array for no selection present.
clearSelection
public boolean clearSelection()
Clears the selection without trigger component.- Returns:
- true for success, false if the table is not of single or multiple selection type. In case of false return code, no unselection is performed.
clearSelection
public boolean clearSelection(IGProp<?> trigger)
Clears the selection with optional trigger component.- Parameters:
trigger
- The trigger of the selection, null for none.- Returns:
- true for success, false if the table is not of single or multiple selection type. In case of false return code, no unselection is performed.
setSelection
public boolean setSelection(int index)
Sets the single selection index without trigger component.Selection processing is done in the following way:
- select the new row index,
- unselect the other rows, starting with the first to last row.This makes it possible to know if there are no selections remaining at an "unselection event".
- Parameters:
index
- The selected row index, or any negative value (e.g. -1) to clear the selection.- Returns:
- true for success, false if the table is not of single or multiple selection type. In case of false return code, no selection or unselection is performed.
setSelection
public boolean setSelection(int index, IGProp<?> trigger)
Sets the single selection index with optional trigger component.Selection processing is done in the following way:
- select the new row index,
- unselect the other rows, starting with the first to last row.This makes it possible to know if there are no selections remaining at an "unselection event".
- Parameters:
index
- The selected row index, or any negative value (e.g. -1) to clear the selection.trigger
- The trigger of the selection, null for none.- Returns:
- true for success, false if the table is not of single or multiple selection type. In case of false return code, no selection or unselection is performed.
setSelection
public boolean setSelection(int[] indicies)
Sets the selection indicies without trigger component.Selection processing is done in the following way:
- select the new row indicies,
- unselect the other rows, starting with the first to last row.This makes it possible to know if there are no selections remaining at an "unselection event".
- Parameters:
indicies
- The selected row indicies.- Returns:
- true for success, false if the table is not of single or multiple selection type. false is also returned if the length of the indicies is longer than one and the table is of single selection type (regardless if the same index is specified twice). In case of false return code, no selection or unselection is performed.
setSelection
public boolean setSelection(int[] indicies, IGProp<?> trigger)
Sets the selection indicies with optional trigger component.Selection processing is done in the following way:
- select the new row indicies,
- unselect the other rows, starting with the first to last row.This makes it possible to know if there are no selections remaining at an "unselection event".
- Parameters:
indicies
- The selected row indicies.trigger
- The trigger of the selection, null for none.- Returns:
- true for success, false if the table is not of single or multiple selection type. false is also returned if the length of the indicies is longer than one and the table is of single selection type (regardless if the same index is specified twice). In case of false return code, no selection or unselection is performed.
addListener
public boolean addListener(IVSTableRowSelectionListener listener)
Adds a new table row selection listener. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
java.lang.NullPointerException
- If the listener isnull
.
removeListener
public boolean removeListener(IVSTableRowSelectionListener listener)
Removes a table row selection listener.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
fireRowSelection
public void fireRowSelection()
Fires the current row selection to listeners if the table is of single or multiple selection. If no change of selection is present, nothing will be done.
refreshContentProviders
public int refreshContentProviders()
Refreshes all connected content providers. Use this method typically when a content provider that is connected to the VS table needs to be refreshed because it e.g. would produce a different result due to values or states outside of the VS table scope or that there are items not connected to VS fields or rows in the table.The method fires the
onStateChanged(this,State.CONTENT_PROVIDER_REFRESH,false)
event to all table listeners.- Returns:
- The number of table listeners that have been notified.