Author: trong.tran
Date: 2011-08-14 05:48:47 -0400 (Sun, 14 Aug 2011)
New Revision: 7099
Added:
portal/trunk/component/web/resources/src/main/java/gatein_resources_1_2.xsd
portal/trunk/component/web/resources/src/test/resources/org/exoplatform/portal/resource/gatein-resources-1_2.xml
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinConfig.java
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinModule.java
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestGateInResourceParser.java
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestXSDCorruption.java
portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml
portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
GTNPORTAL-1450 Priority for skin modules
Added: portal/trunk/component/web/resources/src/main/java/gatein_resources_1_2.xsd
===================================================================
--- portal/trunk/component/web/resources/src/main/java/gatein_resources_1_2.xsd
(rev 0)
+++ portal/trunk/component/web/resources/src/main/java/gatein_resources_1_2.xsd 2011-08-14
09:48:47 UTC (rev 7099)
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<!--
+ ~ 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.
+ -->
+
+<xs:schema
+
targetNamespace="http://www.gatein.org/xml/ns/gatein_resources_1_2&q...
+
xmlns="http://www.gatein.org/xml/ns/gatein_resources_1_2"
+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <!-- The root element type that contains the various resource declarations -->
+ <xs:element name="gatein-resources">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="portal-skin" type="portal-skin" />
+ <xs:element name="portlet-skin" type="portlet-skin" />
+ <xs:element name="window-style" type="window-style" />
+ <xs:element name="javascript" type="javascript" />
+ <xs:element name="resource-bundle" type="resource-bundle"
/>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Declares a portal skin resource -->
+ <xs:complexType name="portal-skin">
+ <xs:sequence>
+ <xs:element name="skin-name" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+ <xs:element name="skin-module" type="xs:string"
minOccurs="0" maxOccurs="1"/>
+ <xs:element name="css-path" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+ <xs:element name="css-priority" type="xs:string"
minOccurs="0" maxOccurs="1"/>
+ <xs:element name="overwrite" type="xs:integer"
minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- Declares a portlet skin resource -->
+ <xs:complexType name="portlet-skin">
+ <xs:sequence>
+ <!-- The portlet application name -->
+ <xs:element name="application-name" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+
+ <!-- The portlet name -->
+ <xs:element name="portlet-name" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+
+ <!-- The name of the skin to load -->
+ <xs:element name="skin-name" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+
+ <!-- The css path of the skin relative to the application context -->
+ <xs:element name="css-path" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+
+ <!-- Overwrite -->
+ <xs:element name="overwrite" type="xs:string"
minOccurs="0" maxOccurs="1"/>
+
+ <!-- The css priority of the skin to indicate condition for sorting -->
+ <xs:element name="css-priority" type="xs:integer"
minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- Declares a window style -->
+ <xs:complexType name="window-style" mixed="true">
+ <xs:sequence>
+
+ <!-- The window style name -->
+ <xs:element name="style-name" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+
+ <!-- The window style theme -->
+ <xs:element name="style-theme" type="style-theme"
minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- The window style theme -->
+ <xs:complexType name="style-theme">
+ <xs:sequence>
+ <!-- The theme name -->
+ <xs:element name="theme-name" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- Declares a javascript resource -->
+ <xs:complexType name="javascript">
+ <xs:sequence>
+ <xs:element name="param" type="param" minOccurs="0"
maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="param">
+ <xs:sequence>
+ <!-- The javascript module -->
+ <xs:element name="js-module" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+
+ <!-- The javascript path -->
+ <xs:element name="js-path" type="xs:string"
minOccurs="1" maxOccurs="1"/>
+
+ <!-- The javascript priority -->
+ <xs:element name="js-priority" type="xs:string"
minOccurs="0" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- Declares a resource bundle -->
+ <xs:complexType name="resource-bundle">
+ </xs:complexType>
+
+</xs:schema>
\ No newline at end of file
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java
===================================================================
---
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -39,6 +39,8 @@
private final String cssPath_;
private final String id_;
+
+ private final int cssPriority_;
public SimpleSkin(SkinService service, String module, String name, String cssPath)
{
@@ -47,8 +49,24 @@
name_ = name;
cssPath_ = cssPath;
id_ = module.replace('/', '_');
+ cssPriority_ = -1;
}
+ public SimpleSkin(SkinService service, String module, String name, String cssPath,
Integer cssPriority)
+ {
+ service_ = service;
+ module_ = module;
+ name_ = name;
+ cssPath_ = cssPath;
+ id_ = module.replace('/', '_');
+ cssPriority_ = cssPriority != null ? cssPriority : -1;
+ }
+
+ public int getCSSPriority()
+ {
+ return cssPriority_;
+ }
+
public String getId()
{
return id_;
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinConfig.java
===================================================================
---
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinConfig.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinConfig.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -48,5 +48,12 @@
* @return the css path
*/
String getCSSPath();
+
+ /**
+ * Returns the priority number
+ *
+ * @return the priority number
+ */
+ int getCSSPriority();
}
\ No newline at end of file
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java
===================================================================
---
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/SkinService.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -51,6 +51,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
@@ -184,7 +185,7 @@
/**
* add category into portletThemes_ if portletThemes does not contain one
- * @param categoryName: category's name that want to add into portletThemes
+ * @param categoryName: category's name that wangt to add into portletThemes
*/
public void addCategoryTheme(String categoryName)
{
@@ -272,9 +273,104 @@
rtCache.remove(cssPath);
}
+ /**
+ * Register the stylesheet for a portal Skin. Do not replace any previous skin.
Support priority
+ *
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ * @param cssPriority
+ * priority to support sorting in skin list
+ */
+ public void addPortalSkin(String module, String skinName, String cssPath,
ServletContext scontext, Integer cssPriority)
+ {
+ addPortalSkin(module, skinName, cssPath, scontext, false, cssPriority);
+ }
/**
+ * Register the stylesheet for a portal Skin. Support priority
*
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ * @param overwrite
+ * if any previous skin should be replaced by that one
+ * @param cssPriority
+ * priority to support sorting in skin list
+ */
+ public void addPortalSkin(String module, String skinName, String cssPath,
ServletContext scontext, boolean overwrite, Integer cssPrioriry)
+ {
+ availableSkins_.add(skinName);
+ SkinKey key = new SkinKey(module, skinName);
+ SkinConfig skinConfig = portalSkins_.get(key);
+ if (skinConfig == null || overwrite)
+ {
+ skinConfig = new SimpleSkin(this, module, skinName, cssPath, cssPrioriry);
+ portalSkins_.put(key, skinConfig);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Adding Portal skin : Bind " + key + " to " +
skinConfig);
+ }
+ }
+ }
+
+ /**
+ * Register the stylesheet for a portal Skin. Support priority
+ *
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param cssData
+ * the content of css
+ * @param cssPriority
+ * priority to support sorting in skin list
+ */
+ public void addPortalSkin(String module, String skinName, String cssPath, String
cssData, Integer cssPriority)
+ {
+ SkinKey key = new SkinKey(module, skinName);
+ SkinConfig skinConfig = portalSkins_.get(key);
+ if (skinConfig == null)
+ {
+ portalSkins_.put(key, new SimpleSkin(this, module, skinName, cssPath,
cssPriority));
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Adding Portal skin : Bind " + key + " to " +
skinConfig);
+ }
+ }
+ try
+ {
+ StringWriter output = new StringWriter();
+ compressor.compress(new StringReader(cssData), output,
ResourceType.STYLESHEET);
+ cssData = output.toString();
+ }
+ catch (Exception e)
+ {
+ log.debug("Error when compressing CSS, will use normal CSS instead",
e);
+ }
+ ltCache.put(cssPath, new CachedStylesheet(cssData));
+ rtCache.put(cssPath, new CachedStylesheet(cssData));
+ }
+
+ /**
+ *
* Register the Skin for available portal Skins. Do not override previous skin
*
* @param module
@@ -342,6 +438,36 @@
skinConfigs_.put(key, skinConfig);
}
}
+
+ /**
+ *
+ * Register the Skin for available portal Skins. Support priority
+ *
+ * @param module
+ * skin module identifier
+ * @param skinName
+ * skin name
+ * @param cssPath
+ * path uri to the css file. This is relative to the root context,
+ * use leading '/'
+ * @param scontext
+ * the webapp's {@link javax.servlet.ServletContext}
+ * @param overwrite
+ * if any previous skin should be replaced by that one
+ * @param cssPriority
+ * priority to support sorting in skin list
+ */
+ public void addSkin(String module, String skinName, String cssPath, ServletContext
scontext, boolean overwrite, Integer cssPriority)
+ {
+ availableSkins_.add(skinName);
+ SkinKey key = new SkinKey(module, skinName);
+ SkinConfig skinConfig = skinConfigs_.get(key);
+ if (skinConfig == null || overwrite)
+ {
+ skinConfig = new SimpleSkin(this, module, skinName, cssPath, cssPriority);
+ skinConfigs_.put(key, skinConfig);
+ }
+ }
/**
*
@@ -502,12 +628,26 @@
public Collection<SkinConfig> getPortalSkins(String skinName)
{
Set<SkinKey> keys = portalSkins_.keySet();
- Collection<SkinConfig> portalSkins = new ArrayList<SkinConfig>();
+ List<SkinConfig> portalSkins = new ArrayList<SkinConfig>();
for (SkinKey key : keys)
{
if (key.getName().equals(skinName))
portalSkins.add(portalSkins_.get(key));
}
+ Collections.sort(portalSkins, new Comparator<SkinConfig>()
+ {
+ public int compare(SkinConfig o1, SkinConfig o2)
+ {
+ if (o1.getCSSPriority() == o2.getCSSPriority())
+ return 1;//Can indicate others condition here
+ else if (o1.getCSSPriority() < 0)
+ return 1;
+ else if (o2.getCSSPriority() < 0)
+ return -1;
+ else
+ return o1.getCSSPriority() - o2.getCSSPriority();
+ }
+ });
return portalSkins;
}
@@ -910,4 +1050,4 @@
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(deployer);
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(removal);
}
-}
\ No newline at end of file
+}
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinModule.java
===================================================================
---
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinModule.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinModule.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -33,6 +33,7 @@
protected String skinName;
protected String cssPath;
protected boolean overwrite;
+ protected String cssPriority;
public AbstractSkinModule(String name)
{
@@ -70,6 +71,16 @@
setOverwrite("true".equals(overwrite));
}
+ protected void bindingCSSPriority(Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(SkinConfigParser.CSS_PRIORITY_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ this.cssPriority = nodes.item(0).getFirstChild().getNodeValue();
+ }
+
public void setSkinName(String name)
{
this.skinName = name;
@@ -85,4 +96,9 @@
{
this.overwrite = _overwrite;
}
+
+ public void setCSSPriority(String _cssPriority)
+ {
+ this.cssPriority = _cssPriority;
+ }
}
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java
===================================================================
---
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -67,6 +67,7 @@
bindingSkinName(elemt);
bindingModuleName(elemt);
bindingOverwrite(elemt);
+ bindingCSSPriority(elemt);
}
public void execute(SkinService skinService, ServletContext scontext)
@@ -77,7 +78,14 @@
}
String contextPath = scontext.getContextPath();
String fullCSSPath = contextPath + cssPath;
- skinService.addPortalSkin(moduleName, skinName, fullCSSPath, scontext, overwrite);
+ Integer iCssPriority = null;
+ try
+ {
+ iCssPriority = Integer.valueOf(cssPriority);
+ } catch (Exception e) {
+ //Don't set cssPriority when it is not a numarical
+ }
+ skinService.addPortalSkin(moduleName, skinName, fullCSSPath, scontext, overwrite,
iCssPriority);
updateSkinDependentManager(contextPath, moduleName, skinName);
}
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java
===================================================================
---
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -93,7 +93,14 @@
String moduleName = applicationName + "/" + portletName;
String contextPath = scontext.getContextPath();
String fullCSSPath = contextPath + cssPath;
- skinService.addSkin(moduleName, skinName, fullCSSPath, scontext, overwrite);
+ Integer iCSSPriority = null;
+ try
+ {
+ iCSSPriority = Integer.valueOf(cssPriority);
+ } catch (Exception e) {
+ //Don't set cssPriority when it is not a numerical
+ }
+ skinService.addSkin(moduleName, skinName, fullCSSPath, scontext, overwrite,
iCSSPriority);
updateSkinDependentManager(contextPath, moduleName, skinName);
}
@@ -109,7 +116,8 @@
bindingPortletName(elemt);
bindingCSSPath(elemt);
bindingSkinName(elemt);
- bindingOverwrite(elemt);
+ bindingOverwrite(elemt);
+ bindingCSSPriority(elemt);
}
}
Modified:
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java
===================================================================
---
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -52,10 +52,16 @@
public static final String GATEIN_RESOURCES_1_1_SYSTEM_ID =
"http://www.gatein.org/xml/ns/gatein_resources_1_1";
/** . */
+ public static final String GATEIN_RESOURCES_1_2_SYSTEM_ID =
"http://www.gatein.org/xml/ns/gatein_resources_1_2";
+
+ /** . */
private static final String GATEIN_RESOURCE_1_0_XSD_PATH =
"gatein_resources_1_0.xsd";
/** . */
private static final String GATEIN_RESOURCE_1_1_XSD_PATH =
"gatein_resources_1_1.xsd";
+
+ /** . */
+ private static final String GATEIN_RESOURCE_1_2_XSD_PATH =
"gatein_resources_1_2.xsd";
/** . */
private static final XMLValidator VALIDATOR;
@@ -83,6 +89,9 @@
/** . */
final public static String CSS_PATH_TAG = "css-path";
+
+ /** . */
+ final public static String CSS_PRIORITY_TAG = "css-priority";
/** . */
final public static String WINDOW_STYLE_TAG = "window-style";
@@ -101,6 +110,7 @@
Map<String, String> systemIdToResourcePath = new HashMap<String,
String>();
systemIdToResourcePath.put(GATEIN_RESOURCES_1_0_SYSTEM_ID,
GATEIN_RESOURCE_1_0_XSD_PATH);
systemIdToResourcePath.put(GATEIN_RESOURCES_1_1_SYSTEM_ID,
GATEIN_RESOURCE_1_1_XSD_PATH);
+ systemIdToResourcePath.put(GATEIN_RESOURCES_1_2_SYSTEM_ID,
GATEIN_RESOURCE_1_2_XSD_PATH);
VALIDATOR = new XMLValidator(SkinConfigParser.class, systemIdToResourcePath);
}
Modified:
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestGateInResourceParser.java
===================================================================
---
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestGateInResourceParser.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestGateInResourceParser.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -27,6 +27,10 @@
assertDescriptorCanBeLoaded("org/exoplatform/portal/resource/gatein-resources-1_1.xml");
}
+ public void testResources1_2() throws MalformedURLException
+ {
+
assertDescriptorCanBeLoaded("org/exoplatform/portal/resource/gatein-resources-1_2.xml");
+ }
private void assertDescriptorCanBeLoaded(String descriptorPath) throws
MalformedURLException
{
URL url =
Thread.currentThread().getContextClassLoader().getResource(descriptorPath);
Modified:
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestXSDCorruption.java
===================================================================
---
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestXSDCorruption.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/component/web/resources/src/test/java/org/exoplatform/portal/resource/TestXSDCorruption.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -55,9 +55,10 @@
assertEquals(expected, sb.toString());
}
- public void testGateInResources1_0() throws Exception
+ public void testGateInResources1_x() throws Exception
{
assertHash("c68ea6831c3d24a242f63abd2db261a6",
"gatein_resources_1_0.xsd");
assertHash("c55b7e0dc8ae23e2d34430b38260cd96",
"gatein_resources_1_1.xsd");
+ assertHash("378178d66c1efacf87619c3c60a4cbf6",
"gatein_resources_1_2.xsd");
}
}
\ No newline at end of file
Added:
portal/trunk/component/web/resources/src/test/resources/org/exoplatform/portal/resource/gatein-resources-1_2.xml
===================================================================
---
portal/trunk/component/web/resources/src/test/resources/org/exoplatform/portal/resource/gatein-resources-1_2.xml
(rev 0)
+++
portal/trunk/component/web/resources/src/test/resources/org/exoplatform/portal/resource/gatein-resources-1_2.xml 2011-08-14
09:48:47 UTC (rev 7099)
@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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.
+ -->
+<gatein-resources
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_resources_1_2
http://www.gatein.org/xml/ns/gatein_resources_1_2"
+
xmlns="http://www.gatein.org/xml/ns/gatein_resources_1_2">
+
+ <!-- Portal skins -->
+ <portal-skin>
+ <skin-name>Default</skin-name>
+ <skin-module>MyModule</skin-module>
+ <css-path>/skin/Stylesheet.css</css-path>
+ <css-priority>0</css-priority>
+ </portal-skin>
+
+ <!-- BannerPortlet skins -->
+
+ <portlet-skin>
+ <application-name>web</application-name>
+ <portlet-name>BannerPortlet</portlet-name>
+ <skin-name>Default</skin-name>
+ <css-path>/skin/portal/webui/component/UIBannerPortlet/DefaultStylesheet.css</css-path>
+ </portlet-skin>
+
+ <!-- FooterPortlet skins -->
+
+ <portlet-skin>
+ <application-name>web</application-name>
+ <portlet-name>FooterPortlet</portlet-name>
+ <skin-name>Default</skin-name>
+ <css-path>/skin/portal/webui/component/UIFooterPortlet/DefaultStylesheet.css</css-path>
+ </portlet-skin>
+
+ <!-- Simple window style -->
+ <window-style>
+ <style-name>Simple</style-name>
+ <style-theme>
+ <theme-name>SimpleBlue</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>SimpleViolet</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>SimpleOrange</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>SimplePink</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>SimpleGreen</theme-name>
+ </style-theme>
+ </window-style>
+
+ <!-- RoundConer window style -->
+ <window-style>
+ <style-name>RoundConer</style-name>
+ <style-theme>
+ <theme-name>RoundConerBlue</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>RoundConerViolet</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>RoundConerOrange</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>RoundConerPink</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>RoundConerGreen</theme-name>
+ </style-theme>
+ </window-style>
+
+ <!-- Shadow window style -->
+ <window-style>
+ <style-name>Shadow</style-name>
+ <style-theme>
+ <theme-name>ShadowBlue</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>ShadowViolet</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>ShadowOrange</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>ShadowPink</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>ShadowGreen</theme-name>
+ </style-theme>
+ </window-style>
+
+ <!-- MacStyle window style -->
+ <window-style>
+ <style-name>MacStyle</style-name>
+ <style-theme>
+ <theme-name>MacTheme</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>MacGray</theme-name>
+ </style-theme>
+ <style-theme>
+ <theme-name>MacGreenSteel</theme-name>
+ </style-theme>
+ </window-style>
+
+ <!-- VistaStyle window style -->
+ <window-style>
+ <style-name>VistaStyle</style-name>
+ <style-theme>
+ <theme-name>VistaTheme</theme-name>
+ </style-theme>
+ </window-style>
+
+ <javascript>
+ <param>
+ <js-module>eXo</js-module>
+ <js-path>/javascript/eXo.js</js-path>
+ <js-priority>0</js-priority>
+ </param>
+ </javascript>
+
+ <!-- CORE Javascripts -->
+ <javascript>
+ <param>
+ <js-module>eXo.core.Utils</js-module>
+ <js-path>/javascript/eXo/core/Util.js</js-path>
+ <js-priority>1</js-priority>
+ </param>
+ <param>
+ <js-module>eXo.core.DOMUtil</js-module>
+ <js-path>/javascript/eXo/core/DOMUtil.js</js-path>
+ <js-priority>1</js-priority>
+ </param>
+ <param>
+ <js-module>eXo.core.Browser</js-module>
+ <js-path>/javascript/eXo/core/Browser.js</js-path>
+ <js-priority>2</js-priority>
+ </param>
+ <param>
+ <js-module>eXo.core.MouseEventManager</js-module>
+ <js-path>/javascript/eXo/core/MouseEventManager.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.UIMaskLayer</js-module>
+ <js-path>/javascript/eXo/core/UIMaskLayer.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.Skin</js-module>
+ <js-path>/javascript/eXo/core/Skin.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.DragDrop</js-module>
+ <js-path>/javascript/eXo/core/DragDrop.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.DragDrop2</js-module>
+ <js-path>/javascript/eXo/core/DragDrop2.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.Topic</js-module>
+ <js-path>/javascript/eXo/core/Topic.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.JSON</js-module>
+ <js-path>/javascript/eXo/core/JSON.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.Cometd</js-module>
+ <js-path>/javascript/eXo/core/Cometd.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.Spliter</js-module>
+ <js-path>/javascript/eXo/core/Spliter.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.Notification</js-module>
+ <js-path>/javascript/eXo/core/Notification.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.Loader</js-module>
+ <js-path>/javascript/eXo/core/Loader.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.core.I18n</js-module>
+ <js-path>/javascript/eXo/core/I18n.js</js-path>
+ </param>
+ </javascript>
+
+ <!-- Gadget Javascripts -->
+ <javascript>
+ <param>
+ <js-module>eXo.gadget.UIGadget</js-module>
+ <js-path>/javascript/eXo/gadget/UIGadget.js</js-path>
+ </param>
+ </javascript>
+
+ <!-- WebUI Javascripts -->
+ <javascript>
+ <param>
+ <js-module>eXo.webui.UIItemSelector</js-module>
+ <js-path>/javascript/eXo/webui/UIItemSelector.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIForm</js-module>
+ <js-path>/javascript/eXo/webui/UIForm.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIPopup</js-module>
+ <js-path>/javascript/eXo/webui/UIPopup.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIPopupSelectCategory</js-module>
+ <js-path>/javascript/eXo/webui/UIPopupSelectCategory.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIPopupWindow</js-module>
+ <js-path>/javascript/eXo/webui/UIPopupWindow.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIHorizontalTabs</js-module>
+ <js-path>/javascript/eXo/webui/UIHorizontalTabs.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIPopupMenu</js-module>
+ <js-path>/javascript/eXo/webui/UIPopupMenu.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIDropDownControl</js-module>
+ <js-path>/javascript/eXo/webui/UIDropDownControl.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIRightClickPopupMenu</js-module>
+ <js-path>/javascript/eXo/webui/UIRightClickPopupMenu.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIVerticalSlideTabs</js-module>
+ <js-path>/javascript/eXo/webui/UIVerticalSlideTabs.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIPermissionSelectorTab</js-module>
+ <js-path>/javascript/eXo/webui/UIPermissionSelectorTab.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIDashboard</js-module>
+ <js-path>/javascript/eXo/webui/UIDashboard.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIDashboardUtil</js-module>
+ <js-path>/javascript/eXo/webui/UIDashboardUtil.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UINotification</js-module>
+ <js-path>/javascript/eXo/webui/UINotification.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIUserSelector</js-module>
+ <js-path>/javascript/eXo/webui/UIUserSelector.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UICombobox</js-module>
+ <js-path>/javascript/eXo/webui/UICombobox.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UICombobox</js-module>
+ <js-path>/javascript/eXo/webui/UIVirtualList.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.webui.UIColorPicker</js-module>
+ <js-path>/javascript/eXo/webui/UIColorPicker.js</js-path>
+ </param>
+ </javascript>
+
+ <!-- Portal Javascripts -->
+ <javascript>
+ <param>
+ <js-module>eXo.portal.PortalHttpRequest</js-module>
+ <js-path>/javascript/eXo/portal/PortalHttpRequest.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.portal.UIPortal</js-module>
+ <js-path>/javascript/eXo/portal/UIPortal.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.portal.UIWorkspace</js-module>
+ <js-path>/javascript/eXo/portal/UIWorkspace.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.portal.UIPortalControl</js-module>
+ <js-path>/javascript/eXo/portal/UIPortalControl.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.portal.PortalDragDrop</js-module>
+ <js-path>/javascript/eXo/portal/PortalDragDrop.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.portal.UIPortalNavigation</js-module>
+ <js-path>/javascript/eXo/portal/UIPortalNavigation.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.portal.UIMaskWorkspace</js-module>
+ <js-path>/javascript/eXo/portal/UIMaskWorkspace.js</js-path>
+ </param>
+ <param>
+ <js-module>eXo.portal.UIBrowseContent</js-module>
+ <js-path>/javascript/eXo/portal/UIBrowseContent.js</js-path>
+ </param>
+ </javascript>
+
+ <javascript>
+ <param>
+ <js-module>eXo.webui.UIPortlet</js-module>
+ <js-path>/javascript/eXo/webui/UIPortlet.js</js-path>
+ </param>
+ </javascript>
+</gatein-resources>
Modified:
portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
---
portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml 2011-08-14
09:48:47 UTC (rev 7099)
@@ -21,12 +21,13 @@
-->
<gatein-resources
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_resources_1_1
http://www.gatein.org/xml/ns/gatein_resources_1_1"
-
xmlns="http://www.gatein.org/xml/ns/gatein_resources_1_1">
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_resources_1_2
http://www.gatein.org/xml/ns/gatein_resources_1_2"
+
xmlns="http://www.gatein.org/xml/ns/gatein_resources_1_2">
<portal-skin>
<skin-name>SimpleSkin</skin-name>
<css-path>/skin/Stylesheet.css</css-path>
+ <css-priority>0</css-priority>
</portal-skin>
<!-- Skins for portlets in 'web' application -->
Modified: portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml 2011-08-14
09:44:03 UTC (rev 7098)
+++ portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml 2011-08-14
09:48:47 UTC (rev 7099)
@@ -21,12 +21,13 @@
-->
<gatein-resources
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_resources_1_1
http://www.gatein.org/xml/ns/gatein_resources_1_1"
-
xmlns="http://www.gatein.org/xml/ns/gatein_resources_1_1">
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_resources_1_2
http://www.gatein.org/xml/ns/gatein_resources_1_2"
+
xmlns="http://www.gatein.org/xml/ns/gatein_resources_1_2">
<portal-skin>
<skin-name>Default</skin-name>
<css-path>/skin/Stylesheet.css</css-path>
+ <css-priority>0</css-priority>
</portal-skin>
<!-- Simple window style -->
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-08-14
09:44:03 UTC (rev 7098)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-08-14
09:48:47 UTC (rev 7099)
@@ -59,6 +59,8 @@
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -377,9 +379,6 @@
*/
public Set<Skin> getPortletSkins()
{
- // Set to avoid repetition
- Set<Skin> skins = new HashSet<Skin>();
-
// Determine portlets visible on the page
List<UIPortlet> uiportlets = new ArrayList<UIPortlet>();
UIWorkingWorkspace uiWorkingWS = getChildById(UI_WORKING_WS_ID);
@@ -394,7 +393,8 @@
// Get portal portlets to filter since they are already in the portal
// skins
Set<SkinConfig> portletConfigs = getPortalPortletSkins();
-
+ List<SkinConfig> portletSkins = new ArrayList<SkinConfig>();
+
//
for (UIPortlet uiPortlet : uiportlets)
{
@@ -405,12 +405,28 @@
}
if (skinConfig != null && !portletConfigs.contains(skinConfig))
{
- skins.add(skinConfig);
+ portletSkins.add(skinConfig);
}
}
+ //Sort skins by priority
+ Collections.sort(portletSkins, new Comparator<SkinConfig>()
+ {
+ public int compare(SkinConfig o1, SkinConfig o2)
+ {
+ if (o1.getCSSPriority() == o2.getCSSPriority())
+ return 1;//Can indicate others condition here
+ else if (o1.getCSSPriority() < 0)
+ return 1;
+ else if (o2.getCSSPriority() < 0)
+ return -1;
+ else
+ return o1.getCSSPriority() - o2.getCSSPriority();
+ }
+ });
+
//
- return skins;
+ return (new HashSet<Skin>(portletSkins));
}
private SkinConfig getDefaultPortletSkinConfig(UIPortlet portlet)