Author: julien_viet
Date: 2009-11-01 08:58:21 -0500 (Sun, 01 Nov 2009)
New Revision: 468
Added:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java
portal/branches/performance/packaging/profiles.xml.template
Removed:
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardMask.java
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardMask.gtmpl
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/skin/
portal/branches/performance/packaging/key.txt
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/conf/script/
portal/branches/performance/portlet/exoadmin/src/main/webapp/WEB-INF/conf/script/
portal/branches/performance/portlet/web/src/main/webapp/WEB-INF/conf/script/
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/script/groovy/SkinConfigScript.groovy
Modified:
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardContainer.gtmpl
portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
portal/branches/performance/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java
portal/branches/performance/gadgets/eXoGadgets/src/main/webapp/gadgets/Calculator/Calculator.xml
portal/branches/performance/packaging/pkg/pom.xml
portal/branches/performance/packaging/profiles.xml
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties
portal/branches/performance/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UIDashboardPortlet.gtmpl
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupExplorer.java
portal/branches/performance/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
portal/branches/performance/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/Browser.js
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
portal/branches/performance/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
portal/branches/performance/web/portal/src/main/webapp/groovy/webui/core/UIPopupWindow.gtmpl
portal/branches/performance/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
portal/branches/performance/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
GTPPORTAL-153 : Merge with trunk up to revision 467
Modified:
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java
===================================================================
---
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -19,6 +19,8 @@
package org.exoplatform.dashboard.webui.component;
+import org.exoplatform.portal.webui.application.UIGadget;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
@@ -32,7 +34,9 @@
@EventConfig(listeners = UIDashboardContainer.MoveGadgetActionListener.class),
@EventConfig(listeners = UIDashboardContainer.AddNewGadgetActionListener.class),
@EventConfig(listeners = UIDashboard.SetShowSelectContainerActionListener.class),
- @EventConfig(listeners = UIDashboardContainer.DeleteGadgetActionListener.class)})})
+ @EventConfig(listeners = UIDashboardContainer.DeleteGadgetActionListener.class),
+ @EventConfig(listeners = UIDashboard.MinimizeGadgetActionListener.class),
+ @EventConfig(listeners = UIDashboard.MaximizeGadgetActionListener.class)})})
public class UIDashboard extends UIContainer
{
@@ -42,6 +46,8 @@
private String aggregatorId;
+ private UIGadget maximizedGadget;
+
public UIDashboard() throws Exception
{
UIPopupWindow popup = addChild(UIPopupWindow.class, null, GADGET_POPUP_ID);
@@ -86,10 +92,19 @@
this.aggregatorId = aggregatorId;
}
- public static class SetShowSelectContainerActionListener extends
- EventListener<org.exoplatform.webui.core.UIContainer>
+ public UIGadget getMaximizedGadget()
{
- public final void execute(final Event<org.exoplatform.webui.core.UIContainer>
event) throws Exception
+ return maximizedGadget;
+ }
+
+ public void setMaximizedGadget(UIGadget gadget)
+ {
+ maximizedGadget = gadget;
+ }
+
+ public static class SetShowSelectContainerActionListener extends
EventListener<UIDashboard>
+ {
+ public final void execute(final Event<UIDashboard> event) throws Exception
{
UIDashboard uiDashboard = (UIDashboard)event.getSource();
if (!uiDashboard.canEdit())
@@ -106,4 +121,43 @@
}
}
}
+
+ public static class MinimizeGadgetActionListener extends
EventListener<UIDashboard>
+ {
+ public final void execute(final Event<UIDashboard> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UIDashboard uiDashboard = event.getSource();
+ String objectId = context.getRequestParameter(OBJECTID);
+ String minimized = context.getRequestParameter("minimized");
+
+ UIGadget uiGadget =
uiDashboard.getChild(UIDashboardContainer.class).getUIGadget(objectId);
+ uiGadget.getProperties().setProperty("minimized", minimized);
+ uiDashboard.getChild(UIDashboardContainer.class).save();
+ context.addUIComponentToUpdateByAjax(uiGadget);
+ }
+ }
+
+ public static class MaximizeGadgetActionListener extends
EventListener<UIDashboard>
+ {
+ public final void execute(final Event<UIDashboard> event) throws Exception
+ {
+ WebuiRequestContext context = event.getRequestContext();
+ UIDashboard uiDashboard = event.getSource();
+ String objectId = context.getRequestParameter(OBJECTID);
+ String maximize = context.getRequestParameter("maximize");
+ UIDashboardContainer uiDashboardCont =
uiDashboard.getChild(UIDashboardContainer.class);
+ UIGadget uiGadget = uiDashboardCont.getUIGadget(objectId);
+ if (maximize.equals("maximize"))
+ {
+ uiGadget.setView(UIGadget.CANVAS_VIEW);
+ uiDashboard.setMaximizedGadget(uiGadget);
+ }
+ else
+ {
+ uiGadget.setView(UIGadget.HOME_VIEW);
+ uiDashboard.setMaximizedGadget(null);
+ }
+ }
+ }
}
Modified:
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
---
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -29,6 +29,7 @@
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
+import org.exoplatform.web.application.RequestContext;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.InitParams;
@@ -106,7 +107,7 @@
{
return;
}
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ WebuiRequestContext context = RequestContext.getCurrentInstance();
windowId = ((PortletRequestContext)context).getRequest().getWindowID();
Param param = initParams.getParam("ContainerConfigs");
@@ -119,6 +120,7 @@
addChild(UIContainer.class, null, null);
}
+ @Override
public void processRender(WebuiRequestContext context) throws Exception
{
DataStorage service = getApplicationComponent(DataStorage.class);
@@ -287,13 +289,8 @@
*/
public boolean hasUIGadget()
{
- boolean flag = false;
UIGadget gadget = findFirstComponentOfType(UIGadget.class);
- if (gadget != null)
- {
- flag = true;
- }
- return flag;
+ return (gadget != null);
}
/**
@@ -461,13 +458,14 @@
service.saveDashboard(dashboard);
}
- public static class AddNewGadgetActionListener extends
EventListener<org.exoplatform.webui.core.UIContainer>
+ public static class AddNewGadgetActionListener extends
EventListener<UIDashboard>
{
- public final void execute(final Event<org.exoplatform.webui.core.UIContainer>
event) throws Exception
+ @Override
+ public final void execute(final Event<UIDashboard> event) throws Exception
{
WebuiRequestContext context = event.getRequestContext();
- org.exoplatform.webui.core.UIContainer uiDashboard = event.getSource();
- if (!((UIDashboard)uiDashboard).canEdit())
+ UIDashboard uiDashboard = event.getSource();
+ if (!uiDashboard.canEdit())
return;
int col = Integer.parseInt(context.getRequestParameter(COLINDEX));
int row = Integer.parseInt(context.getRequestParameter(ROWINDEX));
@@ -488,13 +486,14 @@
}
}
- public static class MoveGadgetActionListener extends
EventListener<org.exoplatform.webui.core.UIContainer>
+ public static class MoveGadgetActionListener extends EventListener<UIDashboard>
{
- public final void execute(final Event<org.exoplatform.webui.core.UIContainer>
event) throws Exception
+ @Override
+ public final void execute(final Event<UIDashboard> event) throws Exception
{
WebuiRequestContext context = event.getRequestContext();
- org.exoplatform.webui.core.UIContainer uiDashboard = event.getSource();
- if (!((UIDashboard)uiDashboard).canEdit())
+ UIDashboard uiDashboard = event.getSource();
+ if (!uiDashboard.canEdit())
return;
UIDashboardContainer uiDashboardContainer =
uiDashboard.getChild(UIDashboardContainer.class);
int col = Integer.parseInt(context.getRequestParameter(COLINDEX));
@@ -507,21 +506,28 @@
}
}
- public static class DeleteGadgetActionListener extends
EventListener<org.exoplatform.webui.core.UIContainer>
+ public static class DeleteGadgetActionListener extends
EventListener<UIDashboard>
{
- public final void execute(final Event<org.exoplatform.webui.core.UIContainer>
event) throws Exception
+ @Override
+ public final void execute(final Event<UIDashboard> event) throws Exception
{
- WebuiRequestContext context = event.getRequestContext();
- org.exoplatform.webui.core.UIContainer uiDashboard = event.getSource();
- if (!((UIDashboard)uiDashboard).canEdit())
+ UIDashboard uiDashboard = event.getSource();
+ if (!uiDashboard.canEdit())
return;
+ WebuiRequestContext context = event.getRequestContext();
String objectId = context.getRequestParameter(OBJECTID);
UIDashboardContainer uiDashboardContainer =
uiDashboard.getChild(UIDashboardContainer.class);
uiDashboardContainer.removeUIGadget(objectId);
+ boolean isMaximized = false;
+ if (uiDashboard.getMaximizedGadget() != null &&
uiDashboard.getMaximizedGadget().getId().equals(objectId))
+ {
+ uiDashboard.setMaximizedGadget(null);
+ isMaximized = true;
+ }
uiDashboardContainer.save();
-// context.addUIComponentToUpdateByAjax(uiDashboardContainer);
- context.setResponseComplete(true);
+ if (!isMaximized)
+ context.setResponseComplete(true);
}
}
Deleted:
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardMask.java
===================================================================
---
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardMask.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardMask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,32 +0,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.
- */
-
-package org.exoplatform.dashboard.webui.component;
-
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.core.UIComponentDecorator;
-
-@ComponentConfig(template =
"classpath:groovy/dashboard/webui/component/UIDashboardMask.gtmpl")
-public class UIDashboardMask extends UIComponentDecorator
-{
-
- public UIDashboardMask() throws Exception
- {
- }
-}
Modified:
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl
===================================================================
---
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboard.gtmpl 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,6 +1,13 @@
+<% def maxiGadget = uicomponent.getMaximizedGadget(); %>
<div id="$uicomponent.id" class="UIDashboard">
- <div class="DashboardContainer">
- <% uicomponent.renderChildren(); %>
- <div class="ClearLeft"><span></span></div>
+ <div class="DashboardContainer <%=maxiGadget == null ? "" :
"Maximized"%>">
+ <%
+ if(maxiGadget == null) {
+ uicomponent.renderChildren();
+ %>
+ <div class="ClearLeft"><span></span></div>
+ <%} else {
+ uicomponent.renderUIComponent(maxiGadget);
+ }%>
</div>
</div>
Modified:
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardContainer.gtmpl
===================================================================
---
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardContainer.gtmpl 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardContainer.gtmpl 2009-11-01
13:58:21 UTC (rev 468)
@@ -26,15 +26,8 @@
</div>
</div>
</div>
- <%
- }
- if (uicomponent.findFirstComponentOfType(UIGadget.class) == null) {
- %>
- <div class="NoGadget"><%=
_ctx.appRes("UIDashboard.msg.addGadget"); %></div>
- <%
- }
- uicomponent.renderChildren() ;
- %>
-
+ <%}%>
+ <div class="NoGadget" style="display: <%=uicomponent.hasUIGadget()
? "none" : "block"%>"><%=
_ctx.appRes("UIDashboard.msg.addGadget"); %></div>
+ <% uicomponent.renderChildren() ;%>
</div>
</div>
Deleted:
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardMask.gtmpl
===================================================================
---
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardMask.gtmpl 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/dashboard/src/main/resources/groovy/dashboard/webui/component/UIDashboardMask.gtmpl 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,3 +0,0 @@
-<div id="$uicomponent.id" class="UIDashboardMask">
- <%uicomponent.renderChildren();%>
-</div>
\ No newline at end of file
Modified:
portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml
===================================================================
---
portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/conf/portal/configuration.xml 2009-11-01
13:58:21 UTC (rev 468)
@@ -95,7 +95,7 @@
</component>
<component>
- <type>org.exoplatform.portal.skin.SkinService</type>
+ <type>org.exoplatform.portal.resource.SkinService</type>
</component>
<external-component-plugins>
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -373,10 +373,12 @@
}
page.setModifiable(false);
String[] accessPerms = page.getAccessPermissions();
- for (String per : accessPerms)
- {
- if (hasPermission(identity, per))
- return true;
+ if (accessPerms != null) {
+ for (String per : accessPerms)
+ {
+ if (hasPermission(identity, per))
+ return true;
+ }
}
return false;
}
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNavigation.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -21,6 +21,7 @@
import org.exoplatform.portal.pom.data.NavigationData;
import org.exoplatform.portal.pom.data.NavigationNodeData;
+import org.gatein.mop.core.api.workspace.NavigationContainer;
import java.util.ArrayList;
import java.util.LinkedHashMap;
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -69,7 +69,7 @@
//
this.uri = nav.getURI();
this.label = nav.getLabel();
- this.resolvedLabel = label;
+ this.resolvedLabel = nav.getLabel();
this.icon = nav.getIcon();
this.name = nav.getName();
this.startPublicationDate = nav.getStartPublicationDate();
Modified:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNodeContainer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -19,7 +19,6 @@
package org.exoplatform.portal.config.model;
-import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.pom.data.NavigationNodeContainerData;
import org.exoplatform.portal.pom.data.NavigationNodeData;
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource)
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,38 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.gatein.wci.WebAppEvent;
-import org.gatein.wci.WebAppListener;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public abstract class AbstractResourceHandler implements WebAppListener
-{
-
- abstract public void onEvent(WebAppEvent event);
-
-}
\ No newline at end of file
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/AbstractResourceHandler.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,38 @@
+/**
+ * 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.resource;
+
+import org.gatein.wci.WebAppEvent;
+import org.gatein.wci.WebAppListener;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+public abstract class AbstractResourceHandler implements WebAppListener
+{
+
+ abstract public void onEvent(WebAppEvent event);
+
+}
\ No newline at end of file
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,111 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.exoplatform.commons.utils.CharEncoder;
-import org.exoplatform.commons.utils.CharsetCharEncoder;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-
-/**
- * A codec for names. It is a modified version of the percent encoding algorithm that
translates
- * underscores to their percent counterpart and slash to underscores. Therefore slash
chars are
- * never seen as the %2F string as it can cause some issues on tomcat when it is used in
an URI.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-class Codec
-{
-
- private Codec()
- {
- }
-
- private static final char[][] table = new char[256][];
-
- static
- {
- char[] a = "0123456789ABCDEF".toCharArray();
- for (int b = 0; b < 256; b++)
- {
- int b1 = (b & 0xF0) >> 4;
- int b2 = b & 0x0F;
- table[b] = new char[]{a[b1], a[b2]};
- }
- }
-
- public static String decode(String s)
- {
- try
- {
- s = s.replace("_", "%2F");
- return URLDecoder.decode(s, "UTF8");
- }
- catch (UnsupportedEncodingException e)
- {
- throw new Error(e);
- }
- }
-
- public static void encode(Appendable appendable, String s) throws IOException
- {
- for (int i = 0; i < s.length(); i++)
- {
- char c = s.charAt(i);
- if (Character.isLetter(c))
- {
- appendable.append(c);
- }
- else
- {
- switch (c)
- {
- case 'A' :
- case '.' :
- case '-' :
- case '*' :
- appendable.append(c);
- break;
- case ' ' :
- appendable.append('+');
- break;
- case '/' :
- appendable.append('_');
- break;
- default :
- CharEncoder encoder = CharsetCharEncoder.getUTF8();
- byte[] bytes = encoder.encode(c);
- appendable.append('%');
- for (byte b : bytes)
- {
- for (char cc : table[b])
- {
- appendable.append(cc);
- }
- }
- }
- }
- }
- }
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Codec.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,111 @@
+/**
+ * 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.resource;
+
+import org.exoplatform.commons.utils.CharEncoder;
+import org.exoplatform.commons.utils.CharsetCharEncoder;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+/**
+ * A codec for names. It is a modified version of the percent encoding algorithm that
translates
+ * underscores to their percent counterpart and slash to underscores. Therefore slash
chars are
+ * never seen as the %2F string as it can cause some issues on tomcat when it is used in
an URI.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class Codec
+{
+
+ private Codec()
+ {
+ }
+
+ private static final char[][] table = new char[256][];
+
+ static
+ {
+ char[] a = "0123456789ABCDEF".toCharArray();
+ for (int b = 0; b < 256; b++)
+ {
+ int b1 = (b & 0xF0) >> 4;
+ int b2 = b & 0x0F;
+ table[b] = new char[]{a[b1], a[b2]};
+ }
+ }
+
+ public static String decode(String s)
+ {
+ try
+ {
+ s = s.replace("_", "%2F");
+ return URLDecoder.decode(s, "UTF8");
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ public static void encode(Appendable appendable, String s) throws IOException
+ {
+ for (int i = 0; i < s.length(); i++)
+ {
+ char c = s.charAt(i);
+ if (Character.isLetter(c))
+ {
+ appendable.append(c);
+ }
+ else
+ {
+ switch (c)
+ {
+ case 'A' :
+ case '.' :
+ case '-' :
+ case '*' :
+ appendable.append(c);
+ break;
+ case ' ' :
+ appendable.append('+');
+ break;
+ case '/' :
+ appendable.append('_');
+ break;
+ default :
+ CharEncoder encoder = CharsetCharEncoder.getUTF8();
+ byte[] bytes = encoder.encode(c);
+ appendable.append('%');
+ for (byte b : bytes)
+ {
+ for (char cc : table[b])
+ {
+ appendable.append(cc);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,80 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-class CompositeResourceResolver implements ResourceResolver
-{
-
- /** . */
- private final Map<SkinKey, SkinConfig> skins;
-
- /**
- * The name of the portal container
- */
- private final String portalContainerName;
-
- public CompositeResourceResolver(String portalContainerName, Map<SkinKey,
SkinConfig> skins)
- {
- this.portalContainerName = portalContainerName;
- this.skins = skins;
- }
-
- public Resource resolve(String path)
- {
- if (path.startsWith("/" + portalContainerName + "/resource/")
&& path.endsWith(".css"))
- {
- final StringBuffer sb = new StringBuffer();
- String encoded = path.substring(("/" + portalContainerName +
"/resource/").length());
- String blah[] = encoded.split("/");
- int len = (blah.length >> 1) << 1;
- for (int i = 0; i < len; i += 2)
- {
- String name = Codec.decode(blah[i]);
- String module = Codec.decode(blah[i + 1]);
- SkinKey key = new SkinKey(module, name);
- SkinConfig skin = skins.get(key);
- if (skin != null)
- {
- sb.append("@import
url(").append(skin.getCSSPath()).append(");").append("\n");
- }
- }
- return new Resource(path)
- {
- @Override
- public Reader read()
- {
- return new StringReader(sb.toString());
- }
- };
- }
- else
- {
- return null;
- }
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeResourceResolver.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,80 @@
+/**
+ * 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.resource;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class CompositeResourceResolver implements ResourceResolver
+{
+
+ /** . */
+ private final Map<SkinKey, SkinConfig> skins;
+
+ /**
+ * The name of the portal container
+ */
+ private final String portalContainerName;
+
+ public CompositeResourceResolver(String portalContainerName, Map<SkinKey,
SkinConfig> skins)
+ {
+ this.portalContainerName = portalContainerName;
+ this.skins = skins;
+ }
+
+ public Resource resolve(String path)
+ {
+ if (path.startsWith("/" + portalContainerName + "/resource/")
&& path.endsWith(".css"))
+ {
+ final StringBuffer sb = new StringBuffer();
+ String encoded = path.substring(("/" + portalContainerName +
"/resource/").length());
+ String blah[] = encoded.split("/");
+ int len = (blah.length >> 1) << 1;
+ for (int i = 0; i < len; i += 2)
+ {
+ String name = Codec.decode(blah[i]);
+ String module = Codec.decode(blah[i + 1]);
+ SkinKey key = new SkinKey(module, name);
+ SkinConfig skin = skins.get(key);
+ if (skin != null)
+ {
+ sb.append("@import
url(").append(skin.getCSSPath()).append(");").append("\n");
+ }
+ }
+ return new Resource(path)
+ {
+ @Override
+ public Reader read()
+ {
+ return new StringReader(sb.toString());
+ }
+ };
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,113 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.exoplatform.commons.utils.PropertyManager;
-import org.exoplatform.services.resources.Orientation;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.TreeMap;
-
-/**
- * A composite skin.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-class CompositeSkin implements Skin
-{
-
- /** . */
- private final SkinService service;
-
- /** . */
- private final String id;
-
- /** . */
- private final String urlPrefix;
-
- CompositeSkin(SkinService service, Collection<SkinConfig> skins)
- {
- TreeMap<String, SkinConfig> urlSkins = new TreeMap<String,
SkinConfig>();
- for (SkinConfig skin : skins)
- {
- urlSkins.put(skin.getCSSPath(), skin);
- }
-
- //
- final StringBuilder builder = new StringBuilder();
-
builder.append("/").append(service.portalContainerName).append("/resource");
-
- //
- final StringBuilder id = new StringBuilder();
-
- //
- try
- {
- for (SkinConfig cfg : urlSkins.values())
- {
- StringBuilder encodedName = new StringBuilder();
- Codec.encode(encodedName, cfg.getName());
- StringBuilder encodedModule = new StringBuilder();
- Codec.encode(encodedModule, cfg.getModule());
-
- //
- id.append(encodedName).append(encodedModule);
-
builder.append("/").append(encodedName).append("/").append(encodedModule);
- }
- }
- catch (IOException e)
- {
- throw new Error(e);
- }
-
- //
- this.service = service;
- this.id = id.toString();
- this.urlPrefix = builder.toString();
- }
-
- public String getId()
- {
- return id;
- }
-
- public SkinURL createURL()
- {
- return new SkinURL()
- {
-
- Orientation orientation;
-
- public void setOrientation(Orientation orientation)
- {
- this.orientation = orientation;
- }
-
- @Override
- public String toString()
- {
- return urlPrefix + "/" + (PropertyManager.isDevelopping() ?
"style" : service.id)
- + service.getSuffix(orientation);
- }
- };
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/CompositeSkin.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,113 @@
+/**
+ * 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.resource;
+
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.services.resources.Orientation;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.TreeMap;
+
+/**
+ * A composite skin.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class CompositeSkin implements Skin
+{
+
+ /** . */
+ private final SkinService service;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final String urlPrefix;
+
+ CompositeSkin(SkinService service, Collection<SkinConfig> skins)
+ {
+ TreeMap<String, SkinConfig> urlSkins = new TreeMap<String,
SkinConfig>();
+ for (SkinConfig skin : skins)
+ {
+ urlSkins.put(skin.getCSSPath(), skin);
+ }
+
+ //
+ final StringBuilder builder = new StringBuilder();
+
builder.append("/").append(service.portalContainerName).append("/resource");
+
+ //
+ final StringBuilder id = new StringBuilder();
+
+ //
+ try
+ {
+ for (SkinConfig cfg : urlSkins.values())
+ {
+ StringBuilder encodedName = new StringBuilder();
+ Codec.encode(encodedName, cfg.getName());
+ StringBuilder encodedModule = new StringBuilder();
+ Codec.encode(encodedModule, cfg.getModule());
+
+ //
+ id.append(encodedName).append(encodedModule);
+
builder.append("/").append(encodedName).append("/").append(encodedModule);
+ }
+ }
+ catch (IOException e)
+ {
+ throw new Error(e);
+ }
+
+ //
+ this.service = service;
+ this.id = id.toString();
+ this.urlPrefix = builder.toString();
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public SkinURL createURL()
+ {
+ return new SkinURL()
+ {
+
+ Orientation orientation;
+
+ public void setOrientation(Orientation orientation)
+ {
+ this.orientation = orientation;
+ }
+
+ @Override
+ public String toString()
+ {
+ return urlPrefix + "/" + (PropertyManager.isDevelopping() ?
"style" : service.id)
+ + service.getSuffix(orientation);
+ }
+ };
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,133 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.RootContainer.PortalContainerPostInitTask;
-import org.exoplatform.portal.resource.config.xml.SkinConfigParser;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.gatein.wci.WebAppEvent;
-import org.gatein.wci.WebAppLifeCycleEvent;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.servlet.ServletContext;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public class GateinSkinConfigDeployer extends AbstractResourceHandler
-{
-
- private final SkinService skinService;
-
- private static final String GATEIN_CONFIG_RESOURCE =
"/WEB-INF/gatein-resources.xml";
-
- private static Log LOG = ExoLogger.getExoLogger(GateinSkinConfigDeployer.class);
-
- /**
- * The name of the portal container
- */
- private final String portalContainerName;
-
- public GateinSkinConfigDeployer(String portalContainerName, SkinService _skinService)
- {
- this.skinService = _skinService;
- this.portalContainerName = portalContainerName;
- }
-
- @Override
- public void onEvent(WebAppEvent event)
- {
- if (event instanceof WebAppLifeCycleEvent)
- {
- WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
- if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
- {
- ServletContext scontext = null;
- try
- {
- scontext = event.getWebApp().getServletContext();
- InputStream is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
- if (is == null)
- return;
- try
- {
- is.close();
- }
- catch (Exception ex)
- {
- // ignore me
- }
- final PortalContainerPostInitTask task = new
PortalContainerPostInitTask()
- {
-
- public void execute(ServletContext scontext, PortalContainer
portalContainer)
- {
- register(scontext, portalContainer);
- }
- };
- PortalContainer.addInitTask(scontext, task, portalContainerName);
- }
- catch (Exception ex)
- {
- LOG.error("An error occurs while registering '" +
GATEIN_CONFIG_RESOURCE + "' from the context '"
- + (scontext == null ? "unknown" :
scontext.getServletContextName()) + "'", ex);
- }
- }
- }
- }
-
- private void register(ServletContext scontext, PortalContainer container)
- {
- InputStream is = null;
- try
- {
- is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
- SkinConfigParser.processConfigResource(is, skinService, scontext);
- }
- catch (Exception ex)
- {
- LOG.error("An error occurs while registering '" +
GATEIN_CONFIG_RESOURCE + "' from the context '"
- + (scontext == null ? "unknown" : scontext.getServletContextName())
+ "'", ex);
- }
- finally
- {
- if (is != null)
- {
- try
- {
- is.close();
- }
- catch (IOException e)
- {
- // ignore me
- }
- }
- }
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/GateinSkinConfigDeployer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,133 @@
+/**
+ * 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.resource;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer.PortalContainerPostInitTask;
+import org.exoplatform.portal.resource.config.xml.SkinConfigParser;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.gatein.wci.WebAppEvent;
+import org.gatein.wci.WebAppLifeCycleEvent;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletContext;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+public class GateinSkinConfigDeployer extends AbstractResourceHandler
+{
+
+ private final SkinService skinService;
+
+ private static final String GATEIN_CONFIG_RESOURCE =
"/WEB-INF/gatein-resources.xml";
+
+ private static Log LOG = ExoLogger.getExoLogger(GateinSkinConfigDeployer.class);
+
+ /**
+ * The name of the portal container
+ */
+ private final String portalContainerName;
+
+ public GateinSkinConfigDeployer(String portalContainerName, SkinService _skinService)
+ {
+ this.skinService = _skinService;
+ this.portalContainerName = portalContainerName;
+ }
+
+ @Override
+ public void onEvent(WebAppEvent event)
+ {
+ if (event instanceof WebAppLifeCycleEvent)
+ {
+ WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
+ if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
+ {
+ ServletContext scontext = null;
+ try
+ {
+ scontext = event.getWebApp().getServletContext();
+ InputStream is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
+ if (is == null)
+ return;
+ try
+ {
+ is.close();
+ }
+ catch (Exception ex)
+ {
+ // ignore me
+ }
+ final PortalContainerPostInitTask task = new
PortalContainerPostInitTask()
+ {
+
+ public void execute(ServletContext scontext, PortalContainer
portalContainer)
+ {
+ register(scontext, portalContainer);
+ }
+ };
+ PortalContainer.addInitTask(scontext, task, portalContainerName);
+ }
+ catch (Exception ex)
+ {
+ LOG.error("An error occurs while registering '" +
GATEIN_CONFIG_RESOURCE + "' from the context '"
+ + (scontext == null ? "unknown" :
scontext.getServletContextName()) + "'", ex);
+ }
+ }
+ }
+ }
+
+ private void register(ServletContext scontext, PortalContainer container)
+ {
+ InputStream is = null;
+ try
+ {
+ is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
+ SkinConfigParser.processConfigResource(is, skinService, scontext);
+ }
+ catch (Exception ex)
+ {
+ LOG.error("An error occurs while registering '" +
GATEIN_CONFIG_RESOURCE + "' from the context '"
+ + (scontext == null ? "unknown" : scontext.getServletContextName())
+ "'", ex);
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (IOException e)
+ {
+ // ignore me
+ }
+ }
+ }
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,80 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-class MainResourceResolver implements ResourceResolver
-{
-
- final Map<String, SimpleResourceContext> contexts;
-
- final CopyOnWriteArrayList<ResourceResolver> resolvers;
-
- final Map<SkinKey, SkinConfig> skins;
-
- public MainResourceResolver(String portalContainerName, Map<SkinKey, SkinConfig>
skins)
- {
- this.skins = skins;
- this.contexts = new HashMap<String, SimpleResourceContext>();
- this.resolvers = new CopyOnWriteArrayList<ResourceResolver>();
-
- //
- resolvers.add(new CompositeResourceResolver(portalContainerName, skins));
- }
-
- SimpleResourceContext registerContext(ServletContext servletContext)
- {
- String key = "/" + servletContext.getServletContextName();
- SimpleResourceContext ctx = contexts.get(key);
- if (ctx == null)
- {
- ctx = new SimpleResourceContext(key, servletContext);
- contexts.put(ctx.getContextPath(), ctx);
- }
- return ctx;
- }
-
- public Resource resolve(String path)
- {
- for (ResourceResolver resolver : resolvers)
- {
- Resource res = resolver.resolve(path);
- if (res != null)
- {
- return res;
- }
- }
-
- //
- int i1 = path.indexOf("/", 2);
- String targetedContextPath = path.substring(0, i1);
- SimpleResourceContext context = contexts.get(targetedContextPath);
- return context.getResource(path.substring(i1));
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/MainResourceResolver.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,80 @@
+/**
+ * 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.resource;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class MainResourceResolver implements ResourceResolver
+{
+
+ final Map<String, SimpleResourceContext> contexts;
+
+ final CopyOnWriteArrayList<ResourceResolver> resolvers;
+
+ final Map<SkinKey, SkinConfig> skins;
+
+ public MainResourceResolver(String portalContainerName, Map<SkinKey, SkinConfig>
skins)
+ {
+ this.skins = skins;
+ this.contexts = new HashMap<String, SimpleResourceContext>();
+ this.resolvers = new CopyOnWriteArrayList<ResourceResolver>();
+
+ //
+ resolvers.add(new CompositeResourceResolver(portalContainerName, skins));
+ }
+
+ SimpleResourceContext registerContext(ServletContext servletContext)
+ {
+ String key = "/" + servletContext.getServletContextName();
+ SimpleResourceContext ctx = contexts.get(key);
+ if (ctx == null)
+ {
+ ctx = new SimpleResourceContext(key, servletContext);
+ contexts.put(ctx.getContextPath(), ctx);
+ }
+ return ctx;
+ }
+
+ public Resource resolve(String path)
+ {
+ for (ResourceResolver resolver : resolvers)
+ {
+ Resource res = resolver.resolve(path);
+ if (res != null)
+ {
+ return res;
+ }
+ }
+
+ //
+ int i1 = path.indexOf("/", 2);
+ String targetedContextPath = path.substring(0, i1);
+ SimpleResourceContext context = contexts.get(targetedContextPath);
+ return context.getResource(path.substring(i1));
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,49 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-/**
- * Signal an exception during rendering.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class RenderingException extends Exception
-{
-
- public RenderingException()
- {
- }
-
- public RenderingException(String message)
- {
- super(message);
- }
-
- public RenderingException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public RenderingException(Throwable cause)
- {
- super(cause);
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/RenderingException.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,49 @@
+/**
+ * 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.resource;
+
+/**
+ * Signal an exception during rendering.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class RenderingException extends Exception
+{
+
+ public RenderingException()
+ {
+ }
+
+ public RenderingException(String message)
+ {
+ super(message);
+ }
+
+ public RenderingException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public RenderingException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,85 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/**
- * Represents a resource.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public abstract class Resource
-{
-
- private final String contextPath;
-
- private final String parentPath;
-
- private final String fileName;
-
- public Resource(String path)
- {
- int index = path.indexOf("/", 2);
- String relativeCSSPath = path.substring(index);
- int index2 = relativeCSSPath.lastIndexOf("/") + 1;
-
- //
- this.contextPath = path.substring(0, index);
- this.parentPath = relativeCSSPath.substring(0, index2);
- this.fileName = relativeCSSPath.substring(index2);
- }
-
- public Resource(String contextPath, String parentPath, String fileName)
- {
- this.contextPath = contextPath;
- this.parentPath = parentPath;
- this.fileName = fileName;
- }
-
- public final String getPath()
- {
- return getContextPath() + getParentPath() + getFileName();
- }
-
- public final String getContextPath()
- {
- return contextPath;
- }
-
- public final String getParentPath()
- {
- return parentPath;
- }
-
- public final String getFileName()
- {
- return fileName;
- }
-
- public final String getResourcePath()
- {
- return getParentPath() + getFileName();
- }
-
- public abstract Reader read() throws IOException;
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Resource.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,85 @@
+/**
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.Reader;
+
+/**
+ * Represents a resource.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public abstract class Resource
+{
+
+ private final String contextPath;
+
+ private final String parentPath;
+
+ private final String fileName;
+
+ public Resource(String path)
+ {
+ int index = path.indexOf("/", 2);
+ String relativeCSSPath = path.substring(index);
+ int index2 = relativeCSSPath.lastIndexOf("/") + 1;
+
+ //
+ this.contextPath = path.substring(0, index);
+ this.parentPath = relativeCSSPath.substring(0, index2);
+ this.fileName = relativeCSSPath.substring(index2);
+ }
+
+ public Resource(String contextPath, String parentPath, String fileName)
+ {
+ this.contextPath = contextPath;
+ this.parentPath = parentPath;
+ this.fileName = fileName;
+ }
+
+ public final String getPath()
+ {
+ return getContextPath() + getParentPath() + getFileName();
+ }
+
+ public final String getContextPath()
+ {
+ return contextPath;
+ }
+
+ public final String getParentPath()
+ {
+ return parentPath;
+ }
+
+ public final String getFileName()
+ {
+ return fileName;
+ }
+
+ public final String getResourcePath()
+ {
+ return getParentPath() + getFileName();
+ }
+
+ public abstract Reader read() throws IOException;
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,47 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-/**
- * An interface defining the renderer contract for a resource.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public interface ResourceRenderer
-{
-
- /**
- * Returns an appendable for the performing the rendering of the resource.
- *
- * @return the appendable
- */
- Appendable getAppendable();
-
- /**
- * Instruct the renderer about the expiration time in seconds. A non positive value
- * means that no caching should be performed. The expiration value is relative to the
- * date of the request.
- *
- * @param seconds the value in seconds
- */
- void setExpiration(long seconds);
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceRenderer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,47 @@
+/**
+ * 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.resource;
+
+/**
+ * An interface defining the renderer contract for a resource.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public interface ResourceRenderer
+{
+
+ /**
+ * Returns an appendable for the performing the rendering of the resource.
+ *
+ * @return the appendable
+ */
+ Appendable getAppendable();
+
+ /**
+ * Instruct the renderer about the expiration time in seconds. A non positive value
+ * means that no caching should be performed. The expiration value is relative to the
+ * date of the request.
+ *
+ * @param seconds the value in seconds
+ */
+ void setExpiration(long seconds);
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,39 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-/**
- * A resource resolver for char based resources.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public interface ResourceResolver
-{
-
- /**
- * Returns a reader for the provided path or null if the resource cannot be resolved.
- *
- * @param path the path
- * @return a reader
- */
- Resource resolve(String path);
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/ResourceResolver.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,39 @@
+/**
+ * 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.resource;
+
+/**
+ * A resource resolver for char based resources.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public interface ResourceResolver
+{
+
+ /**
+ * Returns a reader for the provided path or null if the resource cannot be resolved.
+ *
+ * @param path the path
+ * @return a reader
+ */
+ Resource resolve(String path);
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,78 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-class SimpleResourceContext
-{
-
- private final String contextPath;
-
- private final ServletContext context;
-
- public SimpleResourceContext(String contextPath, ServletContext context)
- {
- this.contextPath = contextPath;
- this.context = context;
- }
-
- public Resource getResource(String path)
- {
- int i2 = path.lastIndexOf("/") + 1;
- String targetedParentPath = path.substring(0, i2);
- String targetedFileName = path.substring(i2);
- try
- {
- final URL url = context.getResource(path);
- if (url != null)
- {
- return new Resource(contextPath, targetedParentPath, targetedFileName)
- {
- @Override
- public Reader read() throws IOException
- {
- return new InputStreamReader(url.openStream());
- }
- };
- }
- }
- catch (MalformedURLException e)
- {
- e.printStackTrace();
- }
- return null;
- }
-
- public String getContextPath()
- {
- return contextPath;
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleResourceContext.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,78 @@
+/**
+ * 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.resource;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class SimpleResourceContext
+{
+
+ private final String contextPath;
+
+ private final ServletContext context;
+
+ public SimpleResourceContext(String contextPath, ServletContext context)
+ {
+ this.contextPath = contextPath;
+ this.context = context;
+ }
+
+ public Resource getResource(String path)
+ {
+ int i2 = path.lastIndexOf("/") + 1;
+ String targetedParentPath = path.substring(0, i2);
+ String targetedFileName = path.substring(i2);
+ try
+ {
+ final URL url = context.getResource(path);
+ if (url != null)
+ {
+ return new Resource(contextPath, targetedParentPath, targetedFileName)
+ {
+ @Override
+ public Reader read() throws IOException
+ {
+ return new InputStreamReader(url.openStream());
+ }
+ };
+ }
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public String getContextPath()
+ {
+ return contextPath;
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,91 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.exoplatform.services.resources.Orientation;
-
-/**
- * An implementation of the skin config.
- *
- * Created by The eXo Platform SAS
- * Jan 19, 2007
- */
-class SimpleSkin implements SkinConfig
-{
-
- private final SkinService service_;
-
- private final String module_;
-
- private final String name_;
-
- private final String cssPath_;
-
- private final String id_;
-
- public SimpleSkin(SkinService service, String module, String name, String cssPath)
- {
- service_ = service;
- module_ = module;
- name_ = name;
- cssPath_ = cssPath;
- id_ = module.replace('/', '_');
- }
-
- public String getId()
- {
- return id_;
- }
-
- public String getModule()
- {
- return module_;
- }
-
- public String getCSSPath()
- {
- return cssPath_;
- }
-
- public String getName()
- {
- return name_;
- }
-
- public SkinURL createURL()
- {
- return new SkinURL()
- {
-
- Orientation orientation = null;
-
- public void setOrientation(Orientation orientation)
- {
- this.orientation = orientation;
- }
-
- @Override
- public String toString()
- {
- return cssPath_.replaceAll("\\.css$",
service_.getSuffix(orientation));
- }
- };
- }
-}
\ No newline at end of file
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SimpleSkin.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,91 @@
+/**
+ * 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.resource;
+
+import org.exoplatform.services.resources.Orientation;
+
+/**
+ * An implementation of the skin config.
+ *
+ * Created by The eXo Platform SAS
+ * Jan 19, 2007
+ */
+class SimpleSkin implements SkinConfig
+{
+
+ private final SkinService service_;
+
+ private final String module_;
+
+ private final String name_;
+
+ private final String cssPath_;
+
+ private final String id_;
+
+ public SimpleSkin(SkinService service, String module, String name, String cssPath)
+ {
+ service_ = service;
+ module_ = module;
+ name_ = name;
+ cssPath_ = cssPath;
+ id_ = module.replace('/', '_');
+ }
+
+ public String getId()
+ {
+ return id_;
+ }
+
+ public String getModule()
+ {
+ return module_;
+ }
+
+ public String getCSSPath()
+ {
+ return cssPath_;
+ }
+
+ public String getName()
+ {
+ return name_;
+ }
+
+ public SkinURL createURL()
+ {
+ return new SkinURL()
+ {
+
+ Orientation orientation = null;
+
+ public void setOrientation(Orientation orientation)
+ {
+ this.orientation = orientation;
+ }
+
+ @Override
+ public String toString()
+ {
+ return cssPath_.replaceAll("\\.css$",
service_.getSuffix(orientation));
+ }
+ };
+ }
+}
\ No newline at end of file
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,45 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-/**
- * A skin.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public interface Skin
-{
-
- /**
- * Returns the skin id.
- *
- * @return the skin id
- */
- String getId();
-
- /**
- * Creates and return a skin URL.
- *
- * @return the skin URL
- */
- SkinURL createURL();
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/Skin.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,45 @@
+/**
+ * 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.resource;
+
+/**
+ * A skin.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public interface Skin
+{
+
+ /**
+ * Returns the skin id.
+ *
+ * @return the skin id
+ */
+ String getId();
+
+ /**
+ * Creates and return a skin URL.
+ *
+ * @return the skin URL
+ */
+ SkinURL createURL();
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,52 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-/**
- * Extends a skin with additional information.
- *
- * Created by The eXo Platform SAS
- * Jan 19, 2007
- */
-public interface SkinConfig extends Skin
-{
-
- /**
- * Returns the skin name
- *
- * @return the skin name
- */
- String getName();
-
- /**
- * Returns the skin module.
- *
- * @return the module
- */
- String getModule();
-
- /**
- * Returns the css path.
- *
- * @return the css path
- */
- String getCSSPath();
-
-}
\ No newline at end of file
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfig.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,52 @@
+/**
+ * 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.resource;
+
+/**
+ * Extends a skin with additional information.
+ *
+ * Created by The eXo Platform SAS
+ * Jan 19, 2007
+ */
+public interface SkinConfig extends Skin
+{
+
+ /**
+ * Returns the skin name
+ *
+ * @return the skin name
+ */
+ String getName();
+
+ /**
+ * Returns the skin module.
+ *
+ * @return the module
+ */
+ String getModule();
+
+ /**
+ * Returns the css path.
+ *
+ * @return the css path
+ */
+ String getCSSPath();
+
+}
\ No newline at end of file
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,139 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import groovy.lang.Binding;
-import groovy.lang.GroovyShell;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.container.RootContainer.PortalContainerPostInitTask;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.gatein.wci.WebAppEvent;
-import org.gatein.wci.WebAppLifeCycleEvent;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.servlet.ServletContext;
-
-/**
- * Created by The eXo Platform SAS
- * Jan 19, 2007
- */
-
-public class SkinConfigDeployer extends AbstractResourceHandler
-{
-
- /**
- * Logger
- */
- private static final Log LOG = ExoLogger.getLogger(SkinConfigDeployer.class);
-
- /** . */
- private final SkinService skinService;
-
- /**
- * The name of the portal container
- */
- private final String portalContainerName;
-
- public SkinConfigDeployer(String portalContainerName, SkinService skinService)
- {
- this.skinService = skinService;
- this.portalContainerName = portalContainerName;
- }
-
- public void onEvent(WebAppEvent event)
- {
- if (event instanceof WebAppLifeCycleEvent)
- {
- WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
- if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
- {
- ServletContext scontext = null;
- try
- {
- scontext = event.getWebApp().getServletContext();
- InputStream is =
scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/SkinConfigScript.groovy");
- if (is == null)
- return;
- try
- {
- is.close();
- }
- catch (Exception ex)
- {
- // ignore me
- }
- final PortalContainerPostInitTask task = new
PortalContainerPostInitTask()
- {
-
- public void execute(ServletContext scontext, PortalContainer
portalContainer)
- {
- register(scontext, portalContainer);
- }
- };
- PortalContainer.addInitTask(scontext, task, portalContainerName);
- }
- catch (Exception ex)
- {
- LOG.error("An error occurs while registering
'SkinConfigScript.groovy' from the context '"
- + (scontext == null ? "unknown" :
scontext.getServletContextName()) + "'", ex);
- }
- }
- }
- }
-
- private void register(ServletContext scontext, PortalContainer container)
- {
- InputStream is = null;
- try
- {
- is =
scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/SkinConfigScript.groovy");
- Binding binding = new Binding();
- binding.setVariable("SkinService", skinService);
- binding.setVariable("ServletContext", scontext);
- binding.setVariable("ServletContextName",
scontext.getServletContextName());
- binding.setVariable("PortalContainerName", container.getName());
- GroovyShell shell = new GroovyShell(binding);
- shell.evaluate(is);
- }
- catch (Exception ex)
- {
- LOG.error("An error occurs while processing
'SkinConfigScript.groovy' from the context '"
- + scontext.getServletContextName() + "'", ex);
- }
- finally
- {
- if (is != null)
- {
- try
- {
- is.close();
- }
- catch (IOException e)
- {
- // ignore me
- }
- }
- }
- }
-}
\ No newline at end of file
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinConfigDeployer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,139 @@
+/**
+ * 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.resource;
+
+import groovy.lang.Binding;
+import groovy.lang.GroovyShell;
+
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer.PortalContainerPostInitTask;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.gatein.wci.WebAppEvent;
+import org.gatein.wci.WebAppLifeCycleEvent;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletContext;
+
+/**
+ * Created by The eXo Platform SAS
+ * Jan 19, 2007
+ */
+
+public class SkinConfigDeployer extends AbstractResourceHandler
+{
+
+ /**
+ * Logger
+ */
+ private static final Log LOG = ExoLogger.getLogger(SkinConfigDeployer.class);
+
+ /** . */
+ private final SkinService skinService;
+
+ /**
+ * The name of the portal container
+ */
+ private final String portalContainerName;
+
+ public SkinConfigDeployer(String portalContainerName, SkinService skinService)
+ {
+ this.skinService = skinService;
+ this.portalContainerName = portalContainerName;
+ }
+
+ public void onEvent(WebAppEvent event)
+ {
+ if (event instanceof WebAppLifeCycleEvent)
+ {
+ WebAppLifeCycleEvent waEvent = (WebAppLifeCycleEvent)event;
+ if (waEvent.getType() == WebAppLifeCycleEvent.ADDED)
+ {
+ ServletContext scontext = null;
+ try
+ {
+ scontext = event.getWebApp().getServletContext();
+ InputStream is =
scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/SkinConfigScript.groovy");
+ if (is == null)
+ return;
+ try
+ {
+ is.close();
+ }
+ catch (Exception ex)
+ {
+ // ignore me
+ }
+ final PortalContainerPostInitTask task = new
PortalContainerPostInitTask()
+ {
+
+ public void execute(ServletContext scontext, PortalContainer
portalContainer)
+ {
+ register(scontext, portalContainer);
+ }
+ };
+ PortalContainer.addInitTask(scontext, task, portalContainerName);
+ }
+ catch (Exception ex)
+ {
+ LOG.error("An error occurs while registering
'SkinConfigScript.groovy' from the context '"
+ + (scontext == null ? "unknown" :
scontext.getServletContextName()) + "'", ex);
+ }
+ }
+ }
+ }
+
+ private void register(ServletContext scontext, PortalContainer container)
+ {
+ InputStream is = null;
+ try
+ {
+ is =
scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/SkinConfigScript.groovy");
+ Binding binding = new Binding();
+ binding.setVariable("SkinService", skinService);
+ binding.setVariable("ServletContext", scontext);
+ binding.setVariable("ServletContextName",
scontext.getServletContextName());
+ binding.setVariable("PortalContainerName", container.getName());
+ GroovyShell shell = new GroovyShell(binding);
+ shell.evaluate(is);
+ }
+ catch (Exception ex)
+ {
+ LOG.error("An error occurs while processing
'SkinConfigScript.groovy' from the context '"
+ + scontext.getServletContextName() + "'", ex);
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (IOException e)
+ {
+ // ignore me
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,98 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-/**
- * A key for skin config lookup.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-class SkinKey
-{
-
- private final String module;
-
- private final String name;
-
- private final int hashCode;
-
- /**
- * Creates a new skin key.
- *
- * @param module the skin base
- * @param name the skin name
- * @throws IllegalArgumentException if any argument is null
- */
- public SkinKey(String module, String name) throws IllegalArgumentException
- {
- if (module == null)
- {
- throw new IllegalArgumentException("No null base accepted");
- }
- if (name == null)
- {
- throw new IllegalArgumentException("No null skin name accepted");
- }
-
- //
- this.module = module;
- this.name = name;
- this.hashCode = module.hashCode() * 41 + name.hashCode();
- }
-
- public String getModule()
- {
- return module;
- }
-
- public String getName()
- {
- return name;
- }
-
- public int hashCode()
- {
- return hashCode;
- }
-
- public boolean equals(Object obj)
- {
- if (obj == null)
- {
- return false;
- }
- if (obj == this)
- {
- return true;
- }
- if (obj instanceof SkinKey)
- {
- SkinKey that = (SkinKey)obj;
- return that.module.equals(module) && that.name.equals(name);
- }
- return false;
- }
-
- public String toString()
- {
- return "SkinKey[base=" + module + ",name=" + name +
"]";
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinKey.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,98 @@
+/**
+ * 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.resource;
+
+/**
+ * A key for skin config lookup.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class SkinKey
+{
+
+ private final String module;
+
+ private final String name;
+
+ private final int hashCode;
+
+ /**
+ * Creates a new skin key.
+ *
+ * @param module the skin base
+ * @param name the skin name
+ * @throws IllegalArgumentException if any argument is null
+ */
+ public SkinKey(String module, String name) throws IllegalArgumentException
+ {
+ if (module == null)
+ {
+ throw new IllegalArgumentException("No null base accepted");
+ }
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null skin name accepted");
+ }
+
+ //
+ this.module = module;
+ this.name = name;
+ this.hashCode = module.hashCode() * 41 + name.hashCode();
+ }
+
+ public String getModule()
+ {
+ return module;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof SkinKey)
+ {
+ SkinKey that = (SkinKey)obj;
+ return that.module.equals(module) && that.name.equals(name);
+ }
+ return false;
+ }
+
+ public String toString()
+ {
+ return "SkinKey[base=" + module + ",name=" + name +
"]";
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,557 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.exoplatform.commons.utils.PropertyManager;
-import org.exoplatform.commons.utils.Safe;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.management.annotations.Managed;
-import org.exoplatform.management.annotations.ManagedDescription;
-import org.exoplatform.management.annotations.ManagedName;
-import org.exoplatform.management.jmx.annotations.NameTemplate;
-import org.exoplatform.management.jmx.annotations.Property;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.services.resources.Orientation;
-import org.gatein.wci.impl.DefaultServletContainerFactory;
-import org.picocontainer.Startable;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.servlet.ServletContext;
-
-@Managed
-@NameTemplate({@Property(key = "view", value = "portal"),
@Property(key = "service", value = "management"),
- @Property(key = "type", value = "skin")})
-@ManagedDescription("Skin service")
-public class SkinService implements Startable
-{
-
- protected static Log log = ExoLogger.getLogger("portal.SkinService");
-
- private static final Map<Orientation, String> suffixMap = new
EnumMap<Orientation, String>(Orientation.class);
-
- static
- {
- suffixMap.put(Orientation.LT, "-lt.css");
- suffixMap.put(Orientation.RT, "-rt.css");
- suffixMap.put(Orientation.TL, "-lt.css");
- suffixMap.put(Orientation.TR, "-lt.css");
- }
-
- private static final String LEFT_P = "\\(";
-
- private static final String RIGHT_P = "\\)";
-
- /** Immutable and therefore thread safe. */
- private static final Pattern IMPORT_PATTERN =
- Pattern.compile("(@import\\s+" + "url" + LEFT_P +
"['\"]?" + ")([^'\"]+.css)(" +
"['\"]?" + RIGHT_P + "\\s*;)");
-
- /** Immutable and therefore thread safe. */
- private static final Pattern BACKGROUND_PATTERN =
- Pattern.compile("(background.*:.*url" + LEFT_P +
"['\"]?" + ")([^'\"]+)(" +
"['\"]?" + RIGHT_P + ".*;)");
-
- /** Immutable and therefore thread safe. */
- private static final Pattern LT =
Pattern.compile("/\\*\\s*orientation=lt\\s*\\*/");
-
- /** Immutable and therefore thread safe. */
- private static final Pattern RT =
Pattern.compile("/\\*\\s*orientation=rt\\s*\\*/");
-
- /** One month caching. */
- private static final int ONE_MONTH = 2592000;
-
- /** One hour caching. */
- private static final int ONE_HOUR = 3600;
-
- /** The deployer. */
- private final AbstractResourceHandler deployer;
-
- private final Map<SkinKey, SkinConfig> portalSkins_;
-
- private final Map<SkinKey, SkinConfig> skinConfigs_;
-
- private final HashSet<String> availableSkins_;
-
- private final Map<String, String> ltCache;
-
- private final Map<String, String> rtCache;
-
- private final Map<String, Set<String>> portletThemes_;
-
- private final MainResourceResolver mainResolver;
-
- /**
- * The name of the portal container
- */
- final String portalContainerName;
-
- /**
- * An id used for caching request. The id life cycle is the same than the class
instance because
- * we consider css will change until server is restarted. Of course this only applies
for the
- * developing mode set to false.
- */
- final String id = Long.toString(System.currentTimeMillis());
-
- /** Temporary hack. */
- //private static final List<String> skinBlackList =
Arrays.asList("Vista", "Mac");
- private static final List<String> skinBlackList = new
ArrayList<String>();
-
- public SkinService(ExoContainerContext context)
- {
- portalSkins_ = new LinkedHashMap<SkinKey, SkinConfig>();
- skinConfigs_ = new LinkedHashMap<SkinKey, SkinConfig>(20);
- availableSkins_ = new HashSet<String>(5);
- ltCache = new ConcurrentHashMap<String, String>();
- rtCache = new ConcurrentHashMap<String, String>();
- portletThemes_ = new HashMap<String, Set<String>>();
- portalContainerName = context.getPortalContainerName();
- mainResolver = new MainResourceResolver(portalContainerName, skinConfigs_);
- //deployer = new SkinConfigDeployer(portalContainerName, this);
- deployer = new GateinSkinConfigDeployer(portalContainerName, this);
- }
-
- public void addCategoryTheme(String categoryName)
- {
- if (!portletThemes_.containsKey(categoryName))
- portletThemes_.put(categoryName, new HashSet<String>());
- }
-
- public void addPortalSkin(String module, String skinName, String cssPath,
ServletContext scontext)
- {
- addPortalSkin(module, skinName, cssPath, scontext, false);
- }
-
- /**
- * Register the stylesheet for a portal Skin.
- *
- * @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
- */
- public void addPortalSkin(String module, String skinName, String cssPath,
ServletContext scontext, boolean overwrite)
- {
-
- // Triggers a put if absent
- mainResolver.registerContext(scontext);
-
- 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);
- portalSkins_.put(key, skinConfig);
- }
- }
-
- public void addPortalSkin(String module, String skinName, String cssPath, String
cssData)
- {
- SkinKey key = new SkinKey(module, skinName);
- SkinConfig skinConfig = portalSkins_.get(key);
- if (skinConfig == null)
- {
- portalSkins_.put(key, new SimpleSkin(this, module, skinName, cssPath));
- }
- ltCache.put(cssPath, cssData);
- rtCache.put(cssPath, cssData);
- }
-
- public void addSkin(String module, String skinName, String cssPath, ServletContext
scontext)
- {
- addSkin(module, skinName, cssPath, scontext, false);
- }
-
- /**
- * Merge several skins into one single skin.
- *
- * @param skins the skins to merge
- * @return the merged skin
- */
- public Skin merge(Collection<SkinConfig> skins)
- {
- return new CompositeSkin(this, skins);
- }
-
- /**
- * Add a resource resolver to plug external resolvers.
- *
- * @param resolver a resolver to add
- */
- public void addResourceResolver(ResourceResolver resolver)
- {
- mainResolver.resolvers.addIfAbsent(resolver);
- }
-
- public void addSkin(String module, String skinName, String cssPath, ServletContext
scontext, boolean overwrite)
- {
- // Triggers a put if absent
- mainResolver.registerContext(scontext);
-
- 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);
- skinConfigs_.put(key, skinConfig);
- }
- }
-
- public void addSkin(String module, String skinName, String cssPath, String cssData)
- {
- //
- availableSkins_.add(skinName);
- SkinKey key = new SkinKey(module, skinName);
- SkinConfig skinConfig = skinConfigs_.get(key);
- if (skinConfig == null)
- {
- skinConfigs_.put(key, new SimpleSkin(this, module, skinName, cssPath));
- }
- ltCache.put(cssPath, cssData);
- rtCache.put(cssPath, cssData);
- }
-
- public void addTheme(String categoryName, List<String> themesName)
- {
- if (!portletThemes_.containsKey(categoryName))
- portletThemes_.put(categoryName, new HashSet<String>());
- Set<String> catThemes = portletThemes_.get(categoryName);
- for (String theme : themesName)
- catThemes.add(theme);
- }
-
- /**
- * Get names of all the currently registered skins.
- *
- * @return an unmodifiable Set of the currently registered skins
- */
- public Set<String> getAvailableSkinNames()
- {
- return availableSkins_;
- }
-
- /**
- * Return the CSS content of the file specified by the given URI.
- *
- * @param cssPath path of the css to find
- * @return the css
- */
- public String getCSS(String cssPath)
- {
- try
- {
- final StringBuilder sb = new StringBuilder();
- renderCSS(new ResourceRenderer()
- {
- public Appendable getAppendable()
- {
- return sb;
- }
-
- public void setExpiration(long seconds)
- {
-
- }
- }, cssPath);
- return sb.toString();
- }
- catch (IOException e)
- {
- log.error("Error while rendering css " + cssPath, e);
- return null;
- }
- catch (RenderingException e)
- {
- log.error("Error while rendering css " + cssPath, e);
- return null;
- }
- }
-
- public void renderCSS(ResourceRenderer renderer, String path) throws
RenderingException, IOException
- {
- Orientation orientation = Orientation.LT;
- if (path.endsWith("-lt.css"))
- {
- path = path.substring(0, path.length() - "-lt.css".length()) +
".css";
- }
- else if (path.endsWith("-rt.css"))
- {
- path = path.substring(0, path.length() - "-rt.css".length()) +
".css";
- orientation = Orientation.RT;
- }
-
- // Try cache first
- if (!PropertyManager.isDevelopping())
- {
-
- if (path.startsWith("/" + portalContainerName +
"/resource"))
- {
- renderer.setExpiration(ONE_MONTH);
- }
- else
- {
- renderer.setExpiration(ONE_HOUR);
- }
-
- //
- Map<String, String> cache = orientation == Orientation.LT ? ltCache :
rtCache;
- String css = cache.get(path);
- if (css == null)
- {
- StringBuilder sb = new StringBuilder();
- processCSS(sb, path, orientation, true);
- css = sb.toString();
- cache.put(path, css);
- }
- renderer.getAppendable().append(css);
- }
- else
- {
- processCSS(renderer.getAppendable(), path, orientation, false);
- }
- }
-
- public String getMergedCSS(String cssPath)
- {
- return ltCache.get(cssPath);
- }
-
- public Collection<SkinConfig> getPortalSkins(String skinName)
- {
- Set<SkinKey> keys = portalSkins_.keySet();
- Collection<SkinConfig> portalSkins = new ArrayList<SkinConfig>();
- for (SkinKey key : keys)
- {
- if (key.getName().equals(skinName))
- portalSkins.add(portalSkins_.get(key));
- }
- return portalSkins;
- }
-
- public Map<String, Set<String>> getPortletThemes()
- {
- return portletThemes_;
- }
-
- public SkinConfig getSkin(String module, String skinName)
- {
- SkinConfig config = skinConfigs_.get(new SkinKey(module, skinName));
- if (config == null)
- skinConfigs_.get(new SkinKey(module, "Default"));
- return config;
- }
-
- public void invalidatePortalSkinCache(String portalName, String skinName)
- {
- SkinKey key = new SkinKey(portalName, skinName);
- skinConfigs_.remove(key);
- }
-
- public void remove(String module, String skinName) throws Exception
- {
- SkinKey key;
- if (skinName.length() == 0)
- key = new SkinKey(module, "Default");
- else
- key = new SkinKey(module, skinName);
- skinConfigs_.remove(key);
- }
-
- public int size()
- {
- return skinConfigs_.size();
- }
-
- private void processCSS(Appendable appendable, String cssPath, Orientation
orientation, boolean merge)
- throws RenderingException, IOException
- {
- Resource skin = mainResolver.resolve(cssPath);
- processCSSRecursively(appendable, merge, skin, orientation);
- }
-
- private void processCSSRecursively(Appendable appendable, boolean merge, Resource
skin, Orientation orientation)
- throws RenderingException, IOException
- {
-
- // The root URL for the entry
- String basePath = skin.getContextPath() + skin.getParentPath();
-
- //
- String line = "";
- Reader tmp = skin.read();
- if (tmp == null)
- {
- throw new RenderingException("No skin resolved for path " +
skin.getResourcePath());
- }
- BufferedReader reader = new BufferedReader(tmp);
- try
- {
- while ((line = reader.readLine()) != null)
- {
- Matcher matcher = IMPORT_PATTERN.matcher(line);
- if (matcher.find())
- {
- String includedPath = matcher.group(2);
- if (includedPath.startsWith("/"))
- {
- if (merge)
- {
- Resource ssskin = mainResolver.resolve(includedPath);
- processCSSRecursively(appendable, merge, ssskin, orientation);
- }
- else
- {
- appendable.append(matcher.group(1)).append(
- includedPath.substring(0, includedPath.length() -
".css".length())).append(
-
getSuffix(orientation)).append(matcher.group(3)).append("\n");
- }
- }
- else
- {
- if (merge)
- {
- String path = skin.getContextPath() + skin.getParentPath() +
includedPath;
- Resource ssskin = mainResolver.resolve(path);
- processCSSRecursively(appendable, merge, ssskin, orientation);
- }
- else
- {
- appendable.append(matcher.group(1));
- appendable.append(basePath);
- appendable.append(includedPath.substring(0, includedPath.length() -
".css".length()));
- appendable.append(getSuffix(orientation));
- appendable.append(matcher.group(3));
- }
- }
- }
- else
- {
- if (orientation == null || wantInclude(line, orientation))
- {
- append(line, basePath, appendable);
- }
- }
- }
- }
- finally
- {
- Safe.close(reader);
- }
- }
-
- /**
- * Filter what if it's annotated with the alternative orientation.
- *
- * @param line the line to include
- * @param orientation the orientation
- * @return true if the line is included
- */
- private boolean wantInclude(String line, Orientation orientation)
- {
- Pattern orientationPattern = orientation == Orientation.LT ? RT : LT;
- Matcher matcher2 = orientationPattern.matcher(line);
- return !matcher2.find();
- }
-
- private void append(String line, String basePath, Appendable appendable) throws
IOException
- {
- // Rewrite background url pattern
- Matcher matcher = BACKGROUND_PATTERN.matcher(line);
- if (matcher.find() && !matcher.group(2).startsWith("\"/")
&& !matcher.group(2).startsWith("'/")
- && !matcher.group(2).startsWith("/"))
- {
-
appendable.append(matcher.group(1)).append(basePath).append(matcher.group(2)).append(matcher.group(3)).append(
- '\n');
- }
- else
- {
- appendable.append(line).append('\n');
- }
- }
-
- String getSuffix(Orientation orientation)
- {
- if (orientation == null)
- {
- orientation = Orientation.LT;
- }
- return suffixMap.get(orientation);
- }
-
- @Managed
- @ManagedDescription("The list of registered skins identifiers")
- public String[] getSkinList()
- {
- // get all available skin
- List<String> availableSkin = new ArrayList<String>();
- for (String skin : availableSkins_)
- {
- availableSkin.add(skin);
- }
- // sort skin name asc
- Collections.sort(availableSkin);
-
- return availableSkin.toArray(new String[availableSkin.size()]);
- }
-
- @Managed
- @ManagedDescription("Reload all skins")
- public void reloadSkins()
- {
- // remove all ltCache, rtCache
- ltCache.clear();
- rtCache.clear();
- }
-
- @Managed
- @ManagedDescription("Reload a specified skin")
- public void reloadSkin(@ManagedDescription("The skin id")
@ManagedName("skinId") String skinId)
- {
- ltCache.remove(skinId);
- rtCache.remove(skinId);
- }
-
- public void start()
- {
-
DefaultServletContainerFactory.getInstance().getServletContainer().addWebAppListener(deployer);
- }
-
- public void stop()
- {
-
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(deployer);
- }
-}
\ No newline at end of file
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinService.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,557 @@
+/**
+ * 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.resource;
+
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.management.annotations.Managed;
+import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.management.jmx.annotations.NameTemplate;
+import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.resources.Orientation;
+import org.gatein.wci.impl.DefaultServletContainerFactory;
+import org.picocontainer.Startable;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletContext;
+
+@Managed
+@NameTemplate({@Property(key = "view", value = "portal"),
@Property(key = "service", value = "management"),
+ @Property(key = "type", value = "skin")})
+@ManagedDescription("Skin service")
+public class SkinService implements Startable
+{
+
+ protected static Log log = ExoLogger.getLogger("portal.SkinService");
+
+ private static final Map<Orientation, String> suffixMap = new
EnumMap<Orientation, String>(Orientation.class);
+
+ static
+ {
+ suffixMap.put(Orientation.LT, "-lt.css");
+ suffixMap.put(Orientation.RT, "-rt.css");
+ suffixMap.put(Orientation.TL, "-lt.css");
+ suffixMap.put(Orientation.TR, "-lt.css");
+ }
+
+ private static final String LEFT_P = "\\(";
+
+ private static final String RIGHT_P = "\\)";
+
+ /** Immutable and therefore thread safe. */
+ private static final Pattern IMPORT_PATTERN =
+ Pattern.compile("(@import\\s+" + "url" + LEFT_P +
"['\"]?" + ")([^'\"]+.css)(" +
"['\"]?" + RIGHT_P + "\\s*;)");
+
+ /** Immutable and therefore thread safe. */
+ private static final Pattern BACKGROUND_PATTERN =
+ Pattern.compile("(background.*:.*url" + LEFT_P +
"['\"]?" + ")([^'\"]+)(" +
"['\"]?" + RIGHT_P + ".*;)");
+
+ /** Immutable and therefore thread safe. */
+ private static final Pattern LT =
Pattern.compile("/\\*\\s*orientation=lt\\s*\\*/");
+
+ /** Immutable and therefore thread safe. */
+ private static final Pattern RT =
Pattern.compile("/\\*\\s*orientation=rt\\s*\\*/");
+
+ /** One month caching. */
+ private static final int ONE_MONTH = 2592000;
+
+ /** One hour caching. */
+ private static final int ONE_HOUR = 3600;
+
+ /** The deployer. */
+ private final AbstractResourceHandler deployer;
+
+ private final Map<SkinKey, SkinConfig> portalSkins_;
+
+ private final Map<SkinKey, SkinConfig> skinConfigs_;
+
+ private final HashSet<String> availableSkins_;
+
+ private final Map<String, String> ltCache;
+
+ private final Map<String, String> rtCache;
+
+ private final Map<String, Set<String>> portletThemes_;
+
+ private final MainResourceResolver mainResolver;
+
+ /**
+ * The name of the portal container
+ */
+ final String portalContainerName;
+
+ /**
+ * An id used for caching request. The id life cycle is the same than the class
instance because
+ * we consider css will change until server is restarted. Of course this only applies
for the
+ * developing mode set to false.
+ */
+ final String id = Long.toString(System.currentTimeMillis());
+
+ /** Temporary hack. */
+ //private static final List<String> skinBlackList =
Arrays.asList("Vista", "Mac");
+ private static final List<String> skinBlackList = new
ArrayList<String>();
+
+ public SkinService(ExoContainerContext context)
+ {
+ portalSkins_ = new LinkedHashMap<SkinKey, SkinConfig>();
+ skinConfigs_ = new LinkedHashMap<SkinKey, SkinConfig>(20);
+ availableSkins_ = new HashSet<String>(5);
+ ltCache = new ConcurrentHashMap<String, String>();
+ rtCache = new ConcurrentHashMap<String, String>();
+ portletThemes_ = new HashMap<String, Set<String>>();
+ portalContainerName = context.getPortalContainerName();
+ mainResolver = new MainResourceResolver(portalContainerName, skinConfigs_);
+ //deployer = new SkinConfigDeployer(portalContainerName, this);
+ deployer = new GateinSkinConfigDeployer(portalContainerName, this);
+ }
+
+ public void addCategoryTheme(String categoryName)
+ {
+ if (!portletThemes_.containsKey(categoryName))
+ portletThemes_.put(categoryName, new HashSet<String>());
+ }
+
+ public void addPortalSkin(String module, String skinName, String cssPath,
ServletContext scontext)
+ {
+ addPortalSkin(module, skinName, cssPath, scontext, false);
+ }
+
+ /**
+ * Register the stylesheet for a portal Skin.
+ *
+ * @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
+ */
+ public void addPortalSkin(String module, String skinName, String cssPath,
ServletContext scontext, boolean overwrite)
+ {
+
+ // Triggers a put if absent
+ mainResolver.registerContext(scontext);
+
+ 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);
+ portalSkins_.put(key, skinConfig);
+ }
+ }
+
+ public void addPortalSkin(String module, String skinName, String cssPath, String
cssData)
+ {
+ SkinKey key = new SkinKey(module, skinName);
+ SkinConfig skinConfig = portalSkins_.get(key);
+ if (skinConfig == null)
+ {
+ portalSkins_.put(key, new SimpleSkin(this, module, skinName, cssPath));
+ }
+ ltCache.put(cssPath, cssData);
+ rtCache.put(cssPath, cssData);
+ }
+
+ public void addSkin(String module, String skinName, String cssPath, ServletContext
scontext)
+ {
+ addSkin(module, skinName, cssPath, scontext, false);
+ }
+
+ /**
+ * Merge several skins into one single skin.
+ *
+ * @param skins the skins to merge
+ * @return the merged skin
+ */
+ public Skin merge(Collection<SkinConfig> skins)
+ {
+ return new CompositeSkin(this, skins);
+ }
+
+ /**
+ * Add a resource resolver to plug external resolvers.
+ *
+ * @param resolver a resolver to add
+ */
+ public void addResourceResolver(ResourceResolver resolver)
+ {
+ mainResolver.resolvers.addIfAbsent(resolver);
+ }
+
+ public void addSkin(String module, String skinName, String cssPath, ServletContext
scontext, boolean overwrite)
+ {
+ // Triggers a put if absent
+ mainResolver.registerContext(scontext);
+
+ 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);
+ skinConfigs_.put(key, skinConfig);
+ }
+ }
+
+ public void addSkin(String module, String skinName, String cssPath, String cssData)
+ {
+ //
+ availableSkins_.add(skinName);
+ SkinKey key = new SkinKey(module, skinName);
+ SkinConfig skinConfig = skinConfigs_.get(key);
+ if (skinConfig == null)
+ {
+ skinConfigs_.put(key, new SimpleSkin(this, module, skinName, cssPath));
+ }
+ ltCache.put(cssPath, cssData);
+ rtCache.put(cssPath, cssData);
+ }
+
+ public void addTheme(String categoryName, List<String> themesName)
+ {
+ if (!portletThemes_.containsKey(categoryName))
+ portletThemes_.put(categoryName, new HashSet<String>());
+ Set<String> catThemes = portletThemes_.get(categoryName);
+ for (String theme : themesName)
+ catThemes.add(theme);
+ }
+
+ /**
+ * Get names of all the currently registered skins.
+ *
+ * @return an unmodifiable Set of the currently registered skins
+ */
+ public Set<String> getAvailableSkinNames()
+ {
+ return availableSkins_;
+ }
+
+ /**
+ * Return the CSS content of the file specified by the given URI.
+ *
+ * @param cssPath path of the css to find
+ * @return the css
+ */
+ public String getCSS(String cssPath)
+ {
+ try
+ {
+ final StringBuilder sb = new StringBuilder();
+ renderCSS(new ResourceRenderer()
+ {
+ public Appendable getAppendable()
+ {
+ return sb;
+ }
+
+ public void setExpiration(long seconds)
+ {
+
+ }
+ }, cssPath);
+ return sb.toString();
+ }
+ catch (IOException e)
+ {
+ log.error("Error while rendering css " + cssPath, e);
+ return null;
+ }
+ catch (RenderingException e)
+ {
+ log.error("Error while rendering css " + cssPath, e);
+ return null;
+ }
+ }
+
+ public void renderCSS(ResourceRenderer renderer, String path) throws
RenderingException, IOException
+ {
+ Orientation orientation = Orientation.LT;
+ if (path.endsWith("-lt.css"))
+ {
+ path = path.substring(0, path.length() - "-lt.css".length()) +
".css";
+ }
+ else if (path.endsWith("-rt.css"))
+ {
+ path = path.substring(0, path.length() - "-rt.css".length()) +
".css";
+ orientation = Orientation.RT;
+ }
+
+ // Try cache first
+ if (!PropertyManager.isDevelopping())
+ {
+
+ if (path.startsWith("/" + portalContainerName +
"/resource"))
+ {
+ renderer.setExpiration(ONE_MONTH);
+ }
+ else
+ {
+ renderer.setExpiration(ONE_HOUR);
+ }
+
+ //
+ Map<String, String> cache = orientation == Orientation.LT ? ltCache :
rtCache;
+ String css = cache.get(path);
+ if (css == null)
+ {
+ StringBuilder sb = new StringBuilder();
+ processCSS(sb, path, orientation, true);
+ css = sb.toString();
+ cache.put(path, css);
+ }
+ renderer.getAppendable().append(css);
+ }
+ else
+ {
+ processCSS(renderer.getAppendable(), path, orientation, false);
+ }
+ }
+
+ public String getMergedCSS(String cssPath)
+ {
+ return ltCache.get(cssPath);
+ }
+
+ public Collection<SkinConfig> getPortalSkins(String skinName)
+ {
+ Set<SkinKey> keys = portalSkins_.keySet();
+ Collection<SkinConfig> portalSkins = new ArrayList<SkinConfig>();
+ for (SkinKey key : keys)
+ {
+ if (key.getName().equals(skinName))
+ portalSkins.add(portalSkins_.get(key));
+ }
+ return portalSkins;
+ }
+
+ public Map<String, Set<String>> getPortletThemes()
+ {
+ return portletThemes_;
+ }
+
+ public SkinConfig getSkin(String module, String skinName)
+ {
+ SkinConfig config = skinConfigs_.get(new SkinKey(module, skinName));
+ if (config == null)
+ skinConfigs_.get(new SkinKey(module, "Default"));
+ return config;
+ }
+
+ public void invalidatePortalSkinCache(String portalName, String skinName)
+ {
+ SkinKey key = new SkinKey(portalName, skinName);
+ skinConfigs_.remove(key);
+ }
+
+ public void remove(String module, String skinName) throws Exception
+ {
+ SkinKey key;
+ if (skinName.length() == 0)
+ key = new SkinKey(module, "Default");
+ else
+ key = new SkinKey(module, skinName);
+ skinConfigs_.remove(key);
+ }
+
+ public int size()
+ {
+ return skinConfigs_.size();
+ }
+
+ private void processCSS(Appendable appendable, String cssPath, Orientation
orientation, boolean merge)
+ throws RenderingException, IOException
+ {
+ Resource skin = mainResolver.resolve(cssPath);
+ processCSSRecursively(appendable, merge, skin, orientation);
+ }
+
+ private void processCSSRecursively(Appendable appendable, boolean merge, Resource
skin, Orientation orientation)
+ throws RenderingException, IOException
+ {
+
+ // The root URL for the entry
+ String basePath = skin.getContextPath() + skin.getParentPath();
+
+ //
+ String line = "";
+ Reader tmp = skin.read();
+ if (tmp == null)
+ {
+ throw new RenderingException("No skin resolved for path " +
skin.getResourcePath());
+ }
+ BufferedReader reader = new BufferedReader(tmp);
+ try
+ {
+ while ((line = reader.readLine()) != null)
+ {
+ Matcher matcher = IMPORT_PATTERN.matcher(line);
+ if (matcher.find())
+ {
+ String includedPath = matcher.group(2);
+ if (includedPath.startsWith("/"))
+ {
+ if (merge)
+ {
+ Resource ssskin = mainResolver.resolve(includedPath);
+ processCSSRecursively(appendable, merge, ssskin, orientation);
+ }
+ else
+ {
+ appendable.append(matcher.group(1)).append(
+ includedPath.substring(0, includedPath.length() -
".css".length())).append(
+
getSuffix(orientation)).append(matcher.group(3)).append("\n");
+ }
+ }
+ else
+ {
+ if (merge)
+ {
+ String path = skin.getContextPath() + skin.getParentPath() +
includedPath;
+ Resource ssskin = mainResolver.resolve(path);
+ processCSSRecursively(appendable, merge, ssskin, orientation);
+ }
+ else
+ {
+ appendable.append(matcher.group(1));
+ appendable.append(basePath);
+ appendable.append(includedPath.substring(0, includedPath.length() -
".css".length()));
+ appendable.append(getSuffix(orientation));
+ appendable.append(matcher.group(3));
+ }
+ }
+ }
+ else
+ {
+ if (orientation == null || wantInclude(line, orientation))
+ {
+ append(line, basePath, appendable);
+ }
+ }
+ }
+ }
+ finally
+ {
+ Safe.close(reader);
+ }
+ }
+
+ /**
+ * Filter what if it's annotated with the alternative orientation.
+ *
+ * @param line the line to include
+ * @param orientation the orientation
+ * @return true if the line is included
+ */
+ private boolean wantInclude(String line, Orientation orientation)
+ {
+ Pattern orientationPattern = orientation == Orientation.LT ? RT : LT;
+ Matcher matcher2 = orientationPattern.matcher(line);
+ return !matcher2.find();
+ }
+
+ private void append(String line, String basePath, Appendable appendable) throws
IOException
+ {
+ // Rewrite background url pattern
+ Matcher matcher = BACKGROUND_PATTERN.matcher(line);
+ if (matcher.find() && !matcher.group(2).startsWith("\"/")
&& !matcher.group(2).startsWith("'/")
+ && !matcher.group(2).startsWith("/"))
+ {
+
appendable.append(matcher.group(1)).append(basePath).append(matcher.group(2)).append(matcher.group(3)).append(
+ '\n');
+ }
+ else
+ {
+ appendable.append(line).append('\n');
+ }
+ }
+
+ String getSuffix(Orientation orientation)
+ {
+ if (orientation == null)
+ {
+ orientation = Orientation.LT;
+ }
+ return suffixMap.get(orientation);
+ }
+
+ @Managed
+ @ManagedDescription("The list of registered skins identifiers")
+ public String[] getSkinList()
+ {
+ // get all available skin
+ List<String> availableSkin = new ArrayList<String>();
+ for (String skin : availableSkins_)
+ {
+ availableSkin.add(skin);
+ }
+ // sort skin name asc
+ Collections.sort(availableSkin);
+
+ return availableSkin.toArray(new String[availableSkin.size()]);
+ }
+
+ @Managed
+ @ManagedDescription("Reload all skins")
+ public void reloadSkins()
+ {
+ // remove all ltCache, rtCache
+ ltCache.clear();
+ rtCache.clear();
+ }
+
+ @Managed
+ @ManagedDescription("Reload a specified skin")
+ public void reloadSkin(@ManagedDescription("The skin id")
@ManagedName("skinId") String skinId)
+ {
+ ltCache.remove(skinId);
+ rtCache.remove(skinId);
+ }
+
+ public void start()
+ {
+
DefaultServletContainerFactory.getInstance().getServletContainer().addWebAppListener(deployer);
+ }
+
+ public void stop()
+ {
+
DefaultServletContainerFactory.getInstance().getServletContainer().removeWebAppListener(deployer);
+ }
+}
\ No newline at end of file
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,46 +0,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.
- */
-
-package org.exoplatform.portal.resource;
-
-import org.exoplatform.services.resources.Orientation;
-
-/**
- * The URL of a skin.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public interface SkinURL
-{
-
- /**
- * Sets the orientation on the skin URL.
- *
- * @param orientation the orientation
- */
- void setOrientation(Orientation orientation);
-
- /**
- * This method is used to compute the path of a CSS.
- *
- * @return the CSS path, containing the orientation suffix.
- */
- String toString();
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/SkinURL.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,46 @@
+/**
+ * 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.resource;
+
+import org.exoplatform.services.resources.Orientation;
+
+/**
+ * The URL of a skin.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public interface SkinURL
+{
+
+ /**
+ * Sets the orientation on the skin URL.
+ *
+ * @param orientation the orientation
+ */
+ void setOrientation(Orientation orientation);
+
+ /**
+ * This method is used to compute the path of a CSS.
+ *
+ * @return the CSS path, containing the orientation suffix.
+ */
+ String toString();
+}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config)
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks)
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,37 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.tasks;
-
-import org.exoplatform.portal.resource.SkinService;
-
-import javax.servlet.ServletContext;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-abstract public class AbstractSkinTask
-{
- abstract public void execute(SkinService skinService, ServletContext scontext);
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/AbstractSkinTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,37 @@
+/**
+ * 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.resource.config.tasks;
+
+import org.exoplatform.portal.resource.SkinService;
+
+import javax.servlet.ServletContext;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+abstract public class AbstractSkinTask
+{
+ abstract public void execute(SkinService skinService, ServletContext scontext);
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,49 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.tasks;
-
-import org.exoplatform.portal.resource.SkinService;
-
-import javax.servlet.ServletContext;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public class I18nTask extends AbstractSkinTask
-{
-
- public I18nTask()
- {
-
- }
-
- @Override
- public void execute(SkinService skinService, ServletContext scontext)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/I18nTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,49 @@
+/**
+ * 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.resource.config.tasks;
+
+import org.exoplatform.portal.resource.SkinService;
+
+import javax.servlet.ServletContext;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+public class I18nTask extends AbstractSkinTask
+{
+
+ public I18nTask()
+ {
+
+ }
+
+ @Override
+ public void execute(SkinService skinService, ServletContext scontext)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,62 +0,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.
- */
-package org.exoplatform.portal.resource.config.tasks;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-
-import org.exoplatform.web.application.javascript.JavascriptConfigService;
-
-/**
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
- * @version $Id$
- *
- */
-public class JavascriptTask
-{
-
- private List<Parameter> parameters;
-
- public JavascriptTask(){
- parameters = new ArrayList<Parameter>();
- }
-
- public void execute(JavascriptConfigService service, ServletContext scontext){
- for(Parameter param : parameters){
- service.addJavascript(param.moduleName, param.scriptPath, scontext);
- }
- }
-
- public void addParam(String moduleName, String scriptPath){
- parameters.add(new Parameter(moduleName, scriptPath));
- }
-
- private class Parameter {
-
- private String moduleName;
- private String scriptPath;
-
- Parameter(String _moduleName, String _scriptPath){
- moduleName = _moduleName;
- scriptPath = _scriptPath;
- }
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,62 @@
+/*
+ * 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.resource.config.tasks;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+
+import org.exoplatform.web.application.javascript.JavascriptConfigService;
+
+/**
+ * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
+ * @version $Id$
+ *
+ */
+public class JavascriptTask
+{
+
+ private List<Parameter> parameters;
+
+ public JavascriptTask(){
+ parameters = new ArrayList<Parameter>();
+ }
+
+ public void execute(JavascriptConfigService service, ServletContext scontext){
+ for(Parameter param : parameters){
+ service.addJavascript(param.moduleName, param.scriptPath, scontext);
+ }
+ }
+
+ public void addParam(String moduleName, String scriptPath){
+ parameters.add(new Parameter(moduleName, scriptPath));
+ }
+
+ private class Parameter {
+
+ private String moduleName;
+ private String scriptPath;
+
+ Parameter(String _moduleName, String _scriptPath){
+ moduleName = _moduleName;
+ scriptPath = _scriptPath;
+ }
+ }
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,87 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.tasks;
-
-import org.exoplatform.portal.resource.SkinService;
-
-import javax.servlet.ServletContext;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public class PortalSkinTask extends AbstractSkinTask
-{
-
- private static final String DEFAULT_MODULE_NAME = "CoreSkin";
-
- private static final String DEFAULT_SKIN_NAME = "Default";
-
- private String moduleName;
-
- private String skinName;
-
- private String cssPath;
-
- private boolean overwrite;
-
- public PortalSkinTask()
- {
- this.overwrite = true;
- this.moduleName = DEFAULT_MODULE_NAME;
- this.skinName = DEFAULT_SKIN_NAME;
- }
-
- public void setModuleName(String _moduleName)
- {
- this.moduleName = _moduleName;
- }
-
- public void setSkinName(String _skinName)
- {
- this.skinName = _skinName;
- }
-
- public void setCSSPath(String _cssPath)
- {
- this.cssPath = _cssPath;
- }
-
- public void setOverwrite(boolean _overwrite)
- {
- this.overwrite = _overwrite;
- }
-
- @Override
- public void execute(SkinService skinService, ServletContext scontext)
- {
- if (moduleName == null || skinName == null || cssPath == null)
- {
- return;
- }
- String fullCSSPath = scontext.getContextPath() + cssPath;
- skinService.addPortalSkin(moduleName, skinName, fullCSSPath, scontext, overwrite);
- }
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortalSkinTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,87 @@
+/**
+ * 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.resource.config.tasks;
+
+import org.exoplatform.portal.resource.SkinService;
+
+import javax.servlet.ServletContext;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+public class PortalSkinTask extends AbstractSkinTask
+{
+
+ private static final String DEFAULT_MODULE_NAME = "CoreSkin";
+
+ private static final String DEFAULT_SKIN_NAME = "Default";
+
+ private String moduleName;
+
+ private String skinName;
+
+ private String cssPath;
+
+ private boolean overwrite;
+
+ public PortalSkinTask()
+ {
+ this.overwrite = true;
+ this.moduleName = DEFAULT_MODULE_NAME;
+ this.skinName = DEFAULT_SKIN_NAME;
+ }
+
+ public void setModuleName(String _moduleName)
+ {
+ this.moduleName = _moduleName;
+ }
+
+ public void setSkinName(String _skinName)
+ {
+ this.skinName = _skinName;
+ }
+
+ public void setCSSPath(String _cssPath)
+ {
+ this.cssPath = _cssPath;
+ }
+
+ public void setOverwrite(boolean _overwrite)
+ {
+ this.overwrite = _overwrite;
+ }
+
+ @Override
+ public void execute(SkinService skinService, ServletContext scontext)
+ {
+ if (moduleName == null || skinName == null || cssPath == null)
+ {
+ return;
+ }
+ String fullCSSPath = scontext.getContextPath() + cssPath;
+ skinService.addPortalSkin(moduleName, skinName, fullCSSPath, scontext, overwrite);
+ }
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,94 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.tasks;
-
-import org.exoplatform.portal.resource.SkinService;
-
-import javax.servlet.ServletContext;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public class PortletSkinTask extends AbstractSkinTask
-{
-
- private String applicationName;
-
- private String portletName;
-
- private String skinName;
-
- private String cssPath;
-
- private boolean overwrite;
-
- public PortletSkinTask()
- {
- this.skinName = "Default";
- this.overwrite = true;
- }
-
- public void setApplicationName(String _applicationName)
- {
- this.applicationName = _applicationName;
- }
-
- public void setPortletName(String _portletName)
- {
- this.portletName = _portletName;
- }
-
- public void setSkinName(String _skinName)
- {
- this.skinName = _skinName;
- }
-
- public void setCSSPath(String _cssPath)
- {
- this.cssPath = _cssPath;
- }
-
- public void setOverwrite(boolean _overwrite)
- {
- this.overwrite = _overwrite;
- }
-
- @Override
- public void execute(SkinService skinService, ServletContext scontext)
- {
- if (portletName == null || skinName == null || cssPath == null)
- {
- return;
- }
- if (applicationName == null)
- {
- applicationName = scontext.getContextPath();
- }
- String moduleName = applicationName + "/" + portletName;
- String fullCSSPath = scontext.getContextPath() + cssPath;
- skinService.addSkin(moduleName, skinName, fullCSSPath, scontext, overwrite);
- }
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/PortletSkinTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,94 @@
+/**
+ * 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.resource.config.tasks;
+
+import org.exoplatform.portal.resource.SkinService;
+
+import javax.servlet.ServletContext;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+public class PortletSkinTask extends AbstractSkinTask
+{
+
+ private String applicationName;
+
+ private String portletName;
+
+ private String skinName;
+
+ private String cssPath;
+
+ private boolean overwrite;
+
+ public PortletSkinTask()
+ {
+ this.skinName = "Default";
+ this.overwrite = true;
+ }
+
+ public void setApplicationName(String _applicationName)
+ {
+ this.applicationName = _applicationName;
+ }
+
+ public void setPortletName(String _portletName)
+ {
+ this.portletName = _portletName;
+ }
+
+ public void setSkinName(String _skinName)
+ {
+ this.skinName = _skinName;
+ }
+
+ public void setCSSPath(String _cssPath)
+ {
+ this.cssPath = _cssPath;
+ }
+
+ public void setOverwrite(boolean _overwrite)
+ {
+ this.overwrite = _overwrite;
+ }
+
+ @Override
+ public void execute(SkinService skinService, ServletContext scontext)
+ {
+ if (portletName == null || skinName == null || cssPath == null)
+ {
+ return;
+ }
+ if (applicationName == null)
+ {
+ applicationName = scontext.getContextPath();
+ }
+ String moduleName = applicationName + "/" + portletName;
+ String fullCSSPath = scontext.getContextPath() + cssPath;
+ skinService.addSkin(moduleName, skinName, fullCSSPath, scontext, overwrite);
+ }
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,70 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.tasks;
-
-import org.exoplatform.portal.resource.SkinService;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public class ThemeTask extends AbstractSkinTask
-{
-
- private String styleName;
-
- private List<String> themeNames;
-
- public ThemeTask()
- {
- this.themeNames = new ArrayList<String>();
- }
-
- public void addThemeName(String _themeName)
- {
- //TODO: Check duplicated theme name
- this.themeNames.add(_themeName);
- }
-
- public void setStyleName(String _styleName)
- {
- this.styleName = _styleName;
- }
-
- @Override
- public void execute(SkinService skinService, ServletContext scontext)
- {
- if (styleName == null || themeNames.size() < 1)
- {
- return;
- }
- skinService.addTheme(styleName, themeNames);
- }
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/ThemeTask.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,70 @@
+/**
+ * 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.resource.config.tasks;
+
+import org.exoplatform.portal.resource.SkinService;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+public class ThemeTask extends AbstractSkinTask
+{
+
+ private String styleName;
+
+ private List<String> themeNames;
+
+ public ThemeTask()
+ {
+ this.themeNames = new ArrayList<String>();
+ }
+
+ public void addThemeName(String _themeName)
+ {
+ //TODO: Check duplicated theme name
+ this.themeNames.add(_themeName);
+ }
+
+ public void setStyleName(String _styleName)
+ {
+ this.styleName = _styleName;
+ }
+
+ @Override
+ public void execute(SkinService skinService, ServletContext scontext)
+ {
+ if (styleName == null || themeNames.size() < 1)
+ {
+ return;
+ }
+ skinService.addTheme(styleName, themeNames);
+ }
+
+}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml)
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,197 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.xml;
-
-import org.exoplatform.portal.resource.config.tasks.AbstractSkinTask;
-import org.exoplatform.portal.resource.config.tasks.PortalSkinTask;
-import org.exoplatform.portal.resource.config.tasks.PortletSkinTask;
-import org.exoplatform.portal.resource.config.tasks.ThemeTask;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 17, 2009
- */
-public abstract class AbstractTaskXMLBinding
-{
-
- /** Bind an XML element to a skin task */
- abstract public AbstractSkinTask xmlToTask(Element element);
-
- public static class PortalSkinTaskXMLBinding extends AbstractTaskXMLBinding
- {
-
- @Override
- public AbstractSkinTask xmlToTask(Element element)
- {
- if (!element.getTagName().equals(GateinResource.PORTAl_SKIN_TAG))
- {
- return null;
- }
- PortalSkinTask pTask = new PortalSkinTask();
- bindingCSSPath(pTask, element);
- bindingSkinName(pTask, element);
-
- return pTask;
- }
-
- private void bindingCSSPath(PortalSkinTask task, Element element)
- {
- NodeList nodes = element.getElementsByTagName(GateinResource.CSS_PATH_TAG);
- if (nodes == null || nodes.getLength() < 1)
- {
- return;
- }
- String cssPath = nodes.item(0).getFirstChild().getNodeValue();
- task.setCSSPath(cssPath);
- }
-
- private void bindingSkinName(PortalSkinTask task, Element element)
- {
- NodeList nodes = element.getElementsByTagName(GateinResource.SKIN_NAME_TAG);
- if (nodes == null || nodes.getLength() < 1)
- {
- return;
- }
- String skinName = nodes.item(0).getFirstChild().getNodeValue();
- task.setSkinName(skinName);
- }
-
- }
-
- public static class ThemeTaskXMLBinding extends AbstractTaskXMLBinding
- {
- @Override
- public AbstractSkinTask xmlToTask(Element element)
- {
- if (!element.getTagName().equals(GateinResource.WINDOW_STYLE_TAG))
- {
- return null;
- }
- ThemeTask tTask = new ThemeTask();
-
- bindingStyleName(tTask, element);
- bindingThemeNames(tTask, element);
-
- return tTask;
- }
-
- private void bindingStyleName(ThemeTask task, Element element)
- {
- NodeList nodes = element.getElementsByTagName(GateinResource.STYLE_NAME_TAG);
- if (nodes == null || nodes.getLength() < 1)
- {
- return;
- }
- String styleName = nodes.item(0).getFirstChild().getNodeValue();
- task.setStyleName(styleName);
- }
-
- private void bindingThemeNames(ThemeTask task, Element element)
- {
- NodeList nodes = element.getElementsByTagName(GateinResource.THEME_NAME_TAG);
- if (nodes == null)
- {
- return;
- }
- for (int i = nodes.getLength() - 1; i >= 0; i--)
- {
- task.addThemeName(nodes.item(i).getFirstChild().getNodeValue());
- }
- }
- }
-
- public static class PortletSkinTaskXMLBinding extends AbstractTaskXMLBinding
- {
- @Override
- public AbstractSkinTask xmlToTask(Element element)
- {
- if (!element.getTagName().equals(GateinResource.PORTLET_SKIN_TAG))
- {
- return null;
- }
- PortletSkinTask pTask = new PortletSkinTask();
- bindingApplicationName(pTask, element);
- bindingPortletName(pTask, element);
- bindingCSSPath(pTask, element);
- bindingSkinName(pTask, element);
- return pTask;
- }
-
- private void bindingApplicationName(PortletSkinTask task, Element element)
- {
- NodeList nodes =
element.getElementsByTagName(GateinResource.APPLICATION_NAME_TAG);
- if (nodes == null || nodes.getLength() < 1)
- {
- return;
- }
- String applicationName = nodes.item(0).getFirstChild().getNodeValue();
- task.setApplicationName(applicationName);
- }
-
- private void bindingPortletName(PortletSkinTask task, Element element)
- {
- NodeList nodes = element.getElementsByTagName(GateinResource.PORTLET_NAME_TAG);
- if (nodes == null || nodes.getLength() < 1)
- {
- return;
- }
- String portletName = nodes.item(0).getFirstChild().getNodeValue();
- task.setPortletName(portletName);
- }
-
- private void bindingCSSPath(PortletSkinTask task, Element element)
- {
- NodeList nodes = element.getElementsByTagName(GateinResource.CSS_PATH_TAG);
- if (nodes == null || nodes.getLength() < 1)
- {
- return;
- }
- String cssPath = nodes.item(0).getFirstChild().getNodeValue();
- task.setCSSPath(cssPath);
- }
-
- private void bindingSkinName(PortletSkinTask task, Element element)
- {
- NodeList nodes = element.getElementsByTagName(GateinResource.SKIN_NAME_TAG);
- if (nodes == null || nodes.getLength() < 1)
- {
- return;
- }
- String skinName = nodes.item(0).getFirstChild().getNodeValue();
- task.setSkinName(skinName);
- }
- }
-
- public static class I18nTaskXMLBinding extends AbstractTaskXMLBinding
- {
- @Override
- public AbstractSkinTask xmlToTask(Element element)
- {
- return null;
- }
- }
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/AbstractTaskXMLBinding.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,197 @@
+/**
+ * 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.resource.config.xml;
+
+import org.exoplatform.portal.resource.config.tasks.AbstractSkinTask;
+import org.exoplatform.portal.resource.config.tasks.PortalSkinTask;
+import org.exoplatform.portal.resource.config.tasks.PortletSkinTask;
+import org.exoplatform.portal.resource.config.tasks.ThemeTask;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 17, 2009
+ */
+public abstract class AbstractTaskXMLBinding
+{
+
+ /** Bind an XML element to a skin task */
+ abstract public AbstractSkinTask xmlToTask(Element element);
+
+ public static class PortalSkinTaskXMLBinding extends AbstractTaskXMLBinding
+ {
+
+ @Override
+ public AbstractSkinTask xmlToTask(Element element)
+ {
+ if (!element.getTagName().equals(GateinResource.PORTAl_SKIN_TAG))
+ {
+ return null;
+ }
+ PortalSkinTask pTask = new PortalSkinTask();
+ bindingCSSPath(pTask, element);
+ bindingSkinName(pTask, element);
+
+ return pTask;
+ }
+
+ private void bindingCSSPath(PortalSkinTask task, Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(GateinResource.CSS_PATH_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ String cssPath = nodes.item(0).getFirstChild().getNodeValue();
+ task.setCSSPath(cssPath);
+ }
+
+ private void bindingSkinName(PortalSkinTask task, Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(GateinResource.SKIN_NAME_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ String skinName = nodes.item(0).getFirstChild().getNodeValue();
+ task.setSkinName(skinName);
+ }
+
+ }
+
+ public static class ThemeTaskXMLBinding extends AbstractTaskXMLBinding
+ {
+ @Override
+ public AbstractSkinTask xmlToTask(Element element)
+ {
+ if (!element.getTagName().equals(GateinResource.WINDOW_STYLE_TAG))
+ {
+ return null;
+ }
+ ThemeTask tTask = new ThemeTask();
+
+ bindingStyleName(tTask, element);
+ bindingThemeNames(tTask, element);
+
+ return tTask;
+ }
+
+ private void bindingStyleName(ThemeTask task, Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(GateinResource.STYLE_NAME_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ String styleName = nodes.item(0).getFirstChild().getNodeValue();
+ task.setStyleName(styleName);
+ }
+
+ private void bindingThemeNames(ThemeTask task, Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(GateinResource.THEME_NAME_TAG);
+ if (nodes == null)
+ {
+ return;
+ }
+ for (int i = nodes.getLength() - 1; i >= 0; i--)
+ {
+ task.addThemeName(nodes.item(i).getFirstChild().getNodeValue());
+ }
+ }
+ }
+
+ public static class PortletSkinTaskXMLBinding extends AbstractTaskXMLBinding
+ {
+ @Override
+ public AbstractSkinTask xmlToTask(Element element)
+ {
+ if (!element.getTagName().equals(GateinResource.PORTLET_SKIN_TAG))
+ {
+ return null;
+ }
+ PortletSkinTask pTask = new PortletSkinTask();
+ bindingApplicationName(pTask, element);
+ bindingPortletName(pTask, element);
+ bindingCSSPath(pTask, element);
+ bindingSkinName(pTask, element);
+ return pTask;
+ }
+
+ private void bindingApplicationName(PortletSkinTask task, Element element)
+ {
+ NodeList nodes =
element.getElementsByTagName(GateinResource.APPLICATION_NAME_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ String applicationName = nodes.item(0).getFirstChild().getNodeValue();
+ task.setApplicationName(applicationName);
+ }
+
+ private void bindingPortletName(PortletSkinTask task, Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(GateinResource.PORTLET_NAME_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ String portletName = nodes.item(0).getFirstChild().getNodeValue();
+ task.setPortletName(portletName);
+ }
+
+ private void bindingCSSPath(PortletSkinTask task, Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(GateinResource.CSS_PATH_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ String cssPath = nodes.item(0).getFirstChild().getNodeValue();
+ task.setCSSPath(cssPath);
+ }
+
+ private void bindingSkinName(PortletSkinTask task, Element element)
+ {
+ NodeList nodes = element.getElementsByTagName(GateinResource.SKIN_NAME_TAG);
+ if (nodes == null || nodes.getLength() < 1)
+ {
+ return;
+ }
+ String skinName = nodes.item(0).getFirstChild().getNodeValue();
+ task.setSkinName(skinName);
+ }
+ }
+
+ public static class I18nTaskXMLBinding extends AbstractTaskXMLBinding
+ {
+ @Override
+ public AbstractSkinTask xmlToTask(Element element)
+ {
+ return null;
+ }
+ }
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,62 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.xml;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 17, 2009
- */
-public interface GateinResource
-{
-
- final public static String SKIN_DEF_TAG = "skin-def";
-
- final public static String SKIN_NAME_TAG = "skin-name";
-
- final public static String PORTAl_SKIN_TAG = "portal-skin";
-
- final public static String PORTLET_SKIN_TAG = "portlet-skin";
-
- final public static String PORTLET_NAME_TAG = "portlet-name";
-
- final public static String APPLICATION_NAME_TAG = "application-name";
-
- final public static String CSS_PATH_TAG = "css-path";
-
- final public static String WINDOW_STYLE_TAG = "window-style";
-
- final public static String STYLE_NAME_TAG = "style-name";
-
- final public static String STYLE_THEME_TAG = "style-theme";
-
- final public static String THEME_NAME_TAG = "theme-name";
-
- final public static String JAVA_SCRIPT_TAG = "javascript";
-
- final public static String JAVA_SCRIPT_PARAM = "param";
-
- final public static String JAVA_SCRIPT_MODULE = "js-module";
-
- final public static String JAVA_SCRIPT_PATH = "js-path";
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/GateinResource.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,62 @@
+/**
+ * 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.resource.config.xml;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 17, 2009
+ */
+public interface GateinResource
+{
+
+ final public static String SKIN_DEF_TAG = "skin-def";
+
+ final public static String SKIN_NAME_TAG = "skin-name";
+
+ final public static String PORTAl_SKIN_TAG = "portal-skin";
+
+ final public static String PORTLET_SKIN_TAG = "portlet-skin";
+
+ final public static String PORTLET_NAME_TAG = "portlet-name";
+
+ final public static String APPLICATION_NAME_TAG = "application-name";
+
+ final public static String CSS_PATH_TAG = "css-path";
+
+ final public static String WINDOW_STYLE_TAG = "window-style";
+
+ final public static String STYLE_NAME_TAG = "style-name";
+
+ final public static String STYLE_THEME_TAG = "style-theme";
+
+ final public static String THEME_NAME_TAG = "theme-name";
+
+ final public static String JAVA_SCRIPT_TAG = "javascript";
+
+ final public static String JAVA_SCRIPT_PARAM = "param";
+
+ final public static String JAVA_SCRIPT_MODULE = "js-module";
+
+ final public static String JAVA_SCRIPT_PATH = "js-path";
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,95 +0,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.
- */
-package org.exoplatform.portal.resource.config.xml;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.exoplatform.portal.resource.config.tasks.JavascriptTask;
-import org.exoplatform.web.application.javascript.JavascriptConfigService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
- * @version $Id$
- *
- */
-public class JavascriptConfigParser
-{
-
- public static void processConfigResource(InputStream is, JavascriptConfigService
service, ServletContext scontext){
- List<JavascriptTask> tasks = fetchTasks(is);
- if(tasks != null){
- for(JavascriptTask task : tasks){
- task.execute(service, scontext);
- }
- }
- }
-
- private static List<JavascriptTask> fetchTasks(InputStream is)
- {
- try
- {
- DocumentBuilder docBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = docBuilder.parse(is);
- return fetchTasksFromXMLConfig(document);
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
- private static List<JavascriptTask> fetchTasksFromXMLConfig(Document document){
- List<JavascriptTask> tasks = new ArrayList<JavascriptTask>();
- Element element = document.getDocumentElement();
- NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_TAG);
-
- for(int i = nodes.getLength() - 1 ; i >= 0; i--){
- JavascriptTask task = xmlToTask((Element)nodes.item(i));
- if(task != null){
- tasks.add(task);
- }
- }
- return tasks;
- }
-
- private static JavascriptTask xmlToTask(Element element){
- try{
- JavascriptTask task = new JavascriptTask();
- NodeList nodes =
element.getElementsByTagName(GateinResource.JAVA_SCRIPT_PARAM);
- for(int i = nodes.getLength() - 1 ; i >= 0; i--){
- Element param_ele = (Element)nodes.item(i);
- task.addParam(param_ele.getFirstChild().getNodeValue(),
param_ele.getLastChild().getNodeValue());
- }
- return task;
- }catch(Exception ex){
- return null;
- }
- }
-
-
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,95 @@
+/*
+ * 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.resource.config.xml;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.exoplatform.portal.resource.config.tasks.JavascriptTask;
+import org.exoplatform.web.application.javascript.JavascriptConfigService;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
+ * @version $Id$
+ *
+ */
+public class JavascriptConfigParser
+{
+
+ public static void processConfigResource(InputStream is, JavascriptConfigService
service, ServletContext scontext){
+ List<JavascriptTask> tasks = fetchTasks(is);
+ if(tasks != null){
+ for(JavascriptTask task : tasks){
+ task.execute(service, scontext);
+ }
+ }
+ }
+
+ private static List<JavascriptTask> fetchTasks(InputStream is)
+ {
+ try
+ {
+ DocumentBuilder docBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = docBuilder.parse(is);
+ return fetchTasksFromXMLConfig(document);
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
+
+ private static List<JavascriptTask> fetchTasksFromXMLConfig(Document document){
+ List<JavascriptTask> tasks = new ArrayList<JavascriptTask>();
+ Element element = document.getDocumentElement();
+ NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_TAG);
+
+ for(int i = nodes.getLength() - 1 ; i >= 0; i--){
+ JavascriptTask task = xmlToTask((Element)nodes.item(i));
+ if(task != null){
+ tasks.add(task);
+ }
+ }
+ return tasks;
+ }
+
+ private static JavascriptTask xmlToTask(Element element){
+ try{
+ JavascriptTask task = new JavascriptTask();
+ NodeList nodes =
element.getElementsByTagName(GateinResource.JAVA_SCRIPT_PARAM);
+ for(int i = nodes.getLength() - 1 ; i >= 0; i--){
+ Element param_ele = (Element)nodes.item(i);
+ task.addParam(param_ele.getFirstChild().getNodeValue(),
param_ele.getLastChild().getNodeValue());
+ }
+ return task;
+ }catch(Exception ex){
+ return null;
+ }
+ }
+
+
+}
Deleted:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,123 +0,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.
- */
-
-package org.exoplatform.portal.resource.config.xml;
-
-import org.exoplatform.portal.resource.SkinService;
-import org.exoplatform.portal.resource.config.tasks.AbstractSkinTask;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-/**
- *
- * Created by eXoPlatform SAS
- *
- * Author: Minh Hoang TO - hoang281283(a)gmail.com
- *
- * Sep 16, 2009
- */
-public class SkinConfigParser
-{
-
- private final static Map<String, AbstractTaskXMLBinding> allBindings = new
HashMap<String, AbstractTaskXMLBinding>();
-
- static
- {
- allBindings.put(GateinResource.PORTAl_SKIN_TAG, new
AbstractTaskXMLBinding.PortalSkinTaskXMLBinding());
- allBindings.put(GateinResource.PORTLET_SKIN_TAG, new
AbstractTaskXMLBinding.PortletSkinTaskXMLBinding());
- allBindings.put(GateinResource.WINDOW_STYLE_TAG, new
AbstractTaskXMLBinding.ThemeTaskXMLBinding());
- }
-
- public static void processConfigResource(InputStream is, SkinService skinService,
ServletContext scontext)
- {
- List<AbstractSkinTask> allTasks = fetchTasks(is);
- if (allTasks != null)
- {
- for (AbstractSkinTask task : allTasks)
- {
- task.execute(skinService, scontext);
- }
- }
- }
-
- private static List<AbstractSkinTask> fetchTasks(InputStream is)
- {
- try
- {
- DocumentBuilder docBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = docBuilder.parse(is);
- return fetchTasksFromXMLConfig(document);
- }
- catch (Exception ex)
- {
- return null;
- }
- }
-
- private static List<AbstractSkinTask> fetchTasksFromXMLConfig(Document
document)
- {
- List<AbstractSkinTask> tasks = new ArrayList<AbstractSkinTask>();
- Element docElement = document.getDocumentElement();
-
- fetchTasksByTagName(GateinResource.PORTAl_SKIN_TAG, docElement, tasks);
- fetchTasksByTagName(GateinResource.PORTLET_SKIN_TAG, docElement, tasks);
- fetchTasksByTagName(GateinResource.WINDOW_STYLE_TAG, docElement, tasks);
-
- return tasks;
- }
-
- /**
- *
- * @param tagName
- * @param rootElement
- * @param tasks
- */
- private static void fetchTasksByTagName(String tagName, Element rootElement,
List<AbstractSkinTask> tasks)
- {
- AbstractTaskXMLBinding binding = allBindings.get(tagName);
- //If there is no binding for current tagName, then return
- if (binding == null)
- {
- return;
- }
-
- NodeList nodes = rootElement.getElementsByTagName(tagName);
- AbstractSkinTask task;
-
- for (int i = nodes.getLength() - 1; i >= 0; i--)
- {
- task = binding.xmlToTask((Element)nodes.item(i));
- if (task != null)
- {
- tasks.add(task);
- }
- }
- }
-}
Copied:
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java
(from rev 467,
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java)
===================================================================
---
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java
(rev 0)
+++
portal/branches/performance/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/SkinConfigParser.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -0,0 +1,123 @@
+/**
+ * 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.resource.config.xml;
+
+import org.exoplatform.portal.resource.SkinService;
+import org.exoplatform.portal.resource.config.tasks.AbstractSkinTask;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+/**
+ *
+ * Created by eXoPlatform SAS
+ *
+ * Author: Minh Hoang TO - hoang281283(a)gmail.com
+ *
+ * Sep 16, 2009
+ */
+public class SkinConfigParser
+{
+
+ private final static Map<String, AbstractTaskXMLBinding> allBindings = new
HashMap<String, AbstractTaskXMLBinding>();
+
+ static
+ {
+ allBindings.put(GateinResource.PORTAl_SKIN_TAG, new
AbstractTaskXMLBinding.PortalSkinTaskXMLBinding());
+ allBindings.put(GateinResource.PORTLET_SKIN_TAG, new
AbstractTaskXMLBinding.PortletSkinTaskXMLBinding());
+ allBindings.put(GateinResource.WINDOW_STYLE_TAG, new
AbstractTaskXMLBinding.ThemeTaskXMLBinding());
+ }
+
+ public static void processConfigResource(InputStream is, SkinService skinService,
ServletContext scontext)
+ {
+ List<AbstractSkinTask> allTasks = fetchTasks(is);
+ if (allTasks != null)
+ {
+ for (AbstractSkinTask task : allTasks)
+ {
+ task.execute(skinService, scontext);
+ }
+ }
+ }
+
+ private static List<AbstractSkinTask> fetchTasks(InputStream is)
+ {
+ try
+ {
+ DocumentBuilder docBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = docBuilder.parse(is);
+ return fetchTasksFromXMLConfig(document);
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
+
+ private static List<AbstractSkinTask> fetchTasksFromXMLConfig(Document
document)
+ {
+ List<AbstractSkinTask> tasks = new ArrayList<AbstractSkinTask>();
+ Element docElement = document.getDocumentElement();
+
+ fetchTasksByTagName(GateinResource.PORTAl_SKIN_TAG, docElement, tasks);
+ fetchTasksByTagName(GateinResource.PORTLET_SKIN_TAG, docElement, tasks);
+ fetchTasksByTagName(GateinResource.WINDOW_STYLE_TAG, docElement, tasks);
+
+ return tasks;
+ }
+
+ /**
+ *
+ * @param tagName
+ * @param rootElement
+ * @param tasks
+ */
+ private static void fetchTasksByTagName(String tagName, Element rootElement,
List<AbstractSkinTask> tasks)
+ {
+ AbstractTaskXMLBinding binding = allBindings.get(tagName);
+ //If there is no binding for current tagName, then return
+ if (binding == null)
+ {
+ return;
+ }
+
+ NodeList nodes = rootElement.getElementsByTagName(tagName);
+ AbstractSkinTask task;
+
+ for (int i = nodes.getLength() - 1; i >= 0; i--)
+ {
+ task = binding.xmlToTask((Element)nodes.item(i));
+ if (task != null)
+ {
+ tasks.add(task);
+ }
+ }
+ }
+}
Modified:
portal/branches/performance/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java
===================================================================
---
portal/branches/performance/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -45,6 +45,8 @@
public class JavascriptDeployer implements WebAppListener, Startable
{
+ private static final String GATEIN_CONFIG_RESOURCE =
"/WEB-INF/gatein-resources.xml";
+
/**
* Logger
*/
@@ -87,6 +89,7 @@
scontext = event.getWebApp().getServletContext();
InputStream is =
scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/JavascriptScript.groovy");
+ //InputStream is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
if (is == null)
return;
try
@@ -122,6 +125,7 @@
try
{
is =
scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/JavascriptScript.groovy");
+ //is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
Binding binding = new Binding();
binding.setVariable("JavascriptService", javascriptService);
binding.setVariable("ServletContext", scontext);
Modified:
portal/branches/performance/gadgets/eXoGadgets/src/main/webapp/gadgets/Calculator/Calculator.xml
===================================================================
---
portal/branches/performance/gadgets/eXoGadgets/src/main/webapp/gadgets/Calculator/Calculator.xml 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/gadgets/eXoGadgets/src/main/webapp/gadgets/Calculator/Calculator.xml 2009-11-01
13:58:21 UTC (rev 468)
@@ -86,21 +86,21 @@
text-align: center;
}
- .Display p {
+ .Display input {
background: url(/eXoGadgets/skin/image/Display.png) no-repeat top left;
width: 164px;
height: 23px;
- text-align: __BIDI_END_EDGE__;
margin: 0 auto;
font-size: 15px;
line-height: auto;
color: #333333;
font-weight: bold;
- padding: 11px 3px 0 0;
+ padding: 3px 3px 0 0;
+ direction: __BIDI_REVERSE_DIR__;
}
.Number {
- padding-top: 8px;
+ padding-top: 8px;
padding-__BIDI_START_EDGE__: 9px;
}
@@ -115,13 +115,13 @@
display: block;
float: __BIDI_START_EDGE__;
margin-top: 4px;
- margin-__BIDI_START_EDGE__: 3px;
+ margin-__BIDI_START_EDGE__: 3px;
cursor: pointer;
padding-top: 3px;
}
.ClearLeft {
- clear: __BIDI_START_EDGE__
+ clear: __BIDI_START_EDGE__;
}
.Row a sup {
@@ -159,7 +159,7 @@
var NewNumber = "blank";
var opvalue = "";
function Display(displaynumber) {
- document.getElementById("calculator").innerHTML = displaynumber;
+ document.getElementById("calculator").value = displaynumber;
}
function ClearCalc() {
Number1 = "";
@@ -169,7 +169,7 @@
}
function CheckNumber(answer) {
if(answer == ".") {
- Number = document.getElementById("calculator").innerHTML;;
+ Number = document.getElementById("calculator").value;
if(Number.indexOf(".") != -1) {
answer = "";
}
@@ -257,7 +257,7 @@
<div class="RightCalculator">
<div class="CenterCalculator">
<div class="Display">
- <p id="calculator">0</p>
+ <input id="calculator" value="0" disabled />
</div>
<div class="Number">
<div class="Row">
Deleted: portal/branches/performance/packaging/key.txt
===================================================================
--- portal/branches/performance/packaging/key.txt 2009-11-01 11:24:58 UTC (rev 467)
+++ portal/branches/performance/packaging/key.txt 2009-11-01 13:58:21 UTC (rev 468)
@@ -1 +0,0 @@
-rR992qPYCDQYG9SZml36Tb1n+trO+DXEB9CwXAzgfOE=
Modified: portal/branches/performance/packaging/pkg/pom.xml
===================================================================
--- portal/branches/performance/packaging/pkg/pom.xml 2009-11-01 11:24:58 UTC (rev 467)
+++ portal/branches/performance/packaging/pkg/pom.xml 2009-11-01 13:58:21 UTC (rev 468)
@@ -138,6 +138,10 @@
</plugins>
</build>
+ <properties>
+ <gatein.working.dir>${basedir}/target</gatein.working.dir><!--
Default value for server installation dir -->
+ </properties>
+
<profiles>
<profile>
<id>pkg-tomcat</id>
@@ -192,7 +196,7 @@
<argument>-Dexo.current.dir=${basedir}</argument>
<argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
<argument>-Dexo.conf.dir=${basedir}/target/exopackage-conf</argument>
-
<argument>-Dexo.working.dir=${basedir}/target</argument>
+
<argument>-Dexo.working.dir=${gatein.working.dir}/</argument>
<!--argument>-Dexo.src.dir=NONE</argument-->
<argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!--
to get the server ref install -->
<argument>-Dexo.m2.repos=file:${settings.localRepository}</argument>
@@ -216,6 +220,7 @@
</execution>
</executions>
</plugin>
+<!--
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
@@ -234,6 +239,7 @@
</execution>
</executions>
</plugin>
+-->
</plugins>
</build>
</profile>
@@ -291,7 +297,7 @@
<argument>-Dexo.current.dir=${basedir}</argument>
<argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
<argument>-Dexo.conf.dir=${basedir}/target/exopackage-conf</argument>
-
<argument>-Dexo.working.dir=${basedir}/target</argument>
+
<argument>-Dexo.working.dir=${gatein.working.dir}</argument>
<!--argument>-Dexo.src.dir=NONE</argument-->
<argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!--
to get the server ref install -->
<
argument>-Dexo.m2.repos=file:${settings.localRepository},http://maven2...
@@ -315,6 +321,7 @@
</execution>
</executions>
</plugin>
+<!--
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
@@ -333,6 +340,7 @@
</execution>
</executions>
</plugin>
+-->
</plugins>
</build>
</profile>
Modified: portal/branches/performance/packaging/profiles.xml
===================================================================
--- portal/branches/performance/packaging/profiles.xml 2009-11-01 11:24:58 UTC (rev 467)
+++ portal/branches/performance/packaging/profiles.xml 2009-11-01 13:58:21 UTC (rev 468)
@@ -22,7 +22,7 @@
<profilesXml>
<profiles>
<profile>
- <id>exo-projects</id>
+ <id>gatein-projects</id>
<properties>
<!--
Replace with the directory where uncompressed Tomcat 6 and/or JBoss 5.1 can
be found
@@ -30,10 +30,18 @@
ex: On Linux '/home/user/AS'
-->
<exo.projects.directory.dependencies>REPLACE_WITH_YOUR_OWN_DIRECTORY</exo.projects.directory.dependencies>
+
+ <!--
+ If you want that the server is deployed always at the same place (not in
packaging/pkg/target/<server> dir)
+ Uncomment and Replace with the directory you prefer
+ -->
+ <!--
+ <gatein.working.dir>REPLACE_WITH_SERVER_DIR</gatein.working.dir>
+ -->
<!--
Replace with the name of the directory containing Tomcat 6
-->
-
<exo.projects.app.tomcat.version>apache-tomcat-6.0.20</exo.projects.app.tomcat.version>
+
<exo.projects.app.tomcat.version>tomcat-6.0.20</exo.projects.app.tomcat.version>
<!--
Replace with the name of the directory containing JBoss AS 5.1
-->
@@ -43,6 +51,6 @@
</profiles>
<activeProfiles>
- <activeProfile>exo-projects</activeProfile>
+ <activeProfile>gatein-projects</activeProfile>
</activeProfiles>
</profilesXml>
Copied: portal/branches/performance/packaging/profiles.xml.template (from rev 467,
portal/trunk/packaging/profiles.xml.template)
===================================================================
--- portal/branches/performance/packaging/profiles.xml.template
(rev 0)
+++ portal/branches/performance/packaging/profiles.xml.template 2009-11-01 13:58:21 UTC
(rev 468)
@@ -0,0 +1,57 @@
+<!--
+
+ 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.
+
+-->
+
+<profilesXml>
+ <profiles>
+ <profile>
+ <id>gatein-projects</id>
+ <properties>
+ <!--
+ Replace with the directory where uncompressed Tomcat 6 and/or JBoss 5.1 can
be found
+ ex: On Windows 'c:/AS'
+ ex: On Linux '/home/user/AS'
+ -->
+
<exo.projects.directory.dependencies>REPLACE_WITH_YOUR_OWN_DIRECTORY</exo.projects.directory.dependencies>
+
+ <!--
+ If you want that the server is deployed always at the same place (not in
packaging/pkg/target/<server> dir)
+ Uncomment and Replace with the directory you prefer
+ -->
+ <!--
+ <gatein.working.dir>REPLACE_WITH_SERVER_DIR</gatein.working.dir>
+ -->
+
+ <!--
+ Replace with the name of the directory containing Tomcat 6
+ -->
+
<exo.projects.app.tomcat.version>apache-tomcat-6.0.20</exo.projects.app.tomcat.version>
+ <!--
+ Replace with the name of the directory containing JBoss AS 5.1
+ -->
+
<exo.projects.app.jboss.version>jboss-5.1.0.GA</exo.projects.app.jboss.version>
+ </properties>
+ </profile>
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>gatein-projects</activeProfile>
+ </activeProfiles>
+</profilesXml>
Modified:
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -19,16 +19,12 @@
package org.exoplatform.dashboard.webui.component;
-import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import javax.portlet.PortletPreferences;
@@ -38,9 +34,7 @@
/**
* @author exo
*/
-@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template =
"app:/groovy/dashboard/webui/component/UIDashboardPortlet.gtmpl", events = {
- @EventConfig(listeners = UIDashboardPortlet.MinimizeGadgetActionListener.class),
- @EventConfig(listeners = UIDashboardPortlet.MaximizeGadgetActionListener.class)})
+@ComponentConfig(lifecycle = UIApplicationLifecycle.class, template =
"app:/groovy/dashboard/webui/component/UIDashboardPortlet.gtmpl", events = {})
/**
* Dashboard portlet that display google gadgets
*/
@@ -55,7 +49,6 @@
PortletRequestContext context =
(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
UIDashboard dashboard = addChild(UIDashboard.class, null, null);
- addChild(UIDashboardMask.class, null, null).setRendered(false);
addChild(UIDashboardEditForm.class, null, null);
PortletPreferences pref = context.getRequest().getPreferences();
@@ -103,50 +96,4 @@
return owner;
}
- public static class MinimizeGadgetActionListener extends
EventListener<UIDashboardPortlet>
- {
- public final void execute(final Event<UIDashboardPortlet> event) throws
Exception
- {
- WebuiRequestContext context = event.getRequestContext();
- UIDashboardPortlet uiPortlet = event.getSource();
- String objectId = context.getRequestParameter(OBJECTID);
- String minimized = context.getRequestParameter("minimized");
-
- UIDashboard uiDashboard = uiPortlet.getChild(UIDashboard.class);
- UIGadget uiGadget =
uiDashboard.getChild(UIDashboardContainer.class).getUIGadget(objectId);
- uiGadget.getProperties().setProperty("minimized", minimized);
- uiDashboard.getChild(UIDashboardContainer.class).save();
- context.addUIComponentToUpdateByAjax(uiGadget);
- }
- }
-
- public static class MaximizeGadgetActionListener extends
EventListener<UIDashboardPortlet>
- {
- public final void execute(final Event<UIDashboardPortlet> event) throws
Exception
- {
- WebuiRequestContext context = event.getRequestContext();
- UIDashboardPortlet uiPortlet = event.getSource();
- String objectId = context.getRequestParameter(OBJECTID);
- String maximize = context.getRequestParameter("maximize");
- UIDashboard uiDashboard = uiPortlet.getChild(UIDashboard.class);
- UIDashboardContainer uiDashboardContainer =
uiDashboard.getChild(UIDashboardContainer.class);
- UIDashboardMask uiDashboardMask = uiPortlet.getChild(UIDashboardMask.class);
- UIGadget uiGadget = uiDashboardContainer.getUIGadget(objectId);
- if (maximize.equals("maximize"))
- {
- uiGadget.setView(UIGadget.CANVAS_VIEW);
- uiDashboardMask.setUIComponent(uiGadget);
- uiDashboardMask.setRendered(true);
- uiDashboard.setRendered(false);
- }
- else
- {
- uiGadget.setView(UIGadget.HOME_VIEW);
- uiDashboardMask.setUIComponent(null);
- uiDashboardMask.setRendered(false);
- uiDashboard.setRendered(true);
- }
- //context.addUIComponentToUpdateByAjax(uiPortlet) ;
- }
- }
}
Modified:
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -38,6 +38,7 @@
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.exception.MessageException;
import java.util.ArrayList;
import java.util.List;
@@ -209,6 +210,25 @@
}
}
+ private boolean validateName(String label)
+ {
+ label = label.trim();
+ if (Character.isDigit(label.charAt(0)) || label.charAt(0) == '-')
+ {
+ return false;
+ }
+ for (int i = 0; i < label.length(); i++)
+ {
+ char c = label.charAt(i);
+ if (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c ==
'-' || Character.isSpaceChar(c))
+ {
+ continue;
+ }
+ return false;
+ }
+ return true;
+ }
+
private boolean nameExisted(String nodeName)
{
for (PageNode node : pageNavigation.getNodes())
@@ -313,6 +333,11 @@
UITabPaneDashboard tabPane = event.getSource();
WebuiRequestContext context = event.getRequestContext();
String newTabLabel = context.getRequestParameter(UIComponent.OBJECTID);
+ if (!tabPane.validateName(newTabLabel))
+ {
+ context.getUIApplication().addMessage(new
ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", null));
+ return;
+ }
String newNodeName = tabPane.createNewPageNode(newTabLabel);
//If new node is created with success, then redirect to it
@@ -342,6 +367,11 @@
WebuiRequestContext context = event.getRequestContext();
int nodeIndex =
Integer.parseInt(context.getRequestParameter(UIComponent.OBJECTID));
String newTabLabel = context.getRequestParameter(RENAMED_TAB_LABEL_PARAMETER);
+ if (!tabPane.validateName(newTabLabel))
+ {
+ context.getUIApplication().addMessage(new
ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", null));
+ return;
+ }
String newNodeName = tabPane.renamePageNode(nodeIndex, newTabLabel);
//If page node is renamed with success, then redirect to new URL
Modified:
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_en.properties 2009-11-01
13:58:21 UTC (rev 468)
@@ -20,4 +20,5 @@
UITabPaneDashboard.action.addNewDashboard=Add Dashboard
UITabPaneDashboard.action.switchShowRange=Switch Range
UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
-UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
\ No newline at end of file
+UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
+UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space
characters allowed.
\ No newline at end of file
Modified:
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_fr.properties 2009-11-01
13:58:21 UTC (rev 468)
@@ -20,4 +20,5 @@
UITabPaneDashboard.action.addNewDashboard =Ajoute Dashboard
UITabPaneDashboard.action.switchShowRange =Decale
UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
-UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
\ No newline at end of file
+UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
+UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space
characters allowed.
\ No newline at end of file
Modified:
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_ru.properties 2009-11-01
13:58:21 UTC (rev 468)
@@ -20,4 +20,5 @@
UITabPaneDashboard.action.addNewDashboard=Добавить доску
UITabPaneDashboard.action.switchShowRange=Изменить область
UITabPaneDashboard.msg.deleteTab=Вы действительно хотите удалить эту доску?
-UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
\ No newline at end of file
+UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
+UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space
characters allowed.
\ No newline at end of file
Modified:
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/dashboard/src/main/webapp/WEB-INF/classes/locale/portlet/dashboard/TabbedDashboardPortlet_uk.properties 2009-11-01
13:58:21 UTC (rev 468)
@@ -20,4 +20,5 @@
UITabPaneDashboard.action.addNewDashboard =Додати панель інструментів
UITabPaneDashboard.action.switchShowRange =Перемикач діапазону
UITabPaneDashboard.msg.deleteTab=Really want to remove this dashboard?
-UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
\ No newline at end of file
+UITabPaneDashboard.msg.cannotDeleteLastTab=Can not delete the last tab.
+UITabPaneDashboard.msg.wrongTabName=Only alpha, digit, underscore, dash and space
characters allowed.
\ No newline at end of file
Modified:
portal/branches/performance/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UIDashboardPortlet.gtmpl
===================================================================
---
portal/branches/performance/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UIDashboardPortlet.gtmpl 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UIDashboardPortlet.gtmpl 2009-11-01
13:58:21 UTC (rev 468)
@@ -2,7 +2,6 @@
import javax.portlet.PortletMode ;
import org.exoplatform.dashboard.webui.component.DashboardParent ;
import org.exoplatform.dashboard.webui.component.UIDashboard;
- import org.exoplatform.dashboard.webui.component.UIDashboardMask;
import org.exoplatform.dashboard.webui.component.UIDashboardEditForm;
def rcontext = _ctx.getRequestContext() ;
@@ -11,7 +10,6 @@
<div id="$uicomponent.id" class="UIDashboardPortlet">
<% if(rcontext.getApplicationMode() == PortletMode.VIEW) {
uicomponent.renderChild(UIDashboard.class);
- uicomponent.renderChild(UIDashboardMask.class);
} else {
UIDashboardEditForm uiEditForm = uicomponent.getChild(UIDashboardEditForm.class);
uiEditForm.getUIStringInput(UIDashboardEditForm.TOTAL_COLUMNS).setValue(uicomponent.getNumberOfCols()
+ "");
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIAddApplicationForm.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -275,6 +275,7 @@
}
appRegService.save(selectedCate, app);
+ uiOrganizer.reload();
uiOrganizer.setSelectedCategory(selectedCate);
uiOrganizer.selectApplication(app.getApplicationName());
ctx.addUIComponentToUpdateByAjax(uiOrganizer);
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationOrganizer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -362,7 +362,7 @@
service.remove(app);
}
String cateName = uiOrganizer.getSelectedCategory().getName();
- uiOrganizer.initApplicationCategories();
+ uiOrganizer.reload();
uiOrganizer.setSelectedCategory(cateName);
event.getRequestContext().addUIComponentToUpdateByAjax(uiOrganizer);
}
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -178,7 +178,7 @@
}
service.save(category);
uiForm.setValue(null);
- uiOrganizer.initApplicationCategories();
+ uiOrganizer.reload();
uiOrganizer.setSelectedCategory(category.getName());
ctx.addUIComponentToUpdateByAjax(uiOrganizer);
}
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -53,6 +53,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
/*
* Created by The eXo Platform SAS
@@ -87,6 +88,7 @@
UIRepeater repeater = createUIComponent(UIRepeater.class,
"UIGroupNavigationGrid", null);
virtualList.setUIComponent(repeater);
UIPopupWindow editNavigation = addChild(UIPopupWindow.class, null, null);
+ editNavigation.setId(editNavigation.getId() + "-" +
UUID.randomUUID().toString().replaceAll("-", ""));
}
public void loadNavigations() throws Exception
@@ -205,6 +207,7 @@
selector.removeChild(UIRightClickPopupMenu.class);
popUp.setUIComponent(pageManager);
popUp.setWindowSize(400, 400);
+ popUp.setShowMask(true);
popUp.setShow(true);
// prContext.addUIComponentToUpdateByAjax(workingWS);
}
@@ -235,6 +238,7 @@
pageNavigation.setPageNav(navigation);
popUp.setUIComponent(pageNavigation);
popUp.setWindowSize(600, 400);
+ popUp.setShowMask(true);
popUp.setShow(true);
}
}
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -60,6 +60,7 @@
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
@@ -88,6 +89,7 @@
{
UIPopupWindow editNavigation = addChild(UIPopupWindow.class, null, null);
editNavigation.setWindowSize(400, 400);
+ editNavigation.setId(editNavigation.getId()+ "-" +
UUID.randomUUID().toString().replaceAll("-", ""));
//loadPortalConfigs();
}
@@ -319,6 +321,7 @@
selector.initNavigations(list);
selector.removeChild(UIRightClickPopupMenu.class);
popUp.setUIComponent(naviManager);
+ popUp.setShowMask(true);
popUp.setShow(true);
}
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/GroupManagement.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -146,6 +146,8 @@
{
if (username == null)
username =
org.exoplatform.portal.webui.util.Util.getPortalRequestContext().getRemoteUser();
+ if (username.equals(getUserACL().getSuperUser()))
+ return true;
return isMemberOfGroup(username, getUserACL().getAdminGroups());
}
Modified:
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupExplorer.java
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupExplorer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupExplorer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -121,7 +121,8 @@
sibblingsGroup_ = service.getGroupHandler().findGroups(parentGroup);
// if not administrator
- if (!GroupManagement.isAdministrator(null))
+ String username =
org.exoplatform.portal.webui.util.Util.getPortalRequestContext().getRemoteUser();
+ if (!GroupManagement.isSuperUserOfGroup(username, groupId))
{
childrenGroup_ = GroupManagement.getRelatedGroups(null, childrenGroup_);
sibblingsGroup_ = GroupManagement.getRelatedGroups(null, sibblingsGroup_);
Modified:
portal/branches/performance/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml
===================================================================
---
portal/branches/performance/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/exoadmin/src/main/webapp/WEB-INF/portlet.xml 2009-11-01
13:58:21 UTC (rev 468)
@@ -79,7 +79,35 @@
<keywords>Administration</keywords>
</portlet-info>
</portlet>
+
+ <!--
+ <portlet>
+ <description xml:lang="EN">Register Portlet</description>
+ <portlet-name>RegisterPortlet</portlet-name>
+ <display-name xml:lang="EN">Register Portlet</display-name>
+
<portlet-class>org.exoplatform.webui.application.portlet.PortletApplicationController</portlet-class>
+
+ <init-param>
+ <name>webui.configuration</name>
+
<value>/WEB-INF/conf/portlet/exoadmin/RegisterPortlet/webui/configuration.xml</value>
+ </init-param>
+ <expiration-cache>0</expiration-cache>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>help</portlet-mode>
+ </supports>
+ <supported-locale>en</supported-locale>
+
+
<resource-bundle>locale.portlet.exoadmin.RegisterPortlet</resource-bundle>
+ <portlet-info>
+ <title>Register Portlet</title>
+ <short-title>Register Portlet</short-title>
+ <keywords>Administration</keywords>
+ </portlet-info>
+ </portlet>
+ -->
+
<portlet>
<description xml:lang="EN">Group Navigation
Portlet</description>
<portlet-name>GroupNavigationPortlet</portlet-name>
Modified:
portal/branches/performance/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java
===================================================================
---
portal/branches/performance/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -19,8 +19,12 @@
package org.exoplatform.portal.webui.component;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -28,13 +32,12 @@
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.exception.MessageException;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.validator.MandatoryValidator;
+import org.exoplatform.webui.form.validator.URLValidator;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletPreferences;
-
/**
* Created by The eXo Platform SAS Author : eXoPlatform October 2, 2009
*/
@@ -58,6 +61,12 @@
{
UILogoEditMode uiForm = event.getSource();
String url = uiForm.getUIStringInput(FIELD_URL).getValue();
+ if (url != null && !url.trim().matches(URLValidator.URL_REGEX)) {
+ UILogoPortlet uiPortlet = uiForm.getParent();
+ uiForm.getUIStringInput(FIELD_URL).setValue(uiPortlet.getURL());
+ Object[] args = {FIELD_URL, "URL"};
+ throw new MessageException(new
ApplicationMessage("ExpressionValidator.msg.value-invalid", args));
+ }
PortletRequestContext pcontext =
(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
PortletPreferences pref = pcontext.getRequest().getPreferences();
pref.setValue("url", uiForm.getUIStringInput(FIELD_URL).getValue());
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/Browser.js
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/Browser.js 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/Browser.js 2009-11-01
13:58:21 UTC (rev 468)
@@ -459,7 +459,6 @@
Browser.prototype.findMouseRelativeX = function(object, e) {
var posx = -1 ;
var posXObject = eXo.core.Browser.findPosX(object) ;
- document.title = "test" + posXObject;
/*
* posXObject is added more 3px on IE6
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/DragDrop.js 2009-11-01
13:58:21 UTC (rev 468)
@@ -57,6 +57,7 @@
} ;
DragDrop.prototype.init = function(dropableTargets, clickObject, dragObject, evt) {
+ if(evt && evt.preventDefault) evt.preventDefault();
eXo.core.Mouse.init(evt) ;
this.dropableTargets = dropableTargets ;
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/core/UIMaskLayer.js 2009-11-01
13:58:21 UTC (rev 468)
@@ -183,7 +183,7 @@
maskLayer.id = object.id + "MaskLayer" ;
maskLayer.maxZIndex = 3 ;
maskLayer.style.width = blockContainer.offsetWidth + "px" ;
- maskLayer.style.height = blockContainer.offsetHeight + "px" ;
+ maskLayer.style.height = blockContainer.offsetHeight +
eXo.core.Browser.findPosY(blockContainer) + "px" ;
maskLayer.style.top = "0px" ;
maskLayer.style.left = "0px" ;
maskLayer.style.zIndex = maskLayer.maxZIndex ;
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js 2009-11-01
13:58:21 UTC (rev 468)
@@ -204,9 +204,9 @@
}
var compId = portletFrag.parentNode.id;
- var uicomp = DOMUtil.getChildrenByTagName(portletFrag,
"div")[0].className ;
+ var uicomp = DOMUtil.findAncestorByClass(uiGadget, "UIDashboard") ;
var href = eXo.env.server.portalBaseURL + "?portal:componentId=" +
compId ;
- href += "&portal:type=action&uicomponent=" + uicomp;
+ href += "&portal:type=action&uicomponent=" + uicomp.id;
href += "&op=MinimizeGadget";
href += "&minimized=" + minimized;
href += "&objectId=" + uiGadget.id +
"&ajaxRequest=true";
@@ -219,11 +219,10 @@
var uiGadget = DOMUtil.findAncestorByClass(selectedElement, "UIGadget")
;
var portletFrag = DOMUtil.findAncestorByClass(uiGadget,
"PORTLET-FRAGMENT") ;
if (!portletFrag) return;
- var maximize = "maximize";
var compId = portletFrag.parentNode.id;
- var uicomp = DOMUtil.getChildrenByTagName(portletFrag, "div")[0];
- var compDisplay =
DOMUtil.findFirstChildByClass(uicomp,"div","UIDashboardMask");
- if(compDisplay != null) maximize = "unmaximize"
+ var uicomp = DOMUtil.findAncestorByClass(uiGadget, "UIDashboard");
+ var compDisplay = DOMUtil.findAncestorByClass(uiGadget,
"UIDashboardContainer");
+ var maximize = compDisplay ? "maximize" : "unmaximize";
var href = eXo.env.server.portalBaseURL + "?portal:componentId=" +
compId ;
href += "&portal:type=action&uicomponent=" + uicomp.id;
href += "&op=MaximizeGadget";
@@ -242,19 +241,28 @@
if (portletFragment != null) {
var compId = portletFragment.parentNode.id;
- var uicomp = "";
- if (DOMUtil.findChildrenByClass(portletFragment, "div",
"UIDashboard")) {
- uicomp = "UIDashboard";
- }
- else
- uicomp = DOMUtil.getChildrenByTagName(portletFragment,
"div")[0].className;
+ var uicomp = DOMUtil.findAncestorByClass(uiGadget,
"UIDashboard").id;
+// if (DOMUtil.findChildrenByClass(portletFragment, "div",
"UIDashboard"))
+// uicomp = "UIDashboard";
+// else
+// uicomp = DOMUtil.getChildrenByTagName(portletFragment,
"div")[0].className;
if (confirm(this.confirmDeleteGadget)) {
var href = eXo.env.server.portalBaseURL +
"?portal:componentId=" + compId;
href += "&portal:type=action&uicomponent=" + uicomp;
href += "&op=DeleteGadget";
href += "&objectId=" + uiGadget.id +
"&ajaxRequest=true";
- DOMUtil.removeElement(uiGadget);
- ajaxAsyncGetRequest(href);
+
+ var uiDashboardCont = DOMUtil.findAncestorByClass(uiGadget,
"UIDashboardContainer");
+ if(uiDashboardCont) {
+ ajaxAsyncGetRequest(href);
+ DOMUtil.removeElement(uiGadget);
+ if(!DOMUtil.findFirstDescendantByClass(uiDashboardCont, "div",
"UIGadget")) {
+ DOMUtil.findFirstDescendantByClass(uiDashboardCont, "div",
"NoGadget").style.display = "block";
+ }
+ }else {
+// Case: delete gadget in dashboard when maximized gadget
+ ajaxGet(href);
+ }
}
} else {
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2009-11-01
13:58:21 UTC (rev 468)
@@ -332,8 +332,10 @@
};
PortalDragDrop.prototype.scrollOnDrag = function(dragObject, dndEvent) {
+ var workspaceHeight =
document.getElementById("UIWorkingWorkspace").offsetHeight;
+ var browserHeight = eXo.core.Browser.getBrowserHeight() ;
+ if(workspaceHeight <= browserHeight) return;
var dragObjectTop = eXo.core.Browser.findPosY(dragObject) ;
- var browserHeight = eXo.core.Browser.getBrowserHeight() ;
var mouseY = eXo.core.Browser.findMouseYInClient(dndEvent.backupMouseEvent) ;
var deltaTopMouse = eXo.core.Browser.findMouseYInPage(dndEvent.backupMouseEvent) -
mouseY ;
var deltaTop = mouseY - (Math.round(browserHeight * 5/6)) ;
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UICalendar.js 2009-11-01
13:58:21 UTC (rev 468)
@@ -69,7 +69,6 @@
UICalendar.prototype.show = function() {
document.onmousedown = new Function('eXo.webui.UICalendar.hide()') ;
-
var re = /^(\d{1,2}\/\d{1,2}\/\d{1,4})\s*(\s+\d{1,2}:\d{1,2}:\d{1,2})?$/i ;
this.selectedDate = new Date() ;
@@ -109,6 +108,10 @@
var secondIndex = this.datePattern.indexOf("ss");
var secondValue = parseInt(dateFieldValue.substring(secondIndex,secondIndex+2),10);
+ if(isNaN(secondValue)) { secondValue = "00"; }
+ if(isNaN(minutesValue)) { minutesValue = "00"; }
+ if(isNaN(hoursValue)) { hoursValue = "00"; }
+
var testDate = "MM/dd/yyyy HH:mm:ss";
testDate = testDate.replace("dd",dateValue);
testDate = testDate.replace("MM",monthValue+1);
@@ -116,6 +119,7 @@
testDate = testDate.replace("HH",hoursValue);
testDate = testDate.replace("mm",minutesValue);
testDate = testDate.replace("ss",secondValue);
+
if (re.test(testDate)) {
this.selectedDate.setDate(dateValue) ;
this.selectedDate.setMonth(monthValue) ;
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js 2009-11-01
13:58:21 UTC (rev 468)
@@ -23,7 +23,7 @@
renameTabLabel : function(e){
if(!e){
- e = windwow.event;
+ e = window.event;
}
var keyNum = e.keyCode;
@@ -51,7 +51,7 @@
href += "&uicomponent=UITabPaneDashboard";
href += "&op=RenameTabLabel";
href += "&objectId=" + nodeIndex;
- href += "&newTabLabel=" + newTabLabel;
+ href += "&newTabLabel=" + encodeURIComponent(newTabLabel);
window.location = href;
return;
}
@@ -83,6 +83,7 @@
inputElement.style.border = "1px solid #b7b7b7";
inputElement.style.width = "95px";
inputElement.onkeypress = eXo.webui.UITabbedDashboard.renameTabLabel;
+ inputElement.setAttribute('maxLength', 50);
inputElement.onblur = function() {
prNode.replaceChild(eXo.webui.UITabbedDashboard.backupElement, inputElement);
};
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIDashboard/Stylesheet.css 2009-11-01
13:58:21 UTC (rev 468)
@@ -35,7 +35,6 @@
.UIDashboard {
height: 100%;
- background: url('background/BgRepeat.gif') repeat-y left bottom;
}
.UIDashboard .DashboardContainer {
@@ -514,30 +513,30 @@
#UIAddGadgetPopup .PopupTitle {
margin-left: 22px;
}
-/*----------------------UIDashboardMask-------------------*/
+/*----------------------Maximized-------------------*/
-.UIDashboardMask .UIGadget {
+.Maximized .UIGadget {
padding: 5px;
margin: 0px;
}
-.UIDashboardMask .UIGadget .GadgetControl {
+.Maximized .UIGadget .GadgetControl {
float: none;
padding: 0px;
height: auto; width: auto;
}
-.UIDashboardMask .UIGadget .GadgetControl .LeftControlBar {
+.Maximized .UIGadget .GadgetControl .LeftControlBar {
background: none;
padding: 0px;
}
-.UIDashboardMask .UIGadget .GadgetControl .RightControlBar {
+.Maximized .UIGadget .GadgetControl .RightControlBar {
background: none;
padding: 0px;
}
-.UIDashboardMask .UIGadget .GadgetControl .CenterControlBar {
+.Maximized .UIGadget .GadgetControl .CenterControlBar {
background: url('background/BgTitleGadget.gif') repeat-x left top;
height: 23px;
line-height: 23px;
@@ -546,31 +545,31 @@
border-top: none;
}
-.UIDashboardMask .UIGadget .GadgetControl .GadgetDragHandleArea {
+.Maximized .UIGadget .GadgetControl .GadgetDragHandleArea {
display: none;
}
-.UIDashboardMask .UIGadget .TLGadget {
+.Maximized .UIGadget .TLGadget {
display: none;
}
-.UIDashboardMask .UIGadget .MLGadget {
+.Maximized .UIGadget .MLGadget {
background: #f2f2f3;
border: 1px solid #c3c3c3;
border-top: none;
padding: 3px;
}
-.UIDashboardMask .UIGadget .MRGadget {
+.Maximized .UIGadget .MRGadget {
background: white;
padding: 0 0 1px;
}
-.UIDashboardMask .UIGadget .BLGadget {
+.Maximized .UIGadget .BLGadget {
display: none;
}
-.UIDashboardMask .GadgetTitle {
+.Maximized .GadgetTitle {
float: left; /* orientation=lt */
float: right; /* orientation=rt */
padding: 0px 5px;
@@ -581,6 +580,6 @@
white-space: nowrap;
}
-.UIDashboardMask iframe {
+.Maximized iframe {
width: 100%;
}
\ No newline at end of file
Modified:
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css
===================================================================
---
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIPopup/UIPopupWindow/Stylesheet.css 2009-11-01
13:58:21 UTC (rev 468)
@@ -105,6 +105,7 @@
float: left; /* orientation=rt */
cursor: nw-resize; /* orientation=lt */
cursor: ne-resize; /* orientation=rt */
+ margin-top:-29px;
}
.UIPopupWindow .BottomLeftCornerDecorator {
@@ -179,8 +180,8 @@
}
.UIPortalComposer .SaveButton {
- background: transparent url(background/SaveIcon.gif) no-repeat scroll right bottom; /*
orientation=lt */
- background: transparent url(background/SaveIcon-rt.gif) no-repeat scroll left bottom; /*
orientation=rt */
+ background: transparent url(background/UnSaveIcon.gif) no-repeat scroll right bottom; /*
orientation=lt */
+ background: transparent url(background/UnSaveIcon-rt.gif) no-repeat scroll left bottom;
/* orientation=rt */
cursor: pointer;
float: right; /* orientation=lt */
float: left; /* orientation=rt */
@@ -190,8 +191,8 @@
}
.UIPortalComposer .EdittedSaveButton {
- background: transparent url(background/UnSaveIcon.gif) no-repeat scroll right bottom; /*
orientation=lt */
- background: transparent url(background/UnSaveIcon-rt.gif) no-repeat scroll left bottom;
/* orientation=rt */
+ background: transparent url(background/SaveIcon.gif) no-repeat scroll right bottom; /*
orientation=lt */
+ background: transparent url(background/SaveIcon-rt.gif) no-repeat scroll left bottom; /*
orientation=rt */
cursor: pointer;
float: right; /* orientation=lt */
float: left; /* orientation=rt */
@@ -246,6 +247,10 @@
height: 50px;
}
+.UIPortalComposer .BCPortalComposer .UIAction {
+ height: 50px;
+}
+
.UIPortalComposer .Bottom {
border-bottom: 1px solid #a2a3a9;
}
Modified:
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml
===================================================================
---
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/portal/application-registry-configuration.xml 2009-11-01
13:58:21 UTC (rev 468)
@@ -182,7 +182,7 @@
</field>
</object>
</value>
- <value>
+ <value>
<object
type="org.exoplatform.application.registry.Application">
<field
name="categoryName"><string>web</string></field>
<field
name="applicationName"><string>SiteMapPortlet</string></field>
@@ -197,21 +197,6 @@
</field>
</object>
</value>
- <value>
- <object
type="org.exoplatform.application.registry.Application">
- <field
name="categoryName"><string>web</string></field>
- <field
name="applicationName"><string>BrowserPortlet</string></field>
- <field name="displayName"><string>Web
Explorer</string></field>
- <field name="description"><string>Web
Explorer</string></field>
- <field
name="applicationType"><string>portlet</string></field>
- <field
name="applicationGroup"><string>web</string></field>
- <field name="accessPermissions">
- <collection type="java.util.ArrayList"
item-type="java.lang.String">
- <value><string>*:/platform/users</string></value>
- </collection>
- </field>
- </object>
- </value>
</collection>
</field>
</object>
Deleted:
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/script/groovy/SkinConfigScript.groovy
===================================================================
---
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/script/groovy/SkinConfigScript.groovy 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/portal/src/main/webapp/WEB-INF/conf/script/groovy/SkinConfigScript.groovy 2009-11-01
13:58:21 UTC (rev 468)
@@ -1,42 +0,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.
- */
-
-/***************************HomePagePortlet**************************************************/
-SkinService.addSkin(
- "web/HomePagePortlet",
- "Default",
- "/" + ServletContextName +
"/templates/skin/webui/component/UIHomePagePortlet/DefaultStylesheet.css",
- ServletContext
-) ;
-
-SkinService.addSkin(
- "web/HomePagePortlet",
- "Vista",
- "/" + ServletContextName +
"/templates/skin/webui/component/UIHomePagePortlet/DefaultStylesheet.css",
- ServletContext
-) ;
-
-SkinService.addSkin(
- "web/HomePagePortlet",
- "Mac",
- "/" + ServletContextName +
"/templates/skin/webui/component/UIHomePagePortlet/DefaultStylesheet.css",
- ServletContext
-) ;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
Modified:
portal/branches/performance/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
===================================================================
---
portal/branches/performance/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2009-11-01
13:58:21 UTC (rev 468)
@@ -37,7 +37,6 @@
<div class="id"><%=uicomponent.getId();%></div>
<div
class="title"><%=_ctx.appRes("UIPortlet.label.title");%></div>
<div class="description">
-
<%if(uicomponent.getDescription() != null) {%>
<%=uicomponent.getDescription();%>
<%} else {%>
@@ -67,22 +66,12 @@
<div class="CenterBackground">
<div class="GardientBackground">
<%
- String displayName = uicomponent.getDisplayName();
- if(displayName != null) {
- String htmlDisplayName = ""; int count = 1;
- for(c in displayName){
- if(c=="\n"){
- c="<br/>";
- count++;
- }
- htmlDisplayName+=c;
- if(count>5) break;
- }
- %>
- <%=htmlDisplayName;%>
- <%} else {%>
- <%= _ctx.appRes("UIPortlet.label.portletContent");
%>
- <%}%>
+ try {
+ String portletName =
uicomponent.getProducedOfferedPortlet().getInfo().getName();
+ print
_ctx.getRequestContext().getApplicationResourceBundle().getString("UIPortlet.description."
+ portletName);
+ } catch(Exception e){
+ print uicomponent.getDisplayName();
+ }%>
</div>
</div>
</div>
Modified:
portal/branches/performance/web/portal/src/main/webapp/groovy/webui/core/UIPopupWindow.gtmpl
===================================================================
---
portal/branches/performance/web/portal/src/main/webapp/groovy/webui/core/UIPopupWindow.gtmpl 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/web/portal/src/main/webapp/groovy/webui/core/UIPopupWindow.gtmpl 2009-11-01
13:58:21 UTC (rev 468)
@@ -7,15 +7,19 @@
* version: $Id$
*/
%>
-<%
+<%
component = uicomponent.getUIComponent();
boolean showCloseButton = uicomponent.isShowCloseButton()
String popupId = uicomponent.getId();
+ String rsId = popupId;
+ if(popupId.indexOf('-')>0){
+ rsId = popupId.substring(0,popupId.lastIndexOf('-'));
+ }
def rcontext = _ctx.getRequestContext();
rcontext.getJavascriptManager().importJavascript('eXo.webui.UIPopupWindow');
rcontext.getJavascriptManager().addJavascript("eXo.webui.UIPopupWindow.init('$popupId',
$uicomponent.show, $uicomponent.resizable, true, $uicomponent.showMask);");
- String title = popupId;
+ String title = rsId;
if(component != null) title = component.getId();
int width = uicomponent.getWindowWidth();
@@ -41,7 +45,7 @@
<% } else { %>
<div
class="PopupTitleIconRight"><span></span></div>
<% } %>
- <div class="PopupTitle"><%=_ctx.appRes(popupId +
".title."+ title)%></div>
+ <div class="PopupTitle"><%=_ctx.appRes(rsId +
".title."+ title)%></div>
</div>
</div>
</div>
Modified:
portal/branches/performance/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
===================================================================
---
portal/branches/performance/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -19,6 +19,9 @@
package org.exoplatform.webui.core.lifecycle;
+import java.util.ArrayList;
+import java.util.List;
+
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIApplication;
@@ -33,9 +36,6 @@
import org.exoplatform.webui.form.UIFormMultiValueInputSet;
import org.exoplatform.webui.form.validator.Validator;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Author : Nhu Dinh Thuan
* nhudinhthuan(a)yahoo.com
@@ -69,6 +69,8 @@
}
UIComponent uiSubComponent = uicomponent.findComponentById(subComponentId);
Event<UIComponent> event = uiSubComponent.createEvent(action,
Event.Phase.DECODE, context);
+ if (event == null)
+ event = uicomponent.createEvent(action, Event.Phase.DECODE, context);
if (event != null)
event.broadcast();
}
Modified:
portal/branches/performance/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java
===================================================================
---
portal/branches/performance/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIListPermissionSelector.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -19,6 +19,11 @@
package org.exoplatform.webui.organization;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserACL.Permission;
@@ -43,19 +48,13 @@
import org.exoplatform.webui.form.UIFormPopupWindow;
import org.exoplatform.webui.form.validator.Validator;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
/**
* Created by The eXo Platform SARL
* Author : Pham Dung Ha
* ha.pham(a)exoplatform.com
- * May 7, 2007
+ * May 7, 2007o
*/
-@ComponentConfig(template =
"system:/groovy/organization/webui/component/UIListPermissionSelector.gtmpl",
events = {
- @EventConfig(phase = Phase.DECODE, listeners =
UIListPermissionSelector.CloseActionListener.class),
+@ComponentConfig(template =
"system:/groovy/organization/webui/component/UIListPermissionSelector.gtmpl",
events = {
@EventConfig(phase = Phase.DECODE, listeners =
UIListPermissionSelector.DeleteActionListener.class, confirm =
"UIAccessGroup.deleteAccessGroup"),
@EventConfig(phase = Phase.DECODE, listeners =
UIPermissionSelector.SelectMembershipActionListener.class),
@EventConfig(phase = Phase.DECODE, listeners =
UIListPermissionSelector.ChangePublicModeActionListener.class)})
@@ -279,19 +278,6 @@
}
}
-
- static public class CloseActionListener extends
EventListener<UIListPermissionSelector>
- {
- public void execute(Event<UIListPermissionSelector> event) throws Exception
- {
- UIListPermissionSelector uicom = event.getSource();
- UIForm uiForm = uicom.getAncestorOfType(UIForm.class);
- if (uiForm != null)
- {
- uiForm.broadcast(event, event.getExecutionPhase());
- }
- }
- }
static public class EmptyIteratorValidator implements Validator
{
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -47,8 +47,9 @@
protected static Log log =
ExoLogger.getLogger("portal:PortalStateManager");
- private ConcurrentMap<String, PortalApplicationState> uiApplications =
- new ConcurrentHashMap<String, PortalApplicationState>();
+ /** ConcurrentMap<SessionId, HashMap<PortalName, PortalApplicationState>>
**/
+ private ConcurrentMap<String, HashMap<String, PortalApplicationState>>
uiApplications =
+ new ConcurrentHashMap<String, HashMap<String,
PortalApplicationState>>();
/**
* This method is used to restore the UI component tree either the current request
targets a portlet
@@ -66,14 +67,14 @@
/*
* If the request context is of type PortletRequestContext, we extract the parent
context which will
* allow to get access to the PortalApplicationState object thanks to the session
id used as the key for the
- * syncronised Map uiApplications
+ * synchronize Map uiApplications
*/
if (context instanceof PortletRequestContext)
{
- WebuiRequestContext preqContext =
(WebuiRequestContext)context.getParentAppRequestContext();
- PortalApplicationState state = uiApplications.get(preqContext.getSessionId());
+ WebuiRequestContext preqContext =
(WebuiRequestContext)context.getParentAppRequestContext();
PortletRequestContext pcontext = (PortletRequestContext)context;
String key = pcontext.getApplication().getApplicationId() + "/" +
pcontext.getWindowId();
+ PortalApplicationState state = getApplicationState(preqContext);
UIApplication uiApplication = state.get(key);
if (uiApplication != null)
return uiApplication;
@@ -86,11 +87,10 @@
}
PortalRequestContext pcontext = (PortalRequestContext)context;
- PortalApplicationState state = uiApplications.get(pcontext.getSessionId());
+ PortalApplicationState state = getApplicationState(pcontext);
if (state != null)
{
- if ((!(Safe.equals(pcontext.getRemoteUser(), state.getUserName())))
- ||
(!pcontext.getPortalOwner().equals(state.getUIPortalApplication().getOwner())))
+ if (!Safe.equals(pcontext.getRemoteUser(), state.getUserName()))
{
clearSession(pcontext.getRequest().getSession());
state = null;
@@ -119,7 +119,7 @@
pcontext.setAttribute(UserPortalConfig.class, config);
UIPortalApplication uiApplication =
(UIPortalApplication)app.createUIComponent(type, null, null, context);
state = new PortalApplicationState(uiApplication, pcontext.getRemoteUser());
- uiApplications.put(context.getSessionId(), state);
+ cacheApplicationState(pcontext.getSessionId(),
pcontext.getPortalOwner(),state);
SessionManagerContainer pcontainer =
(SessionManagerContainer)app.getApplicationServiceContainer();
pcontainer.createSessionContainer(context.getSessionId(),
uiApplication.getOwner());
}
@@ -133,14 +133,32 @@
public void expire(String sessionId, WebuiApplication app)
{
- PortalApplicationState state = uiApplications.remove(sessionId);
- if (state != null)
- {
- log.warn("Session expires, remove application: " +
state.getUIPortalApplication());
- }
+ uiApplications.remove(sessionId);
SessionManagerContainer pcontainer =
(SessionManagerContainer)app.getApplicationServiceContainer();
pcontainer.removeSessionContainer(sessionId);
}
+
+ private PortalApplicationState getApplicationState(WebuiRequestContext context) {
+ PortalRequestContext portalContext = null;
+ if (context instanceof PortalRequestContext)
+ portalContext = (PortalRequestContext)context;
+ else
+ portalContext = (PortalRequestContext)context.getParentAppRequestContext();
+ String portalName = portalContext.getPortalOwner();
+ String sessionId = portalContext.getSessionId();
+
+ HashMap<String, PortalApplicationState> appStates =
uiApplications.get(sessionId);
+ return (appStates == null) ? null : appStates.get(portalName);
+ }
+
+ private void cacheApplicationState(String sessionId, String portalName,
PortalApplicationState state) {
+ HashMap<String, PortalApplicationState> appStates =
uiApplications.get(sessionId);
+ if (appStates == null) {
+ appStates = new HashMap<String, PortalApplicationState>();
+ uiApplications.put(sessionId, appStates);
+ }
+ appStates.put(portalName, state);
+ }
private UserPortalConfig getUserPortalConfig(PortalRequestContext context) throws
Exception
{
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/application/ResourceRequestFilter.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -26,8 +26,8 @@
import org.exoplatform.commons.utils.TextEncoder;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.web.AbstractFilter;
-import org.exoplatform.portal.skin.ResourceRenderer;
-import org.exoplatform.portal.skin.SkinService;
+import org.exoplatform.portal.resource.ResourceRenderer;
+import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache;
import org.exoplatform.services.log.ExoLogger;
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -601,6 +601,7 @@
HttpServletRequest servletRequest = prc.getRequest();
HashMap<String, String[]> allParams = new HashMap<String, String[]>();
allParams.putAll(servletRequest.getParameterMap());
+ allParams.putAll(this.getPublicParameters());
if (type.equals(ActionInvocation.class))
{
ActionInvocation actionInvocation = new ActionInvocation(pic);
@@ -667,8 +668,7 @@
invocation.setWindowState(org.gatein.pc.api.WindowState.create(getCurrentWindowState().toString()));
// Public navigational state
- invocation.setPublicNavigationalState(allParams);
-
+ invocation.setPublicNavigationalState(this.getPublicParameters());
//
StatefulPortletContext<C> preferencesPortletContext = getPortletContext();
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -140,7 +140,7 @@
// set the public params
HttpServletRequest request = prcontext.getRequest();
- setupPublicRenderParams(uiPortlet, request.getParameterMap());
+ setupPublicRenderParams(uiPortlet,
navStateResponse.getPublicNavigationalStateUpdates());
/*
* Cache the render parameters in the UI portlet component to handle the
@@ -150,9 +150,7 @@
*/
//
- Map<String, String[]> map =
-
StateString.decodeOpaqueValue((navStateResponse.getNavigationalState()).getStringValue());
- uiPortlet.setRenderParametersMap(map);
+
uiPortlet.setRenderParametersMap(navStateResponse.getPublicNavigationalStateUpdates());
//
/*
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletForm.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -25,7 +25,7 @@
import org.exoplatform.portal.pom.spi.portlet.Preference;
import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.portlet.PortletExceptionHandleService;
-import org.exoplatform.portal.skin.SkinService;
+import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -362,9 +362,8 @@
uiNodeForm.setSelectedParent(parent);
// set navigation owner, navigation type
- UINavigationManagement nodeManager = uiNodeSelector.getParent();
- uiNodeForm.setOwner(nodeManager.getOwner());
- uiNodeForm.setOwnerType(nodeManager.getOwnerType());
+ uiNodeForm.setOwner(uiNodeSelector.getSelectedNavigation().getOwnerId());
+ uiNodeForm.setOwnerType(uiNodeSelector.getSelectedNavigation().getOwnerType());
uiManagementPopup.setWindowSize(800, 500);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
@@ -469,6 +468,11 @@
UIPopupWindow uiManagementPopup =
uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
UIPageNodeForm2 uiNodeForm = uiApp.createUIComponent(UIPageNodeForm2.class,
null, null);
uiManagementPopup.setUIComponent(uiNodeForm);
+
+ // set navigation owner, navigation type
+ uiNodeForm.setOwner(uiNodeSelector.getSelectedNavigation().getOwnerId());
+ uiNodeForm.setOwnerType(uiNodeSelector.getSelectedNavigation().getOwnerType());
+
uiNodeForm.setValues(selectedNode);
uiNodeForm.setSelectedParent(obj);
uiManagementPopup.setWindowSize(800, 500);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -70,7 +70,7 @@
{
UserPortalConfigService configService =
uiPortalApp.getApplicationComponent(UserPortalConfigService.class);
String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- UserPortalConfig portalConfig =
configService.getUserPortalConfig(uiPortal.getOwner(), remoteUser);
+ UserPortalConfig portalConfig =
configService.getUserPortalConfig(Util.getPortalRequestContext().getPortalOwner(),
remoteUser);
uiPortal.getChildren().clear();
PortalDataMapper.toUIPortal(uiPortal, portalConfig);
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -33,6 +33,7 @@
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.web.application.JavascriptManager;
@@ -373,6 +374,8 @@
}
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWizard.saveData();
+ UIPortalToolPanel toolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
+ toolPanel.setUIComponent(null);
uiWizard.updateUIPortal(uiPortalApp, event);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageWizard.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -24,6 +24,7 @@
import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -160,6 +161,8 @@
UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
+ UIPortalToolPanel toolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
+ toolPanel.setUIComponent(null);
pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -26,7 +26,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.PortalProperties;
-import org.exoplatform.portal.skin.SkinService;
+import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.portal.webui.application.UIApplicationList;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainerList;
@@ -147,7 +147,7 @@
PortalConfig portalConfig =
(PortalConfig)PortalDataMapper.buildModelObject(editPortal);
UserPortalConfigService configService =
getApplicationComponent(UserPortalConfigService.class);
- configService.update(portalConfig);
+ //configService.update(portalConfig);
uiPortalApp.getUserPortalConfig().setPortal(portalConfig);
String remoteUser = prContext.getRemoteUser();
String ownerUser = prContext.getPortalOwner();
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -26,7 +26,8 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.PortalProperties;
-import org.exoplatform.portal.skin.SkinService;
+import org.exoplatform.portal.resource.SkinService;
+import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -236,6 +237,9 @@
UIPortal uiPortal = Util.getUIPortal();
uiForm.invokeSetBindingBean(uiPortal);
//
uiPortal.refreshNavigation(localeConfigService.getLocaleConfig(uiPortal.getLocale()).getLocale())
;
+ PortalConfig portalConfig =
(PortalConfig)PortalDataMapper.buildModelObject(uiPortal);
+ UserPortalConfigService configService =
uiForm.getApplicationComponent(UserPortalConfigService.class);
+ configService.update(portalConfig);
UIMaskWorkspace uiMaskWorkspace = uiForm.getParent();
uiMaskWorkspace.setUIComponent(null);
event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWorkspace);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UISkinSelector.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -19,7 +19,7 @@
package org.exoplatform.portal.webui.portal;
-import org.exoplatform.portal.skin.SkinService;
+import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -182,7 +182,7 @@
return model;
}
- static private Page toPageModel(UIPage uiPage)
+ static public Page toPageModel(UIPage uiPage)
{
Page model = new Page(uiPage.getStorageId());
toContainer(model, uiPage);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -21,7 +21,9 @@
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserACL;
+import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.page.UIPageCreationWizard;
import org.exoplatform.portal.webui.page.UISiteBody;
@@ -29,8 +31,10 @@
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.portal.UIPortalForm;
+import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
+import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -64,6 +68,18 @@
UIPortalToolPanel uiToolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
uiToolPanel.setShowMaskLayer(false);
UIPageBody pageBody = uiWorkingWS.findFirstComponentOfType(UIPageBody.class);
+
+ // check edit permission for page
+ UIPage uiPage = (UIPage) pageBody.getUIComponent();
+ Page page = PortalDataMapper.toPageModel(uiPage);
+
+ UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
+ if (!userACL.hasEditPermission(page))
+ {
+ uiApp.addMessage(new
ApplicationMessage("UIPortalManagement.msg.Invalid-editPermission", null));
+ return;
+ }
+
uiToolPanel.setWorkingComponent(pageBody.getUIComponent());
event.getRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
Util.getPortalRequestContext().setFullRender(true);
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -25,12 +25,14 @@
import org.exoplatform.webui.core.UIComponentDecorator;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.event.Event.Phase;
/**
* Created by The eXo Platform SAS
* Mar 13, 2007
*/
-@ComponentConfig(id = "UIMaskWorkspace", template =
"system:/groovy/portal/webui/workspace/UIMaskWorkspace.gtmpl", events =
@EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class))
+@ComponentConfig(id = "UIMaskWorkspace", template =
"system:/groovy/portal/webui/workspace/UIMaskWorkspace.gtmpl",
+ events = @EventConfig(phase = Phase.DECODE, listeners =
UIMaskWorkspace.CloseActionListener.class))
public class UIMaskWorkspace extends UIComponentDecorator
{
Modified:
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2009-11-01
11:24:58 UTC (rev 467)
+++
portal/branches/performance/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2009-11-01
13:58:21 UTC (rev 468)
@@ -23,10 +23,10 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.model.Container;
-import org.exoplatform.portal.skin.Skin;
-import org.exoplatform.portal.skin.SkinConfig;
-import org.exoplatform.portal.skin.SkinService;
-import org.exoplatform.portal.skin.SkinURL;
+import org.exoplatform.portal.resource.Skin;
+import org.exoplatform.portal.resource.SkinConfig;
+import org.exoplatform.portal.resource.SkinService;
+import org.exoplatform.portal.resource.SkinURL;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.page.UISiteBody;
import org.exoplatform.portal.webui.portal.PageNodeEvent;