IlsSwTable
 
IlsSwTable
Category 
Dynamic view-related class (Rogue Wave Views component)
Inheritance Path 
IlsRpObject
IlsSwTable
Description 
The class IlsSwTable defines an Rogue Wave Server representation object that is a table. This class also defines a set of properties that are described in section IlsSwTable of Chapter Rogue Wave Server/Rogue Wave Views Mapping in the Rogue Wave Server User’s Manual.
Library 
<mvsw>
Header File 
#include <ilmvsw/table.h>
Synopsis 
class IlsSwTable : public IlsRpObject
{
public:
IlsSwTable(IlsRepresentation& repres,
const IlsRpObjModel& model);
virtual ~IlsSwTable();
Dereferencing
void propertySwOnDereference(IlvInt colIndex,
IlsSwServerDataSource* ds,
IlsMvValue* argv = 0,
IlsCbArgNb argc = 0,
IlsBoolean force = IlsFalse,
IlsSwOpenViewCallbackType cb=0,
IlsAny arg = 0);
void propertySwOnDereference(IlvInt colIndex,
IlsSwServerDataSource* ds,
IlsMvValue* argv,
IlsCbArgNb argc,
IlsMvValue* ackArgv,
IlsCbArgNb ackArgc,
IlsCbArgNb resIndex,
IlsBoolean force = IlsFalse,
IlsSwOpenViewCallbackType cb=0,
IlsAny arg = 0);
protected:
virtual void onSwDereference(IlsRpAttributeId,
IlsSwServerDataSource* ds,
IlsMvValue* argv,
IlsCbArgNb argc,
IlsMvValue* ackArgv,
IlsCbArgNb ackArgc,
IlsCbArgNb resIndex,
IlsBoolean force = IlsFalse,
IlsSwOpenViewCallbackType cb=0,
IlsAny arg = 0);
Attribute Identifiers
public:
IlsRpAttributeId colToAttributeId(IliDataSource*,
IlvInt colNumber,
IlvInt rowNumber = -1) const;
IlsRpAttributeId colToAttributeId
(IlsBoolean isPropertyDataSource,
IlvInt colNumber,
IlvInt rowNumber = -1) const;
Autocommit Mode
IlsBoolean getAutoCommit();
void setAutoCommit(IlsBoolean);
Cells
protected:
virtual void setPropertyCell(const IlsString& colName,
const IliValue& value);
public:
virtual IlsBoolean updateCell(const IliValue&,
IlvInt colNumber,
IlsSwRow* = 0);
Rows and Columns
long getRowsCount() const;
IlsSwRow* getRow(IlvInt rowNumber) const;
IlsSwRow* getCurrentRow() const;
IlvInt getColumnNumber(IlsSvInt svIndex) const;
virtual IlsBoolean canEditColumn(IlvInt colno,
IlsEditRights::Value = IlsEditRights::DEFAULT_EDIT) const;
Row Types
void setRowType(const IlsString& svType,
const IlsString& rpType);
IlsString getSvRowType() const;
IlsString getRowType() const {}
Data Source
IliMemoryDataSource* getMainDataSource() const;
IliMemoryDataSource* getPropertyDataSource() const;
virtual IlsBoolean emptyDataSource();
Symbols
static IlvSymbol* TableCreatedSymbol();
static IlvSymbol* TableDestroyedSymbol();
static IlvSymbol* InsertRowSymbol();
static IlvSymbol* DeleteRowSymbol();
Callbacks
static void AddCallback(IlvSymbol* symbol,
IlsSwRowCallbackType,
IlsAny = 0,
IlsSwTable* = 0);
static void AddCallback(IlvSymbol* symbol,
IlsSwTableCallbackInsertRowType,
IlsAny = 0,
IlsSwTable* = 0);
static void RemoveCallback(IlvSymbol* symbol,
IlsSwRowCallbackType,
IlsAny = 0,
IlsSwTable* = 0);
static void RemoveCallback(IlvSymbol* symbol,
IlsSwTableCallbackInsertRowType,
IlsAny = 0,
IlsSwTable* = 0);
Collectors
IlsSwRow* createAndAddRowCollector(IlsSwTable* parent,
IlvInt rowNumber,
IliTableBuffer*,
IlsRpObject* cousin = 0);
virtual void setDefaultCollector(const IlsString&);
IlsString getDefaultCollector() const;
IlsRpAttributeId getCollectorId
(const IlsRpObjModel* objModel=0) const;
Opening a View
virtual void openSwView(const IlsString& viewName,
IlsSwServerDataSource* sds,
IlsMvValue* argv=0,
IlsCbArgNb argc=0,
IlsBoolean force=IlsFalse,
IlsSwOpenViewCallbackType cb = 0,
IlsAny arg = 0);
virtual void openSwView(const IlsString& viewName,
IlsSwServerDataSource* sds,
IlsMvValue* argv,
IlsCbArgNb argc,
IlsMvValue* ackArgv,
IlsCbArgNb ackArgc,
IlsCbArgNb resultIndex,
IlsBoolean force=IlsFalse,
IlsSwOpenViewCallbackType cb = 0,
IlsAny arg = 0);
Property Manager
void setTablePropertyManager(IliTablePropertyManager* propMgr);
IliTablePropertyManager* getTablePropertyManager();
protected:
virtual void transferState(IlsSwTable& oldTable,
IlsBoolean transferCallbacks);
Other Functions
static IlvBoolean LabelToValue(const IliFieldItf&,
const char*,
IliValue&);
};
Constructor 
IlsSwTable(IlsRepresentation& repres,
const IlsRpObjModel& model);
This constructor is invoked by Rogue Wave Server when a new table representation is created. If you derive this class, you must call this constructor with its repres and model arguments.
Destructor 
virtual ~IlsSwTable();
This is the public virtual destructor for this class.
Member Functions 
Dereferencing
void propertySwOnDereference(IlvInt colIndex,
IlsSwServerDataSource* ds,
IlsMvValue* argv = 0,
IlsCbArgNb argc = 0,
IlsBoolean force = IlsFalse,
IlsSwOpenViewCallbackType cb=0,
IlsAny arg = 0);
This member function can be used to dereference the hyper-reference at the Rogue Wave Views column colNumber of the property data source. If the column corresponds to a selectable hyper-reference, this method calls the virtual member function IlsSwTable::onSwDereference, documented below.
void propertySwOnDereference(IlvInt colIndex,
IlsSwServerDataSource* ds,
IlsMvValue* argv,
IlsCbArgNb argc,
IlsMvValue* ackArgv,
IlsCbArgNb ackArgc,
IlsCbArgNb resIndex,
IlsBoolean force = IlsFalse,
IlsSwOpenViewCallbackType cb=0,
IlsAny arg = 0);
This member function can be used to dereference the hyper-reference at the Rogue Wave Views column colNumber of the property data source. If the column corresponds to a selectable hyper-reference, this method calls the virtual member function IlsSwTable::onSwDereference, documented below.
[virtual] void onSwDereference(IlsRpAttributeId,
IlsSwServerDataSource* ds,
IlsMvValue* argv,
IlsCbArgNb argc,
IlsMvValue* ackArgv,
IlsCbArgNb ackArgc,
IlsCbArgNb resIndex,
IlsBoolean force = IlsFalse,
IlsSwOpenViewCallbackType cb=0,
IlsAny arg = 0);
This protected virtual member function dereferences the attribute specified if it is a valid hyper-reference, otherwise it has no effect.
You can specify a Server data source, if you want to open the new view using and existing Server data source. If this argument is 0, Rogue Wave Server looks for a preregistered data source for this view. If none is found, a new panel is created.
You can also specify a callback and its associated data by setting the cb and arg parameters. This callback will be called when the view is opened.
You can refer to the functions IlsSwComponent::openSwView and IlsRpObject::onDereference for more information.
Attribute Identifiers
IlsRpAttributeId colToAttributeId(IliDataSource*,
IlvInt colNumber,
IlvInt rowNumber = -1) const;
This member function returns the attribute identifier for the cell or column of the data source.
IlsRpAttributeId colToAttributeId(IlsBoolean isPropertyDataSource,
IlvInt colNumber,
IlvInt rowNumber = -1) const;
This member function returns the attribute identifier for the cell in the main data source if the parameter isPropertyDataSource is false, or for the column of the property data source if the parameter isPropertyDataSource is true.
Autocommit Mode
IlsBoolean getAutoCommit();
This member function returns IlsTrue if the table automatically commits its modifications to the server. This is the default behavior. If the table is not in autocommit mode, the application must validate the changes in the data source before the modifications can be sent to the server.
void setAutoCommit(IlsBoolean);
This member function sets the autocommit mode for the table.
Cells
Warning: : As from Rogue Wave Server 4.2, the setCellBg, setCellFg, getCellBg, and getCellFg member functions are obsolete. To set and get foreground and background colors for rows, columns and cells, you can use the Rogue Wave Views Table Property Manager (see the Rogue Wave Views/Data Access documentation for details).
[virtual] void setPropertyCell(const IlsString& colName,
const IliValue& value);
This protected virtual member function is called by the server to update the cell located at column colName in the property data source.
[virtual] IlsBoolean updateCell(const IliValue&,
IlvInt colNumber,
IlsSwRow* = 0);
This virtual member function calls the function IlsRpObject::onUpdate for the attribute associated with the row, or for the attribute associated with the property table if the row parameter is null. This method uses the Views-to-Server value converter registered on the instance of IlsSwComponent to convert the value to an IlsMvValue object.
Rows and Columns
long getRowsCount() const;
This member function returns the number of rows in the table.
IlsSwRow* getRow(IlvInt rowNumber) const;
This member function returns the row for the row identified by rowNumber.
IlsSwRow* getCurrentRow() const;
This member function returns the IlsSwRow associated with the current row of the main data source.
IlvInt getColumnNumber(IlsSvInt svIndex) const;
This member function returns the Rogue Wave Views index of the column indicated by the server index svIndex.
[virtual] IlsBoolean canEditColumn(IlvInt colno,
IlsEditRights::Value = IlsEditRights::DEFAULT_EDIT) const;
This virtual member function returns IlsTrue if the column positioned at colno can be edited according to the value of type IlsEditRights::Value.
Row Types
void setRowType(const IlsString& svType, const IlsString& rpType);
This static member function sets the Server object type that must used to create a new row using a collector defined on the table. This method allows you to insert objects whose type is derived from the class of the target object of the relation.
IlsString getSvRowType() const;
This member function retrieves the type of the Server object that matches the row added to the table using the current collector.
IlsString getRowType() const {}
This member function retrieves the representation name of the row that was added to the table using the current collector.
Data Source
IliMemoryDataSource* getMainDataSource() const;
This member function returns the main data source of a table.
IliMemoryDataSource* getPropertyDataSource() const;
This member function returns the property data source of a table.
[virtual] IlsBoolean emptyDataSource();
This virtual member function is called when an instance of IlsSwTable connects to an existing data source. By default, the whole data source is emptied by this connection. You can override this function and return IlsFalse if you want to keep existing rows in the data source.
Symbols
[static] IlvSymbol* TableCreatedSymbol();
This static member function returns the symbol for the callback that can be called when a table is created. The type of the callback is IlsSwTableCallbackType.
[static] IlvSymbol* TableDestroyedSymbol();
This static member function returns the symbol for the callback that can be called when a table is destroyed. The type of the callback is IlsSwTableCallbackType.
[static] IlvSymbol* InsertRowSymbol();
This static member function returns the symbol for the callback that can be called when a new row is about to be inserted in the table. This callback is only called when the insertion of the new row is triggered by the component, not when rows are inserted into the table as a result of the Server notification mechanism. The type of the callback is IlsSwTableCallbackInsertRowType.
[static] IlvSymbol* DeleteRowSymbol();
This static member function returns the symbol for the callback that can be called when a row is about to be deleted. This callback is called only when the deletion of the row is triggered by the component, not when the row is deleted by a server notification.
If this callback returns IlsTrue, it means that the callback has handled the deletion and Rogue Wave Server does not process any further action as a consequence of the deletion.
This callback may be useful, among other uses, to set the default collector from which the row must be deleted.
See the IlsSwTableCallbackDeleteRowType type definition for more information.
Callbacks
[static] void AddCallback(IlvSymbol* symbol,
IlsSwTableCallbackType,
IlsAny = 0,
IlsSwTable* = 0);
[static] void AddCallback(IlvSymbol* symbol,
IlsSwTableCallbackInsertRowType,
IlsAny = 0,
IlsSwTable* = 0);
Both these static member functions add a callback to the table. Their symbol parameter identifies which callback is to be added. If the table parameter is null, the callback is called for all instances of IlsSwTable.
They differ in their second arguments, which are callback types. See the types IlsSwTableCallbackType and IlsSwTableCallbackInsertRowType for more information.
[static] void RemoveCallback(IlvSymbol* symbol,
IlsSwTableCallbackType,
IlsAny = 0,
IlsSwTable* = 0);
[static] void RemoveCallback(IlvSymbol* symbol,
IlsSwTableCallbackInsertRowType,
IlsAny = 0,
IlsSwTable* = 0);
Both these static member functions remove a callback that was previously added using the static member function AddCallback.
They differ in their second arguments, which are callback types. See the types IlsSwTableCallbackType and IlsSwTableCallbackInsertRowType for more information.
Collectors
IlsSwRow* createAndAddRowCollector(IlsSwTable* parent,
IlvInt rowNumber,
IliTableBuffer*,
IlsRpObject* cousin = 0);
This member function can be called from within the insert row callback to customize the addition of a row in a table. A “cousin” representation object can be passed to this method so that no new object is created in the server if the row is going to represent an existing server object.
[virtual] void setDefaultCollector(const IlsString&);
This virtual member function lets you select the collector that will be used to add new rows to the table if the view specification sets more than one collector for this table.
IlsString getDefaultCollector() const;
This member function returns the current collector used to add new rows to the table.
IlsRpAttributeId getCollectorId(const IlsRpObjModel* objModel=0) const;
This member function returns the default collector attribute identifier for the table. If a representation object model is specified, this function returns the identifier of the collector that references the row type specified by this representation object model.
Note: If more than one collector reference this row type (or a row type associated with a derived class of corresponding server type), this method returns the default collector.
This member function returns -1 if no collector has been defined or if edithRights is set to IlsFalse.
Opening a View
[virtual] void openSwView(const IlsString& viewName,
IlsSwServerDataSource* sds,
IlsMvValue* argv=0,
IlsCbArgNb argc=0,
IlsBoolean force=IlsFalse,
IlsSwOpenViewCallbackType cb = 0,
IlsAny arg = 0);
This virtual member function opens a view on the server object associated with this representation object. See the function IlsSwComponent::openSwView for a description of arguments.
[virtual] void openSwView(const IlsString& viewName,
IlsSwServerDataSource* sds,
IlsMvValue* argv,
IlsCbArgNb argc,
IlsMvValue* ackArgv,
IlsCbArgNb ackArgc,
IlsCbArgNb resultIndex,
IlsBoolean force=IlsFalse,
IlsSwOpenViewCallbackType cb = 0,
IlsAny arg = 0);
This virtual member function opens a view on the server object associated with this representation object. See the class IlsSwComponent::openSwView for a description of arguments.
Property Manager
void setTablePropertyManager(IliTablePropertyManager* propMgr);
This member function sets the property manager that will be used to set properties to the Rogue Wave Views table. If no property manager is specified, the property manager of default Views table is used.
IliTablePropertyManager* getTablePropertyManager();
This member function returns the table property manager used to set properties to the current Rogue Wave Views table.
[virtual] void transferState(IlsSwTable& oldTable,
IlsBoolean transferCallbacks);
This protected virtual member function transfers the state of the old table to the table for which the function is called. If the argument transferCallbacks is set to IlsTrue, the callbacks for this instance are transferred to the new table.
Other Functions
[static] IlvBoolean LabelToValue(const IliFieldItf&,
const char*,
IliValue&);
This static member function must be called in the Rogue Wave Views method labelToValue when deriving Rogue Wave Views gadgets so that it becomes possible to modify a hyper-reference label.
See Also 
Basic Types, IlsSwComponent, IlsSwRow

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.