cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic space

Former Member
0 Kudos

All,

I need to create the empty space between label & button dynamically..

Actually i am creating the label & button at runtime..

Label Here
Button Here

I want a output like below:

Label Here
                      "GAP Here
Button Here

How can i do that?

Thanks..

BM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

For inserting vertical spacing, add a HorizontalGutter element as a separate row (using *HeadData as layout data).

Armin

Former Member
0 Kudos

Armin,

Could you pls explain me in detaill..

BM

Former Member
0 Kudos

Say you are using a MatrixLayout and want (why ever) to achieve the following layout:

Label

<space>

InputField

Then you can achieve this by adding a Label, a HorizontalGutter and an InputField to the parent container and assigning a MatrixHeadData to each (such that a new row is started).

The amount of space can be controlled using the "height" property of the HorizontalGutter, the "ruleType" should be set to NONE.

Armin

Former Member
0 Kudos

Armin,

I am creating label & buttons at runtime. THe classes are not having any methods..

Still my issue is not solved..

BM

Former Member
0 Kudos

What does that mean "THe classes are not having any methods"?

Just do something like:


IWDUIElementContainer panel = ...; /* assume MatrixLayout */

IWDLabel label = (IWDLabel) view.createElement(IWDLabel.class, null);
label.createLayoutData(IWDMatrixHeadData.class);
panel.addChild(label);

IWDHorizontalGutter vspace = (IWDHorizontalGutter) view.createElement(IWDHorizontalGutter.class, null);
vspace.createLayoutData(IWDMatrixHeadData.class);
vspace.setHeight(WDHorizontalDividerRuleHeight.SMALL);
vspace.setRuleType(WDHorizontalGutterRuleType.NONE);
panel.addChild(vspace);

IWDInputField input = (IWDInputField) view.createElement(IWDInputField.class, null);
input.createLayoutData(IWDMatrixHeadData.class);
input.bindValue("some_attribute");
label.setLabelFor(input.getId());
panel.addChild(input);

Armin

Former Member
0 Kudos

I have to use GridLayout. Still can i use the above code?

BM

Message was edited by:

Bharathi M

Former Member
0 Kudos

HI Bharati,

Try to get the space by adding a transparent container with height as below

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

IWDTransparentContainer heightContainer = (IWDTransparentContainer) view.createElement(IWDTransparentContainer.class,"HeightContainer");

l_trans_cont.setHeight("200px");

l_trans_cont.addChild(heightContainer);

Regards

Fahad Hamsa

Former Member
0 Kudos

No, but who forces you to use GridLayout?

Armin

Former Member
0 Kudos

Armin

As per the requirement, i need to created the Label iwht 10 buttons one after another as shows bwlow. But i need space between the Label & first button.

Label Here

Button Here

Button Here

Button Here

etc..

So Im using GridLayout with Col count 1.

BM

Former Member
0 Kudos

Fahad Hamsa,

You are simply awesome..It solved my problem..

Thanks..

BM

Former Member
0 Kudos

That no reason to use GridLayout, this can also be done using MatrixLayout or RowLayout.

Armin

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

Try this code,

IWDTransparentContainer tcont=(IWDTransparentContainer)view.getRootElement();

tcont.createLayout(IWDMatrixLayout.class);

IWDLabel lab=(IWDLabel)view.createElement(IWDLabel.class,"Label");

lab.createLayoutData(IWDMatrixHeadData.class);

lab.setDesign(WDLabelDesign.EMPHASIZED);

tcont.addChild(lab);

IWDInvisibleElement invisib = (IWDInvisibleElement) view.createElement(IWDInvisibleElement.class, "InvisibleEle");

tcont.addchild(invisib);

IWDButton button=(IWDButton)view.getElement("button1");

Former Member
0 Kudos

Hi,

IWDLabel label1 = (IWDLabel)view.createElement(IWDLabel.class,"lbl1");
		IWDGridData layout = (IWDGridData) label1.createLayoutData(IWDGridData.class);
		layout.setPaddingBottom("large");

Regards,

Naga

Former Member
0 Kudos

Hi Bharathi,

Try to create Web Dynpro InvisibleElement API - IWDInvisibleElement dynamically inbetween label and Button to fill the empty space. This element is used to fill the empty element in Grid layout.

With regards,

Laksh.

Former Member
0 Kudos

Hi Bharathi,

Similar to creating a Label and Button dynamically, you can create an Invisible

Element dynamically between the two.

Following is the code:

IWDTransparentContainer l_trans_cont = (IWDTransparentContainer) view.getElement("RootUIElementContainer");
    IWDInvisibleElement l_inv_ele = (IWDInvisibleElement) view.createElement(IWDInvisibleElement.class, "InvisibleEle0");
    l_trans_cont.addChild(l_inv_ele);

Hope it helps.

Regards,

Alka.

Former Member
0 Kudos

All.. I tried below code..But not expected result..


IWDTransparentContainer l_trans_cont = (IWDTransparentContainer) view.getElement("RootUIElementContainer");
    IWDInvisibleElement l_inv_ele = (IWDInvisibleElement) view.createElement(IWDInvisibleElement.class, "InvisibleEle0");
    l_trans_cont.addChild(l_inv_ele);

Pls help me..

BM

Former Member
0 Kudos

And also make the colcount for your group as 1

Former Member
0 Kudos

Hi Bharati,

Make the RootUIElementContainer or your Group layout as gridlayout and select the padding bottom as large for your label properties.

Regards,

Suresh