gatein SVN: r1454 - portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form.
by do-not-reply@jboss.org
Author: tan_pham_dinh
Date: 2010-01-27 05:49:38 -0500 (Wed, 27 Jan 2010)
New Revision: 1454
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java
Log:
GTNPORTAL-560: Create MultiValued filed
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java 2010-01-27 08:55:47 UTC (rev 1453)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java 2010-01-27 10:49:38 UTC (rev 1454)
@@ -201,6 +201,16 @@
{
Class[] classes = constructor_.getParameterTypes();
Object[] params = new Object[classes.length];
+ for (int i = 0; i < classes.length; i++)
+ {
+ if (classes[i].isPrimitive())
+ {
+ if (classes[i] == boolean.class)
+ params[i] = false;
+ else
+ params[i] = 0;
+ }
+ }
params[0] = getId() + String.valueOf(idx);
UIFormInputBase inputBase = (UIFormInputBase)constructor_.newInstance(params);
List<Validator> validators = this.getValidators();
14 years, 11 months
gatein SVN: r1453 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-27 03:55:47 -0500 (Wed, 27 Jan 2010)
New Revision: 1453
Added:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIMappedForm.java
Log:
- Started implementing a dynamic form which elements are automatically created from a backing bean via reflection. Still needs work and testing.
Added: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIMappedForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIMappedForm.java (rev 0)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIMappedForm.java 2010-01-27 08:55:47 UTC (rev 1453)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * 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.wsrp.webui.component;
+
+import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.form.UIForm;
+import org.exoplatform.webui.form.UIFormCheckBoxInput;
+import org.exoplatform.webui.form.UIFormInputSet;
+import org.exoplatform.webui.form.UIFormStringInput;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class UIMappedForm extends UIForm
+{
+ private static final Class<?>[] EMPTY_ARGS = new Class<?>[]{};
+
+ public void setBackingBean(Object bean) throws Exception
+ {
+ introspectAndBuild(bean, this);
+ invokeSetBindingBean(bean);
+ }
+
+ private void introspectAndBuild(Object bean, UIContainer container) throws IllegalAccessException, InvocationTargetException
+ {
+ Class<? extends Object> beanClass = bean.getClass();
+ Method[] methods = beanClass.getDeclaredMethods();
+ for (Method method : methods)
+ {
+ Class<?> type = method.getReturnType();
+ String name = method.getName();
+ String fieldName = getFieldNameOrNullFrom(name, method, beanClass);
+ if (fieldName != null)
+ {
+ Object beanValue = method.invoke(bean, null);
+ if (String.class.isAssignableFrom(type))
+ {
+ container.addChild(new UIFormStringInput(name, name, beanValue == null ? null : beanValue.toString()));
+ }
+ else if (Boolean.class.isAssignableFrom(type))
+ {
+ container.addChild(new UIFormCheckBoxInput(name, name, beanValue));
+ }
+ else
+ {
+ UIFormInputSet input = new UIFormInputSet(name);
+ container.addChild(input);
+ introspectAndBuild(beanValue, input);
+ }
+ }
+ }
+ }
+
+ private String getFieldNameOrNullFrom(String name, Method method, Class<?> beanClass)
+ {
+ int index = name.indexOf("get");
+ int endIndex = 3;
+ if (index != 0)
+ {
+ index = name.indexOf("is");
+ endIndex = 2;
+ }
+
+ if (index == 0 && method.getParameterTypes().length == 0)
+ {
+ name = name.substring(endIndex);
+ Class<?> type = method.getReturnType();
+
+ try
+ {
+ // check if there's a get method associated to the setter
+ beanClass.getDeclaredMethod("set" + name, type);
+ }
+ catch (NoSuchMethodException e)
+ {
+ return null;
+ }
+ return name;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
14 years, 11 months
gatein SVN: r1452 - in portal/trunk: portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-27 03:53:45 -0500 (Wed, 27 Jan 2010)
New Revision: 1452
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java
Log:
- Deactivate localRegistration's actions so that there's no ambiguity as to which grid issued the event.
- Display form to edit registration property value (not currently working).
- Inject ExoContainerContext in ExoKernelIntegration.
Modified: portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java
===================================================================
--- portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java 2010-01-27 06:25:11 UTC (rev 1451)
+++ portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ExoKernelIntegration.java 2010-01-27 08:53:45 UTC (rev 1452)
@@ -75,8 +75,9 @@
private final String consumersConfigLocation;
private ConsumerRegistry consumerRegistry;
private static final String REMOTE_INVOKERS_INVOKER_ID = "remote";
+ private ExoContainer container;
- public ExoKernelIntegration(InitParams params, ConfigurationManager configurationManager,
+ public ExoKernelIntegration(ExoContainerContext context, InitParams params, ConfigurationManager configurationManager,
org.exoplatform.portal.pc.ExoKernelIntegration pc) throws Exception
{
// IMPORTANT: even though PC ExoKernelIntegration is not used anywhere in the code, it's still needed for pico
@@ -94,16 +95,17 @@
}
configurationIS = configurationManager.getInputStream(CLASSPATH + producerConfigLocation);
+
+ container = context.getContainer();
}
public void start()
{
- ExoContainer container = ExoContainerContext.getCurrentContainer();
- startProducer(container);
- startConsumers(container);
+ startProducer();
+ startConsumers();
}
- private void startProducer(ExoContainer container)
+ private void startProducer()
{
JCRProducerConfigurationService producerConfigurationService;
@@ -167,7 +169,7 @@
producer.start();
}
- private void startConsumers(ExoContainer container)
+ private void startConsumers()
{
// retrieve federating portlet invoker from container
FederatingPortletInvoker federatingPortletInvoker =
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java 2010-01-27 06:25:11 UTC (rev 1451)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java 2010-01-27 08:53:45 UTC (rev 1452)
@@ -26,10 +26,7 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccessImpl;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIPageIterator;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIFormGrid;
import org.gatein.common.util.ParameterValidation;
import org.gatein.wsrp.consumer.RegistrationProperty;
@@ -43,15 +40,14 @@
* @version $Revision$
*/
@ComponentConfig(
- template = "system:/groovy/webui/core/UIGrid.gtmpl",
- events = {
- @EventConfig(listeners = UIRegistrationPropertiesGrid.EditPropertyActionListener.class)
- })
+ template = "system:/groovy/webui/core/UIGrid.gtmpl"
+)
public class UIRegistrationPropertiesGrid extends UIFormGrid
{
private static final String NAME = "name";
static String[] FIELDS = {NAME, "description", "status", "value"};
static String[] PROPERTIES_ACTIONS = {"EditProperty", "DeleteProperty"};
+ static String[] INACTIVE_ACTIONS = {};
private Map<String, RegistrationProperty> props;
public UIRegistrationPropertiesGrid() throws Exception
@@ -96,13 +92,15 @@
return props.get(name);
}
- static public class EditPropertyActionListener extends EventListener<UIRegistrationPropertiesGrid>
+ public void setActive(boolean active)
{
- @Override
- public void execute(Event<UIRegistrationPropertiesGrid> event) throws Exception
+ if (active)
{
- String name = event.getRequestContext().getRequestParameter(OBJECTID);
- UIRegistrationPropertiesGrid registrationPropertiesGrid = event.getSource();
+ configure(NAME, FIELDS, PROPERTIES_ACTIONS);
}
+ else
+ {
+ configure(NAME, FIELDS, INACTIVE_ACTIONS);
+ }
}
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java 2010-01-27 06:25:11 UTC (rev 1451)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java 2010-01-27 08:53:45 UTC (rev 1452)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -45,6 +45,7 @@
import org.gatein.wsrp.consumer.ConsumerException;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.RegistrationInfo;
+import org.gatein.wsrp.consumer.RegistrationProperty;
import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
import org.gatein.wsrp.services.ManageableServiceFactory;
@@ -92,8 +93,8 @@
setActions(ACTIONS);
// set property value popup
- setValuePopup = addChild(UIPopupWindow.class, null, null);
- setValuePopup.setWindowSize(200, 0);
+ setValuePopup = addChild(UIPopupWindow.class, null, "SetPropertyPopup");
+ setValuePopup.setWindowSize(400, 0);
setPropertyForm = createUIComponent(UISetPropertyValueForm.class, null, "SetProperty");
setValuePopup.setUIComponent(setPropertyForm);
setValuePopup.setRendered(false);
@@ -162,11 +163,13 @@
RegistrationInfo local = producerInfo.getRegistrationInfo();
localRegistration.resetProps(local.getRegistrationProperties());
+ localRegistration.setActive(false);
RegistrationInfo expected = producerInfo.getExpectedRegistrationInfo();
if (local != expected && expected != null)
{
expectedRegistration.resetProps(expected.getRegistrationProperties());
+ expectedRegistration.setActive(true);
}
else
{
@@ -279,6 +282,17 @@
String name = event.getRequestContext().getRequestParameter(OBJECTID);
UIWsrpConsumerEditor editor = event.getSource();
+ RegistrationProperty property = editor.expectedRegistration.getProperty(name);
+ editor.displayPropertyValueEditor(property);
}
}
+
+ private void displayPropertyValueEditor(RegistrationProperty prop) throws Exception
+ {
+ setPropertyForm.reset();
+ setPropertyForm.setProperty(prop);
+
+ setValuePopup.setRendered(true);
+ setValuePopup.setShow(true);
+ }
}
14 years, 11 months
gatein SVN: r1451 - portal/trunk/docs/reference-guide/en/modules/development.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-01-27 01:25:11 -0500 (Wed, 27 Jan 2010)
New Revision: 1451
Modified:
portal/trunk/docs/reference-guide/en/modules/development/Internationalization_Configuration.xml
portal/trunk/docs/reference-guide/en/modules/development/Portal_Lifecycle.xml
portal/trunk/docs/reference-guide/en/modules/development/Right_To_Left_Framework.xml
Log:
begin edits Ch2 Development
Modified: portal/trunk/docs/reference-guide/en/modules/development/Internationalization_Configuration.xml
===================================================================
--- portal/trunk/docs/reference-guide/en/modules/development/Internationalization_Configuration.xml 2010-01-27 03:59:24 UTC (rev 1450)
+++ portal/trunk/docs/reference-guide/en/modules/development/Internationalization_Configuration.xml 2010-01-27 06:25:11 UTC (rev 1451)
@@ -8,7 +8,7 @@
<section id="sect-Reference_Guide-Internationalization_Configuration-Overview">
<title>Overview</title>
<para>
- All aspects of internationalization in GateIn products are covered. You should have a general knowledge of Internationalization in Java products. Sun created a <ulink url="http://java.sun.com/docs/books/tutorial/i18n/TOC.html">good internationalization tutorial</ulink> .
+ All aspects of internationalization in &PRODUCT; are covered. You should have a general knowledge of Internationalization in Java products. Sun created a <ulink url="http://java.sun.com/docs/books/tutorial/i18n/TOC.html">good internationalization tutorial</ulink> .
</para>
<para>
All embedded applications contains property files for various languages. They are packaged with the portlets applications in a WEB-INF/classes/locale/ directory.
Modified: portal/trunk/docs/reference-guide/en/modules/development/Portal_Lifecycle.xml
===================================================================
--- portal/trunk/docs/reference-guide/en/modules/development/Portal_Lifecycle.xml 2010-01-27 03:59:24 UTC (rev 1450)
+++ portal/trunk/docs/reference-guide/en/modules/development/Portal_Lifecycle.xml 2010-01-27 06:25:11 UTC (rev 1451)
@@ -15,11 +15,14 @@
<section id="sect-Reference_Guide-Portal_Lifecycle-Application_Server_start_and_stop">
<title>Application Server start and stop</title>
<para>
- A GateIn Portal instance is simply a web application deployed as a WAR in an application server. Portlets are also part of an enhanced WAR that we call a portlet application.
+ A portal instance is simply a web application deployed as a WAR in an application server. Portlets are also part of an enhanced WAR called a portlet application.
</para>
<para>
- GateIn doesn't require any particular setup for your portlet in most common scenario and the web.xml file can remain without any GateIn specific configuration. During deployment, GateIn will automatically and transparently inject a servlet into the portlet application to be able to interact with it. This feature is dependent on the underlying servlet container but will work out of the box on the proposed bundles.
+ &PRODUCT; doesn't require any particular setup for your portlet in most common scenarios and the <filename>web.xml</filename> file can remain without any &PRODUCT; specific configuration.
</para>
+ <para>
+ During deployment, &PRODUCT; will automatically and transparently inject a servlet into the portlet application to be able to interact with it. This feature is dependent on the underlying servlet container but will work out of the box on the proposed bundles.
+ </para>
</section>
<!--
@@ -88,12 +91,16 @@
<section id="sect-Reference_Guide-Portal_Lifecycle-The_Command_Servlet">
<title>The Command Servlet</title>
<para>
- The servlet is the main entry point for incoming requests, it also includes some interesting init code when the portal is launched. This servlet (<literal>org.gatein.wci.command.CommandServlet</literal>) is automatically added during deployment and mapped to <literal>/tomcatgateinservlet</literal>.
+ The servlet is the main entry point for incoming requests, it also includes some init code when the portal is launched. This servlet (<literal>org.gatein.wci.command.CommandServlet</literal>) is automatically added during deployment and mapped to <literal>/tomcatgateinservlet</literal>.
</para>
<para>
- In other words, this is equivalent to adding the following into web.xml (But this is for information only, the servlet is already configured)
+ This is equivalent to adding the following into <filename>web.xml</filename>.
</para>
-
+ <note>
+ <para>
+ As the servlet is already configured this example is for information only.
+ </para>
+ </note>
<programlisting role="XML">
<servlet>
<servlet-name>TomcatGateInServlet</servlet-name>
@@ -107,7 +114,10 @@
</servlet-mapping>
</programlisting>
<para>
- With this in mind it's possible to filter on the CommandServlet by filtering on the URL pattern used by the Servlet mapping. As an example below we will create a servlet filter that calculates the time of execution of a portlet request.
+ It is possible to filter on the CommandServlet by filtering the URL pattern used by the Servlet mapping.
+ </para>
+ <para>
+ The example below would create a servlet filter that calculates the time of execution of a portlet request.
</para>
<para>
The filter class:
@@ -146,7 +156,7 @@
}
</programlisting>
<para>
- The Java EE web application configuration file (web.xml) of the portlet on which we want to know the time to serve a portlet request. As mentioned above nothing specific to GateIn needs to be included, only the URL pattern to set has to be known.
+ The Java EE web application configuration file (<filename>web.xml</filename>) of the portlet on which we want to know the time to serve a portlet request. As mentioned above nothing specific to &PRODUCT; needs to be included, only the URL pattern to set has to be known.
</para>
<programlisting role="XML">
@@ -172,7 +182,7 @@
<note>
<title>INCLUDE dispatcher</title>
<para>
- Here it's important to set INCLUDE as dispatcher as the portal will always hit the CommandServlet through a request dispatcher. Without this, the filter will not be triggered, unless direct access to a resource (such as an image).
+ It is important to set <literal>INCLUDE</literal> as dispatcher as the portal will always hit the CommandServlet through a request dispatcher. Without this, the filter will not be triggered, unless direct access to a resource (such as an image).
</para>
</note>
</para>
Modified: portal/trunk/docs/reference-guide/en/modules/development/Right_To_Left_Framework.xml
===================================================================
--- portal/trunk/docs/reference-guide/en/modules/development/Right_To_Left_Framework.xml 2010-01-27 03:59:24 UTC (rev 1450)
+++ portal/trunk/docs/reference-guide/en/modules/development/Right_To_Left_Framework.xml 2010-01-27 06:25:11 UTC (rev 1451)
@@ -5,18 +5,9 @@
]>
<section id="sect-Reference_Guide-RTL_Right_To_Left_Framework">
<title>RTL (Right To Left) Framework</title>
- <section id="sect-Reference_Guide-RTL_Right_To_Left_Framework-Overview">
- <title>Overview</title>
<para>
- The RTL framework (Right-To-Left framework) provides a set of tools that can be leveraged by the user interface components to handle directionality gracefully.
+ The text orientation depends on the current locale setting. The orientation is a Java 5 enum that provides a set of functionalities:
</para>
- </section>
-
- <section id="sect-Reference_Guide-RTL_Right_To_Left_Framework-Direction">
- <title>Direction</title>
- <para>
- The orientation depends on the current locale and during a portal request the current orientation is made available by various means. The orientation is a Java 5 enum that provides a set of functionalities:
- </para>
<programlisting>
LT, // Western Europe
@@ -29,48 +20,68 @@
public boolean isTR() { ... }
</programlisting>
<para>
- The object defining the current Orientation for the current request is the UIPortalApplication. However it should be accessed at runtime using the RequestContext that delegates to the UIPortalApplication. In the case of a PortalRequestContext it is a direct delegate as the PortalRequestContext has a reference to the current UIPortalApplication. In case of a different context such as the PortletRequestContext, it delegates to the parent context given the fact that the root RequestContext is always a PortalRequestContext.
+ The object defining the Orientation for the current request is the <literal>UIPortalApplication</literal>. However it should be accessed at runtime using the <literal>RequestContext</literal> that delegates to the <literal>UIPortalApplication</literal>.
</para>
- </section>
+ <para>
+ In the case of a <literal>PortalRequestContext</literal> it is a direct delegate as the <literal>PortalRequestContext</literal> has a reference to the current <literal>UIPortalApplication</literal>.
+ </para>
+ <para>
+ In the case of a different context such as the <literal>PortletRequestContext</literal>, it delegates to the parent context given the fact that the root <literal>RequestContext</literal> is always a <literal>PortalRequestContext</literal>.
+ </para>
<section id="sect-Reference_Guide-RTL_Right_To_Left_Framework-Groovy_templates">
<title>Groovy templates</title>
<para>
- Orientation is obtained from implicit variables defined by the groovy binding context:
+ Orientation is defined by implicit variables in the groovy binding context:
</para>
- <itemizedlist>
- <listitem>
- <para>
- orientation : the current orientation as an Orientation
- </para>
- </listitem>
- <listitem>
- <para>
- isLT : the value of orientation.isLT()
- </para>
- </listitem>
- <listitem>
- <para>
- isRT : the value of orientation.isRT()
- </para>
- </listitem>
- <listitem>
- <para>
- dir : the string 'ltr' if the orientation is LT or the string 'rtl' if the orientation is RT
- </para>
- </listitem>
- </itemizedlist>
+ <variablelist>
+ <varlistentry>
+ <term>Orientation</term>
+ <listitem>
+ <para>
+ The current orientation as an Orientation
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>isLT</term>
+ <listitem>
+ <para>
+ The value of orientation.isLT()
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>isRT</term>
+ <listitem>
+ <para>
+ The value of orientation.isRT()
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>dir</term>
+ <listitem>
+ <para>
+ The string 'ltr' if the orientation is LT or the string 'rtl' if the orientation is RT.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</section>
<section id="sect-Reference_Guide-RTL_Right_To_Left_Framework-Stylesheet">
<title>Stylesheet</title>
<para>
- The skin service handles stylesheet rewriting to accommodate the orientation. It works by appending -lt or -rt to the stylesheet name. For instance <emphasis role="bold"> /web/skin/portal/webui/component/UIFooterPortlet/DefaultStylesheet-rt.css </emphasis> will return the same stylesheet as <emphasis role="bold"> /web/skin/portal/webui/component/UIFooterPortlet/DefaultStylesheet.css </emphasis> but processed for the RT orientation. Obviously the -lt suffix is optional.
+ The skin service handles stylesheet rewriting to accommodate the orientation. It works by appending -lt or -rt to the stylesheet name.
+ </para>
+ <para>
+ For instance: <filename>/web/skin/portal/webui/component/UIFooterPortlet/DefaultStylesheet-rt.css</filename> will return the same stylesheet as <filename>/web/skin/portal/webui/component/UIFooterPortlet/DefaultStylesheet.css</filename> but processed for the RT orientation. The <parameter>-lt</parameter> suffix is optional.
</para>
<para>
Stylesheet authors can annotate their stylesheet to create content that depends on the orientation.
</para>
- <section id="sect-Reference_Guide-Stylesheet-Example_1">
+ <formalpara>
<title>Example 1</title>
<para>
In the example we need to use the orientation to modify the float attribute that will make the horizontal tabs either float on left or on right:
@@ -96,9 +107,9 @@
white-space: nowrap;
</programlisting>
</para>
- </section>
+ </formalpara>
- <section id="sect-Reference_Guide-Stylesheet-Example_2">
+ <formalpara>
<title>Example 2</title>
<para>
In this example we need to modify the padding according to the orientation:
@@ -121,7 +132,7 @@
padding: 0px 0px 0px 5px; /* orientation=rt */
</programlisting>
</para>
- </section>
+ </formalpara>
</section>
@@ -131,8 +142,16 @@
Sometimes it is necessary to create an RT version of an image that will be used from a template or from a stylesheet. However symmetric images can be automatically generated avoiding the necessity to create a mirrored version of an image and furthermore avoiding maintenance cost.
</para>
<para>
- The web resource filter uses the same naming pattern than the skin service does. When an image ends with the -rt suffix the portal will attempt to locate the original image and create a mirror of it. For instance requesting the image <emphasis role="bold"> /GateInResources/skin/DefaultSkin/webui/component/UITabSystem/UITabs/background/NormalTabStyle-rt.gif </emphasis> returns a mirror of the image <emphasis role="bold"> /GateInResources/skin/DefaultSkin/webui/component/UITabSystem/UITabs/background/NormalTabStyle.gif </emphasis> and it works perfectly because the image is symmetric.
+ The web resource filter uses the same naming pattern as the skin service. When an image ends with the -rt suffix the portal will attempt to locate the original image and create a mirror of it.
+ </para>
+ <para>
+ For instance: requesting the image <filename>/GateInResources/skin/DefaultSkin/webui/component/UITabSystem/UITabs/background/NormalTabStyle-rt.gif</filename> returns a mirror of the image <filename>/GateInResources/skin/DefaultSkin/webui/component/UITabSystem/UITabs/background/NormalTabStyle.gif</filename>.
</para>
+ <note>
+ <para>
+ It is important to consider whether the image to be mirrored is symmetrical as this will impact it's final appearance.
+ </para>
+ </note>
<para>
Here is an example combining stylesheet and images:
</para>
@@ -149,30 +168,43 @@
<section id="sect-Reference_Guide-RTL_Right_To_Left_Framework-Client_side_JavaScript">
<title>Client side JavaScript</title>
<para>
- Just use the eXo.core.I18n object that provides the following methods:
- <itemizedlist>
- <listitem>
- <para>
- getOrientation() : returns either the string lt or rt
- </para>
- </listitem>
- <listitem>
- <para>
- getDir() : returns either the string ltr or rtl
- </para>
- </listitem>
- <listitem>
- <para>
- isLT() : returns true for LT
- </para>
- </listitem>
- <listitem>
- <para>
- isRT() : returns true of RT
- </para>
- </listitem>
- </itemizedlist>
+ The <literal>eXo.core.I18n</literal> object provides the following parameters for orientation:
</para>
+ <variablelist>
+ <varlistentry>
+ <term>getOrientation()</term>
+ <listitem>
+ <para>
+ Returns either the string lt or rt
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>getDir()</term>
+ <listitem>
+ <para>
+ Returns either the string ltr or rtl
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>isLT()</term>
+ <listitem>
+ <para>
+ Returns true for LT
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>isRT()</term>
+ <listitem>
+ <para>
+ Returns true of RT
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
</section>
</section>
14 years, 11 months
gatein SVN: r1450 - portal/trunk/docs/reference-guide/en/modules/configuration.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-01-26 22:59:24 -0500 (Tue, 26 Jan 2010)
New Revision: 1450
Modified:
portal/trunk/docs/reference-guide/en/modules/configuration/Authentication_Token_Configuration.xml
portal/trunk/docs/reference-guide/en/modules/configuration/Dashboard_Configuration.xml
portal/trunk/docs/reference-guide/en/modules/configuration/JavaScript_Configuration.xml
Log:
first edit of CH1 Configuration complete
Modified: portal/trunk/docs/reference-guide/en/modules/configuration/Authentication_Token_Configuration.xml
===================================================================
--- portal/trunk/docs/reference-guide/en/modules/configuration/Authentication_Token_Configuration.xml 2010-01-27 03:59:01 UTC (rev 1449)
+++ portal/trunk/docs/reference-guide/en/modules/configuration/Authentication_Token_Configuration.xml 2010-01-27 03:59:24 UTC (rev 1450)
@@ -5,47 +5,24 @@
]>
<section id="sect-Reference_Guide-Authentication_Token_Configuration">
<title>Authentication Token Configuration</title>
- <section id="sect-Reference_Guide-Authentication_Token_Configuration-Overview">
- <title>Overview</title>
- <para>
- In this article, you will learn:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- What token services are.
- </para>
- </listitem>
- <listitem>
- <para>
- Implement a token service for using in GateIn portal.
- </para>
- </listitem>
- <listitem>
- <para>
- Configure a token service with a token's life-time.
- </para>
- </listitem>
- </itemizedlist>
- </section>
<section id="sect-Reference_Guide-Authentication_Token_Configuration-What_is_token_service">
<title>What is token service</title>
<para>
- Token service is used in authentication.
+ <emphasis>Token service</emphasis> is used in authentication.
</para>
<para>
- Using token helps preventing information such as user name, password into user request so the system will become more secure.
+ The token system prevents user account information being sent in clear text mode for inbound requests. This increases authentication security.
</para>
<para>
- Token service provides the way to manipulate tokens such as create, delete, retrieve, clean ... Token service also defines the life-time of token. After the life-time, token has no more effect. The life-time definition must be configured.
+ Token service allows adminitrators to create, delete, retrieve and clean tokens as required. The service also defines the validity period of any given token. The token becomes invalid once this period has expired, . The life-time definition must be configured.
</para>
</section>
<section id="sect-Reference_Guide-Authentication_Token_Configuration-Implement_token_services_API">
<title>Implement token service's API</title>
<para>
- All token services used in GateIn portal's authentication must be a subclass of an abstract class <emphasis role="bold">AbstractTokenService</emphasis> . So they must have these following methods:
+ All token services used in &PRODUCT;'s authentication must be a subclass of an abstract class <emphasis role="bold">AbstractTokenService</emphasis>. The following example shows how the token-service manipulates its tokens.
</para>
<programlisting role="JAVA">
@@ -57,19 +34,31 @@
public Credentials validateToken(String tokenKey, boolean remove) throws NullPointerException;
</programlisting>
<para>
- These methods show how the token-service manipulates its tokens.
+
</para>
</section>
<section id="sect-Reference_Guide-Authentication_Token_Configuration-Configure_token_services">
<title>Configure token services</title>
<para>
- Token services configuration is also known as specifying the life-time of token in the configuration file. The token service is configured as a portal component.
+ Token services configuration includes specifying the validity period time of token in the configuration file. The token service is configured as a portal component.
</para>
<para>
- Examples:
+ In the example below, <emphasis>CookieTokenService</emphasis> is a subclass of <emphasis role="bold">AbstractTokenService</emphasis> so it has a property which specifies the validity period of the token.
</para>
-
+ <para>
+ The token service will initiate this validity property by looking for an <parameter>init-param</parameter> named "<emphasis role="bold">service.configuration</emphasis>".
+ </para>
+ <para>
+ This property must have three values.
+ </para>
+ <programlistingco>
+ <areaspec>
+ <area coords="7" id="area-Reference_Guide-Authentication_Token_Configuration-Configure_token_services-name" />
+ <area coords="8" id="area-Reference_Guide-Authentication_Token_Configuration-Configure_token_services-time" />
+ <area coords="9" id="area-Reference_Guide-Authentication_Token_Configuration-Configure_token_services-unit" />
+ </areaspec>
+
<programlisting role="XML"><component>
<key>org.exoplatform.web.security.security.CookieTokenService</key>
<type>org.exoplatform.web.security.security.CookieTokenService</type>
@@ -83,17 +72,54 @@
</init-params>
</component>
</programlisting>
+
+ <calloutlist>
+ <callout arearefs="area-Reference_Guide-Authentication_Token_Configuration-Configure_token_services-name">
+ <para>
+ Service name
+ </para>
+ </callout>
+ <callout arearefs="area-Reference_Guide-Authentication_Token_Configuration-Configure_token_services-time">
+ <para>
+ Amount of time
+ </para>
+ </callout>
+ <callout arearefs="area-Reference_Guide-Authentication_Token_Configuration-Configure_token_services-unit">
+ <para>
+ Unit of time
+ </para>
+ </callout>
+ </calloutlist>
+ </programlistingco>
<para>
- In this example, <emphasis>CookieTokenService</emphasis> is a subclass of <emphasis role="bold">AbstractTokenService</emphasis> so it has a property which specifies <emphasis>how long token can live</emphasis> .
+ In this case, the service's name is "<emphasis role="bold">jcr-token</emphasis>" and the token's expiration time is a week.
</para>
<para>
- Service will initiate this property by looking for an init-param named as " <emphasis role="bold">service.configuration</emphasis> ". This property must have 3 values (service's name, amount of time, unit of time). In this case, we can see the service's name is "jcr-token", the token's expiration time is a week.
+ &PRODUCT; supports <emphasis>four</emphasis> timing units:
</para>
- <para>
- At this time, GateIn Portal supports <emphasis>four</emphasis> timing units: <emphasis role="bold">SECOND</emphasis> , <emphasis role="bold">MINUTE</emphasis> , <emphasis role="bold">HOUR</emphasis> and <emphasis role="bold">DAY</emphasis> .
- </para>
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ <parameter>SECOND</parameter>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>MINUTE</parameter>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>HOUR</parameter>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>DAY</parameter>
+ </para>
+ </listitem>
+ </orderedlist>
</section>
-
</section>
Modified: portal/trunk/docs/reference-guide/en/modules/configuration/Dashboard_Configuration.xml
===================================================================
--- portal/trunk/docs/reference-guide/en/modules/configuration/Dashboard_Configuration.xml 2010-01-27 03:59:01 UTC (rev 1449)
+++ portal/trunk/docs/reference-guide/en/modules/configuration/Dashboard_Configuration.xml 2010-01-27 03:59:24 UTC (rev 1450)
@@ -5,47 +5,48 @@
]>
<section id="sect-Reference_Guide-Dashboard_configuration">
<title>Dashboard configuration</title>
- <section id="sect-Reference_Guide-Dashboard_configuration-Parameters_in_edit_mode">
- <title>Parameters (in edit mode)</title>
- <section id="sect-Reference_Guide-Parameters_in_edit_mode-owner">
+ <para>
+ The following parameters are available controll the Dashboard configuration (when in edit mode):
+ </para>
+ <formalpara>
<title>owner</title>
- <itemizedlist>
- <listitem>
- <para>
- if empty, everyone share the same dashboard and can edit it
- </para>
- </listitem>
- <listitem>
- <para>
- if set to <emphasis>CURRENTUSER</emphasis> , every user has his own dashboard
- </para>
- </listitem>
- <listitem>
- <para>
- if set to a username, everyone will see the dashboard of this person
- </para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section id="sect-Reference_Guide-Parameters_in_edit_mode-isPrivate">
+ <para>
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ if empty, everyone share the same dashboard and can edit it
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ if set to <emphasis>CURRENTUSER</emphasis> , every user has his own dashboard
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ if set to a username, everyone will see the dashboard of this person
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </formalpara>
+ <formalpara>
<title>isPrivate</title>
- <itemizedlist>
- <listitem>
- <para>
- if set to 1, only the owner of the dashboard can edit it
- </para>
- </listitem>
- <listitem>
- <para>
- if set to 0, everyone can edit it
- </para>
- </listitem>
- </itemizedlist>
- </section>
-
- </section>
-
+ <para>
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ if set to 1, only the owner of the dashboard can edit it
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ if set to 0, everyone can edit it
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </formalpara>
</section>
Modified: portal/trunk/docs/reference-guide/en/modules/configuration/JavaScript_Configuration.xml
===================================================================
--- portal/trunk/docs/reference-guide/en/modules/configuration/JavaScript_Configuration.xml 2010-01-27 03:59:01 UTC (rev 1449)
+++ portal/trunk/docs/reference-guide/en/modules/configuration/JavaScript_Configuration.xml 2010-01-27 03:59:24 UTC (rev 1450)
@@ -12,8 +12,11 @@
Every portlet can have its own javscript code but in many cases it is more convenient to reuse some existing shared libraries. For that reason, &PRODUCT; has a mechanism to easily register the libraries that will be loaded when the first page will be rendered.
</para>
<para>
- To do so, every WAR deployed in &PRODUCT; can register the <filename>js</filename> files thanks to a groovy script "<filename>WEB-INF/conf/script/groovy/JavascriptScript.groovy</filename>". The example file below is found in the 01eXoResources.war
+ To do so, every WAR deployed in &PRODUCT; can register the <filename>js</filename> files with the groovy script "<filename>WEB-INF/conf/script/groovy/JavascriptScript.groovy</filename>".
</para>
+ <para>
+ The example file below is found in the 01eXoResources.war
+ </para>
<programlisting>JavascriptService.addJavascript("eXo", "/javascript/eXo.js", ServletContext);
/* Animation Javascripts */
14 years, 11 months
gatein SVN: r1448 - in portal/trunk: portlet/web/src/main/java/org/exoplatform/portal/webui/component and 8 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-26 13:03:45 -0500 (Tue, 26 Jan 2010)
New Revision: 1448
Added:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentConfigConverter.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentHandle.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/metadata/
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/metadata/ComponentMetaData.java
Removed:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Container.java
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupManagement.java
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/WebuiApplication.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/WebuiConfiguration.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
portal/trunk/webui/core/src/main/resources/binding.xml
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java
Log:
- make Component (config) immutable so it can be easily referenced during the serialization of UIComponent
- make the template override for the components UIPortalNavigation, UIPortalNavigation2, UISiteMapPortlet, UIBreadcumbsPortlet at the component level
- better serialize UIComponents
- introduce ComponentMetaData that takes XML configuration and create immutable Component objects
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupManagement.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupManagement.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupManagement.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -62,7 +62,7 @@
public UIGroupManagement() throws Exception
{
UIBreadcumbs uiBreadcum = addChild(UIBreadcumbs.class, null, "BreadcumbsGroupManagement");
- uiBreadcum.getComponentConfig().setTemplate("system:/groovy/webui/core/UIBreadcumbs.gtmpl");
+ uiBreadcum.setTemplate("system:/groovy/webui/core/UIBreadcumbs.gtmpl");
addChild(UIGroupExplorer.class, null, null);
addChild(UIGroupDetail.class, null, null);
uiBreadcum.setBreadcumbsStyle("UIExplorerHistoryPath");
Modified: portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
===================================================================
--- portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -59,7 +59,7 @@
String template = prefers.getValue("template", "system:/groovy/webui/core/UIBreadcumbs.gtmpl");
UIBreadcumbs uiBreadCumbs = addChild(UIBreadcumbs.class, null, null);
- uiBreadCumbs.getComponentConfig().setTemplate(template);
+ uiBreadCumbs.setTemplate(template);
}
public void loadSelectedPath()
Modified: portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java
===================================================================
--- portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UINavigationPortlet.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -46,7 +46,7 @@
UIPortalNavigation portalNavigation = addChild(UIPortalNavigation.class, "UIHorizontalNavigation", null);
portalNavigation.setUseAjax(Boolean.valueOf(prefers.getValue("useAJAX", "true")));
portalNavigation.setShowUserNavigation(Boolean.valueOf(prefers.getValue("showUserNavigation", "true")));
- portalNavigation.getComponentConfig().setTemplate(template);
+ portalNavigation.setTemplate(template);
portalNavigation.setCssClassName(prefers.getValue("CSSClassName", ""));
}
Modified: portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java
===================================================================
--- portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIPortalNavigationPortlet.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -45,6 +45,6 @@
UIPortalNavigation2 portalNavigation = addChild(UIPortalNavigation2.class, "UIHorizontalNavigation", null);
portalNavigation.setUseAjax(Boolean.valueOf(prefers.getValue("useAJAX", "true")));
- portalNavigation.getComponentConfig().setTemplate(template);
+ portalNavigation.setTemplate(template);
}
}
\ No newline at end of file
Modified: portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
===================================================================
--- portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -58,7 +58,7 @@
UIPortalNavigation uiPortalNavigation = addChild(UIPortalNavigation.class, "UISiteMap", null);
uiPortalNavigation.loadTreeNodes();
- uiPortalNavigation.getComponentConfig().setTemplate(template);
+ uiPortalNavigation.setTemplate(template);
}
public boolean isUseAjax()
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -19,19 +19,16 @@
package org.exoplatform.webui.application;
-import org.exoplatform.webui.config.Component;
-import org.exoplatform.webui.config.Event;
-import org.exoplatform.webui.config.EventInterceptor;
-import org.exoplatform.webui.config.InitParams;
-import org.exoplatform.webui.config.Param;
-import org.exoplatform.webui.config.Validator;
-import org.exoplatform.webui.config.WebuiConfiguration;
+import org.exoplatform.webui.config.*;
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.config.annotation.EventInterceptorConfig;
import org.exoplatform.webui.config.annotation.ParamConfig;
import org.exoplatform.webui.config.annotation.ValidatorConfig;
+import org.exoplatform.webui.config.metadata.ComponentMetaData;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
@@ -60,6 +57,10 @@
*/
private Map<String, Component> configs_ = new HashMap<String, Component>();
+ /** The logger. */
+ private final Logger log;
+
+ /** . */
private org.exoplatform.webui.config.Application application_;
/**
@@ -68,6 +69,9 @@
*/
public ConfigurationManager(InputStream inputStream) throws Exception
{
+ // Logger first
+ log = LoggerFactory.getLogger(ConfigurationManager.class);
+
IBindingFactory bfact = BindingDirectory.getFactory(WebuiConfiguration.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
WebuiConfiguration config = (WebuiConfiguration)uctx.unmarshalDocument(inputStream, null);
@@ -83,14 +87,14 @@
}
if (config.getComponents() != null)
{
- for (Component component : config.getComponents())
+ for (ComponentMetaData componentMetaData : config.getComponents())
{
- String key = component.getType();
- if (component.getId() != null)
+ String key = componentMetaData.getType();
+ if (componentMetaData.getId() != null)
{
- key = key + ":" + component.getId();
+ key = key + ":" + componentMetaData.getId();
}
- configs_.put(key, component);
+ configs_.put(key, new Component(componentMetaData));
}
}
@@ -106,12 +110,7 @@
{
for (Component component : configs)
{
- String key = component.getType();
- if (component.getId() != null)
- {
- key = key + ":" + component.getId();
- }
- configs_.put(key, component);
+ configs_.put(component.getKey(), component);
}
}
@@ -136,6 +135,38 @@
return configs;
}
+ public Component getComponentConfig(ComponentHandle handle)
+ {
+ Component component = configs_.get(handle.getKey());
+
+ //
+ if (component == null)
+ {
+ Class<?> owner = handle.getOwner();
+ process(owner);
+ }
+
+ //
+ return configs_.get(handle.getKey());
+ }
+
+ private void process(Class<?> owner)
+ {
+ if (owner == null)
+ {
+ throw new NullPointerException("Cannot process a null owner");
+ }
+ try
+ {
+ Component[] components = annotationToComponents(owner);
+ setComponentConfigs(components);
+ }
+ catch (Exception e)
+ {
+ log.error("Could not create component configuration for owner " + owner.getName(), e);
+ }
+ }
+
/**
* Gets a component of a given class and identified by id
*
@@ -150,21 +181,19 @@
{
key = key + ":" + id;
}
+
+ //
Component config = configs_.get(key);
if (config != null)
{
return config;
}
- try
- {
- Component[] components = annotationToComponents(type);
- setComponentConfigs(components);
- return configs_.get(key);
- }
- catch (Exception e)
- {
- return null;
- }
+
+ //
+ process(type);
+
+ //
+ return configs_.get(key);
}
public org.exoplatform.webui.config.Application getApplication()
@@ -218,28 +247,37 @@
private Component toComponentConfig(ComponentConfig annotation, Class<?> clazz) throws Exception
{
- Component config = new Component();
+ String template = null;
+ if (annotation.template().length() > 0)
+ {
+ template = annotation.template();
+ }
+
+ //
+ String id = null;
if (annotation.id().length() > 0)
{
- config.setId(annotation.id());
+ id = annotation.id();
}
+ //
Class<?> type = annotation.type() == void.class ? clazz : annotation.type();
- config.setType(type.getName());
- if (annotation.template().length() > 0)
- {
- config.setTemplate(annotation.template());
- }
+
+ //
+ String lifecycle = null;
if (annotation.lifecycle() != void.class)
{
- config.setLifecycle(annotation.lifecycle().getName());
+ lifecycle = annotation.lifecycle().getName();
}
+
+ //
+ String decorator = null;
if (annotation.decorator().length() > 0)
{
- config.setDecorator(annotation.decorator());
+ decorator = annotation.decorator();
}
- config.setInitParams(toInitParams(annotation.initParams()));
+ //
EventConfig[] eventAnnotations = annotation.events();
ArrayList<Event> events;
if (eventAnnotations.length != 0)
@@ -254,8 +292,8 @@
{
events = new ArrayList<Event>();
}
- config.setEvents(events);
+ //
EventInterceptorConfig[] eventInterceptorAnnotations = annotation.eventInterceptors();
ArrayList<EventInterceptor> eventInterceptors;
if (eventInterceptorAnnotations.length != 0)
@@ -270,8 +308,8 @@
{
eventInterceptors = new ArrayList<EventInterceptor>();
}
- config.setEventInterceptors(eventInterceptors);
+ //
ValidatorConfig[] validatorAnnotations = annotation.validators();
ArrayList<Validator> validators;
if (validatorAnnotations.length != 0)
@@ -286,9 +324,19 @@
{
validators = new ArrayList<Validator>();
}
- config.setValidators(validators);
- return config;
+ //
+ return new Component(
+ clazz,
+ id,
+ type.getName(),
+ lifecycle,
+ template,
+ decorator,
+ toInitParams(annotation.initParams()),
+ validators,
+ events,
+ eventInterceptors);
}
private Event toEventConfig(EventConfig annotation) throws Exception
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/WebuiApplication.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/WebuiApplication.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/WebuiApplication.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -110,6 +110,7 @@
throw new Exception("Cannot find the configuration for the component " + type.getName() + ", configId "
+ configId);
}
+ System.out.println("Created component " + type.getName() + " with configId=" + configId + " and id=" + id + " and config=" + config);
T uicomponent = Util.createObject(type, config.getInitParams());
uicomponent.setComponentConfig(id, config);
return uicomponent;
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/TypeDomain.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -26,6 +26,8 @@
import org.exoplatform.webui.application.replication.model.metadata.ConvertedTypeMetaData;
import org.exoplatform.webui.application.replication.model.metadata.DomainMetaData;
import org.exoplatform.webui.application.replication.model.metadata.TypeMetaData;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import java.io.Serializable;
import java.lang.reflect.Field;
@@ -42,6 +44,9 @@
{
/** . */
+ private static final Logger log = LoggerFactory.getLogger(TypeDomain.class);
+
+ /** . */
private static final Map<Class<?>, Class<?>> primitiveToWrapperMap = new HashMap<Class<?>, Class<?>>();
static
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -20,6 +20,8 @@
package org.exoplatform.webui.config;
import org.exoplatform.webui.Util;
+import org.exoplatform.webui.application.replication.api.annotations.Converted;
+import org.exoplatform.webui.config.metadata.ComponentMetaData;
import org.exoplatform.webui.core.lifecycle.Lifecycle;
import org.exoplatform.webui.event.EventListener;
@@ -29,123 +31,148 @@
import java.util.Map;
/** Created by The eXo Platform SARL Author : Tuan Nguyen tuan08(a)users.sourceforge.net May 4, 2006 */
+(a)Converted(ComponentConfigConverter.class)
public class Component
{
- private String id;
+ final ComponentHandle handle;
- private String type;
+ private final String id;
- private String lifecycle;
+ private final String type;
- private String template;
+ private final String lifecycle;
- private String decorator;
+ private final String template;
- private InitParams initParams;
+ private final String decorator;
- // Note: Specific List implementations are required by JiBX :/
+ private final InitParams initParams;
- private ArrayList<Validator> validators;
+ private final List<Validator> validators;
- private ArrayList<Event> events;
+ private final List<Event> events;
- private ArrayList<EventInterceptor> eventInterceptors;
+ private final List<EventInterceptor> eventInterceptors;
- transient private Map<String, Event> eventMap;
+ private Map<String, Event> eventMap;
- transient private Lifecycle componentLifecycle;
+ private Lifecycle componentLifecycle;
- public String getId()
+ public Component(ComponentMetaData metaData)
{
- return id;
+ this(
+ new ComponentHandle(null, metaData.getId() == null ? metaData.getType() : metaData.getType() + metaData.getId()),
+ metaData.getId(),
+ metaData.getType(),
+ metaData.getLifecycle(),
+ metaData.getTemplate(),
+ metaData.getDecorator(),
+ metaData.getInitParams(),
+ metaData.getValidators(),
+ metaData.getEvents(),
+ metaData.getEventInterceptors());
}
- public String getType()
+ public Component(
+ Class<?> owner,
+ String id,
+ String type,
+ String lifecycle,
+ String template,
+ String decorator,
+ InitParams initParams,
+ List<Validator> validators,
+ List<Event> events,
+ List<EventInterceptor> eventInterceptors)
{
- return type;
+ this(
+ new ComponentHandle(owner, id == null ? type : type + ":" + id),
+ id,
+ type,
+ lifecycle,
+ template,
+ decorator,
+ initParams,
+ validators,
+ events,
+ eventInterceptors);
}
- public String getLifecycle()
+ private Component(
+ ComponentHandle handle,
+ String id,
+ String type,
+ String lifecycle,
+ String template,
+ String decorator,
+ InitParams initParams,
+ List<Validator> validators,
+ List<Event> events,
+ List<EventInterceptor> eventInterceptors)
{
- return lifecycle;
+ this.handle = handle;
+ this.id = id;
+ this.type = type;
+ this.lifecycle = lifecycle;
+ this.template = template;
+ this.decorator = decorator;
+ this.initParams = initParams;
+ this.validators = validators;
+ this.events = events;
+ this.eventInterceptors = eventInterceptors;
}
- public String getTemplate()
+ public String getKey()
{
- return template;
+ return handle.getKey();
}
- public String getDecorator()
+ public String getId()
{
- return decorator;
+ return id;
}
- public void setId(String id)
+ public String getType()
{
- this.id = id;
+ return type;
}
- public void setType(String type)
+ public String getLifecycle()
{
- this.type = type;
+ return lifecycle;
}
- public void setLifecycle(String lifecycle)
+ public String getTemplate()
{
- this.lifecycle = lifecycle;
+ return template;
}
- public void setTemplate(String template)
+ public String getDecorator()
{
- this.template = template;
+ return decorator;
}
- public void setDecorator(String decorator)
- {
- this.decorator = decorator;
- }
-
public InitParams getInitParams()
{
return initParams;
}
- public void setInitParams(InitParams initParams)
+ public List<Validator> getValidators()
{
- this.initParams = initParams;
- }
-
- public ArrayList<Validator> getValidators()
- {
return validators;
}
- public void setValidators(ArrayList<Validator> validators)
+ public List<Event> getEvents()
{
- this.validators = validators;
- }
-
- public ArrayList<Event> getEvents()
- {
return events;
}
- public void setEvents(ArrayList<Event> events)
+ public List<EventInterceptor> getEventInterceptors()
{
- this.events = events;
- }
-
- public ArrayList<EventInterceptor> getEventInterceptors()
- {
return eventInterceptors;
}
- public void setEventInterceptors(ArrayList<EventInterceptor> events)
- {
- eventInterceptors = events;
- }
-
public Event getUIComponentEventConfig(String eventName) throws Exception
{
if (eventMap != null)
Added: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentConfigConverter.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentConfigConverter.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentConfigConverter.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -0,0 +1,48 @@
+/*
+ * 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.webui.config;
+
+import org.exoplatform.webui.application.ConfigurationManager;
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.TypeConverter;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ComponentConfigConverter extends TypeConverter<Component, ComponentHandle>
+{
+
+ @Override
+ public ComponentHandle write(Component external) throws Exception
+ {
+ return external.handle;
+ }
+
+ @Override
+ public Component read(ComponentHandle internal) throws Exception
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ WebuiApplication webuiApp = (WebuiApplication)context.getApplication();
+ ConfigurationManager configMgr = webuiApp.getConfigurationManager();
+ return configMgr.getComponentConfig(internal);
+ }
+}
Added: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentHandle.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentHandle.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/ComponentHandle.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.webui.config;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ComponentHandle implements Serializable
+{
+
+ /** The owner type of the component that may be null if no owner exists. */
+ private final Class<?> owner;
+
+ /** The component key. */
+ private final String key;
+
+ public ComponentHandle(Class<?> owner, String key)
+ {
+ this.owner = owner;
+ this.key = key;
+ }
+
+ public Class<?> getOwner()
+ {
+ return owner;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+}
Deleted: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Container.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Container.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Container.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -1,74 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.webui.config;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Author : Nhu Dinh Thuan
- * nhudinhthuan(a)yahoo.com
- * May 19, 2006
- */
-public class Container extends Component
-{
-
- protected String title;
-
- protected List<Component> children = new ArrayList<Component>(5);
-
- public String getTitle()
- {
- return title;
- }
-
- public void setTitle(String s)
- {
- title = s;
- }
-
- public List getChildren()
- {
- return children;
- }
-
- @SuppressWarnings("unchecked")
- public void setChildren(List l)
- {
- children = l;
- }
-
- public void addChild(Component comp)
- {
- children.add(comp);
- }
-
- public void addComponent(Component comp)
- {
- children.add(comp);
- }
-
- public Iterator<Component> getChildIterator()
- {
- return children.iterator();
- }
-
-}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/WebuiConfiguration.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/WebuiConfiguration.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/WebuiConfiguration.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -19,6 +19,8 @@
package org.exoplatform.webui.config;
+import org.exoplatform.webui.config.metadata.ComponentMetaData;
+
import java.util.ArrayList;
/**
@@ -30,7 +32,7 @@
private ArrayList<String> annotationClasses;
- private ArrayList<Component> components;
+ private ArrayList<ComponentMetaData> components;
private Application application;
@@ -39,7 +41,7 @@
return annotationClasses;
}
- public ArrayList<Component> getComponents()
+ public ArrayList<ComponentMetaData> getComponents()
{
return components;
}
Added: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/metadata/ComponentMetaData.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/metadata/ComponentMetaData.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/metadata/ComponentMetaData.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -0,0 +1,140 @@
+/**
+ * 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.webui.config.metadata;
+
+import org.exoplatform.webui.config.Event;
+import org.exoplatform.webui.config.EventInterceptor;
+import org.exoplatform.webui.config.InitParams;
+import org.exoplatform.webui.config.Validator;
+
+import java.util.ArrayList;
+
+/** Created by The eXo Platform SARL Author : Tuan Nguyen tuan08(a)users.sourceforge.net May 4, 2006 */
+public class ComponentMetaData
+{
+
+ private String id;
+
+ private String type;
+
+ private String lifecycle;
+
+ private String template;
+
+ private String decorator;
+
+ private InitParams initParams;
+
+ private ArrayList<Validator> validators;
+
+ private ArrayList<Event> events;
+
+ private ArrayList<EventInterceptor> eventInterceptors;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getLifecycle()
+ {
+ return lifecycle;
+ }
+
+ public String getTemplate()
+ {
+ return template;
+ }
+
+ public String getDecorator()
+ {
+ return decorator;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public void setLifecycle(String lifecycle)
+ {
+ this.lifecycle = lifecycle;
+ }
+
+ public void setTemplate(String template)
+ {
+ this.template = template;
+ }
+
+ public void setDecorator(String decorator)
+ {
+ this.decorator = decorator;
+ }
+
+ public InitParams getInitParams()
+ {
+ return initParams;
+ }
+
+ public void setInitParams(InitParams initParams)
+ {
+ this.initParams = initParams;
+ }
+
+ public ArrayList<Validator> getValidators()
+ {
+ return validators;
+ }
+
+ public void setValidators(ArrayList<Validator> validators)
+ {
+ this.validators = validators;
+ }
+
+ public ArrayList<Event> getEvents()
+ {
+ return events;
+ }
+
+ public void setEvents(ArrayList<Event> events)
+ {
+ this.events = events;
+ }
+
+ public ArrayList<EventInterceptor> getEventInterceptors()
+ {
+ return eventInterceptors;
+ }
+
+ public void setEventInterceptors(ArrayList<EventInterceptor> events)
+ {
+ eventInterceptors = events;
+ }
+}
\ No newline at end of file
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIBreadcumbs.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -59,6 +59,22 @@
*/
private String styleBread = "default";
+ /**
+ * The runtime template.
+ */
+ private String template;
+
+ @Override
+ public String getTemplate()
+ {
+ return template != null ? template : super.getTemplate();
+ }
+
+ public void setTemplate(String template)
+ {
+ this.template = template;
+ }
+
public List<LocalPath> getPath()
{
return path_;
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -58,10 +58,8 @@
protected UIComponent uiparent;
- private String configId;
+ protected Component config;
- protected transient Component config;
-
private transient ValueRendererRegistry rendererRegistry = new ValueRendererRegistry();
private static final Lifecycle DEFAULT_LIFECYCLE = new Lifecycle();
@@ -183,7 +181,6 @@
public void setComponentConfig(String componentId, Component config) throws Exception
{
this.config = config;
- this.configId = config.getId();
if (componentId == null || componentId.length() == 0)
{
componentId = config.getId();
Modified: portal/trunk/webui/core/src/main/resources/binding.xml
===================================================================
--- portal/trunk/webui/core/src/main/resources/binding.xml 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/core/src/main/resources/binding.xml 2010-01-26 18:03:45 UTC (rev 1448)
@@ -55,7 +55,7 @@
<!-- component object mapping -->
- <mapping name="ui-component-config" class="org.exoplatform.webui.config.Component">
+ <mapping name="ui-component-config" class="org.exoplatform.webui.config.metadata.ComponentMetaData">
<value name="id" field="id" style="attribute" usage="optional" />
<value name="type" field="type" />
<value name="lifecycle" field="lifecycle" usage="optional" />
@@ -93,7 +93,7 @@
<value name="class" style="element"/>
</collection>
- <collection item-type="org.exoplatform.webui.config.Component"
+ <collection item-type="org.exoplatform.webui.config.metadata.ComponentMetaData"
field="components" usage="optional" />
<structure usage="optional" field="application"/>
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -38,8 +38,6 @@
public class UIComponentFactory extends ObjectFactory<UIComponent>
{
-
-
private <S extends UIComponent> Object getFieldValue(String fieldName, Map<FieldModel<? super S, ?>, ?> state)
{
for (Map.Entry<FieldModel<? super S, ?>, ?> entry : state.entrySet())
@@ -56,30 +54,12 @@
@Override
public <S extends UIComponent> S create(Class<S> type, Map<FieldModel<? super S, ?>, ?> state) throws CreateException
{
- // Get config id
- String configId = (String)getFieldValue("configId", state);
- String id = (String)getFieldValue("id", state);
-
//
try
{
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- WebuiApplication webuiApp = (WebuiApplication) context.getApplication();
- ConfigurationManager configMgr = webuiApp.getConfigurationManager();
- Component config = configMgr.getComponentConfig(type, configId);
+ Component config = (Component)getFieldValue("config", state);
- //
- S instance;
- if (config != null)
- {
- instance = Util.createObject(type, config.getInitParams());
- instance.setComponentConfig(id, config);
- }
- else
- {
- instance = Util.createObject(type, null);
- instance.setId(id);
- }
+ S instance = Util.createObject(type, config != null ? config.getInitParams() : null);
// Now set state
for (Map.Entry<FieldModel<? super S, ?>, ?> entry : state.entrySet())
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -52,6 +52,19 @@
private String cssClassName = "";
+ private String template;
+
+ @Override
+ public String getTemplate()
+ {
+ return template != null ? template : super.getTemplate();
+ }
+
+ public void setTemplate(String template)
+ {
+ this.template = template;
+ }
+
public UIComponent getViewModeUIComponent()
{
return null;
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java 2010-01-26 10:23:31 UTC (rev 1447)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation2.java 2010-01-26 18:03:45 UTC (rev 1448)
@@ -40,6 +40,19 @@
protected Object selectedParent_;
+ private String template;
+
+ @Override
+ public String getTemplate()
+ {
+ return template != null ? template : super.getTemplate();
+ }
+
+ public void setTemplate(String template)
+ {
+ this.template = template;
+ }
+
public UIComponent getViewModeUIComponent()
{
return null;
14 years, 11 months
gatein SVN: r1447 - in portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core: lifecycle and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-26 05:23:31 -0500 (Tue, 26 Jan 2010)
New Revision: 1447
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java
Log:
GTNPORTAL-556: Throw detailled IllegalStateException when a uicomponent does not have an assigned template at rendering time
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-26 07:53:01 UTC (rev 1446)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-26 10:23:31 UTC (rev 1447)
@@ -205,7 +205,7 @@
public String getTemplate()
{
- return config.getTemplate();
+ return config != null ? config.getTemplate() : null;
}
public ResourceResolver getTemplateResourceResolver(WebuiRequestContext context, String template)
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java 2010-01-26 07:53:01 UTC (rev 1446)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java 2010-01-26 10:23:31 UTC (rev 1447)
@@ -69,6 +69,15 @@
public void processRender(E uicomponent, WebuiRequestContext context) throws Exception
{
String template = uicomponent.getTemplate();
+
+ // Fail if we have no template
+ if (template == null)
+ {
+ throw new IllegalStateException("uicomponent " + uicomponent + " with class " + uicomponent.getClass().getName() +
+ " has no template for rendering");
+ }
+
+ //
ResourceResolver resolver = uicomponent.getTemplateResourceResolver(context, template);
WebuiBindingContext bcontext = new WebuiBindingContext(resolver, context.getWriter(), uicomponent, context);
bcontext.put(UIComponent.UICOMPONENT, uicomponent);
14 years, 11 months
gatein SVN: r1446 - portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data.
by do-not-reply@jboss.org
Author: liem_nguyen
Date: 2010-01-26 02:53:01 -0500 (Tue, 26 Jan 2010)
New Revision: 1446
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
Log:
GTNPORTAL-398 Unknown error when change position of portlet in Edit layout of Dashboard
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-01-26 02:30:24 UTC (rev 1445)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2010-01-26 07:53:01 UTC (rev 1446)
@@ -688,6 +688,14 @@
// We manufacture one name
name = UUID.randomUUID().toString();
}
+
+ // Remove to prevent DuplicateNameException (GTNPORTAL-398)
+ UIComponent uiComponent = dst.get(name);
+ if (uiComponent != null) {
+ dst.remove(uiComponent);
+ }
+
+
if (srcChild instanceof ContainerData)
{
dstChild = dst.add(ObjectType.CONTAINER, name);
14 years, 11 months
gatein SVN: r1445 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component.
by do-not-reply@jboss.org
Author: truong.le
Date: 2010-01-25 21:30:24 -0500 (Mon, 25 Jan 2010)
New Revision: 1445
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java
Log:
GTNPORTAL-437: show message wrong when delete group in special case
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java 2010-01-25 11:12:49 UTC (rev 1444)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java 2010-01-26 02:30:24 UTC (rev 1445)
@@ -108,25 +108,24 @@
if (currentGroupId != null)
{
Group currentGroup = service.getGroupHandler().findGroupById(currentGroupId);
- uiGroupForm.invokeSetBindingBean(currentGroup);
- if (currentGroup.getLabel() == null || currentGroup.getLabel().trim().length() == 0)
- {
- currentGroup.setLabel(currentGroup.getGroupName());
- }
- Group updateGroup = service.getGroupHandler().findGroupById(currentGroup.getGroupName());
- if (updateGroup == null)
+ if (currentGroup == null)
{
- Object[] args = {"GroupName", currentGroup.getGroupName()};
+ Object[] args = {uiGroupForm.getUIStringInput(GROUP_NAME).getValue()};
UIApplication uiApp = event.getRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIGroupForm.msg.group-not-exist", args));
- String parentId = currentGroup.getParentId();
- uiGroupExplorer.changeGroup(parentId);
+ uiGroupExplorer.changeGroup(null);
uiGroupDetail.getChild(UIGroupForm.class).setGroup(null);
uiGroupDetail.setRenderedChild(UIGroupInfo.class);
return;
}
+ uiGroupForm.invokeSetBindingBean(currentGroup);
+ if (currentGroup.getLabel() == null || currentGroup.getLabel().trim().length() == 0)
+ {
+ currentGroup.setLabel(currentGroup.getGroupName());
+ }
+
service.getGroupHandler().saveGroup(currentGroup, false);
uiGroupForm.reset();
uiGroupForm.setGroup(null);
@@ -157,7 +156,7 @@
Group newGroup = groupHandler.findGroupById(groupName);
if (newGroup != null)
{
- Object[] args = {"GroupName", groupName};
+ Object[] args = {groupName};
UIApplication uiApp = event.getRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIGroupForm.msg.group-exist", args));
return;
14 years, 11 months