Author: julien(a)jboss.com
Date: 2007-12-19 07:49:13 -0500 (Wed, 19 Dec 2007)
New Revision: 9372
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateType.java
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/server/MainProcessor.java
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
Log:
NYI implementation of refresh operation in the portal object structural state context impl
that was preventing compilation
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-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/model/StructuralStateContextImpl.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -30,6 +30,7 @@
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.common.NotYetImplemented;
import java.util.ArrayList;
import java.util.Collection;
@@ -90,6 +91,11 @@
}
}
+ public StructuralObject.Refresh refresh(StructuralObject object) throws
IllegalArgumentException, StateException
+ {
+ throw new NotYetImplemented();
+ }
+
/**
*
*/
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java
===================================================================
---
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-12-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/MainProcessor.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -45,7 +45,7 @@
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.RenderResponse;
import org.jboss.portal.presentation.client.PresentationContext;
-import org.jboss.portal.presentation.model.StateScopeType;
+import org.jboss.portal.presentation.model.StateType;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.protocol.ErrorResponse;
import org.jboss.portal.presentation.protocol.LinkActivation;
@@ -254,7 +254,7 @@
{
uiWindow.setMode(mode);
}
- uiWindow.setProperty(StateScopeType.NAVIGATIONAL, "content",
contentState);
+ uiWindow.setProperty(StateType.NAVIGATIONAL, "content",
contentState);
response = new
ShowUIObjectResponse(window.getPage().getId().toString(PortalObjectPath.CANONICAL_FORMAT));
}
}
Modified:
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java
===================================================================
---
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-12-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/core-presentation/src/main/org/jboss/portal/core/presentation/server/content/PresentationContentRendererContext.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -37,7 +37,7 @@
import org.jboss.portal.portlet.impl.spi.AbstractUserContext;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.presentation.client.PresentationContext;
-import org.jboss.portal.presentation.model.StateScopeType;
+import org.jboss.portal.presentation.model.StateType;
import org.jboss.portal.presentation.model.UIWindow;
/**
@@ -83,7 +83,7 @@
windowState = WindowState.NORMAL;
}
- StateString contentState =
(StateString)uiwindow.getProperty(StateScopeType.NAVIGATIONAL, "content");
+ StateString contentState =
(StateString)uiwindow.getProperty(StateType.NAVIGATIONAL, "content");
//
return new WindowNavigationalState(windowState, mode, contentState);
@@ -93,7 +93,7 @@
{
uiwindow.setWindowState(navigationalState.getWindowState());
uiwindow.setMode(navigationalState.getMode());
- uiwindow.setProperty(StateScopeType.NAVIGATIONAL, "content",
navigationalState.getContentState());
+ uiwindow.setProperty(StateType.NAVIGATIONAL, "content",
navigationalState.getContentState());
}
public User getUser()
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-12-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -24,7 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.presentation.model.StateScopeType;
+import org.jboss.portal.presentation.model.StateType;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIWindow;
import org.jboss.portal.presentation.impl.model.container.AbstractUIObject;
@@ -47,7 +47,7 @@
*/
public Mode getMode()
{
- return getProperty(StateScopeType.NAVIGATIONAL, "mode", Mode.class);
+ return getProperty(StateType.NAVIGATIONAL, "mode", Mode.class);
}
/**
@@ -55,7 +55,7 @@
*/
public WindowState getWindowState()
{
- return getProperty(StateScopeType.NAVIGATIONAL, "windowstate",
WindowState.class);
+ return getProperty(StateType.NAVIGATIONAL, "windowstate",
WindowState.class);
}
/**
@@ -63,7 +63,7 @@
*/
public void setMode(Mode mode)
{
- setProperty(StateScopeType.NAVIGATIONAL, "mode", mode);
+ setProperty(StateType.NAVIGATIONAL, "mode", mode);
}
/**
@@ -71,7 +71,7 @@
*/
public void setWindowState(WindowState windowState)
{
- setProperty(StateScopeType.NAVIGATIONAL, "windowstate", windowState);
+ setProperty(StateType.NAVIGATIONAL, "windowstate", windowState);
}
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java 2007-12-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.impl.model.container;
import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.presentation.model.StateScopeType;
+import org.jboss.portal.presentation.model.StateType;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.event.state.StateChange;
import org.jboss.portal.presentation.model.event.state.StateChangeEvent;
@@ -142,13 +142,13 @@
}
}
- public <T> T getProperty(StateScopeType scopeType, String propertyName,
Class<T> propertyType)
+ public <T> T getProperty(StateType stateType, String propertyName,
Class<T> propertyType)
{
if (!context.isValid())
{
throw new IllegalStateException();
}
- if (scopeType == null)
+ if (stateType == null)
{
throw new IllegalArgumentException();
}
@@ -161,7 +161,7 @@
throw new IllegalArgumentException();
}
Object value;
- switch (scopeType)
+ switch (stateType)
{
case NAVIGATIONAL:
value = context.container.navigationalStateContext.get(getId(),
propertyName);
@@ -175,18 +175,18 @@
return safeCast(value, propertyType);
}
- public Object getProperty(StateScopeType scopeType, String propertyName)
+ public Object getProperty(StateType stateType, String propertyName)
{
- return getProperty(scopeType, propertyName, Object.class);
+ return getProperty(stateType, propertyName, Object.class);
}
- public <T> void setProperty(StateScopeType scopeType, String propertyName, T
propertyValue) throws StateChangeVetoException
+ public <T> void setProperty(StateType stateType, String propertyName, T
propertyValue) throws StateChangeVetoException
{
if (!context.isValid())
{
throw new IllegalStateException();
}
- if (scopeType == null)
+ if (stateType == null)
{
throw new IllegalArgumentException();
}
@@ -199,7 +199,7 @@
String id = getId();
//
- switch (scopeType)
+ switch (stateType)
{
case NAVIGATIONAL:
{
Copied:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateType.java
(from rev 9366,
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateScopeType.java)
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateType.java
(rev 0)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/StateType.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public enum StateType
+{
+ /**
+ * The navigational state type. The navigational state type describe sthe a kind of
change done at runtime by the user when it
+ * interacts with the model (i.e not all interactions with the model are automatically
navigational state changes).
+ */
+ NAVIGATIONAL,
+
+ /**
+ * The structural state type. The structural state type describes the structure of the
model, i.e it defines an enduring
+ * state managed by the presentation server.
+ */
+ STRUCTURAL
+}
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java 2007-12-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIObject.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -111,28 +111,28 @@
/**
* Returns a property value or null if it does not exist.
*
- * @param scopeType the scope where to get the value from
+ * @param stateType the scope where to get the value from
* @param propertyName the property name
* @param propertyType the expected property type
* @return the property value
* @throws IllegalArgumentException if any argument is null or not valid
* @throws StateException any state exception
*/
- <T> T getProperty(StateScopeType scopeType, String propertyName, Class<T>
propertyType) throws IllegalArgumentException, StateException;
+ <T> T getProperty(StateType stateType, String propertyName, Class<T>
propertyType) throws IllegalArgumentException, StateException;
/**
* Equivalent to call
<code>getPropertyValue(StateScopeType,String,Class)</code> with the
<code>Object.class</code>
* literal.
*
- * @param scopeType the scope where to get the value from
+ * @param stateType the scope where to get the value from
* @param propertyName the property name
* @return the property value
* @throws IllegalArgumentException if any argument is null or not valid
* @throws StateException any state exception
*/
- Object getProperty(StateScopeType scopeType, String propertyName) throws
IllegalArgumentException, StateException;
+ Object getProperty(StateType stateType, String propertyName) throws
IllegalArgumentException, StateException;
- <T> void setProperty(StateScopeType scopeType, String propertyName, T
propertyValue) throws IllegalArgumentException, StateException;
+ <T> void setProperty(StateType stateType, String propertyName, T propertyValue)
throws IllegalArgumentException, StateException;
/**
* Create a named child with a specified type.
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-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -40,17 +40,17 @@
throw new StateChangeVetoException();
}
- public StructuralObject.Destruction destroy(StructuralObject object) throws
StateChangeVetoException, StateException, IllegalArgumentException
+ public StructuralObject.Destruction destroy(StructuralObject object) throws
StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public StructuralObject.Move move(StructuralObject source, StructuralObject
destination) throws StateChangeVetoException, StateException, IllegalArgumentException
+ public StructuralObject.Move move(StructuralObject source, StructuralObject
destination) throws StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
- public StructuralObject.Update update(StructuralObject object, Map<String,
String> changes) throws StateChangeVetoException, StateException,
IllegalArgumentException
+ public StructuralObject.Update update(StructuralObject object, Map<String,
String> changes) throws StateException, IllegalArgumentException
{
throw new StateChangeVetoException();
}
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-19
12:41:36 UTC (rev 9371)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2007-12-19
12:49:13 UTC (rev 9372)
@@ -26,7 +26,7 @@
import junit.framework.TestCase;
import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
import
org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
-import org.jboss.portal.presentation.model.StateScopeType;
+import org.jboss.portal.presentation.model.StateType;
import org.jboss.portal.presentation.model.UIContext;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPage;
@@ -104,7 +104,7 @@
//
try
{
- context.setProperty(StateScopeType.STRUCTURAL, null, "foo_value");
+ context.setProperty(StateType.STRUCTURAL, null, "foo_value");
fail();
}
catch (IllegalArgumentException ignore)
@@ -134,7 +134,7 @@
//
try
{
- context.getProperty(StateScopeType.STRUCTURAL, null);
+ context.getProperty(StateType.STRUCTURAL, null);
fail();
}
catch (IllegalArgumentException ignore)
@@ -207,20 +207,20 @@
void assertStructuralEquals(String propertyName, String propertyValue)
{
- assertEquals(StateScopeType.STRUCTURAL, propertyName, propertyValue,
String.class);
+ assertEquals(StateType.STRUCTURAL, propertyName, propertyValue, String.class);
}
<T> void assertNavigationalEquals(String propertyName, T propertyValue,
Class<T> propertyClass)
{
- assertEquals(StateScopeType.NAVIGATIONAL, propertyName, propertyValue,
propertyClass);
+ assertEquals(StateType.NAVIGATIONAL, propertyName, propertyValue,
propertyClass);
}
- <T> void assertEquals(StateScopeType scopeType, String propertyName, T
propertyValue, Class<T> propertyClass)
+ <T> void assertEquals(StateType stateType, String propertyName, T
propertyValue, Class<T> propertyClass)
{
- Assert.assertEquals(propertyValue, object.getProperty(scopeType, propertyName,
propertyClass));
- Assert.assertEquals(propertyValue, object.getProperty(scopeType, propertyName,
Object.class));
- Assert.assertEquals(propertyValue, object.getProperty(scopeType,
propertyName));
- Assert.assertEquals(null, object.getProperty(scopeType, propertyName,
Blah.class)); }
+ Assert.assertEquals(propertyValue, object.getProperty(stateType, propertyName,
propertyClass));
+ Assert.assertEquals(propertyValue, object.getProperty(stateType, propertyName,
Object.class));
+ Assert.assertEquals(propertyValue, object.getProperty(stateType,
propertyName));
+ Assert.assertEquals(null, object.getProperty(stateType, propertyName,
Blah.class)); }
}
public void testUpdatePropertyNonExistingObject() throws MockException
@@ -233,7 +233,7 @@
//
try
{
- foo.setProperty(StateScopeType.STRUCTURAL, "foo",
"foo_value");
+ foo.setProperty(StateType.STRUCTURAL, "foo", "foo_value");
fail();
}
catch (NoSuchStateException e)
@@ -256,14 +256,14 @@
fooAssert.assertStructuralEquals("foo", "foo_value");
// Update structural property
- foo.setProperty(StateScopeType.STRUCTURAL, "foo",
"foo_new_value");
+ foo.setProperty(StateType.STRUCTURAL, "foo", "foo_new_value");
fooAssert.assertStructuralEquals("foo", "foo_new_value");
eventAssert.next(fooId, new
StructuralStateModification.Update(Collections.singletonMap("foo",
"foo_new_value")));
// Try a non string type
try
{
- foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ foo.setProperty(StateType.STRUCTURAL, "foo", 2);
fail("Property update should have been vetoed");
}
catch (StateChangeVetoException ignore)
@@ -290,7 +290,7 @@
// Try an update
try
{
- foo.setProperty(StateScopeType.STRUCTURAL, "foo",
"foo_new_value");
+ foo.setProperty(StateType.STRUCTURAL, "foo",
"foo_new_value");
fail("Property update should have been vetoed");
}
catch (StateChangeVetoException ignore)
@@ -302,7 +302,7 @@
// Try a non string type
try
{
- foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ foo.setProperty(StateType.STRUCTURAL, "foo", 2);
fail("Property update should have been vetoed");
}
catch (StateChangeVetoException ignore)
@@ -326,14 +326,14 @@
fooAssert.assertStructuralEquals("foo", null);
// Update structural property
- foo.setProperty(StateScopeType.STRUCTURAL, "foo",
"foo_new_value");
+ foo.setProperty(StateType.STRUCTURAL, "foo", "foo_new_value");
fooAssert.assertStructuralEquals("foo", "foo_new_value");
eventAssert.next(fooId, new
StructuralStateModification.Update(Collections.singletonMap("foo",
"foo_new_value")));
// Try a non string type
try
{
- foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ foo.setProperty(StateType.STRUCTURAL, "foo", 2);
fail("Property update should have been vetoed");
}
catch (StateChangeVetoException ignore)
@@ -359,7 +359,7 @@
// Try an update
try
{
- foo.setProperty(StateScopeType.STRUCTURAL, "foo",
"foo_new_value");
+ foo.setProperty(StateType.STRUCTURAL, "foo",
"foo_new_value");
fail("Property update should have been vetoed");
}
catch (StateChangeVetoException ignore)
@@ -371,7 +371,7 @@
// Try a non string type
try
{
- foo.setProperty(StateScopeType.STRUCTURAL, "foo", 2);
+ foo.setProperty(StateType.STRUCTURAL, "foo", 2);
fail("Property update should have been vetoed");
}
catch (StateChangeVetoException ignore)
@@ -394,11 +394,11 @@
fooAssert.assertNavigationalEquals("foo", null, String.class);
// Update navigational state
- foo.setProperty(StateScopeType.NAVIGATIONAL, "foo",
"foo_new_value");
+ foo.setProperty(StateType.NAVIGATIONAL, "foo",
"foo_new_value");
fooAssert.assertNavigationalEquals("foo", "foo_new_value",
String.class);
// Update navigational state
- foo.setProperty(StateScopeType.NAVIGATIONAL, "foo", 2);
+ foo.setProperty(StateType.NAVIGATIONAL, "foo", 2);
fooAssert.assertNavigationalEquals("foo", 2, Integer.class);
}
@@ -407,8 +407,8 @@
UIContext context = createContext();
//
- context.setProperty(StateScopeType.STRUCTURAL, "foo", "bar");
- context.setProperty(StateScopeType.STRUCTURAL, "foo", "bar2");
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar");
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar2");
}
public void testConcurrentStructuralPropertyDetection() throws MockException
@@ -416,7 +416,7 @@
UIContext context = createContext();
//
- context.setProperty(StateScopeType.STRUCTURAL, "foo", "bar");
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar");
// The concurrent update
model.getRoot().setPropertyValue("foo", "bar2");
@@ -424,7 +424,7 @@
//
try
{
- context.setProperty(StateScopeType.STRUCTURAL, "foo",
"bar3");
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar3");
fail("Was expecting an stale state exception");
}
catch (StaleStateException ignore)