1
22
23 package com.liferay.portal.kernel.portlet;
24
25 import javax.portlet.WindowState;
26
27 import javax.servlet.http.HttpServletRequest;
28
29
35 public class LiferayWindowState extends WindowState {
36
37 public final static WindowState EXCLUSIVE = new WindowState("exclusive");
38
39 public final static WindowState POP_UP = new WindowState("pop_up");
40
41 public static boolean isExclusive(HttpServletRequest request) {
42 String state = request.getParameter("p_p_state");
43
44 if ((state != null) && (state.equals(EXCLUSIVE.toString()))) {
45 return true;
46 }
47 else {
48 return false;
49 }
50 }
51
52 public static boolean isMaximized(HttpServletRequest request) {
53 String state = request.getParameter("p_p_state");
54
55 if ((state != null) &&
56 (state.equals(WindowState.MAXIMIZED.toString()))) {
57
58 return true;
59 }
60 else {
61 return false;
62 }
63 }
64
65 public static boolean isPopUp(HttpServletRequest request) {
66 String state = request.getParameter("p_p_state");
67
68 if ((state != null) && (state.equals(POP_UP.toString()))) {
69 return true;
70 }
71 else {
72 return false;
73 }
74 }
75
76 public static boolean isWindowStatePreserved(
77 WindowState oldWindowState, WindowState newWindowState) {
78
79
81 if ((newWindowState != null) &&
82 (newWindowState.equals(LiferayWindowState.EXCLUSIVE))) {
83
84 return true;
85 }
86
87
89 if ((oldWindowState != null) &&
90 (oldWindowState.equals(LiferayWindowState.POP_UP))) {
91
92 return false;
93 }
94 else {
95 return true;
96 }
97 }
98
99 public LiferayWindowState(String name) {
100 super(name);
101 }
102
103 }