Rogue Wave Server/Rogue Wave Views Integration > Server/Views Mapping > Extending the Server/Views Mapping > Subclassing the Server/Views Component
 
Subclassing the Server/Views Component
You may need to subclass the component type in your application to override virtual methods, such as openView, ackOpenView and others, or to implement your own functionality. In a Server/Views application component, your own component must inherit from IlsSwComponent.
A more common way to do this is to use the class IlsMvComponentFactory. With this method, the library creates only components of the type you define.
Once you have set the component factory to your own factory, you can use the regular functions of the library and your function newInstance will be called to create new components:
class MyComponent : public IlsSwComponent {
/*...*/
};
 
class MyComponentFactory : public IlsMvComponentFactory {
public:
virtual IlsMvComponent* newInstance() { return new MyComponent(); }
};
/* ... */
IlsMvComponentFactory::SetSingleton(new MyComponentFactory());
IlsSwComponent::Initialize(argc, argv);
IlsSwComponent:Run();
At initialization, the class IlsSwComponent tries to install its default factory. You must therefore install your own factory before calling the static member function IlsSwComponent::Initialize.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.