cancel
Showing results for 
Search instead for 
Did you mean: 

Visibillity

Former Member
0 Kudos

Hi,

i have radiobuttons and based on the selection parts should be shown or not. how can I do this in WD java?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

You can create a context attribute of type com.sap.ide.webdynpro.uielementdefinitions.Visibility.

And you can assign them to visible property of you UI elements.

You can use

wdContext.currentContextElement().set<ContextAttrName>(WDVisibilty.VISIBLE);

or

wdContext.currentContextElement().set<ContextAttrName>(WDVisibilty.NONE);

in the action of your onSelect event for radio button.

Regards,

Ajay

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi,

Create value attribute as "sample"

select that "sample" value attribute->properties->

Click on type->type selection window will pop up

->Dictionary simple type ->com.sap.ide.webdynpro.uielementdefinitions->visiblity

bind this "sample" value attribute required to visible property of UI elements.

wdContext.currentContextElement().set<ContextAttrName>(WDVisibilty.VISIBLE);

or

wdContext.currentContextElement().set<ContextAttrName>(WDVisibilty.NONE);

Regards

Suresh

Former Member
0 Kudos

Thanks

How can I implement it(I made the visibility type), i have the following code in the custom controler:

Y_Tf_Process_Reasons_Input inputPR = new Y_Tf_Process_Reasons_Input();

inputPR.setMainprocesskey(wdContext.currentYtf_MainprocessPLElement().getMainprocesskey());

wdContext.nodeY_Tf_Process_Reasons_Input().bind(inputPR);

try

{

wdContext.currentY_Tf_Process_Reasons_InputElement().modelObject().execute();

wdContext.nodeOutputPR().invalidate();

}

catch (Exception ex)

{

ex.printStackTrace();

}

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

This u have to do that in the view. The UI elements,

Will have the prorerty, set the visiblity as the above threads says. Then based on the condition make it blank or visible.

In the custom controller u have just executrd the bapi to get the values from backened.

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

like this?

wdThis.wdGetProcessStart_CustController().getY_Tf_Process_Reasons_Input(MAINPROCESSKEY);

wdContext.currentReasonsPRElement().setMainprocesskey(WDVisibilty.VISIBLE);

or

wdContext.currentcontextElement().setMainprocesskey(WDVisibilty.NONE);

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Are u setting the visiblity of the UI element then bind the attribute to the UI element.

Then Set the attribute value as

wdContext.currentcontextElement().set<attribute>(WDVisibilty.NONE);

Suppoose if u bind the Mainprocesskey attribute then the type of the property should be com....uielement.visiblity

.

But the Mainprocesskey is a bapi parameter.

Why u are setting there?

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Hi,

1.Create a attribute in component Controler named textvisible with type com.sap.ide.webdynpro.uielementdefinitions.Visibility

2.Bind the attribute to the View.

3. Bind the attribute to the UIelement's Property Visibillity which you want to hide.

Check the condition which deside the visibility of that element in view .You can check it in view or component controler.

set the visibility as follows

String param=wdContext.current<node>Element().get<Param>();

if(param.equals("<value>")){

wdContext.current<node>Element().set<textvisible>(WDVisibility.VISIBLE);

}else{

wdContext.current<node>Element().set<textvisible>(WDVisibility.NONE);

}

Kind Regards

Mukesh

Former Member
0 Kudos

It says that it is not applicable for the arguments:

//@@begin onActionLeadSelectProcess(ServerEvent)

wdThis.wdGetProcessStart_CustController().getY_Tf_Process_Reasons_Input(MAINPROCESSKEY);

String param=wdContext.currentReasonsPRElement().getMainprocesskey();

if(param.equals("<value>")){

wdContext.currentReasonsPRElement().setMainprocesskey(WDVisibility.VISIBLE);

}else{

wdContext.currentReasonsPRElement().setMainprocesskey(WDVisibility.NONE);

}

//@@end

}

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Once u execute the bapi,ucan get the values from the backened

For example the mainprocesskey

.

Then use the below code

String param=wdContext.currentReasonsPRElement().getMainprocesskey();

if(param.equals("<value>")){

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.VISIBLE);

}else{

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.NONE);

}

Hope this helps,

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Hi,

what is your need? what do you want to do with that visibility propoerty? please clarify.

Former Member
0 Kudos

I have a table (first they where radiobuttons) which only needs to be shown if the bapi gives data.

_______________________________________

The first set gives an invalid expression statement.

if(param.equals("<value>")){

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.VISIBLE);

}else{

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.NONE);

}

Former Member
0 Kudos

Eoin,

a small tip: The better you describe your problem/use case, the easier it is to give a solution.

So please describe

- what kind of radio buttons are you using, single buttons or radio button group

- How does your context structure look like

- Did you bind the "visible" property of all UI elements you want to show/hide to a context attribute of simple type "Visibility"

- Do you have a suitable point in processing where to set the value of this attribute (e.g. an event handler)

As an alternative, you could use a calculated attribute.

Armin

Former Member
0 Kudos

Hi

if the bapi give the data

IPrivate<ViewName>.I<BapiOutput>Node node=wdContext.node<BapiOutput>();

int size=node.size();

if(size>0){

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.VISIBLE);

}else{

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.NONE);

}

//

Give the complete code and error message

Kind Regards

Mukesh

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

If u need to show the table Visiblity the create the attribute tablevisiblity.

Bind this to table.

Then execute the bapi.

See weather any value is returned from backened.

String parm=<value from "output node">

if(parm.equals("<value>")){

wdContext.currentTableVisiblityElement().set<visiblity attribute>(WDVisibility.VISIBLE);

}else{

wdContext.currentTableVisiblityElement().set<visiblity attribute>(WDVisibility.NONE);

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

I have a table and on lead select there should be apperaing an other table if the bapi gives any data.

I made a value attribute with name WDVisibilty with type com.sap.ide.webdynpro.uielementdefinitions.Visibility

This value attribute I bind to the table (Visible). In the view I used the above coding.

Former Member
0 Kudos

hi,

create one Context value attribute. give the WDVisibility type to that attribute.

bind it with the table's visible property.

check the Bapi's output node if it's size=0 then set the visibility property to

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.NONE);

otherwise set

wdContext.currentContextElement().set<visiblity attribute>(WDVisibility.VISIBLE);

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

From the lead selection u get the value from bapi , if u have then set the visiblity properties of that table.

Regards

Vijayakhanna Raman

Former Member
0 Kudos

have a table and on lead select there should be apperaing an other table if the bapi gives any data.

I made a value attribute with name WDVisibilty with type com.sap.ide.webdynpro.uielementdefinitions.Visibility

This value attribute I bind to the table (Visible). In the view I used the coding in the view. But the table is still visible

wdThis.wdGetProcessStart_CustController().getY_Tf_Process_Reasons_Input(MAINPROCESSKEY);

IPrivateStartProcessView.IReasonsPRNode node=wdContext.nodeReasonsPR();

int size=node.size();

if(size>0){

wdContext.currentContextElement().setWDVisibilty(WDVisibility.VISIBLE);

}else{

wdContext.currentContextElement().setWDVisibilty(WDVisibility.NONE);

}

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

If the output node is nodeReasonsPR();

then

int size=wdContext.nodeReasonsPR().Size();

if(size>0){

wdContext.currentContextElement().setWDVisibilty(WDVisibility.VISIBLE);

}else{

wdContext.currentContextElement().setWDVisibilty(WDVisibility.NONE);

}

Print and see the size.

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

Hi,

for which table you bind the visibility property?

to the second one or the first? and did you check the size of the node?

Former Member
0 Kudos

second one (the one who need to disappear).

What do you mean with check the size?

Former Member
0 Kudos

Hi Cronan

check the Bapi's output node size. what is the result comes after executing the Bapi? if it returns any value then the size greater than '0'.

Former Member
0 Kudos

depants on the selection. it can be 0 or can be 2 or more entries

Former Member
0 Kudos

Hi,

First check the size of outputnode and ensure it by print the size and after set the visibility of attribute. Ensure that visiblity attribute is bind to the second

Regards

Saravanan K

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

use this to see the node size if its zero then nothing is returned from backened.

wdComponentAPI.getMessageManager().reportSuccess("Size of node"+size);

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

where should i put it Vijayakhanna Raman?

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

Have u bind the visiblity attribute to the second table

then U initially set the visiblity property to NONE in the initmethod();

Then in the leadsect method set the visiblity according to condition.

Regards,

Vijayakhanna Raman

Former Member
0 Kudos

thanks it solved the problem

Former Member
0 Kudos

Hi,

In ur leadSelect method just execute the RFC and then check this following code.

From the RFC node that gives ur output:

if(wdContext.nodeZ<Output node>.size()!=0)

{

wdContext.currentcontextElement.set<table visibility param>(WDVISIBILITY.VISIBLE);

}

else

{

wdComponentAPI.getMessageManager().reportException("No Values Found",true);

}

By this way u can check whether ur RFC is getting executed and if it is then the visibility will be proper.

Regards,

Nagarajan.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

You set the visibility to NONE in wdInit() of the view by

wdContext.currentContextElement().setWDVisibilty(WDVisibility.NONE);

so that the table won't be visible initially.

Regards,

Ajay

Former Member
0 Kudos

Ajay,

it stil stays visible..

former_member182372
Active Contributor
0 Kudos

Hi Eoin,

Create context attribute with type WDVisibility bind it with visibility property of UI elelment you need to gide/show. In onToggle action handler of CheckBoxGroup or CheckBox set visiblity to appropriate value.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi

check the lead Selection for the selected radio button and set the visibility occording to the condition.

String selected=wdContext.current<Radio>Element().get<Param>();

if(selectes.equals("<Value>")){

wdContext.current<Name>Element().set<Param>(WDVisibility.VISIBLE);

}

Bind the visibility attribute to the UI Element

Kind Regards

Mukesh