gatein SVN: r1272 - in portal/trunk: portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-13 21:56:10 -0500 (Wed, 13 Jan 2010)
New Revision: 1272
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java
Log:
- Removed key field in registration details and use name as id field. Added getBeanIdFor method on UIGrid that calls toString on the id field to make sure
we get a String for further processing (in particular, UIForm.event methods).
- Re-worked toggle mechanism to work with the new organization of elements.
- Events on properties don't currently work. :/
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-14 02:56:10 UTC (rev 1272)
@@ -44,7 +44,8 @@
lifecycle = UIFormLifecycle.class,
template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
events = {
- @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
+ @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class),
+ @EventConfig(listeners = UIWsrpProducerEditor.RegistrationOnChangeActionListener.class)
}
)
public class UIWsrpProducerEditor extends UIForm
@@ -79,9 +80,9 @@
// registration details
// form set to gather registration information
- registrationDetails = addChild(UIWsrpRegistrationDetails.class,null,null);
+ registrationDetails = addChild(UIWsrpRegistrationDetails.class, null, null);
- init();
+ init(false);
}
ProducerConfigurationService getService()
@@ -89,7 +90,7 @@
return configService;
}
- private void init() throws Exception
+ private void init(boolean getRegistrationRequiredFromCheckBox) throws Exception
{
ProducerConfiguration configuration = configService.getConfiguration();
@@ -97,7 +98,9 @@
regReqForDesc.setValue(registrationRequirements.isRegistrationRequiredForFullDescription());
strictMode.setValue(configuration.isUsingStrictMode());
- boolean registrationRequired = registrationRequirements.isRegistrationRequired();
+ boolean registrationRequired = getRegistrationRequiredFromCheckBox ?
+ regRequired.getValue() :
+ registrationRequirements.isRegistrationRequired();
regRequired.setValue(registrationRequired);
// if registration is required then we display more information
@@ -142,11 +145,11 @@
e.printStackTrace();
}
- source.init();
+ source.init(false);
}
}
- public static class RegistrationOnChangeActionListener extends EventListener<UIFormCheckBoxInput>
+ /*public static class RegistrationOnChangeActionListener extends EventListener<UIFormCheckBoxInput>
{
public void execute(Event<UIFormCheckBoxInput> event) throws Exception
{
@@ -157,6 +160,18 @@
//update only the parent, avoid updating the full portlet
event.getRequestContext().addUIComponentToUpdateByAjax(parent);
}
+ }*/
+
+ public static class RegistrationOnChangeActionListener extends EventListener<UIWsrpProducerEditor>
+ {
+ public void execute(Event<UIWsrpProducerEditor> event) throws Exception
+ {
+ UIWsrpProducerEditor source = event.getSource();
+ source.init(true);
+
+ //update only the parent, avoid updating the full portlet
+ event.getRequestContext().addUIComponentToUpdateByAjax(source);
+ }
}
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-14 02:56:10 UTC (rev 1272)
@@ -35,8 +35,7 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIGrid;
import org.exoplatform.webui.core.UIPopupWindow;
-import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
+import org.exoplatform.webui.core.lifecycle.UIContainerLifecycle;
import org.exoplatform.webui.core.renderers.ValueRenderer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -66,21 +65,22 @@
* @version $Revision$
*/
@ComponentConfigs({
- @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
+ @ComponentConfig(id = UIWsrpRegistrationDetails.REGISTRATION_PROPERTIES, type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
@ComponentConfig(
- lifecycle = UIFormLifecycle.class,
+ lifecycle = UIContainerLifecycle.class,
events = {
@EventConfig(listeners = UIWsrpRegistrationDetails.AddPropertyActionListener.class),
@EventConfig(listeners = UIWsrpRegistrationDetails.EditPropertyActionListener.class),
@EventConfig(listeners = UIWsrpRegistrationDetails.DeletePropertyActionListener.class)
})
})
-public class UIWsrpRegistrationDetails extends UIForm
+public class UIWsrpRegistrationDetails extends UIFormInputSet
{
private UIFormInputBase<String> policy;
private UIFormInputBase<String> validator;
private UIGrid registrationProperties;
- static String[] FIELDS = {"key", "name", "description", "label", "hint"};
+ private static final String NAME = "name";
+ static String[] FIELDS = {NAME, "description", "label", "hint"};
static String[] SELECT_ACTIONS = {"EditProperty", "DeleteProperty"};
static final String POLICY_CLASS = "policyClassName";
static final String VALIDATOR_CLASS = "validatorClassName";
@@ -114,7 +114,7 @@
registrationProperties.registerRendererFor(renderer, LocalizedString.class);
//configure the edit and delete buttons based on an id from the data list - this will also be passed as param to listener
- registrationProperties.configure("key", FIELDS, SELECT_ACTIONS);
+ registrationProperties.configure(NAME, FIELDS, SELECT_ACTIONS);
registrationProperties.getUIPageIterator().setId(REGISTRATION_PROPERTIES_ITERATOR);
registrationProperties.getUIPageIterator().setRendered(false);
addChild(registrationProperties.getUIPageIterator());
@@ -216,11 +216,11 @@
@Override
public void processRender(WebuiRequestContext context) throws Exception
{
- if (getComponentConfig() != null)
+ /*if (getComponentConfig() != null)
{
super.processRender(context);
return;
- }
+ }*/
Writer w = context.getWriter();
w.write("<div class=\"UIFormInputSet\">");
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css 2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css 2010-01-14 02:56:10 UTC (rev 1272)
@@ -18,72 +18,82 @@
*/
.UIWsrpPortlet {
- padding:10px;
+ padding: 10px;
}
img.RefreshIcon {
- width: 16px; height: 16px;
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/RefreshIcon.gif') no-repeat;
+ width: 16px;
+ height: 16px;
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/RefreshIcon.gif') no-repeat;
}
img.DeactivateIcon {
- width: 16px; height: 16px;
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/Cancel.gif') no-repeat;
+ width: 16px;
+ height: 16px;
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/Cancel.gif') no-repeat;
}
-img.StopIcon {
- width: 16px; height: 16px;
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/DustBinClickButton.gif') no-repeat;
+img.ActivateIcon {
+ width: 16px;
+ height: 16px;
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/SelectIcon.gif') no-repeat;
}
-img.ActivateIcon {
- width: 16px; height: 16px;
- background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/SelectIcon.gif') no-repeat;
+img.EditPropertyIcon {
+ width: 16px;
+ height: 16px;
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/EditIcon.gif') no-repeat;
}
+img.DeletePropertyIcon {
+ width: 16px;
+ height: 16px;
+ background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/DustBinIcon.gif') no-repeat;
+}
+
.UIWsrpPortlet .UITabPane {
- margin: 10px
+ margin: 10px
}
.UIWsrpPortlet .UIHorizontalTabs .TabsContainer {
- border-bottom:1px solid #DDDDDD;
- height:24px;
+ border-bottom: 1px solid #DDDDDD;
+ height: 24px;
}
.UIWsrpPortlet .UIAction .ActionContainer {
- margin:0;
- width:auto;
+ margin: 0;
+ width: auto;
}
.UIWsrpPortlet .form-row {
- /*border-bottom: 1px solid #ddd;*/
- padding: 3px;
- clear:both;
+/*border-bottom: 1px solid #ddd;*/
+ padding: 3px;
+ clear: both;
}
.UIWsrpPortlet .form-row label {
- float:left;
- width: 100%;
+ float: left;
+ width: 100%;
}
.UIWsrpPortlet .form-row label span {
- display:block;
- float:left;
- width: 26%;
+ display: block;
+ float: left;
+ width: 26%;
}
.UIWsrpPortlet .form-row label input {
- float:left;
- width: 69%;
+ float: left;
+ width: 69%;
}
.UIWsrpPortlet .UILoginForm .UIAction {
- clear:both;
- padding: 8px 0;
+ clear: both;
+ padding: 8px 0;
}
.UIWsrpPortlet .UILoginForm .ActionContainer {
- float:right;
- margin:0;
+ float: right;
+ margin: 0;
}
Modified: portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-01-14 02:56:10 UTC (rev 1272)
@@ -70,22 +70,22 @@
<div class="ActionContainer">
<%
def beanIdField = uicomponent.getBeanIdField();
+ def beanId = uicomponent.getBeanIdFor(bean);
for (action in beanActions)
{
- def beanId = uicomponent.getFieldValue(bean, beanIdField);
if (action == null) continue;
- String title = _ctx.appRes(uicomponent.getParent().getName() + ".action.title." + action);
+ String title = _ctx.appRes(uiParent.getName() + ".action.title." + action);
String actionLink = "";
if (uiForm != null)
{
- actionLink = uiForm.event(action, uicomponent.getParent().getId(), beanId);
+ actionLink = uiForm.event(action, uiParent.getId(), beanId);
}
else
{
actionLink = uiParent.event(action, beanId);
}
%>
- <img onclick="$actionLink" alt="" title="$title" src="/eXoResources/skin/sharedImages/Blank.gif" class="${action}Icon"/>
+ <img onclick="$actionLink" alt="$action" title="$title" src="/eXoResources/skin/sharedImages/Blank.gif" class="${action}Icon"/>
<% } %>
</div>
</td>
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java 2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java 2010-01-14 02:56:10 UTC (rev 1272)
@@ -1,16 +1,16 @@
/**
* 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
@@ -26,35 +26,25 @@
import java.util.List;
/**
- * Created by The eXo Platform SARL
- * Author : Tuan Nguyen
- * tuan08(a)users.sourceforge.net
- * May 7, 2006
- *
+ * Created by The eXo Platform SARL Author : Tuan Nguyen tuan08(a)users.sourceforge.net May 7, 2006
+ * <p/>
* A grid element (represented by an HTML table) that can be paginated with a UIPageIterator
+ *
* @see UIPageIterator
*/
@ComponentConfig(template = "system:/groovy/webui/core/UIGrid.gtmpl")
public class UIGrid extends UIComponent
{
- /**
- * The page iterator
- */
+ /** The page iterator */
protected UIPageIterator uiIterator_;
- /**
- * The bean field that holds the id of this bean
- */
+ /** The bean field that holds the id of this bean */
protected String beanIdField_;
- /**
- * An array of String representing the fields in each bean
- */
+ /** An array of String representing the fields in each bean */
protected String[] beanField_;
- /**
- * An array of String representing the actions on each bean
- */
+ /** An array of String representing the actions on each bean */
protected String[] action_;
protected String classname_;
@@ -125,11 +115,18 @@
return method.invoke(bean, ReflectionUtil.EMPTY_ARGS);
}
+ public String getBeanIdFor(Object bean) throws Exception
+ {
+ return getFieldValue(bean, beanIdField_).toString();
+ }
+
@SuppressWarnings("unchecked")
public UIComponent findComponentById(String lookupId)
{
if (uiIterator_.getId().equals(lookupId))
+ {
return uiIterator_;
+ }
return super.findComponentById(lookupId);
}
14 years, 11 months
gatein SVN: r1271 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal.
by do-not-reply@jboss.org
Author: truong.le
Date: 2010-01-13 20:45:49 -0500 (Wed, 13 Jan 2010)
New Revision: 1271
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
Log:
GTNPORTAL-433: NPE when delete current portal in special case
Refactor to avoid duplicate messages.
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-01-14 00:10:26 UTC (rev 1270)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-01-14 01:45:49 UTC (rev 1271)
@@ -173,9 +173,6 @@
}
else
{
- UIApplication uiApp = prContext.getUIApplication();
- uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));
- prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
return;
}
14 years, 11 months
gatein SVN: r1270 - in portal/trunk/webui/core/src: test/java/org/exoplatform/webui/replication and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-13 19:10:26 -0500 (Wed, 13 Jan 2010)
New Revision: 1270
Removed:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataOutput.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/DataOutputImpl.java
Log:
remove unused class
Deleted: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataOutput.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataOutput.java 2010-01-13 23:44:52 UTC (rev 1269)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataOutput.java 2010-01-14 00:10:26 UTC (rev 1270)
@@ -1,35 +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.application.replication.serial;
-
-import java.io.Serializable;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public interface DataOutput
-{
-
- void writeInt(int i);
- void writeString(String s);
- void writeSerializable(Serializable serializable);
-
-}
Deleted: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/DataOutputImpl.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/DataOutputImpl.java 2010-01-13 23:44:52 UTC (rev 1269)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/DataOutputImpl.java 2010-01-14 00:10:26 UTC (rev 1270)
@@ -1,81 +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.replication;
-
-import junit.framework.Assert;
-import org.exoplatform.webui.application.replication.serial.DataOutput;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class DataOutputImpl implements DataOutput
-{
-
- /** . */
- private LinkedList<Object> stream = new LinkedList<Object>();
-
- public void writeInt(int i)
- {
- stream.add(0);
- stream.addLast(i);
- }
-
- public void writeString(String s)
- {
- stream.add(1);
- stream.addLast(s);
- }
-
- public void writeSerializable(Serializable serializable)
- {
- stream.add(2);
- stream.addLast(serializable);
- }
-
- public void assertEmpty()
- {
- Assert.assertEquals(0, stream.size());
- }
-
- public void assertInt(int i)
- {
- assertElement(0, i);
- }
-
- public void assertString(String s)
- {
- assertElement(1, s);
- }
-
- public void assertSerializable(Serializable s)
- {
- assertElement(2, s);
- }
-
- private void assertElement(int type, Object o)
- {
- Assert.assertEquals(type, stream.removeFirst());
- Assert.assertEquals(o, stream.removeFirst());
- }
-}
14 years, 11 months
gatein SVN: r1269 - in portal/trunk/webui/core/src: test/java/org/exoplatform/webui/replication and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-13 18:44:52 -0500 (Wed, 13 Jan 2010)
New Revision: 1269
Added:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataContainer.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/E.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
Log:
other impl of stream serialization
Added: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataContainer.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataContainer.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/DataContainer.java 2010-01-13 23:44:52 UTC (rev 1269)
@@ -0,0 +1,65 @@
+/*
+ * 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.application.replication.serial;
+
+import java.io.*;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DataContainer implements Serializable
+{
+
+ /** . */
+ private final LinkedList<Object> structure;
+
+ public DataContainer()
+ {
+ this.structure = new LinkedList<Object>();
+ }
+
+ public void writeInt(int i)
+ {
+ structure.add(i);
+ }
+
+ public void writeObject(Object o)
+ {
+ structure.add(o);
+ }
+
+ public int readInt()
+ {
+ return (Integer)structure.removeFirst();
+ }
+
+ public Object readObject()
+ {
+ return structure.removeFirst();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "DataContainer[" + structure + "]";
+ }
+}
Added: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectReader.java 2010-01-13 23:44:52 UTC (rev 1269)
@@ -0,0 +1,182 @@
+/*
+ * 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.application.replication.serial;
+
+import org.exoplatform.webui.application.replication.model.ClassTypeModel;
+import org.exoplatform.webui.application.replication.model.FieldModel;
+import org.exoplatform.webui.application.replication.model.TypeDomain;
+import org.exoplatform.webui.application.replication.model.TypeModel;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.util.*;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ObjectReader extends ObjectInputStream
+{
+
+ /** . */
+ private final TypeDomain domain;
+
+ /** . */
+ private final Map<Integer, Object> idToObject;
+
+ /** . */
+ private final Map<Integer, List<Resolution>> idToResolutions;
+
+ public ObjectReader(TypeDomain domain, InputStream in) throws IOException
+ {
+ super(in);
+
+ //
+ enableResolveObject(true);
+
+ //
+ this.domain = domain;
+ this.idToObject = new HashMap<Integer, Object>();
+ this.idToResolutions = new HashMap<Integer, List<Resolution>>();
+ }
+
+ @Override
+ protected Object resolveObject(Object obj) throws IOException
+ {
+ if (obj instanceof DataContainer)
+ {
+ DataContainer container = (DataContainer) obj;
+
+ int id;
+ switch (container.readInt())
+ {
+ case DataKind.OBJECT_REF:
+ id = container.readInt();
+ Object o1 = idToObject.get(id);
+ if (o1 == null)
+ {
+ throw new AssertionError();
+ }
+ return o1;
+ case DataKind.OBJECT:
+ id = container.readInt();
+ Class clazz = (Class) container.readObject();
+ Object instance;
+ try
+ {
+ instance = clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new AssertionError(e);
+ }
+ ClassTypeModel typeModel = (ClassTypeModel) domain.getTypeModel(clazz);
+ idToObject.put(id, instance);
+
+ //
+ ClassTypeModel currentTypeModel = typeModel;
+ while (true)
+ {
+ for (FieldModel fieldModel : (currentTypeModel).getFields())
+ {
+ switch (container.readInt())
+ {
+ case DataKind.NULL_VALUE:
+ fieldModel.setValue(instance, null);
+ break;
+ case DataKind.OBJECT_REF:
+ int refId = container.readInt();
+ Object refO = idToObject.get(refId);
+ if (refO != null)
+ {
+ fieldModel.setValue(instance, refO);
+ }
+ else
+ {
+ List<Resolution> resolutions = idToResolutions.get(refId);
+ if (resolutions == null)
+ {
+ resolutions = new ArrayList<Resolution>();
+ idToResolutions.put(refId, resolutions);
+ }
+ resolutions.add(new Resolution(instance, fieldModel));
+ }
+ break;
+ case DataKind.OBJECT:
+ Object o = container.readObject();
+ fieldModel.setValue(instance, o);
+ break;
+
+ }
+ }
+ TypeModel currentSuperTypeModel = currentTypeModel.getSuperType();
+ if (currentSuperTypeModel == null)
+ {
+ break;
+ }
+ if (currentSuperTypeModel instanceof ClassTypeModel)
+ {
+ currentTypeModel = (ClassTypeModel)currentSuperTypeModel;
+ }
+ else
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ //
+ List<Resolution> resolutions = idToResolutions.remove(id);
+ if (resolutions != null)
+ {
+ for (Resolution resolution : resolutions)
+ {
+ resolution.fieldModel.setValue(resolution.target, instance);
+ }
+ }
+
+ //
+ return instance;
+ default:
+ throw new AssertionError();
+ }
+ }
+ else
+ {
+ return obj;
+ }
+ }
+
+ private static class Resolution
+ {
+ /** . */
+ private final Object target;
+
+ /** . */
+ private final FieldModel fieldModel;
+
+ private Resolution(Object target, FieldModel fieldModel)
+ {
+ this.target = target;
+ this.fieldModel = fieldModel;
+ }
+ }
+
+}
Added: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-13 23:44:52 UTC (rev 1269)
@@ -0,0 +1,146 @@
+/*
+ * 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.application.replication.serial;
+
+import org.exoplatform.webui.application.replication.model.ClassTypeModel;
+import org.exoplatform.webui.application.replication.model.FieldModel;
+import org.exoplatform.webui.application.replication.model.TypeDomain;
+import org.exoplatform.webui.application.replication.model.TypeModel;
+
+import java.io.*;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ObjectWriter extends ObjectOutputStream
+{
+
+ /** . */
+ private final TypeDomain domain;
+
+ /** . */
+ private final IdentityHashMap<Object, Integer> objectToId;
+
+ public ObjectWriter(TypeDomain domain, OutputStream out) throws IOException
+ {
+ super(out);
+
+ //
+ enableReplaceObject(true);
+
+ //
+ this.domain = domain;
+ this.objectToId = new IdentityHashMap<Object, Integer>();
+ }
+
+ private int register(Object o)
+ {
+ int nextId = objectToId.size();
+ objectToId.put(o, nextId);
+ return nextId;
+ }
+
+ @Override
+ protected Object replaceObject(Object obj) throws IOException
+ {
+ if (obj instanceof Serializable)
+ {
+ return obj;
+ }
+
+ //
+ DataContainer output = new DataContainer();
+
+ //
+ Integer id = objectToId.get(obj);
+ if (id != null)
+ {
+ output.writeInt(DataKind.OBJECT_REF);
+ output.writeObject(id);
+ }
+ else
+ {
+ ClassTypeModel typeModel = (ClassTypeModel) domain.getTypeModel(obj.getClass());
+
+ //
+ if (typeModel == null)
+ {
+ throw new NotSerializableException("Object " + obj + " is not serializable");
+ }
+
+ //
+ output.writeInt(DataKind.OBJECT);
+ output.writeInt(register(obj));
+ output.writeObject(obj.getClass());
+
+ //
+ ClassTypeModel currentTypeModel = typeModel;
+ while (true)
+ {
+ for (FieldModel fieldModel : (currentTypeModel).getFields())
+ {
+ Object fieldValue = fieldModel.getValue(obj);
+ if (fieldValue == null)
+ {
+ output.writeObject(DataKind.NULL_VALUE);
+ }
+ else
+ {
+ Integer fieldValueId = objectToId.get(fieldValue);
+ if (fieldValueId != null)
+ {
+ output.writeObject(DataKind.OBJECT_REF);
+ output.writeInt(fieldValueId);
+ }
+ else
+ {
+ output.writeObject(DataKind.OBJECT);
+ output.writeObject(fieldValue);
+ }
+ }
+ }
+
+ //
+ TypeModel currentSuperTypeModel = currentTypeModel.getSuperType();
+ if (currentSuperTypeModel == null)
+ {
+ break;
+ }
+
+ //
+ if (currentSuperTypeModel instanceof ClassTypeModel)
+ {
+ currentTypeModel = (ClassTypeModel)currentSuperTypeModel;
+ }
+ else
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+ }
+
+ //
+ return output;
+ }
+}
\ No newline at end of file
Added: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/E.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/E.java (rev 0)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/E.java 2010-01-13 23:44:52 UTC (rev 1269)
@@ -0,0 +1,35 @@
+/*
+ * 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.replication;
+
+import org.exoplatform.webui.application.replication.annotations.ReplicatedType;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+@ReplicatedType
+public class E
+{
+
+ E left;
+ E right;
+
+}
Added: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java (rev 0)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-13 23:44:52 UTC (rev 1269)
@@ -0,0 +1,92 @@
+/*
+ * 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.replication;
+
+import junit.framework.TestCase;
+import org.exoplatform.webui.application.replication.model.TypeDomain;
+import org.exoplatform.webui.application.replication.serial.ObjectReader;
+import org.exoplatform.webui.application.replication.serial.ObjectWriter;
+
+import java.io.*;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestSerialization extends TestCase
+{
+
+ public void testBar() throws Exception
+ {
+ TypeDomain domain = new TypeDomain();
+ domain.add(A.class);
+ A a = new A();
+ a.a = "foo";
+ a.b = 2;
+ a.c = true;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectWriter writer = new ObjectWriter(domain, baos);
+ writer.writeObject(a);
+ writer.close();
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectReader in = new ObjectReader(domain, bais);
+ a = (A)in.readObject();
+ assertEquals("foo", a.a);
+ assertEquals(2, a.b);
+ assertEquals(true, a.c);
+ }
+
+ public void testFoo() throws Exception
+ {
+ TypeDomain domain = new TypeDomain();
+ domain.add(B.class);
+ B b = new B();
+ b.ref = new B(b);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectWriter writer = new ObjectWriter(domain, baos);
+ writer.writeObject(b);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectReader in = new ObjectReader(domain, bais);
+ b = (B)in.readObject();
+ assertNotNull(b.ref);
+ assertSame(b, b.ref.ref);
+ }
+
+ public void testAAA() throws Exception
+ {
+ TypeDomain domain = new TypeDomain();
+ domain.add(E.class);
+ E e = new E();
+ e.left = new E();
+ e.left.left = new E();
+ e.left.right = new E();
+ e.right = new E();
+ e.right.left = e.left.left;
+ e.right.right = e.left.right;
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectWriter writer = new ObjectWriter(domain, baos);
+ writer.writeObject(e);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectReader in = new ObjectReader(domain, bais);
+ e = (E)in.readObject();
+ assertSame(e.left.left, e.right.left);
+ assertSame(e.left.right, e.right.right);
+ }
+}
14 years, 11 months
gatein SVN: r1268 - in portal/trunk/webui/core/src: main/java/org/exoplatform/webui/application/replication/serial and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-13 18:40:46 -0500 (Wed, 13 Jan 2010)
New Revision: 1268
Removed:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java
portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/A.java
Log:
remove wrong impl for now
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java 2010-01-13 22:19:50 UTC (rev 1267)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/model/FieldModel.java 2010-01-13 23:40:46 UTC (rev 1268)
@@ -25,32 +25,52 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
* @version $Revision$
*/
-public class FieldModel {
+public class FieldModel
+{
- /** . */
- private final Field field;
+ /** . */
+ private final Field field;
- /** . */
- private final TypeModel type;
+ /** . */
+ private final TypeModel type;
- public FieldModel(Field field, TypeModel type) {
- this.field = field;
- this.type = type;
- }
+ public FieldModel(Field field, TypeModel type)
+ {
+ this.field = field;
+ this.type = type;
+ }
- public String getName() {
- return field.getName();
- }
+ public String getName()
+ {
+ return field.getName();
+ }
- public TypeModel getType() {
- return type;
- }
+ public TypeModel getType()
+ {
+ return type;
+ }
- public Object getValue(Object o) {
- try {
- return field.get(o);
- } catch (IllegalAccessException e) {
- throw new AssertionError(e);
- }
- }
+ public Object getValue(Object o)
+ {
+ try
+ {
+ return field.get(o);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new AssertionError(e);
+ }
+ }
+
+ public void setValue(Object o, Object value)
+ {
+ try
+ {
+ field.set(o, value);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new AssertionError(e);
+ }
+ }
}
Deleted: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-13 22:19:50 UTC (rev 1267)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/serial/ObjectWriter.java 2010-01-13 23:40:46 UTC (rev 1268)
@@ -1,127 +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.application.replication.serial;
-
-import org.exoplatform.webui.application.replication.model.ClassTypeModel;
-import org.exoplatform.webui.application.replication.model.FieldModel;
-import org.exoplatform.webui.application.replication.model.TypeDomain;
-import org.exoplatform.webui.application.replication.model.TypeModel;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ObjectWriter
-{
-
- /** . */
- private final TypeDomain domain;
-
- /** . */
- private final IdentityHashMap<Object, Integer> objectToId;
-
- /** . */
- private final Map<Integer, Object> idToObject;
-
- public ObjectWriter(TypeDomain domain)
- {
- this.domain = domain;
- this.objectToId = new IdentityHashMap<Object, Integer>();
- this.idToObject = new HashMap<Integer, Object>();
- }
-
- private int register(Object o)
- {
- int nextId = objectToId.size();
- objectToId.put(o, nextId);
- idToObject.put(nextId, o);
- return nextId;
- }
-
- public void write(Object o, DataOutput output)
- {
- if (o == null)
- {
- output.writeInt(DataKind.NULL_VALUE);
- }
- else
- {
- Integer id = objectToId.get(o);
- if (id != null)
- {
- output.writeInt(DataKind.OBJECT_REF);
- output.writeInt(id);
- }
- else
- {
- TypeModel typeModel = domain.getTypeModel(o.getClass());
- if (typeModel instanceof ClassTypeModel)
- {
- ClassTypeModel classTypeModel = (ClassTypeModel)typeModel;
-
- //
- output.writeInt(DataKind.OBJECT);
- output.writeInt(register(o));
- output.writeSerializable(o.getClass());
-
- //
- ClassTypeModel currentTypeModel = classTypeModel;
- while (true)
- {
- for (FieldModel fieldModel : (currentTypeModel).getFields())
- {
- Object fieldValue = fieldModel.getValue(o);
- write(fieldValue, output);
- }
- TypeModel currentSuperTypeModel = currentTypeModel.getSuperType();
- if (currentSuperTypeModel == null)
- {
- break;
- }
- if (currentSuperTypeModel instanceof ClassTypeModel)
- {
- currentTypeModel = (ClassTypeModel)currentSuperTypeModel;
- }
- else
- {
- output.writeInt(DataKind.SERIALIZABLE_OBJECT);
- output.writeSerializable((Serializable)o);
- break;
- }
- }
- }
- else if (o instanceof Serializable)
- {
- output.writeInt(DataKind.SERIALIZABLE_OBJECT);
- output.writeSerializable((Serializable)o);
- }
- else
- {
- throw new IllegalArgumentException();
- }
- }
- }
- }
-}
Modified: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/A.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/A.java 2010-01-13 22:19:50 UTC (rev 1267)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/A.java 2010-01-13 23:40:46 UTC (rev 1268)
@@ -28,8 +28,8 @@
@ReplicatedType
public class A {
- String a = "a";
- int b = 2;
- boolean c = true;
+ String a;
+ int b;
+ boolean c;
}
Deleted: portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java
===================================================================
--- portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-13 22:19:50 UTC (rev 1267)
+++ portal/trunk/webui/core/src/test/java/org/exoplatform/webui/replication/TestSerialization.java 2010-01-13 23:40:46 UTC (rev 1268)
@@ -1,129 +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.replication;
-
-import junit.framework.TestCase;
-import org.exoplatform.webui.application.replication.model.TypeDomain;
-import org.exoplatform.webui.application.replication.serial.DataKind;
-import org.exoplatform.webui.application.replication.serial.ObjectWriter;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestSerialization extends TestCase
-{
-
- public void testBar()
- {
- TypeDomain domain = new TypeDomain();
- domain.add(A.class);
- A a = new A();
- ObjectWriter writer = new ObjectWriter(domain);
- DataOutputImpl output = new DataOutputImpl();
- writer.write(a, output);
- output.assertInt(DataKind.OBJECT);
- output.assertInt(0);
- output.assertSerializable(A.class);
- output.assertInt(DataKind.SERIALIZABLE_OBJECT);
- output.assertSerializable("a");
- output.assertInt(DataKind.SERIALIZABLE_OBJECT);
- output.assertSerializable(2);
- output.assertInt(DataKind.SERIALIZABLE_OBJECT);
- output.assertSerializable(true);
- output.assertEmpty();
-
- //
- writer.write(a, output);
- output.assertInt(DataKind.OBJECT_REF);
- output.assertInt(0);
- output.assertEmpty();
- }
-
- public void testFoo()
- {
- TypeDomain domain = new TypeDomain();
- domain.add(B.class);
-
- B b = new B();
- B b2 = new B(b);
- b.ref = b2;
-
- ObjectWriter writer = new ObjectWriter(domain);
- DataOutputImpl output = new DataOutputImpl();
- writer.write(b, output);
-
- output.assertInt(DataKind.OBJECT);
- output.assertInt(0);
- output.assertSerializable(B.class);
-
- output.assertInt(DataKind.OBJECT);
- output.assertInt(1);
- output.assertSerializable(B.class);
-
- output.assertInt(DataKind.OBJECT_REF);
- output.assertInt(0);
- output.assertEmpty();
- }
-
- public void testJuu()
- {
- TypeDomain domain = new TypeDomain();
- domain.add(C2.class);
-
- C2 c = new C2();
-
- ObjectWriter writer = new ObjectWriter(domain);
- DataOutputImpl output = new DataOutputImpl();
- writer.write(c, output);
-
- output.assertInt(DataKind.OBJECT);
- output.assertInt(0);
- output.assertSerializable(C2.class);
-
- output.assertInt(DataKind.SERIALIZABLE_OBJECT);
- output.assertSerializable("a2");
- output.assertInt(DataKind.SERIALIZABLE_OBJECT);
- output.assertSerializable("a1");
- output.assertEmpty();
- }
-
- public void testDaa()
- {
- TypeDomain domain = new TypeDomain();
- domain.add(D.class);
-
- D c = new D();
-
- ObjectWriter writer = new ObjectWriter(domain);
- DataOutputImpl output = new DataOutputImpl();
- writer.write(c, output);
-
- output.assertInt(DataKind.OBJECT);
- output.assertInt(0);
- output.assertSerializable(D.class);
-
- output.assertInt(DataKind.SERIALIZABLE_OBJECT);
- output.assertSerializable("a");
- output.assertInt(DataKind.SERIALIZABLE_OBJECT);
- output.assertSerializable(c);
- output.assertEmpty();
- }
-}
14 years, 11 months
gatein SVN: r1267 - in portal/trunk/portlet/exoadmin/src/main: webapp/groovy/wsrp/webui/component and 1 other directory.
by do-not-reply@jboss.org
Author: wesleyhales
Date: 2010-01-13 17:19:50 -0500 (Wed, 13 Jan 2010)
New Revision: 1267
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerPropertyEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
Log:
Revert recent changes and fixed bugs from previous checked in code.
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-13 19:27:29 UTC (rev 1266)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-13 22:19:50 UTC (rev 1267)
@@ -25,10 +25,8 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
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.UIApplication;
-import org.exoplatform.webui.core.UIGrid;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -42,23 +40,19 @@
* @author Wesley Hales
* @author Chris Laprun
*/
-@ComponentConfigs({
- @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
- @ComponentConfig(
- lifecycle = UIFormLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
- events = {
- @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
- }
- )
-})
+@ComponentConfig(
+ lifecycle = UIFormLifecycle.class,
+ template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
+ events = {
+ @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
+ }
+)
public class UIWsrpProducerEditor extends UIForm
{
private static final String REG_REQUIRED_FOR_DESCRIPTION = "registrationrequiredforfulldescription";
private static final String STRICT_MODE = "strictmode";
private static final String REQUIRES_REGISTRATION = "requiresregistration";
private static final String REGISTRATION_DETAILS = "registrationdetails";
- static final String REGISTRATION_PROPERTIES = "RegistrationPropertySelector";
private ProducerConfigurationService configService;
private UIWsrpRegistrationDetails registrationDetails;
@@ -66,15 +60,6 @@
private UIFormCheckBoxInput strictMode;
private UIFormCheckBoxInput<Boolean> regRequired;
- private UIGrid registrationProperties;
-
- public UIGrid getRegistrationProperties() throws Exception
- {
- return createUIComponent(UIGrid.class, REGISTRATION_PROPERTIES, REGISTRATION_PROPERTIES);
- }
-
-
-
public UIWsrpProducerEditor() throws Exception
{
configService = Util.getUIPortalApplication().getApplicationComponent(ProducerConfigurationService.class);
@@ -94,8 +79,7 @@
// registration details
// form set to gather registration information
- registrationDetails = new UIWsrpRegistrationDetails(REGISTRATION_DETAILS, this);
- addUIFormInput(registrationDetails);
+ registrationDetails = addChild(UIWsrpRegistrationDetails.class,null,null);
init();
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerPropertyEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerPropertyEditor.java 2010-01-13 19:27:29 UTC (rev 1266)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerPropertyEditor.java 2010-01-13 22:19:50 UTC (rev 1267)
@@ -42,7 +42,8 @@
/** @author Wesley Hales */
-@ComponentConfig(template = "app:/groovy/wsrp/webui/component/UIWsrpProducerPropertyEditor.gtmpl", lifecycle = UIFormLifecycle.class, events = {
+@ComponentConfig(template = "app:/groovy/wsrp/webui/component/UIWsrpProducerPropertyEditor.gtmpl", lifecycle = UIFormLifecycle.class,
+ events = {
@EventConfig(listeners = UIWsrpProducerPropertyEditor.SaveActionListener.class)})
public class UIWsrpProducerPropertyEditor extends UIForm
{
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 19:27:29 UTC (rev 1266)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 22:19:50 UTC (rev 1267)
@@ -25,6 +25,7 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -35,6 +36,7 @@
import org.exoplatform.webui.core.UIGrid;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
+import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.core.renderers.ValueRenderer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -63,31 +65,31 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-
-@ComponentConfig(
- lifecycle = UIApplicationLifecycle.class,
- events = {
- @EventConfig(listeners = UIWsrpRegistrationDetails.AddPropertyActionListener.class),
- @EventConfig(listeners = UIWsrpRegistrationDetails.EditPropertyActionListener.class),
- @EventConfig(listeners = UIWsrpRegistrationDetails.DeletePropertyActionListener.class)
- })
-
-public class UIWsrpRegistrationDetails extends UIFormInputSet
+@ComponentConfigs({
+ @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
+ @ComponentConfig(
+ lifecycle = UIFormLifecycle.class,
+ events = {
+ @EventConfig(listeners = UIWsrpRegistrationDetails.AddPropertyActionListener.class),
+ @EventConfig(listeners = UIWsrpRegistrationDetails.EditPropertyActionListener.class),
+ @EventConfig(listeners = UIWsrpRegistrationDetails.DeletePropertyActionListener.class)
+ })
+})
+public class UIWsrpRegistrationDetails extends UIForm
{
private UIFormInputBase<String> policy;
private UIFormInputBase<String> validator;
private UIGrid registrationProperties;
- static String[] FIELDS = {"key","name", "description", "label", "hint"};
- static String[] SELECT_ACTIONS = {"AddProperty", "EditProperty", "DeleteProperty"};
+ static String[] FIELDS = {"key", "name", "description", "label", "hint"};
+ static String[] SELECT_ACTIONS = {"EditProperty", "DeleteProperty"};
static final String POLICY_CLASS = "policyClassName";
static final String VALIDATOR_CLASS = "validatorClassName";
static final String REGISTRATION_PROPERTIES = "RegistrationPropertySelector";
static final String REGISTRATION_PROPERTIES_ITERATOR = "ProducerPropPageIterator";
-
- public UIWsrpRegistrationDetails(String name, UIWsrpProducerEditor parent) throws Exception
+ public UIWsrpRegistrationDetails() throws Exception
{
- super(name);
+ //super(name);
// policy
policy = new UIFormStringInput(POLICY_CLASS, POLICY_CLASS, null);
@@ -96,11 +98,9 @@
// validator
validator = new UIFormStringInput(VALIDATOR_CLASS, VALIDATOR_CLASS, null);
addUIFormInput(validator);
- addChild(parent.getRegistrationProperties());
- registrationProperties = getChildById(REGISTRATION_PROPERTIES);
+
// registration properties
- //registrationProperties.setComponentConfig(UIGrid.class,REGISTRATION_PROPERTIES);
- //registrationProperties = createUIComponent(UIGrid.class, null, null);
+ registrationProperties = addChild(UIGrid.class, REGISTRATION_PROPERTIES, REGISTRATION_PROPERTIES);
// add renderer for LocalizedString
ValueRenderer<LocalizedString> renderer = new ValueRenderer<LocalizedString>()
@@ -119,7 +119,7 @@
registrationProperties.getUIPageIterator().setRendered(false);
addChild(registrationProperties.getUIPageIterator());
- init(parent.getService().getConfiguration().getRegistrationRequirements());
+ init(getService().getConfiguration().getRegistrationRequirements());
//add the popup for property edit and adding new properties
UIPopupWindow popup = addChild(UIPopupWindow.class, null, null);
@@ -152,6 +152,11 @@
registrationProperties.getUIPageIterator().setPageList(createPageList(getPropertyList(regProps)));
}
+ ProducerConfigurationService getService()
+ {
+ return Util.getUIPortalApplication().getApplicationComponent(ProducerConfigurationService.class);
+ }
+
private List<RegistrationPropertyDescription> getPropertyList(Map<QName, RegistrationPropertyDescription> descriptions) throws Exception
{
Comparator<RegistrationPropertyDescription> descComparator = new Comparator<RegistrationPropertyDescription>()
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-13 19:27:29 UTC (rev 1266)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-13 22:19:50 UTC (rev 1267)
@@ -1,5 +1,6 @@
<%
import org.exoplatform.wsrp.webui.component.UIWsrpProducerEditor;
+ import org.exoplatform.wsrp.webui.component.UIWsrpRegistrationDetails;
%>
<div class="<%=uicomponent.getId()%>" id="<%=uicomponent.getId()%>">
@@ -12,11 +13,11 @@
<table class="ActionContainer">
<tr>
<td>
- <div onclick="<%=uicomponent.event("AddProperty")%>" class="ActionButton LightBlueStyle">
+ <div onclick="<%=uicomponent.getChild(UIWsrpProducerEditor.class).getChild(UIWsrpRegistrationDetails.class).event("Add")%>" class="ActionButton LightBlueStyle">
<div class="ButtonLeft">
<div class="ButtonRight">
<div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() + ".action.AddProperty")%></a>
+ <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getChild(UIWsrpProducerEditor.class).getChild(UIWsrpRegistrationDetails.class).getId() + ".action.Add")%></a>
</div>
</div>
</div>
14 years, 11 months
gatein SVN: r1266 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component.
by do-not-reply@jboss.org
Author: wesleyhales
Date: 2010-01-13 14:27:29 -0500 (Wed, 13 Jan 2010)
New Revision: 1266
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
Log:
add key column back to grid for now
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 19:09:03 UTC (rev 1265)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 19:27:29 UTC (rev 1266)
@@ -77,7 +77,7 @@
private UIFormInputBase<String> policy;
private UIFormInputBase<String> validator;
private UIGrid registrationProperties;
- static String[] FIELDS = {"name", "description", "label", "hint"};
+ static String[] FIELDS = {"key","name", "description", "label", "hint"};
static String[] SELECT_ACTIONS = {"AddProperty", "EditProperty", "DeleteProperty"};
static final String POLICY_CLASS = "policyClassName";
static final String VALIDATOR_CLASS = "validatorClassName";
@@ -114,7 +114,7 @@
registrationProperties.registerRendererFor(renderer, LocalizedString.class);
//configure the edit and delete buttons based on an id from the data list - this will also be passed as param to listener
- registrationProperties.configure("name", FIELDS, SELECT_ACTIONS);
+ registrationProperties.configure("key", FIELDS, SELECT_ACTIONS);
registrationProperties.getUIPageIterator().setId(REGISTRATION_PROPERTIES_ITERATOR);
registrationProperties.getUIPageIterator().setRendered(false);
addChild(registrationProperties.getUIPageIterator());
14 years, 11 months
gatein SVN: r1265 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component.
by do-not-reply@jboss.org
Author: wesleyhales
Date: 2010-01-13 14:09:03 -0500 (Wed, 13 Jan 2010)
New Revision: 1265
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
Log:
forgot to add as child
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 19:03:17 UTC (rev 1264)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 19:09:03 UTC (rev 1265)
@@ -96,7 +96,8 @@
// validator
validator = new UIFormStringInput(VALIDATOR_CLASS, VALIDATOR_CLASS, null);
addUIFormInput(validator);
- registrationProperties = parent.getRegistrationProperties();
+ addChild(parent.getRegistrationProperties());
+ registrationProperties = getChildById(REGISTRATION_PROPERTIES);
// registration properties
//registrationProperties.setComponentConfig(UIGrid.class,REGISTRATION_PROPERTIES);
//registrationProperties = createUIComponent(UIGrid.class, null, null);
14 years, 11 months
gatein SVN: r1264 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component.
by do-not-reply@jboss.org
Author: wesleyhales
Date: 2010-01-13 14:03:17 -0500 (Wed, 13 Jan 2010)
New Revision: 1264
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
Log:
trying to fix issue with UIGrid in producerRegistrationDetails
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-13 18:40:06 UTC (rev 1263)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java 2010-01-13 19:03:17 UTC (rev 1264)
@@ -25,8 +25,10 @@
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
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.UIApplication;
+import org.exoplatform.webui.core.UIGrid;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -40,19 +42,23 @@
* @author Wesley Hales
* @author Chris Laprun
*/
-@ComponentConfig(
- lifecycle = UIFormLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
- events = {
- @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
- }
-)
+@ComponentConfigs({
+ @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
+ @ComponentConfig(
+ lifecycle = UIFormLifecycle.class,
+ template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
+ events = {
+ @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
+ }
+ )
+})
public class UIWsrpProducerEditor extends UIForm
{
private static final String REG_REQUIRED_FOR_DESCRIPTION = "registrationrequiredforfulldescription";
private static final String STRICT_MODE = "strictmode";
private static final String REQUIRES_REGISTRATION = "requiresregistration";
private static final String REGISTRATION_DETAILS = "registrationdetails";
+ static final String REGISTRATION_PROPERTIES = "RegistrationPropertySelector";
private ProducerConfigurationService configService;
private UIWsrpRegistrationDetails registrationDetails;
@@ -60,6 +66,15 @@
private UIFormCheckBoxInput strictMode;
private UIFormCheckBoxInput<Boolean> regRequired;
+ private UIGrid registrationProperties;
+
+ public UIGrid getRegistrationProperties() throws Exception
+ {
+ return createUIComponent(UIGrid.class, REGISTRATION_PROPERTIES, REGISTRATION_PROPERTIES);
+ }
+
+
+
public UIWsrpProducerEditor() throws Exception
{
configService = Util.getUIPortalApplication().getApplicationComponent(ProducerConfigurationService.class);
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 18:40:06 UTC (rev 1263)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java 2010-01-13 19:03:17 UTC (rev 1264)
@@ -63,16 +63,15 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-@ComponentConfigs({
- @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
- @ComponentConfig(
- lifecycle = UIApplicationLifecycle.class,
- events = {
- @EventConfig(listeners = UIWsrpRegistrationDetails.AddPropertyActionListener.class),
- @EventConfig(listeners = UIWsrpRegistrationDetails.EditPropertyActionListener.class),
- @EventConfig(listeners = UIWsrpRegistrationDetails.DeletePropertyActionListener.class)
- })
-})
+
+@ComponentConfig(
+ lifecycle = UIApplicationLifecycle.class,
+ events = {
+ @EventConfig(listeners = UIWsrpRegistrationDetails.AddPropertyActionListener.class),
+ @EventConfig(listeners = UIWsrpRegistrationDetails.EditPropertyActionListener.class),
+ @EventConfig(listeners = UIWsrpRegistrationDetails.DeletePropertyActionListener.class)
+ })
+
public class UIWsrpRegistrationDetails extends UIFormInputSet
{
private UIFormInputBase<String> policy;
@@ -85,6 +84,7 @@
static final String REGISTRATION_PROPERTIES = "RegistrationPropertySelector";
static final String REGISTRATION_PROPERTIES_ITERATOR = "ProducerPropPageIterator";
+
public UIWsrpRegistrationDetails(String name, UIWsrpProducerEditor parent) throws Exception
{
super(name);
@@ -96,9 +96,10 @@
// validator
validator = new UIFormStringInput(VALIDATOR_CLASS, VALIDATOR_CLASS, null);
addUIFormInput(validator);
-
+ registrationProperties = parent.getRegistrationProperties();
// registration properties
- registrationProperties = addChild(UIGrid.class, REGISTRATION_PROPERTIES, REGISTRATION_PROPERTIES);
+ //registrationProperties.setComponentConfig(UIGrid.class,REGISTRATION_PROPERTIES);
+ //registrationProperties = createUIComponent(UIGrid.class, null, null);
// add renderer for LocalizedString
ValueRenderer<LocalizedString> renderer = new ValueRenderer<LocalizedString>()
14 years, 11 months
gatein SVN: r1263 - portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component.
by do-not-reply@jboss.org
Author: wesleyhales
Date: 2010-01-13 13:40:06 -0500 (Wed, 13 Jan 2010)
New Revision: 1263
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
Log:
Touch ups for consumer ui - reset the form when adding new and better messages
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2010-01-13 17:34:03 UTC (rev 1262)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2010-01-13 18:40:06 UTC (rev 1263)
@@ -180,6 +180,7 @@
UIWsrpConsumerEditor editor = (UIWsrpConsumerEditor)popup.getUIComponent();
//reset the form
+ editor.reset();
editor.setConsumer(null);
popup.setRendered(true);
popup.setShow(true);
@@ -252,12 +253,19 @@
WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
UIApplication uiApp = event.getRequestContext().getUIApplication();
- if (consumer != null && consumer.isActive())
+ if (consumer != null)
{
- ConsumerRegistry registry = consumerOverview.getConsumerRegistry();
- registry.deactivateConsumerWith(consumer.getProducerId());
- uiApp.addMessage(new ApplicationMessage("Consumer successfully deactivated", null));
- consumerOverview.refreshGrid(event);
+ if (consumer.isActive())
+ {
+ ConsumerRegistry registry = consumerOverview.getConsumerRegistry();
+ registry.deactivateConsumerWith(consumer.getProducerId());
+ uiApp.addMessage(new ApplicationMessage("Consumer successfully deactivated", null));
+ consumerOverview.refreshGrid(event);
+ }
+ else
+ {
+ uiApp.addMessage(new ApplicationMessage("Consumer Must be Active to Deactivate", null));
+ }
}
}
}
@@ -272,10 +280,18 @@
if (consumer != null && !consumer.isActive())
{
- ConsumerRegistry registry = consumerOverview.getConsumerRegistry();
- registry.activateConsumerWith(consumer.getProducerId());
- uiApp.addMessage(new ApplicationMessage("Consumer successfully activated", null));
- consumerOverview.refreshGrid(event);
+ try
+ {
+ ConsumerRegistry registry = consumerOverview.getConsumerRegistry();
+ registry.activateConsumerWith(consumer.getProducerId());
+ uiApp.addMessage(new ApplicationMessage("Consumer successfully activated", null));
+ consumerOverview.refreshGrid(event);
+ }
+ catch (Exception e)
+ {
+ uiApp.addMessage(new ApplicationMessage("Problem Activating Consumer: " + e.getCause(), null, ApplicationMessage.ERROR));
+ e.printStackTrace();
+ }
}
}
}
@@ -305,7 +321,7 @@
// refresh had issues, we should deactivate this consumer
registry.deactivateConsumerWith(consumer.getProducerId());
- uiApp.addMessage(new ApplicationMessage("Consumer refresh resulted in errors that need to be fixed", null, ApplicationMessage.ERROR));
+ uiApp.addMessage(new ApplicationMessage("Consumer refresh resulted in errors that need to be fixed: " + result.getStatus().toString(), null, ApplicationMessage.ERROR));
}
else
{
@@ -318,14 +334,14 @@
{
registry.deactivateConsumerWith(consumer.getProducerId());
}
- uiApp.addMessage(new ApplicationMessage("Consumer Refreshed Successfully", null));
+ uiApp.addMessage(new ApplicationMessage("Consumer Refreshed Successfully", null, ApplicationMessage.INFO));
}
consumerOverview.refreshGrid(event);
}
}
catch (Exception e)
{
- uiApp.addMessage(new ApplicationMessage("Failed to refresh Consumer", null, ApplicationMessage.ERROR));
+ uiApp.addMessage(new ApplicationMessage("Failed to refresh Consumer: " + e.getCause(), null, ApplicationMessage.ERROR));
e.printStackTrace();
}
}
14 years, 11 months