PDA

View Full Version : Portal: How to get all Portlets?



lgdito
7 Jul 2009, 2:53 AM
Hi all!

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:
I made a Portal 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)

Now the 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?

What is the best practice for this functionallity?

Thanks all for your tips!

Lars.