EXT-GWT Portal:如何获取所有 Portlet?

发布于 2024-07-29 03:19:53 字数 1920 浏览 4 评论 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)

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

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

感谢大家的提示!

拉斯.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墨洒年华 2024-08-05 03:19:53

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

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

或者更一般地说,将 Portal 包装在您自己的类中,该类记录 Portal 中的 Portlet ——然后您可以得到一个List而不是List。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文