cancel
Showing results for 
Search instead for 
Did you mean: 

sample dynamic programming gridlayout

Former Member
0 Kudos

Hello *,

does anybody have a short example for dynamic programming the layout?

I don't have any idea how to create and arrange this.

//IWDUIElementContainer.createLayout(GridLayout.class)

//IWDUIElement.createLayoutData(???)

How can I edit this, e.g. the number of cols?

How do I set a childUIElement into a special column?

Thanks in advance,

Regards Mario

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Mario,

in wdDoMidifyView:


final IWDUIElementContainer c 
  = (IWDUIElementContainer)view.getElement("<some-id>");

final IWDGridLayout layout 
  = (IWDGridLayout)c.createLayout(IWDGridLayout.class);

/* 3 columns */
layout.setColCount(3)
/* rows are defined only by content */

final String[] texts 
  = {"A", "B", "C", "D", "E", "F", "G", "H", "I" };
final WDCellBackgroundDesign[] bckg 
  = {WDCellBackgroundDesign.PLAIN, WDCellBackgroundDesign.FILL2};

for (int i = 0; i < texts.length; i++)
{
  final IWDTextView tv = (IWDTextView)view.createElement(IWDTextView.class, null); 
  tv.setText(texts[ i ]);

  final IWDGridData cell 
    = (IWDGridData)tv.createLayoutData(IWDGridData.class);
  cell.setCellBackgroundDesign(bckg[ i % 2 ]);

  c.addElement( tv );
}

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Valery,

GREAT!

but:

c.addElement( tv ); --> syntax error

c.addChild(tv); --> worked!

Thanks a lot!

Regards Mario

Former Member
0 Kudos

Oops!

I were coding without IDE, only having SAP help at hand

VS

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mario,

Try out this code this should solve ur problem:

<b>For dynamic creation of Layouts:</b>

IWDTransparentContainer container = (IWDTransparentContainer)view.getElement("RootUIElementContainer");

IWDGroup group = (IWDGroup)view.createElement(IWDGroup.class,"NewGroup");

IWDLayout layout = (IWDLayout)group.createLayout(IWDGridLayout.class);

container.addChild(group);

<b>For inserting child inside this layout try out this:</b>

IWDTextView travel1 = (IWDTextView)view.createElement(IWDTextView.class,"Textview1");

travel1.setText(" Travel Expenditure :");

IWDLayoutData data1 = (IWDLayoutData)travel1.createLayoutData(IWDGridLayout.class);

travel1.setDesign(WDTextViewDesign.HEADER2);

group.addChild(travel1);

Hope this helps u,

Regards,

Nagarajan.