1 54 55 package org.exoplatform.services.wsrp.utils; 56 57 import javax.portlet.WindowState; 58 59 public class WindowStates implements java.io.Serializable { 60 private java.lang.String _value_; 61 private static java.util.HashMap _table_ = new java.util.HashMap (); 62 63 protected WindowStates(java.lang.String value) { 65 _value_ = value; 66 _table_.put(_value_, this); 67 } 68 69 public static final java.lang.String _normal = "wsrp:normal"; 71 public static final java.lang.String _minimized = "wsrp:minimized"; 72 public static final java.lang.String _maximized = "wsrp:maximized"; 73 public static final java.lang.String _solo = "wsrp:solo"; 74 public static final WindowStates normal = new WindowStates(_normal); 75 public static final WindowStates minimized = new WindowStates(_minimized); 76 public static final WindowStates maximized = new WindowStates(_maximized); 77 public static final WindowStates solo = new WindowStates(_solo); 78 79 public java.lang.String getValue() { 80 return _value_; 81 } 82 83 90 public static WindowStates fromValue(java.lang.String value) { 91 return (WindowStates) _table_.get(value); 92 } 93 94 101 public static WindowStates fromString(java.lang.String value) { 102 return fromValue(value); 103 } 104 105 public boolean equals(java.lang.Object obj) { 106 return (obj == this); 107 } 108 109 public int hashCode() { 110 return toString().hashCode(); 111 } 112 113 public java.lang.String toString() { 114 return _value_; 115 } 116 117 public java.lang.Object readResolve() throws java.io.ObjectStreamException { 118 return fromValue(_value_); 119 } 120 121 129 public static WindowState getJsrPortletStateFromWsrpState(WindowStates wsrpState) { 130 if (wsrpState == null) { 131 return WindowState.NORMAL; 132 } else if (wsrpState.equals(WindowStates.maximized)) { 133 return WindowState.MAXIMIZED; 134 } else if (wsrpState.equals(WindowStates.minimized)) { 135 return WindowState.MINIMIZED; 136 } else if (wsrpState.equals(WindowStates.normal)) { 137 return WindowState.NORMAL; 138 } 139 140 return WindowState.NORMAL; 141 } 142 143 152 public static WindowStates getWsrpStateFromJsrPortletState(WindowState portletState) { 153 if (portletState.equals(WindowState.MAXIMIZED)) { 154 return WindowStates.maximized; 155 } else if (portletState.equals(WindowState.MINIMIZED)) { 156 return WindowStates.minimized; 157 } else if (portletState.equals(WindowState.NORMAL)) { 158 return WindowStates.normal; 159 } 160 161 return WindowStates.normal; 162 } 163 164 public static String [] getWindowStatesAsStringArray() { 165 return (String []) _table_.keySet().toArray(); 166 } 167 } 168 | Popular Tags |