on 12-11-2014 2:59 PM
Hello SDN.
We have a WDJ application consists of two WD components: one component is the list of business objects (ListComp) and the second one is the screen with object's attributes (ScreenComp). The application separated to two components since ScreenComp has to be reusable. ListComp used ScreenComp with "onDemand" flag. ScreenComp has a lot of fields and table fields with OVS. For OVS we have developed separate WD comp (GenericSH) and some Java classes which help us to cofigure OVSes. GenericSH is used in ScreenComp with flag "manual". OVSes configured in Component controller of ScreenComp.
OVSes configured and created with usage.createComponentUsageOfSameType() while ScreenView is called. OVSes deleted with usage.deleteComponent() when user leaves ScreenView.
But if user leaves ScreenView and then calls this view again the following error occured:
Cannot create object with the name workKind and rolenameComponentUsages because it already exists.
(workKind is the name of the OVS usage)
So how we can properly delete component usage and then create it again?
We're working with NW 7.31
Regards,
Lev
i think you should use createComponent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jun.
I tried to use createComponent in this way:
unitUsage = wdThis.wdGetGenericSHComponentUsage();
unitUsage.createComponent();
IExternalGenericSHInterface intrfcUM = (IExternalGenericSHInterface)unitUsage.getInterfaceController()
.wdCastTo(IExternalGenericSHInterface.class);
IWDOVSContextNotificationListener listenerUM = intrfcUM.getListener(unitOVS);
WDValueServices.addOVSExtension(IPrivateIndexView.IIndexRecordElement.UNIT_MEASURE_TXT_SHORT,
new IWDAttributeInfo[]{nodeIndInfo.getAttribute(IPrivateIndexView.IIndexRecordElement.UNIT_MEASURE_TXT_SHORT)},
intrfcUM.getInputNode(),
intrfcUM.getOutputNode(),
listenerUM);
IWDComponentUsage phdWrkKndUsage = wdThis.wdGetGenericSHComponentUsage();
phdWrkKndUsage.createComponent();
IExternalGenericSHInterface intrfc = (IExternalGenericSHInterface)phdWrkKndUsage.getInterfaceController()
.wdCastTo(IExternalGenericSHInterface.class);
IWDOVSContextNotificationListener listener = intrfc.getListener(myOVSListener);
WDValueServices.addOVSExtension(IPrivateIndexView.IWorkKindsElement.WORK_KIND,
new IWDAttributeInfo[]{phdWrkKndInfo.getAttribute(IPrivateIndexView.IWorkKindsElement.WORK_KIND)},
intrfc.getInputNode(),
intrfc.getOutputNode(),
listener);
This method called everytime when ScreenView is called.
On the exit from ScreenView I try to delete usage:
if(phdWrkKndUsage != null){
phdWrkKndUsage.deleteComponent();
}
if(unitUsage != null){
unitUsage.deleteComponent();
}
(phdWorkKndUsage and unitUsage are attributes of the ScreenView Comp Controller).
When I try to call ScreenView I'm faced with this exception:
ComponentUsage(com.acme.view.indexes.wd.comp.indexview.IndexView:GenericSH, createOnDemand=false, childComponent=com.acme.wd.searches.comps.genericsh.GenericSH): No active component must exist when creating a component.
This exception throwed at the line with phdWrkKndUsage.createComponent();
Thanks and regards
Lev
Message was edited by: Lev Kulaev Found an error in the previous version of the message.
Exception throwed before any exit method called.
Let me give more details about it.
If I try to use createComponent() as mentioned in my previous message I get an exception
ComponentUsage(com.acme.view.indexes.wd.comp.indexview.IndexView:GenericSH, createOnDemand=false, childComponent=com.acme.wd.searches.comps.genericsh.GenericSH): No active component must exist when creating a component.
during the first call of ScreenView on the line phdWrkKndUsage.createComponent(); => the first OVS initials correctly and the second one throws exception.
Also please note that I try to use the same used WD Component for two OVSes since it is common WD OVS Component.
Regards,
Lev
I thought about this. But the problem is there not two OVSes, two were for example. In fact there are 20 fixed OVSes and some OVSes for dynamically generated fields. I'm just curious what problems with createComponentUsageOfSameType(). Is it limits of WD framework to delete such usages or I miss something. Is it good way to create usage with this method and name+current timestamp (just to be sure it will be unique)?
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.