gatein SVN: r2488 - in portal/trunk: web/portal/src/main/webapp/WEB-INF/classes/locale/portal and 1 other directories.
by do-not-reply@jboss.org
Author: kien_nguyen
Date: 2010-04-06 06:30:22 -0400 (Tue, 06 Apr 2010)
New Revision: 2488
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
Log:
Fixed GTNPORTAL-966 with changing validator of FirstName, LastName in Register Portlet
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java 2010-04-06 10:11:02 UTC (rev 2487)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/account/webui/component/UIRegisterInputSet.java 2010-04-06 10:30:22 UTC (rev 2488)
@@ -20,6 +20,7 @@
import javax.portlet.PortletPreferences;
+import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.webui.CaptchaValidator;
import org.exoplatform.portal.webui.UICaptcha;
import org.exoplatform.services.organization.Query;
@@ -73,14 +74,12 @@
.addValidator(MandatoryValidator.class).addValidator(PasswordStringLengthValidator.class, 6, 30));
addUIFormInput(new UIFormStringInput(FIRST_NAME, FIRST_NAME, null).addValidator(StringLengthValidator.class, 3,
- 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class, "^[\\p{L}][\\p{ASCII}]+$",
- "FirstCharacterNameValidator.msg").addValidator(ExpressionValidator.class, "^[\\p{L}][\\p{L}._\\- \\d]+$",
- "ResourceValidator.msg.Invalid-char"));
+ 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class, Utils.FIRST_CHARACTER_NAME_VALIDATOR_REGEX,
+ "FirstCharacterNameValidator.msg"));
addUIFormInput(new UIFormStringInput(LAST_NAME, LAST_NAME, null).addValidator(StringLengthValidator.class, 3,
- 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class, "^[\\p{L}][\\p{ASCII}]+$",
- "FirstCharacterNameValidator.msg").addValidator(ExpressionValidator.class, "^[\\p{L}][\\p{L}._\\- \\d]+$",
- "ResourceValidator.msg.Invalid-char"));
+ 45).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class, Utils.FIRST_CHARACTER_NAME_VALIDATOR_REGEX,
+ "FirstCharacterNameValidator.msg"));
addUIFormInput(new UIFormStringInput(EMAIL_ADDRESS, EMAIL_ADDRESS, null).addValidator(MandatoryValidator.class).addValidator(
EmailAddressValidator.class));
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-04-06 10:11:02 UTC (rev 2487)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-04-06 10:30:22 UTC (rev 2488)
@@ -222,7 +222,8 @@
#{0}=input field name
NameValidator.msg.Invalid-char=Only alpha, digit, dot, dash and underscore characters are allowed for the field "{0}".
-FirstCharacterNameValidator.msg=The "{0}" field must start with a character and must not contains special characters.
+FirstCharacterNameValidator.msg=The "{0}" field must start with a character.
+FirstAndSpecialCharacterNameValidator.msg=The "{0}" field must start with a character and must not contain special characters."
#############################################################################
# Message Info #
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-04-06 10:11:02 UTC (rev 2487)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-04-06 10:30:22 UTC (rev 2488)
@@ -58,7 +58,7 @@
if (Character.isDigit(s.charAt(0)) || s.charAt(0) == '-')
{
Object[] args = {label, uiInput.getBindingField()};
- throw new MessageException(new ApplicationMessage("FirstCharacterNameValidator.msg", args,
+ throw new MessageException(new ApplicationMessage("FirstAndSpecialCharacterNameValidator.msg", args,
ApplicationMessage.WARNING));
}
for (int i = 0; i < s.length(); i++)
14 years, 8 months
gatein SVN: r2487 - in portal/trunk/component: common/src/main/java/org/exoplatform/commons/cache/future and 5 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-04-06 06:11:02 -0400 (Tue, 06 Apr 2010)
New Revision: 2487
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/
portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Entry.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCache.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureExoCache.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Loader.java
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/FutureMap.java
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/GetTestCase.java
portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/StringLoader.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceKey.java
Modified:
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java
portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceResolver.java
Log:
GTNPORTAL-945 : Handle gracefully concurrent compilation of the same template
Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Entry.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Entry.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Entry.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,58 @@
+/*
+ * 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.commons.cache.future;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class Entry<V> implements Serializable
+{
+
+ public static <V> Entry<V> create(V v)
+ {
+ return new Entry<V>(v);
+ }
+
+ /** . */
+ private final V value;
+
+ private Entry(V value)
+ {
+ if (value == null)
+ {
+ throw new NullPointerException();
+ }
+ this.value = value;
+ }
+
+ public V getValue()
+ {
+ return value;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Entry[" + value + "]";
+ }
+}
Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCache.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCache.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCache.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,135 @@
+/*
+ * 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.commons.cache.future;
+
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+
+import java.util.concurrent.*;
+
+/**
+ * A future cache that prevents the loading of the same resource twice. This should be used when the resource
+ * to load is very expensive or cannot be concurrently retrieved (like a classloading).
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public abstract class FutureCache<K, V, C>
+{
+
+ /** . */
+ private final Loader<K, V, C> loader;
+
+ /** . */
+ private final ConcurrentMap<K, FutureTask<Entry<V>>> local;
+
+ /** . */
+ private final Logger log = LoggerFactory.getLogger(FutureCache.class);
+
+ public FutureCache(Loader<K, V, C> loader)
+ {
+ this.loader = loader;
+ this.local = new ConcurrentHashMap<K, FutureTask<Entry<V>>>();
+ }
+
+ protected abstract Entry<V> get(K key);
+
+ protected abstract void put(K key, Entry<V> entry);
+
+ public V get(final C context, final K key)
+ {
+ // First we try a simple cache get
+ Entry<V> entry = get(key);
+
+ // If it does not succeed then we go through a process that will avoid to load
+ // the same resource concurrently
+ if (entry == null)
+ {
+ // Create our future
+ FutureTask<Entry<V>> future = new FutureTask<Entry<V>>(new Callable<Entry<V>>()
+ {
+ public Entry<V> call() throws Exception
+ {
+ // Retrieve the value from the loader
+ V value = loader.retrieve(context, key);
+
+ //
+ if (value != null)
+ {
+ // Create the entry
+ Entry<V> entry = Entry.create(value);
+
+ // Cache it, it is made available to other threads (unless someone removes it)
+ put(key, entry);
+
+ // Return entry
+ return entry;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ });
+
+ // Was our means that we inserted in the local
+ boolean inserted = true;
+
+ //
+ try
+ {
+ FutureTask<Entry<V>> phantom = local.putIfAbsent(key, future);
+
+ // Use the entry that could have been inserted by another thread
+ if (phantom != null)
+ {
+ future = phantom;
+ inserted = false;
+ }
+ else
+ {
+ future.run();
+ }
+
+ // Returns the entry
+ entry = future.get();
+ }
+ catch (ExecutionException e)
+ {
+ log.error("Computing of resource " + key + " threw an exception", e.getCause());
+ }
+ catch (Exception e)
+ {
+ log.error("Retrieval of resource " + key + " threw an exception", e);
+ }
+ finally
+ {
+ // Clean up the per key map but only if our insertion succeeded and with our future
+ if (inserted)
+ {
+ local.remove(key, future);
+ }
+ }
+ }
+
+ //
+ return entry != null ? entry.getValue() : null;
+ }
+}
Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureExoCache.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureExoCache.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureExoCache.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.commons.cache.future;
+
+import org.exoplatform.services.cache.ExoCache;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class FutureExoCache<K extends Serializable, V, C> extends FutureCache<K, V, C>
+{
+
+ /** . */
+ private final ExoCache<K, Entry<V>> cache;
+
+ public FutureExoCache(Loader<K, V, C> loader, ExoCache<K, Entry<V>> cache)
+ {
+ super(loader);
+
+ //
+ this.cache = cache;
+ }
+
+ @Override
+ protected Entry<V> get(K key)
+ {
+ return cache.get(key);
+ }
+
+ @Override
+ protected void put(K key, Entry<V> entry)
+ {
+ cache.put(key, entry);
+ }
+}
Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Loader.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Loader.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/Loader.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,33 @@
+/*
+ * 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.commons.cache.future;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface Loader<K, V, C>
+{
+
+ V retrieve(C context, K key) throws Exception;
+
+}
Added: portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/ConcurrentGetWhenPutTestCase.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,177 @@
+/*
+ * 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.commons.cache.future;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+import org.exoplatform.commons.cache.future.Entry;
+import org.exoplatform.commons.cache.future.FutureCache;
+import org.gatein.common.util.Tools;
+
+import java.util.*;
+import java.util.concurrent.Callable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ConcurrentGetWhenPutTestCase extends TestCase
+{
+
+ /** . */
+ private AssertionFailedError failure;
+
+ /** . */
+ private LinkedList<String> events = new LinkedList<String>();
+
+ FutureCache<String, String, Callable<String>> futureCache = new FutureCache<String, String, Callable<String>>(new StringLoader()) {
+
+
+ @Override
+ protected Entry<String> get(String key)
+ {
+ if (key == key1)
+ {
+ if (Thread.currentThread() != thread1)
+ {
+ failure = new AssertionFailedError();
+ }
+ events.addLast("get/key1");
+ }
+ else if (key == key2)
+ {
+ if (Thread.currentThread() != thread2)
+ {
+ failure = new AssertionFailedError();
+ }
+ events.addLast("get/key2");
+ }
+ else
+ {
+ failure = new AssertionFailedError();
+ }
+ return null;
+ }
+
+ @Override
+ protected void put(String key, Entry<String> entry)
+ {
+ if (key == key1)
+ {
+ if (Thread.currentThread() == thread1)
+ {
+ events.addLast("begin_put/key1/" + entry);
+
+ //
+ thread2.start();
+
+ //
+ while (thread2.getState() != Thread.State.WAITING)
+ {
+ // Wait until thread 2 is blocked
+ }
+
+ //
+ events.addLast("end_put/key1");
+ }
+ else
+ {
+ failure = new AssertionFailedError();
+ }
+ }
+ else
+ {
+ failure = new AssertionFailedError();
+ }
+ }
+ };
+
+ /** . */
+ private final String key1 = new String("foo");
+
+ /** . */
+ private final String key2 = new String("foo");
+
+ Thread thread1 = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ String v = futureCache.get(new Callable<String>()
+ {
+ public String call() throws Exception
+ {
+ events.addLast("call/key1");
+ return "foo_value_1";
+ }
+ }, key1);
+ events.addLast("retrieved/key1/" + v);
+ }
+ };
+
+ Thread thread2 = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ String v = futureCache.get(new Callable<String>()
+ {
+ public String call() throws Exception
+ {
+ failure = new AssertionFailedError();
+ return "foo_value_2";
+ }
+ }, key2);
+ events.addLast("retrieved/key2/" + v);
+ }
+ };
+
+ public void testMain() throws Exception
+ {
+ thread1.start();
+
+ //
+ thread1.join();
+ thread2.join();
+
+ //
+ if (failure != null)
+ {
+ throw failure;
+ }
+
+ //
+ List<String> expectedEvents = Arrays.asList(
+ "get/key1",
+ "call/key1",
+ "begin_put/key1/Entry[foo_value_1]",
+ "get/key2",
+ "end_put/key1"
+ );
+
+ //
+ assertEquals(expectedEvents, events.subList(0, expectedEvents.size()));
+
+ //
+ Set<String> expectedEndEvents = Tools.toSet("retrieved/key1/foo_value_1", "retrieved/key2/foo_value_1");
+ assertEquals(expectedEndEvents, new HashSet<String>(events.subList(expectedEvents.size(), events.size())));
+ }
+
+}
\ No newline at end of file
Added: portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/FutureMap.java
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/FutureMap.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/FutureMap.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,59 @@
+/*
+ * 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.commons.cache.future;
+
+import org.exoplatform.commons.cache.future.Entry;
+import org.exoplatform.commons.cache.future.FutureCache;
+import org.exoplatform.commons.cache.future.Loader;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class FutureMap<C> extends FutureCache<String, String, C>
+{
+
+ /** . */
+ final Map<String, Entry<String>> data;
+
+ public FutureMap(Loader<String, String, C> loader)
+ {
+ super(loader);
+
+ //
+ this.data = Collections.synchronizedMap(new HashMap<String, Entry<String>>());
+ }
+
+ @Override
+ protected Entry<String> get(String key)
+ {
+ return data.get(key);
+ }
+
+ @Override
+ protected void put(String key, Entry<String> entry)
+ {
+ data.put(key, entry);
+ }
+}
Added: portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/GetTestCase.java
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/GetTestCase.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/GetTestCase.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,71 @@
+/*
+ * 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.commons.cache.future;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import java.util.concurrent.Callable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class GetTestCase extends TestCase
+{
+ public void testGet()
+ {
+ FutureMap<Callable<String>> futureCache = new FutureMap<Callable<String>>(new StringLoader());
+ Assert.assertEquals("foo_value", futureCache.get(new Callable<String>()
+ {
+ public String call() throws Exception
+ {
+ return "foo_value";
+ }
+ }, "foo"));
+ Assert.assertEquals("foo_value", futureCache.data.get("foo").getValue());
+ }
+
+ public void testNullValue()
+ {
+ FutureMap<Callable<String>> futureCache = new FutureMap<Callable<String>>(new StringLoader());
+ Assert.assertEquals(null, futureCache.get(new Callable<String>()
+ {
+ public String call() throws Exception
+ {
+ return null;
+ }
+ }, "foo"));
+ Assert.assertFalse(futureCache.data.containsKey("foo"));
+ }
+
+ public void testThrowException()
+ {
+ FutureMap<Callable<String>> futureCache = new FutureMap<Callable<String>>(new StringLoader());
+ Assert.assertEquals(null, futureCache.get(new Callable<String>()
+ {
+ public String call() throws Exception
+ {
+ throw new Exception("DON'T FREAK OUT");
+ }
+ }, "foo"));
+ Assert.assertFalse(futureCache.data.containsKey("foo"));
+ }
+}
Added: portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/StringLoader.java
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/StringLoader.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/commons/cache/future/StringLoader.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,36 @@
+/*
+ * 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.commons.cache.future;
+
+import org.exoplatform.commons.cache.future.Loader;
+
+import java.util.concurrent.Callable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class StringLoader implements Loader<String, String, Callable<String>>
+{
+ public String retrieve(Callable<String> context, String key) throws Exception
+ {
+ return context.call();
+ }
+}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java 2010-04-06 09:44:10 UTC (rev 2486)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/text/TemplateService.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -22,8 +22,11 @@
import groovy.lang.Writable;
import groovy.text.Template;
+import org.exoplatform.commons.cache.future.Entry;
+import org.exoplatform.commons.cache.future.FutureCache;
+import org.exoplatform.commons.cache.future.FutureExoCache;
+import org.exoplatform.commons.cache.future.Loader;
import org.exoplatform.commons.utils.IOUtil;
-import org.exoplatform.container.xml.InitParams;
import org.exoplatform.groovyscript.GroovyTemplate;
import org.exoplatform.groovyscript.GroovyTemplateEngine;
import org.exoplatform.management.annotations.Impact;
@@ -34,9 +37,11 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
import org.exoplatform.management.rest.annotations.RESTEndpoint;
+import org.exoplatform.resolver.ResourceKey;
import org.exoplatform.resolver.ResourceResolver;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
+import org.gatein.common.io.IOTools;
import java.io.InputStream;
import java.util.ArrayList;
@@ -54,17 +59,52 @@
private GroovyTemplateEngine engine_;
- private ExoCache<String, GroovyTemplate> templatesCache_;
+ private ExoCache<ResourceKey, Entry<GroovyTemplate>> templatesCache_;
private TemplateStatisticService statisticService;
private boolean cacheTemplate_ = true;
+ private final Loader<ResourceKey, GroovyTemplate, ResourceResolver> loader = new Loader<ResourceKey, GroovyTemplate, ResourceResolver>()
+ {
+ public GroovyTemplate retrieve(ResourceResolver context, ResourceKey key) throws Exception
+ {
+ byte[] bytes;
+ InputStream is = context.getInputStream(key.getURL());
+ try
+ {
+ bytes = IOUtil.getStreamContentAsBytes(is);
+ is.close();
+ }
+ finally
+ {
+ IOTools.safeClose(is);
+ }
+
+ // The template class name
+ int pos = key.getURL().lastIndexOf('/');
+ if (pos == -1)
+ {
+ pos = 0;
+ }
+ String name = key.getURL().substring(pos);
+
+ // Julien: it's a bit dangerious here, with respect to the file encoding...
+ String text = new String(bytes);
+
+ // Finally do the expensive template creation
+ return engine_.createTemplate(key.getURL(), name, text);
+ }
+ };
+
+ private FutureCache<ResourceKey, GroovyTemplate, ResourceResolver> futureCache;
+
public TemplateService(TemplateStatisticService statisticService, CacheService cservice) throws Exception
{
this.engine_ = new GroovyTemplateEngine();
this.statisticService = statisticService;
this.templatesCache_ = cservice.getCacheInstance(TemplateService.class.getSimpleName());
+ this.futureCache = new FutureExoCache<ResourceKey, GroovyTemplate, ResourceResolver>(loader, templatesCache_);
}
public void merge(String name, BindingContext context) throws Exception
@@ -108,37 +148,18 @@
final public GroovyTemplate getTemplate(String url, ResourceResolver resolver, boolean cacheable) throws Exception
{
- GroovyTemplate template = null;
+ GroovyTemplate template;
+ ResourceKey resourceId = resolver.createResourceKey(url);
if (cacheable)
{
- String resourceId = resolver.createResourceId(url);
- template = getTemplatesCache().get(resourceId);
+ template = futureCache.get(resolver, resourceId);
}
- if (template != null)
- return template;
- InputStream is;
- byte[] bytes = null;
- is = resolver.getInputStream(url);
- bytes = IOUtil.getStreamContentAsBytes(is);
- is.close();
-
- // The template class name
- int pos = url.lastIndexOf('/');
- if (pos == -1)
+ else
{
- pos = 0;
+ template = loader.retrieve(resolver, resourceId);
}
- String name = url.substring(pos);
- String text = new String(bytes);
- template = engine_.createTemplate(url, name, text);
-
- if (cacheable)
- {
- String resourceId = resolver.createResourceId(url);
- getTemplatesCache().put(resourceId, template);
- }
-
+ //
return template;
}
@@ -148,7 +169,7 @@
getTemplatesCache().remove(resourceId);
}
- public ExoCache<String, GroovyTemplate> getTemplatesCache()
+ public ExoCache<ResourceKey, Entry<GroovyTemplate>> getTemplatesCache()
{
return templatesCache_;
}
@@ -198,9 +219,13 @@
try
{
ArrayList<String> list = new ArrayList<String>();
- for (GroovyTemplate template : templatesCache_.getCachedObjects())
+ for (Entry<GroovyTemplate> entry : templatesCache_.getCachedObjects())
{
- list.add(template.getId());
+ GroovyTemplate template = entry.getValue();
+ if (template != null)
+ {
+ list.add(template.getId());
+ }
}
return list.toArray(new String[list.size()]);
}
Added: portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceKey.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceKey.java (rev 0)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceKey.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -0,0 +1,72 @@
+/*
+ * 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.resolver;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ResourceKey implements Serializable
+{
+
+ /** . */
+ private final int resolverId;
+
+ /** . */
+ private final String url;
+
+ public ResourceKey(int resolverId, String url)
+ {
+ if (url == null)
+ {
+ throw new NullPointerException("no null URL accepted");
+ }
+ this.resolverId = resolverId;
+ this.url = url;
+ }
+
+ public String getURL()
+ {
+ return url;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return resolverId ^ url.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof ResourceKey)
+ {
+ ResourceKey that = (ResourceKey)o;
+ return resolverId == that.resolverId && url.equals(that.url);
+ }
+ return false;
+ }
+}
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceResolver.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceResolver.java 2010-04-06 09:44:10 UTC (rev 2486)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/resolver/ResourceResolver.java 2010-04-06 10:11:02 UTC (rev 2487)
@@ -54,6 +54,11 @@
throw new RuntimeException("unsupported method");
}
+ public ResourceKey createResourceKey(String url)
+ {
+ return new ResourceKey(hashCode(), url);
+ }
+
public String createResourceId(String url)
{
return hashCode() + ":" + url;
14 years, 8 months
gatein SVN: r2486 - in portal/branches/EPP_5_0_Branch: web/eXoResources/src/main/webapp/WEB-INF and 1 other directory.
by do-not-reply@jboss.org
Author: mpodolin
Date: 2010-04-06 05:44:10 -0400 (Tue, 06 Apr 2010)
New Revision: 2486
Modified:
portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml
portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml
Log:
JBEPP-238: GTNPORTAL-891 ported to the branch
Modified: portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
--- portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml 2010-04-06 09:35:49 UTC (rev 2485)
+++ portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/gatein-resources.xml 2010-04-06 09:44:10 UTC (rev 2486)
@@ -51,18 +51,7 @@
<portlet-name>NavigationPortlet</portlet-name>
<skin-name>Default</skin-name>
<css-path>/skin/portal/webui/component/UINavigationPortlet/DefaultStylesheet.css</css-path>
- </portlet-skin>
-
-
- <!-- PortalNavigationPortlet skins -->
-
- <portlet-skin>
- <application-name>web</application-name>
- <portlet-name>PortalNavigationPortlet2</portlet-name>
- <skin-name>Default</skin-name>
- <css-path>/skin/portal/webui/component/UIPortalNavigationPortlet/DefaultStylesheet.css</css-path>
- </portlet-skin>
-
+ </portlet-skin>
<!-- SiteMapPortlet skins -->
Modified: portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml
===================================================================
--- portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml 2010-04-06 09:35:49 UTC (rev 2485)
+++ portal/branches/EPP_5_0_Branch/portlet/web/src/main/webapp/WEB-INF/portlet.xml 2010-04-06 09:44:10 UTC (rev 2486)
@@ -201,38 +201,6 @@
</portlet>
<portlet>
- <description xml:lang="EN">Portal Navigation Portlet</description>
- <portlet-name>PortalNavigationPortlet2</portlet-name>
- <display-name xml:lang="EN">Portal Navigation Portlet</display-name>
- <portlet-class>org.exoplatform.webui.application.portlet.PortletApplicationController</portlet-class>
-
- <init-param>
- <name>webui.configuration</name>
- <value>/WEB-INF/conf/portlet/web/PortalNavigationPortlet/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.portal.PortalNavigationPortlet</resource-bundle>
- <portlet-info>
- <title>Portal Navigation Portlet</title>
- <short-title>Portal Navigation Portlet</short-title>
- <keywords>System</keywords>
- </portlet-info>
- <portlet-preferences>
- <preference>
- <name>useAJAX</name>
- <value>false</value>
- <read-only>false</read-only>
- </preference>
- </portlet-preferences>
- </portlet>
-
- <portlet>
<description xml:lang="EN">SiteMap Portlet</description>
<portlet-name>SiteMapPortlet</portlet-name>
<display-name xml:lang="EN">Site Map Portlet</display-name>
Modified: portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
--- portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml 2010-04-06 09:35:49 UTC (rev 2485)
+++ portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml 2010-04-06 09:44:10 UTC (rev 2486)
@@ -297,10 +297,6 @@
<js-path>/javascript/eXo/portal/UIPortalNavigation.js</js-path>
</param>
<param>
- <js-module>eXo.portal.UIPortalNavigation2</js-module>
- <js-path>/javascript/eXo/portal/UIPortalNavigation2.js</js-path>
- </param>
- <param>
<js-module>eXo.portal.UIMaskWorkspace</js-module>
<js-path>/javascript/eXo/portal/UIMaskWorkspace.js</js-path>
</param>
@@ -316,4 +312,4 @@
<js-path>/javascript/eXo/webui/UIPortlet.js</js-path>
</param>
</javascript>
-</gatein-resources>
\ No newline at end of file
+</gatein-resources>
14 years, 8 months
gatein SVN: r2485 - portal/branches/EPP_5_0_Branch/component/resources/src/main/java/org/exoplatform/services/resources.
by do-not-reply@jboss.org
Author: mpodolin
Date: 2010-04-06 05:35:49 -0400 (Tue, 06 Apr 2010)
New Revision: 2485
Modified:
portal/branches/EPP_5_0_Branch/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java
Log:
JBEPP-219: GTNPORTAL-638 ported to the branch
Modified: portal/branches/EPP_5_0_Branch/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java
===================================================================
--- portal/branches/EPP_5_0_Branch/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java 2010-04-06 09:29:21 UTC (rev 2484)
+++ portal/branches/EPP_5_0_Branch/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java 2010-04-06 09:35:49 UTC (rev 2485)
@@ -55,4 +55,10 @@
{
return EMPTY_KEYS.elements();
}
+
+ @Override
+ public Locale getLocale()
+ {
+ return MAGIC_LOCALE;
+ }
}
14 years, 8 months
gatein SVN: r2484 - in portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin: webui/component/UIBarDecorator/UIInfoBar and 1 other directory.
by do-not-reply@jboss.org
Author: mpodolin
Date: 2010-04-06 05:29:21 -0400 (Tue, 06 Apr 2010)
New Revision: 2484
Modified:
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIBarDecorator/UIInfoBar/Stylesheet.css
Log:
JBEPP-206: GTNPORTAL-422 ported to the branch
Modified: portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css
===================================================================
--- portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css 2010-04-06 09:25:24 UTC (rev 2483)
+++ portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css 2010-04-06 09:29:21 UTC (rev 2484)
@@ -51,8 +51,8 @@
}
.UIPortlet .EditPortletPropertiesIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
width: 20px; height: 20px;
background: url('background/Pen.gif') no-repeat top;
margin: 4px 0px 0px 5px; /* orientation=lt */
@@ -60,8 +60,8 @@
}
.UIPortlet .DeletePortletIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
width: 20px; height:20px;
background: url('background/Close.gif') no-repeat bottom;
margin: 0px 0px 0px 2px; /* orientation=lt */
@@ -139,24 +139,6 @@
_height: 86px;
}
-.UIContainer .EditPortletPropertiesIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 20px; height: 20px;
- background: url('background/Pen.png') no-repeat top;
- margin: 2px 0px 0px 5px; /* orientation=lt */
- margin: 2px 5px 0px 0px; /* orientation=rt */
-}
-
-.UIContainer .DeletePortletIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 20px; height:20px;
- background: url('background/close.png') no-repeat bottom;
- margin: 1px 0px 0px 2px; /* orientation=lt */
- margin: 1px 2px 0px 0px; /* orientation=rt */
-}
-
.UIContainer .NewLayer {
background: #93c0e2;
filter: alpha(opacity=40);
@@ -200,8 +182,8 @@
}
.UIContainer .EditContainerIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
width: 22px; height: 16px;
background: url('background/Pen.gif') no-repeat top;
margin: 4px 2px 0px 0px; /* orientation=lt */
@@ -209,8 +191,8 @@
}
.UIContainer .DeleteContainerIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
width: 22px; height: 16px;
background: url('background/Close.gif') no-repeat bottom;
margin: 4px 0px 0px 0px; /* orientation=lt */
Modified: portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIBarDecorator/UIInfoBar/Stylesheet.css
===================================================================
--- portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIBarDecorator/UIInfoBar/Stylesheet.css 2010-04-06 09:25:24 UTC (rev 2483)
+++ portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UIBarDecorator/UIInfoBar/Stylesheet.css 2010-04-06 09:29:21 UTC (rev 2484)
@@ -80,7 +80,6 @@
.UIInfoBar .BlueRoundedStyle .FixHeight {
height: 26px;
- *width: 270px;
white-space: nowrap;
}
14 years, 8 months
gatein SVN: r2483 - portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent.
by do-not-reply@jboss.org
Author: mpodolin
Date: 2010-04-06 05:25:24 -0400 (Tue, 06 Apr 2010)
New Revision: 2483
Modified:
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css
Log:
JBEPP-235: GTNPORTAL-885 ported to the branch
Modified: portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css
===================================================================
--- portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css 2010-04-06 08:27:23 UTC (rev 2482)
+++ portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/view/UIPortalComponent/Stylesheet.css 2010-04-06 09:25:24 UTC (rev 2483)
@@ -17,98 +17,98 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-.UIPortlet .LAYOUT-BLOCK {
- padding: 5px;
-}
-
+.UIPortlet .LAYOUT-BLOCK {
+ padding: 5px;
+}
+
.UIPortlet .CONTROL-PORTLET {
- left: 0; /* orientation=lt */
- right: 0; /* orientation=rt */
-}
-
-.UIPortlet .CONTROL-PORTLET .Login {
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/ToolIcons/Key.gif') no-repeat center;
-}
-
-.UIPortlet .CONTROL-PORTLET .DragControlArea {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- width: 7px; height: 13px;
- margin: 5px 0px 0px 3px; /* orientation=lt */
- margin: 5px 3px 0px 0px; /* orientation=rt */
- background: url('background/DragBg2x2.gif');
- cursor: move;
-}
-
-.UIPortlet .ViewPortletIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 16px; height: 16px;
- margin: 4px 5px 0px 0px; /* orientation=lt */
- margin: 4px 0px 0px 5px; /* orientation=rt */
- background: url('background/BlueBoxLight.gif') no-repeat;
- cursor: pointer;
-}
-
+ left: 0; /* orientation=lt */
+ right: 0; /* orientation=rt */
+}
+
+.UIPortlet .CONTROL-PORTLET .Login {
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/ToolIcons/Key.gif') no-repeat center;
+}
+
+.UIPortlet .CONTROL-PORTLET .DragControlArea {
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
+ width: 7px; height: 13px;
+ margin: 5px 0px 0px 3px; /* orientation=lt */
+ margin: 5px 3px 0px 0px; /* orientation=rt */
+ background: url('background/DragBg2x2.gif');
+ cursor: move;
+}
+
+.UIPortlet .ViewPortletIcon {
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ width: 16px; height: 16px;
+ margin: 4px 5px 0px 0px; /* orientation=lt */
+ margin: 4px 0px 0px 5px; /* orientation=rt */
+ background: url('background/BlueBoxLight.gif') no-repeat;
+ cursor: pointer;
+}
+
.UIPortlet .EditPortletPropertiesIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 20px; height: 20px;
- background: url('background/Pen.gif') no-repeat top;
- margin: 4px 3px 0px 5px; /* orientation=lt */
- margin: 4px 5px 0px 3px; /* orientation=rt */
-}
-
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ width: 20px; height: 20px;
+ background: url('background/Pen.gif') no-repeat top;
+ margin: 4px 0px 0px 5px; /* orientation=lt */
+ margin: 4px 5px 0px 0px; /* orientation=rt */
+}
+
.UIPortlet .DeletePortletIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 20px; height:20px;
- background: url('background/Close.gif') no-repeat bottom;
- margin: 0px 4px 0px 0px; /* orientation=lt */
- margin: 0px 0px 0px 4px; /* orientation=rt */
-}
-
-.UIPortlet .SelectedContainerBlock {
- background: white;
- border-top: 1px solid #91bcdd;
-}
-
-.UIPortlet .SelectedContainerBlock .LeftContainerBlock {
- background: url('background/BgContainerBlock.gif') no-repeat left top;
- padding-left: 1px;
-}
-
-.UIPortlet .SelectedContainerBlock .RightContainerBlock {
- background: url('background/BgContainerBlock.gif') no-repeat right top;
- padding: 4px;
-}
-
-.UIPortlet .NewLayer {
- background: #d1dce5;
- filter: alpha(opacity=80);
- opacity: 0.8;
- width: 100%; height: 100%;
-}
-
-/*##############################- PortletLayoutDecorator -################################*/
-
-.PortletLayoutDecorator {
-}
-
-.PortletLayoutDecorator .LPortletLayoutDecorator {
- background: url('background/PortletLayoutDecorator.gif') no-repeat left top;
- padding: 0px 0px 0px 12px;
-}
-
-.PortletLayoutDecorator .RPortletLayoutDecorator {
- background: url('background/PortletLayoutDecorator.gif') no-repeat right top;
- padding-right: 12px;
-}
-
-.PortletLayoutDecorator .CPortletLayoutDecorator {
- background: url('background/PortletLayoutDecorator.gif') repeat-x center -89px;
-}
-
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ width: 20px; height:20px;
+ background: url('background/Close.gif') no-repeat bottom;
+ margin: 0px 0px 0px 2px; /* orientation=lt */
+ margin: 0px 2px 0px 0px; /* orientation=rt */
+}
+
+.UIPortlet .SelectedContainerBlock {
+ background: white;
+ border-top: 1px solid #91bcdd;
+}
+
+.UIPortlet .SelectedContainerBlock .LeftContainerBlock {
+ background: url('background/BgContainerBlock.gif') no-repeat left top;
+ padding-left: 1px;
+}
+
+.UIPortlet .SelectedContainerBlock .RightContainerBlock {
+ background: url('background/BgContainerBlock.gif') no-repeat right top;
+ padding: 4px;
+}
+
+.UIPortlet .NewLayer {
+ background: #d1dce5;
+ filter: alpha(opacity=80);
+ opacity: 0.8;
+ width: 100%; height: 100%;
+}
+
+/*##############################- PortletLayoutDecorator -################################*/
+
+.PortletLayoutDecorator {
+}
+
+.PortletLayoutDecorator .LPortletLayoutDecorator {
+ background: url('background/PortletLayoutDecorator.gif') no-repeat left top;
+ padding: 0px 0px 0px 12px;
+}
+
+.PortletLayoutDecorator .RPortletLayoutDecorator {
+ background: url('background/PortletLayoutDecorator.gif') no-repeat right top;
+ padding-right: 12px;
+}
+
+.PortletLayoutDecorator .CPortletLayoutDecorator {
+ background: url('background/PortletLayoutDecorator.gif') repeat-x center -89px;
+}
+
.PortletLayoutDecorator .FixHeight {
height: 69px;
padding: 10px 0;
@@ -119,178 +119,179 @@
.ProtectedPortlet .PortletLayoutDecorator .LPortletLayoutDecorator {
opacity: 0.3;
filter: alpha(opacity=30);
-}
-/*############### End Decorator ###################################################*/
-
-.LAYOUT-CONTAINER .UIContainer {
- height: 100%;
- /*
- fix bug dragdrop in IE6
- */
-}
-
-.LAYOUT-CONTAINER .TDContainer {
- padding: 0px 2px;
-}
-
-
-.UIContainer .LAYOUT-BLOCK .UIRowContainer {
- min-height: 86px;
- _height: 86px;
-}
-
-.UIContainer .EditPortletPropertiesIcon {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- width: 20px; height: 20px;
- background: url('background/Pen.png') no-repeat top;
- margin: 4px 3px 2px 5px;
-}
-
-.UIContainer .DeletePortletIcon {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- width: 20px; height:20px;
- background: url('background/close.png') no-repeat bottom;
- margin: 4px 4px 2px 0px; /* orientation=lt */
- margin: 4px 0px 2px 4px; /* orientation=rt */
-}
-
-.UIContainer .NewLayer {
- background: #93c0e2;
- filter: alpha(opacity=40);
- opacity: 0.4;
- width: 100%; height: 100%;
-}
-
-/*
-.UIContainer .LAYOUT-CONTAINER {
- background: #f5f5f5;
- border: solid 1px #38acf3;
- padding: 5px;
- margin: 0px 1px;
- min-height: 60px;
-}
-
-* html .UIContainer .LAYOUT-CONTAINER {
- height: 60px;
-}
-
-.UIContainer .UIInfoBar .BlueRoundedStyle {
- padding: 0px; margin: 0px;
- height: 22px;
-}
-*/
-
-.UIContainer .CONTROL-CONTAINER .DragControlArea {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- width: 7px; height: 13px;
- background: url('background/DragBg2x2.gif');
- cursor: move;
- margin: 5px 0px 0px 2px; /* orientation=lt */
- margin: 5px 2px 0px 0px; /* orientation=rt */
-}
-
-.UIContainer .LAYOUT-CONTAINER .UITableColumnContainer {
- background: none;
- border: none;
- margin: auto;
-}
-
-.UIContainer .EditContainerIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 22px; height: 16px;
- background: url('background/Pen.gif') no-repeat top;
- margin: 4px 2px 0px 0px; /* orientation=lt */
- margin: 4px 0px 0px 2px; /* orientation=rt */
-}
-
-.UIContainer .DeleteContainerIcon {
- float: right; /* orientation=lt */
- float: left; /* orientation=rt */
- width: 22px; height: 16px;
- background: url('background/Close.gif') no-repeat bottom;
- margin: 4px 0px 0px 0px; /* orientation=lt */
- margin: 4px 0px 0px 0px; /* orientation=rt */
-}
-
-.UIContainer .ContainerIcon {
- float: left; /* orientation=lt */
- float: right; /* orientation=rt */
- height: 16px; line-height: 16px;
- padding-left: 24px; /* orientation=lt */
- padding-right: 24px; /* orientation=rt */
- margin: 3px 0px 0px 5px; /* orientation=lt */
- margin: 3px 5px 0px 0px; /* orientation=rt */
- background: url('background/DefaultContainerIcon.png') no-repeat;
-}
-
-.UIPortal .LAYOUT-PORTAL {
- /* background: url('background/PortalBackground4x4.gif');*/
- background: white;
- padding: 8px;
- _padding: 8px 0px; /* orientation=rt */
- margin: auto;
- _margin: 0px; /* orientation=rt */
- _width: 99%; /* orientation=rt */
-}
-
-.DragAndDropPreview {
- width: auto; height: 80px;
- background: url('background/DragAndDropPreview4x4.gif');
- border: 1px solid #c4c4c4;
- margin: 0px 12px 10px 12px;
-}
-
-.PortletBlockDecorator {
-
}
+/*############### End Decorator ###################################################*/
-.EdittingContainer {
- padding: 3px;
-}
-
-.EdittingContainer .NormalContainerBlock {
- background: white;
- border: 1px dashed #a2a2a2;
-}
-
-.EdittingContainer .NormalContainerBlock .LeftContainerBlock, .EdittingContainer .OverContainerBlock .NormalContainerBlock .LeftContainerBlock {
- background: none;
-}
-
-.EdittingContainer .NormalContainerBlock .RightContainerBlock, .EdittingContainer .OverContainerBlock .NormalContainerBlock .RightContainerBlock {
- padding: 2px;
- background: none;
-}
-
-.UIContainer .UIPortlet {
- padding: 0px;
+.LAYOUT-CONTAINER .UIContainer {
+ height: 100%;
+ /*
+ fix bug dragdrop in IE6
+ */
}
+.LAYOUT-CONTAINER .TDContainer {
+ padding: 0px 2px;
+}
+
+
+.UIContainer .LAYOUT-BLOCK .UIRowContainer {
+ min-height: 86px;
+ _height: 86px;
+}
+
+.UIContainer .EditPortletPropertiesIcon {
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ width: 20px; height: 20px;
+ background: url('background/Pen.png') no-repeat top;
+ margin: 2px 0px 0px 5px; /* orientation=lt */
+ margin: 2px 5px 0px 0px; /* orientation=rt */
+}
+
+.UIContainer .DeletePortletIcon {
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ width: 20px; height:20px;
+ background: url('background/close.png') no-repeat bottom;
+ margin: 1px 0px 0px 2px; /* orientation=lt */
+ margin: 1px 2px 0px 0px; /* orientation=rt */
+}
+
+.UIContainer .NewLayer {
+ background: #93c0e2;
+ filter: alpha(opacity=40);
+ opacity: 0.4;
+ width: 100%; height: 100%;
+}
+
+/*
+.UIContainer .LAYOUT-CONTAINER {
+ background: #f5f5f5;
+ border: solid 1px #38acf3;
+ padding: 5px;
+ margin: 0px 1px;
+ min-height: 60px;
+}
+
+* html .UIContainer .LAYOUT-CONTAINER {
+ height: 60px;
+}
+
+.UIContainer .UIInfoBar .BlueRoundedStyle {
+ padding: 0px; margin: 0px;
+ height: 22px;
+}
+*/
+
+.UIContainer .CONTROL-CONTAINER .DragControlArea {
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
+ width: 7px; height: 13px;
+ background: url('background/DragBg2x2.gif');
+ cursor: move;
+ margin: 5px 0px 0px 2px; /* orientation=lt */
+ margin: 5px 2px 0px 0px; /* orientation=rt */
+}
+
+.UIContainer .LAYOUT-CONTAINER .UITableColumnContainer {
+ background: none;
+ border: none;
+ margin: auto;
+}
+
+.UIContainer .EditContainerIcon {
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ width: 22px; height: 16px;
+ background: url('background/Pen.gif') no-repeat top;
+ margin: 4px 2px 0px 0px; /* orientation=lt */
+ margin: 4px 0px 0px 2px; /* orientation=rt */
+}
+
+.UIContainer .DeleteContainerIcon {
+ float: right; /* orientation=lt */
+ float: left; /* orientation=rt */
+ width: 22px; height: 16px;
+ background: url('background/Close.gif') no-repeat bottom;
+ margin: 4px 0px 0px 0px; /* orientation=lt */
+ margin: 4px 0px 0px 0px; /* orientation=rt */
+}
+
+.UIContainer .ContainerIcon {
+ float: left; /* orientation=lt */
+ float: right; /* orientation=rt */
+ height: 16px; line-height: 16px;
+ padding-left: 24px; /* orientation=lt */
+ padding-right: 24px; /* orientation=rt */
+ margin: 3px 0px 0px 5px; /* orientation=lt */
+ margin: 3px 5px 0px 0px; /* orientation=rt */
+ background: url('background/DefaultContainerIcon.png') no-repeat;
+}
+
+.UIPortal .LAYOUT-PORTAL {
+ /* background: url('background/PortalBackground4x4.gif');*/
+ background: white;
+ padding: 8px;
+ _padding: 8px 0px; /* orientation=rt */
+ margin: auto;
+ _margin: 0px; /* orientation=rt */
+ _width: 99%; /* orientation=rt */
+}
+
+.DragAndDropPreview {
+ width: auto; height: 80px;
+ background: url('background/DragAndDropPreview4x4.gif');
+ border: 1px solid #c4c4c4;
+ margin: 0px 12px 10px 12px;
+}
+
+.PortletBlockDecorator {
+
+}
+
+.EdittingContainer {
+ padding: 3px;
+}
+
+.EdittingContainer .NormalContainerBlock {
+ background: white;
+ border: 1px dashed #a2a2a2;
+}
+
+.EdittingContainer .NormalContainerBlock .LeftContainerBlock, .EdittingContainer .OverContainerBlock .NormalContainerBlock .LeftContainerBlock {
+ background: none;
+}
+
+.EdittingContainer .NormalContainerBlock .RightContainerBlock, .EdittingContainer .OverContainerBlock .NormalContainerBlock .RightContainerBlock {
+ padding: 2px;
+ background: none;
+}
+
+.UIContainer .UIPortlet {
+ padding: 0px;
+}
+
.UIPortletMask {
opacity: 0;
filter: alpha(opacity=0);
background: #ffffff;
-}
-
-.EdittingContainer .OverContainerBlock {
- border: 1px solid #b8babf;
+}
+
+.EdittingContainer .OverContainerBlock {
+ border: 1px solid #b8babf;
background: none;
- height: 100%;
-}
-
-.EdittingContainer .OverContainerBlock .LeftContainerBlock {
- background: white;
-}
-
-.EdittingContainer .OverContainerBlock .RightContainerBlock {
- background: none;
- padding: 2px;
+ height: 100%;
}
+.EdittingContainer .OverContainerBlock .LeftContainerBlock {
+ background: white;
+}
+
+.EdittingContainer .OverContainerBlock .RightContainerBlock {
+ background: none;
+ padding: 2px;
+}
+
.ProtectedContainer .ProtectedContent {
opacity: 0.3;
filter: alpha(opacity=80);
14 years, 8 months
gatein SVN: r2482 - in portal/branches/EPP_5_0_Branch: web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container and 4 other directories.
by do-not-reply@jboss.org
Author: mpodolin
Date: 2010-04-06 04:27:23 -0400 (Tue, 06 Apr 2010)
New Revision: 2482
Added:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java
Modified:
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
Log:
JBEPP-205: GTNPORTAL-421 ported to the branch
Modified: portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
--- portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2010-04-06 08:27:23 UTC (rev 2482)
@@ -52,17 +52,17 @@
var properties = ["top", eXo.core.I18n.isLT() ? "left" : "right", "zIndex", "opacity", "filter", "position"] ;
this.origDragObjectStyle.copyProperties(properties, dragObject.style) ;
- var isComponent = !!DOMUtil.findFirstDescendantByClass(dragObject, "div", "UIComponentBlock");
+ var isAddingNewly = !DOMUtil.findFirstDescendantByClass(dragObject, "div", "UIComponentBlock");
var uiWorkingWS = document.getElementById("UIWorkingWorkspace");
- PortalDragDrop.positionRootObj = isComponent ? uiWorkingWS :
+ PortalDragDrop.positionRootObj = !isAddingNewly ? uiWorkingWS :
DOMUtil.findFirstDescendantByClass(uiWorkingWS, "div", "UIPortalComposer");
var originalDragObjectTop = Browser.findPosYInContainer(dragObject, PortalDragDrop.positionRootObj);
var originalDragObjectLeft = Browser.findPosXInContainer(dragObject, PortalDragDrop.positionRootObj);
PortalDragDrop.deltaYDragObjectAndMouse = Browser.findMouseRelativeY(dragObject, e);
PortalDragDrop.deltaXDragObjectAndMouse = Browser.findMouseRelativeX(dragObject, e);
- if(!isComponent) {
+ if(isAddingNewly) {
var contentContainer = DOMUtil.findAncestorByClass(dragObject, "PopupContent");
originalDragObjectTop -= contentContainer.scrollTop;
PortalDragDrop.deltaYDragObjectAndMouse += contentContainer.scrollTop;
@@ -72,13 +72,15 @@
PortalDragDrop.backupDragObjectWidth = dragObject.offsetWidth ;
/*Case: dragObject out of UIPortal*/
- if(!isComponent) {
+
+ if(isAddingNewly) {
var cloneObject = dragObject.cloneNode(true) ;
dragObject.parentNode.insertBefore(cloneObject, dragObject) ;
cloneObject.style.opacity = 0.5 ;
cloneObject.style.filter = "alpha(opacity=50)" ;
cloneObject.style.width = PortalDragDrop.backupDragObjectWidth + "px" ;
dndEvent.dragObject = cloneObject ;
+ dndEvent.dragObject.isAddingNewly = isAddingNewly;
} else {
previewBlock = PortalDragDrop.createPreview();
dragObject.parentNode.insertBefore(previewBlock, dragObject);
@@ -90,8 +92,7 @@
if(newLayer) newLayer.style.width = "300px";
}
}
- dragObject.isComponent = isComponent;
-
+ dragObject.isAddingNewly = isAddingNewly;
dragObject = dndEvent.dragObject;
dragObject.style.position = "absolute" ;
if(eXo.core.I18n.isLT()) dragObject.style.left = originalDragObjectLeft + "px" ;
@@ -110,11 +111,11 @@
if(dndEvent.foundTargetObject.className == "UIPage") {
uiComponentLayout = DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject, "div", "VIEW-PAGE");
} else if(dndEvent.foundTargetObject.className == "UIPortal") {
- if(eXo.portal.portalMode%2) uiComponentLayout = DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject, "div", "LAYOUT-PORTAL") ;
+ if(eXo.portal.portalMode % 2) uiComponentLayout = DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject, "div", "LAYOUT-PORTAL") ;
else uiComponentLayout = DOMUtil.findFirstDescendantByClass(dndEvent.foundTargetObject, "div", "VIEW-PORTAL");
} else {
var foundUIComponent = new eXo.portal.UIPortalComponent(dndEvent.foundTargetObject) ;
- if(eXo.portal.portalMode%2) uiComponentLayout = foundUIComponent.getLayoutBlock() ;
+ if(eXo.portal.portalMode % 2) uiComponentLayout = foundUIComponent.getLayoutBlock() ;
else uiComponentLayout = foundUIComponent.getViewBlock();
uiComponentLayout.style.height = "auto";
}
@@ -178,10 +179,9 @@
dndEvent.foundTargetObject.foundIndex = insertPosition ;
/* Insert preview block */
- var tdBlock = document.createElement("td");
- tdBlock.id = tdBlock.className = "PreviewTDBlock";
- tdBlock.appendChild(previewBlock);
- previewTD = tdBlock;
+ previewTD = document.createElement("td");
+ previewTD.id = previewTD.className = "PreviewTDBlock";
+ previewTD.appendChild(previewBlock);
if(insertPosition >= 0) {
trContainer.insertBefore(previewTD, listComponent[insertPosition]) ;
} else {
@@ -199,12 +199,12 @@
if(dndEvent.dragObject.parentNode.nodeName.toLowerCase() == "td") {
dndEvent.dragObject.parentNode.style.width = "auto";
}
- if(!dndEvent.dragObject.isComponent) {
+ if(dndEvent.dragObject.isAddingNewly) {
dndEvent.dragObject.parentNode.removeChild(dndEvent.dragObject) ;
}
}
- if(dndEvent.dragObject.isComponent) {
+ if(!dndEvent.dragObject.isAddingNewly) {
var componentBlock = eXo.core.DOMUtil.findFirstDescendantByClass(dndEvent.dragObject, "div", "UIComponentBlock") ;
var editBlock = eXo.core.DOMUtil.findFirstChildByClass(componentBlock, "div", "EDITION-BLOCK");
if(editBlock) editBlock.style.display = "none";
@@ -229,12 +229,15 @@
var clickObject = this;
var componentBlock = DOMUtil.findAncestorByClass(clickObject, "UIComponentBlock") ;
+ //Check if it is dragging the object existing in the current layout or from the popup composer to add newly
if(componentBlock != null) {
var dragBlock = eXo.portal.UIPortal.findUIComponentOf(componentBlock) ;
DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject, dragBlock, e) ;
} else {
var dragBlock = DOMUtil.findAncestorByClass(clickObject, "DragObjectPortlet") ;
+ //TODO: Seems the dragBlock is always null
if(dragBlock) {
+ eXo.debug("The dragBlock is not null");
DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject, dragBlock, e) ;
} else {
DragDrop.init(eXo.portal.PortalDragDrop.findDropableTargets(dragBlock), clickObject, clickObject, e) ;
@@ -242,20 +245,25 @@
}
};
+/**
+ * Perform following works after dropping :
+ *
+ * 1. Remove the dragging object if any
+ * 2. Send an request to server side to update the changes
+ */
PortalDragDrop.prototype.doDropCallback = function(dndEvent) {
var srcElement = dndEvent.dragObject ;
var targetElement = dndEvent.foundTargetObject;
if(!targetElement) {
- if(!dndEvent.dragObject.isComponent) {
+ if(dndEvent.dragObject.isAddingNewly) {
dndEvent.dragObject.parentNode.removeChild(dndEvent.dragObject) ;
}
dndEvent.dragObject.style.width = "auto";
return;
}
- var newComponent = false;
- if(srcElement.isComponent && (targetElement.foundIndex != null)) {
+ if(!srcElement.isAddingNewly && (targetElement.foundIndex != null)) {
if(eXo.portal.PortalDragDrop.layoutTypeElementNode != null) {
eXo.portal.PortalDragDrop.divRowContainerAddChild(srcElement, targetElement, targetElement.foundIndex) ;
} else {
@@ -263,17 +271,16 @@
eXo.portal.PortalDragDrop.tableColumnContainerAddChild(srcElement, targetElement, targetElement.foundIndex) ;
}
}
-
- if(!dndEvent.dragObject.isComponent) {
- dndEvent.dragObject.parentNode.removeChild(dndEvent.dragObject) ;
- newComponent = true;
+
+ if(srcElement.isAddingNewly) {
+ eXo.core.DOMUtil.removeElement(srcElement) ;
}
var params = [
- {name: "srcID", value: (srcElement.id.replace(/^UIPortlet-/, "")).replace(/^UIContainer-/,"")},
+ {name: "srcID", value: (srcElement.id.replace(/^UIPortlet-/, ""))},
{name: "targetID", value: targetElement.id.replace(/^.*-/, "")},
{name: "insertPosition", value: targetElement.foundIndex},
- {name: "newComponent", value: newComponent}
+ {name: "isAddingNewly", value: srcElement.isAddingNewly}
] ;
try {
@@ -285,23 +292,28 @@
ajaxGet(eXo.env.server.createPortalURL("UIPortal", "MoveChild", true, params)) ;
};
-/* Find components in dropable target */
+/**
+ * Return an array of droppable target objects
+ *
+ * @param the dragging object
+ */
PortalDragDrop.prototype.findDropableTargets = function(dragBlock) {
var DOMUtil = eXo.core.DOMUtil;
var dropableTargets = new Array() ;
var uiWorkingWorkspace = document.getElementById("UIWorkingWorkspace") ;
- var uiPortal = DOMUtil.findFirstDescendantByClass(uiWorkingWorkspace, "div", "UIPortal") ;
var pagebody = document.getElementById("UIPageBody");
- var uiContainers = DOMUtil.findDescendantsByClass(uiWorkingWorkspace, "div", "UIContainer") ;
if(eXo.portal.portalMode && pagebody) {
+ var uiPortal = DOMUtil.findFirstDescendantByClass(uiWorkingWorkspace, "div", "UIPortal") ;
dropableTargets.push(uiPortal) ;
} else {
var uiPage = DOMUtil.findFirstDescendantByClass(uiWorkingWorkspace, "div", "UIPage") ;
if(uiPage) dropableTargets.push(uiPage) ;
}
+
+ var uiContainers = DOMUtil.findDescendantsByClass(uiWorkingWorkspace, "div", "UIContainer") ;
for(var i = 0; i < uiContainers.length; i++) {
- if (DOMUtil.hasAncestor(uiContainers[i], dragBlock)) continue;
+ if(DOMUtil.hasAncestor(uiContainers[i], dragBlock)) continue;
if(DOMUtil.hasClass(uiContainers[i], "ProtectedContainer")) continue;
dropableTargets.push(uiContainers[i]) ;
}
@@ -324,6 +336,12 @@
}
};
+/**
+ * Return a most suiable position among the <code>components</code> objects
+ * that the dragging object should be at
+ *
+ * @param layout {string} the layout type which is "row" or "column"
+ */
PortalDragDrop.prototype.findInsertPosition = function(components, dragObject, layout) {
if(layout == "row") {
for(var i = 0; i < components.length; i++) {
@@ -349,6 +367,9 @@
}
};
+/**
+ * Create a div block which show the preview block
+ */
PortalDragDrop.prototype.createPreview = function(layoutType) {
var previewBlock = document.createElement("div") ;
previewBlock.className = "DragAndDropPreview" ;
@@ -356,25 +377,38 @@
return previewBlock;
};
-PortalDragDrop.prototype.divRowContainerAddChild = function(insertBlock, targetElement, insertPosition) {
+/**
+ * Add the <code>srcElement</code> dragging object to a container.
+ * If the dragging object is a column then let remove it from the table column container
+ */
+PortalDragDrop.prototype.divRowContainerAddChild = function(srcElement, targetElement, insertPosition) {
var listComponent = eXo.core.DragDrop.dndEvent.foundTargetObject.listComponentInTarget ;
var uiRowContainer = eXo.core.DOMUtil.findFirstDescendantByClass(targetElement, "div", "UIRowContainer") ;
- insertBlock.style.width = "auto" ;
+ srcElement.style.width = "auto" ;
+ var parentNode = srcElement.parentNode;
if(insertPosition >= 0) {
- uiRowContainer.insertBefore(insertBlock, listComponent[insertPosition]) ;
+ uiRowContainer.insertBefore(srcElement, listComponent[insertPosition]) ;
} else {
- uiRowContainer.appendChild(insertBlock) ;
+ uiRowContainer.appendChild(srcElement) ;
}
+
+ if(parentNode.nodeName.toLowerCase() == "td") {
+ eXo.core.DOMUtil.removeElement(parentNode) ;
+ }
};
-PortalDragDrop.prototype.tableColumnContainerAddChild = function(insertBlock, targetElement, insertPosition) {
+/**
+ * Add the <code>srcElement</code> to be a column of the <code>targetElement</code> table column container
+ * at the position <code>insertPosition</code>
+ */
+PortalDragDrop.prototype.tableColumnContainerAddChild = function(srcElement, targetElement, insertPosition) {
var listComponent = eXo.core.DragDrop.dndEvent.foundTargetObject.listComponentInTarget ;
var DOMUtil = eXo.core.DOMUtil ;
var trContainer = DOMUtil.findFirstDescendantByClass(targetElement, "tr", "TRContainer") ;
var tdInserted = document.createElement('td') ;
- tdInserted.appendChild(insertBlock) ;
+ tdInserted.appendChild(srcElement) ;
if(insertPosition >= 0) {
trContainer.insertBefore(tdInserted, listComponent[insertPosition]) ;
@@ -382,7 +416,7 @@
trContainer.appendChild(tdInserted) ;
}
- insertBlock.style.width = "auto" ;
+ srcElement.style.width = "auto" ;
if(eXo.portal.PortalDragDrop.parentDragObject.nodeName.toLowerCase() == "td") {
DOMUtil.removeElement(eXo.portal.PortalDragDrop.parentDragObject) ;
Modified: portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
===================================================================
--- portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2010-04-06 08:27:23 UTC (rev 2482)
@@ -421,6 +421,10 @@
}
} ;
+/**
+ * Return the closest container of the element.
+ * It might be one of these : UIPortlet, UIContainer, UIPageBody, UIPortal
+ */
UIPortal.prototype.findUIComponentOf = function(element) {
var DOMUtil = eXo.core.DOMUtil;
var parent = element.parentNode ;
@@ -503,7 +507,11 @@
UIPortal.prototype.removeComponent = function(componentId) {
var comp = document.getElementById(componentId);
var viewPage = eXo.core.DOMUtil.findAncestorByClass(comp, "VIEW-PAGE");
- eXo.core.DOMUtil.removeElement(comp);
+
+ //Check if the removing component is a column
+ if (comp.parentNode.nodeName.toUpperCase() == "TD") eXo.core.DOMUtil.removeElement(comp.parentNode);
+ else eXo.core.DOMUtil.removeElement(comp);
+
if(viewPage && eXo.portal.UIPortal.getUIContainers().length == 0
&& eXo.portal.UIPortal.getUIPortlets().length == 0) {
viewPage.style.paddingTop = "50px" ;
Modified: portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy
===================================================================
--- portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/container/ContainerConfigOption.groovy 2010-04-06 08:27:23 UTC (rev 2482)
@@ -45,17 +45,20 @@
SelectItemCategory column = new SelectItemCategory("column") ;
column.addSelectItemOption(new SelectItemOption("oneColumns","" +
"<container template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
"</container>",
"OneRowContainerLayout")) ;
column.addSelectItemOption(new SelectItemOption("twoColumns",
"<container template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
"</container>",
"TwoColumnContainerLayout")) ;
column.addSelectItemOption(new SelectItemOption("threeColumns",
"<container template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
@@ -63,6 +66,7 @@
"ThreeColumnContainerLayout")) ;
column.addSelectItemOption(new SelectItemOption("threeToolbarColumns",
"<container template=\"system:/groovy/portal/webui/container/UIToolbarContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container id=\"StarToolBarPortelt\" template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container id=\"UserToolBarPortelt\" template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container id=\"AdminToolBarPortelt\" template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
@@ -73,17 +77,20 @@
SelectItemCategory autofitColumn = new SelectItemCategory("autofitColumn") ;
autofitColumn.addSelectItemOption(new SelectItemOption("autofitOneColumns","" +
"<container template=\"system:/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
"</container>",
"OneRowContainerLayout")) ;
autofitColumn.addSelectItemOption(new SelectItemOption("autofitTwoColumns",
"<container template=\"system:/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
"</container>",
"TwoColumnContainerLayout")) ;
autofitColumn.addSelectItemOption(new SelectItemOption("autofitThreeColumns",
"<container template=\"system:/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
@@ -127,6 +134,7 @@
"<container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\">" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" </container>" +
@@ -136,6 +144,7 @@
"<container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\">" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl\">" +
+ " <factory-id>TableColumnContainer</factory-id>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" <container template=\"system:/groovy/portal/webui/container/UIContainer.gtmpl\"></container>" +
" </container>" +
Modified: portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl
===================================================================
--- portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIContainer.gtmpl 2010-04-06 08:27:23 UTC (rev 2482)
@@ -26,7 +26,7 @@
%>
<div class="UIContainer <%=uiPortalApp.isEditing()?"EdittingContainer":""%> <%=hasPermission?"": "ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}" ${cssStyle}
+ id="${uicomponent.id}" ${cssStyle}
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -41,13 +41,13 @@
<%} else {%>
<div class="VIEW-CONTAINER VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
- <%if(hasPermission) {%>
+ <%if(hasPermission) {%>
<div class="UIRowContainer">
+ <div>
<%uicomponent.renderChildren();%>
+ </div>
</div>
<%} else out.print("<div class='ProtectedContent'>"+_ctx.appRes("UIPortlet.label.protectedContent")+"</div>");%>
- </div>
</div>
<%if(portalMode != UIPortalApplication.NORMAL_MODE){%>
@@ -72,8 +72,8 @@
%>
<div class="ContainerIcon"><%=hasPermission ? strTitle : _ctx.appRes("UIPortlet.label.protectedContent")%></div>
<%if(hasPermission) {%>
- <a href="<%=uicomponent.event("DeleteComponent","$uicomponent.id")%>" class="DeleteContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
- <a href="<%=uicomponent.event("EditContainer","$uicomponent.id")%>;eXo.portal.UIPortal.changeComposerSaveButton()" class="EditContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
+ <a href="<%=uicomponent.event("DeleteComponent")%>" class="DeleteContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.closeContainer")%>"><span></span></a>
+ <a href="<%=uicomponent.event("EditContainer")%>;eXo.portal.UIPortal.changeComposerSaveButton()" class="EditContainerIcon" title="<%=_ctx.appRes("UIContainer.tooltip.editContainer")%>"><span></span></a>
<%}%>
<div class="ClearBoth"><span></span></div>
</div>
Modified: portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl
===================================================================
--- portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITabContainer.gtmpl 2010-04-06 08:27:23 UTC (rev 2482)
@@ -36,7 +36,7 @@
String id = uicomponent.getId();
%>
<% if(children != null && children.size() > 0) { %>
-<div class="UITabContainer">
+<div class="UITabContainer" id="$id">
<div class="UIHorizontalTabs">
<div class="LeftHorizontalTabs">
<div class="RightHorizontalTabs">
Modified: portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl
===================================================================
--- portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableAutofitColumnContainer.gtmpl 2010-04-06 08:27:23 UTC (rev 2482)
@@ -17,7 +17,7 @@
%>
<div class="UIContainer <%=uiPortalApp.isEditing()?"EdittingContainer":""%> <%=hasPermission?"":"ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}"
+ id="${uicomponent.id}"
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -37,7 +37,7 @@
<%} else {%>
<div class="VIEW-CONTAINER VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
+ <div>
<%if(hasPermission) {%>
<table class="UITableColumnContainer" style="margin: 0px auto; $style">
<tr class="TRContainer">
Modified: portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl
===================================================================
--- portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UITableColumnContainer.gtmpl 2010-04-06 08:27:23 UTC (rev 2482)
@@ -17,7 +17,7 @@
%>
<div class="UIContainer <%=uiPortalApp.isEditing()?"EdittingContainer":""%> <%=hasPermission?"":"ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}"
+ id="${uicomponent.id}"
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -37,7 +37,7 @@
<%} else {%>
<div class="VIEW-CONTAINER VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
+ <div>
<%if(hasPermission) {%>
<table class="UITableColumnContainer" style="table-layout: fixed; margin: 0px auto; $style">
<tr class="TRContainer">
Modified: portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl
===================================================================
--- portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/web/portal/src/main/webapp/groovy/portal/webui/container/UIToolbarContainer.gtmpl 2010-04-06 08:27:23 UTC (rev 2482)
@@ -13,7 +13,7 @@
%>
<div class="UIContainer UIToolbarContainer <%=uiPortalApp.isEditing()?"EdittingContainer":""%> <%=hasPermission?"": "ProtectedContainer"%>"
- id="UIContainer-${uicomponent.id}"
+ id="${uicomponent.id}"
onmouseover="eXo.portal.UIPortal.blockOnMouseOver(event, this, true);"
onmouseout="eXo.portal.UIPortal.blockOnMouseOver(event, this, false);">
<div class="NormalContainerBlock">
@@ -33,7 +33,7 @@
<%} else {%>
<div class="VIEW-CONTAINER ToolbarContainer VIEW-BLOCK">
<%} %>
- <div id="$uicomponent.id">
+ <div>
<%if(hasPermission) {%>
<div class="UITableColumnContainer" style="margin: 0px auto; $style">
<div class="TRContainer" style="zoom: 100%;">
Modified: portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java
===================================================================
--- portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainer.java 2010-04-06 08:27:23 UTC (rev 2482)
@@ -19,30 +19,19 @@
package org.exoplatform.portal.webui.container;
-import org.exoplatform.portal.webui.container.UIContainerActionListener.EditContainerActionListener;
import org.exoplatform.portal.webui.portal.UIPortalComponent;
import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.DeleteComponentActionListener;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-import java.util.List;
-
/**
* May 19, 2006
*/
-@ComponentConfigs({
- @ComponentConfig(events = {@EventConfig(listeners = UIContainerActionListener.EditContainerActionListener.class),
- @EventConfig(listeners = DeleteComponentActionListener.class, confirm = "UIContainer.deleteContainer")}),
- @ComponentConfig(id = "TabContainer", template = "system:/groovy/portal/webui/container/UITabContainer.gtmpl", events = {
- @EventConfig(listeners = EditContainerActionListener.class),
- @EventConfig(listeners = DeleteComponentActionListener.class, confirm = "UIContainer.deleteContainer"),
- @EventConfig(listeners = UIContainer.SelectTabActionListener.class)})})
+@ComponentConfig(events = {@EventConfig(listeners = UIContainerActionListener.EditContainerActionListener.class),
+ @EventConfig(listeners = DeleteComponentActionListener.class, confirm = "UIContainer.deleteContainer")})
public class UIContainer extends UIPortalComponent
{
+ public static final String TABLE_COLUMN_CONTAINER = "TableColumnContainer";
/** Storage id. */
private String storageId;
@@ -84,29 +73,4 @@
{
this.description = desc;
}
-
- static public class SelectTabActionListener extends EventListener<UIContainer>
- {
- public void execute(Event<UIContainer> event) throws Exception
- {
- String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
- UIContainer container = event.getSource();
- UIComponent goal = container.findComponentById(objectId);
- if (goal == null)
- {
- return;
- }
- UIContainer parent = goal.getParent();
- List<UIComponent> children = parent.getChildren();
- for (UIComponent child : children)
- {
- if (child.getId().equals(objectId))
- {
- child.setRendered(true);
- continue;
- }
- child.setRendered(false);
- }
- }
- }
}
Modified: portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java
===================================================================
--- portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerActionListener.java 2010-04-06 08:27:23 UTC (rev 2482)
@@ -23,7 +23,6 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -40,29 +39,14 @@
{
UIContainer uiContainer = event.getSource();
- String id = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
-
UIPortal uiPortal = Util.getUIPortal();
UIPortalApplication uiApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
UIContainerForm containerForm = uiMaskWS.createUIComponent(UIContainerForm.class, null, null);
- if (uiContainer.getId().equals(id))
- {
- containerForm.setValues(uiContainer);
- }
- else
- {
- if (uiContainer.getChildById(id) != null)
- {
- containerForm.setValues((UIContainer)uiContainer.getChildById(id));
- }
- else
- return;
- }
+ containerForm.setValues(uiContainer);
uiMaskWS.setUIComponent(containerForm);
uiMaskWS.setShow(true);
event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
- // Util.updateUIApplication(event);
}
}
}
Added: portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java
===================================================================
--- portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java (rev 0)
+++ portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UITabContainer.java 2010-04-06 08:27:23 UTC (rev 2482)
@@ -0,0 +1,72 @@
+/**
+ * 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.webui.container;
+
+import org.exoplatform.portal.webui.container.UIContainerActionListener.EditContainerActionListener;
+import org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.DeleteComponentActionListener;
+import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
+
+import java.util.List;
+
+/**
+ * May 19, 2006
+ */
+@ComponentConfig(template = "system:/groovy/portal/webui/container/UITabContainer.gtmpl", events = {
+ @EventConfig(listeners = EditContainerActionListener.class),
+ @EventConfig(listeners = DeleteComponentActionListener.class, confirm = "UIContainer.deleteContainer"),
+ @EventConfig(listeners = UITabContainer.SelectTabActionListener.class)})
+public class UITabContainer extends UIContainer
+{
+ public static final String TAB_CONTAINER = "TabContainer";
+
+ public UITabContainer()
+ {
+ super();
+ }
+
+ static public class SelectTabActionListener extends EventListener<UITabContainer>
+ {
+ public void execute(Event<UITabContainer> event) throws Exception
+ {
+ String objectId = event.getRequestContext().getRequestParameter(OBJECTID);
+ UITabContainer container = event.getSource();
+ UIComponent goal = container.findComponentById(objectId);
+ if (goal == null)
+ {
+ return;
+ }
+ UITabContainer parent = goal.getParent();
+ List<UIComponent> children = parent.getChildren();
+ for (UIComponent child : children)
+ {
+ if (child.getId().equals(objectId))
+ {
+ child.setRendered(true);
+ continue;
+ }
+ child.setRendered(false);
+ }
+ }
+ }
+}
Modified: portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
--- portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2010-04-06 08:27:23 UTC (rev 2482)
@@ -21,7 +21,6 @@
import org.exoplatform.portal.account.UIAccountSetting;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
Modified: portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
--- portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2010-04-06 08:27:23 UTC (rev 2482)
@@ -19,8 +19,6 @@
package org.exoplatform.portal.webui.portal;
-import java.util.List;
-
import org.exoplatform.application.registry.Application;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.UserACL;
@@ -34,6 +32,7 @@
import org.exoplatform.portal.webui.application.UIApplicationList;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainerList;
+import org.exoplatform.portal.webui.container.UITabContainer;
import org.exoplatform.portal.webui.login.UILogin;
import org.exoplatform.portal.webui.login.UIResetPassword;
import org.exoplatform.portal.webui.page.UIPage;
@@ -58,10 +57,13 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import java.util.List;
+
/** Author : Nhu Dinh Thuan nhudinhthuan(a)yahoo.com Jun 14, 2006 */
public class UIPortalComponentActionListener
{
-
+ private final static String UI_PORTLET_PREFIX = "UIPortlet-";
+
static public class ViewChildActionListener extends EventListener<UIContainer>
{
public void execute(Event<UIContainer> event) throws Exception
@@ -88,29 +90,22 @@
static public class DeleteComponentActionListener extends EventListener<UIComponent>
{
- private final static String UI_CONTAINER_PREFIX = "UIContainer-";
-
- private final static String UI_PORTLET_PREFIX = "UIPortlet-";
-
public void execute(Event<UIComponent> event) throws Exception
{
- String id = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- UIComponent uiComponent = event.getSource();
- UIPortalComponent uiParent = (UIPortalComponent)uiComponent.getParent();
- UIComponent uiRemoveComponent = uiParent.findComponentById(id);
+ UIComponent uiComponentTobeRemoved = event.getSource();
+ String id = uiComponentTobeRemoved.getId();
UIPortalApplication uiApp = Util.getUIPortalApplication();
- if (uiRemoveComponent.findFirstComponentOfType(UIPageBody.class) != null)
+ if (uiComponentTobeRemoved.findFirstComponentOfType(UIPageBody.class) != null)
{
uiApp.addMessage(new ApplicationMessage("UIPortalApplication.msg.deletePageBody", new Object[]{},
ApplicationMessage.WARNING));
return;
}
- uiParent.removeChildById(id);
UIPortalComposer portalComposer = uiApp.findFirstComponentOfType(UIPortalComposer.class);
portalComposer.setEditted(true);
- UIPage uiPage = uiParent.getAncestorOfType(UIPage.class);
+ UIPage uiPage = uiComponentTobeRemoved.getAncestorOfType(UIPage.class);
if (uiPage != null && uiPage.getMaximizedUIPortlet() != null)
{
if (id.equals(uiPage.getMaximizedUIPortlet().getId()))
@@ -140,128 +135,66 @@
}
}
}
- Util.showComponentLayoutMode(uiRemoveComponent.getClass());
+ Util.showComponentLayoutMode(uiComponentTobeRemoved.getClass());
PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
- // Case1: current component is a portlet
- if (uiComponent instanceof UIPortlet)
+ org.exoplatform.portal.webui.container.UIContainer uiParent = uiComponentTobeRemoved.getParent();
+ if (UITabContainer.TAB_CONTAINER.equals(uiParent.getFactoryId()))
{
- removeComponent(id, UI_PORTLET_PREFIX, pcontext);
- return;
- }
-
- // Case 2: current component is a container
- if (uiComponent instanceof org.exoplatform.portal.webui.container.UIContainer)
- {
- org.exoplatform.portal.webui.container.UIContainer topAncestor =
- getTopBlockContainer((org.exoplatform.portal.webui.container.UIContainer)uiParent);
-
- /**
- * topAncestor is null if the uiParent is either UIPortal or UIPage,
- * that happens when our container is a simple container
+ /*
+ * Check if it is removing the last tab then we will remove the TabContainer as well
+ *
+ * Indeed, a TabContainer is nested into a normal container so
+ * we should remove the its parent instead of itself when we delete the last tab
*/
- if (topAncestor == null)
+ if (uiParent.getChildren().size() == 1)
{
- removeComponent(id, UI_CONTAINER_PREFIX, pcontext);
- return;
+ uiComponentTobeRemoved = uiParent.getParent();
}
- /** Case of nested container like tab container, mixed container */
else
{
- String topAncestorId = topAncestor.getId();
-
- /** If the topAncestor has no child, then it is removed */
- if (topAncestor.getChildren().size() == 0)
- {
- /** Update server-side */
- UIContainer parentOfTopAncestor = topAncestor.getParent();
- parentOfTopAncestor.removeChildById(topAncestorId);
-
- /** Update client side */
- if (topAncestorId.startsWith(UI_CONTAINER_PREFIX))
- {
- topAncestorId = topAncestorId.substring(UI_CONTAINER_PREFIX.length());
- topAncestor.setId(topAncestorId);
- }
- removeComponent(topAncestorId, UI_CONTAINER_PREFIX, pcontext);
- return;
- }
-
- /**
- * If the uiParent is not the topAncestor and having no child,
- * then it is removed
- */
- if (uiParent.getChildren().size() == 0)
- {
- /** Update server-side */
- UIContainer itsParent = uiParent.getParent();
- itsParent.removeChildById(uiParent.getId());
- }
-
- /**
- * Update the topAncestor by Ajax
- */
- if (!topAncestorId.startsWith(UI_CONTAINER_PREFIX))
- {
- topAncestor.setId(UI_CONTAINER_PREFIX + topAncestorId);
- }
- pcontext.addUIComponentToUpdateByAjax(topAncestor);
+ removeUIComponent(uiComponentTobeRemoved, pcontext, true);
return;
}
}
-
+ else if (org.exoplatform.portal.webui.container.UIContainer.TABLE_COLUMN_CONTAINER.equals(uiParent.getFactoryId()))
+ {
+ if (uiParent.getChildren().size() == 1)
+ {
+ uiComponentTobeRemoved = uiParent;
+ }
+ }
+
+ removeUIComponent(uiComponentTobeRemoved, pcontext, false);
}
- /** Add Javascript script to remove component */
- private void removeComponent(String componentId, String componentType, PortalRequestContext pcontext)
- {
- String scriptRemovingComponent = scriptRemovingComponent(componentId, componentType);
- JavascriptManager jsManager = pcontext.getJavascriptManager();
- jsManager.addJavascript(scriptRemovingComponent);
- jsManager.addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
- }
-
- private String scriptRemovingComponent(String componentId, String prefix)
- {
+ }
+
+ /**
+ * Remove an UIComponent from server side and
+ * adding removing behaviors in javascript to clients if necessary
+ */
+ private static void removeUIComponent(UIComponent uiComponent, PortalRequestContext pcontext, boolean isUpdate)
+ {
+ UIContainer uiParent = uiComponent.getParent();
+ uiParent.getChildren().remove(uiComponent);
+
+ JavascriptManager jsManager = pcontext.getJavascriptManager();
+ if(isUpdate) {
+ pcontext.addUIComponentToUpdateByAjax(uiParent);
+ } else {
StringBuffer buffer = new StringBuffer();
buffer.append("eXo.portal.UIPortal.removeComponent('");
- buffer.append(prefix);
- buffer.append(componentId);
- buffer.append("');");
- return buffer.toString();
- }
-
- /**
- * Returns the top ancestor( of type
- * org.exoplatform.portal.webui.container.UIContainer but not of type
- * UIPortal or UIPage) of a given container
- */
- private static org.exoplatform.portal.webui.container.UIContainer getTopBlockContainer(
- org.exoplatform.portal.webui.container.UIContainer container)
- {
- if (container instanceof UIPortal || container instanceof UIPage)
+ if (uiComponent instanceof UIPortlet)
{
- return null;
+ buffer.append(UI_PORTLET_PREFIX);
}
- org.exoplatform.portal.webui.container.UIContainer topAncestor = container;
- org.exoplatform.portal.webui.container.UIContainer intermediateCont;
- try
- {
- intermediateCont = topAncestor.getParent();
- while (intermediateCont != null && !(intermediateCont instanceof UIPortal)
- && !(intermediateCont instanceof UIPage))
- {
- topAncestor = intermediateCont;
- intermediateCont = topAncestor.getParent();
- }
- }
- catch (ClassCastException ex)
- {
-
- }
- return topAncestor;
+ buffer.append(uiComponent.getId());
+ buffer.append("');");
+ jsManager.addJavascript(buffer.toString());
}
+ jsManager.addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
}
static public class MoveChildActionListener extends EventListener<UIContainer>
@@ -281,7 +214,7 @@
}
boolean newComponent = false;
- String paramNewComponent = pcontext.getRequestParameter("newComponent");
+ String paramNewComponent = pcontext.getRequestParameter("isAddingNewly");
if (paramNewComponent != null)
newComponent = Boolean.valueOf(paramNewComponent).booleanValue();
@@ -401,7 +334,7 @@
return;
}
- UIContainer uiParent = uiSource.getParent();
+ org.exoplatform.portal.webui.container.UIContainer uiParent = uiSource.getParent();
if (uiParent == uiTarget)
{
int currentIdx = uiTarget.getChildren().indexOf(uiSource);
@@ -420,9 +353,31 @@
uiTarget.getChildren().add(position, uiSource);
return;
}
- uiParent.getChildren().remove(uiSource);
+
uiTarget.getChildren().add(position, uiSource);
uiSource.setParent(uiTarget);
+
+ if (UITabContainer.TAB_CONTAINER.equals(uiParent.getFactoryId()))
+ {
+ if (uiParent.getChildren().size() == 1)
+ {
+ removeUIComponent(uiParent.getParent(), pcontext, false);
+ }
+ else
+ {
+ uiParent.getChildren().remove(uiSource);
+ pcontext.addUIComponentToUpdateByAjax(uiParent);
+ }
+ }
+ else if (org.exoplatform.portal.webui.container.UIContainer.TABLE_COLUMN_CONTAINER.equals(uiParent
+ .getFactoryId()) && uiParent.getChildren().size() == 1)
+ {
+ removeUIComponent(uiParent, pcontext, false);
+ }
+ else
+ {
+ uiParent.getChildren().remove(uiSource);
+ }
}
}
@@ -454,12 +409,12 @@
if (token == null)
{
WebuiRequestContext requestContext = event.getRequestContext();
- requestContext.getUIApplication().addMessage(
- new ApplicationMessage("UIForgetPassword.msg.expration", null));
+ requestContext.getUIApplication()
+ .addMessage(new ApplicationMessage("UIForgetPassword.msg.expration", null));
requestContext.addUIComponentToUpdateByAjax(uiPortal.getParent());
return;
}
-
+
UIPortalApplication uiApp = uiPortal.getAncestorOfType(UIPortalApplication.class);
UIMaskWorkspace uiMaskWS = uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
Modified: portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
--- portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2010-04-06 08:25:18 UTC (rev 2481)
+++ portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2010-04-06 08:27:23 UTC (rev 2482)
@@ -34,6 +34,7 @@
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
+import org.exoplatform.portal.webui.container.UITabContainer;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.page.UISiteBody;
@@ -406,8 +407,16 @@
else if (model instanceof Container)
{
Container container = (Container)model;
- UIContainer uiTempContainer =
- uiContainer.createUIComponent(context, UIContainer.class, container.getFactoryId(), null);
+ UIContainer uiTempContainer ;
+ if(UITabContainer.TAB_CONTAINER.equals(container.getFactoryId()))
+ {
+ uiTempContainer = uiContainer.createUIComponent(context, UITabContainer.class, null, null);
+ }
+ else
+ {
+ uiTempContainer = uiContainer.createUIComponent(context, UIContainer.class, null, null);
+ }
+
toUIContainer(uiTempContainer, (Container)model, dashboard);
uiComponent = uiTempContainer;
}
14 years, 8 months
gatein SVN: r2481 - portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources.
by do-not-reply@jboss.org
Author: mstruk
Date: 2010-04-06 04:25:18 -0400 (Tue, 06 Apr 2010)
New Revision: 2481
Modified:
portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java
Log:
GTNPORTAL-638 Magic locale caused exceptions. Fixed.
Modified: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java 2010-04-06 08:11:53 UTC (rev 2480)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java 2010-04-06 08:25:18 UTC (rev 2481)
@@ -55,4 +55,10 @@
{
return EMPTY_KEYS.elements();
}
+
+ @Override
+ public Locale getLocale()
+ {
+ return MAGIC_LOCALE;
+ }
}
14 years, 8 months
gatein SVN: r2480 - portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page.
by do-not-reply@jboss.org
Author: mpodolin
Date: 2010-04-06 04:11:53 -0400 (Tue, 06 Apr 2010)
New Revision: 2480
Modified:
portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
Log:
JBEPP-214: GTNPORTAL-575 ported to the branch
Modified: portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
--- portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-04-06 03:56:06 UTC (rev 2479)
+++ portal/branches/EPP_5_0_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-04-06 08:11:53 UTC (rev 2480)
@@ -342,12 +342,13 @@
//That happens when user browses to a URL like /portal/public/classic
if(pathNodes.length == 0)
{
- nodes.add(nav.getNodes().get(0));
+ nodes.add(getDefaultNode(nav));
return nodes;
}
PageNode startNode = nav.getNode(pathNodes[0]);
if (startNode == null)
{
+ nodes.add(getDefaultNode(nav));
return nodes;
}
nodes.add(startNode);
14 years, 8 months
gatein SVN: r2479 - in portal/trunk: portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin and 1 other directories.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2010-04-05 23:56:06 -0400 (Mon, 05 Apr 2010)
New Revision: 2479
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java
Log:
GTNPORTAL-1018
-Gadget's name is unique and add a name field
-Remove bindexpression argument in some validator because it's unused in some case. For instance, in MandatoryValidator, message EmptyFieldValidator.msg.empty-input only use 1 argument
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -42,7 +42,10 @@
import org.exoplatform.webui.exception.MessageException;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
+import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.UIFormTextAreaInput;
+import org.exoplatform.webui.form.validator.ExpressionValidator;
+import org.exoplatform.webui.form.validator.IdentifierValidator;
import org.exoplatform.webui.form.validator.MandatoryValidator;
import org.exoplatform.webui.form.validator.Validator;
@@ -61,19 +64,24 @@
{
final static public String FIELD_SOURCE = "source";
+ final static public String FIELD_NAME = "name";
private Source source_;
private String fullName_;
private String dirPath;
+
+ private String gadgetName_;
public UIGadgetEditor(InitParams initParams) throws Exception
{
Param param = initParams.getParam("SampleGadget");
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
String sample = (String)param.getMapGroovyObject(context);
- addUIFormInput(new UIFormTextAreaInput(FIELD_SOURCE, null, sample).addValidator(MandatoryValidator.class)
+ addUIFormInput(new UIFormStringInput(FIELD_NAME, null, null).addValidator(MandatoryValidator.class).addValidator(ExpressionValidator.class, "^[\\p{L}][\\p{ASCII}]+$",
+ "UIGadgetEditor.msg.Invalid"));
+ addUIFormInput(new UIFormTextAreaInput(FIELD_SOURCE, FIELD_SOURCE, sample).addValidator(MandatoryValidator.class)
.addValidator(GadgetSpecValidator.class));
}
@@ -89,6 +97,11 @@
UIFormTextAreaInput uiInputSource = getUIFormTextAreaInput(FIELD_SOURCE);
uiInputSource.setValue(source_.getTextContent());
}
+
+ public void setGadgetName(String name) {
+ UIFormStringInput uiInputName = getUIStringInput(FIELD_NAME);
+ uiInputName.setValue(name);
+ }
public String getSourceFullName()
{
@@ -103,8 +116,13 @@
public void processRender(WebuiRequestContext context) throws Exception
{
UIFormTextAreaInput uiInputSource = getUIFormTextAreaInput(FIELD_SOURCE);
+ UIFormStringInput uiInputName = getUIStringInput(FIELD_NAME);
String encoded = StringEscapeUtils.escapeHtml(StringEscapeUtils.unescapeHtml(uiInputSource.getValue()));
uiInputSource.setValue(encoded);
+ if(this.isEdit()) {
+ uiInputName.setEditable(false);
+ }
+
super.processRender(context);
}
@@ -137,56 +155,57 @@
{
UIGadgetEditor uiForm = event.getSource();
UIGadgetManagement uiManagement = uiForm.getParent();
- String name, fileName, dirPath;
+ String gadgetName;
String text = uiForm.getUIFormTextAreaInput(UIGadgetEditor.FIELD_SOURCE).getValue();
GadgetRegistryService service = uiForm.getApplicationComponent(GadgetRegistryService.class);
SourceStorage sourceStorage = uiForm.getApplicationComponent(SourceStorage.class);
- boolean isEdit = uiForm.getSource() != null;
+ boolean isEdit = uiForm.isEdit();
if (isEdit)
{
- fileName = uiForm.getSourceFullName();
- name = uiForm.getSourceName();
- dirPath = uiForm.getDirPath();
+ gadgetName = uiForm.getSourceFullName();
}
else
{
- name = "gadget" + Calendar.getInstance().hashCode();
- fileName = name + ".xml";
- dirPath = name;
+ gadgetName = uiForm.getUIStringInput(UIGadgetEditor.FIELD_NAME).getValue();
}
//
- Gadget gadget = service.getGadget(name);
- if (isEdit)
- {
- if (gadget == null)
- {
- UIApplication uiApp = event.getRequestContext().getUIApplication();
- uiApp.addMessage(new ApplicationMessage("gadget.msg.changeNotExist", null));
- uiManagement.reload();
- return;
- }
+ Gadget gadget = service.getGadget(gadgetName);
+
+ if(isEdit) {
+ if (gadget == null)
+ {
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+ uiApp.addMessage(new ApplicationMessage("gadget.msg.changeNotExist", null, ApplicationMessage.WARNING));
+ uiManagement.reload();
+ return;
+ }
}
+ else {
+ // If gadget is null we need to create it first
+ if (gadget == null)
+ {
+ gadget = new Gadget();
+ gadget.setName(gadgetName);
- // If gadget is null we need to create it first
- if (gadget == null)
- {
- gadget = new Gadget();
- gadget.setName("CHANGME");
+ // Those data will be taken from the gadget XML anyway
+ gadget.setDescription("");
+ gadget.setThumbnail("");
+ gadget.setLocal(true);
+ gadget.setTitle("");
+ gadget.setReferenceUrl("");
- // Those data will be taken from the gadget XML anyway
- gadget.setDescription("");
- gadget.setThumbnail("");
- gadget.setLocal(true);
- gadget.setTitle("");
- gadget.setReferenceUrl("");
-
- // Save gadget with empty data first
- service.saveGadget(gadget);
+ // Save gadget with empty data first
+ service.saveGadget(gadget);
+ }
+ else {
+ UIApplication uiApp = event.getRequestContext().getUIApplication();
+ uiApp.addMessage(new ApplicationMessage("UIGadgetEditor.gadget.msg.gadgetIsExist", null, ApplicationMessage.WARNING));
+ return;
+ }
}
-
//
- Source source = new Source(fileName, "application/xml");
+ Source source = new Source(gadgetName, "application/xml");
source.setTextContent(text);
source.setLastModified(Calendar.getInstance());
@@ -202,6 +221,10 @@
}
}
+
+ private boolean isEdit() {
+ return (this.getSource() != null);
+ }
public static class CancelActionListener extends EventListener<UIGadgetEditor>
{
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetInfo.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -160,6 +160,7 @@
// get gadget's source: path = dir path + file name
Source source = sourceStorage.getSource(gadget);
uiEditor.setSource(source);
+ uiEditor.setGadgetName(gadget.getName());
uiEditor.setDirPath(dirPath);
uiManagement.getChildren().clear();
uiManagement.addChild(uiEditor);
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties 2010-04-06 03:56:06 UTC (rev 2479)
@@ -139,10 +139,13 @@
UIAddGadget.label.urlError=Data in url: '{0}' is not valid
## org.exoplatform.applicationregistry.webui.component.UIGadgetEditor
-UIGadgetEditor.label.source=Source:
+UIGadgetEditor.label.source=Source:
+UIGadgetEditor.label.name=Name:
UIGadgetEditor.action.Save=#{word.save}
UIGadgetEditor.action.Cancel=#{word.cancel}
UIGadgetEditor.msg.invalidSpec=This source is invalid gadget specification.
+UIGadgetEditor.gadget.msg.gadgetIsExist=This name already exists, please enter a different name.
+UIGadgetEditor.msg.Invalid=The "{0}" field must not contains special characters.
##package org.exoplatform.organization.webui.component.UIListPermissionSelector
UIListPermissionSelector.header.groupId=Group
UIListPermissionSelector.header.membership=Membership
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/EmailAddressValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -59,7 +59,7 @@
String s = (String)uiInput.getValue();
if (s.matches(EMAIL_REGEX))
return;
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("EmailAddressValidator.msg.Invalid-input", args,
ApplicationMessage.WARNING));
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ExpressionValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -85,7 +85,7 @@
{
label = uiInput.getName();
}
- Object[] args = {label,};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage(key_, args, ApplicationMessage.WARNING));
}
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/IdentifierValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -68,7 +68,7 @@
{
continue;
}
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("IdentifierValidator.msg.Invalid-char", args,
ApplicationMessage.WARNING));
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/MandatoryValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -61,7 +61,7 @@
label = uiInput.getName();
}
label = label.trim();
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("EmptyFieldValidator.msg.empty-input", args,
ApplicationMessage.WARNING));
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NameValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -62,7 +62,7 @@
{
continue;
}
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("NameValidator.msg.Invalid-char", args));
}
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NullFieldValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -52,7 +52,7 @@
{
label = uiInput.getName();
}
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("EmptyFieldValidator.msg.empty-input", args));
}
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/NumberFormatValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -61,7 +61,7 @@
{
continue;
}
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("NumberFormatValidator.msg.Invalid-number", args));
}
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/PositiveNumberFormatValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -69,7 +69,7 @@
}
if (error == true && s.charAt(0) == '-')
{
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("PositiveNumberFormatValidator.msg.Invalid-number", args));
}
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/ResourceValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -68,7 +68,7 @@
{
continue;
}
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("ResourceValidator.msg.Invalid-char", args,
ApplicationMessage.WARNING));
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java 2010-04-06 03:52:26 UTC (rev 2478)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/validator/SpecialCharacterValidator.java 2010-04-06 03:56:06 UTC (rev 2479)
@@ -60,7 +60,7 @@
{
continue;
}
- Object[] args = {label, uiInput.getBindingField()};
+ Object[] args = {label};
throw new MessageException(new ApplicationMessage("SpecialCharacterValidator.msg.Invalid-char", args,
ApplicationMessage.WARNING));
}
14 years, 8 months