on 08-18-2004 9:46 AM
Hi all,
is there a better way of firing an outbound plug of an wd component interface view than from within the interface view controller itself?
The problem is, that you easly get a cyclic reference if you evaluate inbound component plugs in the interface controller (usage from int view ctrl --> int ctrl needed) and then try to fire an outbound plug from this interface controller (usage comp int --> comp int view usage needed).
One workaround is to use some custom controller with usage of the interface view, but this doesn't seem to be a nice solution.
So is it possible to fire outbound comp plugs from, lets say the component controller - without any usage releation to the comp int view - instead, maybe via wdComponentAPI? If yes, could you provide a code snippet?
Thanks you and best regards,
Christian
Hi Christian,
this is not possible by using the public API only, i'm afraid. It is of course possible, if you decide to forget about the possible drawbacks of using methods and classes reserved for internal use. But you have to use it at your own risk. I hacked this together some weeks ago, don't know whether it still works
/**
* Fires an outbound plug of an interface view with parameters.
*
* @param wdComponentAPI Component API "owning" the interface view.
* @param windowName Name of window
* @param plugName Name of outbound plug
* @param callerParameterMap optional Map of plug parameters.
*/
public static final void fireOutboundPlug(
IWDComponent wdComponentAPI,
String windowName,
String plugName,
Map callerParameterMap)
throws WDRuntimeException {
// Find window requested
IWDWindowInfo windowInfo = wdComponentAPI.getComponent().getComponentInfo().findInWindows(windowName);
if (windowInfo == null) {
throw new WDRuntimeException(
"Can't find window: " + windowName + " in component: " + wdComponentAPI.getQualifiedName());
}
// Get info of interface view
IWDInterfaceViewInfo ifViewInfo = windowInfo.getInterfaceView();
if (ifViewInfo == null) {
throw new WDRuntimeException("Window: " + windowName + ", no interface view info found");
}
// Find outbound plug
IWDOutboundPlugInfo outboundPlug = ifViewInfo.findInOutboundPlugs(plugName);
if (outboundPlug == null) {
throw new WDRuntimeException(
"The interface view: " + ifViewInfo.getName() + " has no outbound plug: " + plugName);
}
// Parameter passing
Collection plugParameters = outboundPlug.getParameters();
// TODO make check optional, check caller map parameter keys against existing
if (plugParameters == null || plugParameters.isEmpty()) {
// No caller parameters allowed.
if (callerParameterMap != null && !callerParameterMap.isEmpty()) {
throw new WDRuntimeException(
"The outbound plug: " + plugName + " has no parameters, callerParams must be empty/null.");
}
}
// TODO This is a hack, use of internal WD runtime classes and methods (don't use productive).
InterfaceView ifViewController =
(InterfaceView) ((Component) wdComponentAPI.getComponent()).getController(ifViewInfo.getName());
ifViewController.navigate(outboundPlug.getName(), callerParameterMap);
}
Please remember, that not everything which is technically possible, makes sense
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi guys,
I am having problems with a cyclic component usage also. It seems I cannot navigate between interface views in the same Component controller, without creating a cycle.
What is the best design for multiple interface views/windows in one component? (ie. i want to navigate from one "viewset" to another).
thanks,
michael
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.