JBoss Portal SVN: r9286 - in tags/JBoss_Portal_2_6_3/core/src: main/org/jboss/portal/core/aspects/server and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-04 12:32:48 -0500 (Tue, 04 Dec 2007)
New Revision: 9286
Added:
tags/JBoss_Portal_2_6_3/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java
Modified:
tags/JBoss_Portal_2_6_3/core/src/bin/portal-core-war/layouts/common/modal.jsp
tags/JBoss_Portal_2_6_3/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
- Adding a server interceptor to stick the portal context path into the request
- Fix the modal login window so that it works with other portal context path
Modified: tags/JBoss_Portal_2_6_3/core/src/bin/portal-core-war/layouts/common/modal.jsp
===================================================================
--- tags/JBoss_Portal_2_6_3/core/src/bin/portal-core-war/layouts/common/modal.jsp 2007-12-04 17:30:19 UTC (rev 9285)
+++ tags/JBoss_Portal_2_6_3/core/src/bin/portal-core-war/layouts/common/modal.jsp 2007-12-04 17:32:48 UTC (rev 9286)
@@ -1,3 +1,5 @@
+<%@page import="org.jboss.portal.server.ServerURL"%>
+<%@page import="org.jboss.portal.server.AbstractServerURL"%>
<script src="<%=request.getContextPath()%>/js/modal.js" type="text/javascript"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/modal.css" type="text/css" />
<div id="login-modal" style="display:none">
@@ -3,5 +5,5 @@
<div id="login-modal-msg" style="display:none;width:257px;height:157px">
<% String loginHeight = "100%"; %>
- <iframe src="/portal/auth/?loginheight=0" frameborder="0" width="257" height="157" scrolling="no" marginheight="0" marginwidth="0" name="login-content" class="login-content"></iframe>
+ <iframe src="<%=request.getAttribute("org.jboss.portal.PORTAL_CONTEXT_PATH")%>/auth/?loginheight=0" frameborder="0" width="257" height="157" scrolling="no" marginheight="0" marginwidth="0" name="login-content" class="login-content"></iframe>
</div>
</div>
\ No newline at end of file
Copied: tags/JBoss_Portal_2_6_3/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java (from rev 9285, branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java)
===================================================================
--- tags/JBoss_Portal_2_6_3/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java (rev 0)
+++ tags/JBoss_Portal_2_6_3/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java 2007-12-04 17:32:48 UTC (rev 9286)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.core.aspects.server;
+
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.server.ServerInterceptor;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortalContextPathInterceptor extends ServerInterceptor
+{
+
+ @Override
+ protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
+ {
+ ServerInvocationContext serverContext = invocation.getServerContext();
+ String url = serverContext.getPortalContextPath();
+
+ invocation.getServerContext().setAttribute(ServerInvocation.REQUEST_SCOPE, "org.jboss.portal.PORTAL_CONTEXT_PATH", url);
+
+ invocation.invokeNext();
+
+ }
+
+}
+
Modified: tags/JBoss_Portal_2_6_3/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- tags/JBoss_Portal_2_6_3/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-12-04 17:30:19 UTC (rev 9285)
+++ tags/JBoss_Portal_2_6_3/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-12-04 17:32:48 UTC (rev 9286)
@@ -141,6 +141,13 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.core.aspects.server.PortalContextPathInterceptor"
+ name="portal:service=Interceptor,type=Server,name=PortalContextPath"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.server.aspects.server.ContentTypeInterceptor"
name="portal:service=Interceptor,type=Server,name=ContentType"
xmbean-dd=""
@@ -160,6 +167,7 @@
<depends-list-element>portal:service=Interceptor,type=Server,name=SessionInvalidator</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=User</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=Locale</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Server,name=PortalContextPath</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=ContentType</depends-list-element>
</depends-list>
</mbean>
16 years, 6 months
JBoss Portal SVN: r9285 - in branches/JBoss_Portal_Branch_2_6/core/src: main/org/jboss/portal/core/aspects/server and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-04 12:30:19 -0500 (Tue, 04 Dec 2007)
New Revision: 9285
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/bin/portal-core-war/layouts/common/modal.jsp
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
- Adding a server interceptor to stick the portal context path into the request
- Fix the modal login window so that it works with other portal context path
Modified: branches/JBoss_Portal_Branch_2_6/core/src/bin/portal-core-war/layouts/common/modal.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/bin/portal-core-war/layouts/common/modal.jsp 2007-12-04 16:00:56 UTC (rev 9284)
+++ branches/JBoss_Portal_Branch_2_6/core/src/bin/portal-core-war/layouts/common/modal.jsp 2007-12-04 17:30:19 UTC (rev 9285)
@@ -1,3 +1,5 @@
+<%@page import="org.jboss.portal.server.ServerURL"%>
+<%@page import="org.jboss.portal.server.AbstractServerURL"%>
<script src="<%=request.getContextPath()%>/js/modal.js" type="text/javascript"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/modal.css" type="text/css" />
<div id="login-modal" style="display:none">
@@ -3,5 +5,5 @@
<div id="login-modal-msg" style="display:none;width:257px;height:157px">
<% String loginHeight = "100%"; %>
- <iframe src="/portal/auth/?loginheight=0" frameborder="0" width="257" height="157" scrolling="no" marginheight="0" marginwidth="0" name="login-content" class="login-content"></iframe>
+ <iframe src="<%=request.getAttribute("org.jboss.portal.PORTAL_CONTEXT_PATH")%>/auth/?loginheight=0" frameborder="0" width="257" height="157" scrolling="no" marginheight="0" marginwidth="0" name="login-content" class="login-content"></iframe>
</div>
</div>
\ No newline at end of file
Added: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/aspects/server/PortalContextPathInterceptor.java 2007-12-04 17:30:19 UTC (rev 9285)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.core.aspects.server;
+
+import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.server.ServerInterceptor;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerInvocationContext;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortalContextPathInterceptor extends ServerInterceptor
+{
+
+ @Override
+ protected void invoke(ServerInvocation invocation) throws Exception, InvocationException
+ {
+ ServerInvocationContext serverContext = invocation.getServerContext();
+ String url = serverContext.getPortalContextPath();
+
+ invocation.getServerContext().setAttribute(ServerInvocation.REQUEST_SCOPE, "org.jboss.portal.PORTAL_CONTEXT_PATH", url);
+
+ invocation.invokeNext();
+
+ }
+
+}
+
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-12-04 16:00:56 UTC (rev 9284)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-12-04 17:30:19 UTC (rev 9285)
@@ -141,6 +141,13 @@
<xmbean/>
</mbean>
<mbean
+ code="org.jboss.portal.core.aspects.server.PortalContextPathInterceptor"
+ name="portal:service=Interceptor,type=Server,name=PortalContextPath"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
code="org.jboss.portal.server.aspects.server.ContentTypeInterceptor"
name="portal:service=Interceptor,type=Server,name=ContentType"
xmbean-dd=""
@@ -160,6 +167,7 @@
<depends-list-element>portal:service=Interceptor,type=Server,name=SessionInvalidator</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=User</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=Locale</depends-list-element>
+ <depends-list-element>portal:service=Interceptor,type=Server,name=PortalContextPath</depends-list-element>
<depends-list-element>portal:service=Interceptor,type=Server,name=ContentType</depends-list-element>
</depends-list>
</mbean>
16 years, 6 months
JBoss Portal SVN: r9284 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation: test/model and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-04 11:00:56 -0500 (Tue, 04 Dec 2007)
New Revision: 9284
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
Log:
make child creation throw an event and test it
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-04 15:45:20 UTC (rev 9283)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-04 16:00:56 UTC (rev 9284)
@@ -273,7 +273,16 @@
context.update(creation);
//
- return type.cast(context.getObject(creation.getChild().getId()));
+ StructuralObject child = creation.getChild();
+
+ // Eventing
+ StructuralStateModification mod = new StructuralStateModification.Creation(type, name, EMPTY_STATE);
+ StateChange<StructuralStateModification> change = new StateChange<StructuralStateModification>(child.getId(), mod);
+ StateChangeEvent event = new StateChangeEvent(change);
+ context.fireEvent(event);
+
+ //
+ return type.cast(context.getObject(child.getId()));
}
void update(StructuralObject object)
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java 2007-12-04 15:45:20 UTC (rev 9283)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java 2007-12-04 16:00:56 UTC (rev 9284)
@@ -69,6 +69,17 @@
Assert.assertEquals(sp.getChanges(), mod.getChanges());
}
+ public void next(String targetId, StructuralStateModification.Creation sp)
+ {
+ StateChangeEvent ste = next(StateChangeEvent.class);
+ StateChange change = ste.getChange();
+ Assert.assertEquals(targetId, change.getTargetId());
+ StructuralStateModification.Creation mod = (StructuralStateModification.Creation)change.getModification();
+ Assert.assertEquals(sp.getName(), mod.getName());
+ Assert.assertEquals(sp.getType(), mod.getType());
+ Assert.assertEquals(sp.getProperties(), mod.getProperties());
+ }
+
public void next(String targetId, NavigationalStateModification ns)
{
StateChangeEvent ste = next(StateChangeEvent.class);
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-04 15:45:20 UTC (rev 9283)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-04 16:00:56 UTC (rev 9284)
@@ -40,6 +40,7 @@
import org.jboss.portal.presentation.test.model.state.structural.MockObject;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
/**
@@ -499,6 +500,8 @@
public void testCreateChild()
{
UIContext context = createContext();
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
assertNull(context.getChild("foo"));
@@ -509,5 +512,7 @@
assertSame(context, portal.getParent());
assertSame(portal, context.getChild("foo"));
+
+ eventAssert.next(portal.getId(), new StructuralStateModification.Creation(UIPortal.class, "foo", new HashMap<String, String>()));
}
}
16 years, 6 months
JBoss Portal SVN: r9283 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation: impl/model/state/navigational and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-04 10:45:20 -0500 (Tue, 04 Dec 2007)
New Revision: 9283
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChange.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChangeEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateModification.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/navigational/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/navigational/NavigationalStateModification.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/structural/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/structural/StructuralStateModification.java
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
Log:
move model event related stuff in an model.event package
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-04 15:32:16 UTC (rev 9282)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -24,12 +24,12 @@
import org.jboss.portal.presentation.model.StateScopeType;
import org.jboss.portal.presentation.model.UIObject;
-import org.jboss.portal.presentation.model.state.StateChange;
-import org.jboss.portal.presentation.model.state.StateChangeEvent;
+import org.jboss.portal.presentation.model.event.StateChange;
+import org.jboss.portal.presentation.model.event.StateChangeEvent;
+import org.jboss.portal.presentation.model.event.navigational.NavigationalStateModification;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
-import org.jboss.portal.presentation.model.state.navigational.NavigationalStateModification;
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateModification;
+import org.jboss.portal.presentation.model.event.structural.StructuralStateModification;
import java.io.Serializable;
import java.util.Collections;
@@ -134,7 +134,6 @@
{
throw new IllegalArgumentException();
}
- Map map;
Object value;
switch (scopeType)
{
@@ -165,17 +164,21 @@
{
throw new IllegalArgumentException();
}
+
+ //
+ String id = getId();
+
+ //
switch (scopeType)
{
case NAVIGATIONAL:
{
- NavigationalStateModification mod = new NavigationalStateModification(propertyName, propertyValue);
- StateChange<NavigationalStateModification> change = new StateChange<NavigationalStateModification>(getId(), mod);
-
// Have context process the change
- context.navigationalStateContext.update(change);
+ context.navigationalStateContext.set(id, propertyName, propertyValue);
// Broadcast event
+ NavigationalStateModification mod = new NavigationalStateModification(propertyName, propertyValue);
+ StateChange<NavigationalStateModification> change = new StateChange<NavigationalStateModification>(id, mod);
StateChangeEvent event = new StateChangeEvent(change);
context.fireEvent(event);
break;
@@ -195,7 +198,7 @@
// Broadcast event
StructuralStateModification mod = new StructuralStateModification.Update(changes);
- StateChange<StructuralStateModification> change = new StateChange<StructuralStateModification>(getId(), mod);
+ StateChange<StructuralStateModification> change = new StateChange<StructuralStateModification>(id, mod);
StateChangeEvent event = new StateChangeEvent(change);
context.fireEvent(event);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java 2007-12-04 15:32:16 UTC (rev 9282)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -23,14 +23,11 @@
package org.jboss.portal.presentation.impl.model.state.navigational;
import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.model.state.navigational.NavigationalStateModification;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.state.StateException;
-import org.jboss.portal.presentation.model.state.StateChange;
import java.util.Map;
import java.util.HashMap;
-import java.util.List;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -52,35 +49,21 @@
this(new HashMap<Key, Object>());
}
- public void update(List<StateChange<NavigationalStateModification>> changes)
+ public void set(String objectId, String key, Object navigationalState) throws StateChangeVetoException, StateException, IllegalArgumentException
{
- for (StateChange<NavigationalStateModification> change : changes)
- {
- update(change);
- }
- }
+ Key key2 = new Key(objectId, key);
- public void update(StateChange<NavigationalStateModification> change)
- {
- Key key = new Key(change.getTargetId(), change.getModification().getKey());
- Object navigationalState = change.getModification().getNavigationalState();
-
//
if (navigationalState != null)
{
- map.put(key, navigationalState);
+ map.put(key2, navigationalState);
}
else
{
- map.remove(key);
+ map.remove(key2);
}
}
- public void set(String objectId, String key, Object navigationalState) throws StateChangeVetoException, StateException, IllegalArgumentException
- {
- update(new StateChange<NavigationalStateModification>(objectId, new NavigationalStateModification(key, navigationalState)));
- }
-
public Object get(String objectId, String key) throws IllegalArgumentException
{
return map.get(new Key(objectId, key));
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChange.java (from rev 9227, branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChange.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChange.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChange.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.presentation.model.event;
+
+import org.jboss.portal.presentation.model.event.StateModification;
+
+/**
+ * A change in the state of the model. The change is the association of a target id and a modification.
+ * The target id refers to an object in the structural state context and the modification is a modification
+ * of its state. Note that the modification could also modify the state of other objects.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class StateChange<M extends StateModification>
+{
+
+ /** . */
+ private final String targetId;
+
+ /** . */
+ private final M modification;
+
+ public StateChange(String targetId, M modification)
+ {
+ if (targetId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (modification == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.targetId = targetId;
+ this.modification = modification;
+ }
+
+ /**
+ * Returns the target id of the change.
+ *
+ * @return the target id
+ */
+ public String getTargetId()
+ {
+ return targetId;
+ }
+
+ /**
+ * Returns the modification operated on the target id.
+ *
+ * @return the modification
+ */
+ public M getModification()
+ {
+ return modification;
+ }
+}
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChangeEvent.java (from rev 9227, branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateChangeEvent.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChangeEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateChangeEvent.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.presentation.model.event;
+
+import org.jboss.portal.presentation.model.ModelEvent;
+import org.jboss.portal.presentation.model.event.StateChange;
+
+/**
+ * Signals a state change occured.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class StateChangeEvent extends ModelEvent
+{
+
+ /** . */
+ private final StateChange change;
+
+ public StateChangeEvent(StateChange change)
+ {
+ if (change == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.change = change;
+ }
+
+ /**
+ * Returns the state change that occured.
+ *
+ * @return the state change
+ */
+ public StateChange getChange()
+ {
+ return change;
+ }
+}
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateModification.java (from rev 9227, branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/StateModification.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateModification.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/StateModification.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.presentation.model.event;
+
+/**
+ * An abstract class for the modification of state.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class StateModification
+{
+}
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/navigational/NavigationalStateModification.java (from rev 9227, branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/navigational/NavigationalStateModification.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/navigational/NavigationalStateModification.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/navigational/NavigationalStateModification.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.presentation.model.event.navigational;
+
+import org.jboss.portal.presentation.model.event.StateModification;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class NavigationalStateModification extends StateModification
+{
+
+ /** . */
+ private final String key;
+
+ /** . */
+ private final Object navigationalState;
+
+ public NavigationalStateModification(String key, Object navigationalState)
+ {
+ if (key == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.key = key;
+ this.navigationalState = navigationalState;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public Object getNavigationalState()
+ {
+ return navigationalState;
+ }
+}
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/structural/StructuralStateModification.java (from rev 9281, branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/structural/StructuralStateModification.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/structural/StructuralStateModification.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.jboss.portal.presentation.model.event.structural;
+
+import org.jboss.portal.presentation.model.event.StateModification;
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.util.Map;
+
+/**
+ * Specification of state modification for structural state.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class StructuralStateModification extends StateModification
+{
+
+ protected StructuralStateModification()
+ {
+ }
+
+ /**
+ * Destruction of an object.
+ */
+ public final static class Destruction extends StructuralStateModification
+ {
+ }
+
+ public final static class Creation extends StructuralStateModification
+ {
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ public Creation(Class<? extends UIObject> type, String name, Map<String, String> properties)
+ {
+ this.type = type;
+ this.name = name;
+ this.properties = properties;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+ }
+
+ public final static class Move extends StructuralStateModification
+ {
+
+ /** . */
+ private final String destinationId;
+
+ public Move(String parentId)
+ {
+ this.destinationId = parentId;
+ }
+
+ public String getDestinationId()
+ {
+ return destinationId;
+ }
+ }
+
+
+ /**
+ * Update the properties portion of the state. The <code>Map</code> values are interpreted as follow:
+ * <ul>
+ * <li>Each non null value will replace an existing value of create a new one</li>
+ * <li>Each null value will destroy an existing value</li>
+ * </ul>
+ */
+ public final static class Update extends StructuralStateModification
+ {
+
+ /** . */
+ private final Map<String, String> changes;
+
+ public Update(Map<String, String> changes)
+ {
+ if (changes == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.changes = changes;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map<String, String> getChanges()
+ {
+ return changes;
+ }
+ }
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java 2007-12-04 15:32:16 UTC (rev 9282)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -22,12 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.model.state.navigational;
-import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.state.StateException;
-import org.jboss.portal.presentation.model.state.StateChange;
-import java.util.List;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -36,9 +32,6 @@
{
Object get(String objectId, String key) throws IllegalArgumentException;
- void set(String objectId, String key, Object navigationalState) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ void set(String objectId, String key, Object navigationalState) throws StateException, IllegalArgumentException;
- void update(List<StateChange<NavigationalStateModification>> modifications);
-
- void update(StateChange<NavigationalStateModification> modification);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java 2007-12-04 15:32:16 UTC (rev 9282)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -25,10 +25,10 @@
import junit.framework.Assert;
import org.jboss.portal.presentation.model.ModelEvent;
import org.jboss.portal.presentation.model.ModelListener;
-import org.jboss.portal.presentation.model.state.StateChange;
-import org.jboss.portal.presentation.model.state.StateChangeEvent;
-import org.jboss.portal.presentation.model.state.navigational.NavigationalStateModification;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateModification;
+import org.jboss.portal.presentation.model.event.StateChange;
+import org.jboss.portal.presentation.model.event.StateChangeEvent;
+import org.jboss.portal.presentation.model.event.navigational.NavigationalStateModification;
+import org.jboss.portal.presentation.model.event.structural.StructuralStateModification;
import java.util.ArrayList;
import java.util.List;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-04 15:32:16 UTC (rev 9282)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-04 15:45:20 UTC (rev 9283)
@@ -32,11 +32,10 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.event.structural.StructuralStateModification;
import org.jboss.portal.presentation.model.state.NoSuchStateException;
import org.jboss.portal.presentation.model.state.StaleStateException;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
-import org.jboss.portal.presentation.model.state.StateException;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateModification;
import org.jboss.portal.presentation.test.model.state.structural.MockModel;
import org.jboss.portal.presentation.test.model.state.structural.MockObject;
16 years, 6 months
JBoss Portal SVN: r9281 - branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-04 10:19:58 -0500 (Tue, 04 Dec 2007)
New Revision: 9281
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java
Log:
minor renaming
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java 2007-12-04 15:14:34 UTC (rev 9280)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java 2007-12-04 15:19:58 UTC (rev 9281)
@@ -43,11 +43,11 @@
/**
* Destruction of an object.
*/
- public final static class Destroy extends StructuralStateModification
+ public final static class Destruction extends StructuralStateModification
{
}
- public final static class Create extends StructuralStateModification
+ public final static class Creation extends StructuralStateModification
{
/** . */
@@ -59,7 +59,7 @@
/** . */
private final Map<String, String> properties;
- public Create(Class<? extends UIObject> type, String name, Map<String, String> properties)
+ public Creation(Class<? extends UIObject> type, String name, Map<String, String> properties)
{
this.type = type;
this.name = name;
16 years, 6 months
JBoss Portal SVN: r9280 - in branches/presentation: presentation/src/main/org/jboss/portal/presentation/impl/model and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-12-04 10:14:34 -0500 (Tue, 04 Dec 2007)
New Revision: 9280
Removed:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateChangeListener.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateChangeListener.java
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
Log:
- remove the listener mechanism and instead use a more protocolish design
- isolate uicontext objects update in the uicontext class
Modified: branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java
===================================================================
--- branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -115,6 +115,24 @@
return parent == null ? null : new StructuralObjectImpl(parent);
}
+ public boolean equals(StructuralObject left, StructuralObject right)
+ {
+ if (left == null)
+ {
+ return right == null;
+ }
+ else
+ {
+ if (right == null)
+ {
+ return false;
+ }
+ StructuralObjectImpl lefti = (StructuralObjectImpl)left;
+ StructuralObjectImpl righti = (StructuralObjectImpl)right;
+ return lefti.getId().equals(righti.getId());
+ }
+ }
+
/**
*
*
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -32,7 +32,6 @@
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateChangeListener;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
import java.util.ArrayList;
@@ -48,7 +47,7 @@
{
/** . */
- private final Map<String, UIObjectImpl> objects = new HashMap<String, UIObjectImpl>();
+ private final Map<String, UIObjectImpl> universe = new HashMap<String, UIObjectImpl>();
/** . */
protected final StructuralStateContext structuralStateContext;
@@ -59,32 +58,6 @@
/** . */
protected final List<ModelListener> listeners;
- protected final StructuralStateChangeListener listener = new StructuralStateChangeListener()
- {
- public void update(StructuralObject object)
- {
- // Get the corresponding object
- UIObjectImpl tmp = objects.get(object.getId());
-
- // If it is not here, create it
- if (tmp == null)
- {
- tmp = createObject(object);
- objects.put(object.getId(), tmp);
- }
- else
- {
- // Update its structural view
- tmp.update(object);
- }
- }
-
- public void remove(String id)
- {
- objects.remove(id);
- }
- };
-
private static StructuralObject getRootState(StructuralStateContext loader)
{
return loader.load(loader.getRootId());
@@ -99,8 +72,8 @@
this.navigationalStateContext = navigationalStateContext;
this.listeners = new ArrayList<ModelListener>();
- // Put our self in the object cache
- objects.put(getId(), this);
+ // Put our self in the universe
+ universe.put(getId(), this);
}
/**
@@ -108,14 +81,59 @@
*/
public UIObject getObject(String id)
{
- return getFromUniverse(id, true);
+ return getObject(id, true);
}
- UIObject getFromUniverse(String id, boolean loadIfAbsent)
+ void update(StructuralObject.Change change)
{
+ if (change instanceof StructuralObject.Update)
+ {
+ StructuralObject.Update update = (StructuralObject.Update)change;
+ context.updateUniverse(update.getObject());
+ }
+ else if (change instanceof StructuralObject.Creation)
+ {
+ StructuralObject.Creation creation = (StructuralObject.Creation)change;
+ context.updateUniverse(creation.getParent());
+ context.updateUniverse(creation.getChild());
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+ }
+
+ UIObjectImpl getParent(StructuralObject structuralObject)
+ {
+ StructuralObject parentStructuralState = context.structuralStateContext.loadParent(structuralObject);
+ return context.updateUniverse(parentStructuralState);
+ }
+
+ List<UIObject> getChildren(StructuralObject structuralObject)
+ {
+ ArrayList<UIObject> children = new ArrayList<UIObject>();
+ for (StructuralObject structuralChild : context.structuralStateContext.loadChildren(structuralObject))
+ {
+ UIObjectImpl child = context.updateUniverse(structuralChild);
+ children.add(child);
+ }
+ return children;
+ }
+
+ /**
+ * Get an object from the universe. If the parameter <code>loadIfAbsent</code> has the value <code>false</code>
+ * and the object is not in the universe it will throw an <code>AssertionError</code> otherwise it will return
+ * the object.
+ *
+ * @param id the id of the object to obtain
+ * @param loadIfAbsent load the object from the structural state context if it is not present
+ * @return the loaded object
+ */
+ private UIObjectImpl getObject(String id, boolean loadIfAbsent)
+ {
try
{
- UIObject object = objects.get(id);
+ UIObjectImpl object = universe.get(id);
//
if (object != null)
@@ -126,7 +144,7 @@
//
if (loadIfAbsent)
{
- //Fetch the state of the UIObject in question
+ // Fetch the state of the UIObject in question
StructuralObject structuralObject = this.structuralStateContext.load(id);
//
@@ -143,9 +161,9 @@
}
}
- protected UIObjectImpl updateUniverse(StructuralObject structuralObject)
+ private UIObjectImpl updateUniverse(StructuralObject structuralObject)
{
- UIObjectImpl object = objects.get(structuralObject.getId());
+ UIObjectImpl object = universe.get(structuralObject.getId());
//
if (object == null)
@@ -153,25 +171,15 @@
object = createObject(structuralObject);
//
- objects.put(structuralObject.getId(), object);
+ universe.put(structuralObject.getId(), object);
}
-
- //
- return object;
- }
-
- public void addModelListener(ModelListener listener)
- {
- if (listener == null)
+ else
{
- throw new IllegalArgumentException();
+ object.update(structuralObject);
}
//
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
+ return object;
}
private UIObjectImpl createObject(StructuralObject state)
@@ -201,6 +209,20 @@
}
}
+ public void addModelListener(ModelListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (!listeners.contains(listener))
+ {
+ listeners.add(listener);
+ }
+ }
+
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
{
return type == UIPortal.class;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -32,7 +32,6 @@
import org.jboss.portal.presentation.model.state.structural.StructuralStateModification;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -47,6 +46,9 @@
{
/** . */
+ private static final Map<String, String> EMPTY_STATE = Collections.emptyMap();
+
+ /** . */
protected final UIContextImpl context;
/** . */
@@ -186,8 +188,11 @@
changes.put(propertyName, (String)propertyValue);
// Have context process change
- context.structuralStateContext.update(context.listener, structuralObject, changes);
+ StructuralObject.Update update = context.structuralStateContext.update(structuralObject, changes);
+ //
+ context.update(update);
+
// Broadcast event
StructuralStateModification mod = new StructuralStateModification.Update(changes);
StateChange<StructuralStateModification> change = new StateChange<StructuralStateModification>(getId(), mod);
@@ -238,8 +243,7 @@
//
if (parent == null)
{
- StructuralObject parentStructuralState = context.structuralStateContext.loadParent(structuralObject);
- parent = context.updateUniverse(parentStructuralState);
+ parent = context.getParent(structuralObject);
}
//
@@ -253,25 +257,20 @@
{
if (children == null)
{
- ArrayList<UIObject> tmp = new ArrayList<UIObject>();
- for (StructuralObject structuralChild : context.structuralStateContext.loadChildren(structuralObject))
- {
- UIObjectImpl child = context.updateUniverse(structuralChild);
- tmp.add(child);
- }
- children = tmp;
+ children = context.getChildren(structuralObject);
}
return children;
}
- private static final Map<String, String> EMPTY_STATE = Collections.emptyMap();
-
public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
{
- String id = context.structuralStateContext.create(context.listener, structuralObject, type, name, EMPTY_STATE);
+ StructuralObject.Creation creation = context.structuralStateContext.create(structuralObject, type, name, EMPTY_STATE);
//
- return type.cast(context.getFromUniverse(id, false));
+ context.update(creation);
+
+ //
+ return type.cast(context.getObject(creation.getChild().getId()));
}
void update(StructuralObject object)
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateChangeListener.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateChangeListener.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateChangeListener.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -1,38 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.presentation.model.state.structural;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class AbstractStructuralStateChangeListener implements StructuralStateChangeListener
-{
- public void update(StructuralObject object)
- {
- }
-
- public void remove(String id)
- {
- }
-}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -35,22 +35,22 @@
public abstract class AbstractStructuralStateContext implements StructuralStateContext
{
- public String create(StructuralStateChangeListener listener, StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException
+ public StructuralObject.Creation create(StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public void destroy(StructuralStateChangeListener listener, StructuralObject object) throws StateChangeVetoException, StateException, IllegalArgumentException
+ public StructuralObject.Destruction destroy(StructuralObject object) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public void move(StructuralStateChangeListener listener, StructuralObject object, StructuralObject parent) throws StateChangeVetoException, StateException, IllegalArgumentException
+ public StructuralObject.Move move(StructuralObject source, StructuralObject destination) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public void update(StructuralStateChangeListener listener, StructuralObject object, Map<String, String> changes) throws StateChangeVetoException, StateException, IllegalArgumentException
+ public StructuralObject.Update update(StructuralObject object, Map<String, String> changes) throws StateChangeVetoException, StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.model.state.structural;
+import java.util.List;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -33,4 +35,138 @@
StructuralState getState();
+ public static class Change
+ {
+ }
+
+ public static class Update extends Change
+ {
+
+ /** . */
+ private final StructuralObject object;
+
+ public Update(StructuralObject object)
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.object = object;
+ }
+
+ public StructuralObject getObject()
+ {
+ return object;
+ }
+ }
+
+ public static class Move extends Change
+ {
+
+ /** . */
+ private final StructuralObject source;
+
+ /** . */
+ private final StructuralObject destination;
+
+ public Move(StructuralObject source, StructuralObject destination)
+ {
+ if (source == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (destination == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.source = source;
+ this.destination = destination;
+ }
+
+ public StructuralObject getSource()
+ {
+ return source;
+ }
+
+ public StructuralObject getDestination()
+ {
+ return destination;
+ }
+ }
+
+ public static class Creation extends Change
+ {
+
+ /** . */
+ private final StructuralObject child;
+
+ /** . */
+ private final StructuralObject parent;
+
+ public Creation(StructuralObject parent, StructuralObject child)
+ {
+ if (parent == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (child == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.parent = parent;
+ this.child = child;
+ }
+
+ public StructuralObject getParent()
+ {
+ return parent;
+ }
+
+ public StructuralObject getChild()
+ {
+ return child;
+ }
+ }
+
+ public static class Destruction extends Change
+ {
+
+ /** . */
+ private final StructuralObject parent;
+
+ /** . */
+ private final List<String> ids;
+
+ public Destruction(StructuralObject parent, List<String> ids)
+ {
+ if (parent == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (ids == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.parent = parent;
+ this.ids = ids;
+ }
+
+ public StructuralObject getParent()
+ {
+ return parent;
+ }
+
+ public List<String> getIds()
+ {
+ return ids;
+ }
+ }
}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateChangeListener.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateChangeListener.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateChangeListener.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -1,44 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, 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.jboss.portal.presentation.model.state.structural;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public interface StructuralStateChangeListener
-{
- /**
- * Updates the structural object.
- *
- * @param object the object to update
- */
- void update(StructuralObject object);
-
- /**
- * Removes the structural object with the specified id.
- *
- * @param id the id to remove
- */
- void remove(String id);
-}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -62,7 +62,6 @@
/**
* Create an object.
*
- * @param listener the listener
* @param parent the parent
* @param type the type of the child
* @param name the name of the child
@@ -73,42 +72,52 @@
* @throws NoSuchStateException if the parent id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
*/
- String create(StructuralStateChangeListener listener, StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ StructuralObject.Creation create(StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException;
/**
* Destroy a specified object.
*
- * @param listener the listener
- * @param object the object to destroy @throws StateChangeVetoException if the creation is vetoed
+ * @param object the object to destroy
+ * @throws StateChangeVetoException if the creation is vetoed
* @throws StateException a generic state exception
* @throws NoSuchStateException if the object id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
* @throws StateChangeVetoException
*/
- void destroy(StructuralStateChangeListener listener, StructuralObject object) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ StructuralObject.Destruction destroy(StructuralObject object) throws StateException, IllegalArgumentException;
/**
* Move an object to a new parent.
*
- * @param listener the listener
- * @param object the object to move
- * @param parent the new parent @throws StateChangeVetoException if the creation is vetoed
+ * @param source
+ * @param destination
* @throws StateException a generic state exception
* @throws NoSuchStateException if the object id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
*/
- void move(StructuralStateChangeListener listener, StructuralObject object, StructuralObject parent) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ StructuralObject.Move move(StructuralObject source, StructuralObject destination) throws StateException, IllegalArgumentException;
/**
* Update the state of a specified object.
*
- * @param listener the listener
* @param object the object to udpate
- * @param changes the changes @throws StateChangeVetoException if the creation is vetoed
+ * @param changes the changes
+ * @throws StateChangeVetoException if the creation is vetoed
* @throws StateException a generic state exception
* @throws NoSuchStateException if the object id does not point a valid state
* @throws IllegalArgumentException if an argument is null or not valid
*/
- void update(StructuralStateChangeListener listener, StructuralObject object, Map<String, String> changes) throws StateChangeVetoException, StateException, IllegalArgumentException;
+ StructuralObject.Update update(StructuralObject object, Map<String, String> changes) throws StateException, IllegalArgumentException;
+ /**
+ * The structural object equality requires the equality of the id but it may not be a sufficient condition.
+ * Equality could be based on the state or on a version id. The equality operation can be considered as safe
+ * with respect to passing null as argument.
+ *
+ * @param left the left
+ * @param right the right
+ * @return if left and right are equals
+ */
+ boolean equals(StructuralObject left, StructuralObject right);
+
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralStateModification.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -86,16 +86,16 @@
{
/** . */
- private final String parentId;
+ private final String destinationId;
public Move(String parentId)
{
- this.parentId = parentId;
+ this.destinationId = parentId;
}
- public String getParentId()
+ public String getDestinationId()
{
- return parentId;
+ return destinationId;
}
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModelTestCase.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/MockModelTestCase.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -26,10 +26,8 @@
import org.jboss.portal.presentation.model.UIContext;
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.state.StaleStateException;
-import org.jboss.portal.presentation.model.state.structural.AbstractStructuralStateChangeListener;
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.model.state.structural.StructuralState;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateChangeListener;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.test.model.state.structural.MockModel;
import org.jboss.portal.presentation.test.model.state.structural.MockObject;
@@ -54,30 +52,16 @@
/** . */
private StructuralStateContext ssc;
- /** . */
- private Map<String, StructuralObject> universe;
-
- /** . */
- private final StructuralStateChangeListener listener = new AbstractStructuralStateChangeListener()
- {
- public void update(StructuralObject object)
- {
- universe.put(object.getId(), object);
- }
- };
-
protected void setUp() throws Exception
{
model = new MockModel();
ssc = model.getStructuralStateContext();
- universe = new HashMap<String, StructuralObject>();
}
protected void tearDown() throws Exception
{
model = null;
ssc = null;
- universe = null;
}
public void testRoot()
@@ -115,7 +99,7 @@
assertEquals(Collections.EMPTY_MAP, rootState0.getProperties());
// Set
- ssc.update(listener, root0, Collections.singletonMap("foo", "bar"));
+ StructuralObject.Update update = ssc.update(root0, Collections.singletonMap("foo", "bar"));
//
int rootV1 = mockRoot.getVersion();
@@ -124,7 +108,7 @@
assertEquals("bar", mockRoot.getPropertyValue("foo"));
assertEquals(Collections.EMPTY_MAP, rootState0.getProperties());
assertStale(root0);
- StructuralObject root1_0 = universe.get(rootId);
+ StructuralObject root1_0 = update.getObject();
assertNotNull(root1_0);
assertNotStale(root1_0);
StructuralState rootState1_0 = root1_0.getState();
@@ -164,7 +148,7 @@
assertEquals(Collections.singletonMap("foo", "bar"), rootState1.getProperties());
// Update
- ssc.update(listener, root1, Collections.singletonMap("foo", "bar2"));
+ StructuralObject.Update update = ssc.update(root1, Collections.singletonMap("foo", "bar2"));
//
int rootV2 = mockRoot.getVersion();
@@ -176,7 +160,7 @@
assertStale(root1);
//
- StructuralObject root2_0 = universe.get(rootId);
+ StructuralObject root2_0 = update.getObject();
assertNotNull(root2_0);
assertNotStale(root2_0);
StructuralState rootState2_0 = root2_0.getState();
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/MockModel.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -33,7 +33,6 @@
import org.jboss.portal.presentation.model.state.StateException;
import org.jboss.portal.presentation.model.state.structural.AbstractStructuralStateContext;
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateChangeListener;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
import java.util.ArrayList;
@@ -111,7 +110,7 @@
return root.getId();
}
- public void update(StructuralStateChangeListener listener, StructuralObject object, Map<String, String> changes) throws StateChangeVetoException
+ public StructuralObject.Update update(StructuralObject object, Map<String, String> changes) throws StateChangeVetoException
{
MockObject mockObject = getValidMockObject(object);
@@ -138,13 +137,10 @@
}
//
- if (listener != null)
- {
- listener.update(mockObject.takeSnapshot());
- }
+ return new StructuralObject.Update(mockObject.takeSnapshot());
}
- public String create(StructuralStateChangeListener listener, StructuralObject parent, Class<? extends UIObject> classType, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException
+ public StructuralObject.Creation create(StructuralObject parent, Class<? extends UIObject> classType, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException
{
MockObject mockParent = getValidMockObject(parent);
@@ -155,11 +151,7 @@
MockObject mockChild = mockParent.addChild(name, type, properties);
//
- listener.update(mockParent.takeSnapshot());
- listener.update(mockChild.takeSnapshot());
-
- //
- return mockChild.getId();
+ return new StructuralObject.Creation(mockParent.takeSnapshot(), mockChild.takeSnapshot());
}
public List<StructuralObject> loadChildren(StructuralObject object)
@@ -217,5 +209,32 @@
return mockObject;
}
+ public boolean equals(StructuralObject left, StructuralObject right)
+ {
+ if (left == null)
+ {
+ return right == null;
+ }
+ else
+ {
+ if (right == null)
+ {
+ return false;
+ }
+
+ //
+ StructuralObjectImpl lefti = (StructuralObjectImpl)left;
+ StructuralObjectImpl righti = (StructuralObjectImpl)left;
+
+ //
+ if (lefti == righti)
+ {
+ return true;
+ }
+
+ //
+ return lefti.id.equals(righti.id) && lefti.version == righti.version;
+ }
+ }
};
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java 2007-12-04 15:08:37 UTC (rev 9279)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java 2007-12-04 15:14:34 UTC (rev 9280)
@@ -57,4 +57,18 @@
{
return state;
}
+
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof StructuralObjectImpl)
+ {
+ StructuralObjectImpl that = (StructuralObjectImpl)o;
+ return id.equals(that.id) && version == that.version;
+ }
+ return false;
+ }
}
16 years, 6 months
JBoss Portal SVN: r9279 - docs/branches/JBoss_Portal_Branch_2_6/userGuide/en/images/management.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-04 10:08:37 -0500 (Tue, 04 Dec 2007)
New Revision: 9279
Added:
docs/branches/JBoss_Portal_Branch_2_6/userGuide/en/images/management/display_names.png
Log:
oups
Added: docs/branches/JBoss_Portal_Branch_2_6/userGuide/en/images/management/display_names.png
===================================================================
(Binary files differ)
Property changes on: docs/branches/JBoss_Portal_Branch_2_6/userGuide/en/images/management/display_names.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 6 months
JBoss Portal SVN: r9278 - docs/tags/JBoss_Portal_2_6_3/userGuide/en/images/management.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-12-04 10:08:19 -0500 (Tue, 04 Dec 2007)
New Revision: 9278
Added:
docs/tags/JBoss_Portal_2_6_3/userGuide/en/images/management/display_names.png
Log:
Oups
Added: docs/tags/JBoss_Portal_2_6_3/userGuide/en/images/management/display_names.png
===================================================================
(Binary files differ)
Property changes on: docs/tags/JBoss_Portal_2_6_3/userGuide/en/images/management/display_names.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 6 months