cancel
Showing results for 
Search instead for 
Did you mean: 

IWDGroup

Former Member
0 Kudos

Hi,

I want to make UIElement dynamically in Group.

But,It is in the code below ..the error...

Could anyone teach?

================================================

sample

public static void wdDoModifyView(......)

if(firstTime){

IWDGroup rootElement = (IWDGroup)view.getRootElement();

rootElement.createLayout(IWDMatrixHeadData.class);

IWDNodeInfo soNodeinfo = wdContext.getNodeInfo();

for(int i = 0 ;i<3;i++){

Iterator iter = soNodeinfo.iterateAttributes();

IWDAttributeInfo soAttrInfo = (IWDAttributeInfo)iter.next();

IWDLabel label = (IWDLabel)view.createElement(IWDLabel.class,soAttrInfo.getName() + "Label" + i);

label.setText("test");

label.setDesign(WDLabelDesign.STANDARD);

label.createLayoutData(IWDMatrixHeadData.class);

rootElement.addChild(label);

IWDInputField input = (IWDInputField)view.createElement(IWDInputField.class,soAttrInfo.getName() + "sample" + i);

input.createLayoutData(IWDMatrixData.class);

input.bindValue("test1");

rootElement.addChild(input);

}

========================================================

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

BESS,

First of all, you are adding controls to wrong parent.

Instead of

IWDGroup rootElement = (IWDGroup)view.getRootElement();

use

IWDGroup rootElement = (IWDGroup)view.getElement("place-here-id-of-group");

Next, your code for iterating attributes has errors as well.

instead


for(int i = 0 ;i<3;i++){
Iterator iter = soNodeinfo.iterateAttributes();
IWDAttributeInfo soAttrInfo = (IWDAttributeInfo)iter.next();
...
}

use

for(final Iterator iter = soNodeinfo.iterateAttributes(); iter.hasNext(); ) {
IWDAttributeInfo soAttrInfo = (IWDAttributeInfo)iter.next();
...
}

VS

Former Member
0 Kudos

Hi,VS

Thank you for teaching.

There is another one question.

I want to make UIElement(Group) dynamically.

I want you to teach the code dynamically made

UIElement(Group)

because it should already set Group to Layout.

====================================================

IWDGroup rootElement = (IWDGroup)view.getElement("Group1");

====================================================

Regards,

Former Member
0 Kudos

BESS,

The prologue then must look like this:


IWDUIElementContainer rootElement = (IWDUIElementContainer)view.getRootElement();
IWDGroup group = (IWDGroup)view.createElement(IWDGroup.class,null);
rootElement.addChild(group);
/* This allows keep other code unchanged */
rootElement = group;

VS

Former Member
0 Kudos

Hi,VS

The problem was able to be solved.

Thank you very much.

Regards,

Answers (0)