cancel
Showing results for 
Search instead for 
Did you mean: 

Create dinamic HorizontalGutter

Former Member
0 Kudos

Hello I'm creating the following HorizontalGutter dinamicly and I have

the exception: ( java.lang.ClassCastException )

IWDHorizontalGutter gut =

(IWDHorizontalGutter) view.createElement(

IWDHorizontalGutter.class,

"Gutter1" + index);

Does anybody know what is left?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

//@@begin javadoc:createUIeleOrg()

/** Declared method. */

//@@end

public void createUIeleOrg( int index, com.sap.tc.webdynpro.progmodel.api.IWDView view, comp.diageo.sims.wdp.IPrivateSearchPage.IOrganisationElement ele )

{

//@@begin createUIeleOrg()

IWDTransparentContainer org =

(IWDTransparentContainer) view.createElement(

IWDTransparentContainer.class,

SimsConstants.c_torg + index);

org.createLayout(IWDGridLayout.class);

IWDLinkToAction lto =

(IWDLinkToAction) view.createElement(

IWDLinkToAction.class,

SimsConstants.c_lto + index);

IWDAction linkAction =

wdThis.wdCreateAction(

IPrivateSearchPage.WDActionEventHandler.TO_ORG_DETAILS,

c_blank);

lto.setOnAction(linkAction);

lto.mappingOfOnAction().addParameter(

SimsConstants.c_orgid,

ele.getOrgID());

IWDCaption lab =

(IWDCaption) view.createElement(

IWDLabel.class,

SimsConstants.c_lb1 + index);

IWDCaption lab2 =

(IWDCaption) view.createElement(

IWDCaption.class,

SimsConstants.c_lb2 + index);

IWDCaption lab3 =

(IWDCaption) view.createElement(

IWDCaption.class,

SimsConstants.c_lb3 + index);

IWDHorizontalGutter gut =

(IWDHorizontalGutter) view.createElement(

IWDHorizontalGutter.class,

SimsConstants.c_gut + index);

lto.setText(SimsConstants.c_title + ele.getOrgName());

lab.setText(SimsConstants.c_address + ele.getOrgAddress());

lab2.setText(SimsConstants.c_showner + ele.getOrgOwner());

lab3.setText(SimsConstants.c_comment + ele.getOrgNotes());

org.addChild(lto);

org.addChild(lab);

org.addChild(lab2);

org.addChild(lab3);

org.addChild(gut);

IWDTransparentContainer tc =

(IWDTransparentContainer) view.getElement(SimsConstants.c_transorg);

tc.addChild(org, index);

//@@end

}

The code before insert the Gutter part was working, only after insert the part corresponding to the gutter, an exception is raised.

Former Member
0 Kudos

This is wrong:

IWDCaption lab =

(IWDCaption) view.createElement(

<b>IWDLabel.class</b>,

SimsConstants.c_lb1 + index);

And you don't need to create unique IDs for "anonymous" elements that you don't want to reference later via ID, just pass NULL as ID.

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

Code looks correct (perhaps you might pass NULL as ID).

Please post complete stacktrace.

Armin