WindowState 表示了Portlet 窗口的状态
JSR-168规范定义了三种窗口状态,(标准,最大化,最小化)
- public class WindowState
- {
- public static final WindowState NORMAL = new WindowState("normal");
- public static final WindowState MAXIMIZED = new WindowState("maximized");
- public static final WindowState MINIMIZED = new WindowState("minimized");
- private String _name;
- public WindowState(String name)
- {
- if (name == null) {
- throw new IllegalArgumentException("WindowState name can not be NULL");
- }
- this._name = name.toLowerCase(Locale.ENGLISH);
- }
- public String toString()
- {
- return this._name;
- }
- public int hashCode()
- {
- return this._name.hashCode();
- }
- public boolean equals(Object object)
- {
- if (object instanceof WindowState) {
- return this._name.equals(((WindowState)object)._name);
- }
- return false;
- }
- }
最小化时候,render请求是被忽略的,而最大化时候,Portlet会显示一些额外信息。
-----
各种不同的Portal Server(比如Liferay)可以有自己的规范以外的特有的窗口状态
如何开发自定义窗口状态:
首先在portlet.xml的<supports>的<window-state>中声明这个Porlet所要支持的窗口状态,可以指定多个
- <portlet>
- <portlet-name>bookCatalog</portlet-name>
- <portlet-class>
- chapter03.code.listing.base.BookCatalogPortlet</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- <window-state>pop_up</window-state>
- ...
- </supports>
- ...
- </portlet>
然后在portlet应用级别,也就是在portlet.xml中所有<portlet>元素的外面,声明自定义窗口状态,注意,这个window-state必须被Portlet应用所部属的Portal Server所支持
- <portlet-app>
- <portlet>
- ..
- </portlet>
- <custom-window-state>
- <window-state>pop_up</window-state>
- </custom-window-state>
- ...
- </portlet-app>
本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/844316,如需转载请自行联系原作者