Amit Pal
Amit Pal

Reputation: 11052

How to disable and enable the visibility of Horizontal panel in GWT?

First of all i have to disable the Horizontal panel. I tried with the following code and it the panel was disabled.

public void hideNavigaton(){
    pagination.removeFromParent();
}

But i have to also enable the above panel after disabling it in following method definition:

public void showNavigation(){
    // Add definition to enable the visibility.
}

If anything is wrong , then what will be write or appropriate method to enable and disable the visibility of Horizontal panel?

Upvotes: 0

Views: 2379

Answers (2)

Andrei Volgin
Andrei Volgin

Reputation: 41089

If you want to simply hide and show the panel, use setVisible() as suggested by Daniel. In this case the panel will appear/disappear, but it will keep its place in the layout.

If you want the panel to completely disappear and give its space to another widget, you have to remove it from parent. Then you can add it back when you need it.

public void hideNavigaton(){
    pagination.removeFromParent();
}
public void showNavigation(){
    myParentWidget.add(pagination);
    // Set position of pagination widget if you don't do it through CSS
}

Upvotes: 0

To hide you call

pagination.setVisible(false)

and to show

pagination.setVisible(true)

Upvotes: 2

Related Questions