Java EXT-GWT门户:如何获取所有portlet?

Java EXT-GWT门户:如何获取所有portlet?,java,gwt,gxt,Java,Gwt,Gxt,嗨,这是我的第一个问题 我只是用(Ext-)GWT迈出了第一步。我正在测试extgwt库,真的:这些库非常棒! 现在我的问题是: 是否可以为已定义的门户创建一种“清除门户”或“隐藏所有门户”? 或者我是否总是像上面的示例代码那样手动清除门户? 我的示例代码如下所示: //define the Portal, 2 columns, each 50% auf width, with borders and Backgroundcolor portal = new Portal(2); porta

嗨,这是我的第一个问题

我只是用(Ext-)GWT迈出了第一步。我正在测试extgwt库,真的:这些库非常棒! 现在我的问题是: 是否可以为已定义的门户创建一种“清除门户”或“隐藏所有门户”? 或者我是否总是像上面的示例代码那样手动清除门户? 我的示例代码如下所示:

//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);
因此,首先,这很好,看起来很棒:-)

现在我有一个手风琴菜单按钮。此按钮上的侦听器应隐藏门户中的所有portlet(此时为portletUser和portletVehicles),然后添加另一个portlet(例如portletCountries):

又是上面的问题;-) 是否可以为已定义的门户创建一种“清除门户”或“隐藏所有门户”? 或者我是否总是像上面的示例代码那样手动清除门户?

这种功能的最佳实践是什么

谢谢大家的提示

Lars.

我没有使用Ext GWT——但看看Javadoc for Portal,我会尝试两件事:

for (LayoutContainer c : portal.getItems()) {
    c.hide();
}
或者,更一般地说,在您自己的类中包装一个门户,该类记录门户中的portlet——然后您可以得到一个列表而不是列表

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