how to pass a String[] array in the declarative UI

Skip to first unread message

Marius Grama

Oct 31, 2012, 9:51:36 AM10/31/12
I have an own Button class which has a method
void setDisplayPermissions(String[] displayPermissions)
where it is specified for the button which are the required permissions needed for showing the button.

In the example bellow i can set that the button should be shown only when the user has the FINISH_ORDER function right.
<a:Button ui:field="finishButton" displayPermissions="{Rights.getFinishOrder}"/>

(Rights is an application specific class where there are getters defined for all the function rights names from the application)

Now I'd like to show this button when the user has FINISH_ORDER or CANCEL_ORDER function right.
Can anybody suggest me how to do this (elegantly) through the declarative UI within a .ui.xml file?

Thanks in advance.

Benjamin Possolo

Oct 31, 2012, 5:06:34 PM10/31/12
You are trying to add logic to your UiBinder XML file which is not what it is intended to do. View-specific logic goes in the java code.

Just do it in the constructor or if you are caching your views (which is good for performance) in a dedicated method that can be called before the view is rendered by your Activity.

For the sake of an example, lets assume your UiBinder class is called MyView.

public class MyView extends Composite {

//definition of UiBinder interface and instance

FinishButton finish;

public MyView(){

public MyView(Rights permissions){
public void updateUi(Rights permissions){
if( permissions == FINISH_ORDER || permissions == CANCEL_ORDER ) 

void onClickFinish(ClickEvent e){
//handle the click
Reply all
Reply to author
0 new messages