on 11-14-2008 11:16 PM
Hi all,
Iam trying to create a ViewContainerUI element at runtime and want to add an existing view to the ViewContainer dynamically.
Please let me know how can I embed a view dynamically in a view container.
Component Controller :
//Dynamic view container
final IWDWindowInfo myWindow = wdComponentAPI.getComponentInfo().findInWindows("DemoWin");
final IWDViewUsageInfo vuiMain = myWindow.getViewUsageByID("DemoView");
final IWDViewContainerAssignmentInfo vcaiMainArea = vuiMain.createViewContainerAssignment();
{
final IWDViewInfo viMain= (IWDViewInfo)vuiMain.getView();
final IWDViewContainerInfo vciViewContainer = viMain.createViewContainer();
/* Transfer the name to view controller to setup UI element */
wdContext.currentContextElement().setViewId( vciViewContainer.getName() );
vcaiMainArea.setViewContainer( vciViewContainer );
}
In the DemoView :
IWDViewContainerUIElement theViewContainer = (IWDViewContainerUIElement) view.createElement(IWDViewContainerUIElement.class, fld.getFieldID());
theViewContainer.createLayoutData(IWDMatrixHeadData.class);
theViewContainer.setViewContainer(wdContext.currentContextElement().getViewId());
theGroup.addChild(theViewContainer);
This is working fine. I am not getting exceptions.
But a empty container is added to the view. Instead I want to add a existing view into viewcontainer dynamically.
Please help me......Thanks in advance.
Try this..........
//Dynamic view container
final IWDWindowInfo myWindow = wdComponentAPI.getComponentInfo().findInWindows("MyWin");
final IWDViewUsageInfo vuiMain = myWindow.getViewUsageByID("MainView");
final IWDViewContainerAssignmentInfo vcaiMainArea = vuiMain.createViewContainerAssignment();
{
final IWDViewInfo viMain= (IWDViewInfo)vuiMain.getView();
final IWDViewContainerInfo vciViewContainer = viMain.createViewContainer();
/* Transfer the name to view controller to setup UI element */
vcaiMainArea.setViewContainer( vciViewContainer );
}
//EMbed View dynamically in the View Container //
final IWDViewUsageInfo vuiInner = vcaiMainArea.createEmbeddedViewUsage();
{
final IWDViewUsageInfo myViewMain = myWindow.getViewUsageByID("MyView");
final IWDViewInfo myView= (IWDViewInfo)myViewMain .getView();
myViewMain.setView( myView);
}
/* Mark view usage as default */
vcaiMainArea.setDefaultViewUsage( vuiInner );
Let me know if it works.........
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.