1
14
15 package com.liferay.portal.kernel.portlet;
16
17 import javax.portlet.WindowState;
18
19 import javax.servlet.http.HttpServletRequest;
20
21
26 public class LiferayWindowState extends WindowState {
27
28 public final static WindowState EXCLUSIVE = new WindowState("exclusive");
29
30 public final static WindowState POP_UP = new WindowState("pop_up");
31
32 public static boolean isExclusive(HttpServletRequest request) {
33 String state = request.getParameter("p_p_state");
34
35 if ((state != null) && (state.equals(EXCLUSIVE.toString()))) {
36 return true;
37 }
38 else {
39 return false;
40 }
41 }
42
43 public static boolean isMaximized(HttpServletRequest request) {
44 String state = request.getParameter("p_p_state");
45
46 if ((state != null) &&
47 (state.equals(WindowState.MAXIMIZED.toString()))) {
48
49 return true;
50 }
51 else {
52 return false;
53 }
54 }
55
56 public static boolean isPopUp(HttpServletRequest request) {
57 String state = request.getParameter("p_p_state");
58
59 if ((state != null) && (state.equals(POP_UP.toString()))) {
60 return true;
61 }
62 else {
63 return false;
64 }
65 }
66
67 public static boolean isWindowStatePreserved(
68 WindowState oldWindowState, WindowState newWindowState) {
69
70
72 if ((newWindowState != null) &&
73 (newWindowState.equals(LiferayWindowState.EXCLUSIVE))) {
74
75 return true;
76 }
77
78
80 if ((oldWindowState != null) &&
81 (oldWindowState.equals(LiferayWindowState.POP_UP))) {
82
83 return false;
84 }
85 else {
86 return true;
87 }
88 }
89
90 public LiferayWindowState(String name) {
91 super(name);
92 }
93
94 }