0

大家好,这是我在这里的第一个问题!

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

//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):

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

再次来自上面的问题;-) 是否可以为定义的门户制作一种“清除门户”或“隐藏所有门户”?还是我总是像上面的示例代码一样手动清除门户?

此功能的最佳实践是什么?

谢谢大家的提示!

拉斯。

4

1 回答 1

0

我没有使用过 Ext-GWT ——但是查看 Portal 的 Javadoc 有两件事我会尝试:

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

或者,更一般地,在您自己的类中包装一个门户,该类记录门户中的门户——然后您可以获得一个列表而不是列表。

于 2010-05-18T03:37:37.543 回答