tags:

views:

640

answers:

1

Hi all this is my first Question here!

Im just making my first steps with (Ext-) GWT. I´m testing the Ext-GWT libraries and really: These are absolute great! Now my question: Is it possible to make a kind of "clear-Portal" or "hide all portles" for a defined Portal? Or have i always manually clear the portal like in my example code above? My sample code looks like this:

//define the Portal, 2 columns, each 50% auf width, with borders and Backgroundcolor
portal = new Portal(2);  
portal.setBorders(true);  
portal.setStyleAttribute("backgroundColor", "white");  
portal.setColumnWidth(0, .50);  
portal.setColumnWidth(1, .50);  

//define a Portlet for showing all Users
portletUser = new Portlet();  
portletUser.setHeading("Benutzer");  
configPanel(portletUser);  
portletUser.setLayout(new FitLayout());
CompUserList compUserList = new CompUserList();
portletUser.add(compUserList);  
portletUser.setHeight(250); 

//define a Portlet for showing all Vehicles
portletVehicles = new Portlet();  
portletVehicles.setHeading("Fahrzeuge");  
configPanel(portletVehicles);  
portletVehicles.setLayout(new FitLayout());
CompVehicleList compVehicleList = new CompVehicleList();
portletVehicles.add(compVehicleList);  
portletVehicles.setHeight(250);

//define a portlet for showing all countries
portletCountries = new Portlet();  
portletCountries.setHeading("Länder");  
configPanel(portletCountries);  
portletCountries.setLayout(new FitLayout());
CompCountryList compCountryList = new CompCountryList();
portletCountries.add(compCountryList);  
portletCountries.setHeight(250);

//add both Portlets to Portal
portal.add(portletUser, 0);
portal.add(portletVehicles, 1);

So first of all this works fine and looks great :-)

Now i have a a button in a accordeon menu. The Listener on this button should hide all portlets in the portal (at this time its the portletUser and portletVehicles) and then add another portlet (for example the portletCountries):

portletUser.hide();
portletVehicles.hide();
portal.add(portletCountries, 0)

Question from above again ;-) Is it possible to make a kind of "clear-Portal" or "hide all portles" for a defined Portal? Or have i always manually clear the portal like in my example code above?

What is the best practice for this functionallity?

Thanks all for your tips!

Lars.

A: 

I haven't used Ext-GWT -- but looking at the Javadoc for Portal there are two things I would try:

for (LayoutContainer c : portal.getItems()) {
    c.hide();
}

or, more generally, wrap a Portal in your own class which records the Portlets which are in the Portal -- then you can get a List rather than List.

tdavies