Author: julien_viet
Date: 2010-02-26 17:29:58 -0500 (Fri, 26 Feb 2010)
New Revision: 1891
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Decorated.java
Modified:
portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
Log:
added a Decorated mixin that gathers the properties of something visual that is decorated,
will be useful for GTNPORTAL-180 (Nothing happens when check or un-check Show Infor bar,
Show Portlet Mode and Show Window State in dashboard portlet)
Modified: portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml 2010-02-26
21:53:44 UTC (rev 1890)
+++ portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml 2010-02-26
22:29:58 UTC (rev 1891)
@@ -40,4 +40,21 @@
</propertyDefinitions>
</nodeType>
+ <nodeType name="gtn:decorated" isMixin="true"
hasOrderableChildNodes="false" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="gtn:showinfobar"
requiredType="Boolean" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false"
multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="gtn:showwindowstate"
requiredType="Boolean" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false"
multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="gtn:showmode"
requiredType="Boolean" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false"
multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ <propertyDefinition name="gtn:theme" requiredType="String"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
</nodeTypes>
Added:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Decorated.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Decorated.java
(rev 0)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Decorated.java 2010-02-26
22:29:58 UTC (rev 1891)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop;
+
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.Property;
+
+/**
+ * An object that has a surrounding configurable decoration.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+@MixinType(name = "gtn:decorated")
+public abstract class Decorated
+{
+
+ @Property(name = "gtn:showinfobar", defaultValue = "false")
+ public abstract boolean getShowInfoBar();
+
+ public abstract void setShowInfoBar(boolean showInfoBar);
+
+ @Property(name = "gtn:showmode", defaultValue = "false")
+ public abstract boolean getShowMode();
+
+ public abstract void setShowMode(boolean showMode);
+
+ @Property(name = "gtn:showwindowstate", defaultValue = "false")
+ public abstract boolean getShowWindowState();
+
+ public abstract void setShowWindowState(boolean showWindowState);
+
+ @Property(name = "gtn:theme")
+ public abstract String getTheme();
+
+ public abstract void setTheme(String theme);
+
+}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2010-02-26
21:53:44 UTC (rev 1890)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2010-02-26
22:29:58 UTC (rev 1891)
@@ -74,15 +74,6 @@
public static final Key<String> VISIBILITY = Key.create("visibility",
ValueType.STRING);
/** . */
- public static final Key<Boolean> SHOW_INFO_BAR =
Key.create("show-info-bar", ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_STATE = Key.create("show-state",
ValueType.BOOLEAN);
-
- /** . */
- public static final Key<Boolean> SHOW_MODE = Key.create("show-mode",
ValueType.BOOLEAN);
-
- /** . */
public static final Key<String> LOCALE = Key.create("locale",
ValueType.STRING);
/** . */
@@ -96,7 +87,4 @@
/** . */
public static final Key<String> TYPE = Key.create("type",
ValueType.STRING);
-
- /** . */
- public static final Key<String> THEME = Key.create("theme",
ValueType.STRING);
}
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-02-26
21:53:44 UTC (rev 1890)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-02-26
22:29:58 UTC (rev 1891)
@@ -24,6 +24,7 @@
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.CloneApplicationState;
+import org.exoplatform.portal.mop.Decorated;
import org.exoplatform.portal.mop.Described;
import org.exoplatform.portal.mop.ProtectedResource;
import org.exoplatform.portal.config.model.PersistentApplicationState;
@@ -86,10 +87,6 @@
private static final Set<String> windowPropertiesBlackList =
Tools.set(
MappedAttributes.TYPE.getName(),
- MappedAttributes.THEME.getName(),
- MappedAttributes.SHOW_INFO_BAR.getName(),
- MappedAttributes.SHOW_STATE.getName(),
- MappedAttributes.SHOW_MODE.getName(),
MappedAttributes.ICON.getName(),
MappedAttributes.WIDTH.getName(),
MappedAttributes.HEIGHT.getName());
@@ -853,6 +850,20 @@
Described described = src.adapt(Described.class);
//
+ boolean showInfoBar = false;
+ boolean showWindowState = false;
+ boolean showMode = false;
+ String theme = null;
+ if (src.isAdapted(Decorated.class))
+ {
+ Decorated decorated = src.adapt(Decorated.class);
+ showInfoBar = decorated.getShowInfoBar();
+ showWindowState = decorated.getShowWindowState();
+ showMode = decorated.getShowMode();
+ theme = decorated.getTheme();
+ }
+
+ //
return new ApplicationData<S>(
src.getObjectId(),
src.getName(),
@@ -862,10 +873,10 @@
described.getName(),
attrs.getValue(MappedAttributes.ICON),
described.getDescription(),
- attrs.getValue(MappedAttributes.SHOW_INFO_BAR),
- attrs.getValue(MappedAttributes.SHOW_STATE),
- attrs.getValue(MappedAttributes.SHOW_MODE),
- attrs.getValue(MappedAttributes.THEME),
+ showInfoBar,
+ showWindowState,
+ showMode,
+ theme,
attrs.getValue(MappedAttributes.WIDTH),
attrs.getValue(MappedAttributes.HEIGHT),
Utils.safeImmutableMap(properties),
@@ -883,11 +894,14 @@
described.setName(src.getTitle());
described.setDescription(src.getDescription());
+ Decorated decorated = dst.adapt(Decorated.class);
+ decorated.setShowInfoBar(src.isShowInfoBar());
+ decorated.setShowMode(src.isShowApplicationMode());
+ decorated.setShowWindowState(src.isShowApplicationState());
+ decorated.setTheme(src.getTheme());
+
+ //
Attributes attrs = dst.getAttributes();
- attrs.setValue(MappedAttributes.THEME, src.getTheme());
- attrs.setValue(MappedAttributes.SHOW_INFO_BAR, src.isShowInfoBar());
- attrs.setValue(MappedAttributes.SHOW_STATE, src.isShowApplicationState());
- attrs.setValue(MappedAttributes.SHOW_MODE, src.isShowApplicationMode());
attrs.setValue(MappedAttributes.ICON, src.getIcon());
attrs.setValue(MappedAttributes.WIDTH, src.getWidth());
attrs.setValue(MappedAttributes.HEIGHT, src.getHeight());
Modified:
portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml
===================================================================
---
portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml 2010-02-26
21:53:44 UTC (rev 1890)
+++
portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml 2010-02-26
22:29:58 UTC (rev 1891)
@@ -180,6 +180,7 @@
<value>org.exoplatform.portal.pom.spi.wsrp.WSRPState</value>
<value>org.exoplatform.portal.mop.ProtectedResource</value>
<value>org.exoplatform.portal.mop.Described</value>
+ <value>org.exoplatform.portal.mop.Decorated</value>
</values-param>
</init-params>
</component-plugin>
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2010-02-26
21:53:44 UTC (rev 1890)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2010-02-26
22:29:58 UTC (rev 1891)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.config;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.portal.mop.Decorated;
import org.exoplatform.portal.mop.Described;
import org.exoplatform.portal.mop.ProtectedResource;
import org.exoplatform.portal.pom.config.POMSession;
@@ -214,11 +215,12 @@
Described application1Described = application1.adapt(Described.class);
assertEquals("application_1_title", application1Described.getName());
assertEquals("application_1_description",
application1Described.getDescription());
+ Decorated application1Decorated = application1.adapt(Decorated.class);
+ assertEquals("application_1_theme", application1Decorated.getTheme());
+ assertEquals(true, application1Decorated.getShowInfoBar());
+ assertEquals(true, application1Decorated.getShowMode());
+ assertEquals(true, application1Decorated.getShowWindowState());
Attributes application1Attrs = application1.getAttributes();
- assertEquals("application_1_theme",
application1Attrs.getString("theme"));
- assertEquals(true,
(boolean)application1Attrs.getBoolean("show-info-bar"));
- assertEquals(true, (boolean)application1Attrs.getBoolean("show-state"));
- assertEquals(true, (boolean)application1Attrs.getBoolean("show-mode"));
assertEquals("application_1_icon",
application1Attrs.getString("icon"));
assertEquals("application_1_width",
application1Attrs.getString("width"));
assertEquals("application_1_height",
application1Attrs.getString("height"));
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2010-02-26
21:53:44 UTC (rev 1890)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2010-02-26
22:29:58 UTC (rev 1891)
@@ -265,6 +265,7 @@
<value>org.exoplatform.portal.pom.spi.wsrp.WSRPState</value>
<value>org.exoplatform.portal.mop.ProtectedResource</value>
<value>org.exoplatform.portal.mop.Described</value>
+ <value>org.exoplatform.portal.mop.Decorated</value>
</values-param>
<properties-param>
<name>options</name>