JBoss Portal SVN: r10409 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-03-28 16:57:24 -0400 (Fri, 28 Mar 2008)
New Revision: 10409
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
Log:
- Use WSRPConstants.DEFAULT_LOCALES in Producer as well.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-03-28 20:55:59 UTC (rev 10408)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-03-28 20:57:24 UTC (rev 10409)
@@ -35,6 +35,7 @@
import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.registration.RegistrationUtils;
import org.jboss.portal.wsrp.ResponseDebugFactory;
+import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPProducer;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
@@ -121,7 +122,7 @@
private CookieProtocol requiresInitCookie = CookieProtocol.none;
/** Supported locales. */
- private String[] supportedLocales = new String[]{"en", "en-US"};
+ private String[] supportedLocales = WSRPConstants.DEFAULT_LOCALES;
private ProducerConfigurationService configurationService;
16 years, 1 month
JBoss Portal SVN: r10408 - in branches/JBoss_Portal_Branch_2_7: core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer and 8 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-03-28 16:55:59 -0400 (Fri, 28 Mar 2008)
New Revision: 10408
Added:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationChangeListener.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_7.xsd
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/strict-mode.xml
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/jboss-wsrp-producer_2_7.xsd
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/xml.xsd
Modified:
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
Log:
- Updated producer configuration schema to add strict mode and support for property description description to a new 2.7 version of the schema.
- JBPORTAL-1964:
+ Use producer configuration instead of jboss-service.xml for strict mode.
+ Added GUI configuration for producer. Needs more testing.
+ This won't be backported to 2.6 (which will keep using configuration via MBeans and won't provide a GUI interface to it).
- Use WSRPConstants.DEFAULT_LOCALES in Producer as well.
- Added more tests.
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -132,6 +132,16 @@
validatorClassName = className;
}
+ public boolean isStrictMode()
+ {
+ return getConfiguration().isUsingStrictMode();
+ }
+
+ public void setStrictMode(boolean strictMode)
+ {
+ getConfiguration().setUsingStrictMode(strictMode);
+ }
+
public List<RegistrationPropertyDescription> getRegistrationProperties()
{
Map descriptions = getRegRequirements().getRegistrationProperties();
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer/producer.xhtml 2008-03-28 20:55:59 UTC (rev 10408)
@@ -12,6 +12,9 @@
<h:selectBooleanCheckbox value="#{producer.registrationRequiredForFullDescription}"/>
<h:outputText value="Access to full service description requires consumers to be registered."/>
+ <h:selectBooleanCheckbox value="#{producer.strictMode}"/>
+ <h:outputText value="Use strict WSRP compliance."/>
+
<h:selectBooleanCheckbox value="#{producer.registrationRequired}" immediate="true"
onchange="this.form.submit()"
valueChangeListener="#{producer.requireRegistrationListener}"/>
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/config/ProducerConfigurationTestCase.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -30,17 +30,33 @@
import org.jboss.portal.registration.policies.RegistrationPropertyValidator;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
+import org.jboss.portal.wsrp.producer.config.ProducerConfigurationChangeListener;
import org.jboss.portal.wsrp.producer.config.ProducerConfigurationFactory;
+import org.jboss.portal.wsrp.producer.config.ProducerConfigurationProvider;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
+import org.jboss.portal.wsrp.producer.config.impl.ProducerConfigurationImpl;
import org.jboss.portal.wsrp.registration.LocalizedString;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.ObjectModelProvider;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.XercesXsMarshaller;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.xml.sax.SAXException;
import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
import java.net.URL;
import java.util.Locale;
import java.util.Map;
@@ -55,7 +71,16 @@
private Unmarshaller unmarshaller;
private ObjectModelFactory factory;
+ private static DefaultSchemaResolver RESOLVER;
+ static
+ {
+ RESOLVER = new DefaultSchemaResolver();
+ RESOLVER.setCacheResolvedSchemas(true);
+ RESOLVER.addSchemaLocation("http://www.w3.org/XML/1998/namespace", "xsd/xml.xsd");
+ RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_7", "xsd/jboss-wsrp-producer_2_7.xsd");
+ }
+
protected void setUp() throws Exception
{
unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
@@ -66,6 +91,8 @@
public void testCustomPolicyUnmarshalling() throws Exception
{
ProducerConfiguration producerConfiguration = getProducerConfiguration("custom-policy.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
assertNotNull(requirements);
RegistrationPolicy policy = requirements.getPolicy();
@@ -75,6 +102,8 @@
public void testExtendedUnmarshalling() throws Exception
{
ProducerConfiguration producerConfiguration = getProducerConfiguration("extended.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
assertNotNull(requirements);
RegistrationPolicy policy = requirements.getPolicy();
@@ -95,6 +124,8 @@
public void testMinimalRegistrationUnmarshalling() throws Exception
{
ProducerConfiguration producerConfiguration = getProducerConfiguration("minimal-registration.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
assertNotNull(requirements);
assertTrue(requirements.isRegistrationRequired());
@@ -108,6 +139,8 @@
public void testMinimalUnmarshalling() throws Exception
{
ProducerConfiguration producerConfiguration = getProducerConfiguration("minimal.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
ProducerRegistrationRequirements requirements = producerConfiguration.getRegistrationRequirements();
assertNotNull(requirements);
assertFalse(requirements.isRegistrationRequired());
@@ -164,12 +197,129 @@
}
}
+ public void testUseStrictMode() throws IOException, JBossXBException
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("strict-mode.xml");
+ assertFalse(producerConfiguration.isUsingStrictMode());
+ }
+
+ public void testChangeListeners() throws IOException, JBossXBException
+ {
+ ProducerConfiguration producerConfiguration = getProducerConfiguration("minimal.xml");
+ assertTrue(producerConfiguration.isUsingStrictMode());
+
+ TestProducerConfigurationChangeListener listener = new TestProducerConfigurationChangeListener();
+ producerConfiguration.addChangeListener(listener);
+ assertFalse(listener.called);
+
+ // we're not changing the value, the listeners shouldn't be called
+ producerConfiguration.setUsingStrictMode(true);
+ assertFalse(listener.called);
+
+ producerConfiguration.setUsingStrictMode(false);
+ assertFalse(producerConfiguration.isUsingStrictMode());
+ assertTrue(listener.called);
+ }
+
+ public void testSaveAndReload() throws IOException, ParserConfigurationException, SAXException, JBossXBException
+ {
+ ProducerConfiguration configuration = new ProducerConfigurationImpl();
+ configuration.setUsingStrictMode(false);
+ ProducerRegistrationRequirements registrationRequirements = configuration.getRegistrationRequirements();
+ registrationRequirements.setRegistrationRequiredForFullDescription(true);
+ registrationRequirements.setRegistrationRequired(true);
+ String prop1 = "prop1";
+ registrationRequirements.addEmptyRegistrationProperty(prop1);
+ registrationRequirements.getRegistrationPropertyWith(prop1).setDefaultLabel("label1");
+ String prop2 = "prop2";
+ registrationRequirements.addEmptyRegistrationProperty(prop2);
+ registrationRequirements.getRegistrationPropertyWith(prop2).setDefaultHint("hint2");
+ String prop3 = "prop3";
+ registrationRequirements.addEmptyRegistrationProperty(prop3);
+ registrationRequirements.getRegistrationPropertyWith(prop3).setDefaultDescription("description3");
+ String prop4 = "prop4";
+ registrationRequirements.addEmptyRegistrationProperty(prop4);
+ RegistrationPropertyDescription propDesc4 = registrationRequirements.getRegistrationPropertyWith(prop4);
+ propDesc4.setDefaultLabel("label4");
+ propDesc4.setDefaultHint("hint4");
+ propDesc4.setDefaultDescription("description4");
+
+ File tmp = File.createTempFile("producer-configuration-test-case", "xml");
+ tmp.deleteOnExit();
+
+ writeConfigToFile(configuration, tmp);
+
+ configuration = getProducerConfiguration(tmp.toURL());
+
+ assertFalse(configuration.isUsingStrictMode());
+
+ registrationRequirements = configuration.getRegistrationRequirements();
+ assertTrue(registrationRequirements.isRegistrationRequired());
+ assertTrue(registrationRequirements.isRegistrationRequiredForFullDescription());
+
+ assertEquals(4, registrationRequirements.getRegistrationProperties().size());
+ assertEquals("label1", registrationRequirements.getRegistrationPropertyWith(prop1).getLabel().getValue());
+ assertEquals("hint2", registrationRequirements.getRegistrationPropertyWith(prop2).getHint().getValue());
+ assertEquals("description3", registrationRequirements.getRegistrationPropertyWith(prop3).getDescription().getValue());
+ propDesc4 = registrationRequirements.getRegistrationPropertyWith(prop4);
+ assertEquals("label4", propDesc4.getLabel().getValue());
+ assertEquals("hint4", propDesc4.getHint().getValue());
+ assertEquals("description4", propDesc4.getDescription().getValue());
+ }
+
+ private void writeConfigToFile(ProducerConfiguration configuration, File file)
+ throws IOException, ParserConfigurationException, SAXException
+ {
+ StringWriter xmlOutput = new StringWriter();
+
+ // get the XML Schema source
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("xsd/jboss-wsrp-producer_2_7.xsd");
+
+ Reader xsReader = new InputStreamReader(is);
+
+ // create an instance of XML Schema marshaller
+ XercesXsMarshaller marshaller = new XercesXsMarshaller();
+
+ marshaller.setSchemaResolver(RESOLVER);
+
+ // we need to specify what elements are top most (roots) providing namespace URI, prefix and local name
+ marshaller.addRootElement("urn:jboss:portal:wsrp:producer:v2_7", "", "producer-configuration");
+
+ // declare default namespace
+ marshaller.declareNamespace("wpc", "urn:jboss:portal:wsrp:producer:v2_7");
+
+ // add schema location by declaring xsi namespace and adding xsi:schemaLocation attribute
+ marshaller.declareNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ marshaller.addAttribute("xsi", "schemaLocation", "string",
+ "urn:jboss:portal:wsrp:producer:v2_7 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_7.xsd");
+
+ // create an instance of Object Model Provider
+ ObjectModelProvider provider = new ProducerConfigurationProvider();
+
+ marshaller.setProperty("org.jboss.xml.binding.marshalling.indent", "true");
+ marshaller.marshal(xsReader, provider, configuration, xmlOutput);
+
+ // close XML Schema reader
+ xsReader.close();
+
+ file.createNewFile();
+ Writer configFile = new BufferedWriter(new FileWriter(file));
+ configFile.write(xmlOutput.toString());
+ configFile.flush();
+ configFile.close();
+ }
+
private ProducerConfiguration getProducerConfiguration(String fileName) throws JBossXBException, IOException
{
URL location = Thread.currentThread().getContextClassLoader().getResource(fileName);
assertNotNull(location);
System.out.println("location = " + location);
+ return getProducerConfiguration(location);
+ }
+
+ private ProducerConfiguration getProducerConfiguration(URL location) throws JBossXBException, IOException
+ {
Object o = unmarshaller.unmarshal(location.openStream(), factory, null);
assertNotNull(o);
assertTrue(o instanceof ProducerConfiguration);
@@ -193,4 +343,14 @@
localizedString.setValue("label" + index);
assertEquals(localizedString, desc.getLabel());
}
+
+ private static class TestProducerConfigurationChangeListener implements ProducerConfigurationChangeListener
+ {
+ boolean called = false;
+
+ public void usingStrictModeChangedTo(boolean strictMode)
+ {
+ called = true;
+ }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -36,6 +36,7 @@
import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.registration.RegistrationUtils;
import org.jboss.portal.wsrp.ResponseDebugFactory;
+import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPProducer;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
@@ -79,6 +80,7 @@
import org.jboss.portal.wsrp.core.UnsupportedModeFault;
import org.jboss.portal.wsrp.core.UnsupportedWindowStateFault;
import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
+import org.jboss.portal.wsrp.producer.config.ProducerConfigurationChangeListener;
import org.jboss.portal.wsrp.producer.config.ProducerConfigurationService;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
@@ -92,7 +94,7 @@
* @version $Revision$
* @since 2.4
*/
-public class WSRPProducerImpl extends AbstractJBossService implements WSRPProducer
+public class WSRPProducerImpl extends AbstractJBossService implements WSRPProducer, ProducerConfigurationChangeListener
{
/** logger used for logging ;) */
private static final Logger log = Logger.getLogger(WSRPProducerImpl.class);
@@ -123,7 +125,7 @@
private CookieProtocol requiresInitCookie = CookieProtocol.none;
/** Supported locales. */
- private String[] supportedLocales = new String[]{"en", "en-US"};
+ private String[] supportedLocales = WSRPConstants.DEFAULT_LOCALES;
private ProducerConfigurationService configurationService;
@@ -270,17 +272,16 @@
return configurationService;
}
- public void setUseStrictMode(boolean strict)
- {
- RegistrationUtils.setStrict(strict);
- }
-
protected void startService() throws Exception
{
super.startService();
producerConfiguration = configurationService.getConfiguration();
+ // register to listen to changes in configuration and get initial state
+ producerConfiguration.addChangeListener(this);
+ usingStrictModeChangedTo(producerConfiguration.isUsingStrictMode());
+
ProducerRegistrationRequirements registrationRequirements = getProducerRegistrationRequirements();
registrationRequirements.addRegistrationPolicyChangeListener(registrationManager);
registrationRequirements.addRegistrationPropertyChangeListener(registrationManager);
@@ -297,6 +298,8 @@
registrationRequirements.removeRegistrationPropertyChangeListener(registrationManager);
registrationRequirements.removeRegistrationPolicyChangeListener(registrationManager);
+ producerConfiguration.removeChangeListener(this);
+
super.stopService();
}
@@ -528,4 +531,8 @@
return supportedLocales; // todo: avoid hardcoding this at some point...
}
+ public void usingStrictModeChangedTo(boolean strictMode)
+ {
+ RegistrationUtils.setStrict(strictMode);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfiguration.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -31,4 +31,12 @@
public interface ProducerConfiguration
{
ProducerRegistrationRequirements getRegistrationRequirements();
+
+ boolean isUsingStrictMode();
+
+ void setUsingStrictMode(boolean strict);
+
+ void addChangeListener(ProducerConfigurationChangeListener listener);
+
+ void removeChangeListener(ProducerConfigurationChangeListener listener);
}
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationChangeListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationChangeListener.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationChangeListener.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -0,0 +1,32 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, 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.wsrp.producer.config;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public interface ProducerConfigurationChangeListener
+{
+ void usingStrictModeChangedTo(boolean strictMode);
+}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationFactory.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -61,7 +61,9 @@
if ("producer-configuration".equals(localName))
{
- return new ProducerConfigurationImpl();
+ ProducerConfiguration producerConfiguration = new ProducerConfigurationImpl();
+ producerConfiguration.setUsingStrictMode(getBooleanAttributeValue(attrs, "useStrictMode", true));
+ return producerConfiguration;
}
throw new IllegalArgumentException("The processed file doesn't seem to have the proper format, " +
"was expecting producer-configuration, instead got " + localName);
@@ -84,19 +86,7 @@
ProducerRegistrationRequirements registrationRequirements = new ProducerRegistrationRequirementsImpl();
registrationRequirements.setRegistrationRequired(true);
- String descRequiresRegistration = attrs.getValue("fullServiceDescriptionRequiresRegistration");
- if ("true".equals(descRequiresRegistration))
- {
- registrationRequirements.setRegistrationRequiredForFullDescription(true);
- }
- else if (descRequiresRegistration == null || "false".equals(descRequiresRegistration))
- {
- registrationRequirements.setRegistrationRequiredForFullDescription(false);
- }
- else
- {
- throw new IllegalArgumentException("Invalid value for fullServiceDescriptionRequiresRegistration attribute. Acceptable values are: true, false.");
- }
+ registrationRequirements.setRegistrationRequiredForFullDescription(getBooleanAttributeValue(attrs, "fullServiceDescriptionRequiresRegistration", false));
registrationDone = true;
return registrationRequirements;
}
@@ -180,7 +170,7 @@
System.out.println("newchild desc " + localName);
}
- if ("hint".equals(localName) || "label".equals(localName))
+ if ("hint".equals(localName) || "label".equals(localName) || "description".equals(localName))
{
String lang = attrs.getValue("xml:lang");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "xml:lang", localName);
@@ -256,5 +246,36 @@
{
desc.setLabel(string);
}
+ else if ("description".equals(localName))
+ {
+ desc.setDescription(string);
+ }
}
+
+ private boolean getBooleanAttributeValue(Attributes attrs, String attributeName, boolean defaultValue)
+ {
+ String value = attrs.getValue(attributeName);
+
+ // figure out which is the default value
+ String defaultString = "false";
+ String other = "true";
+ if (defaultValue)
+ {
+ defaultString = "true";
+ other = "false";
+ }
+
+ if (other.equals(value))
+ {
+ return !defaultValue;
+ }
+ else if (value == null || defaultString.equals(value))
+ {
+ return defaultValue;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid value for " + attributeName + " attribute. Acceptable values are: true, false.");
+ }
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -75,9 +75,19 @@
public Object getAttributeValue(ProducerConfigurationImpl configuration, String namespaceUri, String localName)
{
+ if ("useStrictMode".equals(localName))
+ {
+ return configuration.isUsingStrictMode();
+ }
+
+ return null;
+ }
+
+ public Object getAttributeValue(ProducerRegistrationRequirementsImpl regReq, String namespaceUri, String localName)
+ {
if ("fullServiceDescriptionRequiresRegistration".equals(localName))
{
- return configuration.getRegistrationRequirements().isRegistrationRequiredForFullDescription();
+ return regReq.isRegistrationRequiredForFullDescription();
}
return null;
@@ -129,6 +139,10 @@
{
value = getLocalizedStringOrNull(propertyDescription.getHint());
}
+ else if ("description".equals(localName))
+ {
+ value = getLocalizedStringOrNull(propertyDescription.getDescription());
+ }
return value;
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -23,9 +23,14 @@
package org.jboss.portal.wsrp.producer.config.impl;
+import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
+import org.jboss.portal.wsrp.producer.config.ProducerConfigurationChangeListener;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -35,6 +40,11 @@
{
private ProducerRegistrationRequirements requirements;
+ // use strict mode by default
+ private boolean strictMode = true;
+
+ private List<ProducerConfigurationChangeListener> listeners = new ArrayList<ProducerConfigurationChangeListener>(7);
+
public ProducerRegistrationRequirements getRegistrationRequirements()
{
if (requirements == null)
@@ -45,6 +55,35 @@
return requirements;
}
+ public boolean isUsingStrictMode()
+ {
+ return strictMode;
+ }
+
+ public void setUsingStrictMode(boolean strict)
+ {
+ if (strictMode != strict)
+ {
+ strictMode = strict;
+ for (ProducerConfigurationChangeListener listener : listeners)
+ {
+ listener.usingStrictModeChangedTo(strict);
+ }
+ }
+ }
+
+ public void addChangeListener(ProducerConfigurationChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener, "ProducerConfigurationChangeListener");
+ listeners.add(listener);
+ }
+
+ public void removeChangeListener(ProducerConfigurationChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener, "ProducerConfigurationChangeListener");
+ listeners.remove(listener);
+ }
+
public void setRegistrationRequirements(ProducerRegistrationRequirements requirements)
{
this.requirements = requirements;
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationServiceImpl.java 2008-03-28 20:55:59 UTC (rev 10408)
@@ -73,6 +73,7 @@
RESOLVER.setCacheResolvedSchemas(true);
RESOLVER.addSchemaLocation("http://www.w3.org/XML/1998/namespace", "xsd/xml.xsd");
RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_6", "xsd/jboss-wsrp-producer_2_6.xsd");
+ RESOLVER.addSchemaLocation("urn:jboss:portal:wsrp:producer:v2_7", "xsd/jboss-wsrp-producer_2_7.xsd");
}
public String getConfigLocation()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2008-03-28 20:43:08 UTC (rev 10407)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2008-03-28 20:55:59 UTC (rev 10408)
@@ -38,8 +38,6 @@
<depends optional-attribute-name="ProducerConfigurationService" proxy-type="attribute">
portal.wsrp:service=ProducerConfiguration
</depends>
- <attribute name="UseStrictMode">true</attribute>
- <!-- Set to false to switch to lenient mode -->
</mbean>
<!-- Registration manager -->
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_7.xsd
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_7.xsd (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_7.xsd 2008-03-28 20:55:59 UTC (rev 10408)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:jboss:portal:wsrp:producer:v2_7"
+ xmlns="urn:jboss:portal:wsrp:producer:v2_7"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ xmlns:wpc="urn:jboss:portal:wsrp:producer:v2_7" elementFormDefault="qualified">
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
+
+ <xs:element name="producer-configuration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="registration-configuration" type="wpc:RegistrationConfiguration"/>
+ </xs:sequence>
+ <xs:attribute name="useStrictMode" type="xs:boolean" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="RegistrationConfiguration">
+ <xs:sequence>
+ <xs:element name="registration-policy" type="xs:string" minOccurs="0"/>
+ <xs:element name="registration-property-validator" type="xs:string" minOccurs="0"/>
+ <xs:element name="registration-property-description" type="wpc:RegistrationPropertyDescription" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="fullServiceDescriptionRequiresRegistration" type="xs:boolean" use="optional"/>
+ </xs:complexType>
+
+ <xs:complexType name="RegistrationPropertyDescription">
+ <xs:sequence>
+ <xs:element name="name" type="xs:QName"/>
+ <xs:element name="type" type="xs:QName"/>
+ <xs:element name="label" type="wpc:LocalizedString" minOccurs="0"/>
+ <xs:element name="hint" type="wpc:LocalizedString" minOccurs="0"/>
+ <xs:element name="description" type="wpc:LocalizedString" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="LocalizedString">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute ref="xml:lang" use="required"/>
+ <xs:attribute name="resourceName" type="xs:string" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+</xs:schema>
Added: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/strict-mode.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/strict-mode.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/strict-mode.xml 2008-03-28 20:55:59 UTC (rev 10408)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<producer-configuration xmlns="urn:jboss:portal:wsrp:producer:v2_6"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:portal:wsrp:producer:v2_6 http://www.jboss.org/portal/xsd/jboss-wsrp-producer_2_6.xsd"
+ useStrictMode="false"/>
\ No newline at end of file
Copied: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/jboss-wsrp-producer_2_7.xsd (from rev 10400, branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/jboss-wsrp-producer_2_7.xsd (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/jboss-wsrp-producer_2_7.xsd 2008-03-28 20:55:59 UTC (rev 10408)
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2008, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:jboss:portal:wsrp:producer:v2_7"
+ xmlns="urn:jboss:portal:wsrp:producer:v2_7"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ xmlns:wpc="urn:jboss:portal:wsrp:producer:v2_7" elementFormDefault="qualified">
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
+
+ <xs:element name="producer-configuration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="registration-configuration" type="wpc:RegistrationConfiguration"/>
+ </xs:sequence>
+ <xs:attribute name="useStrictMode" type="xs:boolean" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="RegistrationConfiguration">
+ <xs:sequence>
+ <xs:element name="registration-policy" type="xs:string" minOccurs="0"/>
+ <xs:element name="registration-property-validator" type="xs:string" minOccurs="0"/>
+ <xs:element name="registration-property-description" type="wpc:RegistrationPropertyDescription" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="fullServiceDescriptionRequiresRegistration" type="xs:boolean" use="optional"/>
+ </xs:complexType>
+
+ <xs:complexType name="RegistrationPropertyDescription">
+ <xs:sequence>
+ <xs:element name="name" type="xs:QName"/>
+ <xs:element name="type" type="xs:QName"/>
+ <xs:element name="label" type="wpc:LocalizedString" minOccurs="0"/>
+ <xs:element name="hint" type="wpc:LocalizedString" minOccurs="0"/>
+ <xs:element name="description" type="wpc:LocalizedString" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="LocalizedString">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute ref="xml:lang" use="required"/>
+ <xs:attribute name="resourceName" type="xs:string" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+</xs:schema>
Property changes on: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/jboss-wsrp-producer_2_7.xsd
___________________________________________________________________
Name: svn:keywords
+ LastChangedDate LastChangedBy LastChangedRevision Id
Copied: branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/xml.xsd (from rev 10400, branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/portal-wsrp-sar/xsd/xml.xsd)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/xml.xsd (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/resources/tests/test-producer-configuration-lib-jar/xsd/xml.xsd 2008-03-28 20:55:59 UTC (rev 10408)
@@ -0,0 +1,151 @@
+<?xml version='1.0'?>
+
+<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xml:lang="en">
+
+ <xs:annotation>
+ <xs:documentation>
+ See http://www.w3.org/XML/1998/namespace.html and
+ http://www.w3.org/TR/REC-xml for information about this namespace.
+
+ This schema document describes the XML namespace, in a form
+ suitable for import by other schema documents.
+
+ Note that local names in this namespace are intended to be defined
+ only by the World Wide Web Consortium or its subgroups. The
+ following names are currently defined in this namespace and should
+ not be used with conflicting semantics by any Working Group,
+ specification, or document instance:
+
+ base (as an attribute name): denotes an attribute whose value
+ provides a URI to be used as the base for interpreting any
+ relative URIs in the scope of the element on which it
+ appears; its value is inherited. This name is reserved
+ by virtue of its definition in the XML Base specification.
+
+ id (as an attribute name): denotes an attribute whose value
+ should be interpreted as if declared to be of type ID.
+ This name is reserved by virtue of its definition in the
+ xml:id specification.
+
+ lang (as an attribute name): denotes an attribute whose value
+ is a language code for the natural language of the content of
+ any element; its value is inherited. This name is reserved
+ by virtue of its definition in the XML specification.
+
+ space (as an attribute name): denotes an attribute whose
+ value is a keyword indicating what whitespace processing
+ discipline is intended for the content of the element; its
+ value is inherited. This name is reserved by virtue of its
+ definition in the XML specification.
+
+ Father (in any context at all): denotes Jon Bosak, the chair of
+ the original XML Working Group. This name is reserved by
+ the following decision of the W3C XML Plenary and
+ XML Coordination groups:
+
+ In appreciation for his vision, leadership and dedication
+ the W3C XML Plenary on this 10th day of February, 2000
+ reserves for Jon Bosak in perpetuity the XML name
+ xml:Father
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>This schema defines attributes and an attribute group
+ suitable for use by
+ schemas wishing to allow xml:base, xml:lang, xml:space or xml:id
+ attributes on elements they define.
+
+ To enable this, such a schema must import this schema
+ for the XML namespace, e.g. as follows:
+ <schema . . .>
+ . . .
+ <import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+
+ Subsequently, qualified reference to any of the attributes
+ or the group defined below will have the desired effect, e.g.
+
+ <type . . .>
+ . . .
+ <attributeGroup ref="xml:specialAttrs"/>
+
+ will define a type which will schema-validate an instance
+ element with any of those attributes
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>In keeping with the XML Schema WG's standard versioning
+ policy, this schema document will persist at
+ http://www.w3.org/2007/08/xml.xsd.
+ At the date of issue it can also be found at
+ http://www.w3.org/2001/xml.xsd.
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XML Schema
+ itself, or with the XML namespace itself. In other words, if the XML
+ Schema or XML namespaces change, the version of this document at
+ http://www.w3.org/2001/xml.xsd will change
+ accordingly; the version at
+ http://www.w3.org/2007/08/xml.xsd will not change.
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang">
+ <xs:annotation>
+ <xs:documentation>Attempting to install the relevant ISO 2- and 3-letter
+ codes as the enumerated possible values is probably never
+ going to be a realistic possibility. See
+ RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry
+ at http://www.iana.org/assignments/lang-tag-apps.htm for
+ further information.
+
+ The union allows for the 'un-declaration' of xml:lang with
+ the empty string.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:language">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value=""/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="space">
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="base" type="xs:anyURI">
+ <xs:annotation>
+ <xs:documentation>See http://www.w3.org/TR/xmlbase/ for
+ information about this attribute.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="id" type="xs:ID">
+ <xs:annotation>
+ <xs:documentation>See http://www.w3.org/TR/xml-id/ for
+ information about this attribute.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+ <xs:attribute ref="xml:base"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute ref="xml:space"/>
+ <xs:attribute ref="xml:id"/>
+ </xs:attributeGroup>
+
+</xs:schema>
16 years, 1 month
JBoss Portal SVN: r10407 - branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-03-28 16:43:08 -0400 (Fri, 28 Mar 2008)
New Revision: 10407
Modified:
branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
Log:
admin portlet migration
Modified: branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2008-03-28 20:35:59 UTC (rev 10406)
+++ branches/JBoss_Portal_2_6_4_JBPB/core-admin/src/resources/portal-admin-war/WEB-INF/web.xml 2008-03-28 20:43:08 UTC (rev 10407)
@@ -28,72 +28,84 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
- <!-- Bridge specific configuration -->
<context-param>
- <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
- <param-value>
- org.jboss.portletbridge.application.FaceletPortletViewHandler
- </param-value>
- </context-param>
+ <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+ <param-value>org.jboss.portletbridge.application.FaceletPortletViewHandler</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.portlet.faces.renderPolicy</param-name>
+ <param-value>DEFAULT</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.portlet.faces.preserveActionParams</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
+ <param-value>rfRes</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.LoadStyleStrategy</param-name>
+ <param-value>NONE</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>NONE</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <!-- JSF -->
+
<context-param>
- <param-name>javax.portlet.faces.renderPolicy</param-name>
- <param-value>ALWAYS_DELEGATE</param-value>
- </context-param>
- <context-param>
- <param-name>javax.portlet.faces.preserveActionParams</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
- <param-value>rfRes</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.LoadStyleStrategy</param-name>
- <param-value>NONE</param-value>
- </context-param>
- <context-param>
- <param-name>org.richfaces.LoadScriptStrategy</param-name>
- <param-value>NONE</param-value>
- </context-param>
- <context-param>
- <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
- <param-value>false</param-value>
- </context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
- <!-- Facelet configuration -->
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
<context-param>
- <param-name>facelets.DEVELOPMENT</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
- <param-name>facelets.SKIP_COMMENTS</param-name>
- <param-value>true</param-value>
- </context-param>
- <context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/WEB-INF/portal.taglib.xml</param-value>
</context-param>
- <!-- JSF configuration -->
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
- </context-param>
- <context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>server</param-value>
- </context-param>
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>FacesServlet</servlet-name>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
- <!-- The JSF servlet -->
- <servlet>
- <servlet-name>FacesServlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
+ <servlet>
+ <servlet-name>FacesServlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
- <servlet-mapping>
- <servlet-name>FacesServlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>FacesServlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
</web-app>
16 years, 1 month
JBoss Portal SVN: r10406 - in branches/presentation/presentation: src/main/org/jboss/portal/presentation/impl/model2 and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-28 16:35:59 -0400 (Fri, 28 Mar 2008)
New Revision: 10406
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UpdateObjectTestCase.java
Modified:
branches/presentation/presentation/build.xml
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/CreateUpdatePhase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/ObjectUpdate.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/UIObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ViewPortContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java
Log:
add test case for property updates
Modified: branches/presentation/presentation/build.xml
===================================================================
--- branches/presentation/presentation/build.xml 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/build.xml 2008-03-28 20:35:59 UTC (rev 10406)
@@ -319,6 +319,7 @@
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.AddChildTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.RemoveChildTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.MoveChildTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.UpdateObjectTestCase"/>
</x-test>
<x-classpath>
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -27,6 +27,7 @@
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -36,7 +37,7 @@
{
/** . */
- public final StructuralObject structuralObject;
+ public StructuralObject structuralObject;
/** We keep track of what was loaded by the scope. */
public Map<String, UIObjectRef> childRefs;
@@ -61,6 +62,11 @@
return safeCast(getProperty(propertyName), propertyType);
}
+ public Set<String> getPropertyNames()
+ {
+ return structuralObject.getState().getProperties().keySet();
+ }
+
public Object getProperty(String propertyName) throws IllegalArgumentException, StateException
{
if (propertyName == null)
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/CreateUpdatePhase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/CreateUpdatePhase.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/CreateUpdatePhase.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -211,7 +211,7 @@
if (object != null)
{
return new ObjectUpdate.UpdateObject(
- object.getId(),
+ object.structuralObject,
childrenStatus,
addedChildrenUpdates,
removedChildrenUpdates,
@@ -255,7 +255,7 @@
}
//
- return new ObjectUpdate.UpdateObject(object.getId(), removedChildrenUpdates);
+ return new ObjectUpdate.UpdateObject(object.structuralObject, removedChildrenUpdates);
}
else
{
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/ObjectUpdate.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/ObjectUpdate.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/ObjectUpdate.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.impl.model2.UIObjectImpl;
import org.jboss.portal.presentation.impl.model2.UIObjectRef;
import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import java.util.List;
import java.util.HashMap;
@@ -46,7 +47,7 @@
{
/** . */
- final String objectId;
+ final StructuralObject structuralObject;
/** . */
final Map<String, Boolean> childrenStatus;
@@ -60,9 +61,9 @@
/** . */
final List<UpdateObject> updateChildrenUpdates;
- public UpdateObject(String objectId, List<RemoveChild> removeChildrenUpdates)
+ public UpdateObject(StructuralObject structuralObject, List<RemoveChild> removeChildrenUpdates)
{
- if (objectId == null)
+ if (structuralObject == null)
{
throw new IllegalArgumentException("No null object id accepted");
}
@@ -72,7 +73,7 @@
}
//
- this.objectId = objectId;
+ this.structuralObject = structuralObject;
this.childrenStatus = null;
this.addedChildrenUpdates = null;
this.removedChildrenUpdates = removeChildrenUpdates;
@@ -80,13 +81,13 @@
}
public UpdateObject(
- String objectId,
+ StructuralObject structuralObject,
Map<String, Boolean> childrenStatus,
List<AddChild> addedChildrenUpdates,
List<RemoveChild> removedChildrenUpdates,
List<UpdateObject> updateChildrenUpdates)
{
- if (objectId == null)
+ if (structuralObject == null)
{
throw new IllegalArgumentException("No null object id accepted");
}
@@ -104,7 +105,7 @@
}
//
- this.objectId = objectId;
+ this.structuralObject = structuralObject;
this.childrenStatus = childrenStatus;
this.addedChildrenUpdates = addedChildrenUpdates;
this.removedChildrenUpdates = removedChildrenUpdates;
@@ -113,7 +114,7 @@
public void execute(ViewPortContext context)
{
- UIObjectImpl object = (UIObjectImpl)context.getObject(objectId);
+ UIObjectImpl object = (UIObjectImpl)context.getObject(structuralObject.getId());
// Normally should be ok because if we have removed children updates it means
// that it was created because the existing object was referencing children
@@ -122,6 +123,13 @@
removedChildUpdate.execute(context);
}
+ // Perform state update
+ if (object.structuralObject.compareTo(structuralObject))
+ {
+ object.structuralObject = structuralObject;
+ context.updateObject(structuralObject.getId());
+ }
+
//
if (childrenStatus != null)
{
@@ -134,7 +142,7 @@
}
//
- context.createChildren(objectId);
+ context.createChildren(structuralObject.getId());
}
//
@@ -153,7 +161,7 @@
{
if (object.childRefs != null)
{
- context.destroyChildren(objectId);
+ context.destroyChildren(structuralObject.getId());
}
}
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/UIObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/UIObject.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/UIObject.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -24,6 +24,8 @@
import org.jboss.portal.presentation.model.state.StateException;
+import java.util.Set;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -55,4 +57,11 @@
* @throws org.jboss.portal.presentation.model.state.StateException any state exception
*/
<T> T getProperty(String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException;
+
+ /**
+ * Returns the set of property names of this object
+ *
+ * @return the property names
+ */
+ Set<String> getPropertyNames();
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ViewPortContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ViewPortContext.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ViewPortContext.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -33,6 +33,8 @@
void removeObject(String objectId);
+ void updateObject(String objectId);
+
void addObject(UIObject object);
void createChildren(String parentId);
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -57,12 +57,16 @@
/** . */
private NodeDef parent;
+ /** . */
+ private final Map<String, String> properties;
+
private NodeDef(String name)
{
this.name = name;
this.children = new HashMap<String, NodeDef>();
this.traversal = ObjectTraversalType.RECURSIVE;
this.parent = null;
+ this.properties = new HashMap<String, String>();
}
public String getName()
@@ -90,6 +94,35 @@
this.traversal = traversal;
}
+ public void setProperty(String name, String value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (value != null)
+ {
+ properties.put(name, value);
+ }
+ else
+ {
+ properties.remove(name);
+ }
+ }
+
+ public String getProperty(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return properties.get(name);
+ }
+
public NodeDef addChild(String name)
{
if (children.containsKey(name))
@@ -131,7 +164,7 @@
{
for (Map.Entry<String, NodeDef> childNodeEntry : children.entrySet())
{
- MockObject child = object.addChild(childNodeEntry.getKey(), MockObject.Type.PORTAL);
+ MockObject child = object.addChild(childNodeEntry.getKey(), MockObject.Type.PORTAL, properties);
childNodeEntry.getValue().populate(child);
}
}
@@ -139,6 +172,13 @@
public void assertEquals(UIObjectNode objectNode)
{
Assert.assertEquals(name, objectNode.getObject().getName());
+ Assert.assertEquals(properties.keySet(), objectNode.getProperties().keySet());
+ for (String propertyName : properties.keySet())
+ {
+ String expectedProperty = properties.get(propertyName);
+ String property = objectNode.getProperties().get(propertyName);
+ Assert.assertEquals(expectedProperty, property);
+ }
//
switch (traversal)
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -40,6 +40,9 @@
/** . */
private Map<String, UIObjectNode> children;
+ /** . */
+ private Map<String, String> properties;
+
public UIObjectNode(UIObject object)
{
if (object == null)
@@ -49,8 +52,28 @@
//
this.object = object;
+ this.properties = new HashMap<String, String>();
+
+ //
+ updateState();
}
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public void updateState()
+ {
+ properties.clear();
+
+ for (String name : object.getPropertyNames())
+ {
+ String value = object.getProperty(name, String.class);
+ properties.put(name, value);
+ }
+ }
+
public UIObject getObject()
{
return object;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java 2008-03-28 19:57:44 UTC (rev 10405)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -77,6 +77,18 @@
return node != null ? node.getObject() : null;
}
+ public void updateObject(String objectId)
+ {
+ UIObjectNode node = nodes.get(objectId);
+ if (node == null)
+ {
+ throw new IllegalStateException("No such object " + objectId);
+ }
+
+ //
+ node.updateState();
+ }
+
public void removeObject(String objectId)
{
if (nodes.remove(objectId) == null)
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UpdateObjectTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UpdateObjectTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UpdateObjectTestCase.java 2008-03-28 20:35:59 UTC (rev 10406)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPort;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UpdateObjectTestCase extends TraversalModelTestCase
+{
+
+ public void testUpdateObject()
+ {
+ test(0, null);
+ }
+
+ protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after, Object handback)
+ {
+ NodeDef rootDef = NodeDef.create();
+ NodeDef fooDef = rootDef.addChild("foo");
+
+ //
+ rootDef.populate(mockModel);
+
+ //
+ ViewPortScope scope = new CustomScope(model, rootDef);
+ UIObjectTree context = new UIObjectTree();
+ ViewPort viewPort = model.createViewPort(context, scope);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+
+ //
+ mockModel.getRoot().getChild("foo").setPropertyValue("juu", "daa");
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+
+ //
+ mockModel.getRoot().getChild("foo").setPropertyValue("juu", null);
+ mockModel.getRoot().getChild("foo").setPropertyValue("daa", "juu");
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ }
+}
16 years, 1 month
JBoss Portal SVN: r10405 - in branches/presentation/presentation: src/main/org/jboss/portal/presentation/impl/model2 and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-28 15:57:44 -0400 (Fri, 28 Mar 2008)
New Revision: 10405
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectRef.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/
Removed:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/
Modified:
branches/presentation/presentation/build.xml
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/ChildrenVisit.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/CreateDiffPhase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/ObjectVisit.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/CreateUpdatePhase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/ObjectUpdate.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java
Log:
reorg new model impl
Modified: branches/presentation/presentation/build.xml
===================================================================
--- branches/presentation/presentation/build.xml 2008-03-28 19:54:35 UTC (rev 10404)
+++ branches/presentation/presentation/build.xml 2008-03-28 19:57:44 UTC (rev 10405)
@@ -315,13 +315,6 @@
<!--<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.ModelTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.EventTestCase"/>-->
-<!--
- <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.ModelTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.AddChildTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.RemoveChildTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.MoveChildTestCase"/>
--->
-
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.ModelTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.AddChildTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.RemoveChildTestCase"/>
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java (from rev 10403, branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIModelImpl.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.model2.UIModel;
+import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPort;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIModelImpl implements UIModel
+{
+
+ /** . */
+ final NavigationalStateContext navigationalStateContext;
+
+ /** . */
+ final StructuralStateContext structuralStateContext;
+
+ public UIModelImpl(NavigationalStateContext navigationalStateContext, StructuralStateContext structuralStateContext)
+ {
+ this.navigationalStateContext = navigationalStateContext;
+ this.structuralStateContext = structuralStateContext;
+ }
+
+ public NavigationalStateContext getNavigationalStateContext()
+ {
+ return navigationalStateContext;
+ }
+
+ public StructuralStateContext getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ public String getRootId()
+ {
+ return structuralStateContext.getRootId();
+ }
+
+ public ViewPort createViewPort(ViewPortContext context, ViewPortScope scope)
+ {
+ return new ViewPortImpl(this, context, scope);
+ }
+}
\ No newline at end of file
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java (from rev 10403, branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectImpl.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2;
+
+import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIObjectImpl implements UIObject
+{
+
+ /** . */
+ public final StructuralObject structuralObject;
+
+ /** We keep track of what was loaded by the scope. */
+ public Map<String, UIObjectRef> childRefs;
+
+ public UIObjectImpl(StructuralObject structuralObject)
+ {
+ this.structuralObject = structuralObject;
+ }
+
+ public String getId()
+ {
+ return structuralObject.getId();
+ }
+
+ public String getName()
+ {
+ return structuralObject.getState().getName();
+ }
+
+ public <T> T getProperty(String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException
+ {
+ return safeCast(getProperty(propertyName), propertyType);
+ }
+
+ public Object getProperty(String propertyName) throws IllegalArgumentException, StateException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return structuralObject.getState().getProperties().get(propertyName);
+ }
+
+ /**
+ * Attempt to cast the value argument to the provided type argument. If the value argument type is assignable
+ * to the provided type, the value is returned, otherwise if it is not or the value is null, null is returned.
+ *
+ * @param value the value to cast
+ * @param type the type to downcast
+ * @return the casted value or null
+ */
+ private <T> T safeCast(Object value, Class<T> type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (value == null)
+ {
+ return null;
+ }
+ else
+ {
+ if (type.isAssignableFrom(value.getClass()))
+ {
+ return type.cast(value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
\ No newline at end of file
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectRef.java (from rev 10403, branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectRef.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectRef.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectRef.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIObjectRef
+{
+
+ /** The child id. */
+ final String id;
+
+ /** Whether or not the child is loaded. */
+ public boolean loaded;
+
+ public UIObjectRef(String id, boolean loaded)
+ {
+ this.id = id;
+ this.loaded = loaded;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java (from rev 10403, branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/ViewPortImpl.java)
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2;
+
+import org.jboss.portal.presentation.model2.ViewPort;
+import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.impl.model2.diff.CreateDiffPhase;
+import org.jboss.portal.presentation.impl.model2.diff.ObjectVisit;
+import org.jboss.portal.presentation.impl.model2.update.CreateUpdatePhase;
+import org.jboss.portal.presentation.impl.model2.update.ObjectUpdate;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ViewPortImpl implements ViewPort
+{
+
+ /** . */
+ final UIModelImpl model;
+
+ /** . */
+ final ViewPortContext context;
+
+ /** . */
+ final ViewPortScope scope;
+
+ public ViewPortImpl(UIModelImpl model, ViewPortContext context, ViewPortScope scope)
+ {
+ this.model = model;
+ this.context = context;
+ this.scope = scope;
+ }
+
+ public void refresh()
+ {
+ CreateDiffPhase createDiffPhase = new CreateDiffPhase(context, scope, model.structuralStateContext);
+
+ //
+ createDiffPhase.perform();
+
+ //
+ ObjectVisit rootVisit = createDiffPhase.getRootVisit();
+
+ //
+ CreateUpdatePhase createUpdatePhase = new CreateUpdatePhase(context, rootVisit);
+
+ //
+ createUpdatePhase.perform();
+
+ //
+ ObjectUpdate rootUpdate = createUpdatePhase.getRootUpdate();
+
+ //
+ rootUpdate.execute(context);
+ }
+
+ public ViewPortContext getContext()
+ {
+ return context;
+ }
+
+ public ViewPortScope getScope()
+ {
+ return scope;
+ }
+}
\ No newline at end of file
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff (from rev 10403, branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff)
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/ChildrenVisit.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ChildrenVisit.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/ChildrenVisit.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -20,7 +20,7 @@
* 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.impl.model2.refresh.diff;
+package org.jboss.portal.presentation.impl.model2.diff;
import java.util.Collection;
import java.util.ArrayList;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/CreateDiffPhase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/CreateDiffPhase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/CreateDiffPhase.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -20,12 +20,12 @@
* 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.impl.model2.refresh.diff;
+package org.jboss.portal.presentation.impl.model2.diff;
import org.jboss.portal.presentation.model2.ViewPortScope;
import org.jboss.portal.presentation.model2.ViewPortContext;
import org.jboss.portal.presentation.model2.ObjectTraversalType;
-import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
+import org.jboss.portal.presentation.impl.model2.UIObjectImpl;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/ObjectVisit.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ObjectVisit.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/diff/ObjectVisit.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -20,9 +20,9 @@
* 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.impl.model2.refresh.diff;
+package org.jboss.portal.presentation.impl.model2.diff;
-import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
+import org.jboss.portal.presentation.impl.model2.UIObjectImpl;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Copied: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update (from rev 10403, branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update)
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/CreateUpdatePhase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/CreateUpdatePhase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/CreateUpdatePhase.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -20,13 +20,13 @@
* 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.impl.model2.refresh.update;
+package org.jboss.portal.presentation.impl.model2.update;
import org.jboss.portal.presentation.model2.ViewPortContext;
-import org.jboss.portal.presentation.impl.model2.refresh.diff.ObjectVisit;
-import org.jboss.portal.presentation.impl.model2.refresh.diff.ChildrenVisit;
-import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
-import org.jboss.portal.presentation.impl.model2.refresh.UIObjectRef;
+import org.jboss.portal.presentation.impl.model2.diff.ObjectVisit;
+import org.jboss.portal.presentation.impl.model2.diff.ChildrenVisit;
+import org.jboss.portal.presentation.impl.model2.UIObjectImpl;
+import org.jboss.portal.presentation.impl.model2.UIObjectRef;
import java.util.List;
import java.util.ArrayList;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/ObjectUpdate.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/ObjectUpdate.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/update/ObjectUpdate.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -20,10 +20,10 @@
* 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.impl.model2.refresh.update;
+package org.jboss.portal.presentation.impl.model2.update;
-import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
-import org.jboss.portal.presentation.impl.model2.refresh.UIObjectRef;
+import org.jboss.portal.presentation.impl.model2.UIObjectImpl;
+import org.jboss.portal.presentation.impl.model2.UIObjectRef;
import org.jboss.portal.presentation.model2.ViewPortContext;
import java.util.List;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -26,7 +26,7 @@
import org.jboss.portal.presentation.test.model.state.structural.MockModel;
import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.impl.model2.refresh.UIModelImpl;
+import org.jboss.portal.presentation.impl.model2.UIModelImpl;
import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
import junit.framework.TestCase;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java 2008-03-28 19:57:44 UTC (rev 10405)
@@ -27,7 +27,7 @@
import org.jboss.portal.presentation.test.model.state.structural.MockModel;
import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.impl.model2.refresh.UIModelImpl;
+import org.jboss.portal.presentation.impl.model2.UIModelImpl;
import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
import java.util.Collection;
16 years, 1 month
JBoss Portal SVN: r10404 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation: test/model2 and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-28 15:54:35 -0400 (Fri, 28 Mar 2008)
New Revision: 10404
Removed:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/Refresh.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AbstractModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AddChildTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/CustomScope.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/FullScope.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/ModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/MoveChildTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/NodeDef.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/RemoveChildTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/TraversalModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectNode.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectTree.java
Log:
removed previous flawed impl
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/Refresh.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/Refresh.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/Refresh.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,406 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.impl.model2;
-
-import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.model.state.structural.StructuralObject;
-import org.jboss.portal.presentation.model2.ViewPortContext;
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collection;
-import java.util.ArrayList;
-
-/**
- * A refresh operation.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-class Refresh
-{
-
- private enum Action
- {
- NO_OP, WANT_REMOVE, WANT_ADD
- }
-
- /** . */
- private final ViewPortContext context;
-
- /** . */
- private final ViewPortScope scope;
-
- /** . */
- private final StructuralStateContext structuralStateContext;
-
- /** The objects removed during the refresh operation. */
- private final Map<String, UIObjectImpl> removedObjects;
-
- Refresh(ViewPortImpl viewPort)
- {
- this.context = viewPort.context;
- this.scope = viewPort.scope;
- this.structuralStateContext = viewPort.model.structuralStateContext;
- this.removedObjects = new HashMap<String, UIObjectImpl>();
- }
-
- void perform()
- {
- String rootId = scope.getRootId();
-
- //
- refresh(rootId);
- }
-
- private Status refresh(String objectId)
- {
- UIObjectImpl object = (UIObjectImpl)context.getObject(objectId);
-
- //
- if (object != null)
- {
- return refresh(object);
- }
- else
- {
- StructuralObject structuralObject = structuralStateContext.load(objectId);
-
- // It is not present, load it
- return load(structuralObject) ? Status.LOADED : Status.NOT_LOADED;
- }
- }
-
- private Status refresh(StructuralObject structuralObject)
- {
-
- UIObjectImpl object = (UIObjectImpl)context.getObject(structuralObject.getId());
-
- if (object == null)
- {
- return load(structuralObject) ? Status.LOADED : Status.NOT_LOADED;
- }
- else
- {
- // Update state
-
- //
- return refresh(object);
- }
- }
-
- private enum Status
- {
- LOADED,
- NOT_LOADED,
- WANT_EVICT
- }
-
- private Status refresh(UIObjectImpl object)
- {
- ObjectTraversalType traversalType = scope.enterObject(object);
-
- //
- try
- {
- if (traversalType == ObjectTraversalType.SKIP)
- {
- return Status.WANT_EVICT;
- }
- else if (traversalType == ObjectTraversalType.SINGLE)
- {
- if (object.childrenRefs != null)
- {
- // Need to evict children if any
- for (UIObjectImpl.ChildRef childRef : object.childrenRefs.values())
- {
- if (childRef.loaded)
- {
- UIObjectImpl childObject = (UIObjectImpl)context.getObject(childRef.id);
-
- //
- context.removeChild(object.getId(), childObject.getId());
-
- //
- evict(childObject);
- }
- }
-
- //
- context.destroyChildren(object.getId());
- }
-
- //
- return Status.LOADED;
- }
- else
- {
- boolean hadChildren = object.childrenRefs != null;
- String objectId = object.structuralObject.getId();
-
- //
- if (!hadChildren)
- {
- object.childrenRefs = new HashMap<String, UIObjectImpl.ChildRef>();
- context.createChildren(objectId);
- }
-
- //
- StructuralObject.Refresh refresh = structuralStateContext.refresh(object.structuralObject);
-
- //
- for (Map.Entry<String, StructuralObject> childEntry : refresh.getStaleChildren().entrySet())
- {
- StructuralObject structuralChild = childEntry.getValue();
- String childId = structuralChild.getId();
-
- // Is it the same object with a new state or is it a new child with the same name ?
- if (childEntry.getKey().equals(childId))
- {
- Status status = refresh(childEntry.getValue());
-
- switch (status)
- {
- case LOADED:
- if (hadChildren)
- {
- UIObjectImpl.ChildRef childRef = object.childrenRefs.get(childId);
- if (!childRef.loaded)
- {
- childRef.loaded = true;
- context.addChild(objectId, childId);
- }
- }
- else
- {
- object.childrenRefs.put(childId, new UIObjectImpl.ChildRef(childId, true));
- context.addChild(objectId, structuralChild.getId());
- }
- break;
- case NOT_LOADED:
- if (hadChildren)
- {
- UIObjectImpl.ChildRef childRef = object.childrenRefs.get(childId);
- if (childRef.loaded)
- {
- childRef.loaded = false;
- context.removeChild(objectId, childId);
- }
- }
- else
- {
- object.childrenRefs.put(childId, new UIObjectImpl.ChildRef(childId, false));
- }
- break;
- case WANT_EVICT:
- if (hadChildren)
- {
- UIObjectImpl.ChildRef childRef = object.childrenRefs.get(childId);
- if (childRef.loaded)
- {
- context.removeChild(objectId, childId);
- childRef.loaded = false;
- UIObjectImpl child = (UIObjectImpl)context.getObject(childId);
- evict(child);
- }
- }
- break;
- }
- }
- else
- {
- throw new UnsupportedOperationException("todo");
- }
- }
-
- //
- for (StructuralObject structuralChild : refresh.getAddedChildren())
- {
- boolean loaded = load(structuralChild);
-
- //
- object.childrenRefs.put(structuralChild.getId(), new UIObjectImpl.ChildRef(structuralChild.getId(), loaded));
-
- //
- if (loaded)
- {
- context.addChild(objectId, structuralChild.getId());
- }
- }
-
- //
- for (String childId : refresh.getRemovedChildren())
- {
- if (hadChildren)
- {
- object.childrenRefs.remove(childId);
- context.removeChild(objectId, childId);
- UIObjectImpl removedChild = (UIObjectImpl)context.getObject(childId);
- evict(removedChild);
- }
- }
-
- //
- for (String childId : refresh.getValidChildren())
- {
- Status status = refresh(childId);
-
- switch (status)
- {
- case LOADED:
- if (hadChildren)
- {
- UIObjectImpl.ChildRef childRef = object.childrenRefs.get(childId);
- if (!childRef.loaded)
- {
- childRef.loaded = true;
- context.addChild(objectId, childId);
- }
- }
- else
- {
- object.childrenRefs.put(childId, new UIObjectImpl.ChildRef(childId, true));
- context.addChild(objectId, childId);
- }
- break;
- case NOT_LOADED:
- if (hadChildren)
- {
- UIObjectImpl.ChildRef childRef = object.childrenRefs.get(childId);
- if (childRef.loaded)
- {
- childRef.loaded = false;
- context.removeChild(objectId, childId);
- }
- }
- else
- {
- object.childrenRefs.put(childId, new UIObjectImpl.ChildRef(childId, false));
- }
- break;
- case WANT_EVICT:
- if (hadChildren)
- {
- UIObjectImpl.ChildRef childRef = object.childrenRefs.get(childId);
- if (childRef.loaded)
- {
- context.removeChild(objectId, childId);
- childRef.loaded = false;
- UIObjectImpl child = (UIObjectImpl)context.getObject(childId);
- evict(child);
- }
- }
- break;
- }
- }
-
- //
- return Status.LOADED;
- }
- }
- finally
- {
- scope.leaveObject(object);
- }
- }
-
- private void evict(UIObjectImpl object)
- {
- if (object.childrenRefs != null)
- {
- for (UIObjectImpl.ChildRef childRef : new ArrayList<UIObjectImpl.ChildRef>(object.childrenRefs.values()))
- {
- if (childRef.loaded)
- {
- UIObjectImpl child = (UIObjectImpl)context.getObject(childRef.id);
-
- //
- context.removeChild(object.structuralObject.getId(), child.structuralObject.getId());
-
- //
- evict(child);
- }
- }
-
- //
- context.destroyChildren(object.structuralObject.getId());
- }
-
- //
- context.removeObject(object.structuralObject.getId());
- }
-
- private boolean load(StructuralObject structuralObject)
- {
- UIObjectImpl object = new UIObjectImpl(structuralObject);
-
- //
- ObjectTraversalType tmp = scope.enterObject(object);
-
- //
- try
- {
- if (tmp == ObjectTraversalType.SKIP)
- {
- return false;
- }
- else
- {
- context.addObject(object);
-
- //
- if (tmp == ObjectTraversalType.RECURSIVE)
- {
- Collection<StructuralObject> structuralChildren = structuralStateContext.loadChildren(object.structuralObject);
- Map<String, UIObjectImpl.ChildRef> childrenRefs = new HashMap<String, UIObjectImpl.ChildRef>(structuralChildren.size());
- context.createChildren(structuralObject.getId());
-
- //
- for (StructuralObject structuralChild : structuralChildren)
- {
- boolean loaded = load(structuralChild);
- childrenRefs.put(structuralChild.getId(), new UIObjectImpl.ChildRef(structuralChild.getId(), loaded));
-
- //
- if (loaded)
- {
- context.addChild(structuralObject.getId(), structuralChild.getId());
- }
- }
-
- // Update
- object.childrenRefs = childrenRefs;
- }
-
- //
- return true;
- }
- }
- finally
- {
- scope.leaveObject(object);
- }
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIModelImpl.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,70 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.impl.model2;
-
-import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.model2.UIModel;
-import org.jboss.portal.presentation.model2.ViewPortContext;
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ViewPort;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class UIModelImpl implements UIModel
-{
-
- /** . */
- final NavigationalStateContext navigationalStateContext;
-
- /** . */
- final StructuralStateContext structuralStateContext;
-
- public UIModelImpl(NavigationalStateContext navigationalStateContext, StructuralStateContext structuralStateContext)
- {
- this.navigationalStateContext = navigationalStateContext;
- this.structuralStateContext = structuralStateContext;
- }
-
- public NavigationalStateContext getNavigationalStateContext()
- {
- return navigationalStateContext;
- }
-
- public StructuralStateContext getStructuralStateContext()
- {
- return structuralStateContext;
- }
-
- public String getRootId()
- {
- return structuralStateContext.getRootId();
- }
-
- public ViewPort createViewPort(ViewPortContext context, ViewPortScope scope)
- {
- return new ViewPortImpl(this, context, scope);
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,124 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.impl.model2;
-
-import org.jboss.portal.presentation.model2.UIObject;
-import org.jboss.portal.presentation.model.state.StateException;
-import org.jboss.portal.presentation.model.state.structural.StructuralObject;
-
-import java.util.ArrayList;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class UIObjectImpl implements UIObject
-{
-
- /** . */
- final StructuralObject structuralObject;
-
- /** We keep track of what was loaded by the scope. */
- Map<String, ChildRef> childrenRefs;
-
- public UIObjectImpl(StructuralObject structuralObject)
- {
- this.structuralObject = structuralObject;
- }
-
- public String getId()
- {
- return structuralObject.getId();
- }
-
- public String getName()
- {
- return structuralObject.getState().getName();
- }
-
- public <T> T getProperty(String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException
- {
- return safeCast(getProperty(propertyName), propertyType);
- }
-
- public Object getProperty(String propertyName) throws IllegalArgumentException, StateException
- {
- if (propertyName == null)
- {
- throw new IllegalArgumentException();
- }
- return structuralObject.getState().getProperties().get(propertyName);
- }
-
- /**
- * Attempt to cast the value argument to the provided type argument. If the value argument type is assignable
- * to the provided type, the value is returned, otherwise if it is not or the value is null, null is returned.
- *
- * @param value the value to cast
- * @param type the type to downcast
- * @return the casted value or null
- */
- private <T> T safeCast(Object value, Class<T> type)
- {
- if (type == null)
- {
- throw new IllegalArgumentException();
- }
- if (value == null)
- {
- return null;
- }
- else
- {
- if (type.isAssignableFrom(value.getClass()))
- {
- return type.cast(value);
- }
- else
- {
- return null;
- }
- }
- }
-
- /**
- * A reference to a child.
- */
- static class ChildRef
- {
-
- /** The child id. */
- final String id;
-
- /** Whether or not the child is loaded. */
- boolean loaded;
-
- ChildRef(String id, boolean loaded)
- {
- this.id = id;
- this.loaded = loaded;
- }
- }
-
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/ViewPortImpl.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,66 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.impl.model2;
-
-import org.jboss.portal.presentation.model2.ViewPort;
-import org.jboss.portal.presentation.model2.ViewPortContext;
-import org.jboss.portal.presentation.model2.ViewPortScope;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ViewPortImpl implements ViewPort
-{
-
- /** . */
- final UIModelImpl model;
-
- /** . */
- final ViewPortContext context;
-
- /** . */
- final ViewPortScope scope;
-
- public ViewPortImpl(UIModelImpl model, ViewPortContext context, ViewPortScope scope)
- {
- this.model = model;
- this.context = context;
- this.scope = scope;
- }
-
- public void refresh()
- {
- new Refresh(this).perform();
- }
-
- public ViewPortContext getContext()
- {
- return context;
- }
-
- public ViewPortScope getScope()
- {
- return scope;
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AbstractModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AbstractModelTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AbstractModelTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,107 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.UIModel;
-import org.jboss.portal.presentation.test.model.state.structural.MockModel;
-import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
-import org.jboss.portal.presentation.test.model.state.structural.MockObject;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.impl.model2.UIModelImpl;
-import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
-import junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class AbstractModelTestCase extends TestCase
-{
-
- /** . */
- protected UIModel model;
-
- /** . */
- protected MockModel mockModel;
-
- /** . */
- protected StructuralStateContext structuralStateContext;
-
- protected void setUp() throws Exception
- {
- mockModel = new MockModelImpl();
- structuralStateContext = mockModel.getStructuralStateContext();
- model = new UIModelImpl(new NavigationalStateContextImpl(), structuralStateContext);
- }
-
- protected abstract static class Population
- {
-
- /** . */
- protected final MockObject root;
-
- protected Population(MockObject root)
- {
- this.root = root;
- }
-
- protected Population(MockModel model)
- {
- this(model.getRoot());
- }
-
- protected abstract void populate();
-
- protected abstract void check(UIObjectNode root);
- }
-
- protected static class Population1 extends Population
- {
-
- protected Population1(MockObject root)
- {
- super(root);
- }
-
- protected Population1(MockModel model)
- {
- super(model);
- }
-
- protected void populate()
- {
- MockObject foo = root.addChild("foo", MockObject.Type.PORTAL);
- MockObject bar = root.addChild("bar", MockObject.Type.PORTAL);
- foo.addChild("juu", MockObject.Type.PAGE);
- foo.addChild("daa", MockObject.Type.PAGE);
- }
-
- protected void check(UIObjectNode root)
- {
- UIObjectNode foo = root.getChildren().get("foo");
- UIObjectNode bar = root.getChildren().get("bar");
- assertNotNull(foo);
- assertNotNull(bar);
- }
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AddChildTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AddChildTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/AddChildTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,71 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ViewPort;
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-import org.jboss.portal.presentation.test.model.state.structural.MockObject;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class AddChildTestCase extends TraversalModelTestCase
-{
-
- public void testAddChild()
- {
- test(1);
- }
-
- protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after)
- {
- NodeDef rootDef = NodeDef.create();
- NodeDef fooDef = rootDef.addChild("foo");
- fooDef.setTraversal(before[0]);
-
- //
- rootDef.populate(mockModel);
-
- //
- ViewPortScope scope = new CustomScope(model, rootDef);
- UIObjectTree context = new UIObjectTree();
- ViewPort viewPort = model.createViewPort(context, scope);
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
-
- //
- mockModel.getRoot().getChild("foo").addChild("juu", MockObject.Type.PORTAL);
- fooDef.addChild("juu");
- fooDef.setTraversal(after[0]);
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/CustomScope.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/CustomScope.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/CustomScope.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,99 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-import org.jboss.portal.presentation.model2.UIObject;
-import org.jboss.portal.presentation.model2.UIModel;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class CustomScope implements ViewPortScope
-{
-
- /** . */
- private final UIModel model;
-
- /** . */
- private final NodeDef root;
-
- /** . */
- private NodeDef current;
-
- public CustomScope(UIModel model, NodeDef root)
- {
- if (root == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.model = model;
- this.root = root;
- this.current = null;
- }
-
- public String getRootId()
- {
- return model.getRootId();
- }
-
- public ObjectTraversalType enterObject(UIObject object)
- {
- if (current == null)
- {
- // It must be the root
- if (!model.getRootId().equals(object.getId()))
- {
- throw new IllegalStateException();
- }
-
- //
- current = root;
- }
- else
- {
- NodeDef child = current.getChild(object.getName());
-
- //
- if (child == null)
- {
- throw new IllegalStateException("No such child " + object.getName());
- }
-
- //
- current = child;
- }
-
- //
- return current.getTraversal();
- }
-
- public void leaveObject(UIObject object)
- {
- current = current.getParent();
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/FullScope.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/FullScope.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/FullScope.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,57 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-import org.jboss.portal.presentation.model2.UIObject;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class FullScope implements ViewPortScope
-{
-
- /** . */
- private final String rootId;
-
- public FullScope(String rootId)
- {
- this.rootId = rootId;
- }
-
- public String getRootId()
- {
- return rootId;
- }
-
- public ObjectTraversalType enterObject(UIObject object)
- {
- return ObjectTraversalType.RECURSIVE;
- }
-
- public void leaveObject(UIObject object)
- {
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/ModelTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/ModelTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,84 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ViewPort;
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ModelTestCase extends TraversalModelTestCase
-{
-
- public void testRefresh1() throws Exception
- {
- test(4);
- }
-
- protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after)
- {
- NodeDef rootDef = NodeDef.create();
- NodeDef fooDef = rootDef.addChild("foo");
- NodeDef barDef = rootDef.addChild("bar");
- NodeDef juuDef = fooDef.addChild("juu");
- NodeDef daaDef = fooDef.addChild("daa");
-
- //
- fooDef.setTraversal(before[0]);
- barDef.setTraversal(before[1]);
- juuDef.setTraversal(before[2]);
- daaDef.setTraversal(before[3]);
-
- //
- rootDef.populate(mockModel);
-
- //
- ViewPortScope scope = new CustomScope(model, rootDef);
- UIObjectTree context = new UIObjectTree();
- ViewPort viewPort = model.createViewPort(context, scope);
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
-
- //
- fooDef.setTraversal(after[0]);
- barDef.setTraversal(after[1]);
- juuDef.setTraversal(after[2]);
- daaDef.setTraversal(after[3]);
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/MoveChildTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/MoveChildTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/MoveChildTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,72 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ViewPort;
-import org.jboss.portal.presentation.test.model.state.structural.MockObject;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class MoveChildTestCase extends TraversalModelTestCase
-{
-
- public void testMoveChild()
- {
- test(0);
- }
-
- protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after)
- {
- NodeDef rootDef = NodeDef.create();
- NodeDef fooDef = rootDef.addChild("foo");
- NodeDef juuDef = fooDef.addChild("juu");
- NodeDef barDef = rootDef.addChild("bar");
-
- //
- rootDef.populate(mockModel);
-
- //
- ViewPortScope scope = new CustomScope(model, rootDef);
- UIObjectTree context = new UIObjectTree();
- ViewPort viewPort = model.createViewPort(context, scope);
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
-
- //
- mockModel.getRoot().getChild("foo").getChild("juu").move(mockModel.getRoot().getChild("bar"));
- fooDef.removeChild("juu");
- barDef.addChild("juu");
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/NodeDef.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/NodeDef.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/NodeDef.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,174 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-import org.jboss.portal.presentation.test.model.state.structural.MockObject;
-import org.jboss.portal.presentation.test.model.state.structural.MockModel;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
-
-import junit.framework.Assert;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class NodeDef
-{
-
- public static NodeDef create()
- {
- return new NodeDef("");
- }
-
- /** . */
- private final String name;
-
- /** . */
- private final Map<String, NodeDef> children;
-
- /** . */
- private ObjectTraversalType traversal;
-
- /** . */
- private NodeDef parent;
-
- private NodeDef(String name)
- {
- this.name = name;
- this.children = new HashMap<String, NodeDef>();
- this.traversal = ObjectTraversalType.RECURSIVE;
- this.parent = null;
- }
-
- public String getName()
- {
- return name;
- }
-
- public NodeDef getChild(String name)
- {
- return children.get(name);
- }
-
- public NodeDef getParent()
- {
- return parent;
- }
-
- public ObjectTraversalType getTraversal()
- {
- return traversal;
- }
-
- public void setTraversal(ObjectTraversalType traversal)
- {
- this.traversal = traversal;
- }
-
- public NodeDef addChild(String name)
- {
- if (children.containsKey(name))
- {
- throw new IllegalStateException();
- }
-
- //
- NodeDef child = new NodeDef(name);
-
- //
- children.put(name, child);
- child.parent = this;
-
- //
- return child;
- }
-
- public void removeChild(String name)
- {
- NodeDef child = children.remove(name);
-
- //
- if (child == null)
- {
- throw new IllegalStateException();
- }
-
- //
- child.parent = null;
- }
-
- public void populate(MockModel model)
- {
- populate(model.getRoot());
- }
-
- public void populate(MockObject object)
- {
- for (Map.Entry<String, NodeDef> childNodeEntry : children.entrySet())
- {
- MockObject child = object.addChild(childNodeEntry.getKey(), MockObject.Type.PORTAL);
- childNodeEntry.getValue().populate(child);
- }
- }
-
- public void assertEquals(UIObjectNode objectNode)
- {
- Assert.assertEquals(name, objectNode.getObject().getName());
-
- //
- switch (traversal)
- {
- case SKIP:
- Assert.fail();
- break;
- case SINGLE:
- Assert.assertNull(objectNode.getChildren());
- break;
- case RECURSIVE:
- Set<String> expectedChildrenNames = new HashSet<String>();
- for (Map.Entry<String, NodeDef> entry : children.entrySet())
- {
- if (entry.getValue().getTraversal() != ObjectTraversalType.SKIP)
- {
- expectedChildrenNames.add(entry.getKey());
- }
- }
-
- //
- Assert.assertEquals(expectedChildrenNames, objectNode.getChildren().keySet());
-
- //
- for (UIObjectNode childObjectNode : objectNode.getChildren().values())
- {
- NodeDef child = children.get(childObjectNode.getObject().getName());
- child.assertEquals(childObjectNode);
- }
- break;
- }
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/RemoveChildTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/RemoveChildTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/RemoveChildTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,69 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ViewPortScope;
-import org.jboss.portal.presentation.model2.ViewPort;
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class RemoveChildTestCase extends TraversalModelTestCase
-{
-
- public void testRemoveChild()
- {
- test(1);
- }
-
- protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after)
- {
- NodeDef rootDef = NodeDef.create();
- NodeDef fooDef = rootDef.addChild("foo");
- NodeDef barDef = fooDef.addChild("bar");
- NodeDef juuDef = fooDef.addChild("juu");
-
- //
- rootDef.populate(mockModel);
-
- //
- ViewPortScope scope = new CustomScope(model, rootDef);
- UIObjectTree context = new UIObjectTree();
- ViewPort viewPort = model.createViewPort(context, scope);
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
-
- //
- mockModel.destroy(mockModel.getRoot().getChild("foo").getChild("juu"));
- fooDef.removeChild("juu");
-
- //
- viewPort.refresh();
- rootDef.assertEquals(context.getNode(model.getRootId()));
- context.assertConsistency(model.getRootId());
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/TraversalModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/TraversalModelTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/TraversalModelTestCase.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,128 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ObjectTraversalType;
-import org.jboss.portal.presentation.model2.UIModel;
-import org.jboss.portal.presentation.test.model.state.structural.MockModel;
-import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
-import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.impl.model2.UIModelImpl;
-import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class TraversalModelTestCase extends TestCase
-{
-
- /** . */
- protected UIModel model;
-
- /** . */
- protected MockModel mockModel;
-
- /** . */
- protected StructuralStateContext structuralStateContext;
-
- public void test(int size)
- {
- ObjectTraversalType[] before = new ObjectTraversalType[size];
- ObjectTraversalType[] after = new ObjectTraversalType[size];
- Collection<ObjectTraversalType[]> enumeration = generate(before.length + after.length);
-
- //
- for (ObjectTraversalType[] element : enumeration)
- {
- mockModel = new MockModelImpl();
- structuralStateContext = mockModel.getStructuralStateContext();
- model = new UIModelImpl(new NavigationalStateContextImpl(), structuralStateContext);
-
- //
- Assert.assertEquals(before.length + after.length, element.length);
- System.arraycopy(element, 0, before, 0, before.length);
- System.arraycopy(element, before.length, after, 0, after.length);
- boolean failed = true;
- try
- {
- test(before, after);
- failed = false;
- }
- finally
- {
- if (failed)
- {
- System.out.println("Arrays.asList(before) = " + Arrays.asList(before));
- System.out.println("Arrays.asList(after) = " + Arrays.asList(after));
- }
-
- //
- mockModel = null;
- structuralStateContext = null;
- model = null;
- }
- }
- }
-
- protected abstract void test(ObjectTraversalType[] before, ObjectTraversalType[] after);
-
- public static Collection<ObjectTraversalType[]> generate(int size)
- {
- if (size == 0)
- {
- return Collections.singleton(new ObjectTraversalType[0]);
- }
- else
- {
- Collection<ObjectTraversalType[]> enumeration = generate(size - 1);
-
- //
- ArrayList<ObjectTraversalType[]> augmentedEnumeration = new ArrayList<ObjectTraversalType[]>(enumeration.size() * 3);
-
- //
- for (ObjectTraversalType type : ObjectTraversalType.values())
- {
- for (ObjectTraversalType[] element : enumeration)
- {
- ObjectTraversalType[] augmentedElement = new ObjectTraversalType[1 + element.length];
- System.arraycopy(element, 0, augmentedElement, 1, element.length);
- augmentedElement[0] = type;
- augmentedEnumeration.add(augmentedElement);
- }
- }
-
- //
- return augmentedEnumeration;
- }
- }
-
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectNode.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectNode.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectNode.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,125 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.UIObject;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class UIObjectNode
-{
-
- /** . */
- private final UIObject object;
-
- /** . */
- private Map<String, UIObjectNode> children;
-
- public UIObjectNode(UIObject object)
- {
- if (object == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.object = object;
- }
-
- public UIObject getObject()
- {
- return object;
- }
-
- public Map<String, UIObjectNode> getChildren()
- {
- return children;
- }
-
- public void addChild(UIObjectNode child)
- {
- if (children == null)
- {
- throw new IllegalStateException("Children not initialized");
- }
-
- //
- String key = child.getObject().getName();
-
- //
- if (children.containsKey(key))
- {
- throw new IllegalStateException("Duplicate name " + key + " among " + children.keySet());
- }
-
- //
- children.put(key, child);
- }
-
- public void removeChild(UIObjectNode child)
- {
- if (children == null)
- {
- throw new IllegalStateException("Children not initialized");
- }
-
- //
- String key = child.getObject().getName();
-
- //
- if (!children.containsKey(key))
- {
- throw new IllegalStateException("No such child with name " + key + " among " + children.keySet());
- }
-
- //
- children.remove(key);
- }
-
- public void createChildren()
- {
- if (children != null)
- {
- throw new IllegalStateException("Children already initialized");
- }
-
- //
- children = new HashMap<String, UIObjectNode>();
- }
-
- public void destroyChildren()
- {
- if (children == null)
- {
- throw new IllegalStateException("Children never initialized");
- }
-
- //
- children = null;
- }
-}
Deleted: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectTree.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectTree.java 2008-03-28 19:49:52 UTC (rev 10403)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model2/UIObjectTree.java 2008-03-28 19:54:35 UTC (rev 10404)
@@ -1,163 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, 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.test.model2;
-
-import org.jboss.portal.presentation.model2.ViewPortContext;
-import org.jboss.portal.presentation.model2.UIObject;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.HashSet;
-
-import junit.framework.Assert;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class UIObjectTree implements ViewPortContext
-{
-
- /** . */
- private final Map<String, UIObjectNode> nodes = new HashMap<String, UIObjectNode>();
-
- public void assertConsistency(String rootId)
- {
- UIObjectNode root = nodes.get(rootId);
- Assert.assertNotNull(root);
- ArrayList<String> allIds = new ArrayList<String>();
- collect(root, allIds);
- Assert.assertEquals(new HashSet<String>(allIds).size(), allIds.size());
- Assert.assertEquals(new HashSet<String>(allIds), nodes.keySet());
- }
-
- private void collect(UIObjectNode node, ArrayList<String> ids)
- {
- ids.add(node.getObject().getId());
- if (node.getChildren() != null)
- {
- for (UIObjectNode child : node.getChildren().values())
- {
- collect(child, ids);
- }
- }
- }
-
- public UIObjectNode getNode(String objectId)
- {
- return nodes.get(objectId);
- }
-
- public UIObject getObject(String objectId)
- {
- UIObjectNode node = nodes.get(objectId);
-
- //
- return node != null ? node.getObject() : null;
- }
-
- public void removeObject(String objectId)
- {
- if (nodes.remove(objectId) == null)
- {
- throw new IllegalStateException("No such object " + objectId);
- }
- }
-
- public void addObject(UIObject object)
- {
- String id = object.getId();
-
- //
- if (nodes.containsKey(id))
- {
- throw new IllegalStateException("Object with id " + id + " is already loaded");
- }
-
- //
- nodes.put(id, new UIObjectNode(object));
- }
-
- public void addChild(String parentId, String childId)
- {
- UIObjectNode parent = nodes.get(parentId);
- if (parent == null)
- {
- throw new IllegalStateException("No such object " + parentId);
- }
-
- //
- UIObjectNode child = nodes.get(childId);
- if (child == null)
- {
- throw new IllegalStateException("No such object " + childId);
- }
-
- //
- parent.addChild(child);
- }
-
- public void removeChild(String parentId, String childId)
- {
- UIObjectNode parent = nodes.get(parentId);
- if (parent == null)
- {
- throw new IllegalStateException("No such object " + parentId);
- }
-
- //
- UIObjectNode child = nodes.get(childId);
- if (child == null)
- {
- throw new IllegalStateException("No such object " + childId);
- }
-
- //
- parent.removeChild(child);
- }
-
- public void createChildren(String parentId)
- {
- UIObjectNode parent = nodes.get(parentId);
- if (parent == null)
- {
- throw new IllegalStateException("No such object " + parentId);
- }
-
- //
- parent.createChildren();
- }
-
- public void destroyChildren(String parentId)
- {
- UIObjectNode parent =nodes.get(parentId);
- if (parent == null)
- {
- throw new IllegalStateException("No such object " + parentId);
- }
-
- //
- parent.destroyChildren();
- }
-}
16 years, 1 month
JBoss Portal SVN: r10403 - in branches/presentation/presentation: src/main/org/jboss/portal/presentation/impl/model2 and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-03-28 15:49:52 -0400 (Fri, 28 Mar 2008)
New Revision: 10403
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIModelImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectRef.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/ViewPortImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ChildrenVisit.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/CreateDiffPhase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ObjectVisit.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/CreateUpdatePhase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/ObjectUpdate.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AddChildTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/CustomScope.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/ModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/MoveChildTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/RemoveChildTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java
Modified:
branches/presentation/presentation/build.xml
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ObjectTraversalType.java
Log:
a new implementation of refresh that handles object moves
Modified: branches/presentation/presentation/build.xml
===================================================================
--- branches/presentation/presentation/build.xml 2008-03-28 17:53:50 UTC (rev 10402)
+++ branches/presentation/presentation/build.xml 2008-03-28 19:49:52 UTC (rev 10403)
@@ -311,13 +311,22 @@
-->
</x-sysproperty>
<x-test>
- <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.MockModelTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.ModelTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.EventTestCase"/>
+ <!--<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.MockModelTestCase"/>-->
+ <!--<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.ModelTestCase"/>-->
+ <!--<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.EventTestCase"/>-->
+
+<!--
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.ModelTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.AddChildTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.RemoveChildTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.presentation.test.model2.MoveChildTestCase"/>
+-->
+
+ <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.ModelTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.AddChildTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.RemoveChildTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model3.MoveChildTestCase"/>
+
</x-test>
<x-classpath>
<path refid="jboss.portal/modules/common.classpath"/>
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIModelImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIModelImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIModelImpl.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.model2.UIModel;
+import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPort;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIModelImpl implements UIModel
+{
+
+ /** . */
+ final NavigationalStateContext navigationalStateContext;
+
+ /** . */
+ final StructuralStateContext structuralStateContext;
+
+ public UIModelImpl(NavigationalStateContext navigationalStateContext, StructuralStateContext structuralStateContext)
+ {
+ this.navigationalStateContext = navigationalStateContext;
+ this.structuralStateContext = structuralStateContext;
+ }
+
+ public NavigationalStateContext getNavigationalStateContext()
+ {
+ return navigationalStateContext;
+ }
+
+ public StructuralStateContext getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ public String getRootId()
+ {
+ return structuralStateContext.getRootId();
+ }
+
+ public ViewPort createViewPort(ViewPortContext context, ViewPortScope scope)
+ {
+ return new ViewPortImpl(this, context, scope);
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectImpl.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh;
+
+import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIObjectImpl implements UIObject
+{
+
+ /** . */
+ public final StructuralObject structuralObject;
+
+ /** We keep track of what was loaded by the scope. */
+ public Map<String, UIObjectRef> childRefs;
+
+ public UIObjectImpl(StructuralObject structuralObject)
+ {
+ this.structuralObject = structuralObject;
+ }
+
+ public String getId()
+ {
+ return structuralObject.getId();
+ }
+
+ public String getName()
+ {
+ return structuralObject.getState().getName();
+ }
+
+ public <T> T getProperty(String propertyName, Class<T> propertyType) throws IllegalArgumentException, StateException
+ {
+ return safeCast(getProperty(propertyName), propertyType);
+ }
+
+ public Object getProperty(String propertyName) throws IllegalArgumentException, StateException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return structuralObject.getState().getProperties().get(propertyName);
+ }
+
+ /**
+ * Attempt to cast the value argument to the provided type argument. If the value argument type is assignable
+ * to the provided type, the value is returned, otherwise if it is not or the value is null, null is returned.
+ *
+ * @param value the value to cast
+ * @param type the type to downcast
+ * @return the casted value or null
+ */
+ private <T> T safeCast(Object value, Class<T> type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (value == null)
+ {
+ return null;
+ }
+ else
+ {
+ if (type.isAssignableFrom(value.getClass()))
+ {
+ return type.cast(value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectRef.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectRef.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/UIObjectRef.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIObjectRef
+{
+
+ /** The child id. */
+ final String id;
+
+ /** Whether or not the child is loaded. */
+ public boolean loaded;
+
+ public UIObjectRef(String id, boolean loaded)
+ {
+ this.id = id;
+ this.loaded = loaded;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/ViewPortImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/ViewPortImpl.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/ViewPortImpl.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh;
+
+import org.jboss.portal.presentation.model2.ViewPort;
+import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.impl.model2.refresh.diff.CreateDiffPhase;
+import org.jboss.portal.presentation.impl.model2.refresh.diff.ObjectVisit;
+import org.jboss.portal.presentation.impl.model2.refresh.update.CreateUpdatePhase;
+import org.jboss.portal.presentation.impl.model2.refresh.update.ObjectUpdate;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ViewPortImpl implements ViewPort
+{
+
+ /** . */
+ final UIModelImpl model;
+
+ /** . */
+ final ViewPortContext context;
+
+ /** . */
+ final ViewPortScope scope;
+
+ public ViewPortImpl(UIModelImpl model, ViewPortContext context, ViewPortScope scope)
+ {
+ this.model = model;
+ this.context = context;
+ this.scope = scope;
+ }
+
+ public void refresh()
+ {
+ CreateDiffPhase createDiffPhase = new CreateDiffPhase(context, scope, model.structuralStateContext);
+
+ //
+ createDiffPhase.perform();
+
+ //
+ ObjectVisit rootVisit = createDiffPhase.getRootVisit();
+
+ //
+ CreateUpdatePhase createUpdatePhase = new CreateUpdatePhase(context, rootVisit);
+
+ //
+ createUpdatePhase.perform();
+
+ //
+ ObjectUpdate rootUpdate = createUpdatePhase.getRootUpdate();
+
+ //
+ rootUpdate.execute(context);
+ }
+
+ public ViewPortContext getContext()
+ {
+ return context;
+ }
+
+ public ViewPortScope getScope()
+ {
+ return scope;
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ChildrenVisit.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ChildrenVisit.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ChildrenVisit.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh.diff;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ChildrenVisit
+{
+
+ /** . */
+ final Collection<ObjectVisit> addedObjects = new ArrayList<ObjectVisit>();
+
+ /** . */
+ final Collection<ObjectVisit> validObjects = new ArrayList<ObjectVisit>();
+
+ /** . */
+ final Collection<ObjectVisit> staleObjects = new ArrayList<ObjectVisit>();
+
+ /** . */
+ final Collection<String> removedObjects = new ArrayList<String>();
+
+ ChildrenVisit()
+ {
+ }
+
+ public Collection<ObjectVisit> getAddedObjects()
+ {
+ return addedObjects;
+ }
+
+ public Collection<String> getRemovedObjects()
+ {
+ return removedObjects;
+ }
+
+ public Collection<ObjectVisit> getValidObjects()
+ {
+ return validObjects;
+ }
+
+ public Collection<ObjectVisit> getStaleObjects()
+ {
+ return staleObjects;
+ }
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/CreateDiffPhase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/CreateDiffPhase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/CreateDiffPhase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,188 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh.diff;
+
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CreateDiffPhase
+{
+
+ /** . */
+ private final ViewPortContext context;
+
+ /** . */
+ private final ViewPortScope scope;
+
+ /** . */
+ private final StructuralStateContext structuralStateContext;
+
+ /** . */
+ private ObjectVisit rootVisit;
+
+ public CreateDiffPhase(
+ ViewPortContext context,
+ ViewPortScope scope,
+ StructuralStateContext structuralStateContext)
+ {
+ this.context = context;
+ this.scope = scope;
+ this.structuralStateContext = structuralStateContext;
+ }
+
+ public void perform()
+ {
+ rootVisit = diff(scope.getRootId());
+ }
+
+ public ObjectVisit getRootVisit()
+ {
+ return rootVisit;
+ }
+
+ private ObjectVisit diff(String objectId)
+ {
+ UIObjectImpl object = (UIObjectImpl)context.getObject(objectId);
+
+ //
+ if (object == null)
+ {
+ StructuralObject structuralObject = structuralStateContext.load(objectId);
+
+ //
+ if (structuralObject == null)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ //
+ return load(structuralObject);
+ }
+ else
+ {
+ return diff(object);
+ }
+ }
+
+ private ObjectVisit diff(UIObjectImpl object)
+ {
+ ObjectTraversalType traversalType = scope.enterObject(object);
+
+ //
+ try
+ {
+ switch (traversalType)
+ {
+ case SKIP:
+ return new ObjectVisit(object, false);
+ case SINGLE:
+ return new ObjectVisit(object, true);
+ case RECURSIVE:
+ StructuralObject.Refresh refresh = structuralStateContext.refresh(object.structuralObject);
+ ChildrenVisit childrenVisit = new ChildrenVisit();
+
+ //
+ for (StructuralObject addedStructuralChild : refresh.getAddedChildren())
+ {
+ ObjectVisit childVisit = load(addedStructuralChild);
+ childrenVisit.addedObjects.add(childVisit);
+ }
+
+ //
+ for (StructuralObject staleStructuralChild : refresh.getStaleChildren().values())
+ {
+ ObjectVisit childVisit = diff(staleStructuralChild.getId());
+ childrenVisit.staleObjects.add(childVisit);
+ }
+
+ //
+ for (String validChildId : refresh.getValidChildren())
+ {
+ ObjectVisit childVisit = diff(validChildId);
+ childrenVisit.validObjects.add(childVisit);
+ }
+
+ //
+ childrenVisit.removedObjects.addAll(refresh.getRemovedChildren());
+
+ //
+ return new ObjectVisit(object, childrenVisit);
+ default:
+ throw new AssertionError();
+ }
+ }
+ finally
+ {
+ scope.leaveObject(object);
+ }
+ }
+
+ private ObjectVisit load(StructuralObject structuralObject)
+ {
+ UIObjectImpl object = new UIObjectImpl(structuralObject);
+
+ //
+ ObjectTraversalType traversalType = scope.enterObject(object);
+
+ //
+ try
+ {
+ ObjectVisit visit;
+ switch (traversalType)
+ {
+ case SKIP:
+ visit = new ObjectVisit(object, false);
+ break;
+ case SINGLE:
+ visit = new ObjectVisit(object, true);
+ break;
+ case RECURSIVE:
+ ChildrenVisit childrenVisit = new ChildrenVisit();
+ for (StructuralObject structuralChild : structuralStateContext.loadChildren(structuralObject))
+ {
+ ObjectVisit childVisit = load(structuralChild);
+ childrenVisit.addedObjects.add(childVisit);
+ }
+ visit = new ObjectVisit(object, childrenVisit);
+ break;
+ default:
+ throw new AssertionError();
+ }
+
+ //
+ return visit;
+ }
+ finally
+ {
+ scope.leaveObject(object);
+ }
+ }
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ObjectVisit.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ObjectVisit.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/diff/ObjectVisit.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,76 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh.diff;
+
+import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ObjectVisit
+{
+
+ /** . */
+ private final UIObjectImpl object;
+
+ /** . */
+ private final boolean loaded;
+
+ /** . */
+ private final ChildrenVisit children;
+
+ ObjectVisit(UIObjectImpl object, ChildrenVisit children)
+ {
+ this.object = object;
+ this.loaded = true;
+ this.children = children;
+ }
+
+ ObjectVisit(UIObjectImpl object, boolean loaded)
+ {
+ this.object = object;
+ this.loaded = loaded;
+ this.children = null;
+ }
+
+ public String getObjectId()
+ {
+ return object.getId();
+ }
+
+ public UIObjectImpl getObject()
+ {
+ return object;
+ }
+
+ public boolean getLoaded()
+ {
+ return loaded;
+ }
+
+ public ChildrenVisit getChildrenVisit()
+ {
+ return children;
+ }
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/CreateUpdatePhase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/CreateUpdatePhase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/CreateUpdatePhase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,304 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh.update;
+
+import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.impl.model2.refresh.diff.ObjectVisit;
+import org.jboss.portal.presentation.impl.model2.refresh.diff.ChildrenVisit;
+import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
+import org.jboss.portal.presentation.impl.model2.refresh.UIObjectRef;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CreateUpdatePhase
+{
+
+ /** . */
+ private final ViewPortContext context;
+
+ /** . */
+ private ObjectVisit rootVisit;
+
+ /** . */
+ private ObjectUpdate rootUpdate;
+
+ /** . */
+ private Map<String, ObjectUpdate.AddChild> deferredAddChildUpdates;
+
+ /** . */
+ private Set<String> removedChildren;
+
+ public CreateUpdatePhase(ViewPortContext context, ObjectVisit rootVisit)
+ {
+ this.context = context;
+ this.rootVisit = rootVisit;
+ }
+
+ public ObjectUpdate getRootUpdate()
+ {
+ return rootUpdate;
+ }
+
+ public void perform()
+ {
+ deferredAddChildUpdates = new HashMap<String, ObjectUpdate.AddChild>();
+ removedChildren = new HashSet<String>();
+
+ //
+ rootUpdate = createUpdate(rootVisit);
+
+ //
+ if (deferredAddChildUpdates.size() > 0)
+ {
+ throw new IllegalStateException("Was expecting the deferred update to be empty");
+ }
+ }
+
+ private ObjectUpdate createUpdate(ObjectVisit objectVisit)
+ {
+ UIObjectImpl object = (UIObjectImpl)context.getObject(objectVisit.getObjectId());
+
+ if (objectVisit.getLoaded())
+ {
+ ChildrenVisit childrenVisit = objectVisit.getChildrenVisit();
+
+ //
+ if (object != null)
+ {
+ if (object != objectVisit.getObject())
+ {
+ // The object is stale, we need to update the state maybe
+ }
+ }
+
+ //
+ if (childrenVisit != null)
+ {
+ Map<String, Boolean> childrenStatus = new HashMap<String, Boolean>();
+ List<ObjectUpdate.AddChild> addedChildrenUpdates = new ArrayList<ObjectUpdate.AddChild>();
+ List<ObjectUpdate.RemoveChild> removedChildrenUpdates = new ArrayList<ObjectUpdate.RemoveChild>();
+ List<ObjectUpdate.UpdateObject> updateChildrenUpdates = new ArrayList<ObjectUpdate.UpdateObject>();
+
+ //
+ for (ObjectVisit addedObjectVisit : childrenVisit.getAddedObjects())
+ {
+ ObjectUpdate childUpdate = createUpdate(addedObjectVisit);
+
+ //
+ if (childUpdate instanceof ObjectUpdate.AddObject)
+ {
+ addedChildrenUpdates.add(new ObjectUpdate.AddChild(objectVisit.getObjectId(), (ObjectUpdate.AddObject)childUpdate));
+ childrenStatus.put(addedObjectVisit.getObjectId(), true);
+ }
+ else if (childUpdate == null)
+ {
+ childrenStatus.put(addedObjectVisit.getObjectId(), false);
+ }
+ else if (childUpdate instanceof ObjectUpdate.UpdateObject)
+ {
+ // This is 'the' trick becaue this is likely a 'move' operation that we may need
+ // to handle differently as a deferred add child
+ ObjectUpdate.UpdateObject updateChildUpdate = (ObjectUpdate.UpdateObject)childUpdate;
+
+ //
+ ObjectUpdate.AddObject addObjectUpdate = new ObjectUpdate.AddObject(
+ addedObjectVisit.getObject(),
+ updateChildUpdate.childrenStatus,
+ updateChildUpdate.addedChildrenUpdates,
+ updateChildUpdate.removedChildrenUpdates,
+ updateChildUpdate.updateChildrenUpdates);
+
+ //
+ ObjectUpdate.AddChild addChildUpdate = new ObjectUpdate.AddChild(objectVisit.getObjectId(), addObjectUpdate);
+
+ //
+ if (removedChildren.contains(addedObjectVisit.getObjectId()))
+ {
+ addedChildrenUpdates.add(addChildUpdate);
+ }
+ else
+ {
+ deferredAddChildUpdates.put(addedObjectVisit.getObjectId(), addChildUpdate);
+ }
+
+ //
+ childrenStatus.put(addedObjectVisit.getObjectId(), true);
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Was not expecting update of type " + childUpdate.getClass().getSimpleName());
+ }
+ }
+
+ //
+ for (String removeObjectId : childrenVisit.getRemovedObjects())
+ {
+ UIObjectImpl child = (UIObjectImpl)context.getObject(removeObjectId);
+ removedChildrenUpdates.add(new ObjectUpdate.RemoveChild(objectVisit.getObjectId(), createRemove(child)));
+ }
+
+ List<ObjectVisit> existingObjectVisits = new ArrayList<ObjectVisit>();
+ existingObjectVisits.addAll(childrenVisit.getValidObjects());
+ existingObjectVisits.addAll(childrenVisit.getStaleObjects());
+
+ //
+ for (ObjectVisit validObjectVisit : existingObjectVisits)
+ {
+ ObjectUpdate childUpdate = createUpdate(validObjectVisit);
+
+ //
+ if (childUpdate == null)
+ {
+ childrenStatus.put(validObjectVisit.getObjectId(), false);
+ }
+ else if (childUpdate instanceof ObjectUpdate.UpdateObject)
+ {
+ updateChildrenUpdates.add((ObjectUpdate.UpdateObject)childUpdate);
+ childrenStatus.put(validObjectVisit.getObjectId(), true);
+ }
+ else if (childUpdate instanceof ObjectUpdate.RemoveObject)
+ {
+ removedChildrenUpdates.add(new ObjectUpdate.RemoveChild(objectVisit.getObjectId(), (ObjectUpdate.RemoveObject)childUpdate));
+ childrenStatus.put(validObjectVisit.getObjectId(), false);
+ }
+ else if (childUpdate instanceof ObjectUpdate.AddObject)
+ {
+ addedChildrenUpdates.add(new ObjectUpdate.AddChild(objectVisit.getObjectId(), (ObjectUpdate.AddObject)childUpdate));
+ childrenStatus.put(validObjectVisit.getObjectId(), true);
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Was not expecting update of type " + childUpdate.getClass().getSimpleName());
+ }
+ }
+
+ //
+ for (ObjectUpdate.RemoveChild removeChildUpdate : removedChildrenUpdates)
+ {
+ removedChildren.add(removeChildUpdate.removedObjectUpdate.objectId);
+ }
+
+ //
+ if (object != null)
+ {
+ return new ObjectUpdate.UpdateObject(
+ object.getId(),
+ childrenStatus,
+ addedChildrenUpdates,
+ removedChildrenUpdates,
+ updateChildrenUpdates);
+ }
+ else
+ {
+ return new ObjectUpdate.AddObject(
+ objectVisit.getObject(),
+ childrenStatus,
+ addedChildrenUpdates,
+ removedChildrenUpdates,
+ updateChildrenUpdates);
+ }
+ }
+ else
+ {
+ if (object != null)
+ {
+ List<ObjectUpdate.RemoveChild> removedChildrenUpdates = new ArrayList<ObjectUpdate.RemoveChild>();
+
+ //
+ if (object.childRefs != null)
+ {
+ for (UIObjectRef removedChildRef : object.childRefs.values())
+ {
+ if (removedChildRef.loaded)
+ {
+ UIObjectImpl child = (UIObjectImpl)context.getObject(removedChildRef.getId());
+
+ //
+ removedChildrenUpdates.add(new ObjectUpdate.RemoveChild(objectVisit.getObjectId(), createRemove(child)));
+ }
+ }
+ }
+
+ //
+ for (ObjectUpdate.RemoveChild removeChildUpdate : removedChildrenUpdates)
+ {
+ removedChildren.add(removeChildUpdate.removedObjectUpdate.objectId);
+ }
+
+ //
+ return new ObjectUpdate.UpdateObject(object.getId(), removedChildrenUpdates);
+ }
+ else
+ {
+ return new ObjectUpdate.AddObject(objectVisit.getObject());
+ }
+ }
+ }
+ else
+ {
+ if (object != null)
+ {
+ return createRemove(object);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ private ObjectUpdate.RemoveObject createRemove(UIObjectImpl object)
+ {
+ List<ObjectUpdate.RemoveObject> removedChildrenUpdates = new ArrayList<ObjectUpdate.RemoveObject>();
+
+ //
+ if (object.childRefs != null)
+ {
+ for (UIObjectRef removedChildRef : object.childRefs.values())
+ {
+ if (removedChildRef.loaded)
+ {
+ UIObjectImpl removedChild = (UIObjectImpl)context.getObject(removedChildRef.getId());
+
+ //
+ removedChildrenUpdates.add(createRemove(removedChild));
+ }
+ }
+ }
+
+ //
+ ObjectUpdate.AddChild addChildUpdate = deferredAddChildUpdates.remove(object.getId());
+
+ //
+ return new ObjectUpdate.RemoveObject(object.getId(), removedChildrenUpdates, addChildUpdate);
+ }
+}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/ObjectUpdate.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/ObjectUpdate.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model2/refresh/update/ObjectUpdate.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,352 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.impl.model2.refresh.update;
+
+import org.jboss.portal.presentation.impl.model2.refresh.UIObjectImpl;
+import org.jboss.portal.presentation.impl.model2.refresh.UIObjectRef;
+import org.jboss.portal.presentation.model2.ViewPortContext;
+
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class ObjectUpdate
+{
+
+ public abstract void execute(ViewPortContext context);
+
+ /**
+ * Not really carrying any state for now... until we really implement it.
+ */
+ public static class UpdateObject extends ObjectUpdate
+ {
+
+ /** . */
+ final String objectId;
+
+ /** . */
+ final Map<String, Boolean> childrenStatus;
+
+ /** . */
+ final List<AddChild> addedChildrenUpdates;
+
+ /** . */
+ final List<RemoveChild> removedChildrenUpdates;
+
+ /** . */
+ final List<UpdateObject> updateChildrenUpdates;
+
+ public UpdateObject(String objectId, List<RemoveChild> removeChildrenUpdates)
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException("No null object id accepted");
+ }
+ if (removeChildrenUpdates == null)
+ {
+ throw new IllegalArgumentException("No null removed children accepted");
+ }
+
+ //
+ this.objectId = objectId;
+ this.childrenStatus = null;
+ this.addedChildrenUpdates = null;
+ this.removedChildrenUpdates = removeChildrenUpdates;
+ this.updateChildrenUpdates = null;
+ }
+
+ public UpdateObject(
+ String objectId,
+ Map<String, Boolean> childrenStatus,
+ List<AddChild> addedChildrenUpdates,
+ List<RemoveChild> removedChildrenUpdates,
+ List<UpdateObject> updateChildrenUpdates)
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException("No null object id accepted");
+ }
+ if (addedChildrenUpdates == null)
+ {
+ throw new IllegalArgumentException("No null added children accepted");
+ }
+ if (removedChildrenUpdates == null)
+ {
+ throw new IllegalArgumentException("No null removed children accepted");
+ }
+ if (updateChildrenUpdates == null)
+ {
+ throw new IllegalArgumentException("No null update children accepted");
+ }
+
+ //
+ this.objectId = objectId;
+ this.childrenStatus = childrenStatus;
+ this.addedChildrenUpdates = addedChildrenUpdates;
+ this.removedChildrenUpdates = removedChildrenUpdates;
+ this.updateChildrenUpdates = updateChildrenUpdates;
+ }
+
+ public void execute(ViewPortContext context)
+ {
+ UIObjectImpl object = (UIObjectImpl)context.getObject(objectId);
+
+ // Normally should be ok because if we have removed children updates it means
+ // that it was created because the existing object was referencing children
+ for (RemoveChild removedChildUpdate : removedChildrenUpdates)
+ {
+ removedChildUpdate.execute(context);
+ }
+
+ //
+ if (childrenStatus != null)
+ {
+ if (object.childRefs == null)
+ {
+ object.childRefs = new HashMap<String, UIObjectRef>();
+ for (Map.Entry<String, Boolean> childRefEntry : childrenStatus.entrySet())
+ {
+ object.childRefs.put(childRefEntry.getKey(), new UIObjectRef(childRefEntry.getKey(), childRefEntry.getValue()));
+ }
+
+ //
+ context.createChildren(objectId);
+ }
+
+ //
+ for (AddChild addedChildUpdate : addedChildrenUpdates)
+ {
+ addedChildUpdate.execute(context);
+ }
+
+ //
+ for (UpdateObject updateChildUpdate : updateChildrenUpdates)
+ {
+ updateChildUpdate.execute(context);
+ }
+ }
+ else
+ {
+ if (object.childRefs != null)
+ {
+ context.destroyChildren(objectId);
+ }
+ }
+ }
+ }
+
+ public static class AddObject extends ObjectUpdate
+ {
+
+ /** . */
+ private final UIObjectImpl object;
+
+ /** . */
+ private final Map<String, Boolean> childrenStatus;
+
+ /** . */
+ private final List<AddChild> addedChildrenUpdates;
+
+ /** . */
+ private final List<RemoveChild> removedChildrenUpdates;
+
+ /** . */
+ private final List<UpdateObject> updateChildrenUpdates;
+
+ public AddObject(UIObjectImpl object)
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException("No null object accepted");
+ }
+
+ //
+ this.object = object;
+ this.childrenStatus = null;
+ this.addedChildrenUpdates = null;
+ this.removedChildrenUpdates = null;
+ this.updateChildrenUpdates = null;
+ }
+
+ public AddObject(
+ UIObjectImpl object,
+ Map<String, Boolean> childrenStatus,
+ List<AddChild> addedChildrenUpdates,
+ List<RemoveChild> removedChildrenUpdates,
+ List<UpdateObject> updateChildrenUpdates)
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException("No null object accepted");
+ }
+ if (addedChildrenUpdates == null)
+ {
+ throw new IllegalArgumentException("No null added children accepted");
+ }
+ if (removedChildrenUpdates == null)
+ {
+ throw new IllegalArgumentException("No null removed children accepted");
+ }
+ if (updateChildrenUpdates == null)
+ {
+ throw new IllegalArgumentException("No null update children accepted");
+ }
+
+
+ //
+ this.object = object;
+ this.childrenStatus = childrenStatus;
+ this.addedChildrenUpdates = addedChildrenUpdates;
+ this.removedChildrenUpdates = removedChildrenUpdates;
+ this.updateChildrenUpdates = updateChildrenUpdates;
+ }
+
+ public void execute(ViewPortContext context)
+ {
+ context.addObject(object);
+
+ //
+ if (childrenStatus != null)
+ {
+ object.childRefs = new HashMap<String, UIObjectRef>();
+ for (Map.Entry<String, Boolean> childRefEntry : childrenStatus.entrySet())
+ {
+ object.childRefs.put(childRefEntry.getKey(), new UIObjectRef(childRefEntry.getKey(), childRefEntry.getValue()));
+ }
+
+ //
+ context.createChildren(object.getId());
+
+ //
+ for (AddChild addedChildUpdate : addedChildrenUpdates)
+ {
+ addedChildUpdate.execute(context);
+ }
+
+ //
+ for (RemoveChild removedChildUpdate : removedChildrenUpdates)
+ {
+ removedChildUpdate.execute(context);
+ }
+
+ //
+ for (UpdateObject updateChildUpdate : updateChildrenUpdates)
+ {
+ updateChildUpdate.execute(context);
+ }
+ }
+ }
+ }
+
+ public static class RemoveObject extends ObjectUpdate
+ {
+
+ /** . */
+ final String objectId;
+
+ /** . */
+ private final List<RemoveObject> removedChildrenUpdates;
+
+ /** . */
+ private final AddChild addChildUpdate;
+
+ public RemoveObject(String objectId, List<RemoveObject> removedChildrenUpdates, AddChild addChildUpdate)
+ {
+ this.objectId = objectId;
+ this.removedChildrenUpdates = removedChildrenUpdates;
+ this.addChildUpdate = addChildUpdate;
+ }
+
+ public void execute(ViewPortContext context)
+ {
+ for (RemoveObject removedChildUpdate : removedChildrenUpdates)
+ {
+ context.removeChild(objectId, removedChildUpdate.objectId);
+
+ //
+ removedChildUpdate.execute(context);
+ }
+
+ //
+ context.removeObject(objectId);
+
+ //
+ if (addChildUpdate != null)
+ {
+ addChildUpdate.execute(context);
+ }
+ }
+ }
+
+ public static class AddChild extends ObjectUpdate
+ {
+
+ /** . */
+ private final String parentId;
+
+ /** . */
+ private final AddObject addedObjectUpdate;
+
+ public AddChild(String parentId, AddObject addedObjectUpdate)
+ {
+ this.parentId = parentId;
+ this.addedObjectUpdate = addedObjectUpdate;
+ }
+
+ public void execute(ViewPortContext context)
+ {
+ addedObjectUpdate.execute(context);
+
+ //
+ context.addChild(parentId, addedObjectUpdate.object.getId());
+ }
+ }
+
+ public static class RemoveChild extends ObjectUpdate
+ {
+
+ /** . */
+ private final String parentId;
+
+ /** . */
+ final RemoveObject removedObjectUpdate;
+
+ public RemoveChild(String parentId, RemoveObject removedObjectUpdate)
+ {
+ this.parentId = parentId;
+ this.removedObjectUpdate = removedObjectUpdate;
+ }
+
+ public void execute(ViewPortContext context)
+ {
+ context.removeChild(parentId, removedObjectUpdate.objectId);
+
+ //
+ removedObjectUpdate.execute(context);
+ }
+ }
+}
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 2008-03-28 17:53:50 UTC (rev 10402)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/state/structural/StructuralObject.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -37,6 +37,9 @@
StructuralState getState();
+ /**
+ * todo : replace by equals probably.
+ */
boolean compareTo(StructuralObject other);
/**
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ObjectTraversalType.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ObjectTraversalType.java 2008-03-28 17:53:50 UTC (rev 10402)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model2/ObjectTraversalType.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -32,18 +32,18 @@
{
/**
- * The object should not be visited.
+ * The object should be visited and its children.
*/
- SKIP,
+ RECURSIVE,
/**
* The object should be visited but not its children.
*/
SINGLE,
+
/**
- * The object should be visited and its children.
+ * The object should not be visited.
*/
- RECURSIVE
-
+ SKIP
}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AbstractModelTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.UIModel;
+import org.jboss.portal.presentation.test.model.state.structural.MockModel;
+import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.impl.model2.refresh.UIModelImpl;
+import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AbstractModelTestCase extends TestCase
+{
+
+ /** . */
+ protected UIModel model;
+
+ /** . */
+ protected MockModel mockModel;
+
+ /** . */
+ protected StructuralStateContext structuralStateContext;
+
+ protected void setUp() throws Exception
+ {
+ mockModel = new MockModelImpl();
+ structuralStateContext = mockModel.getStructuralStateContext();
+ model = new UIModelImpl(new NavigationalStateContextImpl(), structuralStateContext);
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AddChildTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AddChildTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/AddChildTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPort;
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+import org.jboss.portal.presentation.test.model.state.structural.MockObject;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AddChildTestCase extends TraversalModelTestCase
+{
+
+ public void testAddChild()
+ {
+ test(1, null);
+ }
+
+ protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after, Object handback)
+ {
+ NodeDef rootDef = NodeDef.create();
+ NodeDef fooDef = rootDef.addChild("foo");
+ fooDef.setTraversal(before[0]);
+
+ //
+ rootDef.populate(mockModel);
+
+ //
+ ViewPortScope scope = new CustomScope(model, rootDef);
+ UIObjectTree context = new UIObjectTree();
+ ViewPort viewPort = model.createViewPort(context, scope);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+
+ //
+ mockModel.getRoot().getChild("foo").addChild("juu", MockObject.Type.PORTAL);
+ fooDef.addChild("juu");
+ fooDef.setTraversal(after[0]);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/CustomScope.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/CustomScope.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/CustomScope.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model2.UIModel;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CustomScope implements ViewPortScope
+{
+
+ /** . */
+ private final UIModel model;
+
+ /** . */
+ private final NodeDef root;
+
+ /** . */
+ private NodeDef current;
+
+ public CustomScope(UIModel model, NodeDef root)
+ {
+ if (root == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.model = model;
+ this.root = root;
+ this.current = null;
+ }
+
+ public String getRootId()
+ {
+ return model.getRootId();
+ }
+
+ public ObjectTraversalType enterObject(UIObject object)
+ {
+ if (current == null)
+ {
+ // It must be the root
+ if (!model.getRootId().equals(object.getId()))
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ current = root;
+ }
+ else
+ {
+ NodeDef child = current.getChild(object.getName());
+
+ //
+ if (child == null)
+ {
+ throw new IllegalStateException("No such child " + object.getName());
+ }
+
+ //
+ current = child;
+ }
+
+ //
+ return current.getTraversal();
+ }
+
+ public void leaveObject(UIObject object)
+ {
+ current = current.getParent();
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/ModelTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/ModelTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPort;
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ModelTestCase extends TraversalModelTestCase
+{
+
+ public void testRefresh1() throws Exception
+ {
+ test(4, null);
+ }
+
+ protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after, Object handback)
+ {
+ NodeDef rootDef = NodeDef.create();
+ NodeDef fooDef = rootDef.addChild("foo");
+ NodeDef barDef = rootDef.addChild("bar");
+ NodeDef juuDef = fooDef.addChild("juu");
+ NodeDef daaDef = fooDef.addChild("daa");
+
+ //
+ fooDef.setTraversal(before[0]);
+ barDef.setTraversal(before[1]);
+ juuDef.setTraversal(before[2]);
+ daaDef.setTraversal(before[3]);
+
+ //
+ rootDef.populate(mockModel);
+
+ //
+ ViewPortScope scope = new CustomScope(model, rootDef);
+ UIObjectTree context = new UIObjectTree();
+ ViewPort viewPort = model.createViewPort(context, scope);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+
+ //
+ fooDef.setTraversal(after[0]);
+ barDef.setTraversal(after[1]);
+ juuDef.setTraversal(after[2]);
+ daaDef.setTraversal(after[3]);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/MoveChildTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/MoveChildTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/MoveChildTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,155 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPort;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MoveChildTestCase extends TraversalModelTestCase
+{
+
+ public void testMoveChild1()
+ {
+ test(0, new Runnable()
+ {
+ public void run()
+ {
+ NodeDef rootDef = NodeDef.create();
+ NodeDef fooDef = rootDef.addChild("foo");
+ NodeDef juuDef = fooDef.addChild("juu");
+ NodeDef barDef = rootDef.addChild("bar");
+
+ //
+ rootDef.populate(mockModel);
+
+ //
+ ViewPortScope scope = new CustomScope(model, rootDef);
+ UIObjectTree context = new UIObjectTree();
+ ViewPort viewPort = model.createViewPort(context, scope);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+
+ //
+ mockModel.getRoot().getChild("foo").getChild("juu").move(mockModel.getRoot().getChild("bar"));
+ fooDef.removeChild("juu");
+ barDef.addChild("juu");
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+ }
+ });
+ }
+
+ public void testMoveChild2()
+ {
+ test(0, new Runnable()
+ {
+ public void run()
+ {
+ NodeDef rootDef = NodeDef.create();
+ NodeDef fooDef = rootDef.addChild("foo");
+ NodeDef barDef = rootDef.addChild("bar");
+ NodeDef juuDef = barDef.addChild("juu");
+
+ //
+ rootDef.populate(mockModel);
+
+ //
+ ViewPortScope scope = new CustomScope(model, rootDef);
+ UIObjectTree context = new UIObjectTree();
+ ViewPort viewPort = model.createViewPort(context, scope);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+
+ //
+ mockModel.getRoot().getChild("bar").getChild("juu").move(mockModel.getRoot().getChild("foo"));
+ barDef.removeChild("juu");
+ fooDef.addChild("juu");
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+ }
+ });
+ }
+
+ public void testMoveChild3()
+ {
+ test(0, new Runnable()
+ {
+ public void run()
+ {
+ NodeDef rootDef = NodeDef.create();
+ NodeDef fooDef = rootDef.addChild("foo");
+ NodeDef juuDef = fooDef.addChild("juu");
+ NodeDef barDef = rootDef.addChild("bar");
+ NodeDef daaDef = barDef.addChild("daa");
+
+ //
+ rootDef.populate(mockModel);
+
+ //
+ ViewPortScope scope = new CustomScope(model, rootDef);
+ UIObjectTree context = new UIObjectTree();
+ ViewPort viewPort = model.createViewPort(context, scope);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+
+ //
+ mockModel.getRoot().getChild("foo").getChild("juu").move(mockModel.getRoot().getChild("bar"));
+ mockModel.getRoot().getChild("bar").getChild("daa").move(mockModel.getRoot().getChild("foo"));
+ fooDef.removeChild("juu");
+ barDef.addChild("juu");
+ barDef.removeChild("daa");
+ fooDef.addChild("daa");
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+ }
+ });
+ }
+
+ protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after, Object handback)
+ {
+ ((Runnable)handback).run();
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/NodeDef.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,174 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+import org.jboss.portal.presentation.test.model.state.structural.MockObject;
+import org.jboss.portal.presentation.test.model.state.structural.MockModel;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+
+import junit.framework.Assert;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NodeDef
+{
+
+ public static NodeDef create()
+ {
+ return new NodeDef("");
+ }
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, NodeDef> children;
+
+ /** . */
+ private ObjectTraversalType traversal;
+
+ /** . */
+ private NodeDef parent;
+
+ private NodeDef(String name)
+ {
+ this.name = name;
+ this.children = new HashMap<String, NodeDef>();
+ this.traversal = ObjectTraversalType.RECURSIVE;
+ this.parent = null;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public NodeDef getChild(String name)
+ {
+ return children.get(name);
+ }
+
+ public NodeDef getParent()
+ {
+ return parent;
+ }
+
+ public ObjectTraversalType getTraversal()
+ {
+ return traversal;
+ }
+
+ public void setTraversal(ObjectTraversalType traversal)
+ {
+ this.traversal = traversal;
+ }
+
+ public NodeDef addChild(String name)
+ {
+ if (children.containsKey(name))
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ NodeDef child = new NodeDef(name);
+
+ //
+ children.put(name, child);
+ child.parent = this;
+
+ //
+ return child;
+ }
+
+ public void removeChild(String name)
+ {
+ NodeDef child = children.remove(name);
+
+ //
+ if (child == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ child.parent = null;
+ }
+
+ public void populate(MockModel model)
+ {
+ populate(model.getRoot());
+ }
+
+ public void populate(MockObject object)
+ {
+ for (Map.Entry<String, NodeDef> childNodeEntry : children.entrySet())
+ {
+ MockObject child = object.addChild(childNodeEntry.getKey(), MockObject.Type.PORTAL);
+ childNodeEntry.getValue().populate(child);
+ }
+ }
+
+ public void assertEquals(UIObjectNode objectNode)
+ {
+ Assert.assertEquals(name, objectNode.getObject().getName());
+
+ //
+ switch (traversal)
+ {
+ case SKIP:
+ Assert.fail();
+ break;
+ case SINGLE:
+ Assert.assertNull(objectNode.getChildren());
+ break;
+ case RECURSIVE:
+ Set<String> expectedChildrenNames = new HashSet<String>();
+ for (Map.Entry<String, NodeDef> entry : children.entrySet())
+ {
+ if (entry.getValue().getTraversal() != ObjectTraversalType.SKIP)
+ {
+ expectedChildrenNames.add(entry.getKey());
+ }
+ }
+
+ //
+ Assert.assertEquals(expectedChildrenNames, objectNode.getChildren().keySet());
+
+ //
+ for (UIObjectNode childObjectNode : objectNode.getChildren().values())
+ {
+ NodeDef child = children.get(childObjectNode.getObject().getName());
+ child.assertEquals(childObjectNode);
+ }
+ break;
+ }
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/RemoveChildTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/RemoveChildTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/RemoveChildTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ViewPortScope;
+import org.jboss.portal.presentation.model2.ViewPort;
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RemoveChildTestCase extends TraversalModelTestCase
+{
+
+ public void testRemoveChild()
+ {
+ test(1, null);
+ }
+
+ protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after, Object handback)
+ {
+ NodeDef rootDef = NodeDef.create();
+ NodeDef fooDef = rootDef.addChild("foo");
+ NodeDef barDef = fooDef.addChild("bar");
+ NodeDef juuDef = fooDef.addChild("juu");
+
+ //
+ rootDef.populate(mockModel);
+
+ //
+ ViewPortScope scope = new CustomScope(model, rootDef);
+ UIObjectTree context = new UIObjectTree();
+ ViewPort viewPort = model.createViewPort(context, scope);
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+
+ //
+ mockModel.destroy(mockModel.getRoot().getChild("foo").getChild("juu"));
+ fooDef.removeChild("juu");
+
+ //
+ viewPort.refresh();
+ rootDef.assertEquals(context.getNode(model.getRootId()));
+ context.assertConsistency(model.getRootId());
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/TraversalModelTestCase.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,128 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ObjectTraversalType;
+import org.jboss.portal.presentation.model2.UIModel;
+import org.jboss.portal.presentation.test.model.state.structural.MockModel;
+import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.impl.model2.refresh.UIModelImpl;
+import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class TraversalModelTestCase extends TestCase
+{
+
+ /** . */
+ protected UIModel model;
+
+ /** . */
+ protected MockModel mockModel;
+
+ /** . */
+ protected StructuralStateContext structuralStateContext;
+
+ public void test(int size, Object handback)
+ {
+ ObjectTraversalType[] before = new ObjectTraversalType[size];
+ ObjectTraversalType[] after = new ObjectTraversalType[size];
+ Collection<ObjectTraversalType[]> enumeration = generate(before.length + after.length);
+
+ //
+ for (ObjectTraversalType[] element : enumeration)
+ {
+ mockModel = new MockModelImpl();
+ structuralStateContext = mockModel.getStructuralStateContext();
+ model = new UIModelImpl(new NavigationalStateContextImpl(), structuralStateContext);
+
+ //
+ Assert.assertEquals(before.length + after.length, element.length);
+ System.arraycopy(element, 0, before, 0, before.length);
+ System.arraycopy(element, before.length, after, 0, after.length);
+ boolean failed = true;
+ try
+ {
+ test(before, after, handback);
+ failed = false;
+ }
+ finally
+ {
+ if (failed)
+ {
+ System.out.println("Arrays.asList(before) = " + Arrays.asList(before));
+ System.out.println("Arrays.asList(after) = " + Arrays.asList(after));
+ }
+
+ //
+ mockModel = null;
+ structuralStateContext = null;
+ model = null;
+ }
+ }
+ }
+
+ protected abstract void test(ObjectTraversalType[] before, ObjectTraversalType[] after, Object handback);
+
+ public static Collection<ObjectTraversalType[]> generate(int size)
+ {
+ if (size == 0)
+ {
+ return Collections.singleton(new ObjectTraversalType[0]);
+ }
+ else
+ {
+ Collection<ObjectTraversalType[]> enumeration = generate(size - 1);
+
+ //
+ ArrayList<ObjectTraversalType[]> augmentedEnumeration = new ArrayList<ObjectTraversalType[]>(enumeration.size() * 3);
+
+ //
+ for (ObjectTraversalType type : ObjectTraversalType.values())
+ {
+ for (ObjectTraversalType[] element : enumeration)
+ {
+ ObjectTraversalType[] augmentedElement = new ObjectTraversalType[1 + element.length];
+ System.arraycopy(element, 0, augmentedElement, 1, element.length);
+ augmentedElement[0] = type;
+ augmentedEnumeration.add(augmentedElement);
+ }
+ }
+
+ //
+ return augmentedEnumeration;
+ }
+ }
+
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectNode.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,125 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.UIObject;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIObjectNode
+{
+
+ /** . */
+ private final UIObject object;
+
+ /** . */
+ private Map<String, UIObjectNode> children;
+
+ public UIObjectNode(UIObject object)
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.object = object;
+ }
+
+ public UIObject getObject()
+ {
+ return object;
+ }
+
+ public Map<String, UIObjectNode> getChildren()
+ {
+ return children;
+ }
+
+ public void addChild(UIObjectNode child)
+ {
+ if (children == null)
+ {
+ throw new IllegalStateException("Children not initialized");
+ }
+
+ //
+ String key = child.getObject().getName();
+
+ //
+ if (children.containsKey(key))
+ {
+ throw new IllegalStateException("Duplicate name " + key + " among " + children.keySet());
+ }
+
+ //
+ children.put(key, child);
+ }
+
+ public void removeChild(UIObjectNode child)
+ {
+ if (children == null)
+ {
+ throw new IllegalStateException("Children not initialized");
+ }
+
+ //
+ String key = child.getObject().getName();
+
+ //
+ if (!children.containsKey(key))
+ {
+ throw new IllegalStateException("No such child with name " + key + " among " + children.keySet());
+ }
+
+ //
+ children.remove(key);
+ }
+
+ public void createChildren()
+ {
+ if (children != null)
+ {
+ throw new IllegalStateException("Children already initialized");
+ }
+
+ //
+ children = new HashMap<String, UIObjectNode>();
+ }
+
+ public void destroyChildren()
+ {
+ if (children == null)
+ {
+ throw new IllegalStateException("Children never initialized");
+ }
+
+ //
+ children = null;
+ }
+}
\ No newline at end of file
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model3/UIObjectTree.java 2008-03-28 19:49:52 UTC (rev 10403)
@@ -0,0 +1,163 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.model3;
+
+import org.jboss.portal.presentation.model2.ViewPortContext;
+import org.jboss.portal.presentation.model2.UIObject;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import junit.framework.Assert;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIObjectTree implements ViewPortContext
+{
+
+ /** . */
+ private final Map<String, UIObjectNode> nodes = new HashMap<String, UIObjectNode>();
+
+ public void assertConsistency(String rootId)
+ {
+ UIObjectNode root = nodes.get(rootId);
+ Assert.assertNotNull(root);
+ ArrayList<String> allIds = new ArrayList<String>();
+ collect(root, allIds);
+ Assert.assertEquals(new HashSet<String>(allIds).size(), allIds.size());
+ Assert.assertEquals(new HashSet<String>(allIds), nodes.keySet());
+ }
+
+ private void collect(UIObjectNode node, ArrayList<String> ids)
+ {
+ ids.add(node.getObject().getId());
+ if (node.getChildren() != null)
+ {
+ for (UIObjectNode child : node.getChildren().values())
+ {
+ collect(child, ids);
+ }
+ }
+ }
+
+ public UIObjectNode getNode(String objectId)
+ {
+ return nodes.get(objectId);
+ }
+
+ public UIObject getObject(String objectId)
+ {
+ UIObjectNode node = nodes.get(objectId);
+
+ //
+ return node != null ? node.getObject() : null;
+ }
+
+ public void removeObject(String objectId)
+ {
+ if (nodes.remove(objectId) == null)
+ {
+ throw new IllegalStateException("No such object " + objectId);
+ }
+ }
+
+ public void addObject(UIObject object)
+ {
+ String id = object.getId();
+
+ //
+ if (nodes.containsKey(id))
+ {
+ throw new IllegalStateException("Object with id " + id + " is already loaded");
+ }
+
+ //
+ nodes.put(id, new UIObjectNode(object));
+ }
+
+ public void addChild(String parentId, String childId)
+ {
+ UIObjectNode parent = nodes.get(parentId);
+ if (parent == null)
+ {
+ throw new IllegalStateException("No such object " + parentId);
+ }
+
+ //
+ UIObjectNode child = nodes.get(childId);
+ if (child == null)
+ {
+ throw new IllegalStateException("No such object " + childId);
+ }
+
+ //
+ parent.addChild(child);
+ }
+
+ public void removeChild(String parentId, String childId)
+ {
+ UIObjectNode parent = nodes.get(parentId);
+ if (parent == null)
+ {
+ throw new IllegalStateException("No such object " + parentId);
+ }
+
+ //
+ UIObjectNode child = nodes.get(childId);
+ if (child == null)
+ {
+ throw new IllegalStateException("No such object " + childId);
+ }
+
+ //
+ parent.removeChild(child);
+ }
+
+ public void createChildren(String parentId)
+ {
+ UIObjectNode parent = nodes.get(parentId);
+ if (parent == null)
+ {
+ throw new IllegalStateException("No such object " + parentId);
+ }
+
+ //
+ parent.createChildren();
+ }
+
+ public void destroyChildren(String parentId)
+ {
+ UIObjectNode parent =nodes.get(parentId);
+ if (parent == null)
+ {
+ throw new IllegalStateException("No such object " + parentId);
+ }
+
+ //
+ parent.destroyChildren();
+ }
+}
\ No newline at end of file
16 years, 1 month
JBoss Portal SVN: r10401 - in modules: presentation and 104 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-03-28 13:51:45 -0400 (Fri, 28 Mar 2008)
New Revision: 10401
Added:
modules/presentation/
modules/presentation/branches/
modules/presentation/tags/
modules/presentation/trunk/
modules/presentation/trunk/.classpath
modules/presentation/trunk/.project
modules/presentation/trunk/bin/
modules/presentation/trunk/bin/classes/
modules/presentation/trunk/bin/classes/org/
modules/presentation/trunk/bin/classes/org/jboss/
modules/presentation/trunk/bin/classes/org/jboss/portal/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$2.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$3.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$4.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$5.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$ResponseTextHandlerImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$TabListenerImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/MyGWTPrototype$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/MyGWTPrototype.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$2.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$3.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$4.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$5.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$ResponseTextHandlerImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Portal.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout$2.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletService.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletServiceAsync.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletWindowPanel.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Session.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Util.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/layout/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/layout/LayoutManager.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/AnchorListener.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/ListenerUtil.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/SubmitListener.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIContainer.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIObject.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIPage.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIPortal.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIWindow.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/Page.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/Window.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxShowUIObjectResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/Caller.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/ClientAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/ClientResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/service/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/service/PortalRPC.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/widget/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/widget/PortletWindow$PortletWindowListener.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/PresentationContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/controller/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/controller/AjaxUIController.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/controller/UIController.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/PresentationContextImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/SessionConstants.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/entry/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/AjaxModelListener.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIContainerImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIContextImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIObjectImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIPageImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIPortalImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIWindowImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ManagedObject$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ManagedObject.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ObjectContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$2.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$ManyToOne.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany$LazySet$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany$LazySet.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIContainerObject.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIObjectContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIObjectFactory.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/navigational/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl$Key.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/layout/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/layout/LayoutManager.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/layout/LayoutService.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/ModelEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/ModelListener.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/StateType.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIContainer.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject$Status.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject$Visitor.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIPage.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIPortal.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIWindow.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/content/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/content/WindowContent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateChange.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateChangeEvent.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateModification.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/navigational/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/navigational/NavigationalStateModification.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Creation.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Destruction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Move.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Update.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/ConstraintViolationException.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/NoSuchStateException.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StaleStateException.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StateChangeVetoException.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StateException.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/navigational/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Change.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Creation.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Destruction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Move.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Refresh.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Update.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralState.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/CreateUIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/DestroyUIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ErrorResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/GetActivation.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/LinkActivation.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/MoveUIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/PostActivation.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/RedirectResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/RenameUIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ServerAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ServerResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ShowUIObjectResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/StreamResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/UIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/UIObjectResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ViewUIObjectAction.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/PresentationServer.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/Processor.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/ProcessorRequest.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/ProcessorResponse.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/GetAjaxPageTestCase.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/HostedModeProxy.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/JBossUnitSandBox.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/PortletServiceImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/layout/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/AbstractModelTestCase$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/AbstractModelTestCase.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/EventAssert.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/EventTestCase.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/MockModelTestCase.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase$PropertyAssert$Blah.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase$PropertyAssert.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/UIModelTester.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockException$ErrorCode.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockException.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModel.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl$1.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Failure.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Type.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$UpdateBehavior.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Veto.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectHandle.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockContext.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockInstance.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPage.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortal.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalObject.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalServer.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortlet.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockWindow.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralObjectImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralStateContextImpl.class
modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralStateImpl.class
modules/presentation/trunk/bin/test-classes/
modules/presentation/trunk/build/
modules/presentation/trunk/build/pom.xml
modules/presentation/trunk/pom.xml
modules/presentation/trunk/presentation/
modules/presentation/trunk/presentation/pom.xml
modules/presentation/trunk/presentation/src/
modules/presentation/trunk/presentation/src/main/
modules/presentation/trunk/presentation/src/main/java/
modules/presentation/trunk/presentation/src/main/java/org/
modules/presentation/trunk/presentation/src/main/java/org/jboss/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/AsyncPages.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/MyGWTPrototype.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PartialRefresh.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Portal.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortalLayout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletService.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletServiceAsync.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletWindowPanel.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Session.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Util.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/layout/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/layout/LayoutManager.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/AnchorListener.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/ListenerUtil.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/SubmitListener.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContainer.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIObject.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPage.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPortal.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIWindow.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Page.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Window.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxShowUIObjectResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/Caller.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/widget/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/AjaxUIController.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/PresentationContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/SessionConstants.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/AjaxModelListener.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPageImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ManagedObject.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIContainerObject.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectFactory.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/state/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/state/navigational/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelListener.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/StateType.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContainer.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObject.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPage.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPortal.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIWindow.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content/WindowContent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChange.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChangeEvent.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateModification.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/navigational/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/navigational/NavigationalStateModification.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/structural/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/ConstraintViolationException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/NoSuchStateException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StaleStateException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateChangeVetoException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/navigational/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralObject.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralState.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/DestroyUIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ErrorResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RedirectResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RenameUIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ShowUIObjectResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/StreamResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectResponse.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ViewUIObjectAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/Processor.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorRequest.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorResponse.java
modules/presentation/trunk/presentation/src/test/
modules/presentation/trunk/presentation/src/test/java/
modules/presentation/trunk/presentation/src/test/java/org/
modules/presentation/trunk/presentation/src/test/java/org/jboss/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/GetAjaxPageTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/HostedModeProxy.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/JBossUnitSandBox.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/PortletServiceImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventAssert.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MockModelTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIModelTester.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockException.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModel.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectHandle.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockContext.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockInstance.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPage.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortal.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalObject.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalServer.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortlet.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockWindow.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralObjectImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateContextImpl.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateImpl.java
modules/presentation/trunk/readme-eclipse.txt
Log:
pf mavenization
Added: modules/presentation/trunk/.classpath
===================================================================
--- modules/presentation/trunk/.classpath (rev 0)
+++ modules/presentation/trunk/.classpath 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="presentation/src/main/java"/>
+ <classpathentry kind="src" path="presentation/src/test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/ant/ant-junit/1.6.5/ant-junit-1.6.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/ant/ant-launcher/1.6.5/ant-launcher-1.6.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/ant/ant-nodeps/1.6.5/ant-nodeps-1.6.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/codehaus/cargo/cargo-core-uberjar/0.8/cargo-core-uberjar-0.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/catalina/5.5.12/catalina-5.5.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/ccpp/ccpp/1.0/ccpp-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/common/common-common/1.2.0.Beta2/common-common-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/common/common-mc/1.2.0.Beta2/common-mc-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/common/common-portal/1.2.0.Beta2/common-portal-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.2/commons-codec-1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/cargo/core/0.9-portal/core-0.9-portal.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-user/1.4.60/gwt-user-1.4.60.jar"/>
+ <classpathentry kind="var" path="M2_REPO/hibernate/hibernate3/3.2.3.GA/hibernate3-3.2.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javassist/3.6.0.GA/javassist-3.6.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.0/jaxb-api-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossas/core-libs/jboss/4.0.4.GA/jboss-4.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR1/jboss-aop-2.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-aop-mc-int/2.0.0.Beta9/jboss-aop-mc-int-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-classloader/2.0.0.Beta9/jboss-classloader-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-classloading-spi/5.0.0.Beta3/jboss-classloading-spi-5.0.0.Beta3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.3.GA/jboss-common-core-2.0.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.3.GA/jboss-common-core-2.2.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-container/2.0.0.Beta9/jboss-container-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.Beta9/jboss-dependency-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-client/2.0.0.Beta9/jboss-deployers-client-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-client-spi/2.0.0.Beta9/jboss-deployers-client-spi-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-core/2.0.0.Beta9/jboss-deployers-core-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-core-spi/2.0.0.Beta9/jboss-deployers-core-spi-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-impl/2.0.0.Beta9/jboss-deployers-impl-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-spi/2.0.0.Beta9/jboss-deployers-spi-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-structure-spi/2.0.0.Beta9/jboss-deployers-structure-spi-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-vfs/2.0.0.Beta9/jboss-deployers-vfs-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-deployers-vfs-spi/2.0.0.Beta9/jboss-deployers-vfs-spi-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-j2ee/4.2.0.GA/jboss-j2ee-4.2.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossas/core-libs/jboss-jca/4.0.4.GA/jboss-jca-4.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-jmx/4.2.0.GA/jboss-jmx-4.2.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta9/jboss-kernel-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossas/core-libs/jboss-local-jdbc/4.0.4.GA/jboss-local-jdbc-4.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-jdk/2.0.3.GA/jboss-logging-jdk-2.0.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-log4j/2.0.3.GA/jboss-logging-log4j-2.0.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-spi/2.0.3.GA/jboss-logging-spi-2.0.3.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-managed/2.0.0.Beta9/jboss-managed-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-metatype/2.0.0.Beta9/jboss-metatype-2.0.0.Beta9.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-remoting/2.2.1.GA/jboss-remoting-2.2.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-system/4.2.0.GA/jboss-system-4.2.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-test/1.0.4.GA/jboss-test-1.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossas/core-libs/jboss-transaction/4.0.4.GA/jboss-transaction-4.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/unit/jboss-unit/1.2.0.Beta2/jboss-unit-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/unit/jboss-unit-mc/1.2.0.Beta2/jboss-unit-mc-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/unit/jboss-unit-remote/1.2.0.Beta2/jboss-unit-remote-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/unit/jboss-unit-tooling-ant/1.2.0.Beta2/jboss-unit-tooling-ant-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/unit/jboss-unit-tooling-core/1.2.0.Beta2/jboss-unit-tooling-core-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta6/jboss-vfs-2.0.0.Beta6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR4/jbossxb-2.0.0.CR4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossas/core-libs/jnpserver/4.0.4.GA/jnpserver-4.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-taglibs/jstl/1.1.2/jstl-1.1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.8/log4j-1.2.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
+ <classpathentry kind="var" path="M2_REPO/net/mygwt/mygwt/0.3.0/mygwt-0.3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-opends/opends-core/legacy/opends-core-legacy.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/osgi/osgi_R4_core/1.0/osgi_R4_core-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/unit/portal-test/1.2.0.Beta2/portal-test-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/unit/portal-test-generic/1.2.0.Beta2/portal-test-generic-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/portlet/portlet-controller/2.0.0.CR1/portlet-controller-2.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/portlet/portlet-jsr168api/2.0.0.CR1/portlet-jsr168api-2.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/portlet/portlet-mc/2.0.0.CR1/portlet-mc-2.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/portlet/portlet-portal/2.0.0.CR1/portlet-portal-2.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/portlet/portlet-portlet/2.0.0.CR1/portlet-portlet-2.0.0.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/portlet/portlet-portlet/2.0.0.CR1/portlet-portlet-2.0.0.CR1-tests.jar"/>
+ <classpathentry kind="var" path="M2_REPO/qdox/qdox/1.6/qdox-1.6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-taglibs/standard/1.1.2/standard-1.1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/trove/trove/2.1.1/trove-2.1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/portal/web/web-web/1.2.0.Beta2/web-web-1.2.0.Beta2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.7.1/xercesImpl-2.7.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
Added: modules/presentation/trunk/.project
===================================================================
--- modules/presentation/trunk/.project (rev 0)
+++ modules/presentation/trunk/.project 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>presentation</name>
+ <comment>JBoss Portal Presentation Module</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$2.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$3.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$3.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$4.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$4.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$5.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$5.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$ResponseTextHandlerImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$ResponseTextHandlerImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$TabListenerImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages$TabListenerImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/AsyncPages.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/MyGWTPrototype$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/MyGWTPrototype$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/MyGWTPrototype.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/MyGWTPrototype.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$2.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$3.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$3.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$4.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$4.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$5.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$5.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$ResponseTextHandlerImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh$ResponseTextHandlerImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PartialRefresh.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Portal.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Portal.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout$2.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortalLayout.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletService.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletService.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletServiceAsync.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletServiceAsync.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletWindowPanel.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/PortletWindowPanel.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Session.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Session.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Util.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/Util.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/layout/LayoutManager.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/layout/LayoutManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/AnchorListener.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/AnchorListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/ListenerUtil.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/ListenerUtil.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/SubmitListener.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/listener/SubmitListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIContainer.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIContainer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIObject.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIPage.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIPage.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIPortal.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIPortal.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIWindow.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/AjaxUIWindow.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/Page.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/Page.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/Window.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/model/Window.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxShowUIObjectResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxShowUIObjectResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/Caller.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/Caller.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/ClientAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/ClientAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/ClientResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/protocol/ClientResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/service/PortalRPC.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/service/PortalRPC.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/widget/PortletWindow$PortletWindowListener.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/widget/PortletWindow$PortletWindowListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/PresentationContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/PresentationContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/controller/AjaxUIController.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/controller/AjaxUIController.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/controller/UIController.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/client/controller/UIController.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/PresentationContextImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/PresentationContextImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/SessionConstants.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/SessionConstants.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/AjaxModelListener.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/AjaxModelListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIContainerImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIContainerImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIContextImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIContextImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIObjectImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIObjectImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIPageImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIPageImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIPortalImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIPortalImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIWindowImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/UIWindowImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ManagedObject$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ManagedObject$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ManagedObject.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ManagedObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ObjectContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/ObjectContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$2.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$2.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$ManyToOne.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$ManyToOne.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany$LazySet$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany$LazySet$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany$LazySet.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany$LazySet.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext$OneToMany.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/RelationshipContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIContainerObject.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIContainerObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIObjectContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIObjectContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIObjectFactory.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/container/spi/UIObjectFactory.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl$Key.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl$Key.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/layout/LayoutManager.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/layout/LayoutManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/layout/LayoutService.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/layout/LayoutService.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/ModelEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/ModelEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/ModelListener.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/ModelListener.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/StateType.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/StateType.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIContainer.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIContainer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject$Status.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject$Status.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject$Visitor.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject$Visitor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIPage.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIPage.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIPortal.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIPortal.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIWindow.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/UIWindow.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/content/WindowContent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/content/WindowContent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateChange.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateChange.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateChangeEvent.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateChangeEvent.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateModification.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/StateModification.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/navigational/NavigationalStateModification.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/navigational/NavigationalStateModification.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Creation.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Creation.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Destruction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Destruction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Move.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Move.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Update.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification$Update.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/ConstraintViolationException.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/ConstraintViolationException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/NoSuchStateException.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/NoSuchStateException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StaleStateException.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StaleStateException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StateChangeVetoException.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StateChangeVetoException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StateException.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/StateException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Change.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Change.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Creation.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Creation.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Destruction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Destruction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Move.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Move.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Refresh.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Refresh.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Update.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject$Update.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralState.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralState.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/CreateUIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/CreateUIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/DestroyUIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/DestroyUIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ErrorResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ErrorResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/GetActivation.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/GetActivation.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/LinkActivation.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/LinkActivation.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/MoveUIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/MoveUIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/PostActivation.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/PostActivation.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/RedirectResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/RedirectResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/RenameUIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/RenameUIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ServerAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ServerAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ServerResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ServerResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ShowUIObjectResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ShowUIObjectResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/StreamResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/StreamResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/UIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/UIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/UIObjectResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/UIObjectResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ViewUIObjectAction.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/protocol/ViewUIObjectAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/PresentationServer.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/PresentationServer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/Processor.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/Processor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/ProcessorRequest.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/ProcessorRequest.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/ProcessorResponse.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/server/ProcessorResponse.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/GetAjaxPageTestCase.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/GetAjaxPageTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/HostedModeProxy.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/HostedModeProxy.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/JBossUnitSandBox.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/JBossUnitSandBox.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/PortletServiceImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/ajax/PortletServiceImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/AbstractModelTestCase$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/AbstractModelTestCase$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/AbstractModelTestCase.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/AbstractModelTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/EventAssert.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/EventAssert.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/EventTestCase.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/EventTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/MockModelTestCase.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/MockModelTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase$PropertyAssert$Blah.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase$PropertyAssert$Blah.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase$PropertyAssert.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase$PropertyAssert.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/ModelTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/UIModelTester.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/UIModelTester.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockException$ErrorCode.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockException$ErrorCode.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockException.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModel.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModel.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl$1.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl$1.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Failure.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Failure.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Type.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Type.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$UpdateBehavior.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$UpdateBehavior.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Veto.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject$Veto.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectHandle.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectHandle.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockContext.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockContext.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockInstance.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockInstance.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPage.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPage.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortal.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortal.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalObject.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalObject.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalServer.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortalServer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortlet.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockPortlet.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockWindow.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/MockWindow.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralObjectImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralObjectImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralStateContextImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralStateContextImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralStateImpl.class
===================================================================
(Binary files differ)
Property changes on: modules/presentation/trunk/bin/classes/org/jboss/portal/presentation/test/portal/plugin/StructuralStateImpl.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/presentation/trunk/build/pom.xml
===================================================================
--- modules/presentation/trunk/build/pom.xml (rev 0)
+++ modules/presentation/trunk/build/pom.xml 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This pom functions as a default configuration. The subproject
+ poms each inherit configuration from this one.
+
+ When adding version information for an artifact please do the following
+ - add a version property for the specific version
+ - add a dependency in the dependencyManagement section which refers to
+ the property
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>jboss-portal-parent</artifactId>
+ <version>1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Portal Presentation Module</name>
+ <url>http://www.jboss.com/products/jbossmc</url>
+ <description>JBoss Portal Presentation Module</description>
+
+ <properties>
+ <version.sun.servlet>2.4</version.sun.servlet>
+ <version.apache-log4j>1.2.8</version.apache-log4j>
+ <version.junit>3.8.1</version.junit>
+ <version.httpunit>1.6</version.httpunit>
+ <version.gwt>1.4.60</version.gwt>
+ <version.mygwt>0.3.0</version.mygwt>
+
+ <version.jboss.portal.common>1.2.0.Beta2</version.jboss.portal.common>
+ <version.jboss.portal.portlet>2.0.0.CR1</version.jboss.portal.portlet>
+ <version.jboss.portal.web>1.2.0.Beta2</version.jboss.portal.web>
+ <version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
+
+ <!--
+ TODO: figure out how to handle this dependency since they are not mavenized yet
+ <version.jboss.portal.server>1.0.1</version.jboss.portal.server>
+ <version.jboss.portal.jems>1.0.1</version.jboss.portal.jems>
+ -->
+
+ <version.jboss.microcontainer>2.0.0.Beta9</version.jboss.microcontainer>
+ <version.jboss.common.core>2.0.3.GA</version.jboss.common.core>
+ <version.jboss.remoting>2.2.1.GA</version.jboss.remoting>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net maven repository</id>
+ <url>http://download.java.net/maven/2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencyManagement>
+ <!-- The parent pom manages the inter-dependencies of the modules. -->
+ <dependencies>
+ <dependency>
+ <groupId>sun-servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${version.sun.servlet}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${version.apache-log4j}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <version>${version.httpunit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${version.gwt}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.mygwt</groupId>
+ <artifactId>mygwt</artifactId>
+ <version>${version.mygwt}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ <version>${version.jboss.portal.common}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-portal</artifactId>
+ <version>${version.jboss.portal.common}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-jsr168api</artifactId>
+ <version>${version.jboss.portal.portlet}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portal</artifactId>
+ <version>${version.jboss.portal.portlet}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
+ <version>${version.jboss.portal.web}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-mc</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-remote</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test-generic</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>${version.jboss.common.core}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ <version>${version.jboss.remoting}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
Added: modules/presentation/trunk/pom.xml
===================================================================
--- modules/presentation/trunk/pom.xml (rev 0)
+++ modules/presentation/trunk/pom.xml 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,31 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>module-aggregator</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Portal Presentation Module</name>
+ <version>1.0.0-SNAPSHOT</version>
+ <url>http://labs.jboss.com/jbossportal</url>
+
+ <dependencies/>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the distribution jar file to a local checkout of the maven repository -->
+ <!-- This variable can be set in $MAVEN_HOME/conf/settings.xml -->
+ <id>repository.jboss.org</id>
+ <url>file://${jboss.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ <uniqueVersion>true</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <modules>
+ <module>presentation</module>
+ </modules>
+</project>
Added: modules/presentation/trunk/presentation/pom.xml
===================================================================
--- modules/presentation/trunk/presentation/pom.xml (rev 0)
+++ modules/presentation/trunk/presentation/pom.xml 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,127 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.presentation</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>presentation</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal Presentation Framework</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>sun-servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.mygwt</groupId>
+ <artifactId>mygwt</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-portal</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-jsr168api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portal</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.portal.web</groupId>
+ <artifactId>web-web</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-mc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-remote</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>portal-test-generic</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-remoting</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>false</skip>
+ <includes>
+ <include>**/SampleModuleATest.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/AsyncPages.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/AsyncPages.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/AsyncPages.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,566 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.EntryPoint;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.HTTPRequest;
+import com.google.gwt.user.client.ResponseTextHandler;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.TabBar;
+import com.google.gwt.user.client.ui.TabListener;
+import com.google.gwt.user.client.ui.SourcesTabEvents;
+
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import net.mygwt.ui.client.widget.ContentPanel;
+import net.mygwt.ui.client.widget.IconButton;
+import net.mygwt.ui.client.widget.WidgetContainer;
+import net.mygwt.ui.client.widget.Viewport;
+import net.mygwt.ui.client.widget.layout.*;
+import net.mygwt.ui.client.Style;
+import net.mygwt.ui.client.event.Listener;
+import net.mygwt.ui.client.event.BaseEvent;
+
+import org.jboss.portal.presentation.ajax.client.model.Page;
+import org.jboss.portal.presentation.ajax.client.model.Window;
+
+/**
+ * Used for Prototyping Async Page Management
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AsyncPages implements EntryPoint
+{
+ /**
+ *
+ */
+ private Viewport viewport = null;
+
+ /**
+ *
+ */
+ private WidgetContainer north = null;
+
+ /**
+ *
+ */
+ private WidgetContainer west = null;
+
+ /**
+ *
+ */
+ private WidgetContainer center = null;
+
+
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad()
+ {
+ //Initialize the Viewport
+ this.viewport = new Viewport();
+
+ //Layout for the viewport
+ BorderLayout pageLayout = new BorderLayout();
+
+ //Layout for the north region (Header/Navigation related content produced by the portal are laid out here)
+ FlowLayout northLayout = new FlowLayout();
+
+ //Setup the layout of the root container of the page
+ this.viewport.setLayout(pageLayout);
+
+ //Setup the north region of the page
+ this.north = new WidgetContainer();
+ this.north.setLayout(northLayout);
+ float northSize = this.viewport.getOffsetHeight() * ((float)0.05);
+ BorderLayoutData northData = new BorderLayoutData(Style.NORTH, northSize);
+ northData.resizeable = true;
+ this.viewport.add(this.north, northData);
+
+ //Load the navigation bar....use a tabbed bar
+ TabBar pageNavigator = new TabBar();
+ pageNavigator.addTab("Page 1");
+ pageNavigator.addTab("Page 2");
+ pageNavigator.addTab("Page 3");
+ pageNavigator.selectTab(0);
+ pageNavigator.addTabListener(new TabListenerImpl());
+ this.north.add(pageNavigator);
+
+ //Load the Portal Page
+ this.loadPartialRefreshPage("Page 1");
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadPartialRefreshPage(String pageId)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.getPage(pageId, callback);
+ }
+
+ /**
+ *
+ * @param portalPage
+ */
+ private void displayPortalPage(Page portalPage)
+ {
+ //A Viewport resizing listener
+
+
+ //Dispalying the fully aggregated page
+ Window[] windows = portalPage.getWindows();
+ int column = 0;
+
+ this.setUpPortletRegions();
+
+ //Fill up the page with portlet windows
+ for(int i=0; i<windows.length; i++)
+ {
+ Window pageWindow = windows[i];
+ if(pageWindow.isVisible())
+ {
+ //Add this window to the Page
+ if(column == 0 && windows.length>1)
+ {
+ this.west.add(this.getPortletWindow(pageWindow.getName(), pageWindow.getContent()));
+ column ++;
+ }
+ else
+ {
+ this.center.add(this.getPortletWindow(pageWindow.getName(), pageWindow.getContent()));
+ column = 0;
+ }
+ }
+ }
+
+ //render the page
+ this.viewport.layout(true);
+ }
+
+ /**
+ *
+ * @param content
+ * @return
+ */
+ private ContentPanel getPortletWindow(String windowName, String content)
+ {
+ ContentPanel portletWindow = new ContentPanel(Style.HEADER);
+ portletWindow.setId(windowName);
+ HTML windowContent = new HTML(content);
+
+
+ //Setup listeners
+ //Event Listener for the decoration components like
+ //Normal, Maximized, Minimized
+ Listener listener = new Listener()
+ {
+ public void handleEvent(BaseEvent event)
+ {
+ IconButton cour = (IconButton)event.widget;
+ String id = cour.getId();
+ String windowName = id.substring(0, id.indexOf(':'));
+ String action = id.substring(id.indexOf(':')+1);
+ if(action.equals("restore"))
+ {
+ handleWindowStateChanged(windowName, Window.NORMAL);
+ }
+ else if(action.equals("minimize"))
+ {
+ handleWindowStateChanged(windowName, Window.MINIMIZED);
+ }
+ else if(action.equals("maximize"))
+ {
+ handleWindowStateChanged(windowName, Window.MAXIMIZED);
+ }
+ else if(action.equals("save"))
+ {
+ handleWindowModeChanged(windowName, Window.EDIT);
+ }
+ }
+ };
+ IconButton save = new IconButton("my-tool-save");
+ save.setId(windowName+":save");
+ IconButton help = new IconButton("my-tool-help");
+ help.setId(windowName+":help");
+ IconButton restore = new IconButton("my-tool-restore");
+ restore.setId(windowName+":restore");
+ IconButton minimize = new IconButton("my-tool-minimize");
+ minimize.setId(windowName+":minimize");
+ IconButton maximize = new IconButton("my-tool-maximize");
+ maximize.setId(windowName+":maximize");
+ portletWindow.addButton(save, listener);
+ portletWindow.addButton(help, listener);
+ portletWindow.addButton(restore, listener);
+ portletWindow.addButton(minimize, listener);
+ portletWindow.addButton(maximize, listener);
+
+ //Event Listener for actions perfomed inside the portlet window content
+ //itself.
+ ClickListener contentListener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Event event = DOM.eventGetCurrentEvent();
+ Element target = DOM.eventGetTarget(event);
+
+ if(target.toString().toUpperCase().trim().indexOf("</A>") != -1)
+ {
+ String link = DOM.getElementAttribute(target, "HREF");
+
+ //A link inside the portlet window was clicked
+ //Load its content asynchronously inside this window
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(link);
+ if(isPartialRefreshAllowed)
+ {
+ DOM.eventPreventDefault(event);
+ handlePartialRefreshLink(link, sender);
+ }
+ }
+ else if(target.toString().toUpperCase().trim().indexOf("INPUT") != -1 &&
+ target.toString().toUpperCase().trim().indexOf("SUBMIT") != -1
+ )
+ {
+ Element currentForm = DOM.getParent(target);
+ String enctype = DOM.getElementAttribute(currentForm, "enctype");
+ String action = DOM.getElementAttribute(currentForm, "action");
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(action);
+ if((isPartialRefreshAllowed) && (enctype == null || !enctype.equals("multipart/form-data")))
+ {
+ DOM.eventPreventDefault(event);
+
+ //Call a native javascript function here
+ String method = DOM.getElementAttribute(currentForm, "method");
+ String serializedForm = serializeForm(currentForm);
+
+ handlePartialRefreshForm(action, method, serializedForm, sender);
+ }
+ }
+ }
+ };
+ windowContent.addClickListener(contentListener);
+
+ //Add the content
+ portletWindow.add(windowContent);
+
+ return portletWindow;
+ }
+
+ /**
+ *
+ *
+ */
+ private void setUpPortletRegions()
+ {
+ if(this.west != null)
+ {
+ this.viewport.remove(this.west);
+ }
+ if(this.center != null)
+ {
+ this.viewport.remove(this.center);
+ }
+
+ //Re-add these two regions
+ //Layout for the west region (Portlet Windows are laid out here)
+ FlowLayout westLayout = new FlowLayout();
+ westLayout.spacing = 5;
+ westLayout.margin = 5;
+
+ //Layout for the center region (Portlet Windows are laid out here)
+ FlowLayout centerLayout = new FlowLayout();
+ centerLayout.spacing = 5;
+ centerLayout.margin = 5;
+
+ //Setup the west region of the page
+ this.west = new WidgetContainer();
+ this.west.setScrollEnabled(true);
+ this.west.setLayout(westLayout);
+ float westSize = this.viewport.getOffsetWidth() * ((float)0.2);
+ BorderLayoutData westData = new BorderLayoutData(Style.WEST, westSize);
+ westData.resizeable = true;
+ this.viewport.add(this.west, westData);
+
+ //Setup the center region of the page
+ this.center = new WidgetContainer();
+ this.center.setScrollEnabled(true);
+ this.center.setLayout(centerLayout);
+ BorderLayoutData centerData = new BorderLayoutData(Style.CENTER);
+ centerData.resizeable = true;
+ this.viewport.add(this.center, centerData);
+ }
+
+ /**
+ *
+ * @param window
+ * @param newState
+ */
+ private void handleWindowStateChanged(String window, String newState)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.setState(window, newState, callback);
+ }
+
+ /**
+ *
+ * @param window
+ * @param newState
+ */
+ private void handleWindowModeChanged(String window, String newMode)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.setMode(window, newMode, callback);
+ }
+
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshLink(String url, Widget windowContent)
+ {
+ HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
+ }
+
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshForm(String url, String method, String postData, Widget windowContent)
+ {
+ if(method.equalsIgnoreCase("post"))
+ {
+ HTTPRequest.asyncPost(url, postData, new ResponseTextHandlerImpl(windowContent));
+ }
+ else if(method.equalsIgnoreCase("get"))
+ {
+ if(postData != null && postData.trim().length() > 0)
+ {
+ url = url + "?" + postData;
+ }
+ HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
+ }
+ }
+
+ /**
+ *
+ * @author soshah
+ *
+ */
+ private class ResponseTextHandlerImpl implements ResponseTextHandler
+ {
+ private Widget windowContent = null;
+
+ public ResponseTextHandlerImpl(Widget windowContent)
+ {
+ this.windowContent = windowContent;
+ }
+ public void onCompletion(String responseText)
+ {
+ HTML html = new HTML(responseText);
+ ContentPanel window = (ContentPanel)this.windowContent.getParent();
+ window.remove(this.windowContent);
+ window.add(html);
+ window.layout(true);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private boolean isPartialRefreshAllowed(String url)
+ {
+ String basePortalURL = GWT.getModuleBaseURL();
+ String portalContext = "org.jboss.portal.presentation.Portal"; //This is hard coded for now, but must be populated from the Portal deployment environment
+ //If Portal is installed at Root context, this value will be an empty string
+
+ if(url == null)
+ {
+ return false;
+ }
+
+ if(url.startsWith(basePortalURL))
+ {
+ //This is an Absolute URL, but it points back to
+ //the Portal
+ //An Async Page Refresh call should be allowed in this case
+ return true;
+ }
+
+ if(url.startsWith("http://"))
+ {
+ //This is an Absolute URL and does not point back
+ //to the Portal
+ //Async Page Refresh call should not be allowed
+ return false;
+ }
+ else
+ {
+ //This is a relative URL.
+
+ //Make sure it points back to the Portal for an Async Page Refresh
+ //If it points to some other resource like another third-party web application etc, the response
+ //has nothing to do with Portal
+ //(unless ofcourse the client side processor of the Portal, wants to
+ //take this response and aggregate this inside the current Portal Page and Window being displayed. This is an exceptional usecase
+ //and not desired behavior for every scenario from end user standpoint)
+ //As standard behavior, Async Page Refresh to be done, only when Portlet Markup is sending a request back to the Portal
+ if(url.startsWith("/"))
+ {
+ if(!portalContext.equals(""))
+ {
+ String urlContext = null;
+ int index = url.indexOf('/', 1);
+ if(index != -1)
+ {
+ urlContext = url.substring(1, index);
+ }
+ else
+ {
+ urlContext = url.substring(1);
+ }
+
+ if(!portalContext.equals(urlContext))
+ {
+ //This request is not being sent to the Portal. It is being sent to some other web application
+ return false;
+ }
+ }
+ else
+ {
+ //If Portal is running on root context, there is no way to tell from client side, if this request is actually
+ //to be sent to the Portal or some other web application. Hence, in the interest of functional safety/correctness
+ //no Async Page Refresh here
+ //If Portal is running on Root context, Partial Refresh will happen only for pure relative links
+ return false;
+ }
+ }
+
+ //If I get here, Async Page Refresh through the Portal should be allowed
+ return true;
+ }
+ }
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public native String serializeForm(Element currentForm)
+ /*-{
+ var formData = $wnd.Form.serialize(currentForm);
+ return formData;
+ }-*/;
+ //------------Page Navigation related logic-----------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private class TabListenerImpl implements TabListener
+ {
+ /**
+ *
+ */
+ public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex)
+ {
+ return true;
+ }
+
+ /**
+ *
+ */
+ public void onTabSelected(SourcesTabEvents sender, int tabIndex)
+ {
+ if(tabIndex == 0)
+ {
+ loadPartialRefreshPage("Page 1");
+ }
+ else if(tabIndex == 1)
+ {
+ loadPartialRefreshPage("Page 2");
+ }
+ else if(tabIndex == 2)
+ {
+ loadPartialRefreshPage("Page 3");
+ }
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/MyGWTPrototype.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/MyGWTPrototype.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/MyGWTPrototype.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,326 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.core.client.JavaScriptObject;
+
+import net.mygwt.ui.client.Style;
+import net.mygwt.ui.client.event.BaseEvent;
+import net.mygwt.ui.client.event.SelectionListener;
+import net.mygwt.ui.client.widget.Button;
+import net.mygwt.ui.client.widget.IconButton;
+import net.mygwt.ui.client.widget.ButtonBar;
+import net.mygwt.ui.client.widget.Info;
+import net.mygwt.ui.client.widget.ContentPanel;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MyGWTPrototype implements EntryPoint
+{
+ private static JavaScriptObject originalSubmitFunction = null;
+ private static JavaScriptObject overrideSubmitFunction = null;
+
+ /**
+ *
+ */
+ public void onModuleLoad()
+ {
+ VerticalPanel panel = new VerticalPanel();
+ RootPanel.get("currentPage").add(panel);
+
+ // Fillup panel with MyGWT widgets for testing
+ //this.createButtonWidget(panel);
+ //this.createPortletWindowWidget(panel);
+ this.loadTestHTML(panel);
+ }
+
+ /**
+ *
+ * @param container
+ */
+ private void createButtonWidget(VerticalPanel panel)
+ {
+ SelectionListener listener = new SelectionListener()
+ {
+ public void widgetSelected(BaseEvent be)
+ {
+ Button btn = (Button) be.widget;
+ Info.show("Click Event", "The '{0}' button was clicked.", btn
+ .getText());
+ }
+ };
+
+ ButtonBar buttonBar = new ButtonBar(Style.LEFT);
+ buttonBar.add(new Button("Click Me", listener));
+
+ Button iconBtn = new Button("Icon Button", listener);
+ iconBtn.setIconStyle("window-maximize-button");
+ buttonBar.add(iconBtn);
+
+ Button disabled = new Button("Disabled", listener);
+ disabled.setEnabled(false);
+ buttonBar.add(disabled);
+
+ panel.add(buttonBar);
+ }
+
+ /**
+ *
+ * @param panel
+ */
+ private void createPortletWindowWidget(VerticalPanel panel)
+ {
+ HTML html = new HTML("<div class=\"window-normal-button\">Normal</div><br/><div class=\"window-minimize-button\">Minimize</div><br/><div class=\"window-maximize-button\">Maximize</div>");
+
+ ContentPanel contentPanel = new ContentPanel(Style.HEADER);
+ contentPanel.addButton(new IconButton("my-tool-save"), null);
+ contentPanel.addButton(new IconButton("my-tool-help"), null);
+ contentPanel.addButton(new IconButton("my-tool-restore"), null);
+ contentPanel.addButton(new IconButton("my-tool-minimize"), null);
+ contentPanel.addButton(new IconButton("my-tool-maximize"), null);
+
+ Button normalButton = new Button("", null);
+ normalButton.setIconStyle("window-normal-button");
+
+ IconButton iconNormalButton = new IconButton("window-minimize-button");
+
+ contentPanel.add(html);
+ contentPanel.add(normalButton);
+ contentPanel.add(iconNormalButton);
+
+ panel.add(contentPanel);
+ }
+
+ /**
+ *
+ * @param panel
+ */
+ private void loadTestHTML(VerticalPanel panel)
+ {
+ this.originalSubmitFunction = this.getOriginalSubmitFunction();
+ this.overrideSubmitFunction = this.getOverRideSubmitFunction();
+ this.overwriteSubmit(this.overrideSubmitFunction);
+
+ this.startClickListener();
+
+ HTML html = new HTML("<div class='window-normal-button'>" +
+ "<form id='testform' method='post' action='http://www.google.com'>" +
+ "<input type=\"hidden\" name=\"j_id_jsp_1600481012_9\" value=\"j_id_jsp_1600481012_9\" />" +
+ "<input type='Button' value='Hello World' onclick='document.getElementById(\"testform\").submit();'>" +
+ "<br/>" +
+ "<span><a href='#' onclick='document.getElementById(\"testform\").submit();' class='portlet-font'>Test Command Link</a></span>" +
+ "<br/>" +
+ "<a href='http://www.google.com' class='portlet-font'><span>Test Plain Link</span></a>" +
+ "<br/>" +
+ "<input type='submit'>" +
+ "</form>" +
+ "</div>");
+
+ ContentPanel contentPanel = new ContentPanel(Style.HEADER);
+ contentPanel.add(html);
+ contentPanel.setSize(200, 200);
+
+ //html.addClickListener(new ContentListener());
+
+ panel.add(contentPanel);
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public static native JavaScriptObject getOriginalSubmitFunction()
+ /*-{
+ return $wnd.HTMLFormElement.prototype.submit;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public static native JavaScriptObject getOverRideSubmitFunction()
+ /*-{
+ function overrideSubmit(event)
+ {
+ var target = null;
+ if(event != null)
+ {
+ target = event.target;
+ @org.jboss.portal.presentation.ajax.client.MyGWTPrototype::submitCallback(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;)(event,target);
+ }
+ else
+ {
+ target = this;
+ @org.jboss.portal.presentation.ajax.client.MyGWTPrototype::submitCallback(Lcom/google/gwt/user/client/Element;)(target);
+ }
+ }
+ return overrideSubmit;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public static native void overwriteSubmit(JavaScriptObject overrideSubmitFunction)
+ /*-{
+ $wnd.addEventListener('submit', overrideSubmitFunction, true);
+ $wnd.HTMLFormElement.prototype.submit = overrideSubmitFunction;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public static native void forceSubmit(JavaScriptObject originalSubmitFunction, JavaScriptObject overrideSubmitFunction, JavaScriptObject form)
+ /*-{
+ $wnd.HTMLFormElement.prototype.submit = originalSubmitFunction;
+ form.submit();
+ $wnd.HTMLFormElement.prototype.submit = overrideSubmitFunction;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public static native String serializeForm(Element currentForm)
+ /*-{
+ var formData = $wnd.Form.serialize(currentForm);
+ return formData;
+ }-*/;
+
+ /**
+ *
+ *
+ */
+ public static void submitCallback(Event event, Element currentForm)
+ {
+ String action = DOM.getElementAttribute(currentForm, "action");
+ String method = DOM.getElementAttribute(currentForm, "method");
+ String enctype = DOM.getElementAttribute(currentForm, "enctype");
+ String serializedForm = serializeForm(currentForm);
+
+ /*System.out.println("---------------------------------------------");
+ System.out.println(event);
+ System.out.println(action);
+ System.out.println(method);
+ System.out.println(enctype);
+ System.out.println(serializedForm);*/
+
+ DOM.eventPreventDefault(event);
+
+ //Force a submit
+ forceSubmit(originalSubmitFunction, overrideSubmitFunction, currentForm);
+ }
+
+ /**
+ *
+ *
+ */
+ public static void submitCallback(Element currentForm)
+ {
+ String action = DOM.getElementAttribute(currentForm, "action");
+ String method = DOM.getElementAttribute(currentForm, "method");
+ String enctype = DOM.getElementAttribute(currentForm, "enctype");
+ String serializedForm = serializeForm(currentForm);
+
+ /*System.out.println("---------------------------------------------");
+ System.out.println(action);
+ System.out.println(method);
+ System.out.println(enctype);
+ System.out.println(serializedForm);*/
+
+ //Force a submit
+ forceSubmit(originalSubmitFunction, overrideSubmitFunction, currentForm);
+ }
+ //--------Testing Anchor click listener----------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public static native void startClickListener()
+ /*-{
+ function listenClick(event)
+ {
+ if(event != null)
+ {
+ @org.jboss.portal.presentation.ajax.client.MyGWTPrototype::clickCallback(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;)(event,event.target);
+ }
+ else
+ {
+ @org.jboss.portal.presentation.ajax.client.MyGWTPrototype::clickCallback(Lcom/google/gwt/user/client/Element;)(this);
+ }
+ }
+ $wnd.addEventListener('click', listenClick, true);
+ }-*/;
+
+ /**
+ *
+ * @param target
+ */
+ public static void clickCallback(Event event, Element target)
+ {
+ if(target.toString().toUpperCase().trim().indexOf("</A>") != -1 && DOM.getElementAttribute(target, "ONCLICK") == null)
+ {
+ DOM.eventPreventDefault(event);
+ System.out.println(target);
+ }
+ }
+
+ public static void clickCallback(Element target)
+ {
+ if(target.toString().toUpperCase().trim().indexOf("</A>") != -1 && DOM.getElementAttribute(target, "ONCLICK") == null)
+ {
+ System.out.println(target);
+ }
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ /*private class ContentListener implements ClickListener
+ {
+ public void onClick(Widget sender)
+ {
+ Event event = DOM.eventGetCurrentEvent();
+ Element target = DOM.eventGetTarget(event);
+ System.out.println(target);
+ }
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PartialRefresh.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PartialRefresh.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PartialRefresh.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,410 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.EntryPoint;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.HTTPRequest;
+import com.google.gwt.user.client.ResponseTextHandler;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Panel;
+
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import org.jboss.portal.presentation.ajax.client.model.Page;
+import org.jboss.portal.presentation.ajax.client.model.Window;
+
+/**
+ * Used for Prototyping Partial Refresh feature
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PartialRefresh implements EntryPoint
+{
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad()
+ {
+ //Proof of Concept for Portlet Partial Refresh feature
+ this.testPartialRefresh();
+ }
+
+ /**
+ *
+ *
+ */
+ private void testPartialRefresh()
+ {
+ VerticalPanel page = new VerticalPanel();
+ RootPanel.get("page").add(page);
+
+ this.loadPartialRefreshPage();
+ }
+
+ /**
+ *
+ *
+ */
+ private void loadPartialRefreshPage()
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.getPage("index", callback);
+ }
+
+ /**
+ *
+ * @param window
+ * @param newState
+ */
+ private void handleWindowStateChanged(String window, String newState)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.setState(window, newState, callback);
+ }
+
+ /**
+ *
+ * @param window
+ * @param newState
+ */
+ private void handleWindowModeChanged(String window, String newMode)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ Page portalPage = (Page)result;
+ displayPortalPage(portalPage);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.setMode(window, newMode, callback);
+ }
+
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshLink(String url, Widget windowContent)
+ {
+ HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
+ }
+
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshForm(String url, String method, String postData, Widget windowContent)
+ {
+ if(method.equalsIgnoreCase("post"))
+ {
+ HTTPRequest.asyncPost(url, postData, new ResponseTextHandlerImpl(windowContent));
+ }
+ else if(method.equalsIgnoreCase("get"))
+ {
+ if(postData != null && postData.trim().length() > 0)
+ {
+ url = url + "?" + postData;
+ }
+ HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
+ }
+ }
+
+ /**
+ *
+ * @author soshah
+ *
+ */
+ private static class ResponseTextHandlerImpl implements ResponseTextHandler
+ {
+ private Widget windowContent = null;
+
+ public ResponseTextHandlerImpl(Widget windowContent)
+ {
+ this.windowContent = windowContent;
+ }
+ public void onCompletion(String responseText)
+ {
+ HTML html = new HTML(responseText);
+ Panel window = (Panel)this.windowContent.getParent();
+ this.windowContent.removeFromParent();
+ window.add(html);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private boolean isPartialRefreshAllowed(String url)
+ {
+ String basePortalURL = GWT.getModuleBaseURL();
+ String portalContext = "org.jboss.portal.presentation.Portal"; //This is hard coded for now, but must be populated from the Portal deployment environment
+ //If Portal is installed at Root context, this value will be an empty string
+
+ if(url.startsWith(basePortalURL))
+ {
+ //This is an Absolute URL, but it points back to
+ //the Portal
+ //An Async Page Refresh call should be allowed in this case
+ return true;
+ }
+
+ if(url.startsWith("http://"))
+ {
+ //This is an Absolute URL and does not point back
+ //to the Portal
+ //Async Page Refresh call should not be allowed
+ return false;
+ }
+ else
+ {
+ //This is a relative URL.
+
+ //Make sure it points back to the Portal for an Async Page Refresh
+ //If it points to some other resource like another third-party web application etc, the response
+ //has nothing to do with Portal
+ //(unless ofcourse the client side processor of the Portal, wants to
+ //take this response and aggregate this inside the current Portal Page and Window being displayed. This is an exceptional usecase
+ //and not desired behavior for every scenario from end user standpoint)
+ //As standard behavior, Async Page Refresh to be done, only when Portlet Markup is sending a request back to the Portal
+ if(url.startsWith("/"))
+ {
+ if(!portalContext.equals(""))
+ {
+ String urlContext = null;
+ int index = url.indexOf('/', 1);
+ if(index != -1)
+ {
+ urlContext = url.substring(1, index);
+ }
+ else
+ {
+ urlContext = url.substring(1);
+ }
+
+ if(!portalContext.equals(urlContext))
+ {
+ //This request is not being sent to the Portal. It is being sent to some other web application
+ return false;
+ }
+ }
+ else
+ {
+ //If Portal is running on root context, there is no way to tell from client side, if this request is actually
+ //to be sent to the Portal or some other web application. Hence, in the interest of functional safety/correctness
+ //no Async Page Refresh here
+ //If Portal is running on Root context, Partial Refresh will happen only for pure relative links
+ return false;
+ }
+ }
+
+ //If I get here, Async Page Refresh through the Portal should be allowed
+ return true;
+ }
+ }
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public native String serializeForm(Element currentForm)
+ /*-{
+ var formData = $wnd.Form.serialize(currentForm);
+ return formData;
+ }-*/;
+
+ /**
+ *
+ * @param portalPage
+ */
+ private void displayPortalPage(Page portalPage)
+ {
+ //Event Listener for the decoration components like
+ //Normal, Maximized, Minimized
+ ClickListener listener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Button cour = (Button)sender;
+ String windowName = sender.getParent().getTitle();
+ if(cour.getText().equals("Normal"))
+ {
+ handleWindowStateChanged(windowName, Window.NORMAL);
+ }
+ else if(cour.getText().equals("Minimized"))
+ {
+ handleWindowStateChanged(windowName, Window.MINIMIZED);
+ }
+ else if(cour.getText().equals("Maximized"))
+ {
+ handleWindowStateChanged(windowName, Window.MAXIMIZED);
+ }
+ else if(cour.getText().equals("Edit"))
+ {
+ handleWindowModeChanged(windowName, Window.EDIT);
+ }
+ }
+ };
+
+ //Event Listener for actions perfomed inside the portlet window content
+ //itself.
+ ClickListener contentListener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Event event = DOM.eventGetCurrentEvent();
+ Element target = DOM.eventGetTarget(event);
+
+ if(target.toString().toUpperCase().trim().indexOf("</A>") != -1)
+ {
+ String link = DOM.getElementAttribute(target, "HREF");
+
+ //A link inside the portlet window was clicked
+ //Load its content asynchronously inside this window
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(link);
+ if(isPartialRefreshAllowed)
+ {
+ DOM.eventPreventDefault(event);
+ handlePartialRefreshLink(link, sender);
+ }
+ }
+ else if(target.toString().toUpperCase().trim().indexOf("INPUT") != -1 &&
+ target.toString().toUpperCase().trim().indexOf("SUBMIT") != -1
+ )
+ {
+ Element currentForm = DOM.getParent(target);
+ String enctype = DOM.getElementAttribute(currentForm, "enctype");
+ String action = DOM.getElementAttribute(currentForm, "action");
+ boolean isPartialRefreshAllowed = isPartialRefreshAllowed(action);
+ if((isPartialRefreshAllowed) && (enctype == null || !enctype.equals("multipart/form-data")))
+ {
+ DOM.eventPreventDefault(event);
+
+ //Call a native javascript function here
+ String method = DOM.getElementAttribute(currentForm, "method");
+ String serializedForm = serializeForm(currentForm);
+
+ handlePartialRefreshForm(action, method, serializedForm, sender);
+ }
+ }
+ }
+ };
+
+ //Dispalying the fully aggregated page
+ Window[] windows = portalPage.getWindows();
+ VerticalPanel page = (VerticalPanel)RootPanel.get("page").getWidget(0);
+ page.clear();
+ for(int i=0; i<windows.length; i++)
+ {
+ Window pageWindow = windows[i];
+ if(pageWindow.isVisible())
+ {
+ VerticalPanel window = new VerticalPanel();
+
+ //Create the decoration panel
+ HorizontalPanel decoration = new HorizontalPanel();
+ decoration.setTitle(pageWindow.getName());
+
+ Button normal = new Button("Normal");
+ Button minimized = new Button("Minimized");
+ Button maximized = new Button("Maximized");
+ Button edit = new Button("Edit");
+
+ decoration.add(normal);
+ decoration.add(minimized);
+ decoration.add(maximized);
+ decoration.add(edit);
+ window.add(decoration);
+
+ //Create the actual content of the portlet to be displayed inside the window
+ HTML windowContent = new HTML(pageWindow.getContent());
+ window.add(windowContent);
+
+ //Event listeners for this Window
+ normal.addClickListener(listener);
+ minimized.addClickListener(listener);
+ maximized.addClickListener(listener);
+ edit.addClickListener(listener);
+ windowContent.addClickListener(contentListener);
+
+ //Add this window to the Page
+ page.add(window);
+ }
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Portal.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Portal.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Portal.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.ajax.client;
+
+import com.google.gwt.core.client.EntryPoint;
+
+import org.jboss.portal.presentation.ajax.client.protocol.Caller;
+import org.jboss.portal.presentation.ajax.client.protocol.AjaxViewUIObjectAction;
+import org.jboss.portal.presentation.ajax.client.listener.SubmitListener;
+import org.jboss.portal.presentation.ajax.client.listener.AnchorListener;
+
+/**
+ * This is the Entry Point of the client-side Ajax agent of the Presentation Framework
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Portal implements EntryPoint, Caller
+{
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad()
+ {
+ //Load the default page of the default portal upon loading the user agent
+ AjaxViewUIObjectAction action = new AjaxViewUIObjectAction("/default/default");
+ action.execute(this);
+
+ Session.getInstance().setSubmitListener(new SubmitListener());
+ Session.getInstance().setAnchorListener(new AnchorListener());
+ }
+
+ /**
+ *
+ */
+ public void callback(Object result)
+ {
+ Util.displayPortalPage();
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortalLayout.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortalLayout.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortalLayout.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,181 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.EntryPoint;
+
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Widget;
+
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * Prototyping some client side layout concepts
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortalLayout implements EntryPoint
+{
+ private String leftContent = "<div><table border=\"1\"><tr><td><b>Left Content</b></td></tr></table></div>";
+ private String centerContent = "<div><table border=\"1\"><tr><td><b>Center Content</b></td></tr></table></div>";
+ private String rightContent = "<div><table border=\"1\"><tr><td><b>Right Content</b></td></tr></table></div>";
+
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad()
+ {
+ //Lets do a Proof of Concept of Layout capabilities that can be obtained using GWT
+ this.testLayout();
+ }
+
+
+
+ /**
+ *
+ */
+ private void testLayout()
+ {
+ this.performVerticalColumnLayout();
+ this.performFlexibleGridLayout();
+ this.createPortletButtons();
+ }
+
+
+ /**
+ *
+ *
+ */
+ private void performVerticalColumnLayout()
+ {
+ VerticalPanel leftPanel = new VerticalPanel();
+ leftPanel.add(new HTMLPanel(leftContent));
+ leftPanel.add(new HTMLPanel(leftContent));
+
+ VerticalPanel centerPanel = new VerticalPanel();
+ centerPanel.add(new HTMLPanel(centerContent));
+
+ VerticalPanel rightPanel = new VerticalPanel();
+ rightPanel.add(new HTMLPanel(rightContent));
+
+ RootPanel.get("leftPanel").add(leftPanel);
+ RootPanel.get("centerPanel").add(centerPanel);
+ RootPanel.get("rightPanel").add(rightPanel);
+ }
+
+ /**
+ *
+ *
+ */
+ private void performFlexibleGridLayout()
+ {
+ FlexTable flexTable = new FlexTable();
+
+ flexTable.setWidget(0, 0, new HTMLPanel(leftContent));
+ flexTable.setWidget(0, 1, new HTMLPanel(leftContent));
+ flexTable.setWidget(1, 0, new HTMLPanel(leftContent));
+ flexTable.setWidget(1, 1, new HTMLPanel(rightContent));
+
+ RootPanel.get("flexGrid").add(flexTable);
+ }
+
+ /**
+ *
+ *
+ */
+ private void createPortletButtons()
+ {
+ Button cmsPortletButton = new Button("cmsPortlet");
+ Button jspPortletButton = new Button("jspPortlet");
+ Button weatherPortletButton = new Button("weatherPortlet");
+
+ ClickListener listener = new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ Button button = (Button)sender;
+ if (button.getText().equals("cmsPortlet"))
+ {
+ refreshFlexibleGrid("cmsPortlet.html");
+ }
+ else if (button.getText().equals("jspPortlet"))
+ {
+ refreshFlexibleGrid("jspPortlet.html");
+ }
+ else if (button.getText().equals("weatherPortlet"))
+ {
+ refreshFlexibleGrid("weatherPortlet.html");
+ }
+ }
+ };
+
+ cmsPortletButton.addClickListener(listener);
+ jspPortletButton.addClickListener(listener);
+ weatherPortletButton.addClickListener(listener);
+
+
+ RootPanel.get("cmsPortlet").add(cmsPortletButton);
+ RootPanel.get("jspPortlet").add(jspPortletButton);
+ RootPanel.get("weatherPortlet").add(weatherPortletButton);
+ }
+
+ /**
+ *
+ *
+ */
+ private void refreshFlexibleGrid(String portletId)
+ {
+ PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
+
+ ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portletService");
+
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ String portletContent = (String)result;
+
+ FlexTable flexTable = new FlexTable();
+ flexTable.setWidget(0, 0, new HTMLPanel(portletContent));
+ flexTable.setWidget(1, 1, new HTMLPanel(portletContent));
+
+ RootPanel.get("flexGrid").clear();
+ RootPanel.get("flexGrid").add(flexTable);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ }
+ };
+
+ portletService.getPortlet(portletId, callback);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletService.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletService.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletService.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.jboss.portal.presentation.ajax.client.model.Page;
+
+/**
+ * A Protototype RPC service
+ *
+ * @author soshah
+ *
+ */
+public interface PortletService extends RemoteService
+{
+ /**
+ *
+ * @param portletId
+ * @return
+ */
+ public String getPortlet(String portletId);
+
+ /**
+ *
+ * @param pageId
+ * @return
+ */
+ public Page getPage(String pageId);
+
+ /**
+ *
+ * @param window
+ * @param state
+ * @return
+ */
+ public Page setState(String window, String newState);
+
+ /**
+ *
+ * @param window
+ * @param newMode
+ * @return
+ */
+ public Page setMode(String window, String newMode);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletServiceAsync.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletServiceAsync.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletServiceAsync.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * A Prototype RPC Service
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface PortletServiceAsync
+{
+ /**
+ *
+ * @param portletId
+ * @return
+ */
+ public void getPortlet(String portletId, AsyncCallback callback);
+
+ /**
+ *
+ * @param pageId
+ * @param callback
+ */
+ public void getPage(String pageId, AsyncCallback callback);
+
+ /**
+ *
+ * @param window
+ * @param callback
+ */
+ public void setState(String window, String newState, AsyncCallback callback);
+
+ /**
+ *
+ * @param window
+ * @param newMode
+ * @return
+ */
+ public void setMode(String window, String newMode, AsyncCallback callback);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletWindowPanel.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletWindowPanel.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/PortletWindowPanel.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import com.google.gwt.user.client.ui.HTMLPanel;
+import com.google.gwt.user.client.Event;
+
+public class PortletWindowPanel extends HTMLPanel
+{
+ /**
+ *
+ * @param html
+ */
+ public PortletWindowPanel(String html)
+ {
+ super(html);
+ }
+
+ public void onBrowserEvent(Event event)
+ {
+ super.onBrowserEvent(event);
+
+ System.out.println("-------------------------------");
+ System.out.println(event);
+ System.out.println("-------------------------------");
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Session.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Session.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Session.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,175 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIContext;
+import org.jboss.portal.presentation.ajax.client.listener.SubmitListener;
+import org.jboss.portal.presentation.ajax.client.listener.AnchorListener;
+
+/**
+ * This is the client side Session. This is a singleton since there should only be one session for each client
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Session
+{
+ /**
+ *
+ */
+ private static Session singleton = null;
+
+ /**
+ * dataKeys
+ */
+ public static final String display = "display";
+
+ /**
+ *
+ */
+ private AjaxUIContext uiContext = null;
+
+ /**
+ *
+ */
+ private SubmitListener submitListener = null;
+
+ /**
+ *
+ */
+ private AnchorListener anchorListener = null;
+
+ /**
+ * @gwt.typeArgs <java.lang.String, java.lang.Object>
+ */
+ private Map attributes = null;
+
+ /**
+ *
+ *
+ */
+ private Session()
+ {
+ this.uiContext = new AjaxUIContext();
+ this.attributes = new HashMap();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static Session getInstance()
+ {
+ if(Session.singleton == null)
+ {
+ Session.singleton = new Session();
+ }
+ return Session.singleton;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public AjaxUIContext getUiContext()
+ {
+ return this.uiContext;
+ }
+
+ /**
+ *
+ * @param uiContext
+ */
+ public void setUiContext(AjaxUIContext uiContext)
+ {
+ this.uiContext = uiContext;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public SubmitListener getSubmitListener()
+ {
+ return submitListener;
+ }
+
+ /**
+ *
+ * @param progSubmitListener
+ */
+ public void setSubmitListener(SubmitListener submitListener)
+ {
+ this.submitListener = submitListener;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public AnchorListener getAnchorListener()
+ {
+ return anchorListener;
+ }
+
+ /**
+ *
+ * @param anchorListener
+ */
+ public void setAnchorListener(AnchorListener anchorListener)
+ {
+ this.anchorListener = anchorListener;
+ }
+
+ /**
+ *
+ * @param attributeKey
+ * @param value
+ */
+ public void setAttribute(String attributeKey, Object value)
+ {
+ this.attributes.put(attributeKey, value);
+ }
+
+ /**
+ *
+ * @param attributeKey
+ * @return
+ */
+ public Object getAttribute(String attributeKey)
+ {
+ return this.attributes.get(attributeKey);
+ }
+
+ /**
+ *
+ * @param attributeKey
+ */
+ public void removeAttribute(String attributeKey)
+ {
+ this.attributes.remove(attributeKey);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Util.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Util.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/Util.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,112 @@
+/******************************************************************************
+ * 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.ajax.client;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.portal.presentation.ajax.client.layout.LayoutManager;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIWindow;
+import org.jboss.portal.presentation.ajax.client.widget.PortletWindow;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Util
+{
+ /**
+ *
+ * @param portalPage
+ */
+ public static void displayPortalPage()
+ {
+ String portalPage = (String)Session.getInstance().getAttribute(Session.display);
+ Util.displayPortalPage(portalPage);
+ }
+
+ /**
+ *
+ * @param pageId
+ */
+ public static void displayPortalPage(String pageId)
+ {
+ AjaxUIPage portalPage = (AjaxUIPage)Session.getInstance().getUiContext().getObject(pageId);
+
+ //Dispalying the fully aggregated page
+ List windows = portalPage.getChildren();
+ if(windows != null)
+ {
+ List displayWindows = new ArrayList();
+ AjaxUIWindow maximizedWindow = Util.getMaximizedWindow(portalPage);
+
+ if(maximizedWindow == null)
+ {
+ for(int i=0; i<windows.size(); i++)
+ {
+ AjaxUIWindow pageWindow = (AjaxUIWindow)windows.get(i);
+ if(pageWindow.isVisible())
+ {
+ PortletWindow portletWindow = new PortletWindow(pageWindow);
+ displayWindows.add(portletWindow);
+ }
+ }
+ }
+ else
+ {
+ PortletWindow portletWindow = new PortletWindow(maximizedWindow);
+ displayWindows.add(portletWindow);
+ }
+
+ //layout the page and its corresponding windows
+ LayoutManager.doLayout(displayWindows);
+ }
+ }
+
+ /**
+ *
+ * @param portalPage
+ * @return
+ */
+ private static AjaxUIWindow getMaximizedWindow(AjaxUIPage portalPage)
+ {
+ AjaxUIWindow maximizedWindow = null;
+
+ List windows = portalPage.getChildren();
+ if(windows != null)
+ {
+ for(int i=0; i<windows.size(); i++)
+ {
+ AjaxUIWindow pageWindow = (AjaxUIWindow)windows.get(i);
+ if(pageWindow.getState().equals(AjaxUIWindow.MAXIMIZE))
+ {
+ maximizedWindow = pageWindow;
+ break;
+ }
+ }
+ }
+
+ return maximizedWindow;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/layout/LayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/layout/LayoutManager.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/layout/LayoutManager.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,339 @@
+/******************************************************************************
+ * 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.ajax.client.layout;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.ArrayList;
+
+import com.google.gwt.user.client.ui.Widget;
+import net.mygwt.ui.client.widget.ContentPanel;
+
+import net.mygwt.ui.client.widget.Viewport;
+import net.mygwt.ui.client.widget.WidgetContainer;
+import net.mygwt.ui.client.widget.layout.BorderLayout;
+import net.mygwt.ui.client.widget.layout.BorderLayoutData;
+import net.mygwt.ui.client.widget.layout.FlowLayout;
+import net.mygwt.ui.client.Style;
+
+import org.jboss.portal.presentation.ajax.client.widget.PortletWindow;
+
+/**
+ * This layout manager provides a Flexible Grid for laying out the UI components (which would be Portlet Windows)
+ * inside a flexible coordinates based Grid
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class LayoutManager
+{
+ /**
+ *
+ */
+ private static Viewport viewport = null;
+
+ /**
+ *
+ */
+ private static WidgetContainer north = null;
+
+ /**
+ *
+ */
+ private static WidgetContainer west = null;
+
+ /**
+ *
+ */
+ private static WidgetContainer center = null;
+
+ /**
+ *
+ */
+ private static Map pageCache = null;
+
+
+ /**
+ *
+ */
+ static
+ {
+ LayoutManager.viewport = new Viewport();
+
+ //Layout for the viewport
+ BorderLayout pageLayout = new BorderLayout();
+
+ //Layout for the north region (Header/Navigation related content produced by the portal are laid out here)
+ FlowLayout northLayout = new FlowLayout();
+
+ //Setup the layout of the root container of the page
+ LayoutManager.viewport.setLayout(pageLayout);
+
+ //Setup the north region of the page
+ LayoutManager.north = new WidgetContainer();
+ LayoutManager.north.setLayout(northLayout);
+ float northSize = LayoutManager.viewport.getOffsetHeight() * ((float)0.05);
+ BorderLayoutData northData = new BorderLayoutData(Style.NORTH, northSize);
+ northData.resizeable = true;
+ LayoutManager.viewport.add(LayoutManager.north, northData);
+
+ pageCache = new HashMap();
+ }
+
+ /**
+ *
+ * @param displayWindows
+ */
+ public static void doLayout(List displayWindows)
+ {
+ LayoutManager.setUpPortletRegions();
+
+ int column = 0;
+ List westList = new ArrayList();
+ List centerList = new ArrayList();
+ LayoutManager.pageCache.put("west", westList);
+ LayoutManager.pageCache.put("center", centerList);
+ for(int i=0; i<displayWindows.size(); i++)
+ {
+ PortletWindow portletWindow = (PortletWindow)displayWindows.get(i);
+ Widget window = portletWindow.create();
+
+ //Add this window to the Page
+ if(column == 0 && displayWindows.size()>1)
+ {
+ LayoutManager.west.add(window);
+ westList.add(portletWindow);
+ column ++;
+ }
+ else
+ {
+ LayoutManager.center.add(window);
+ centerList.add(portletWindow);
+ column = 0;
+ }
+ }
+ LayoutManager.viewport.layout(true);
+ }
+
+ /**
+ *
+ * @param widgetId
+ */
+ public static void maximize(String widgetId)
+ {
+ //Find the widget to be maximized
+ PortletWindow window = LayoutManager.findWindow(widgetId);
+
+ if(window != null)
+ {
+ //clear the layout grid
+ LayoutManager.setUpMaximizePortletRegions();
+
+ //Make this the only widget being displayed and *hide* the others
+ LayoutManager.center.add(window.create());
+
+ //refresh the layout
+ LayoutManager.viewport.layout(true);
+ }
+ }
+
+ /**
+ *
+ * @param widgetId
+ */
+ public static void minimize(String widgetId)
+ {
+ LayoutManager.normal(widgetId);
+ }
+
+ /**
+ *
+ * @param widgetId
+ */
+ public static void normal(String widgetId)
+ {
+ LayoutManager.setUpPortletRegions();
+
+ //restore west region
+ for(Iterator itr=((ArrayList)LayoutManager.pageCache.get("west")).iterator();itr.hasNext();)
+ {
+ PortletWindow window = (PortletWindow)itr.next();
+ LayoutManager.west.add(window.create());
+ }
+
+ //restore center region
+ for(Iterator itr=((ArrayList)LayoutManager.pageCache.get("center")).iterator();itr.hasNext();)
+ {
+ PortletWindow window = (PortletWindow)itr.next();
+ LayoutManager.center.add(window.create());
+ }
+
+ LayoutManager.viewport.layout(true);
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private static Widget find(String widgetId)
+ {
+ Widget widget = null;
+
+ //try to find it in the west region
+ for(int i=0; i<LayoutManager.west.getWidgetCount(); i++)
+ {
+ ContentPanel cour = (ContentPanel)LayoutManager.west.getWidget(i);
+ if(cour.getId().equals(widgetId))
+ {
+ widget = cour;
+ return widget;
+ }
+ }
+
+ //next try to find it in the center region
+ for(int i=0; i<LayoutManager.center.getWidgetCount(); i++)
+ {
+ ContentPanel cour = (ContentPanel)LayoutManager.center.getWidget(i);
+ if(cour.getId().equals(widgetId))
+ {
+ widget = cour;
+ return widget;
+ }
+ }
+
+ return widget;
+ }
+
+ private static PortletWindow findWindow(String windowId)
+ {
+ PortletWindow window = null;
+
+ List allWindows = new ArrayList();
+
+ List westWindows = (List)LayoutManager.pageCache.get("west");
+ if(westWindows != null)
+ {
+ allWindows.addAll(westWindows);
+ }
+
+ List centerWindows = (List)LayoutManager.pageCache.get("center");
+ if(centerWindows != null)
+ {
+ allWindows.addAll(centerWindows);
+ }
+
+ for(int i=0; i<allWindows.size(); i++)
+ {
+ PortletWindow cour = (PortletWindow)allWindows.get(i);
+
+ if(cour.getName().equals(windowId))
+ {
+ window = cour;
+ break;
+ }
+ }
+
+ return window;
+ }
+
+
+ /**
+ *
+ *
+ */
+ private static void setUpPortletRegions()
+ {
+ if(LayoutManager.west != null)
+ {
+ LayoutManager.west.clear();
+ LayoutManager.viewport.remove(LayoutManager.west);
+ }
+ if(LayoutManager.center != null)
+ {
+ LayoutManager.center.clear();
+ LayoutManager.viewport.remove(LayoutManager.center);
+ }
+
+ //Re-add these two regions
+ //Layout for the west region (Portlet Windows are laid out here)
+ FlowLayout westLayout = new FlowLayout();
+ westLayout.spacing = 5;
+ westLayout.margin = 5;
+
+ //Layout for the center region (Portlet Windows are laid out here)
+ FlowLayout centerLayout = new FlowLayout();
+ centerLayout.spacing = 5;
+ centerLayout.margin = 5;
+
+ //Setup the west region of the page
+ LayoutManager.west = new WidgetContainer();
+ LayoutManager.west.setScrollEnabled(true);
+ LayoutManager.west.setLayout(westLayout);
+ float westSize = LayoutManager.viewport.getOffsetWidth() * ((float)0.2);
+ BorderLayoutData westData = new BorderLayoutData(Style.WEST, westSize);
+ westData.resizeable = true;
+ LayoutManager.viewport.add(LayoutManager.west, westData);
+
+ //Setup the center region of the page
+ LayoutManager.center = new WidgetContainer();
+ LayoutManager.center.setScrollEnabled(true);
+ LayoutManager.center.setLayout(centerLayout);
+ BorderLayoutData centerData = new BorderLayoutData(Style.CENTER);
+ centerData.resizeable = true;
+ LayoutManager.viewport.add(LayoutManager.center, centerData);
+ }
+
+ /**
+ *
+ *
+ */
+ private static void setUpMaximizePortletRegions()
+ {
+ if(LayoutManager.west != null)
+ {
+ LayoutManager.west.clear();
+ LayoutManager.viewport.remove(LayoutManager.west);
+ }
+ if(LayoutManager.center != null)
+ {
+ LayoutManager.center.clear();
+ LayoutManager.viewport.remove(LayoutManager.center);
+ }
+
+ //Re-add these two regions
+ //Layout for the center region (Portlet Windows are laid out here)
+ FlowLayout centerLayout = new FlowLayout();
+ centerLayout.spacing = 5;
+ centerLayout.margin = 5;
+
+
+ //Setup the center region of the page
+ LayoutManager.center = new WidgetContainer();
+ LayoutManager.center.setScrollEnabled(true);
+ LayoutManager.center.setLayout(centerLayout);
+ BorderLayoutData centerData = new BorderLayoutData(Style.CENTER);
+ centerData.resizeable = true;
+ LayoutManager.viewport.add(LayoutManager.center, centerData);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/AnchorListener.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/AnchorListener.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/AnchorListener.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * 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.ajax.client.listener;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+
+import org.jboss.portal.presentation.ajax.client.Util;
+import org.jboss.portal.presentation.ajax.client.protocol.AsyncGetAction;
+import org.jboss.portal.presentation.ajax.client.protocol.Caller;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AnchorListener implements Caller, ClickListener
+{
+ /**
+ *
+ * @param callback
+ */
+ public AnchorListener()
+ {
+ }
+ //-------ClickListener impl------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public void onClick(Widget sender)
+ {
+ Event event = DOM.eventGetCurrentEvent();
+ Element target = DOM.eventGetTarget(event);
+
+ //Process normal click
+ if(target.toString().toUpperCase().trim().indexOf("</A>") != -1 && DOM.getElementAttribute(target, "ONCLICK") == null)
+ {
+ String link = DOM.getElementAttribute(target, "HREF");
+
+ //A link inside the portlet window was clicked
+ //Load its content asynchronously inside this window
+ boolean isPartialRefreshAllowed = ListenerUtil.isPartialRefreshAllowed(link.trim());
+ if(isPartialRefreshAllowed)
+ {
+ DOM.eventPreventDefault(event);
+ handlePartialRefreshLink(link.trim());
+ }
+ }
+ }
+ //------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshLink(String url)
+ {
+ AsyncGetAction action = new AsyncGetAction(url);
+ action.execute(this);
+ }
+ //----Caller impl---------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public void callback(Object result)
+ {
+ Util.displayPortalPage();
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/ListenerUtil.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/ListenerUtil.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/ListenerUtil.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,115 @@
+/******************************************************************************
+ * 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.ajax.client.listener;
+
+import com.google.gwt.core.client.GWT;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ListenerUtil
+{
+ /**
+ *
+ * @param url
+ * @return
+ */
+ public static boolean isPartialRefreshAllowed(String url)
+ {
+ String basePortalURL = GWT.getModuleBaseURL();
+
+ /**
+ * TODO: This is hard coded for now, but must be populated from the Portal deployment environment
+ * If Portal is installed at Root context, this value will be an empty string
+ */
+ String portalContext = "presentation";
+
+ //Make sure this is not just an anchor link with real submission in the onclick event
+ if(url.length() == 0 || url.startsWith("#"))
+ {
+ return false;
+ }
+
+ if(url.startsWith(basePortalURL))
+ {
+ //This is an Absolute URL, but it points back to
+ //the Portal
+ //An Async Page Refresh call should be allowed in this case
+ return true;
+ }
+
+ if(url.startsWith("http://"))
+ {
+ //This is an Absolute URL and does not point back
+ //to the Portal
+ //Async Page Refresh call should not be allowed
+ return false;
+ }
+ else
+ {
+ //This is a relative URL.
+
+ //Make sure it points back to the Portal for an Async Page Refresh
+ //If it points to some other resource like another third-party web application etc, the response
+ //has nothing to do with Portal
+ //(unless ofcourse the client side processor of the Portal, wants to
+ //take this response and aggregate this inside the current Portal Page and Window being displayed. This is an exceptional usecase
+ //and not desired behavior for every scenario from end user standpoint)
+ //As standard behavior, Async Page Refresh to be done, only when Portlet Markup is sending a request back to the Portal
+ if(url.startsWith("/"))
+ {
+ if(!portalContext.equals(""))
+ {
+ String urlContext = null;
+ int index = url.indexOf('/', 1);
+ if(index != -1)
+ {
+ urlContext = url.substring(1, index);
+ }
+ else
+ {
+ urlContext = url.substring(1);
+ }
+
+ if(!portalContext.equals(urlContext))
+ {
+ //This request is not being sent to the Portal. It is being sent to some other web application
+ return false;
+ }
+ }
+ else
+ {
+ //If Portal is running on root context, there is no way to tell from client side, if this request is actually
+ //to be sent to the Portal or some other web application. Hence, in the interest of functional safety/correctness
+ //no Async Page Refresh here
+ //If Portal is running on Root context, Partial Refresh will happen only for pure relative links
+ return false;
+ }
+ }
+
+ //If I get here, Async Page Refresh through the Portal should be allowed
+ return true;
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/SubmitListener.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/SubmitListener.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/listener/SubmitListener.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,174 @@
+/******************************************************************************
+ * 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.ajax.client.listener;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Event;
+
+import org.jboss.portal.presentation.ajax.client.Util;
+import org.jboss.portal.presentation.ajax.client.Session;
+import org.jboss.portal.presentation.ajax.client.protocol.AsyncPostAction;
+import org.jboss.portal.presentation.ajax.client.protocol.Caller;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class SubmitListener implements Caller
+{
+ private JavaScriptObject originalSubmitFunction = null;
+ private JavaScriptObject overrideSubmitFunction = null;
+
+ /**
+ *
+ *
+ */
+ public SubmitListener()
+ {
+ this.originalSubmitFunction = this.getOriginalSubmitFunction();
+ this.overrideSubmitFunction = this.getOverRideSubmitFunction();
+ this.overwriteSubmit(this.overrideSubmitFunction);
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ *
+ */
+ public static void submitCallback(Event event, Element currentForm)
+ {
+ DOM.eventPreventDefault(event);
+ SubmitListener.submitCallback(currentForm);
+ }
+
+ /**
+ *
+ *
+ */
+ public static void submitCallback(Element currentForm)
+ {
+ Session.getInstance().getSubmitListener().handlePartialRefreshForm(currentForm);
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @param url
+ * @param portletWindow
+ */
+ private void handlePartialRefreshForm(Element currentForm)
+ {
+ String url = DOM.getElementAttribute(currentForm, "action");
+ String method = DOM.getElementAttribute(currentForm, "method");
+ String enctype = DOM.getElementAttribute(currentForm, "enctype");
+ String postData = serializeForm(currentForm);
+
+ boolean isPartialRefreshAllowed = ListenerUtil.isPartialRefreshAllowed(url.trim());
+ if((isPartialRefreshAllowed) && (enctype == null || !enctype.equals("multipart/form-data")))
+ {
+ AsyncPostAction action = new AsyncPostAction(url, postData);
+ action.execute(this);
+ }
+ else
+ {
+ //Go ahead and perform a regular form submit
+ this.forceSubmit(originalSubmitFunction, overrideSubmitFunction, currentForm);
+ }
+ }
+ //----Caller impl---------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public void callback(Object result)
+ {
+ Util.displayPortalPage();
+ }
+ //---low-level native Javascripts layer------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public native JavaScriptObject getOriginalSubmitFunction()
+ /*-{
+ return $wnd.HTMLFormElement.prototype.submit;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public native JavaScriptObject getOverRideSubmitFunction()
+ /*-{
+ function overrideSubmit(event)
+ {
+ var target = null;
+ if(event != null)
+ {
+ target = event.target;
+ @org.jboss.portal.presentation.ajax.client.listener.SubmitListener::submitCallback(Lcom/google/gwt/user/client/Event;Lcom/google/gwt/user/client/Element;)(event,target);
+ }
+ else
+ {
+ target = this;
+ @org.jboss.portal.presentation.ajax.client.listener.SubmitListener::submitCallback(Lcom/google/gwt/user/client/Element;)(target);
+ }
+ }
+ return overrideSubmit;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public native void overwriteSubmit(JavaScriptObject overrideSubmitFunction)
+ /*-{
+ $wnd.addEventListener('submit', overrideSubmitFunction, true);
+ $wnd.HTMLFormElement.prototype.submit = overrideSubmitFunction;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public native void forceSubmit(JavaScriptObject originalSubmitFunction, JavaScriptObject overrideSubmitFunction, JavaScriptObject form)
+ /*-{
+ $wnd.HTMLFormElement.prototype.submit = originalSubmitFunction;
+ form.submit();
+ $wnd.HTMLFormElement.prototype.submit = overrideSubmitFunction;
+ }-*/;
+
+ /**
+ *
+ * @param currentForm
+ * @return
+ */
+ public static native String serializeForm(Element currentForm)
+ /*-{
+ var formData = $wnd.Form.serialize(currentForm);
+ return formData;
+ }-*/;
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContainer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContainer.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContainer.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * 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.ajax.client.model;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public final class AjaxUIContainer extends AjaxUIObject
+{
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.ajax.client.model;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public final class AjaxUIContext extends AjaxUIObject
+{
+ /**
+ * @gwt.typeArgs <java.lang.String, org.jboss.portal.presentation.ajax.client.model.AjaxUIObject>
+ */
+ private Map objectTree = new HashMap();
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public AjaxUIObject getObject(String id)
+ {
+ AjaxUIObject object = null;
+
+ //Perform a direct quick lookup
+ if(this.objectTree.containsKey(id))
+ {
+ object = (AjaxUIObject)this.objectTree.get(id);
+ }
+
+ return object;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void addObject(AjaxUIObject object)
+ {
+ object.setContext(this);
+ this.objectTree.put(object.getId(), object);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map getObjectTree()
+ {
+ return objectTree;
+ }
+
+ /**
+ *
+ * @param objectTree
+ */
+ public void setObjectTree(Map objectTree)
+ {
+ this.objectTree = objectTree;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIObject.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,202 @@
+/******************************************************************************
+ * 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.ajax.client.model;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class AjaxUIObject implements IsSerializable
+{
+ /**
+ *
+ */
+ public static final int STATUS_VALID = 0;
+ public static final int STATUS_INVALID = 1;
+ public static final int STATUS_STALE = 2;
+
+ /**
+ *
+ */
+ protected String id = null;
+
+ /**
+ *
+ */
+ protected int status = STATUS_VALID;
+
+ /**
+ *
+ */
+ protected AjaxUIObject parent = null;
+
+ /**
+ * @gwt.typeArgs <org.jboss.portal.presentation.ajax.client.model.AjaxUIObject>
+ */
+ protected List children = null;
+
+ /**
+ *
+ */
+ protected AjaxUIContext context = null;
+ //----------------------------------------------------------------------------------------------------------------------------------------------------------
+
+ /**
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return this.id;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ int lastIndex = id.lastIndexOf("/");
+ return id.substring(lastIndex+1);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getStatus()
+ {
+ return this.status;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public AjaxUIObject getParent()
+ {
+ return this.parent;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getChildren()
+ {
+ if(this.children == null)
+ {
+ this.children = new ArrayList();
+ }
+ return this.children;
+ }
+
+ /**
+ *
+ * @param name
+ * @return
+ */
+ public AjaxUIObject getChild(String id)
+ {
+ AjaxUIObject child = null;
+
+ if(this.children != null)
+ {
+ for(int i=0; i<this.children.size(); i++)
+ {
+ AjaxUIObject cour = (AjaxUIObject)this.children.get(i);
+ if(cour.id.equals(id))
+ {
+ child = cour;
+ break;
+ }
+ }
+ }
+
+ return child;
+ }
+
+ /**
+ *
+ * @param children
+ */
+ public void setChildren(List children)
+ {
+ this.children = children;
+ }
+
+ /**
+ *
+ * @param child
+ */
+ /*public void addChild(AjaxUIObject child)
+ {
+ AjaxUIObject find = null;
+ for(int i=0; i<this.getChildren().size(); i++)
+ {
+ AjaxUIObject cour = (AjaxUIObject)this.getChildren().get(i);
+ if(cour.id.equals(child.id))
+ {
+ find = cour;
+ }
+ }
+
+ if(find != null)
+ {
+ this.getChildren().remove(find);
+ }
+
+ this.getChildren().add(child);
+ }*/
+
+
+ public AjaxUIContext getContext()
+ {
+ return context;
+ }
+
+ public void setContext(AjaxUIContext context)
+ {
+ this.context = context;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public void setParent(AjaxUIObject parent)
+ {
+ this.parent = parent;
+ }
+
+ public void setStatus(int status)
+ {
+ this.status = status;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPage.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPage.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPage.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.ajax.client.model;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public final class AjaxUIPage extends AjaxUIObject
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPortal.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPortal.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIPortal.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * 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.ajax.client.model;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public final class AjaxUIPortal extends AjaxUIObject
+{
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIWindow.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIWindow.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxUIWindow.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,117 @@
+/******************************************************************************
+ * 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.ajax.client.model;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public final class AjaxUIWindow extends AjaxUIObject
+{
+ public static final String NORMAL = "normal";
+ public static final String MAXIMIZE = "maximized";
+ public static final String MINIMIZE = "minimized";
+ public static final String EDIT = "edit";
+ public static final String VIEW = "view";
+
+ private String content = null;
+ private String mode = VIEW;
+ private String state = NORMAL;
+ private boolean isVisible = true;
+
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+ /**
+ *
+ * @param content
+ */
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isVisible()
+ {
+ return isVisible;
+ }
+
+ /**
+ *
+ * @param isVisible
+ */
+ public void setVisible(boolean isVisible)
+ {
+ this.isVisible = isVisible;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getMode()
+ {
+ return mode;
+ }
+
+ /**
+ *
+ * @param mode
+ */
+ public void setMode(String mode)
+ {
+ this.mode = mode;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getState()
+ {
+ return state;
+ }
+
+ /**
+ *
+ * @param state
+ */
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Page.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Page.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Page.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * 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.ajax.client.model;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * Represents the concept of a Portal Page on the client-side Ajax agent
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Page implements IsSerializable
+{
+ private String name = null;
+ private Window[] windows = null;
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Window[] getWindows()
+ {
+ return windows;
+ }
+
+ /**
+ *
+ * @param windows
+ */
+ public void setWindows(Window[] windows)
+ {
+ this.windows = windows;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Window.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Window.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/model/Window.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.ajax.client.model;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * Represents the concept of a Portal Window on the client-side Ajax agent
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Window implements IsSerializable
+{
+ public static final String NORMAL = "NORMAL";
+ public static final String MAXIMIZED = "MAXIMIZED";
+ public static final String MINIMIZED = "MINIMIZED";
+ public static final String EDIT = "EDIT";
+ public static final String VIEW = "VIEW";
+
+ private String name = null;
+ private String content = null;
+ private String mode = VIEW;
+ private String state = NORMAL;
+ private boolean isVisible = true;
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+ /**
+ *
+ * @param content
+ */
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isVisible()
+ {
+ return isVisible;
+ }
+
+ /**
+ *
+ * @param isVisible
+ */
+ public void setVisible(boolean isVisible)
+ {
+ this.isVisible = isVisible;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getMode()
+ {
+ return mode;
+ }
+
+ /**
+ *
+ * @param mode
+ */
+ public void setMode(String mode)
+ {
+ this.mode = mode;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getState()
+ {
+ return state;
+ }
+
+ /**
+ *
+ * @param state
+ */
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxShowUIObjectResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxShowUIObjectResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxShowUIObjectResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AjaxShowUIObjectResponse extends ClientResponse
+{
+ /**
+ *
+ */
+ private AjaxUIObject uiObject = null;
+
+ /**
+ *
+ *
+ */
+ public AjaxShowUIObjectResponse()
+ {
+
+ }
+
+ /**
+ *
+ * @param uiObject
+ */
+ public AjaxShowUIObjectResponse(AjaxUIObject uiObject)
+ {
+ this.uiObject = uiObject;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public AjaxUIObject getUiObject()
+ {
+ return uiObject;
+ }
+
+ /**
+ *
+ * @param uiObject
+ */
+ public void setUiObject(AjaxUIObject uiObject)
+ {
+ this.uiObject = uiObject;
+ }
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class AjaxUIObjectAction extends ClientAction
+{
+ /**
+ *
+ */
+ private final String targetId;
+
+ /**
+ *
+ * @param targetId
+ */
+ public AjaxUIObjectAction(String targetId)
+ {
+ this.targetId = targetId;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getTargetId()
+ {
+ return targetId;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+import org.jboss.portal.presentation.ajax.client.Session;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPCAsync;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AjaxUpdateWindowStateAction extends AjaxUIObjectAction
+{
+ /**
+ *
+ */
+ private String windowState = null;
+
+ /**
+ *
+ * @param targetId
+ */
+ public AjaxUpdateWindowStateAction(String windowId, String windowState)
+ {
+ super(windowId);
+ this.windowState = windowState;
+ }
+
+ /**
+ *
+ */
+ public void execute(final Caller caller)
+ {
+ PortalRPCAsync portalRPC = (PortalRPCAsync)GWT.create(PortalRPC.class);
+ ((ServiceDefTarget)portalRPC).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ if(result instanceof AjaxShowUIObjectResponse)
+ {
+ AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
+ Session.getInstance().getUiContext().addObject(uiObject);
+ if(uiObject instanceof AjaxUIPage)
+ {
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ }
+ caller.callback(uiObject);
+ }
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ /**
+ * TODO: Handle exception properly
+ */
+ }
+ };
+ String url = this.getTargetId() + "?" + "windowstate=" + this.windowState;
+ portalRPC.asyncGet(url, callback);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AjaxViewUIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+import org.jboss.portal.presentation.ajax.client.Session;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPCAsync;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AjaxViewUIObjectAction extends AjaxUIObjectAction
+{
+ /**
+ *
+ * @param targetId
+ */
+ public AjaxViewUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+
+ /**
+ *
+ */
+ public void execute(final Caller caller)
+ {
+ PortalRPCAsync portalRPC = (PortalRPCAsync)GWT.create(PortalRPC.class);
+ ((ServiceDefTarget)portalRPC).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
+ Session.getInstance().getUiContext().addObject(uiObject);
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ caller.callback(null);
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ /**
+ * TODO: Handle exception properly
+ */
+ }
+ };
+ portalRPC.loadObject(this.getTargetId(), callback);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncGetAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+import org.jboss.portal.presentation.ajax.client.Session;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPCAsync;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AsyncGetAction extends ClientAction
+{
+ /**
+ *
+ */
+ private String url = null;
+
+ /**
+ *
+ * @param targetId
+ */
+ public AsyncGetAction(String url)
+ {
+ this.url = url;
+ }
+
+ /**
+ *
+ */
+ public void execute(final Caller caller)
+ {
+ PortalRPCAsync portalRPC = (PortalRPCAsync)GWT.create(PortalRPC.class);
+ ((ServiceDefTarget)portalRPC).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ if(result instanceof AjaxShowUIObjectResponse)
+ {
+ AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
+ Session.getInstance().getUiContext().addObject(uiObject);
+ if(uiObject instanceof AjaxUIPage)
+ {
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ }
+ caller.callback(uiObject);
+ }
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ /**
+ * TODO: Handle exception properly
+ */
+ }
+ };
+ portalRPC.asyncGet(this.url, callback);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/AsyncPostAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+import org.jboss.portal.presentation.ajax.client.Session;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
+import org.jboss.portal.presentation.ajax.client.service.PortalRPCAsync;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AsyncPostAction extends ClientAction
+{
+ /**
+ *
+ */
+ private String url = null;
+ private String body = null;
+
+ /**
+ *
+ * @param targetId
+ */
+ public AsyncPostAction(String url, String body)
+ {
+ this.url = url;
+ this.body = body;
+ }
+
+ /**
+ *
+ */
+ public void execute(final Caller caller)
+ {
+ PortalRPCAsync portalRPC = (PortalRPCAsync)GWT.create(PortalRPC.class);
+ ((ServiceDefTarget)portalRPC).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
+ AsyncCallback callback = new AsyncCallback()
+ {
+ public void onSuccess(Object result)
+ {
+ if(result instanceof AjaxShowUIObjectResponse)
+ {
+ AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
+ Session.getInstance().getUiContext().addObject(uiObject);
+ if(uiObject instanceof AjaxUIPage)
+ {
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ }
+ caller.callback(uiObject);
+ }
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ /**
+ * TODO: Handle exception properly
+ */
+ }
+ };
+ portalRPC.asyncPost(this.url, this.body, callback);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/Caller.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/Caller.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/Caller.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface Caller
+{
+ /**
+ *
+ * @param result
+ */
+ public void callback(Object result);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class ClientAction
+{
+ public abstract void execute(Caller caller);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/ClientResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.ajax.client.protocol;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class ClientResponse implements IsSerializable
+{
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.ajax.client.service;
+
+import java.util.Map;
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
+
+/**
+ * RPC service used for Asynchronous communication between the client-side agent and the Portal Server
+ *
+ * @author soshah
+ *
+ */
+public interface PortalRPC extends RemoteService
+{
+ /**
+ * Asynchronously loads the specified object from the server
+ *
+ * @return
+ */
+ public ClientResponse loadObject(String objectId);
+
+ /**
+ * Asynchronously send a UI Get Activation to the Portal Server
+ *
+ */
+ public ClientResponse asyncGet(String url);
+
+ /**
+ * Asynchronously send a UI Post activation to the Portal Server
+ *
+ */
+ public ClientResponse asyncPost(String url, String body);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.ajax.client.service;
+
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+/**
+ * RPC service used for Asynchronous communication between the client-side agent and the Portal Server
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface PortalRPCAsync
+{
+ /**
+ * Asynchronously loads the specified object from the server
+ */
+ public void loadObject(String objectId, AsyncCallback callback);
+
+ /**
+ * Asynchronously send a UI Get Activation to the Portal Server
+ *
+ */
+ public void asyncGet(String url, AsyncCallback callback);
+
+ /**
+ * Asynchronously send a UI Post activation to the Portal Server
+ *
+ */
+ public void asyncPost(String url, String body, AsyncCallback callback);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,205 @@
+/******************************************************************************
+ * 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.ajax.client.widget;
+
+import com.google.gwt.user.client.ui.HTML;
+
+import net.mygwt.ui.client.widget.ContentPanel;
+import net.mygwt.ui.client.Style;
+import net.mygwt.ui.client.widget.IconButton;
+import net.mygwt.ui.client.widget.Info;
+import net.mygwt.ui.client.event.Listener;
+import net.mygwt.ui.client.event.BaseEvent;
+
+import org.jboss.portal.presentation.ajax.client.Util;
+import org.jboss.portal.presentation.ajax.client.Session;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIWindow;
+import org.jboss.portal.presentation.ajax.client.protocol.AjaxUpdateWindowStateAction;
+import org.jboss.portal.presentation.ajax.client.protocol.Caller;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortletWindow implements Caller
+{
+ /**
+ *
+ */
+ private AjaxUIWindow window = null;
+
+ /**
+ *
+ *
+ */
+ public PortletWindow(AjaxUIWindow window)
+ {
+ this.window = window;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return this.window.getName();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public ContentPanel create()
+ {
+ String windowName = this.getName();
+
+ ContentPanel portletWindow = new ContentPanel(Style.HEADER);
+ portletWindow.setId(windowName);
+ portletWindow.layoutOnChange = true;
+
+ //Setup listeners
+ //Event Listener for the decoration components like
+ //Normal, Maximized, Minimized
+ IconButton save = new IconButton("my-tool-save");
+ save.setId(windowName+":save");
+ save.setToolTip("Edit");
+
+ IconButton help = new IconButton("my-tool-help");
+ help.setId(windowName+":help");
+ help.setToolTip("Help");
+
+ IconButton restore = new IconButton("my-tool-restore");
+ restore.setId(windowName+":"+AjaxUIWindow.NORMAL);
+ restore.setToolTip("Normal");
+
+ IconButton minimize = new IconButton("my-tool-minimize");
+ minimize.setId(windowName+":"+AjaxUIWindow.MINIMIZE);
+ minimize.setToolTip("Minimize");
+
+ IconButton maximize = new IconButton("my-tool-maximize");
+ maximize.setId(windowName+":"+AjaxUIWindow.MAXIMIZE);
+ maximize.setToolTip("Maximize");
+
+ //Setup the buttons
+ Listener listener = new PortletWindowListener(this);
+
+ portletWindow.addButton(save, listener);
+ portletWindow.addButton(help, listener);
+
+ if(this.window.getState().equals(AjaxUIWindow.NORMAL) || this.window.getState().equals(AjaxUIWindow.MAXIMIZE))
+ {
+ portletWindow.addButton(minimize, listener);
+ }
+
+ if(this.window.getState().equals(AjaxUIWindow.MAXIMIZE) || this.window.getState().equals(AjaxUIWindow.MINIMIZE))
+ {
+ portletWindow.addButton(restore, listener);
+ }
+
+ if(this.window.getState().equals(AjaxUIWindow.NORMAL) || this.window.getState().equals(AjaxUIWindow.MINIMIZE))
+ {
+ portletWindow.addButton(maximize, listener);
+ }
+
+ //Add the content
+ if(!this.window.getState().equals(AjaxUIWindow.MINIMIZE))
+ {
+ HTML windowContent = new HTML(this.window.getContent());
+ portletWindow.add(windowContent);
+
+ //Event Listener for actions perfomed inside the portlet window content
+ //itself. Used for performing Partial Refresh of a Portal Page
+ windowContent.addClickListener(Session.getInstance().getAnchorListener());
+ }
+
+ return portletWindow;
+ }
+ //----Caller impl---------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public void callback(Object result)
+ {
+ Util.displayPortalPage();
+ }
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+ private class PortletWindowListener implements Listener
+ {
+ /**
+ *
+ */
+ private PortletWindow portletWindow = null;
+
+ /**
+ *
+ * @param portletWindow
+ */
+ private PortletWindowListener(PortletWindow portletWindow)
+ {
+ this.portletWindow = portletWindow;
+ }
+
+ /**
+ *
+ * @param event
+ */
+ public void handleEvent(BaseEvent event)
+ {
+ IconButton cour = (IconButton)event.widget;
+ String id = cour.getId();
+ String windowName = id.substring(0, id.indexOf(':'));
+ String action = id.substring(id.indexOf(':')+1);
+
+ //Process the action performed on the window
+ if(action.equals(AjaxUIWindow.NORMAL))
+ {
+ AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.NORMAL);
+ stateAction.execute(this.portletWindow);
+ }
+ else if(action.equals(AjaxUIWindow.MAXIMIZE))
+ {
+ AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MAXIMIZE);
+ stateAction.execute(this.portletWindow);
+ }
+ else if(action.equals(AjaxUIWindow.MINIMIZE))
+ {
+ AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MINIMIZE);
+ stateAction.execute(this.portletWindow);
+ }
+ else if(action.equals("save"))
+ {
+ Info.show("Save", "Loading Save Mode....", "Loading Save Mode....");
+ }
+ else if(action.equals("help"))
+ {
+ Info.show("Help", "Loading Help Mode....", "Loading Help Mode....");
+ }
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/PresentationContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.client;
+
+import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIContext;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.web.ServletContextDispatcher;
+
+/**
+ * The contract that defines the services that the client provides to the server during a server invocation.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PresentationContext
+{
+
+ /**
+ * Create a string representation of the server action.
+ *
+ * @param action the server action to render
+ * @return the rendition of the server action
+ * @throws IllegalArgumentException if the action cannot be rendered
+ */
+ String render(ServerAction action) throws IllegalArgumentException;
+
+ /**
+ * Returns the root UI context provided by the portal.
+ *
+ * @return the ui context
+ */
+ UIContext getUIContext();
+
+ /**
+ * TODO: remove this method from the PresentationContext make it internal to the AjaxUIController
+ *
+ * Provide the root UI context for the server side cache of the Ajax User Agent
+ *
+ * @return
+ */
+ public AjaxUIContext getAjaxUIContext();
+
+ /**
+ * Returns the servlet context dispatcher.
+ *
+ * @return the servlet context dispatcher
+ */
+ ServletContextDispatcher getDispatcher();
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/AjaxUIController.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/AjaxUIController.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/AjaxUIController.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,264 @@
+/******************************************************************************
+ * 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.client.controller;
+
+import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.impl.PresentationContextImpl;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.ServerResponse;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.server.ProcessorRequest;
+import org.jboss.portal.presentation.server.ProcessorResponse;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIContext;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIWindow;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Collection;
+
+/**
+ * The UIServer is responsible for generating the output that is sent back to the client based on the Portal state of a particular Portal Request
+ *
+ * The UIServer provides various UI level services like Page Aggregation, Page Layout, Web 2.0 client interactions etc.
+ *
+ * Typically the Core component of the Portal delegates all UI specific functions to this component
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AjaxUIController implements RequestController
+{
+
+ /** . */
+ private PresentationServer presentationServer = null;
+
+
+ public AjaxUIController()
+ {
+ }
+
+
+ /**
+ * handle is the entry point for handling an incoming Portal request. The request is handed over
+ * from the Http Layer via the main Portal Servlet
+ */
+ public void handle(ServerInvocation invocation) throws ServerException
+ {
+ try
+ {
+ HttpServletRequest request = invocation.getServerContext().getClientRequest();
+
+ /**
+ * TODO: decouple the implementation via factory pattern
+ */
+ PresentationContext presentationContext = presentationContext = new PresentationContextImpl(this.presentationServer,
+ invocation);
+ request.setAttribute("requestContext", presentationContext);
+
+ /**
+ * TODO: move this functionality to another component like a UIPresenter etc
+ */
+ ServerAction serverAction = this.getServerAction(presentationContext, invocation);
+
+ ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
+ ProcessorResponse processorResponse = this.presentationServer.getProcessor().process(presentationContext,
+ processorRequest);
+
+ //Process the response from the Processor
+ ServerResponse serverResponse = processorResponse.getResponse();
+ this.handle(presentationContext, serverResponse, invocation);
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ * @param serverResponse
+ * @throws ServerException
+ */
+ private void handle(PresentationContext presentationContext, ServerResponse serverResponse, ServerInvocation invocation) throws ServerException
+ {
+ try
+ {
+ HttpServletResponse response = invocation.getServerContext().getClientResponse();
+ if(serverResponse instanceof ShowUIObjectResponse)
+ {
+ ShowUIObjectResponse show = (ShowUIObjectResponse)serverResponse;
+ String targetId = show.getTargetId();
+ render(invocation, presentationContext, targetId);
+ }
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ * @param presentationContext
+ * @param targetId
+ */
+ private void render(ServerInvocation invocation,PresentationContext presentationContext, String targetId)
+ {
+ UIObject uiObject = presentationContext.getUIContext().getObject(targetId);
+
+ //Display the page to the client
+ if(uiObject instanceof UIPage)
+ {
+ UIPage page = (UIPage)uiObject;
+ AjaxUIContext ajaxUiContext = presentationContext.getAjaxUIContext();
+
+ //Process the Page to be displayed
+ AjaxUIPage clientPage = (AjaxUIPage)ajaxUiContext.getObject(page.getId());
+ boolean pageJustCreated = false;
+ if(clientPage == null)
+ {
+ clientPage = new org.jboss.portal.presentation.ajax.client.model.AjaxUIPage();
+ clientPage.setId(page.getId());
+ ajaxUiContext.addObject(clientPage);
+ pageJustCreated = true;
+ }
+
+ //Process the Windows belonging to this Page
+ Collection<? extends UIObject> windows = page.getChildren();
+ for(UIObject cour : windows)
+ {
+ if(cour instanceof UIWindow)
+ {
+ UIWindow window = (UIWindow)cour;
+
+ //Make sure this window properly belongs to the AjaxUIContext object tree
+ AjaxUIWindow clientWindow = (AjaxUIWindow)clientPage.getChild(window.getId());
+ if(clientWindow == null)
+ {
+ clientWindow = new org.jboss.portal.presentation.ajax.client.model.AjaxUIWindow();
+ clientWindow.setId(window.getId());
+ clientPage.getChildren().add(clientWindow);
+ ajaxUiContext.addObject(clientWindow);
+ }
+
+ //Render this window only if this Page is being rendered for the first time in this
+ //User Session or if the navigation state of this window has changed during this interaction
+ //TODO: also add cache expiration as one of the conditions for this action
+ if(pageJustCreated || clientWindow.getStatus() == AjaxUIWindow.STATUS_STALE)
+ {
+ try
+ {
+ WindowContent windowContent = this.presentationServer.render(presentationContext, window);
+
+ clientWindow.setId(window.getId());
+ clientWindow.setParent(clientPage);
+
+ clientWindow.setContent(windowContent.getMarkup());
+ if(window.getMode() != null)
+ {
+ clientWindow.setMode(window.getMode().toString());
+ }
+ if(window.getWindowState() != null)
+ {
+ clientWindow.setState(window.getWindowState().toString());
+ }
+
+ //Restore the Status of the Window
+ clientWindow.setStatus(AjaxUIWindow.STATUS_VALID);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ invocation.getServerContext().getClientRequest().setAttribute("uiObject", clientPage);
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ public void start()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void stop()
+ {
+
+ }
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public PresentationServer getPresentationServer()
+ {
+ return presentationServer;
+ }
+
+ /**
+ *
+ * @param presentationServer
+ */
+ public void setPresentationServer(PresentationServer presentationServer)
+ {
+ this.presentationServer = presentationServer;
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private ServerAction getServerAction(PresentationContext presentationContext, ServerInvocation invocation)
+ {
+ ServerAction action = null;
+
+ //Process any window state change incoming requests
+ action = (ServerAction)invocation.getServerContext().getClientRequest().getAttribute("serverAction");
+
+ //Just use ViewUIObject command for now until URL interpretation/mapping
+ //to ServiceAction is implemented
+ if(action == null)
+ {
+ action = new ViewUIObjectAction("/default/default");
+ }
+
+ return action;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/client/controller/UIController.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,460 @@
+/******************************************************************************
+ * 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.client.controller;
+
+import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.impl.PresentationContextImpl;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.ServerResponse;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.server.ProcessorRequest;
+import org.jboss.portal.presentation.server.ProcessorResponse;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.web.WebRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * The UIServer is responsible for generating the output that is sent back to the client based on the Portal state of a particular Portal Request
+ *
+ * The UIServer provides various UI level services like Page Aggregation, Page Layout, Web 2.0 client interactions etc.
+ *
+ * Typically the Core component of the Portal delegates all UI specific functions to this component
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIController implements RequestController
+{
+
+ /** . */
+ private PresentationServer presentationServer = null;
+
+
+ public UIController()
+ {
+ }
+
+
+ /**
+ * handle is the entry point for handling an incoming Portal request. The request is handed over
+ * from the Http Layer via the main Portal Servlet
+ */
+ public void handle(ServerInvocation invocation) throws ServerException
+ {
+ try
+ {
+ HttpServletRequest request = invocation.getServerContext().getClientRequest();
+
+ /**
+ * TODO: decouple the implementation via factory pattern
+ */
+ PresentationContext presentationContext = new PresentationContextImpl(this.presentationServer,
+ invocation);
+ request.setAttribute("requestContext", presentationContext);
+
+ /**
+ * TODO: move this functionality to another component like a UIPresenter etc
+ */
+ ServerAction serverAction = this.getServerAction(presentationContext, invocation);
+
+ ProcessorRequest processorRequest = new ProcessorRequest(serverAction);
+ ProcessorResponse processorResponse = this.presentationServer.getProcessor().process(presentationContext,
+ processorRequest);
+
+ //Process the response from the Processor
+ ServerResponse serverResponse = processorResponse.getResponse();
+ this.handle(presentationContext, serverResponse, invocation);
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ * @param serverResponse
+ * @throws ServerException
+ */
+ private void handle(PresentationContext presentationContext, ServerResponse serverResponse, ServerInvocation invocation) throws ServerException
+ {
+ try
+ {
+ HttpServletResponse response = invocation.getServerContext().getClientResponse();
+ if(serverResponse instanceof ShowUIObjectResponse)
+ {
+ ShowUIObjectResponse show = (ShowUIObjectResponse)serverResponse;
+ String targetId = show.getTargetId();
+
+ //Load the objects in the UITree
+ UIObject uiObject = presentationContext.getUIContext().getObject(targetId);
+
+ if(uiObject instanceof UIPage)
+ {
+ render(response.getWriter(), presentationContext, targetId);
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ public void start()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void stop()
+ {
+
+ }
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public PresentationServer getPresentationServer()
+ {
+ return presentationServer;
+ }
+
+ /**
+ *
+ * @param presentationServer
+ */
+ public void setPresentationServer(PresentationServer presentationServer)
+ {
+ this.presentationServer = presentationServer;
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private ServerAction getServerAction(PresentationContext presentationContext, ServerInvocation invocation)
+ {
+ String requestPath = invocation.getServerContext().getPortalRequestPath();
+ WebRequest webReq = ((ServerInvocationContextImpl)invocation.getContext()).getWebRequest();
+ Map queryParameters = webReq.getQueryParameterMap();
+
+ //
+ if (queryParameters != null && queryParameters.containsKey("action"))
+ {
+ UIObject target = presentationContext.getUIContext();
+
+ //
+ int from = 1;
+ while (true)
+ {
+ int pos = requestPath.indexOf('/', from);
+ if (pos == -1)
+ {
+ String name = requestPath.substring(from);
+ target = target.getChild(name);
+ break;
+ }
+ else
+ {
+ String name = requestPath.substring(from, pos);
+ target = target.getChild(name);
+ }
+ if (target == null)
+ {
+ break;
+ }
+ from = pos + 1;
+ }
+
+ //
+ if (target != null)
+ {
+ if ("GET".equals(webReq.getMethod()))
+ {
+ return new GetActivation(target.getId(), webReq.getQueryParameterMap());
+ }
+ else if ("POST".equals(webReq.getMethod()))
+ {
+ return new PostActivation(target.getId(), webReq.getQueryParameterMap(), webReq.getBody());
+ }
+ }
+ }
+
+ //Just use ViewUIObject command for now until URL interpretation/mapping
+ //to ServiceAction is implemented
+ return new ViewUIObjectAction("/default/default");
+ }
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * TODO: this should be used only in classic UI case...eventually when Controller is abstracted, this will be moved to
+ * the ClassicController implementation
+ */
+ private void render(PrintWriter clientConnection, PresentationContext presentationContext, String targetId)
+ {
+ StringBuffer responseBuffer = new StringBuffer();
+ UIObject uiObject = presentationContext.getUIContext().getObject(targetId);
+
+ //Display the page to the client
+ if(uiObject instanceof UIPage)
+ {
+ UIPage page = (UIPage)uiObject;
+ Collection<? extends UIObject> windows = page.getChildren();
+ for(UIObject cour : windows)
+ {
+ if(cour instanceof UIWindow)
+ {
+ UIWindow window = (UIWindow)cour;
+
+ try
+ {
+ WindowContent windowContent = this.presentationServer.render(presentationContext, window);
+ responseBuffer.append("<div>");
+ responseBuffer.append("<div id=\"title\">").append(windowContent.getTitle()).append("</div>");
+ responseBuffer.append("<div id=\"content\">").append(windowContent.getMarkup()).append("</div>");
+ responseBuffer.append("</div><br/><br/>");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ //Create the final output...Also hardcoded without any preprocessing/postprocessing etc
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>JBoss Portal UIServer</title><link rel=\"stylesheet\" id=\"dyna_css\" href=\"/portal-ajax/dyna/style.css\" type=\"text/css\"/><link rel=\"stylesheet\" type=\"text/css\" id=\"main_css\" href=\"/portal-core/themes/renaissance/portal_style.css\"/><link rel=\"shortcut icon\" href=\"/portal-core/themes/renaissance/images/favicon.ico\" /><link rel=\"icon\" type=\"image/gif\" href=\"/portal-core/themes/renaissance/images/animated_favicon1.gif\" /></head><body id=\"body\">\n");
+ buffer.append(responseBuffer.toString());
+ buffer.append("</body></html>\n");
+
+
+ //Sending the results back to the Client
+ clientConnection.write(buffer.toString());
+ clientConnection.flush();
+ }
+
+ // ---------All these are just helper methods for the prototype-----------------------------------------------------------------------------------------------
+ //----It containts mostly hard coded logic for the prototype-------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ /*private Object[] getFlexibleGridLayoutManager(Page pageResult)
+ {
+
+ Page page = new Page();
+ Container header = new Container("header");
+ Container leftPanel = new Container("leftPanel");
+ Container mainPanel = new Container("mainPanel");
+ Window headerTabsWindow = new Window("header-tabs-window");
+ Window menuWindow = new Window("menu-window");
+ Window leftPanelWindow1 = new Window("left-panel-window1");
+ Window leftPanelWindow2 = new Window("left-panel-window2");
+ Window mainPanelWindow = new Window("main-panel-window");
+ header.addComponent(headerTabsWindow);
+ header.addComponent(menuWindow);
+ leftPanel.addComponent(leftPanelWindow1);
+ leftPanel.addComponent(leftPanelWindow2);
+ mainPanel.addComponent(mainPanelWindow);
+
+ //Setup the Grid for headerTabs container
+ page.addContainer(header);
+ FlexibleGrid headerGrid = this.getGrid("header", 1, 2);
+ FlexibleGridConstraints[] headerTabConstraints = { this.getConstraints("header-tabs-window", "100", 0, 0, 10, 0, 0, 0),
+ this.getConstraints("menu-window", "100", 0, 0, 0, 0, 0, 1) };
+ headerGrid.setConstraints(headerTabConstraints);
+
+ //Setup the Grid for left panel container
+ page.addContainer(leftPanel);
+ FlexibleGrid leftPanelGrid = this.getGrid("leftPanel", 2, 1);
+ FlexibleGridConstraints[] leftPanelConstraints = { this.getConstraints("left-panel-window1", "75", 0, 0, 0, 0, 0, 0),
+ this.getConstraints("left-panel-window2", "75", 0, 0, 0, 0, 1, 0) };
+ leftPanelGrid.setConstraints(leftPanelConstraints);
+
+ //Setup the Grid for main panel container
+ page.addContainer(mainPanel);
+ FlexibleGrid mainPanelGrid = this.getGrid("mainPanel", 1, 1);
+ FlexibleGridConstraints[] mainPanelConstraints = { this.getConstraints("main-panel-window", "100", 0, 0, 0, 0, 0, 0) };
+ mainPanelGrid.setConstraints(mainPanelConstraints);
+
+ //Setup the FlexibleGrid Layout Manager with the different grids
+ FlexibleGrid[] row1 = { headerGrid };
+ FlexibleGrid[] row2 = { leftPanelGrid, mainPanelGrid };
+ FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
+ layoutManager.addRowOfGrids(row1);
+ layoutManager.addRowOfGrids(row2);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+
+ switch(counter)
+ {
+ case 0:
+ leftPanelWindow1.setContent(result.getContent());
+ break;
+
+ case 1:
+ leftPanelWindow2.setContent(result.getContent());
+ break;
+
+ case 2:
+ mainPanelWindow.setContent(result.getContent());
+ break;
+
+ case 3:
+ menuWindow.setContent(result.getContent());
+ break;
+
+ case 4:
+ headerTabsWindow.setContent(result.getContent());
+ break;
+ }
+
+ counter++;
+ }
+
+ return new Object[]{page, layoutManager};
+ }*/
+
+
+ /**
+ *
+ * @param containerId
+ * @param rows
+ * @param columns
+ * @return
+ */
+ /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
+ {
+ FlexibleGrid grid = new FlexibleGrid(containerId);
+ grid.setRows(rows);
+ grid.setColumns(columns);
+ return grid;
+ }*/
+
+ /**
+ *
+ * @param componentId
+ * @param widthPercentage
+ * @param top
+ * @param bottom
+ * @param left
+ * @param right
+ */
+ /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
+ {
+ FlexibleGridConstraints constraints = new FlexibleGridConstraints();
+ constraints.setComponentId(componentId);
+ constraints.setWidthPercentage(widthPercentage);
+ constraints.setRow(row);
+ constraints.setColumn(column);
+ constraints.setTop(top);
+ constraints.setBottom(bottom);
+ constraints.setLeft(left);
+ constraints.setRight(right);
+ return constraints;
+ }*/
+
+ /**
+ *
+ * @param pageResult
+ * @return
+ */
+ /*private Object[] getRegionBasedLayoutManager(Page pageResult)
+ {
+ Page page = new Page();
+ Container left = new Container("left");
+ Container center = new Container("center");
+ page.addContainer(left);
+ page.addContainer(center);
+
+ //Populate the grid windows with proper content
+ List windows = pageResult.getWindows();
+ int counter = 0;
+ for(Iterator itr=windows.iterator();itr.hasNext();)
+ {
+ Window result = (Window)itr.next();
+ Window uiWindow = new Window(result.getId());
+ uiWindow.setContent(result.getContent());
+ switch(counter)
+ {
+ case 0:
+ left.addComponent(uiWindow);
+ break;
+
+ case 1:
+ left.addComponent(uiWindow);
+ break;
+
+ case 2:
+ center.addComponent(uiWindow);
+ break;
+
+ case 3:
+ center.addComponent(uiWindow);
+ break;
+
+ case 4:
+ left.addComponent(uiWindow);
+ break;
+ }
+
+ counter++;
+ }
+
+ RegionLayoutManager layoutManager = new RegionLayoutManager();
+ RegionConstraints leftConstraints = new RegionConstraints("left", RegionConstraints.LEFT);
+ RegionConstraints centerConstraints = new RegionConstraints("center", RegionConstraints.CENTER);
+ layoutManager.addRegionConstraints(leftConstraints);
+ layoutManager.addRegionConstraints(centerConstraints);
+
+ return new Object[]{page, layoutManager};
+ }*/
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/PresentationContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/PresentationContextImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,193 @@
+/******************************************************************************
+ * 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.impl;
+
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIContext;
+import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
+import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
+import org.jboss.portal.presentation.impl.model.AjaxModelListener;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.UIObjectAction;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.server.AbstractServerURL;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.web.ServletContainer;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.web.impl.DefaultServletContainerFactory;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ */
+public class PresentationContextImpl implements PresentationContext
+{
+
+ /** . */
+ private ServerInvocation invocation = null;
+
+ /** . */
+ private PresentationServer presentationServer = null;
+
+ /**
+ *
+ * @param presentationServer
+ * @param invocation
+ */
+ public PresentationContextImpl(PresentationServer presentationServer, ServerInvocation invocation)
+ {
+ this.invocation = invocation;
+ this.presentationServer = presentationServer;
+ }
+
+ /**
+ *
+ */
+ public UIContext getUIContext()
+ {
+ HttpSession session = this.invocation.getServerContext().getClientRequest().getSession();
+
+ //Process the UIObjectContainer for this session
+ UIObjectContainer uiObjectContainer = (UIObjectContainer)session.getAttribute(SessionConstants.serverModel);
+ if (uiObjectContainer == null)
+ {
+ NavigationalStateContext nsc = new NavigationalStateContextImpl();
+
+ //
+ uiObjectContainer = new UIObjectContainer(presentationServer.getStructuralStateManager(), nsc);
+
+ session.setAttribute(SessionConstants.serverModel, uiObjectContainer);
+ }
+
+ //
+ return uiObjectContainer.getRoot();
+ }
+
+ /**
+ *
+ * @param request
+ * @return
+ */
+ public AjaxUIContext getAjaxUIContext()
+ {
+ AjaxUIContext uiContext = null;
+
+ HttpServletRequest request = this.invocation.getServerContext().getClientRequest();
+ uiContext = (AjaxUIContext)request.getSession().getAttribute(SessionConstants.ajaxModel);
+ if(uiContext == null)
+ {
+ uiContext = new AjaxUIContext();
+ request.getSession().setAttribute(SessionConstants.ajaxModel, uiContext);
+
+ //Register a ModelListener to perform partial model updates based on receiving events due to
+ //Model State changes
+ this.getUIContext().addModelListener(new AjaxModelListener(this.getAjaxUIContext()));
+ }
+
+ return uiContext;
+ }
+
+ /**
+ *
+ */
+ public ServletContextDispatcher getDispatcher()
+ {
+ ServletContainer container = DefaultServletContainerFactory.getInstance().getServletContainer();
+ return new ServletContextDispatcher(
+ invocation.getServerContext().getClientRequest(),
+ invocation.getServerContext().getClientResponse(),
+ container);
+ }
+
+ /**
+ *
+ * @param action
+ * @return
+ * @throws IllegalArgumentException
+ */
+ public String render(ServerAction action) throws IllegalArgumentException
+ {
+ if (action instanceof UIObjectAction)
+ {
+ UIObjectAction objectAction = (UIObjectAction)action;
+
+ String targetId = objectAction.getTargetId();
+
+ UIObject target = getUIContext().getObject(targetId);
+
+ //
+ if (objectAction instanceof LinkActivation)
+ {
+ //StringBuffer portalRequestPath = new StringBuffer("/invoke");
+ //createPath(target, portalRequestPath);
+
+ StringBuffer portalRequestPath = new StringBuffer();
+ portalRequestPath.append(targetId);
+
+ ServerURL url = new AbstractServerURL();
+ url.setPortalRequestPath(portalRequestPath.toString());
+ LinkActivation linkActivation = (LinkActivation)objectAction;
+ url.getParameterMap().putAll(linkActivation.getQueryParameters());
+ return invocation.getServerContext().renderURL(url, URLContext.newInstance(false, false), URLFormat.newInstance(false, true));
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ /**
+ *
+ * @param object
+ * @param buffer
+ */
+ private static void createPath(UIObject object, StringBuffer buffer)
+ {
+ UIObject parent = object.getParent();
+
+ //
+ if (parent != null)
+ {
+ createPath(parent, buffer);
+
+ //
+ buffer.append('/').append(object.getName());
+ }
+ }
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/SessionConstants.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/SessionConstants.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/SessionConstants.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.impl;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface SessionConstants
+{
+ /**
+ * Represents the session key for storing the server side UI model
+ */
+ public final String serverModel = "serverModel";
+
+ /**
+ * Represents the session key for storing the client side UI model for the Ajax User Agent
+ */
+ public final String ajaxModel = "ajaxModel";
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/GWTClientFilter.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,211 @@
+/******************************************************************************
+ * 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.impl.ajax.entry;
+
+import java.util.Map;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+
+/**
+ * This filter is activated or deactivated depending on whether the Portal needs to runs in Ajax mode or Classic Html mode
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class GWTClientFilter implements Filter
+{
+ /**
+ *
+ */
+ public void init(FilterConfig arg0) throws ServletException
+ {
+ }
+
+ /**
+ *
+ */
+ public void destroy()
+ {
+ }
+
+ /**
+ *
+ */
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
+ {
+ HttpServletRequest request = (HttpServletRequest)servletRequest;
+ HttpServletResponse response = (HttpServletResponse)servletResponse;
+ String contextPath = request.getContextPath();
+
+ //Extract the resource that is being accessed
+ String resource = request.getRequestURI().replaceFirst(contextPath, "");
+ while(resource.startsWith("/"))
+ {
+ if(resource.length() > 1)
+ {
+ resource = resource.substring(1);
+ }
+ else
+ {
+ resource = "";
+ }
+ }
+
+ if(resource == null || resource.trim().length() == 0)
+ {
+ response.sendRedirect("index.html");
+ return;
+ }
+
+ //Now make sure the resource requested is a GWT resource
+ if( resource.equals("index.html") ||
+ resource.equals("portal.css") ||
+ resource.equals("mygwt-all.css") ||
+ resource.equals("mygwt-all-gray.css") ||
+ resource.equals("gwt.js") ||
+ resource.equals("prototype.js") ||
+ resource.contains(".cache.") ||
+ resource.contains(".nocache.") ||
+ resource.contains(".gwt.rpc") ||
+ resource.contains("images/default") ||
+ resource.contains("images/gray")
+ )
+ {
+ byte[] gwtResource = this.readContent(resource);
+ response.getOutputStream().write(gwtResource);
+ response.getOutputStream().flush();
+ return;
+ }
+
+
+ String method = request.getMethod();
+ String url = request.getRequestURL().toString();
+ String targetId = this.parseTargetId(url);
+ Map queryParameters = new HashMap();
+ Enumeration paramNames = request.getParameterNames();
+ if(paramNames != null)
+ {
+ while(paramNames.hasMoreElements())
+ {
+ String name = (String)paramNames.nextElement();
+ String value = (String)request.getParameter(name);
+ queryParameters.put(name, new String[]{value});
+ }
+ }
+ if(method.equalsIgnoreCase("get"))
+ {
+ GetActivation get = new GetActivation(targetId, queryParameters);
+ request.getSession().setAttribute("serverAction", get);
+ }
+ else
+ {
+ PostActivation post = new PostActivation(targetId, queryParameters, null);
+ request.getSession().setAttribute("serverAction", post);
+ }
+
+
+ response.sendRedirect(contextPath+"/"+"index.html");
+ }
+
+ /**
+ *
+ * @param path
+ * @return
+ */
+ private byte[] readContent(String path)
+ {
+ byte[] content = null;
+
+ InputStream is = null;
+ ByteArrayOutputStream bos = null;
+ try
+ {
+ bos = new ByteArrayOutputStream();
+ is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
+ int bytesRead = 0;
+ byte[] data = new byte[1024];
+ while((bytesRead=is.read(data)) != -1)
+ {
+ byte[] cour = new byte[bytesRead];
+ System.arraycopy(data, 0, cour, 0, bytesRead);
+ bos.write(cour);
+ bos.flush();
+ }
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ if(is != null)
+ {
+ try{is.close();}catch(Exception e){}
+ }
+ if(bos != null)
+ {
+ content = bos.toByteArray();
+ try{bos.close();}catch(Exception e){}
+ }
+ }
+
+ return content;
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private String parseTargetId(String url)
+ {
+ String targetId = null;
+
+ int fromIndex = 0; //hard coding the portal deployment context for now
+ fromIndex = url.indexOf("presentation") != -1 ? url.indexOf("presentation") + "presentation".length() : 0;
+ targetId = url.indexOf('?') != -1 ? url.substring(fromIndex, url.indexOf('?')):url.substring(fromIndex);
+
+ //Removes the PATH data if any found
+ if(targetId.indexOf(';')!=-1)
+ {
+ targetId = targetId.substring(0, targetId.indexOf(';'));
+ }
+
+ return targetId;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,344 @@
+package org.jboss.portal.presentation.impl.ajax.entry;
+
+
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.HashMap;
+import java.net.URLDecoder;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.server.RequestControllerFactory;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.server.ServerResponse;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.RequestControllerDispatcher;
+import org.jboss.portal.web.WebRequest;
+
+import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
+import org.jboss.portal.presentation.ajax.client.protocol.AjaxShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * This serves as the Portal Entry Point for AJAX (Asynchronous) RPC calls being made by the
+ * client-side Ajax agent of the Presentation Framework
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortalEntryPoint extends RemoteServiceServlet implements PortalRPC
+{
+ /** The logger. */
+ private Logger log = Logger.getLogger(getClass());
+
+ /**
+ *
+ */
+ private RequestControllerFactory controllerFactory = null;
+
+ /** The interceptor stack. */
+ private InterceptorStackFactory interceptorStack = null;
+
+ /**
+ *
+ */
+ private Server portalServer = null;
+
+
+ /** Configure the as default servlet. */
+ public void init() throws ServletException
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+
+ //Locate the request controller
+ this.controllerFactory = (RequestControllerFactory) MBeanProxy.get(RequestControllerFactory.class, new ObjectName(
+ this.getInitParameter("controllerFactoryName")),
+ mbeanServer);
+
+ //Locate the interceptor stack factory
+ this.interceptorStack = (InterceptorStackFactory) MBeanProxy.get(InterceptorStackFactory.class, new ObjectName(
+ this.getInitParameter("interceptorStackFactoryName")),
+ mbeanServer);
+
+ //Locate the portal server
+ this.portalServer = (Server) MBeanProxy.get(Server.class, new ObjectName(
+ this.getInitParameter("portalServerName")),
+ mbeanServer);
+
+ }
+ catch (Exception e)
+ {
+ this.controllerFactory = null;
+ this.interceptorStack = null;
+ String msg = "Ajax Portal Entry point could not be created";
+ log.error(msg, e);
+ throw new UnavailableException(msg);
+ }
+ }
+ //---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public String processCall(String payload) throws SerializationException
+ {
+ //Perform the remote procedure call
+ String returnVal = super.processCall(payload);
+
+ //Perform any post-processing after calling the actual remote method that will perform
+ //the functionality for this particular remote procedure call
+
+ return returnVal;
+ }
+ // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Asynchronously loads the specified object from the server
+ *
+ * @return The Initial Portal Page
+ */
+ public ClientResponse loadObject(String objectId)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ Object pendingServerAction = request.getSession().getAttribute("serverAction");
+ if(pendingServerAction != null)
+ {
+ request.setAttribute("serverAction", pendingServerAction);
+ request.getSession().removeAttribute("serverAction");
+ }
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ public ClientResponse asyncGet(String url)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Parse the query parameters into a Map of name value pairs
+ Map queryParams = this.parseQueryParams(url);
+
+ //Parse the UIObject target id
+ String targetId = this.parseTargetId(url);
+
+
+ GetActivation get = new GetActivation(targetId, queryParams);
+
+ request.setAttribute("serverAction", get);
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @param body
+ * @return
+ */
+ public ClientResponse asyncPost(String url, String body)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Parse the query parameters into a Map of name value pairs
+ Map queryParams = this.parseQueryParams(url);
+
+ //Parse the UIObject target id
+ String targetId = this.parseTargetId(url);
+
+ //Parse the serialized post body into parameters
+ StringTokenizer st = new StringTokenizer(body, "&");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int equalIndex = token.indexOf('=');
+ String name = token.substring(0, equalIndex);
+ String value = token.substring(equalIndex+1);
+
+ queryParams.put(URLDecoder.decode(name, "UTF-8"), new String[]{URLDecoder.decode(value, "UTF-8")});
+ }
+
+ PostActivation post = new PostActivation(targetId, queryParams, null);
+
+ request.setAttribute("serverAction", post);
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private Map parseQueryParams(String url) throws Exception
+ {
+ Map queryParams = new HashMap();
+
+ if(url.indexOf('?') != -1)
+ {
+ String queryString = url.substring(url.indexOf('?')+1);
+ StringTokenizer st = new StringTokenizer(queryString, "&");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int equalIndex = token.indexOf('=');
+ String name = token.substring(0, equalIndex);
+ String value = token.substring(equalIndex+1);
+
+ queryParams.put(name, new String[]{URLDecoder.decode(value, "UTF-8")});
+ }
+ }
+
+ return queryParams;
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private String parseTargetId(String url)
+ {
+ String targetId = null;
+
+ int fromIndex = 0; //hard coding the portal deployment context for now
+ fromIndex = url.indexOf("presentation") != -1 ? url.indexOf("presentation") + "presentation".length() : 0;
+ targetId = url.indexOf('?') != -1 ? url.substring(fromIndex, url.indexOf('?')):url.substring(fromIndex);
+
+ //Removes the PATH data if any found
+ if(targetId.indexOf(';')!=-1)
+ {
+ targetId = targetId.substring(0, targetId.indexOf(';'));
+ }
+
+ return targetId;
+ }
+
+ /**
+ *
+ *
+ */
+ private void callPortalServer() throws Exception
+ {
+ HttpServletRequest req = this.getThreadLocalRequest();
+ HttpServletResponse resp = this.getThreadLocalResponse();
+ String requestURI = req.getRequestURI();
+ String contextPath = req.getContextPath();
+ String portalHost = req.getServerName();
+ String portalRequestPath = requestURI.substring(contextPath.length());
+ String portalContextPath = requestURI.substring(0, contextPath.length());
+ URLContext urlContext = URLContext.newInstance(req.isSecure(), req.getRemoteUser() != null);
+
+ WebRequest webReq = new WebRequest(req);
+
+ //
+ ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
+ req,
+ resp,
+ webReq,
+ portalHost,
+ portalRequestPath,
+ portalContextPath,
+ urlContext
+ );
+
+ //
+ ServerRequest request = new ServerRequest(invocationCtx);
+ request.setServer(this.portalServer);
+
+ //
+ ServerResponse response = new ServerResponse(request, invocationCtx);
+
+ //
+ ServerInvocation invocation = new ServerInvocation(invocationCtx);
+ invocation.setRequest(request);
+ invocation.setResponse(response);
+
+ //
+ RequestController controller = this.controllerFactory.createRequestController(invocation);
+ invocation.setHandler(new RequestControllerDispatcher(controller));
+
+ invocation.invoke(this.interceptorStack.getInterceptorStack());
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,341 @@
+/******************************************************************************
+ * 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.impl.classic.layout;
+
+import org.apache.log4j.Logger;
+
+import java.io.Serializable;
+
+/**
+ * This layout provides a Flexible Grid for laying out the UI components (which would be Portlet Windows)
+ * inside a flexible coordinates based Grid on a classic HTML page
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class FlexibleGrid implements Serializable
+{
+ private static Logger log = Logger.getLogger(FlexibleGrid.class);
+
+ private FlexibleGridConstraints[] constraints = null;
+
+ private int rows = 0;
+ private int columns = 0;
+
+ /**
+ * Id of the container being laid out inside this grid. This is a required value
+ */
+ private String containerId = null;
+
+ /**
+ * minimumWidth of the grid
+ */
+ private int minimumWidth = 0;
+
+ /**
+ * Float this grid to the left side of the page so that another grid can be placed next to it
+ *
+ * Used for placing multiple grids horizontally on the page
+ */
+ private boolean isFloatLeft = false;
+
+
+ /**
+ *
+ *
+ */
+ public FlexibleGrid(String containerId)
+ {
+ this.containerId = containerId;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public FlexibleGridConstraints[] getConstraints()
+ {
+ return constraints;
+ }
+
+ /**
+ *
+ * @param constraints
+ */
+ public void setConstraints(FlexibleGridConstraints[] constraints)
+ {
+ this.constraints = constraints;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getColumns()
+ {
+ return columns;
+ }
+
+ /**
+ *
+ * @param columns
+ */
+ public void setColumns(int columns)
+ {
+ this.columns = columns;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getRows()
+ {
+ return rows;
+ }
+
+ /**
+ *
+ * @param rows
+ */
+ public void setRows(int rows)
+ {
+ this.rows = rows;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getMinimumWidth()
+ {
+ return minimumWidth;
+ }
+
+
+ /**
+ *
+ * @param minimumWidth
+ */
+ public void setMinimumWidth(int minimumWidth)
+ {
+ this.minimumWidth = minimumWidth;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isFloatLeft()
+ {
+ return isFloatLeft;
+ }
+
+ /**
+ *
+ * @param isFloatLeft
+ */
+ public void setFloatLeft(boolean isFloatLeft)
+ {
+ this.isFloatLeft = isFloatLeft;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getContainerId()
+ {
+ return containerId;
+ }
+
+ /**
+ *
+ * @param containerId
+ */
+ public void setContainerId(String containerId)
+ {
+ this.containerId = containerId;
+ }
+
+ /**
+ * Note: this method is given only package level visibility since it should be used only by the FlexibleGridLayoutManager
+ */
+
+ /**
+ *
+ */
+ /*String doLayout(Container container)
+ {
+ String output = null;
+
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("<div id=\"grid-"+this.containerId+"\">\n");
+
+ buffer.append("<table>\n");
+
+ for(int row=0;row<rows;row++)
+ {
+ buffer.append("<tr>\n");
+
+ for(int column=0;column<columns;column++)
+ {
+ buffer.append("<td>\n");
+
+ buffer.append("<div id=\"grid-"+this.containerId+"-"+row+"-"+column+"\">\n");
+ buffer.append(this.getPortletMarkup(container, row, column));
+ buffer.append("</div>\n");
+
+ buffer.append("</td>\n");
+ }
+
+ buffer.append("</tr>\n");
+ }
+
+ buffer.append("</table>\n");
+
+ buffer.append("</div>\n");
+
+
+ output = buffer.toString();
+
+ return output;
+ }*/
+
+
+ /**
+ *
+ * @param container
+ * @return
+ */
+ /*String generateInlineStyle(Container container)
+ {
+ String style = null;
+
+ StringBuffer buffer = new StringBuffer();
+
+ for(int row=0;row<this.rows;row++)
+ {
+ for(int column=0;column<this.columns;column++)
+ {
+ String cellStyle = this.getCellStyle(row, column);
+ if(cellStyle != null && cellStyle.trim().length()>0)
+ {
+ buffer.append(cellStyle);
+ }
+ }
+ }
+
+ style = buffer.toString();
+
+ return style;
+ }*/
+
+ /**
+ *
+ * @param row
+ * @param column
+ * @return
+ */
+ /*String getCellStyle(int row, int column)
+ {
+ String style = null;
+
+ if(this.constraints != null)
+ {
+ for(int i=0;i<this.constraints.length;i++)
+ {
+ FlexibleGridConstraints constraint = this.constraints[i];
+ if(constraint.getRow() == row && constraint.getColumn() == column)
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ //Generate the layout style to be used for this cell
+ buffer.append("#grid-"+this.containerId+"-"+row+"-"+column+"{float: left; margin: 0px; padding: 0px; width: "+constraint.getWidthPercentage()+"%; position: relative;");
+
+ if(constraint.getTop() > 0)
+ {
+ buffer.append(" top: "+String.valueOf(constraint.getTop())+"%;");
+ }
+
+ if(constraint.getBottom() > 0)
+ {
+ buffer.append(" bottom: "+String.valueOf(constraint.getBottom())+"%;");
+ }
+
+ if(constraint.getLeft() > 0)
+ {
+ buffer.append(" left: "+String.valueOf(constraint.getLeft())+"%;");
+ }
+
+ if(constraint.getRight() > 0)
+ {
+ buffer.append(" right: "+String.valueOf(constraint.getRight())+"%;");
+ }
+
+ buffer.append("}\n");
+
+ style = buffer.toString();
+
+ return style;
+ }
+ }
+
+ //If we get here....need to use a spacer for this cell
+ int minWidth = 770/this.columns;
+ style = "#grid-"+this.containerId+"-"+row+"-"+column+"{float: left; line-height: 0px; font-size: 0px; min-width: "+minWidth+"px; height: "+minWidth+"px;}\n";
+ }
+
+ return style;
+ }*/
+
+ /**
+ *
+ * @param row
+ * @param column
+ * @return
+ */
+ /*private String getPortletMarkup(Container container,int row,int column)
+ {
+ String markup = "";
+
+ if(this.constraints != null)
+ {
+ for(int i=0;i<this.constraints.length;i++)
+ {
+ FlexibleGridConstraints constraint = this.constraints[i];
+
+ if(constraint.getRow() == row && constraint.getColumn() == column)
+ {
+ String componentId = constraint.getComponentId();
+ Window window = (Window)container.getComponent(componentId);
+ markup = window.getMarkup();
+ }
+
+ }
+ }
+
+ return markup;
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,234 @@
+/******************************************************************************
+ * 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.impl.classic.layout;
+
+import java.io.Serializable;
+
+/**
+ * The FlexibleGridConstraints class specifies constraints for components that are laid out using the FlexibleGrid layout manager.
+ *
+ * These constraints apply to an instance of a UIComponent being laid out inside the given cell of the FlexibleGrid
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class FlexibleGridConstraints implements Serializable
+{
+ /**
+ * Unique Id of the component that these constraints should be applied to
+ */
+ private String componentId = null;
+
+ /**
+ * width in percentage that this component should occupy in the grid
+ */
+ private String widthPercentage = null;
+
+ /**
+ * top position of the component inside a grid cell.
+ * Value calculated in percentage. A positive value moves the component downwards and vice versa
+ */
+ private int top = 0;
+
+ /**
+ * bottom position of the component inside a grid cell.
+ * Value calculated in percentage. A positive value moves the component upwards and vice versa
+ */
+ private int bottom = 0;
+
+ /**
+ * left position of the component inside a grid cell.
+ * Value calculated in percentage. A positive value moves the component to the right and vice versa
+ */
+ private int left = 0;
+
+ /**
+ * right position of the component inside a grid cell.
+ * Value calculated in percentage. A positive value moves the component to the left and vice versa
+ */
+ private int right = 0;
+
+ /**
+ * row in the grid where this component should be placed
+ */
+ private int row = 0;
+
+ /**
+ * column in the grid where this component should be placed
+ */
+ private int column = 0;
+
+
+ /**
+ *
+ *
+ */
+ public FlexibleGridConstraints()
+ {
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getColumn()
+ {
+ return column;
+ }
+
+ /**
+ *
+ * @param column
+ */
+ public void setColumn(int column)
+ {
+ this.column = column;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getComponentId()
+ {
+ return componentId;
+ }
+
+ /**
+ *
+ * @param componentId
+ */
+ public void setComponentId(String componentId)
+ {
+ this.componentId = componentId;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getRow()
+ {
+ return row;
+ }
+
+ /**
+ *
+ * @param row
+ */
+ public void setRow(int row)
+ {
+ this.row = row;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getWidthPercentage()
+ {
+ return widthPercentage;
+ }
+
+ /**
+ *
+ * @param widthPercentage
+ */
+ public void setWidthPercentage(String widthPercentage)
+ {
+ this.widthPercentage = widthPercentage;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getBottom()
+ {
+ return bottom;
+ }
+
+ /**
+ *
+ * @param bottom
+ */
+ public void setBottom(int bottom)
+ {
+ this.bottom = bottom;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getLeft()
+ {
+ return left;
+ }
+
+ /**
+ *
+ * @param left
+ */
+ public void setLeft(int left)
+ {
+ this.left = left;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getRight()
+ {
+ return right;
+ }
+
+ /**
+ *
+ * @param right
+ */
+ public void setRight(int right)
+ {
+ this.right = right;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getTop()
+ {
+ return top;
+ }
+
+ /**
+ *
+ * @param top
+ */
+ public void setTop(int top)
+ {
+ this.top = top;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,184 @@
+/******************************************************************************
+ * 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.impl.classic.layout;
+
+import org.jboss.portal.presentation.layout.LayoutManager;
+
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * This layout manager provides a Flexible Grid for laying out the UI components (which would be Portlet Windows)
+ * inside a flexible coordinates based Grid on a classic HTML page
+ *
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class FlexibleGridLayoutManager implements LayoutManager
+{
+ /**
+ * A list of array of flexible grids. Each element of this list is an array of
+ * flexible grid objects that needs to be laid out horizontally from left to right
+ * on the page. This array of FlexibleGrid objects can also be thought of as a row of
+ * FlexibleGrid objects
+ *
+ * The grids are laid out in the order they are added to this list
+ */
+ private List pageGrids = null;
+
+ /**
+ *
+ *
+ */
+ public FlexibleGridLayoutManager()
+ {
+ this.pageGrids = new ArrayList();
+ }
+
+ /**
+ *
+ * @param grids
+ */
+ public void addRowOfGrids(FlexibleGrid[] grids)
+ {
+ this.pageGrids.add(grids);
+ }
+
+
+ /**
+ *
+ */
+ /*public String doLayout(Page page)
+ {
+ String layoutOutput = "";
+
+ StringBuffer buffer = new StringBuffer();
+
+ if(this.pageGrids != null)
+ {
+ for(int i=0;i<this.pageGrids.size();i++)
+ {
+ FlexibleGrid[] grids = (FlexibleGrid[])this.pageGrids.get(i);
+ Container[] containers = this.findContainers(page, grids);
+
+ buffer.append(this.generateInlineStyle(grids, containers));
+
+ for(int gridCounter=0;gridCounter<grids.length;gridCounter++)
+ {
+ FlexibleGrid grid = grids[gridCounter];
+ Container container = containers[gridCounter];
+
+ buffer.append(grid.doLayout(container));
+ }
+
+ }
+ }
+
+ layoutOutput = buffer.toString();
+
+ return layoutOutput;
+ }*/
+
+ /**
+ *
+ * @param page
+ * @param grids
+ * @return
+ */
+ /*private Container[] findContainers(Page page, FlexibleGrid[] grids)
+ {
+ Container[] containers = null;
+
+ containers = new Container[grids.length];
+ List allContainers = page.getContainers();
+
+ //Find containers from the page associated with each grid instance in the array of grids
+ for(int gridCount=0; gridCount<grids.length ; gridCount++)
+ {
+ FlexibleGrid grid = grids[gridCount];
+ String containerId = grid.getContainerId();
+
+ //Look for a container inside the page whose id matches the containerId that
+ //the grid is associated with
+ for(int containerCount=0; containerCount < allContainers.size(); containerCount++)
+ {
+ Container container = (Container)allContainers.get(containerCount);
+
+ if(container.getId().equals(containerId))
+ {
+ containers[gridCount] = container;
+ break;
+ }
+ }
+ }
+
+ return containers;
+ }*/
+
+ /**
+ *
+ * @param grids
+ * @param containers
+ * @return
+ */
+ /*private String generateInlineStyle(FlexibleGrid[] grids,Container[] containers)
+ {
+ String inlineStyle = null;
+
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("<style type=\"text/css\">\n");
+
+ for(int gridCounter=0;gridCounter<grids.length;gridCounter++)
+ {
+ FlexibleGrid grid = grids[gridCounter];
+ Container container = containers[gridCounter];
+
+ buffer.append("#grid-"+grid.getContainerId()+"{text-align: left; position: relative;");
+
+ if(grid.getMinimumWidth() > 0)
+ {
+ buffer.append(" min-width: "+String.valueOf(grid.getMinimumWidth())+"px;");
+ }
+
+ if(gridCounter == 0 && grids.length > 1)
+ {
+ buffer.append(" float: left;");
+ }
+
+ buffer.append("}\n");
+
+ //Now generate the styles for each individual cell of the grid which will hold
+ //the components of this container
+ buffer.append(grid.generateInlineStyle(container));
+ }
+
+ buffer.append("</style>\n");
+
+ inlineStyle = buffer.toString();
+
+ return inlineStyle;
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * 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.impl.classic.layout;
+
+import java.io.Serializable;
+
+/**
+ * The RegionConstraints class specifies constraints for containers that are laid out using the Region based layout manager.
+ *
+ * These constraints apply to an instance of a Container and its placement as its laid out within a specified region on the Page
+ *
+ * When the Container is placed, all its Components (which are Windows) are laid out vertically inside the Region
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class RegionConstraints implements Serializable
+{
+ public static final int LEFT = 1;
+ public static final int CENTER = 2;
+ public static final int RIGHT = 3;
+
+ /**
+ * Unique Id of the container that these constraints should be applied to
+ */
+ private String containerId = null;
+
+ /**
+ * Type of region where the component should be added
+ *
+ * makes it belong to LEFT region by default
+ */
+ private int type = 1;
+
+ /**
+ *
+ * @param containerId
+ * @param type
+ */
+ public RegionConstraints(String containerId, int type)
+ {
+ this.containerId = containerId;
+ this.type = type;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getContainerId()
+ {
+ return containerId;
+ }
+
+ /**
+ *
+ * @param containerId
+ */
+ public void setContainerId(String containerId)
+ {
+ this.containerId = containerId;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getType()
+ {
+ return type;
+ }
+
+ /**
+ *
+ * @param type
+ */
+ public void setType(int type)
+ {
+ this.type = type;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * 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.impl.classic.layout;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.portal.presentation.layout.LayoutManager;
+
+/**
+ * This layout manager splits the page up into Regions. Containers which contain the Portlet Windows
+ * are then laid out vertically inside each Region.
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class RegionLayoutManager implements LayoutManager
+{
+ /**
+ *
+ */
+ private List regionConstraints = null;
+
+ /**
+ *
+ *
+ */
+ public RegionLayoutManager()
+ {
+ this.regionConstraints = new ArrayList();
+ }
+
+ /**
+ *
+ * @param constraints
+ */
+ public void addRegionConstraints(RegionConstraints constraints)
+ {
+ this.regionConstraints.add(constraints);
+ }
+
+ /**
+ *
+ */
+ /*public String doLayout(Page page)
+ {
+ String output = null;
+
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("<div id=\"portal-container\">\n");
+
+ //Perform layout of the containers on this page
+ Container leftContainer = this.findContainerByRegion(RegionConstraints.LEFT, page);
+ Container centerContainer = this.findContainerByRegion(RegionConstraints.CENTER, page);
+ Container rightContainer = this.findContainerByRegion(RegionConstraints.RIGHT, page);
+
+ if(leftContainer != null)
+ {
+ buffer.append(this.layoutRegion(RegionConstraints.LEFT, leftContainer));
+ }
+
+ if(centerContainer != null)
+ {
+ buffer.append(this.layoutRegion(RegionConstraints.CENTER, centerContainer));
+ }
+
+ if(rightContainer != null)
+ {
+ buffer.append(this.layoutRegion(RegionConstraints.RIGHT, rightContainer));
+ }
+
+ buffer.append("</div>\n");
+
+ output = buffer.toString();
+
+ return output;
+ }*/
+
+ /**
+ *
+ * @param regionType
+ * @param page
+ * @return
+ */
+ /*private Container findContainerByRegion(int regionType, Page page)
+ {
+ Container container = null;
+
+ for(int containerCtr=0; containerCtr<page.getContainers().size(); containerCtr++)
+ {
+ Container cour = (Container)page.getContainers().get(containerCtr);
+
+ for(int constraintCtr=0; constraintCtr<this.regionConstraints.size(); constraintCtr++)
+ {
+ RegionConstraints constraints = (RegionConstraints)this.regionConstraints.get(constraintCtr);
+
+ if(constraints.getContainerId() == cour.getId() && constraints.getType() == regionType)
+ {
+ container = cour;
+ break;
+ }
+ }
+
+ if(container != null)
+ {
+ break;
+ }
+ }
+
+ return container;
+ }*/
+
+ /**
+ *
+ * @param regionType
+ * @param container
+ */
+ /*private String layoutRegion(int regionType, Container container)
+ {
+ String output = null;
+
+ StringBuffer buffer = new StringBuffer();
+
+ switch(regionType)
+ {
+ case RegionConstraints.LEFT:
+ buffer.append("<div id=\"regionA\">\n");
+ break;
+
+ case RegionConstraints.CENTER:
+ buffer.append("<div id=\"regionB\">\n");
+ break;
+
+ case RegionConstraints.RIGHT:
+ buffer.append("<div id=\"regionC\">\n");
+ break;
+
+ default:
+ buffer.append("<div id=\"regionA\">\n");
+ break;
+ }
+
+ for(int i=0; i<container.getComponents().size(); i++)
+ {
+ Window window = (Window)container.getComponents().get(i);
+
+ buffer.append("<div class=\"portlet-container\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"portlet-titlebar-left\"></td><td class=\"portlet-titlebar-center\"><div class=\"portlet-titlebar-decoration\"></div><span class=\"portlet-titlebar-title\"></span><div class=\"portlet-mode-container\"><span title=\"minimized\"><a class=\"portlet-mode-minimized\" href=\"\"> </a></span><span title=\"maximized\"><a class=\"portlet-mode-maximized\" href=\"\"> </a></span></div></td><td class=\"portlet-titlebar-right\"></td></tr><tr><td class=\"portlet-content-left\"></td><td class=\"portlet-body\"><div class=\"portlet-content-center\">\n");
+
+ buffer.append(window.getMarkup());
+
+ buffer.append("</div></td><td class=\"portlet-content-right\"></td></tr><tr><td class=\"portlet-footer-left\"></td><td class=\"portlet-footer-center\"></td><td class=\"portlet-footer-right\"></td></tr></table></div>\n\n\n\n");
+ }
+
+ buffer.append("</div>\n\n\n\n");
+ output = buffer.toString();
+
+ return output;
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/AjaxModelListener.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/AjaxModelListener.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/AjaxModelListener.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.impl.model;
+
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIContext;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.model.ModelEvent;
+import org.jboss.portal.presentation.model.ModelListener;
+import org.jboss.portal.presentation.model.event.state.StateChangeEvent;
+import org.jboss.portal.presentation.model.event.state.StateChange;
+import org.jboss.portal.presentation.model.event.state.StateModification;
+import org.jboss.portal.presentation.model.event.state.navigational.NavigationalStateModification;
+import org.jboss.portal.presentation.model.event.state.structural.StructuralStateModification;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class AjaxModelListener implements ModelListener
+{
+ private AjaxUIContext ajaxUiContext = null;
+
+ /**
+ *
+ * @param uiContext
+ */
+ public AjaxModelListener(AjaxUIContext ajaxUiContext)
+ {
+ this.ajaxUiContext = ajaxUiContext;
+ }
+
+ /**
+ *
+ */
+ public void onEvent(ModelEvent event)
+ {
+ if(event instanceof StateChangeEvent)
+ {
+ StateChangeEvent stateChangeEvent = (StateChangeEvent)event;
+ StateChange stateChange = stateChangeEvent.getChange();
+ StateModification modification = stateChange.getModification();
+ if(modification instanceof NavigationalStateModification)
+ {
+ NavigationalStateModification navMod = (NavigationalStateModification)modification;
+ if(this.ajaxUiContext != null)
+ {
+ AjaxUIObject ajaxUiObject = this.ajaxUiContext.getObject(stateChange.getTargetId());
+ if(ajaxUiObject != null)
+ {
+ ajaxUiObject.setStatus(AjaxUIObject.STATUS_STALE);
+ }
+ }
+ }
+ else if(modification instanceof StructuralStateModification)
+ {
+ StructuralStateModification structMod = (StructuralStateModification)modification;
+
+ /**
+ * TODO: Process Structural State Modifications
+ */
+ }
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContainerImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.impl.model;
+
+import org.jboss.portal.presentation.model.UIContainer;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIContainerImpl extends UIObjectImpl implements UIContainer
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContextImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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.impl.model;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.ModelListener;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIContextImpl extends UIObjectImpl implements UIContext
+{
+
+ public UIContextImpl()
+ {
+ }
+
+ public UIObject getObject(String id)
+ {
+ return context.getObject(id);
+ }
+
+ public void addModelListener(ModelListener listener)
+ {
+ context.addModelListener(listener);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,141 @@
+/******************************************************************************
+ * 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.impl.model;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.StateType;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.impl.model.container.spi.UIContainerObject;
+import org.jboss.portal.presentation.impl.model.container.spi.UIObjectContext;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class UIObjectImpl implements UIContainerObject
+{
+
+ /** . */
+ protected UIObjectContext context;
+
+ //
+ public UIObjectContext getContext()
+ {
+ return context;
+ }
+
+ public void setContext(UIObjectContext context)
+ {
+ this.context = context;
+ }
+
+ //
+
+ public String getId()
+ {
+ return context.getManagedObject().getId();
+ }
+
+ public Status getStatus()
+ {
+ return context.getManagedObject().getStatus();
+ }
+
+ public void validate(Visitor scope)
+ {
+ context.getManagedObject().validate(scope);
+ }
+
+ public void validate()
+ {
+ context.getManagedObject().validate();
+ }
+
+ public void refresh(Visitor scope)
+ {
+ context.getManagedObject().refresh(scope);
+ }
+
+ public void refresh()
+ {
+ context.getManagedObject().refresh();
+ }
+
+ public <T> T getProperty(StateType stateType, String propertyName, Class<T> propertyType)
+ {
+ return context.getManagedObject().getProperty(stateType, propertyName, propertyType);
+ }
+
+ public Object getProperty(StateType stateType, String propertyName)
+ {
+ return context.getManagedObject().getProperty(stateType, propertyName);
+ }
+
+ public <T> void setProperty(StateType stateType, String propertyName, T propertyValue) throws StateChangeVetoException
+ {
+ context.getManagedObject().setProperty(stateType, propertyName, propertyValue);
+ }
+
+ public UIObject getChild(String name)
+ {
+ return context.getManagedObject().getChild(name);
+ }
+
+ public String getName()
+ {
+ return context.getManagedObject().getName();
+ }
+
+ public UIObject getParent()
+ {
+ return context.getManagedObject().getParent();
+ }
+
+ public Collection<? extends UIObject> getChildren()
+ {
+ return context.getManagedObject().getChildren();
+ }
+
+ public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
+ {
+ return context.getManagedObject().createChild(name, type);
+ }
+
+ public void destroyChild(String name) throws IllegalArgumentException, StateException
+ {
+ context.getManagedObject().destroyChild(name);
+ }
+
+ public void move(UIObject destination) throws IllegalArgumentException, StateException
+ {
+ context.getManagedObject().move(destination);
+ }
+
+ public String toString()
+ {
+ return context.getManagedObject().toString();
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPageImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPageImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.impl.model;
+
+import org.jboss.portal.presentation.model.UIPage;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIPageImpl extends UIObjectImpl implements UIPage
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPortalImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.impl.model;
+
+import org.jboss.portal.presentation.model.UIPortal;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIPortalImpl extends UIObjectImpl implements UIPortal
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIWindowImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * 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.impl.model;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.presentation.model.StateType;
+import org.jboss.portal.presentation.model.UIWindow;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIWindowImpl extends UIObjectImpl implements UIWindow
+{
+
+ /**
+ *
+ */
+ public Mode getMode()
+ {
+ return getProperty(StateType.NAVIGATIONAL, "mode", Mode.class);
+ }
+
+ /**
+ *
+ */
+ public WindowState getWindowState()
+ {
+ return getProperty(StateType.NAVIGATIONAL, "windowstate", WindowState.class);
+ }
+
+ /**
+ *
+ */
+ public void setMode(Mode mode)
+ {
+ setProperty(StateType.NAVIGATIONAL, "mode", mode);
+ }
+
+ /**
+ *
+ */
+ public void setWindowState(WindowState windowState)
+ {
+ setProperty(StateType.NAVIGATIONAL, "windowstate", windowState);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ManagedObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ManagedObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ManagedObject.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,419 @@
+/******************************************************************************
+ * 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.impl.model.container;
+
+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;
+import org.jboss.portal.presentation.model.event.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.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.impl.model.container.spi.UIContainerObject;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Collection;
+import java.io.StringWriter;
+import java.io.PrintWriter;
+
+/**
+ * Implement base fonctionnality of the <code>UIObject</code> interface.
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ */
+final class ManagedObject implements UIObject
+{
+
+ /** . */
+ private static final Map<String, String> EMPTY_STATE = Collections.emptyMap();
+
+ /** The context. */
+ protected final ObjectContext context;
+
+ public ManagedObject(ObjectContext context)
+ {
+ if (context == null)
+ {
+ throw new IllegalArgumentException("No null context accepted");
+ }
+
+ //
+ this.context = context;
+ }
+
+ // UIObject interface implementation --------------------------------------------------------------------------------
+
+ public final String getId()
+ {
+ return context.structuralObject.getId();
+ }
+
+ /**
+ * Attempt to cast the value argument to the provided type argument. If the value argument type is assignable
+ * to the provided type, the value is returned, otherwise if it is not or the value is null, null is returned.
+ *
+ * todo: Move that to common package.
+ *
+ * @param value the value to cast
+ * @param type the type to downcast
+ * @return the casted value or null
+ */
+ private <T> T safeCast(Object value, Class<T> type)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ else
+ {
+ if (type.isAssignableFrom(value.getClass()))
+ {
+ return type.cast(value);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ public final Status getStatus()
+ {
+ return context.status;
+ }
+
+ protected final boolean isModifiable()
+ {
+ return true;
+ }
+
+ public void validate(Visitor scope)
+ {
+ context.container.validate(context.containerObject, scope);
+ }
+
+ public final void validate()
+ {
+ refresh(SINGLE_NODE_VISITOR);
+ }
+
+ public void refresh(Visitor scope)
+ {
+ context.container.refresh(context.containerObject, scope);
+ }
+
+ public final void refresh()
+ {
+ refresh(SINGLE_NODE_VISITOR);
+ }
+
+ public <T> T getProperty(StateType stateType, String propertyName, Class<T> propertyType)
+ {
+ context.checkAccess();
+
+ //
+ if (stateType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ Object value;
+ switch (stateType)
+ {
+ case NAVIGATIONAL:
+ value = context.container.navigationalStateContext.get(getId(), propertyName);
+ break;
+ case STRUCTURAL:
+ value = context.structuralObject.getState().getProperties().get(propertyName);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ return safeCast(value, propertyType);
+ }
+
+ public final Object getProperty(StateType stateType, String propertyName)
+ {
+ return getProperty(stateType, propertyName, Object.class);
+ }
+
+ public final <T> void setProperty(StateType stateType, String propertyName, T propertyValue) throws StateChangeVetoException
+ {
+ context.checkAccess();
+
+ //
+ if (stateType == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!isModifiable())
+ {
+ throw new IllegalStateException("Cannot change state");
+ }
+
+ //
+ String id = getId();
+
+ //
+ switch (stateType)
+ {
+ case NAVIGATIONAL:
+ {
+ // Have context process the change
+ context.container.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.container.fireEvent(event);
+ break;
+ }
+ case STRUCTURAL:
+ {
+ if (propertyValue instanceof String)
+ {
+ Map<String, String> changes = new HashMap<String, String>();
+ changes.put(propertyName, (String)propertyValue);
+
+ // Have context process change
+ try
+ {
+ StructuralObject.Update update = context.container.structuralStateContext.update(context.structuralObject, changes);
+
+ //
+ context.container.update(update);
+ }
+ catch (StateException e)
+ {
+ validate();
+
+ //
+ throw e;
+ }
+ }
+ else
+ {
+ throw new StateChangeVetoException("Structural property value must be string value");
+ }
+ break;
+ }
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ public final UIContainerObject getChild(String name)
+ {
+ context.checkAccess();
+
+ //
+ if (name == null)
+ {
+ throw new IllegalArgumentException("No null name accepted");
+ }
+
+ //
+ Collection<UIContainerObject> children = getChildren();
+ for (UIContainerObject child : children)
+ {
+ String childName = child.getName();
+ if(childName == null)
+ {
+ String id = child.getId();
+ childName = id.substring(id.lastIndexOf('/')+1);
+ }
+
+ if (childName.equals(name))
+ {
+ return child;
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public final String getName()
+ {
+ context.checkAccess();
+
+ //
+ return context.structuralObject.getState().getName();
+ }
+
+ public final UIObject getParent()
+ {
+ context.checkAccess();
+
+ //
+ return context.relationshipContext.parent.getRelated();
+ }
+
+ public final Collection<UIContainerObject> getChildren()
+ {
+ context.checkAccess();
+
+ //
+ return context.relationshipContext.children.getRelateds();
+ }
+
+ public final <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
+ {
+ context.checkAccess();
+
+ //
+ if (!isModifiable())
+ {
+ throw new IllegalStateException("Cannot change state");
+ }
+
+ //
+ StructuralObject.Creation creation;
+ try
+ {
+ creation = context.container.structuralStateContext.create(context.structuralObject, type, name, EMPTY_STATE);
+ }
+ catch (StateException e)
+ {
+ context.updateStatus(e);
+
+ //
+ throw e;
+ }
+
+ //
+ context.container.update(creation);
+
+ //
+ StructuralObject child = creation.getChild();
+
+ //
+ return type.cast(context.getObject(child.getId()));
+ }
+
+ public final void destroyChild(String name) throws IllegalArgumentException, StateException
+ {
+ context.checkAccess();
+
+ //
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (!isModifiable())
+ {
+ throw new IllegalStateException("Cannot change state");
+ }
+
+ // Get the named child
+ UIContainerObject namedChild = getChild(name);
+
+ //
+ if (namedChild == null)
+ {
+ throw new IllegalArgumentException("No such child with name " + name);
+ }
+
+ // Destroy the child
+ StructuralObject.Destruction destruction = context.container.structuralStateContext.destroy(((ObjectContext)namedChild.getContext()).structuralObject);
+
+ //
+ context.container.update(destruction);
+ }
+
+ public final void move(UIObject destination) throws IllegalArgumentException, StateException
+ {
+ context.checkAccess();
+
+ //
+ if (destination == null)
+ {
+ throw new IllegalArgumentException("No null object accepted");
+ }
+ if (!isModifiable())
+ {
+ throw new IllegalStateException("Cannot change state");
+ }
+
+ //
+ if (destination instanceof UIContainerObject)
+ {
+ //
+ UIContainerObject tmp = (UIContainerObject)destination;
+
+ // Perform the move operation
+ StructuralObject.Move move = context.container.structuralStateContext.move(context.structuralObject, ((ObjectContext)tmp.getContext()).structuralObject);
+
+ //
+ context.container.update(move);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Object not of right type");
+ }
+ }
+
+ /**
+ * Visitor that visits a single node only.
+ */
+ private static final Visitor SINGLE_NODE_VISITOR = new Visitor()
+ {
+ public boolean enterObject(UIObject object)
+ {
+ return true;
+ }
+
+ public void leaveObject(UIObject object)
+ {
+ }
+
+ public boolean enterChildren(UIObject object, boolean loaded)
+ {
+ return false;
+ }
+ };
+
+ public String toString()
+ {
+ StructuralObject so = context.structuralObject;
+ StructuralState st = so.getState();
+ return "UIObject[id=" + so.getId() + ",name=" + st.getName() + ",type=" + st.getType().getSimpleName() + ",id=" + hashCode() + "]";
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ObjectContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/ObjectContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,159 @@
+/******************************************************************************
+ * 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.impl.model.container;
+
+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.StateException;
+import org.jboss.portal.presentation.model.state.NoSuchStateException;
+import org.jboss.portal.presentation.model.state.StaleStateException;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.ModelListener;
+import org.jboss.portal.presentation.impl.model.container.spi.UIObjectContext;
+import org.jboss.portal.presentation.impl.model.container.spi.UIContainerObject;
+
+/**
+ * The internal state of an object.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+final class ObjectContext implements UIObjectContext
+{
+
+ /** We keep a ref to the container. */
+ final UIObjectContainer container;
+
+ /** The managed object. */
+ final UIContainerObject containerObject;
+
+ /** . */
+ final ManagedObject managedObject;
+
+ /** The associations. */
+ RelationshipContext relationshipContext;
+
+ /** What we know from the structural context. */
+ StructuralObject structuralObject;
+
+ /** The status related to the structural object value. */
+ UIObject.Status status;
+
+ ObjectContext(
+ UIObjectContainer container,
+ UIContainerObject containerObject,
+ StructuralObject structuralObject)
+ {
+ if (container == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (structuralObject == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.container = container;
+ this.containerObject = containerObject;
+ this.structuralObject = structuralObject;
+ this.status = UIObject.Status.VALID;
+ this.managedObject = new ManagedObject(this);
+ }
+
+ // Public ***********************************************************************************************************
+
+ public UIObject getManagedObject()
+ {
+ return managedObject;
+ }
+
+ public UIObject getObject(String id)
+ {
+ return container.getObject(id);
+ }
+
+ public void addModelListener(ModelListener listener)
+ {
+ container.addModelListener(listener);
+ }
+
+ //
+
+ void checkAccess() throws NoSuchStateException, StaleStateException
+ {
+ switch (status)
+ {
+ case VALID:
+ break;
+ case INVALID:
+ throw new NoSuchStateException();
+ case STALE:
+ throw new StaleStateException();
+ }
+ }
+
+ StructuralState getState()
+ {
+ return structuralObject.getState();
+ }
+
+ UIContext getRoot()
+ {
+ return container.root;
+ }
+
+ UIObject.Status getStatus()
+ {
+ return status;
+ }
+
+ boolean isValid()
+ {
+ return status == UIObject.Status.VALID;
+ }
+
+ // Package protected ************************************************************************************************
+
+ void updateStatus(StateException e)
+ {
+ if (e instanceof NoSuchStateException)
+ {
+ status = UIObject.Status.INVALID;
+ }
+ else if (e instanceof StaleStateException)
+ {
+ status = UIObject.Status.STALE;
+ }
+ else
+ {
+ throw new AssertionError(e);
+ }
+ }
+
+ public String toString()
+ {
+ return "UIObjectContext[" + structuralObject.getId() + "]";
+ }
+}
\ No newline at end of file
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,638 @@
+/******************************************************************************
+ * 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.impl.model.container;
+
+import org.jboss.portal.presentation.impl.model.container.spi.UIContainerObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.event.lifecycle.RelationshipAddedEvent;
+import org.jboss.portal.presentation.model.event.lifecycle.RelationshipRemovedEvent;
+
+import java.util.Iterator;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collection;
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+final class RelationshipContext
+{
+
+ /** The owner of the relationship. */
+ ObjectContext owner;
+
+ /** The many to one relationship that make an object reference its parent. */
+ final ManyToOne parent = new ManyToOne()
+ {
+ protected StructuralObject doLoad()
+ {
+ return owner.container.structuralStateContext.loadParent(owner.structuralObject);
+ }
+ protected ObjectContext getOwner()
+ {
+ return owner;
+ }
+ protected OneToMany getOneToMany(UIContainerObject related)
+ {
+ return ((ObjectContext)related.getContext()).relationshipContext.children;
+ }
+ };
+
+ /** The one to many relationship that makes an object reference its children. */
+ final OneToMany children = new OneToMany()
+ {
+ protected Collection<StructuralObject> doLoad()
+ {
+ return owner.container.structuralStateContext.loadChildren(owner.structuralObject);
+ }
+ protected ObjectContext getOwner()
+ {
+ return owner;
+ }
+ protected ManyToOne getManyToOne(UIContainerObject related)
+ {
+ return ((ObjectContext)related.getContext()).relationshipContext.parent;
+ }
+ };
+
+ static abstract class ManyToOne
+ {
+
+ /** Indicates if the relationship is loaded. */
+ private boolean loaded;
+
+ /** The related object. */
+ private UIContainerObject related;
+
+ /** The context pointing at us via a OneToMany. */
+ private final Set<ObjectContext> refs;
+
+ private ManyToOne()
+ {
+ this.loaded = false;
+ this.related = null;
+ this.refs = new HashSet<ObjectContext>();
+ }
+
+ /**
+ * Returns true if the relationship is loaded
+ *
+ * @return the loaded status
+ */
+ boolean isLoaded()
+ {
+ return loaded;
+ }
+
+ /**
+ * Updates the related to a new related object.
+ *
+ * @param related the new related
+ * @throws IllegalArgumentException if the related is null
+ * @throws IllegalStateException if the relationship is not loaded already
+ */
+ void setLoadedRelated(UIContainerObject related) throws IllegalStateException
+ {
+ if (!loaded)
+ {
+ throw new IllegalStateException("Cannot set related of a non loaded association");
+ }
+ if (related == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ // Downgrade the related side
+ detach();
+
+ //
+ attach(related);
+ }
+
+ /**
+ * Returns the loaded related.
+ *
+ * @return the loaded related
+ * @throws IllegalStateException if the relationship is not loaded
+ */
+ UIContainerObject getLoadedRelated() throws IllegalStateException
+ {
+ if (!loaded)
+ {
+ throw new IllegalStateException("Cannot set parent of non loaded association");
+ }
+
+ //
+ return related;
+ }
+
+ /**
+ * Clears the reference and unload the relationship.
+ *
+ * @throws IllegalStateException if the relationship is not loaded
+ */
+ void clear() throws IllegalStateException
+ {
+ if (!loaded)
+ {
+ throw new IllegalStateException("Cannot clear parent of non loaded association");
+ }
+
+ // Downgrade related
+ detach();
+ }
+
+ /**
+ * Returns the related object. If the object is not loaded an attempt to load the state
+ * will be done.
+ *
+ * @return the related object
+ * @throws StateException if the state of the owner prevents to access the related
+ */
+ UIContainerObject getRelated() throws StateException
+ {
+ ObjectContext owner = getOwner();
+
+ //
+ owner.checkAccess();
+
+ //
+ if (!loaded)
+ {
+ load();
+ }
+
+ //
+ owner.checkAccess();
+
+ //
+ return related;
+ }
+
+ /**
+ * Loads the related side.
+ *
+ * @return the loaded structural object
+ * @throws StateException if the load operation cannot be achieved
+ */
+ protected abstract StructuralObject doLoad() throws StateException;
+
+ /**
+ * The owner of the relationship.
+ *
+ * @return the owner
+ */
+ protected abstract ObjectContext getOwner();
+
+ /**
+ * Returns the related one to many relationship obtained from the related object.
+ *
+ * @param related the related
+ * @return the one to many
+ */
+ protected abstract OneToMany getOneToMany(UIContainerObject related);
+
+ private void attach(UIContainerObject related)
+ {
+ if (this.related != null)
+ {
+ throw new AssertionError("BUG");
+ }
+
+ //
+ OneToMany oneToMany = getOneToMany(related);
+ ObjectContext owner = getOwner();
+
+ //
+ if (oneToMany.refs.contains(owner))
+ {
+ throw new AssertionError("BUG");
+ }
+
+ //
+ oneToMany.refs.add(owner);
+ this.related = related;
+ this.loaded = true;
+
+ // We need to broadcast an event maybe
+ ObjectContext relatedContext = oneToMany.getOwner();
+ if (!refs.contains(relatedContext))
+ {
+ RelationshipAddedEvent event = new RelationshipAddedEvent(relatedContext.structuralObject.getId(), owner.structuralObject.getId());
+ owner.container.fireEvent(event);
+ }
+ }
+
+ private void detach()
+ {
+ if (related == null)
+ {
+ throw new AssertionError("BUG");
+ }
+
+ //
+ OneToMany oneToMany = getOneToMany(related);
+ ObjectContext owner = getOwner();
+
+ //
+ if (!oneToMany.refs.contains(owner))
+ {
+ throw new AssertionError("BUG");
+ }
+
+ //
+ oneToMany.refs.remove(owner);
+ this.related = null;
+ this.loaded = false;
+
+ // We need to broadcast an event maybe
+ ObjectContext relatedContext = oneToMany.getOwner();
+ if (!refs.contains(relatedContext))
+ {
+ RelationshipRemovedEvent event = new RelationshipRemovedEvent(relatedContext.structuralObject.getId(), owner.structuralObject.getId());
+ owner.container.fireEvent(event);
+ }
+ }
+
+ /**
+ * Attempt for loading the related side. If a failure occurs during while loading the related side
+ * the load operation is aborted and the status of the association owner is updated accordingly. If the loading
+ * of the related side is successful the association is updated.
+ */
+ private void load()
+ {
+ ObjectContext owner = getOwner();
+
+ //
+ try
+ {
+ StructuralObject relatedSO = doLoad();
+
+ // If null it is the root so nothing is done
+ if (relatedSO != null)
+ {
+ UIContainerObject related = owner.container.get(relatedSO);
+
+ //
+ if (related != null)
+ {
+ attach(related);
+
+ //
+ ObjectContext parentContext = (ObjectContext)related.getContext();
+
+ //
+ if (!relatedSO.compareTo(parentContext.structuralObject))
+ {
+ parentContext.status = UIObject.Status.STALE;
+ }
+ }
+ else
+ {
+ related = owner.container.create(relatedSO);
+
+ //
+ owner.container.attach(related);
+
+ //
+ attach(related);
+ }
+ }
+
+ // Set as loaded
+ this.loaded = true;
+ }
+ catch (StateException e)
+ {
+ owner.updateStatus(e);
+ }
+ }
+ }
+
+ static abstract class OneToMany
+ {
+
+ /** The lazy read only set. */
+ private final LazySet set;
+
+ /** Indicates if the relationship is loaded. */
+ private boolean loaded;
+
+ /** The related objects. */
+ private Set<UIContainerObject> relateds;
+
+ /** The contexts pointing at us via a ManyToOne. */
+ private Set<ObjectContext> refs;
+
+ private OneToMany()
+ {
+ this.set = new LazySet();
+ this.loaded = false;
+ this.relateds = new LinkedHashSet<UIContainerObject>();
+ this.refs = new HashSet<ObjectContext>();
+ }
+
+ boolean isLoaded()
+ {
+ return loaded;
+ }
+
+ void addLoadedRelated(UIContainerObject related)
+ {
+ if (!isLoaded())
+ {
+ throw new IllegalStateException("Not loaded");
+ }
+ if (related == null)
+ {
+ throw new IllegalArgumentException("No null child accepted");
+ }
+
+ //
+ for (UIContainerObject r : relateds)
+ {
+ if (related.getId().equals(r.getId()))
+ {
+ throw new IllegalStateException("Cannot add duplicate");
+ }
+ }
+
+ //
+ attach(related);
+ }
+
+ void setLoadedRelateds(Set<UIContainerObject> relateds)
+ {
+ if (!isLoaded())
+ {
+ throw new IllegalStateException("Not loaded");
+ }
+
+ //
+ for (UIContainerObject related : new ArrayList<UIContainerObject>(this.relateds))
+ {
+ detach(related);
+ }
+
+ //
+ for (UIContainerObject related : relateds)
+ {
+ attach(related);
+ }
+ }
+
+ UIContainerObject removeLoadedRelated(String relatedId)
+ {
+ if (!isLoaded())
+ {
+ throw new IllegalStateException("Not loaded");
+ }
+ if (relatedId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ for (UIContainerObject related : relateds)
+ {
+ if (relatedId.equals(related.getId()))
+ {
+ detach(related);
+ return related;
+ }
+ }
+
+ //
+ throw new AssertionError("BUG");
+ }
+
+ Collection<UIContainerObject> getRelateds()
+ {
+ return set;
+ }
+
+ void clear()
+ {
+ if (!loaded)
+ {
+ throw new IllegalStateException("Cannot clear parent of non loaded association");
+ }
+
+ // Detach relateds
+ for (UIContainerObject related : new HashSet<UIContainerObject>(relateds))
+ {
+ detach(related);
+ }
+ }
+
+ /**
+ * Load the related side.
+ *
+ * @return the list of structural objects
+ * @throws StateException if the load operation cannot be achieved
+ */
+ protected abstract Collection<StructuralObject> doLoad() throws StateException;
+
+ protected abstract ObjectContext getOwner();
+
+ protected abstract ManyToOne getManyToOne(UIContainerObject related);
+
+ private void detach(UIContainerObject related)
+ {
+ ManyToOne manyToOne = getManyToOne(related);
+
+ //
+ ObjectContext owner = getOwner();
+
+ //
+ if (!manyToOne.refs.contains(owner))
+ {
+ throw new AssertionError("BUG");
+ }
+
+ //
+ manyToOne.refs.remove(owner);
+ relateds.remove(related);
+
+ //
+ ObjectContext relatedContext = manyToOne.getOwner();
+ if (!refs.contains(relatedContext))
+ {
+ RelationshipRemovedEvent event = new RelationshipRemovedEvent(owner.structuralObject.getId(), relatedContext.structuralObject.getId());
+ owner.container.fireEvent(event);
+ }
+ }
+
+ private void attach(UIContainerObject related)
+ {
+ ManyToOne manyToOne = getManyToOne(related);
+
+ //
+ ObjectContext owner = getOwner();
+
+ //
+ if (manyToOne.refs.contains(owner))
+ {
+ throw new AssertionError("Context already referenced by the provided object");
+ }
+
+ //
+ manyToOne.refs.add(owner);
+ relateds.add(related);
+
+ //
+ ObjectContext relatedContext = manyToOne.getOwner();
+ if (!refs.contains(relatedContext))
+ {
+ RelationshipAddedEvent event = new RelationshipAddedEvent(owner.structuralObject.getId(), relatedContext.structuralObject.getId());
+ owner.container.fireEvent(event);
+ }
+ }
+
+ private void load()
+ {
+ ObjectContext owner = getOwner();
+
+ //
+ try
+ {
+ for (StructuralObject relatedSO : doLoad())
+ {
+ UIContainerObject related = owner.container.get(relatedSO);
+
+ //
+ if (related != null)
+ {
+ ObjectContext relatedContext = (ObjectContext)related.getContext();
+
+ //
+ if (!relatedContext.structuralObject.compareTo(relatedSO))
+ {
+ relatedContext.status = UIObject.Status.STALE;
+ }
+ }
+ else
+ {
+ related = owner.container.create(relatedSO);
+
+ //
+ owner.container.attach(related);
+ }
+
+ //
+ attach(related);
+ }
+
+ //
+ this.loaded = true;
+ }
+ catch (StateException e)
+ {
+ owner.updateStatus(e);
+ }
+ }
+
+ private class LazySet extends AbstractSet<UIContainerObject>
+ {
+
+ public Iterator<UIContainerObject> iterator()
+ {
+ final ObjectContext owner = getOwner();
+
+ //
+ owner.checkAccess();
+
+ // Load the entire relationship
+ if (!isLoaded())
+ {
+ load();
+ }
+
+ //
+ owner.checkAccess();
+
+ //
+ final Iterator<UIContainerObject> iterator = relateds.iterator();
+
+ //
+ return new Iterator<UIContainerObject>()
+ {
+ public boolean hasNext()
+ {
+ owner.checkAccess();
+
+ //
+ return iterator.hasNext();
+ }
+
+ public UIContainerObject next()
+ {
+ owner.checkAccess();
+
+ //
+ return iterator.next();
+ }
+
+ public void remove()
+ {
+ owner.checkAccess();
+
+ //
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ public int size()
+ {
+ ObjectContext owner = getOwner();
+
+ //
+ owner.checkAccess();
+
+ //
+ if (!isLoaded())
+ {
+ load();
+ }
+
+ //
+ owner.checkAccess();
+
+ //
+ return relateds.size();
+ }
+
+ public String toString()
+ {
+ return "ProxySet[" + getOwner() + "]";
+ }
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,621 @@
+/******************************************************************************
+ * 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.impl.model.container;
+
+import org.jboss.portal.presentation.model.ModelEvent;
+import org.jboss.portal.presentation.model.ModelListener;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.event.state.structural.StructuralStateModification;
+import org.jboss.portal.presentation.model.event.state.StateChange;
+import org.jboss.portal.presentation.model.event.state.StateChangeEvent;
+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.StructuralStateContext;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.state.NoSuchStateException;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.impl.model.container.spi.UIContainerObject;
+import org.jboss.portal.presentation.impl.model.container.spi.UIObjectFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ */
+public final class UIObjectContainer
+{
+
+ /** . */
+ private final static StructuralStateModification.Destruction DESTRUCTION = new StructuralStateModification.Destruction();
+
+ /** . */
+ private final Map<String, UIContainerObject> universe = new HashMap<String, UIContainerObject>();
+
+ /** . */
+ private final List<ModelListener> listeners;
+
+ /** . */
+ final UIContext root;
+
+ /** . */
+ final StructuralStateContext structuralStateContext;
+
+ /** . */
+ final NavigationalStateContext navigationalStateContext;
+
+ /** . */
+ private final UIObjectFactory factory = new UIObjectFactory();
+
+ public UIObjectContainer(StructuralStateContext structuralStateContext, NavigationalStateContext navigationalStateContext)
+ {
+ // Get root so
+ String rootId = structuralStateContext.getRootId();
+ StructuralObject rootStructuralObject = structuralStateContext.load(rootId);
+ UIContainerObject root = create(rootStructuralObject);
+
+ //
+ this.structuralStateContext = structuralStateContext;
+ this.navigationalStateContext = navigationalStateContext;
+ this.listeners = new ArrayList<ModelListener>();
+ this.root = (UIContext)root;
+
+ // Update universe
+ attach(root);
+ }
+
+ UIContainerObject create(StructuralObject structuralObject)
+ {
+ // Create container object
+ UIContainerObject object = factory.createObject(structuralObject.getState().getType());
+
+ // Create context
+ ObjectContext objectContext = new ObjectContext(this, object, structuralObject);
+ RelationshipContext relationshipContext = new RelationshipContext();
+
+ // Wire
+ objectContext.relationshipContext = relationshipContext;
+ relationshipContext.owner = objectContext;
+
+ // Contextualize
+ object.setContext(objectContext);
+
+ //
+ return object;
+ }
+
+ // Public ***********************************************************************************************************
+
+ public UIContext getRoot()
+ {
+ return root;
+ }
+
+ // Package protected ************************************************************************************************
+
+ /**
+ * Process a change.
+ *
+ * @param change the change to process
+ */
+ void update(StructuralObject.Change change)
+ {
+ if (change instanceof StructuralObject.Update)
+ {
+ StructuralObject.Update update = (StructuralObject.Update)change;
+
+ //
+ UIContainerObject object = get(update.getObject());
+
+ //
+ if (object == null)
+ {
+ throw new AssertionError("It should be here, should we do something ???");
+ }
+
+ //
+ ObjectContext context = (ObjectContext)object.getContext();
+ context.structuralObject = update.getObject();
+
+ // Eventing
+ StructuralStateModification mod = new StructuralStateModification.Update(update.getChanges());
+ StateChange<StructuralStateModification> stateChange = new StateChange<StructuralStateModification>(update.getObject().getId(), mod);
+ StateChangeEvent event = new StateChangeEvent(stateChange);
+ fireEvent(event);
+ }
+ else if (change instanceof StructuralObject.Creation)
+ {
+ StructuralObject.Creation creation = (StructuralObject.Creation)change;
+
+ //
+ UIContainerObject parent = get(creation.getParent());
+
+ //
+ if (parent == null)
+ {
+ throw new AssertionError("It should be here, should we do something ???");
+ }
+
+ //
+ ObjectContext parentContext = (ObjectContext)parent.getContext();
+
+ //
+ parentContext.structuralObject = creation.getParent();
+
+ //
+ if (parentContext.relationshipContext.children.isLoaded())
+ {
+ UIContainerObject child = create(creation.getChild());
+
+ //
+ attach(child);
+
+ //
+ parentContext.relationshipContext.children.addLoadedRelated(child);
+ }
+
+ // Eventing
+ StructuralObject childSO = creation.getChild();
+ StructuralState state = childSO.getState();
+ StructuralStateModification mod = new StructuralStateModification.Creation(state.getType(), state.getName(), state.getProperties());
+ StateChange<StructuralStateModification> stateChange = new StateChange<StructuralStateModification>(childSO.getId(), mod);
+ StateChangeEvent event = new StateChangeEvent(stateChange);
+ fireEvent(event);
+ }
+ else if (change instanceof StructuralObject.Destruction)
+ {
+ StructuralObject.Destruction destruction = (StructuralObject.Destruction)change;
+
+ //
+ UIContainerObject parent = get(destruction.getParent());
+
+ //
+ if (parent != null)
+ {
+ ObjectContext parentContext = (ObjectContext)parent.getContext();
+
+ //
+ parentContext.structuralObject = destruction.getParent();
+
+ //
+ if (parentContext.relationshipContext.children.isLoaded())
+ {
+ // Get the id which is the destroyed object
+ String destroyedId = destruction.getIds().get(destruction.getIds().size() - 1);
+
+ //
+ parentContext.relationshipContext.children.removeLoadedRelated(destroyedId);
+ }
+ }
+
+ //
+ for (String id : destruction.getIds())
+ {
+ UIContainerObject toDestroy = universe.get(id);
+
+ //
+ if (toDestroy != null)
+ {
+ detach(toDestroy, false);
+
+ // Eventing
+ StateChange<StructuralStateModification> stateChange = new StateChange<StructuralStateModification>(id, DESTRUCTION);
+ StateChangeEvent event = new StateChangeEvent(stateChange);
+ fireEvent(event);
+ }
+ }
+ }
+ else if (change instanceof StructuralObject.Move)
+ {
+ StructuralObject.Move move = (StructuralObject.Move)change;
+
+ // Get the container object (some may not be loaded)
+ UIContainerObject parent = get(move.getParent());
+ UIContainerObject destination = get(move.getDestination());
+ UIContainerObject source = get(move.getSource());
+
+ // Update parent
+ if (parent != null)
+ {
+ ObjectContext parentContext = (ObjectContext)parent.getContext();
+
+ // Update so
+ parentContext.structuralObject = move.getParent();
+
+ // Remove the child if the relationship is loaded on this side
+ if (parentContext.relationshipContext.children.isLoaded())
+ {
+ parentContext.relationshipContext.children.removeLoadedRelated(move.getSource().getId());
+ }
+ }
+
+ //
+ if (destination != null)
+ {
+ ObjectContext destinationContext = (ObjectContext)destination.getContext();
+
+ //
+ destinationContext.structuralObject = move.getDestination();
+
+ //
+ if (destinationContext.relationshipContext.children.isLoaded())
+ {
+ // Now we really need to add the source as we load collections entirely
+ if (source == null)
+ {
+ source = create(move.getSource());
+
+ //
+ attach(source);
+ }
+
+ //
+ destinationContext.relationshipContext.children.addLoadedRelated(source);
+ }
+ }
+
+ // Update source
+ if (source != null)
+ {
+ ObjectContext sourceContext = (ObjectContext)source.getContext();
+
+ // Update so
+ sourceContext.structuralObject = move.getSource();
+
+ //
+ if (sourceContext.relationshipContext.parent.isLoaded())
+ {
+ if (destination != null)
+ {
+ sourceContext.relationshipContext.parent.setLoadedRelated(destination);
+ }
+ else
+ {
+ sourceContext.relationshipContext.parent.clear();
+ }
+ }
+ }
+
+ // Eventing
+ StructuralStateModification.Move mod = new StructuralStateModification.Move(move.getParent().getId(), move.getDestination().getId());
+ StateChange<StructuralStateModification> stateChange = new StateChange<StructuralStateModification>(move.getSource().getId(), mod);
+ StateChangeEvent event = new StateChangeEvent(stateChange);
+ fireEvent(event);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+ }
+
+ /**
+ * Returns an object an object specified by the id that is referenced by this context or load
+ * it if it is not present.
+ *
+ * @param id the id of the object to obtain
+ * @return the loaded object
+ */
+ UIContainerObject getObject(String id)
+ {
+ UIContainerObject object = get(id);
+
+ //
+ if (object != null)
+ {
+ return object;
+ }
+
+ //
+ // Fetch the state of the UIObject in question
+ StructuralObject structuralObject = this.structuralStateContext.load(id);
+
+ //
+ if (structuralObject != null)
+ {
+ object = create(structuralObject);
+
+ //
+ attach(object);
+
+ //
+ return object;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ void addModelListener(ModelListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (!listeners.contains(listener))
+ {
+ listeners.add(listener);
+ }
+ }
+
+ void fireEvent(ModelEvent event)
+ {
+ for (ModelListener listener : listeners)
+ {
+ try
+ {
+ listener.onEvent(event);
+ }
+ catch (Exception ignore)
+ {
+ System.out.println("ignore = " + ignore);
+ }
+ }
+ }
+
+ void validate(UIContainerObject object, UIObject.Visitor scope)
+ {
+ if (scope.enterObject(object))
+ {
+ ObjectContext context = (ObjectContext)object.getContext();
+
+ // We do it only if it is not yet invalid
+ if (context.isValid())
+ {
+ // Validate
+ try
+ {
+ structuralStateContext.validate(context.structuralObject);
+ }
+ catch (StateException e)
+ {
+ context.updateStatus(e);
+ }
+
+ // Continue only if it is valid
+ if (context.isValid())
+ {
+ boolean loaded = context.relationshipContext.children.isLoaded();
+
+ // Loading children will never make the current object invalid
+ // but it could make some already loaded children invalid
+ if (scope.enterChildren(object, loaded))
+ {
+ for (UIContainerObject child : context.relationshipContext.children.getRelateds())
+ {
+ ObjectContext childContext = (ObjectContext)child.getContext();
+
+ //
+ validate(childContext.containerObject, scope);
+ }
+ }
+ }
+
+ //
+ scope.leaveObject(object);
+ }
+ }
+ }
+
+ void refresh(UIContainerObject object, UIObject.Visitor scope)
+ {
+ if (scope.enterObject(object))
+ {
+ ObjectContext context = (ObjectContext)object.getContext();
+
+ //
+ if (context.status == UIObject.Status.INVALID)
+ {
+ return;
+ }
+
+ //
+ System.err.println("<" + context.getState().getName() + ">");
+
+ //
+ StructuralObject.Refresh refresh = null;
+ try
+ {
+ refresh = structuralStateContext.refresh(context.structuralObject);
+ }
+ catch (NoSuchStateException e)
+ {
+ context.status = UIObject.Status.INVALID;
+ return;
+ }
+
+ //
+ boolean loaded = context.relationshipContext.children.isLoaded();
+ boolean refreshChildren = scope.enterChildren(object, loaded);
+
+ // Update the structural state
+ if (!context.structuralObject.compareTo(refresh.getObject()))
+ {
+ if (loaded)
+ {
+ // Take care of the added children
+ for (StructuralObject addedSO : refresh.getAddedChildren())
+ {
+ UIContainerObject added = get(addedSO);
+
+ //
+ if (added != null)
+ {
+ ObjectContext addedContext = (ObjectContext)added.getContext();
+
+// // Find parent pointing at us and set as dirty
+// for (ObjectContext addedParentContext : addedContext.relationshipContext.parent.getReferences())
+// {
+// addedParentContext.status = UIObject.Status.STALE;
+// }
+
+ // Update parent if it was loaded
+ if (addedContext.relationshipContext.parent.isLoaded())
+ {
+ addedContext.relationshipContext.parent.setLoadedRelated(object);
+ }
+ }
+ else
+ {
+ added = create(addedSO);
+
+ //
+ attach(added);
+ }
+
+ System.err.println("added " + added.getName());
+
+ //
+ context.relationshipContext.children.addLoadedRelated(added);
+ }
+
+ //
+ for (StructuralObject staleSO : refresh.getStaleChildren().values())
+ {
+ UIContainerObject stale = get(staleSO);
+
+ // It must be here as it is loaded
+ ObjectContext staleContext = (ObjectContext)stale.getContext();
+
+ // Mark as stale
+ staleContext.status = UIObject.Status.STALE;
+ }
+
+ // Removals
+ for (String removedId : refresh.getRemovedChildren())
+ {
+ UIContainerObject removed = context.relationshipContext.children.removeLoadedRelated(removedId);
+
+ //
+ ObjectContext removedContext = (ObjectContext)removed.getContext();
+
+ //
+ System.err.println("want to remove " + removed.getName());
+
+ // We remove only if it's pointing at us
+ if (removedContext.relationshipContext.parent.isLoaded() && removedContext.relationshipContext.parent.getRelated() == object)
+ {
+ System.err.println("removed " + removed.getName());
+ detach(removed, true);
+ }
+ }
+
+ // Update state
+ context.structuralObject = refresh.getObject();
+ context.status = UIObject.Status.VALID;
+ }
+ }
+
+ // Recursively refresh children
+ if (refreshChildren)
+ {
+ for (UIContainerObject child : context.relationshipContext.children.getRelateds())
+ {
+ refresh(child, scope);
+ }
+ }
+
+ System.err.println("</" + context.getState().getName() + ">");
+
+ //
+ scope.leaveObject(object);
+ }
+ }
+
+// void refresh(UIContainerObject object, UIObject.Visitor scope)
+// {
+// // First pass
+//
+//
+//
+// }
+
+ void attach(UIContainerObject object)
+ {
+ String id = object.getId();
+
+ //
+ if (universe.containsKey(id))
+ {
+ throw new AssertionError("Duplicate put for id" + id);
+ }
+
+ //
+ universe.put(id, object);
+
+ //
+// ObjectContext context = (ObjectContext)object.getContext();
+// StructuralObject so = context.structuralObject;
+// StructuralState st = so.getState();
+// ObjectAddedEvent event = new ObjectAddedEvent(so.getId(), st.getName(), st.getType(), st.getProperties());
+// fireEvent(event);
+ }
+
+ void detach(UIContainerObject object, boolean cascade)
+ {
+ ObjectContext context = (ObjectContext)object.getContext();
+
+ //
+ if (cascade)
+ {
+ for (UIContainerObject child : context.relationshipContext.children.getRelateds())
+ {
+ detach(child, true);
+ }
+ }
+
+ //
+ if (context.relationshipContext.parent.isLoaded())
+ {
+ context.relationshipContext.parent.clear();
+ }
+ if (context.relationshipContext.children.isLoaded())
+ {
+ context.relationshipContext.children.clear();
+ }
+
+ //
+ context.status = UIObject.Status.INVALID;
+ universe.remove(object.getId());
+
+ //
+// StructuralObject so = context.structuralObject;
+// ObjectRemovedEvent event = new ObjectRemovedEvent(so.getId());
+// fireEvent(event);
+ }
+
+ UIContainerObject get(String id)
+ {
+ return universe.get(id);
+ }
+
+ UIContainerObject get(StructuralObject so)
+ {
+ return universe.get(so.getId());
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIContainerObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIContainerObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIContainerObject.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.impl.model.container.spi;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.impl.model.container.spi.UIObjectContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface UIContainerObject extends UIObject
+{
+
+ UIObjectContext getContext();
+
+ void setContext(UIObjectContext context);
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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.impl.model.container.spi;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.ModelListener;
+
+/**
+ * Encapsulate internal of an object.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface UIObjectContext
+{
+
+ UIObject getManagedObject();
+
+ UIObject getObject(String id);
+
+ void addModelListener(ModelListener listener);
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectFactory.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectFactory.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/container/spi/UIObjectFactory.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.impl.model.container.spi;
+
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIContainer;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.impl.model.UIContextImpl;
+import org.jboss.portal.presentation.impl.model.UIPortalImpl;
+import org.jboss.portal.presentation.impl.model.UIPageImpl;
+import org.jboss.portal.presentation.impl.model.UIContainerImpl;
+import org.jboss.portal.presentation.impl.model.UIWindowImpl;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class UIObjectFactory
+{
+
+ public UIContainerObject createObject(Class<? extends UIObject> type)
+ {
+ if(type == UIContext.class)
+ {
+ return new UIContextImpl();
+ }
+ else if(type == UIPortal.class)
+ {
+ return new UIPortalImpl();
+ }
+ else if(type == UIPage.class)
+ {
+ return new UIPageImpl();
+ }
+ else if(type == UIContainer.class)
+ {
+ return new UIContainerImpl();
+ }
+ else if(type == UIWindow.class)
+ {
+ return new UIWindowImpl();
+ }
+ else
+ {
+ throw new AssertionError();
+ }
+ }
+
+// public <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+// {
+// if(type == UIContext.class)
+// {
+// return type == UIPortal.class;
+// }
+// else if (type == UIPortal.class)
+// {
+// return type == UIPage.class;
+// }
+// else if (type == UIPage.class)
+// {
+// return type == UIPage.class || type == UIContainer.class || type == UIWindow.class;
+// }
+// else if (type == UIContainer.class)
+// {
+// return type == UIWindow.class;
+// }
+// else if (type == UIWindow.class)
+// {
+// return false;
+// }
+// else
+// {
+// throw new AssertionError();
+// }
+// }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/state/navigational/NavigationalStateContextImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * 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.impl.model.state.navigational;
+
+import org.jboss.portal.presentation.model.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.state.StateException;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NavigationalStateContextImpl implements NavigationalStateContext
+{
+
+ /** . */
+ private final Map<Key, Object> map;
+
+ public NavigationalStateContextImpl(Map<Key, Object> map)
+ {
+ this.map = map;
+ }
+
+ public NavigationalStateContextImpl()
+ {
+ this(new HashMap<Key, Object>());
+ }
+
+ public void set(String objectId, String key, Object navigationalState) throws StateChangeVetoException, StateException, IllegalArgumentException
+ {
+ Key key2 = new Key(objectId, key);
+
+ //
+ if (navigationalState != null)
+ {
+ map.put(key2, navigationalState);
+ }
+ else
+ {
+ map.remove(key2);
+ }
+ }
+
+ public Object get(String objectId, String key) throws IllegalArgumentException
+ {
+ return map.get(new Key(objectId, key));
+ }
+
+ private final class Key
+ {
+ /** . */
+ private final String objectId;
+
+ /** . */
+ private final String key;
+
+ private Key(String objectId, String key)
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (key == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.objectId = objectId;
+ this.key = key;
+ }
+
+ public int hashCode()
+ {
+ return objectId.hashCode() * 43 + key.hashCode();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof Key)
+ {
+ Key that = (Key)o;
+ return objectId.equals(that.objectId) && key.equals(that.key);
+ }
+ return false;
+ }
+ }
+}
\ No newline at end of file
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.layout;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface LayoutManager
+{
+ /**
+ *
+ * @param container
+ * @return
+ */
+ //public String doLayout(Page page);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.layout;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class LayoutService
+{
+ /**
+ *
+ *
+ */
+ public LayoutService()
+ {
+ }
+
+ /**
+ *
+ * @param container
+ * @param layoutManager
+ * @return
+ */
+ /*public String doLayout(Page page, LayoutManager layoutManager)
+ {
+ String output = null;
+
+ output = layoutManager.doLayout(page);
+
+ return output;
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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: 630 $
+ */
+public abstract class ModelEvent
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelListener.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelListener.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ModelListener.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * 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: 630 $
+ */
+public interface ModelListener
+{
+ void onEvent(ModelEvent event);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/StateType.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/StateType.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/StateType.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * An action that can be triggered.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface UIAction extends UIObject
+{
+
+ /**
+ * Returns the action display name.
+ *
+ * @return the display name
+ */
+ String getDisplayName();
+
+ /**
+ * Returns the action icon URL.
+ *
+ * @return the icon URL
+ */
+ String getIconURL();
+
+ /**
+ * Returns the action URL.
+ *
+ * @return the url
+ */
+ String getURL();
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContainer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContainer.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContainer.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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 interface UIContainer extends UIObject
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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 interface UIContext extends UIObject
+{
+ /**
+ *
+ * @param id the object id
+ * @return the object for the specified id or null if it cannot be found
+ */
+ UIObject getObject(String id);
+
+ /**
+ *
+ * @param listener the listener
+ */
+ void addModelListener(ModelListener listener);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIObject.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,208 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.ConstraintViolationException;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIObject
+{
+
+ /**
+ * The status of a user interface object.
+ */
+ public enum Status
+ {
+ /**
+ * It can be used.
+ */
+ VALID,
+
+ /**
+ * It cannot be used.
+ */
+ INVALID,
+
+ /**
+ * It cannot be used as is but a recovery is possible to either become valid or invalid.
+ */
+ STALE
+ }
+
+ public interface Visitor
+ {
+
+ /**
+ * Returns true if the provided object should be visited.
+ *
+ * @param object the object
+ * @return true if it should be visited
+ */
+ boolean enterObject(UIObject object);
+
+ /**
+ * Callback to signal that an object visit is terminated
+ *
+ * @param object the object
+ */
+ void leaveObject(UIObject object);
+
+ /**
+ * Returns true if the children should be visited
+ *
+ * @param object the parent of the children
+ * @param loaded if the relationship is already loaded
+ * @return true if the children should be visited
+ */
+ boolean enterChildren(UIObject object, boolean loaded);
+
+ }
+
+ /**
+ * Updates the status of the object by comparing validating it against the structural state context.
+ */
+ void validate();
+
+ void validate(Visitor scope);
+
+ /**
+ * Attempt a resolution of the current conflict. The behavior of the method will change according to the
+ * current status of the object:
+ * <ul>
+ * <li><code>STALE</code> status leads to resolve the conflict to a new status with <code>INVALID</code> or <code>VALID</code>
+ * as possible values</li>
+ * <li><code>VALID</code> status leads to a non operation</li>
+ * <li><code>INVALID</code> status leads to throw an <code>IllegalStateException</code></li>
+ * </ul>
+ */
+ void refresh();
+
+ void refresh(Visitor scope);
+
+ /**
+ * Return the current status.
+ *
+ * @return the status
+ */
+ Status getStatus();
+
+ /**
+ * Returns the id.
+ *
+ * @return the id
+ */
+ String getId();
+
+ /**
+ * Returns the name.
+ *
+ * @return the name
+ */
+ String getName();
+
+ /**
+ * Returns the parent or null if the object does not have a parent.
+ *
+ * @return the parent
+ */
+ UIObject getParent();
+
+ /**
+ * Returns a named child or null if it does not exist.
+ *
+ * @param name the name of the child
+ * @return the named child
+ */
+ UIObject getChild(String name);
+
+ /**
+ * Returns a property value or null if it does not exist.
+ *
+ * @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(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 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(StateType stateType, String propertyName) throws IllegalArgumentException, StateException;
+
+ <T> void setProperty(StateType stateType, String propertyName, T propertyValue) throws IllegalArgumentException, StateException;
+
+ /**
+ * Create a named child with a specified type.
+ *
+ * @param name the child name
+ * @param type the child type
+ * @return the newly created child
+ * @throws IllegalArgumentException if the name is null, already exists or this kind of object does not accept children of the specified type
+ * @throws StateException any state exception
+ */
+ <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException, StateException;
+
+ /**
+ * Returns the children of this object.
+ *
+ * @return the list of children
+ */
+ Collection<? extends UIObject> getChildren();
+
+ /**
+ * Destroy a named child.
+ *
+ * @param name the name of the child to destroy
+ * @throws IllegalArgumentException if the name is null or the child does not exist
+ * @throws StateException any state exception
+ */
+ void destroyChild(String name) throws IllegalArgumentException, StateException;
+
+ /**
+ * Move the specified object to a new parent. A constraint violation will be detected if the destination
+ * is a descendant of the current object.
+ *
+ * @param destination the new parent
+ * @throws IllegalArgumentException if the destination is null
+ * @throws StateException any state exception
+ * @throws ConstraintViolationException if the destination is not valid
+ */
+ void move(UIObject destination) throws IllegalArgumentException, StateException;
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPage.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPage.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPage.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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 interface UIPage extends UIObject
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPortal.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPortal.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIPortal.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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 interface UIPortal extends UIObject
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIWindow.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIWindow.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/UIWindow.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIWindow extends UIObject
+{
+ /**
+ * Returns the window state of the window or null if it does not exist.
+ *
+ * @return the window state
+ */
+ WindowState getWindowState();
+
+ /**
+ * Update the window state of the window.
+ *
+ * @param windowState the new window state
+ */
+ void setWindowState(WindowState windowState);
+
+ /**
+ * Returns the mode of the window or null if it does not exist.
+ *
+ * @return the mode
+ */
+ Mode getMode();
+
+ /**
+ * Update the mode of the window.
+ *
+ * @param mode the new mode
+ */
+ void setMode(Mode mode);
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content/WindowContent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content/WindowContent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content/WindowContent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.content;
+
+/**
+ * The content of a window.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WindowContent
+{
+
+ /** . */
+ private final long expirationMillis;
+
+ /** . */
+ private final String title;
+
+ /** . */
+ private final String markup;
+
+
+ public WindowContent(long expirationMillis, String title, String markup)
+ {
+ this.expirationMillis = expirationMillis;
+ this.title = title;
+ this.markup = markup;
+ }
+
+ public long getExpirationMillis()
+ {
+ return expirationMillis;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public String getMarkup()
+ {
+ return markup;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.lifecycle;
+
+import org.jboss.portal.presentation.model.ModelEvent;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class LifeCycleEvent extends ModelEvent
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * 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.lifecycle;
+
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ObjectAddedEvent extends ObjectLifeCycleEvent
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ public ObjectAddedEvent(String objectId, String name, Class<? extends UIObject> type, Map<String, String> properties)
+ {
+ super(objectId);
+
+ //
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (properties == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.name = name;
+ this.type = type;
+ this.properties = properties;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.presentation.model.event.lifecycle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class ObjectLifeCycleEvent extends LifeCycleEvent
+{
+
+ /** . */
+ private final String objectId;
+
+ public ObjectLifeCycleEvent(String objectId)
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.objectId = objectId;
+ }
+
+ public String getObjectId()
+ {
+ return objectId;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * 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.lifecycle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ObjectRemovedEvent extends ObjectLifeCycleEvent
+{
+ public ObjectRemovedEvent(String objectId)
+ {
+ super(objectId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * 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.lifecycle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RelationshipAddedEvent extends RelationshipLifeCycleEvent
+{
+ public RelationshipAddedEvent(String parentId, String childId)
+ {
+ super(parentId, childId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.lifecycle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class RelationshipLifeCycleEvent extends LifeCycleEvent
+{
+
+ /** . */
+ private final String parentId;
+
+ /** . */
+ private final String childId;
+
+ public RelationshipLifeCycleEvent(String parentId, String childId)
+ {
+ if (parentId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (childId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.parentId = parentId;
+ this.childId = childId;
+ }
+
+ public String getParentId()
+ {
+ return parentId;
+ }
+
+ public String getChildId()
+ {
+ return childId;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * 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.lifecycle;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RelationshipRemovedEvent extends RelationshipLifeCycleEvent
+{
+ public RelationshipRemovedEvent(String parentId, String childId)
+ {
+ super(parentId, childId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChange.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChange.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChange.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * 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.state;
+
+/**
+ * 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;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChangeEvent.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChangeEvent.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateChangeEvent.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.state;
+
+import org.jboss.portal.presentation.model.ModelEvent;
+import org.jboss.portal.presentation.model.event.state.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;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateModification.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateModification.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/StateModification.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.state;
+
+/**
+ * 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
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/navigational/NavigationalStateModification.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/navigational/NavigationalStateModification.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/navigational/NavigationalStateModification.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.state.navigational;
+
+import org.jboss.portal.presentation.model.event.state.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;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/event/state/structural/StructuralStateModification.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,145 @@
+/******************************************************************************
+ * 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.state.structural;
+
+import org.jboss.portal.presentation.model.event.state.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 parentId;
+
+ /** . */
+ private final String destinationId;
+
+ public Move(String parentId, String destinationId)
+ {
+ this.parentId = parentId;
+ this.destinationId = destinationId;
+ }
+
+ public String getParentId()
+ {
+ return 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;
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/ConstraintViolationException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/ConstraintViolationException.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/ConstraintViolationException.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ConstraintViolationException extends StateException
+{
+ public ConstraintViolationException()
+ {
+ }
+
+ public ConstraintViolationException(String s)
+ {
+ super(s);
+ }
+
+ public ConstraintViolationException(String s, Throwable throwable)
+ {
+ super(s, throwable);
+ }
+
+ public ConstraintViolationException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
\ No newline at end of file
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/NoSuchStateException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/NoSuchStateException.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/NoSuchStateException.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class NoSuchStateException extends StateException
+{
+ public NoSuchStateException()
+ {
+ }
+
+ public NoSuchStateException(String s)
+ {
+ super(s);
+ }
+
+ public NoSuchStateException(String s, Throwable throwable)
+ {
+ super(s, throwable);
+ }
+
+ public NoSuchStateException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StaleStateException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StaleStateException.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StaleStateException.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StaleStateException extends StateException
+{
+ public StaleStateException()
+ {
+ }
+
+ public StaleStateException(String s)
+ {
+ super(s);
+ }
+
+ public StaleStateException(String s, Throwable throwable)
+ {
+ super(s, throwable);
+ }
+
+ public StaleStateException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateChangeVetoException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateChangeVetoException.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateChangeVetoException.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StateChangeVetoException extends StateException
+{
+ public StateChangeVetoException()
+ {
+ }
+
+ public StateChangeVetoException(String s)
+ {
+ super(s);
+ }
+
+ public StateChangeVetoException(String s, Throwable throwable)
+ {
+ super(s, throwable);
+ }
+
+ public StateChangeVetoException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateException.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/StateException.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,49 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StateException extends RuntimeException
+{
+ public StateException()
+ {
+ }
+
+ public StateException(String s)
+ {
+ super(s);
+ }
+
+ public StateException(String s, Throwable throwable)
+ {
+ super(s, throwable);
+ }
+
+ public StateException(Throwable throwable)
+ {
+ super(throwable);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/navigational/NavigationalStateContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.navigational;
+
+import org.jboss.portal.presentation.model.state.StateException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface NavigationalStateContext
+{
+ Object get(String objectId, String key) throws IllegalArgumentException;
+
+ void set(String objectId, String key, Object navigationalState) throws StateException, IllegalArgumentException;
+
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/AbstractStructuralStateContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class AbstractStructuralStateContext implements StructuralStateContext
+{
+
+ public StructuralObject.Creation create(StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateChangeVetoException, StateException, IllegalArgumentException
+ {
+ throw new StateChangeVetoException();
+ }
+
+ public StructuralObject.Destruction destroy(StructuralObject object) throws StateException, IllegalArgumentException
+ {
+ throw new StateChangeVetoException();
+ }
+
+ 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 StateException, IllegalArgumentException
+ {
+ throw new StateChangeVetoException();
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralObject.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,306 @@
+/******************************************************************************
+ * 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;
+
+import java.util.List;
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface StructuralObject
+{
+
+ String getId();
+
+ StructuralState getState();
+
+ boolean compareTo(StructuralObject other);
+
+ /**
+ * A comparison between two structural objects.
+ */
+ public static class Refresh
+ {
+
+ /** . */
+ private final StructuralObject parent;
+
+ /** . */
+ private final StructuralObject object;
+
+ /** . */
+ private final Set<StructuralObject> addedChildren;
+
+ /** . */
+ private final Set<String> removedChildren;
+
+ /** . */
+// private final Set<String> destroyedChildren;
+
+ /** . */
+ private final Map<String, StructuralObject> staleChildren;
+
+ /** . */
+ private final Set<String> validChildren;
+
+ public Refresh(
+ StructuralObject parent,
+ StructuralObject object,
+ Set<StructuralObject> addedChildren,
+ Set<String> removedChildren,
+ Map<String, StructuralObject> staleChildren,
+ Set<String> validChildren/*,
+ Set<String> destroyedChildren*/)
+ {
+ if (addedChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (validChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (staleChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (removedChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+// if (destroyedChildren == null)
+// {
+// throw new IllegalArgumentException();
+// }
+ this.parent = parent;
+ this.object = object;
+ this.addedChildren = addedChildren;
+ this.validChildren = validChildren;
+ this.staleChildren = staleChildren;
+ this.removedChildren = removedChildren;
+// this.destroyedChildren = destroyedChildren;
+ }
+
+ public StructuralObject getParent()
+ {
+ return parent;
+ }
+
+ public StructuralObject getObject()
+ {
+ return object;
+ }
+
+// public Set<String> getDestroyedChildren()
+// {
+// return destroyedChildren;
+// }
+
+ public Set<StructuralObject> getAddedChildren()
+ {
+ return addedChildren;
+ }
+
+ public Map<String, StructuralObject> getStaleChildren()
+ {
+ return staleChildren;
+ }
+
+ public Set<String> getValidChildren()
+ {
+ return validChildren;
+ }
+
+ public Set<String> getRemovedChildren()
+ {
+ return removedChildren;
+ }
+ }
+
+ public static class Change
+ {
+ }
+
+ public static class Update extends Change
+ {
+
+ /** . */
+ private final StructuralObject object;
+
+ /** . */
+ private final Map<String, String> changes;
+
+ public Update(StructuralObject object, Map<String, String> changes)
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (changes == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.object = object;
+ this.changes = changes;
+ }
+
+ public StructuralObject getObject()
+ {
+ return object;
+ }
+
+ public Map<String, String> getChanges()
+ {
+ return changes;
+ }
+ }
+
+ public static class Move extends Change
+ {
+
+ /** . */
+ private final StructuralObject parent;
+
+ /** . */
+ private final StructuralObject source;
+
+ /** . */
+ private final StructuralObject destination;
+
+ public Move(
+ StructuralObject parent,
+ StructuralObject source,
+ StructuralObject destination)
+ {
+ if (parent == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (source == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (destination == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.parent = parent;
+ this.source = source;
+ this.destination = destination;
+ }
+
+ public StructuralObject getParent()
+ {
+ return parent;
+ }
+
+ 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;
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralState.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralState.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralState.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.util.Map;
+
+/**
+ * The structural state.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface StructuralState
+{
+
+ Class<? extends UIObject> getType();
+
+ String getName();
+
+ Map<String, String> getProperties();
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/state/structural/StructuralStateContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,146 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.state.StateChangeVetoException;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.NoSuchStateException;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * The structural state context.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface StructuralStateContext
+{
+
+ /**
+ * Load the state of the specified object.
+ *
+ * @param objectId the object id
+ * @return the state of the object or null if such state does not exist
+ * @throws IllegalArgumentException if the object id argument is null
+ */
+ StructuralObject load(String objectId) throws IllegalArgumentException;
+
+ /**
+ * Load the children of the provided object.
+ *
+ * @param parent the parent
+ * @return the list of children as structural objects
+ * @throws IllegalArgumentException if the provided object is null
+ * @throws StateException any useful exception that would make the object non valid
+ */
+ Collection<StructuralObject> loadChildren(StructuralObject parent) throws IllegalArgumentException, StateException;
+
+ /**
+ * Load the parent of the specified object.
+ *
+ * @param child the child
+ * @return the parent or null if it does not exist
+ * @throws IllegalArgumentException if the provided object is null
+ * @throws StateException any useful exception that would make the object non valid
+ */
+ StructuralObject loadParent(StructuralObject child) throws IllegalArgumentException, StateException;
+
+ /**
+ * Returns the id of the root object.
+ *
+ * @return the id of the root object.
+ */
+ String getRootId();
+
+ /**
+ * Validate the state of the provided object. The operation is idempotent and does not modify any state.
+ * If validation is succesfull the method returns otherwise it throws an exception that indicates
+ * the nature of the non validation failure.
+ *
+ * @param object the object to check
+ * @throws IllegalArgumentException if the provided object is null
+ * @throws StateException any useful exception that would make the object non valid
+ */
+ void validate(StructuralObject object) throws IllegalArgumentException, StateException;
+
+ /**
+ * Attempt to return an object that contains the difference between the provided object
+ * and the up to date object.
+ *
+ * @param object the object to refresh
+ * @return the refresh
+ * @throws IllegalArgumentException if the object argument is null
+ * @throws StateException if the object cannot be refreshed
+ */
+ StructuralObject.Refresh refresh(StructuralObject object) throws IllegalArgumentException, StateException;
+
+ /**
+ * Create an object.
+ *
+ * @param parent the parent
+ * @param type the type of the child
+ * @param name the name of the child
+ * @param properties the initial properties of the child @return the id of the newly created structural state
+ * @return the creation object
+ * @throws IllegalArgumentException if an argument is null or not valid
+ * @throws StateException if the provided state prevents the operation to be done
+ */
+ StructuralObject.Creation create(StructuralObject parent, Class<? extends UIObject> type, String name, Map<String, String> properties) throws StateException, IllegalArgumentException;
+
+ /**
+ * Destroy a specified object.
+ *
+ * @param object the object to destroy
+ * @return the destruction object
+ * @throws IllegalArgumentException if an argument is null or not valid
+ * @throws StateException if the provided state prevents the operation to be done
+ */
+ StructuralObject.Destruction destroy(StructuralObject object) throws IllegalArgumentException, StateException;
+
+ /**
+ * Move an object to a new parent.
+ *
+ * @param source the source object
+ * @param destination the destination object
+ * @return the move object
+ * @throws IllegalArgumentException if an argument is null or not valid
+ * @throws StateException if the provided state prevents the operation to be done
+ */
+ StructuralObject.Move move(StructuralObject source, StructuralObject destination) throws IllegalArgumentException, StateException;
+
+ /**
+ * Update the state of a specified object.
+ *
+ * @param object the object to udpate
+ * @param changes the changes
+ * @throws StateChangeVetoException if the creation is vetoed
+ * @return the update object
+ * @throws IllegalArgumentException if an argument is null or not valid
+ * @throws StateException if the provided state prevents the operation to be done
+ */
+ StructuralObject.Update update(StructuralObject object, Map<String, String> changes) throws IllegalArgumentException, StateException;
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/CreateUIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.protocol;
+
+import org.jboss.portal.presentation.model.UIObject;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CreateUIObjectAction extends UIObjectAction
+{
+ public CreateUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/DestroyUIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/DestroyUIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/DestroyUIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DestroyUIObjectAction extends UIObjectAction
+{
+ public DestroyUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ErrorResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ErrorResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ErrorResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ErrorResponse extends ServerResponse
+{
+ /**
+ *
+ */
+ private int errorCode = 0;
+
+ /**
+ *
+ * @param errorCode
+ */
+ public ErrorResponse(int errorCode)
+ {
+ this.errorCode = errorCode;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public int getErrorCode()
+ {
+ return this.errorCode;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/GetActivation.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * 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.protocol;
+
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class GetActivation extends LinkActivation
+{
+ public GetActivation(String targetId, Map queryParameters)
+ {
+ super(targetId, queryParameters);
+ }
+
+ /**
+ *
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ if(this.queryParameters != null)
+ {
+ buffer.append("QueryString---------------\n");
+ for(Iterator itr=this.queryParameters.keySet().iterator(); itr.hasNext();)
+ {
+ String key = (String)itr.next();
+ String[] value = (String[])this.queryParameters.get(key);
+ buffer.append(key+"="+value[0]+"\n");
+ }
+ }
+
+ return buffer.toString();
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.protocol;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class LinkActivation extends UIObjectAction
+{
+
+ /** julien: Not used for now . */
+ // protected String url = null;
+
+ /** . */
+ protected Map queryParameters = null;
+
+ protected LinkActivation(String targetId, Map queryParameters)
+ {
+ super(targetId);
+
+ //
+ this.queryParameters = queryParameters;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map getQueryParameters()
+ {
+ return queryParameters;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/MoveUIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.protocol;
+
+import org.jboss.portal.presentation.model.UIObject;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MoveUIObjectAction extends UIObjectAction
+{
+ public MoveUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/PostActivation.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * 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.protocol;
+
+import org.jboss.portal.web.Body;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PostActivation extends LinkActivation
+{
+
+ /** . */
+ private final Body body;
+
+ public PostActivation(String targetId, Map queryParameters, Body body)
+ {
+ super(targetId, queryParameters);
+
+ //
+ this.body = body;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Body getBody()
+ {
+ return body;
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ if(this.queryParameters != null)
+ {
+ buffer.append("QueryString---------------\n");
+ for(Iterator itr=this.queryParameters.keySet().iterator(); itr.hasNext();)
+ {
+ String key = (String)itr.next();
+ String[] value = (String[])this.queryParameters.get(key);
+ buffer.append(key+"="+value[0]+"\n");
+ }
+ }
+
+ if(this.body != null && ((Body.Form)this.body).getParameters() != null)
+ {
+ buffer.append("PostBody---------------\n");
+ for(Iterator itr=((Body.Form)this.body).getParameters().keySet().iterator(); itr.hasNext();)
+ {
+ String key = (String)itr.next();
+ String[] value = ((Body.Form)this.body).getParameters().get(key);
+ buffer.append(key+"="+value[0]+"\n");
+ }
+ }
+
+ return buffer.toString();
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RedirectResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RedirectResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RedirectResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RedirectResponse extends ServerResponse
+{
+
+ /** . */
+ private final String location;
+
+ public RedirectResponse(String location)
+ {
+ this.location = location;
+ }
+
+ public String getLocation()
+ {
+ return location;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RenameUIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RenameUIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/RenameUIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RenameUIObjectAction extends UIObjectAction
+{
+
+ /** . */
+ private String name;
+
+ public RenameUIObjectAction(String targetId, String name)
+ {
+ super(targetId);
+
+ //
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class ServerAction
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ServerResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ServerResponse
+{
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ShowUIObjectResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ShowUIObjectResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ShowUIObjectResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * Tell the client to show a particular page.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ShowUIObjectResponse extends UIObjectResponse
+{
+ public ShowUIObjectResponse(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/StreamResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/StreamResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/StreamResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.protocol;
+
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class StreamResponse extends ServerResponse
+{
+ /**
+ *
+ */
+ private String contentType = null;
+
+ /**
+ *
+ */
+ private InputStream is = null;
+
+ /**
+ *
+ * @param contentType
+ * @param is
+ */
+ public StreamResponse(String contentType, InputStream is)
+ {
+ this.contentType = contentType;
+ this.is = is;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UIObjectAction extends ServerAction
+{
+
+ /** . */
+ private final String targetId;
+
+ public UIObjectAction(String targetId)
+ {
+ this.targetId = targetId;
+ }
+
+ public String getTargetId()
+ {
+ return targetId;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/UIObjectResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UIObjectResponse extends ServerResponse
+{
+
+ /** . */
+ private final String targetId;
+
+ public UIObjectResponse(String targetId)
+ {
+ this.targetId = targetId;
+ }
+
+ public String getTargetId()
+ {
+ return targetId;
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ViewUIObjectAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ViewUIObjectAction.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/ViewUIObjectAction.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.protocol;
+
+/**
+ * Shows a page.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ViewUIObjectAction extends UIObjectAction
+{
+ public ViewUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.server;
+
+import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface PresentationServer
+{
+ /**
+ *
+ * @return
+ */
+ Processor getProcessor();
+
+ /**
+ * Obtain the markup.
+ *
+ * @param context the request context
+ * @param window the window to get markup for
+ * @return the markup of the window
+ * @throws Exception for now a generic exception
+ */
+ WindowContent render(PresentationContext context, UIWindow window) throws Exception;
+
+ /**
+ *
+ * @return
+ */
+ StructuralStateContext getStructuralStateManager();
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/Processor.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/Processor.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/Processor.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.server;
+
+import org.jboss.portal.server.ServerException;
+import org.jboss.portal.presentation.client.PresentationContext;
+
+/**
+ * UIServer calls the Processor to hand it
+ * processing of an incoming Portal Request using the protocol between the two components encapsulated by the
+ * ProcessorRequest object
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface Processor
+{
+ /**
+ *
+ * @param request
+ * @throws ServerException
+ */
+ public ProcessorResponse process(PresentationContext presentationContext,ProcessorRequest request) throws ServerException;
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorRequest.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorRequest.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorRequest.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.server;
+
+import java.io.Serializable;
+
+import org.jboss.portal.presentation.protocol.ServerAction;
+
+
+/**
+ * ProcessorRequest is used to communicate information from the UIServer to the core Portal for it to process the incoming Portal request.
+ *
+ * This object is part of the protocol between the UIServer and the core
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ProcessorRequest implements Serializable
+{
+ /**
+ * The Portal action to be performed
+ */
+ private ServerAction action = null;
+
+ /**
+ *
+ *
+ */
+ public ProcessorRequest(ServerAction action)
+ {
+ this.action = action;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public ServerAction getAction()
+ {
+ return action;
+ }
+
+ /**
+ *
+ * @param action
+ */
+ public void setAction(ServerAction action)
+ {
+ this.action = action;
+ }
+
+ /**
+ *
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[action="+this.action+"]");
+ return buffer.toString();
+ }
+}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorResponse.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorResponse.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/ProcessorResponse.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * 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.server;
+
+import java.io.Serializable;
+
+import org.jboss.portal.presentation.protocol.ServerResponse;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ProcessorResponse implements Serializable
+{
+ /**
+ * type of content to be sent back to the client
+ */
+ private String contentType = null;
+
+ /**
+ * character set to be used
+ */
+ private String characterSet = null;
+
+ /**
+ * The ServerResponse generated by processing the ProcessorRequest by the Processor
+ */
+ private ServerResponse response = null;
+
+ /**
+ *
+ * @param dispatcher
+ * @param updatedPages
+ */
+ public ProcessorResponse(ServerResponse response)
+ {
+ this.response = response;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public ServerResponse getResponse()
+ {
+ return response;
+ }
+
+ /**
+ *
+ * @param response
+ */
+ public void setResponse(ServerResponse response)
+ {
+ this.response = response;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getCharacterSet()
+ {
+ return characterSet;
+ }
+
+ /**
+ *
+ * @param characterSet
+ */
+ public void setCharacterSet(String characterSet)
+ {
+ this.characterSet = characterSet;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ /**
+ *
+ * @param contentType
+ */
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/GetAjaxPageTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/GetAjaxPageTestCase.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/GetAjaxPageTestCase.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.test.ajax;
+
+import static org.jboss.unit.api.Assert.assertNotNull;
+
+import org.jboss.unit.TestId;
+import org.jboss.unit.driver.DriverCommand;
+import org.jboss.unit.driver.DriverContext;
+import org.jboss.unit.driver.DriverException;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.info.TestInfo;
+import org.jboss.unit.info.impl.SimpleTestCaseInfo;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.RequestContext;
+import org.jboss.unit.remote.ResponseContext;
+import org.jboss.unit.remote.driver.RemoteTestDriver;
+
+import org.jboss.unit.remote.driver.webpage.GetPageResponse;
+import org.jboss.unit.remote.driver.webpage.WebPageData;
+
+import org.jboss.logging.Logger;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.net.URI;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class GetAjaxPageTestCase implements RemoteTestDriver
+{
+ private static Logger log = Logger.getLogger(GetAjaxPageTestCase.class);
+
+ private TestInfo info = null;
+ private RequestContext requestContext = null;
+ private DriverResponse activeResponse = null;
+
+ /**
+ *
+ *
+ */
+ public GetAjaxPageTestCase()
+ {
+
+ }
+
+ /**
+ *
+ */
+ public void initDriver(DriverContext context) throws DriverException
+ {
+ this.info = new SimpleTestCaseInfo(this.getClass().getName());
+ }
+
+ /**
+ *
+ */
+ public void destroyDriver()
+ {
+ }
+
+ /**
+ *
+ */
+ public TestInfo getInfo()
+ {
+ return this.info;
+ }
+
+ /**
+ *
+ */
+ public DriverResponse invoke(TestId id, DriverCommand command)
+ {
+ try
+ {
+ if(this.requestContext.getRequestCount() <= 0)
+ {
+ this.activeResponse = new GetPageResponse(new URI("http://localhost:8080/presentation/index.html"));
+ }
+ else
+ {
+ WebPageData pageData = (WebPageData)requestContext.getPayload().get("pageData");
+ assertNotNull(pageData);
+
+ this.activeResponse = new EndTestResponse();
+ }
+
+ return this.activeResponse;
+ }
+ catch(Exception e)
+ {
+ log.error(e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ */
+ public void pushContext(TestId testId, RequestContext testContext)
+ {
+ this.requestContext = testContext;
+ }
+
+ /**
+ *
+ */
+ public ResponseContext popContext(TestId testId)
+ {
+ DriverResponse response = this.invoke(testId, null);
+ return new ResponseContext(response, new HashMap<String, Serializable>());
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/HostedModeProxy.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/HostedModeProxy.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/HostedModeProxy.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.test.ajax;
+
+import java.io.ByteArrayInputStream;
+
+import javax.servlet.http.HttpServletRequest;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+
+/**
+ * This is a RPC Proxy Service that is used only during development. This lets the GWT client-side agent integrate with the Portal server while running in
+ * Hosted Mode. It is very efficient to debug/develop client side GWT code in Hosted Mode.
+ *
+ * This service is never deployed in a production setting and Portal components *do not* have any compile time or run time dependency on this Proxy.
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class HostedModeProxy extends RemoteServiceServlet
+{
+ /**
+ *
+ */
+ public String processCall(String input) throws SerializationException
+ {
+ try
+ {
+ String response = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Setup the conversation with the portal server
+ WebConversation wc = null;
+ if(request.getSession().getAttribute("conversation") != null)
+ {
+ wc = (WebConversation)request.getSession().getAttribute("conversation");
+ }
+ else
+ {
+ wc = new WebConversation();
+ request.getSession().setAttribute("conversation", wc);
+ }
+
+ //Proxy this rpc request over to the Portal server
+ WebRequest post = new PostMethodWebRequest(
+ "http://localhost:8080/presentation/portalrpc",
+ new ByteArrayInputStream(input.getBytes()),
+ "text/plain; charset=utf-8"
+ );
+ WebResponse webResponse = wc.getResponse(post);
+ response = webResponse.getText();
+
+ return response;
+ }
+ catch(Exception e)
+ {
+ throw new SerializationException(e);
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/JBossUnitSandBox.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/JBossUnitSandBox.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/JBossUnitSandBox.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.test.ajax;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+import static org.jboss.unit.api.Assert.*;
+
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class JBossUnitSandBox
+{
+ @Test
+ public void test()
+ {
+ fail("Simple JBossUnit Test in the PresentationFramework successfully executed....");
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/PortletServiceImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/PortletServiceImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/ajax/PortletServiceImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,232 @@
+package org.jboss.portal.presentation.test.ajax;
+
+import java.io.InputStream;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.jboss.portal.presentation.ajax.client.PortletService;
+import org.jboss.portal.presentation.ajax.client.model.Page;
+import org.jboss.portal.presentation.ajax.client.model.Window;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * This is just a STUB server side component to test the client side components
+ * of the GWT-based AJAX UI
+ *
+ * Only used for Prototyping stuff
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PortletServiceImpl extends RemoteServiceServlet implements
+ PortletService
+{
+ /**
+ *
+ */
+ public String getPortlet(String portletId)
+ {
+ String portletContent = null;
+
+ String contentPath = portletId;
+ InputStream is = null;
+ try
+ {
+ is = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(contentPath);
+ StringBuffer contentBuffer = new StringBuffer();
+ int bytesRead = 0;
+ byte[] data = new byte[1024];
+ while ((bytesRead = is.read(data)) != -1)
+ {
+ byte[] cour = new byte[bytesRead];
+ System.arraycopy(data, 0, cour, 0, bytesRead);
+ contentBuffer.append(new String(cour));
+ }
+ portletContent = contentBuffer.toString();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ if (is != null)
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+
+ return portletContent;
+ }
+
+ /**
+ *
+ * @param pageId
+ * @return
+ */
+ public Page getPage(String pageId)
+ {
+ Page page = new Page();
+ page.setName(pageId);
+
+ if (pageId.equals("index") || pageId.equals("Page 1"))
+ {
+ String weatherContent = this.getPortlet("weatherPortlet.html");
+ String cmsContent = this.getPortlet("cmsPortlet.html");
+ Window[] windows = new Window[2];
+ page.setWindows(windows);
+
+ Window weatherWindow = new Window();
+ weatherWindow.setName("weatherPortlet");
+ weatherWindow.setContent(weatherContent);
+
+ Window cmsWindow = new Window();
+ cmsWindow.setName("cmsPortlet");
+ cmsWindow.setContent(cmsContent);
+
+ windows[0] = weatherWindow;
+ windows[1] = cmsWindow;
+ }
+ else if (pageId.equals("Page 2"))
+ {
+ String weatherContent = this.getPortlet("weatherPortlet.html");
+ Window[] windows = new Window[1];
+ page.setWindows(windows);
+
+ Window weatherWindow = new Window();
+ weatherWindow.setName("weatherPortlet");
+ weatherWindow.setContent(weatherContent);
+
+ windows[0] = weatherWindow;
+ }
+ else if (pageId.equals("Page 3"))
+ {
+ String cmsContent = this.getPortlet("cmsPortlet.html");
+ Window[] windows = new Window[1];
+ page.setWindows(windows);
+
+ Window cmsWindow = new Window();
+ cmsWindow.setName("cmsPortlet");
+ cmsWindow.setContent(cmsContent);
+
+ windows[0] = cmsWindow;
+ }
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+ request.getSession().setAttribute("currentPage", page);
+
+ return page;
+ }
+
+ /**
+ *
+ * @param window
+ * @param state
+ */
+ public Page setState(String window, String newState)
+ {
+ HttpServletRequest request = this.getThreadLocalRequest();
+ Page page = (Page) request.getSession().getAttribute("currentPage");
+
+ Window selectedWindow = this.findWindow(page, window);
+ selectedWindow.setState(newState);
+ if (selectedWindow.getState().equals(Window.NORMAL))
+ {
+ if (selectedWindow.getName().equals("cmsPortlet"))
+ {
+ selectedWindow.setContent(this.getPortlet("cmsPortlet.html"));
+ }
+ else
+ {
+ selectedWindow.setContent(this.getPortlet("weatherPortlet.html"));
+ }
+ this.hideWindows(page.getWindows(), null, false);
+ }
+ else if (selectedWindow.getState().equals(Window.MINIMIZED))
+ {
+ selectedWindow.setContent("");
+ this.hideWindows(page.getWindows(), null, false);
+ }
+ if (selectedWindow.getState().equals(Window.MAXIMIZED))
+ {
+ if (selectedWindow.getName().equals("cmsPortlet"))
+ {
+ selectedWindow.setContent(this.getPortlet("cmsPortlet.html"));
+ }
+ else
+ {
+ selectedWindow.setContent(this.getPortlet("weatherPortlet.html"));
+ }
+ this.hideWindows(page.getWindows(), selectedWindow, true);
+ }
+
+ return page;
+ }
+
+ /**
+ *
+ * @param window
+ * @param state
+ */
+ public Page setMode(String window, String newMode)
+ {
+ HttpServletRequest request = this.getThreadLocalRequest();
+ Page page = (Page) request.getSession().getAttribute("currentPage");
+
+ Window selectedWindow = this.findWindow(page, window);
+ selectedWindow.setMode(newMode);
+
+ return page;
+ }
+
+ /**
+ *
+ * @param page
+ * @param windowName
+ * @return
+ */
+ private Window findWindow(Page page, String windowName)
+ {
+ Window window = null;
+
+ Window[] windows = page.getWindows();
+ for (int i = 0; i < windows.length; i++)
+ {
+ if (windows[i].getName().equals(windowName))
+ {
+ window = windows[i];
+ break;
+ }
+ }
+
+ return window;
+ }
+
+ /**
+ *
+ * @param excludedWindow
+ * @param hide
+ */
+ private void hideWindows(Window[] windows, Window excludedWindow,
+ boolean hide)
+ {
+ for (int i = 0; i < windows.length; i++)
+ {
+ if (excludedWindow != null
+ && windows[i].getName().equals(excludedWindow.getName()))
+ {
+ continue;
+ }
+
+ windows[i].setVisible(!hide);
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestFlexibleGrid.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,202 @@
+/******************************************************************************
+ * 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.test.layout;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+
+import java.io.FileOutputStream;
+
+import org.jboss.portal.presentation.impl.classic.layout.FlexibleGrid;
+import org.jboss.portal.presentation.impl.classic.layout.FlexibleGridConstraints;
+import org.jboss.portal.presentation.impl.classic.layout.FlexibleGridLayoutManager;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class TestFlexibleGrid extends TestCase
+{
+ /**
+ *
+ */
+ private static Logger log = Logger.getLogger(TestFlexibleGrid.class);
+
+ /**
+ *
+ */
+ protected void setUp() throws Exception
+ {
+ }
+
+ /**
+ *
+ */
+ protected void tearDown() throws Exception
+ {
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ /*public void testDoLayout() throws Exception
+ {
+ // Setup a Page and a container with two portlet windows...
+ // This part is generic with no decoupling to anything layout specific
+ String htmlContent = this.getHtmlContent();
+ Page page = new Page();
+ Container container = new Container("container-1");
+ Window window1 = new Window("window-1", htmlContent);
+ Window window2 = new Window("window-2", htmlContent);
+ container.addComponent(window1);
+ container.addComponent(window2);
+ page.addContainer(container);
+
+ Container container2 = new Container("container-2");
+ container2.addComponent(window1);
+ container2.addComponent(window2);
+ page.addContainer(container2);
+
+
+ // Setup a Flexible Grid for laying out a container of portlet windows
+ FlexibleGrid grid1 = this.getGrid("container-1", 1, 2);
+ FlexibleGridConstraints constraints = this.getConstraints("window-1", "50", 0, 0, 25, 0, 0, 0);
+ FlexibleGridConstraints constraints2 = this.getConstraints("window-1", "50", 0, 0, 25, 0, 0, 1);
+ FlexibleGridConstraints[] firstGridConstraints = { constraints, constraints2 };
+ grid1.setConstraints(firstGridConstraints);
+
+
+ //Setup another Grid to be added right next to the previous grid
+ FlexibleGrid grid2 = this.getGrid("container-2", 1, 2);
+ constraints = this.getConstraints("window-1", "50", 0, 0, 25, 0, 0, 0);
+ constraints2 = this.getConstraints("window-1", "50", 0, 0, 25, 0, 0, 1);
+ FlexibleGridConstraints[] secondGridConstraints = { constraints, constraints2 };
+ grid2.setConstraints(secondGridConstraints);
+
+
+ // Setup the FlexibleGridLayoutManager for doing a layout and apply it
+ // to the Page
+ FlexibleGrid[] row1 = { grid1 };
+ FlexibleGrid[] row2 = { grid2 };
+ FlexibleGridLayoutManager layoutManager = new FlexibleGridLayoutManager();
+ layoutManager.addRowOfGrids(row1);
+ layoutManager.addRowOfGrids(row2);
+
+ // Perform the actual layout of the Page using the
+ // FlexibleGridLayoutManager
+ String output = layoutManager.doLayout(page);
+
+ log.info("--------------------------------------");
+ log.info(output);
+ log.info("--------------------------------------");
+
+ // Write this output to local file to test in a browser
+ FileOutputStream fos = new FileOutputStream(
+ "/home/soshah/html/layout/flexibleGrid.html");
+
+ StringBuffer buffer = new StringBuffer();
+
+ buffer
+ .append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><base href=\"http://localhost/\"/><title>CSS Layout Strategies</title><link rel=\"stylesheet\" type=\"text/css\" href=\"file:///home/soshah/html/layout/unitTest.css\"/></head><body id=\"body\">\n");
+ buffer.append(output);
+ buffer.append("</body></html>\n");
+
+ fos.write(buffer.toString().getBytes());
+ fos.flush();
+ fos.close();
+ }*/
+
+ /**
+ *
+ * @return
+ */
+ /*private String getHtmlContent()
+ {
+ String markup = null;
+
+ try
+ {
+ java.io.FileInputStream fis = new java.io.FileInputStream(
+ "/home/soshah/html/layout/greetings.html");
+
+ StringBuffer buffer = new StringBuffer();
+ int read = 0;
+ byte[] data = new byte[1000];
+ while ((read = fis.read(data)) != -1)
+ {
+ byte[] bufferData = new byte[read];
+ System.arraycopy(data, 0, bufferData, 0, read);
+ buffer.append(new String(bufferData));
+ }
+
+ markup = buffer.toString();
+ fis.close();
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ return markup;
+ }*/
+
+ /**
+ *
+ * @param containerId
+ * @param rows
+ * @param columns
+ * @return
+ */
+ /*private FlexibleGrid getGrid(String containerId,int rows, int columns)
+ {
+ FlexibleGrid grid = new FlexibleGrid(containerId);
+ grid.setRows(rows);
+ grid.setColumns(columns);
+ return grid;
+ }*/
+
+ /**
+ *
+ * @param componentId
+ * @param widthPercentage
+ * @param top
+ * @param bottom
+ * @param left
+ * @param right
+ */
+ /*private FlexibleGridConstraints getConstraints(String componentId, String widthPercentage, int top, int bottom, int left, int right, int row, int column)
+ {
+ FlexibleGridConstraints constraints = new FlexibleGridConstraints();
+ constraints.setComponentId(componentId);
+ constraints.setWidthPercentage(widthPercentage);
+ constraints.setRow(row);
+ constraints.setColumn(column);
+ constraints.setTop(top);
+ constraints.setBottom(bottom);
+ constraints.setLeft(left);
+ constraints.setRight(right);
+ return constraints;
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/layout/TestRegionLayoutManager.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,148 @@
+/******************************************************************************
+ * 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.test.layout;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+
+import java.io.FileOutputStream;
+
+import org.jboss.portal.presentation.impl.classic.layout.RegionConstraints;
+import org.jboss.portal.presentation.impl.classic.layout.RegionLayoutManager;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class TestRegionLayoutManager extends TestCase
+{
+ /**
+ *
+ */
+ private static Logger log = Logger.getLogger(TestRegionLayoutManager.class);
+
+ /**
+ *
+ */
+ protected void setUp() throws Exception
+ {
+ }
+
+ /**
+ *
+ */
+ protected void tearDown() throws Exception
+ {
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ /*public void testDoLayout() throws Exception
+ {
+ // Setup a Page and a container with two portlet windows...
+ // This part is generic with no decoupling to anything layout specific
+ String htmlContent = this.getHtmlContent();
+ Page page = new Page();
+ Container container = new Container("container-1");
+ Window window1 = new Window("window-1", htmlContent);
+ Window window2 = new Window("window-2", htmlContent);
+ container.addComponent(window1);
+ container.addComponent(window2);
+ page.addContainer(container);
+
+ Container container2 = new Container("container-2");
+ Window window3 = new Window("window-3", htmlContent);
+ Window window4 = new Window("window-4", htmlContent);
+ container2.addComponent(window3);
+ container2.addComponent(window4);
+ page.addContainer(container2);
+
+
+ // Setup a two RegionConstraints for laying out using RegionLayoutManager
+ RegionConstraints leftRegion = new RegionConstraints("container-1",RegionConstraints.LEFT);
+ RegionConstraints centerRegion = new RegionConstraints("container-2",RegionConstraints.CENTER);
+ RegionLayoutManager layoutManager = new RegionLayoutManager();
+ layoutManager.addRegionConstraints(leftRegion);
+ layoutManager.addRegionConstraints(centerRegion);
+
+ // Perform the actual layout of the Page using the
+ // RegionLayoutManager
+ String output = layoutManager.doLayout(page);
+
+ log.info("--------------------------------------");
+ log.info(output);
+ log.info("--------------------------------------");
+
+ // Write this output to local file to test in a browser
+ FileOutputStream fos = new FileOutputStream(
+ "/home/soshah/html/layout/regionLayout.html");
+
+ StringBuffer buffer = new StringBuffer();
+
+ buffer
+ .append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><base href=\"http://localhost/\"/><title>CSS Layout Strategies</title><link rel=\"stylesheet\" type=\"text/css\" href=\"file:///home/soshah/html/layout/unitTest.css\"/></head><body id=\"body\">\n");
+ buffer.append(output);
+ buffer.append("</body></html>\n");
+
+ fos.write(buffer.toString().getBytes());
+ fos.flush();
+ fos.close();
+ }*/
+
+ /**
+ *
+ * @return
+ */
+ /*private String getHtmlContent()
+ {
+ String markup = null;
+
+ try
+ {
+ java.io.FileInputStream fis = new java.io.FileInputStream(
+ "/home/soshah/html/layout/greetings2.html");
+
+ StringBuffer buffer = new StringBuffer();
+ int read = 0;
+ byte[] data = new byte[1000];
+ while ((read = fis.read(data)) != -1)
+ {
+ byte[] bufferData = new byte[read];
+ System.arraycopy(data, 0, bufferData, 0, read);
+ buffer.append(new String(bufferData));
+ }
+
+ markup = buffer.toString();
+ fis.close();
+ }
+ catch (Exception e)
+ {
+
+ }
+
+ return markup;
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.test.model;
+
+import org.jboss.portal.presentation.test.model.state.structural.MockModel;
+import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
+import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class AbstractModelTestCase extends TestCase
+{
+
+ /** . */
+ protected MockModel model;
+
+ public AbstractModelTestCase()
+ {
+ }
+
+ public AbstractModelTestCase(String testName)
+ {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception
+ {
+ this.model = new MockModelImpl();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ this.model = null;
+ }
+
+ protected final UIContext createContext()
+ {
+ return new UIObjectContainer(model.getStructuralStateContext(), new NavigationalStateContextImpl()).getRoot();
+ }
+
+ protected final void resetModel()
+ {
+ this.model = new MockModelImpl();
+ }
+
+ protected static final UIObject.Visitor CRAWLER = new UIObject.Visitor()
+ {
+ public boolean enterObject(UIObject object)
+ {
+ return true;
+ }
+
+ public void leaveObject(UIObject object)
+ {
+ }
+
+ public boolean enterChildren(UIObject object, boolean loaded)
+ {
+ return loaded;
+ }
+ };
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventAssert.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventAssert.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventAssert.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * 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.test.model;
+
+import junit.framework.Assert;
+import org.jboss.portal.presentation.model.ModelEvent;
+import org.jboss.portal.presentation.model.ModelListener;
+import org.jboss.portal.presentation.model.event.state.StateChange;
+import org.jboss.portal.presentation.model.event.state.StateChangeEvent;
+import org.jboss.portal.presentation.model.event.state.navigational.NavigationalStateModification;
+import org.jboss.portal.presentation.model.event.state.structural.StructuralStateModification;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventAssert implements ModelListener
+{
+
+ /** . */
+ private final List<ModelEvent> events = new ArrayList<ModelEvent>();
+
+ /** . */
+ private int index = 0;
+
+ public void onEvent(ModelEvent event)
+ {
+ events.add(event);
+ }
+
+ public <T> T next(Class<T> clazz)
+ {
+ Assert.assertTrue(index < events.size());
+ ModelEvent event = events.get(index++);
+ Assert.assertNotNull(event);
+ Assert.assertTrue(clazz.isInstance(event));
+ return clazz.cast(event);
+ }
+
+ public void next(String targetId, StructuralStateModification.Update sp)
+ {
+ StateChangeEvent ste = next(StateChangeEvent.class);
+ StateChange change = ste.getChange();
+ Assert.assertEquals(targetId, change.getTargetId());
+ StructuralStateModification.Update mod = (StructuralStateModification.Update)change.getModification();
+ 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, StructuralStateModification.Destruction sp)
+ {
+ StateChangeEvent ste = next(StateChangeEvent.class);
+ StateChange change = ste.getChange();
+ Assert.assertEquals(targetId, change.getTargetId());
+ StructuralStateModification.Destruction mod = (StructuralStateModification.Destruction)change.getModification();
+ }
+
+ public void next(String targetId, NavigationalStateModification ns)
+ {
+ StateChangeEvent ste = next(StateChangeEvent.class);
+ StateChange change = ste.getChange();
+ Assert.assertEquals(targetId, change.getTargetId());
+ NavigationalStateModification mod = (NavigationalStateModification)change.getModification();
+ Assert.assertEquals(ns.getKey(), mod.getKey());
+ Assert.assertEquals(ns.getNavigationalState(), mod.getNavigationalState());
+ }
+
+ public void assertEmpty()
+ {
+ Assert.assertEquals(events.size(), index);
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventTestCase.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/EventTestCase.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.test.model;
+
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.event.state.structural.StructuralStateModification;
+import org.jboss.portal.presentation.model.event.lifecycle.RelationshipAddedEvent;
+import org.jboss.portal.presentation.model.event.lifecycle.RelationshipRemovedEvent;
+
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventTestCase extends AbstractModelTestCase
+{
+
+ public EventTestCase()
+ {
+ }
+
+ public void testCreateChildEvents()
+ {
+ UIContext context = createContext();
+ context.getChildren().size();
+
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
+
+ //
+ UIObject foo = context.createChild("foo", UIPortal.class);
+ String fooId = foo.getId();
+
+ //
+ eventAssert.next(RelationshipAddedEvent.class);
+ eventAssert.next(fooId, new StructuralStateModification.Creation(UIPortal.class, "foo", new HashMap<String, String>()));
+ }
+
+ public void testDestroyChildEvents()
+ {
+ UIContext context = createContext();
+ UIObject foo = context.createChild("foo", UIPortal.class);
+ String fooId = foo.getId();
+ context.getChildren().size();
+
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
+
+ //
+ context.destroyChild("foo");
+
+ //
+ eventAssert.next(RelationshipRemovedEvent.class);
+ eventAssert.next(fooId, new StructuralStateModification.Destruction());
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MockModelTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MockModelTestCase.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MockModelTestCase.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,693 @@
+/******************************************************************************
+ * 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.test.model;
+
+import junit.framework.TestCase;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.state.StaleStateException;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.NoSuchStateException;
+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.StructuralStateContext;
+import org.jboss.portal.presentation.test.model.state.structural.MockModel;
+import org.jboss.portal.presentation.test.model.state.structural.MockObject;
+import org.jboss.portal.presentation.test.model.state.structural.MockException;
+import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * Test that the mock model we are using behaves in an expected manner
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MockModelTestCase extends TestCase
+{
+
+ /** . */
+ private MockModel model;
+
+ /** . */
+ private StructuralStateContext ssc;
+
+ protected void setUp() throws Exception
+ {
+ model = new MockModelImpl();
+ ssc = model.getStructuralStateContext();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ model = null;
+ ssc = null;
+ }
+
+ public void testRoot()
+ {
+ MockObject mockRoot = model.getRoot();
+ assertNotNull(mockRoot);
+ assertEquals(Collections.EMPTY_SET, mockRoot.getPropertyNames());
+ assertNull(mockRoot.getParent());
+ assertEquals(Collections.EMPTY_LIST, mockRoot.getChildren());
+ assertEquals(MockObject.Type.CONTEXT, mockRoot.getType());
+ assertEquals("", mockRoot.getName());
+ assertEquals(true, mockRoot.isValid());
+
+ //
+ String rootId = ssc.getRootId();
+ assertNotNull(rootId);
+ StructuralObject root = ssc.load(rootId);
+ assertNotNull(root);
+ assertEquals(rootId, root.getId());
+ StructuralState state = root.getState();
+ assertEquals(UIContext.class, state.getType());
+ assertEquals("", state.getName());
+ assertEquals(Collections.EMPTY_MAP, state.getProperties());
+ }
+
+ public void testSetProperty()
+ {
+ MockObject mockRoot = model.getRoot();
+ String rootId = mockRoot.getId();
+ int rootV0 = mockRoot.getVersion();
+
+ //
+ StructuralObject root0 = ssc.load(rootId);
+ StructuralState rootState0 = root0.getState();
+ assertEquals(Collections.EMPTY_MAP, rootState0.getProperties());
+
+ // Set
+ StructuralObject.Update update = ssc.update(root0, Collections.singletonMap("foo", "bar"));
+
+ //
+ int rootV1 = mockRoot.getVersion();
+ assertTrue(rootV1 > rootV0);
+ assertEquals(Collections.singleton("foo"), mockRoot.getPropertyNames());
+ assertEquals("bar", mockRoot.getPropertyValue("foo"));
+ assertEquals(Collections.EMPTY_MAP, rootState0.getProperties());
+ assertStale(root0);
+ StructuralObject root1_0 = update.getObject();
+ assertNotNull(root1_0);
+ assertNotStale(root1_0);
+ StructuralState rootState1_0 = root1_0.getState();
+ assertEquals(Collections.singletonMap("foo", "bar"), rootState1_0.getProperties());
+ StructuralObject root1_1 = ssc.load(rootId);
+ assertNotNull(root1_1);
+ assertNotStale(root1_1);
+ StructuralState rootState1_1 = root1_1.getState();
+ assertEquals(Collections.singletonMap("foo", "bar"), rootState1_1.getProperties());
+ }
+
+ public void testUpdateProperty() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+ String rootId = mockRoot.getId();
+ int rootV0 = mockRoot.getVersion();
+
+ //
+ StructuralObject root0 = ssc.load(rootId);
+ StructuralState rootState0 = root0.getState();
+ assertEquals(Collections.EMPTY_MAP, rootState0.getProperties());
+
+ // Set
+ mockRoot.setPropertyValue("foo", "bar");
+
+ //
+ int rootV1 = mockRoot.getVersion();
+ assertTrue(rootV1 > rootV0);
+ assertEquals(Collections.singleton("foo"), mockRoot.getPropertyNames());
+ assertEquals("bar", mockRoot.getPropertyValue("foo"));
+ assertEquals(Collections.EMPTY_MAP, rootState0.getProperties());
+ assertStale(root0);
+ StructuralObject root1 = ssc.load(rootId);
+ assertNotNull(root1);
+ assertNotStale(root1);
+ StructuralState rootState1 = root1.getState();
+ assertEquals(Collections.singletonMap("foo", "bar"), rootState1.getProperties());
+
+ // Update
+ StructuralObject.Update update = ssc.update(root1, Collections.singletonMap("foo", "bar2"));
+
+ //
+ int rootV2 = mockRoot.getVersion();
+ assertTrue(rootV2 > rootV1);
+ assertEquals(Collections.singleton("foo"), mockRoot.getPropertyNames());
+ assertEquals("bar2", mockRoot.getPropertyValue("foo"));
+ assertEquals(Collections.EMPTY_MAP, rootState0.getProperties());
+ assertStale(root0);
+ assertStale(root1);
+
+ //
+ StructuralObject root2_0 = update.getObject();
+ assertNotNull(root2_0);
+ assertNotStale(root2_0);
+ StructuralState rootState2_0 = root2_0.getState();
+ assertEquals(Collections.singletonMap("foo", "bar2"), rootState2_0.getProperties());
+ StructuralObject root2_1 = ssc.load(rootId);
+ assertNotNull(root2_1);
+ assertNotStale(root2_1);
+ StructuralState rootState2_1 = root2_1.getState();
+ assertEquals(Collections.singletonMap("foo", "bar2"), rootState2_1.getProperties());
+ }
+
+ public void testAddChild() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+ int rootV0 = mockRoot.getVersion();
+
+ //
+ String rootId = mockRoot.getId();
+ StructuralObject root = ssc.load(rootId);
+
+ //
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ assertNotNull(mockFoo);
+ String fooId = mockFoo.getId();
+
+ //
+ assertNotNull(fooId);
+ assertEquals("foo", mockFoo.getName());
+ assertEquals(MockObject.Type.PORTAL, mockFoo.getType());
+ assertSame(mockRoot, mockFoo.getParent());
+ assertEquals(Collections.singletonList(mockFoo), mockRoot.getChildren());
+ assertEquals(Collections.EMPTY_SET, mockFoo.getPropertyNames());
+ assertTrue(mockRoot.getVersion() > rootV0);
+
+ //
+ try
+ {
+ ssc.loadParent(root);
+ fail();
+ }
+ catch (StaleStateException ignore)
+ {
+ }
+ try
+ {
+ ssc.loadChildren(root);
+ fail();
+ }
+ catch (StaleStateException ignore)
+ {
+ }
+
+ //
+ root = ssc.load(rootId);
+ assertNotNull(root);
+ assertEquals(rootId, root.getId());
+
+ //
+ Collection<StructuralObject> children = ssc.loadChildren(root);
+ assertNotNull(children);
+ assertEquals(1, children.size());
+ StructuralObject foo = children.iterator().next();
+ assertNotNull(foo);
+ assertEquals(fooId, foo.getId());
+ StructuralState fooState = foo.getState();
+ assertNotNull(fooState);
+ assertEquals("foo", fooState.getName());
+ assertEquals(Collections.EMPTY_MAP, fooState.getProperties());
+ assertEquals(UIPortal.class, fooState.getType());
+ root = ssc.loadParent(foo);
+ assertNotNull(root);
+ assertEquals(rootId, root.getId());
+ }
+
+ public void testDestroy() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockFoo.addChild("bar", MockObject.Type.PAGE);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+ int rootV0 = mockRoot.getVersion();
+ int fooV0 = mockFoo.getVersion();
+ int barV0 = mockBar.getVersion();
+ String fooId = mockFoo.getId();
+ String barId = mockBar.getId();
+ String juuId = mockJuu.getId();
+ StructuralObject foo0 = ssc.load(fooId);
+ StructuralObject bar0 = ssc.load(barId);
+ StructuralObject juu0 = ssc.load(juuId);
+
+ //
+ model.destroy(mockJuu);
+
+ //
+ StructuralObject foo1 = ssc.load(fooId);
+ StructuralObject bar1 = ssc.load(barId);
+ StructuralObject juu1 = ssc.load(juuId);
+ int rootV1 = mockRoot.getVersion();
+ int fooV1 = mockFoo.getVersion();
+ int barV1 = mockBar.getVersion();
+
+ //
+ assertStale(juu0);
+ assertStale(foo0);
+ assertNotStale(bar0);
+ assertNull(juu1);
+ assertNotStale(foo1);
+ assertNotStale(bar1);
+ assertEquals(Collections.singletonList(mockFoo), mockRoot.getChildren());
+ assertEquals(Collections.singletonList(mockBar), mockFoo.getChildren());
+ assertTrue(mockFoo.isValid());
+ assertTrue(mockBar.isValid());
+ assertFalse(mockJuu.isValid());
+ assertTrue(rootV1 == rootV0);
+ assertTrue(fooV1 > fooV0);
+ assertTrue(barV1 == barV0);
+
+ //
+ model.destroy(mockFoo);
+
+ int rootV2 = mockRoot.getVersion();
+ StructuralObject foo2 = ssc.load(fooId);
+ StructuralObject bar2 = ssc.load(barId);
+ StructuralObject juu2 = ssc.load(juuId);
+
+ //
+ assertStale(juu0);
+ assertStale(foo0);
+ assertStale(bar0);
+ assertNull(juu1);
+ assertStale(foo1);
+ assertStale(bar1);
+ assertNull(foo2);
+ assertNull(bar2);
+ assertNull(juu2);
+ assertEquals(Collections.emptyList(), mockRoot.getChildren());
+ assertFalse(mockFoo.isValid());
+ assertFalse(mockBar.isValid());
+ assertFalse(mockJuu.isValid());
+ assertTrue(rootV2 > rootV1);
+ }
+
+ public void testDestroyInvalidates() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+
+ //
+ model.destroy(mockFoo);
+
+ //
+ assertEquals(false, mockFoo.isValid());
+ try
+ {
+ mockFoo.addChild("juu", MockObject.Type.PAGE);
+ }
+ catch (MockException e)
+ {
+ assertEquals(MockException.ErrorCode.INVALID_OBJECT, e.getCode());
+ }
+ try
+ {
+ model.destroy(mockFoo);
+ }
+ catch (MockException e)
+ {
+ assertEquals(MockException.ErrorCode.INVALID_OBJECT, e.getCode());
+ }
+ try
+ {
+ mockFoo.setPropertyValue("blah", "bluh");
+ }
+ catch (MockException e)
+ {
+ assertEquals(MockException.ErrorCode.INVALID_OBJECT, e.getCode());
+ }
+ }
+
+ public void testMove() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PAGE);
+
+ mockFoo.move(mockBar);
+
+ assertSame(mockBar, mockFoo.getParent());
+ assertEquals(Collections.singletonList(mockFoo), mockBar.getChildren());
+ assertEquals(Collections.singletonList(mockBar), mockRoot.getChildren());
+ }
+
+ public void testMove2() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PAGE);
+
+ //
+ String fooId = mockFoo.getId();
+ String barId = mockBar.getId();
+ String rootId = mockRoot.getId();
+
+ //
+ StructuralObject fooSO = ssc.load(fooId);
+ StructuralObject barSO = ssc.load(barId);
+ StructuralObject rootSO = ssc.load(rootId);
+
+ //
+ StructuralObject.Move move = ssc.move(fooSO, barSO);
+
+ //
+ assertNotNull(move);
+
+ //
+ StructuralObject newFooSO = move.getSource();
+ StructuralObject newBarSO = move.getDestination();
+ StructuralObject newRootSO = move.getParent();
+
+ //
+ assertEquals(rootId, newRootSO.getId());
+ assertEquals(fooId, newFooSO.getId());
+ assertEquals(barId, newBarSO.getId());
+
+ //
+ assertStale(fooSO);
+ assertStale(barSO);
+ assertStale(rootSO);
+
+ //
+ assertNotStale(newRootSO);
+ assertNotStale(newBarSO);
+ assertNotStale(newFooSO);
+ }
+
+ public void testMoveViolatesConstraint() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PAGE);
+ MockObject mockJuu = mockBar.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ try
+ {
+ mockRoot.move(mockRoot);
+ }
+ catch (MockException e)
+ {
+ assertEquals(MockException.ErrorCode.CONSTRAINT_VIOLATION, e.getCode());
+ }
+
+ //
+ try
+ {
+ mockRoot.move(mockFoo);
+ }
+ catch (MockException e)
+ {
+ assertEquals(MockException.ErrorCode.CONSTRAINT_VIOLATION, e.getCode());
+ }
+
+ //
+ try
+ {
+ mockBar.move(mockBar);
+ }
+ catch (MockException e)
+ {
+ assertEquals(MockException.ErrorCode.CONSTRAINT_VIOLATION, e.getCode());
+ }
+
+ //
+ try
+ {
+ mockBar.move(mockJuu);
+ }
+ catch (MockException e)
+ {
+ assertEquals(MockException.ErrorCode.CONSTRAINT_VIOLATION, e.getCode());
+ }
+ }
+
+ public void testInvalidatedByDestruction() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+
+ //
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PAGE);
+
+ //
+ StructuralObject foo = mockFoo.takeSnapshot();
+
+ //
+ model.destroy(mockFoo);
+
+ //
+ assertValidity(foo, NoSuchStateException.class);
+ }
+
+ public void testInvalidatedByPropertyUpdate() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+
+ //
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+
+ //
+ StructuralObject foo = mockFoo.takeSnapshot();
+
+ //
+ mockFoo.setPropertyValue("a", "b");
+
+ //
+ assertValidity(foo, StaleStateException.class);
+ }
+
+ public void testInvalidatedByChildCreation() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+
+ //
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+
+ //
+ StructuralObject foo = mockFoo.takeSnapshot();
+
+ //
+ mockFoo.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ assertValidity(foo, StaleStateException.class);
+ }
+
+ public void testInvalidatedByChildDestruction() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+
+ //
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ StructuralObject foo = mockFoo.takeSnapshot();
+
+ //
+ model.destroy(mockJuu);
+
+ //
+ assertValidity(foo, StaleStateException.class);
+ }
+
+ public void testInvalidatedByMove() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+
+ //
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PAGE);
+ MockObject mockBar = mockFoo.addChild("bar", MockObject.Type.PAGE);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ StructuralObject foo = mockFoo.takeSnapshot();
+ StructuralObject bar = mockBar.takeSnapshot();
+ StructuralObject juu = mockJuu.takeSnapshot();
+
+ //
+ mockBar.move(mockJuu);
+
+ //
+ assertValidity(foo, StaleStateException.class);
+ assertValidity(bar, StaleStateException.class);
+ assertValidity(juu, StaleStateException.class);
+ }
+
+ public void testRefresh() throws MockException
+ {
+ MockObject mockRoot = model.getRoot();
+ String rootId = mockRoot.getId();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ String fooId = mockFoo.getId();
+ MockObject mockJuu = mockRoot.addChild("juu", MockObject.Type.PORTAL);
+ String juuId = mockJuu.getId();
+ MockObject mockFaa = mockRoot.addChild("faa", MockObject.Type.PORTAL);
+ String faaId = mockFaa.getId();
+ StructuralObject rootV0 = ssc.load(rootId);
+
+ //
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PORTAL);
+ String barId = mockBar.getId();
+ model.destroy(mockFoo);
+ mockJuu.setPropertyValue("blah", "blah");
+
+ //
+ StructuralObject.Refresh comparison = ssc.refresh(rootV0);
+ assertNotNull(comparison);
+ Set<String> removed = comparison.getRemovedChildren();
+ assertNotNull(removed);
+ assertEquals(1, removed.size());
+ assertEquals(fooId, removed.iterator().next());
+
+ //
+ Set<StructuralObject> added = comparison.getAddedChildren();
+ assertNotNull(added);
+ assertEquals(1, added.size());
+ assertEquals(barId, added.iterator().next().getId());
+
+ //
+ Map<String, StructuralObject> stale = comparison.getStaleChildren();
+ assertNotNull(stale);
+ assertEquals(1, stale.size());
+ StructuralObject juu = stale.values().iterator().next();
+ assertNotNull(juu);
+ assertEquals(juuId, juu.getId());
+ assertEquals("blah", juu.getState().getProperties().get("blah"));
+
+ //
+ Set<String> valid = comparison.getValidChildren();
+ assertNotNull(valid);
+ assertEquals(1, valid.size());
+ assertEquals(faaId, valid.iterator().next());
+ }
+
+ private void assertValidity(StructuralObject object, Class<? extends StateException> expected) throws MockException
+ {
+ //
+ try
+ {
+ ssc.validate(object);
+ fail();
+ }
+ catch (StateException e)
+ {
+ assertTrue(expected.isInstance(e));
+ }
+
+ //
+ try
+ {
+ ssc.loadChildren(object);
+ fail();
+ }
+ catch (StateException e)
+ {
+ assertTrue(expected.isInstance(e));
+ }
+
+ //
+ try
+ {
+ ssc.loadParent(object);
+ fail();
+ }
+ catch (StateException e)
+ {
+ assertTrue(expected.isInstance(e));
+ }
+
+ //
+ try
+ {
+ StructuralObject bar = model.getRoot().addChild("bar", MockObject.Type.PAGE).takeSnapshot();
+ ssc.move(object, bar);
+ fail();
+ }
+ catch (StateException e)
+ {
+ assertTrue(expected.isInstance(e));
+ }
+
+ //
+ try
+ {
+ ssc.create(object, UIPage.class, "juu", new HashMap<String, String>());
+ fail();
+ }
+ catch (StateException e)
+ {
+ assertTrue(expected.isInstance(e));
+ }
+
+ //
+ try
+ {
+ ssc.destroy(object);
+ fail();
+ }
+ catch (StateException e)
+ {
+ assertTrue(expected.isInstance(e));
+ }
+
+ //
+ try
+ {
+ ssc.update(object, new HashMap<String, String>());
+ fail();
+ }
+ catch (StateException e)
+ {
+ assertTrue(expected.isInstance(e));
+ }
+ }
+
+ private void assertStale(StructuralObject object)
+ {
+ try
+ {
+ ssc.validate(object);
+ fail();
+ }
+ catch (StateException ignore)
+ {
+ }
+ }
+
+ private void assertNotStale(StructuralObject object)
+ {
+ ssc.validate(object);
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/ModelTestCase.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,903 @@
+/******************************************************************************
+ * 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.test.model;
+
+import junit.framework.Assert;
+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;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.event.state.structural.StructuralStateModification;
+import org.jboss.portal.presentation.model.event.lifecycle.RelationshipAddedEvent;
+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.test.model.state.structural.MockObject;
+import org.jboss.portal.presentation.test.model.state.structural.MockException;
+import org.jboss.portal.common.util.Tools;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ */
+public class ModelTestCase extends AbstractModelTestCase
+{
+
+ public void testUIContextParentIsNull()
+ {
+ UIContext context = createContext();
+ assertEquals(null, context.getParent());
+ }
+
+ public void testSetPropertyThrowsIAE()
+ {
+ UIContext context = createContext();
+
+ //
+ try
+ {
+ context.setProperty(null, "foo", "foo_value");
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+
+ //
+ try
+ {
+ context.setProperty(StateType.STRUCTURAL, null, "foo_value");
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+ }
+
+ public void testGetPropertyThrowsIAE()
+ {
+ UIContext context = createContext();
+
+ //
+ try
+ {
+ context.getProperty(null, "foo");
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+
+ //
+ try
+ {
+ context.getProperty(StateType.STRUCTURAL, null);
+ fail();
+ }
+ catch (IllegalArgumentException ignore)
+ {
+ }
+ }
+
+ public void testLoadChildren() throws Exception
+ {
+ MockObject mockDefaultPortal = model.getRoot().addChild("defaultPortal", MockObject.Type.PORTAL);
+ MockObject mockSomeOtherPortal = model.getRoot().addChild("someOtherPortal", MockObject.Type.PORTAL);
+ UIContext context = createContext();
+
+ //
+ Collection<? extends UIObject> children = context.getChildren();
+ assertNotNull(children);
+ assertEquals(2, children.size());
+ Map childrenMap = toMap(children);
+
+ //
+ UIPortal defaultPortal = (UIPortal)childrenMap.get(mockDefaultPortal.getId());
+ assertNotNull(defaultPortal);
+ assertSame(defaultPortal, context.getObject(defaultPortal.getId()));
+ assertEquals("defaultPortal", defaultPortal.getName());
+ assertEquals(mockDefaultPortal.getId(), defaultPortal.getId());
+ assertSame(context, defaultPortal.getParent());
+ assertEquals(0, defaultPortal.getChildren().size());
+
+ //
+ UIPortal someOtherPortal = (UIPortal)childrenMap.get(mockSomeOtherPortal.getId());
+ assertNotNull(someOtherPortal);
+ assertSame(someOtherPortal, context.getObject(someOtherPortal.getId()));
+ assertEquals("someOtherPortal", someOtherPortal.getName());
+ assertEquals(mockSomeOtherPortal.getId(), someOtherPortal.getId());
+ assertSame(context, someOtherPortal.getParent());
+ assertEquals(0, defaultPortal.getChildren().size());
+ }
+
+ Map<String, UIObject> toMap(Collection<? extends UIObject> objects)
+ {
+ Map<String, UIObject> map = new HashMap<String, UIObject>();
+ for (UIObject o : objects)
+ {
+ map.put(o.getId(), o);
+ }
+ return map;
+ }
+
+ public void testLoadChildrenFromStale() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockFoo.addChild("bar", MockObject.Type.PORTAL);
+
+ // Load the context object
+ UIObject foo = createContext().getObject(mockFoo.getId());
+
+ // Make a concurrent modification of the children
+ model.destroy(mockBar);
+
+ // Access children
+ try
+ {
+ Collection<? extends UIObject> children = foo.getChildren();
+ for (UIObject child : children)
+ {
+ }
+ fail();
+ }
+ catch (StaleStateException expected)
+ {
+ }
+
+ // Now state should be stale
+ assertEquals(UIObject.Status.STALE, foo.getStatus());
+ }
+
+ public void testLoadParentFromStale() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockFoo.addChild("bar", MockObject.Type.PORTAL);
+
+ // Load the context object
+ UIObject foo = createContext().getObject(mockFoo.getId());
+
+ // Make a concurrent modification of the children
+ model.destroy(mockBar);
+
+ // Access children
+ try
+ {
+ foo.getParent();
+ fail();
+ }
+ catch (StaleStateException expected)
+ {
+ }
+
+ // Now state should be stale
+ assertEquals(UIObject.Status.STALE, foo.getStatus());
+ }
+
+ public void loadChildrenFromDestroyed() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockFoo.addChild("bar", MockObject.Type.PORTAL);
+
+ // Load the context object
+ UIObject foo = createContext().getObject(mockFoo.getId());
+
+ // Make a concurrent modification of the children
+ model.destroy(mockFoo);
+
+ // Access children
+ try
+ {
+ Collection<? extends UIObject> children = foo.getChildren();
+ for (UIObject child : children)
+ {
+ }
+ fail();
+ }
+ catch (NoSuchStateException expected)
+ {
+ }
+
+ // Now state should be invalid
+ assertEquals(UIObject.Status.INVALID, foo.getStatus());
+ }
+
+ public void loadParentFromDestroyed() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockFoo.addChild("bar", MockObject.Type.PORTAL);
+
+ // Load the context object
+ UIObject foo = createContext().getObject(mockFoo.getId());
+
+ // Make a concurrent modification of the children
+ model.destroy(mockFoo);
+
+ // Access children
+ try
+ {
+ foo.getParent();
+ fail();
+ }
+ catch (NoSuchStateException expected)
+ {
+ }
+
+ // Now state should be invalid
+ assertEquals(UIObject.Status.INVALID, foo.getStatus());
+ }
+
+ public void testLoadParent() throws Exception
+ {
+ MockObject mockDefaultPortal = model.getRoot().addChild("defaultPortal", MockObject.Type.PORTAL);
+ MockObject mockDefaultPage = mockDefaultPortal.addChild("defaultPage", MockObject.Type.PAGE);
+ UIContext context = createContext();
+
+ //
+ UIPage defaultPage = (UIPage)context.getObject(mockDefaultPage.getId());
+ assertNotNull(defaultPage);
+ assertEquals("defaultPage", defaultPage.getName());
+ assertEquals(mockDefaultPage.getId(), defaultPage.getId());
+
+ //
+ UIPortal defaultPortal = (UIPortal)defaultPage.getParent();
+ assertNotNull(defaultPortal);
+ assertEquals(defaultPortal.getName(), "defaultPortal");
+ assertEquals(mockDefaultPortal.getId(), defaultPortal.getId());
+ }
+
+ private static class PropertyAssert
+ {
+ /** . */
+ private final UIObject object;
+
+ private PropertyAssert(UIObject object)
+ {
+ this.object = object;
+ }
+
+ private static final class Blah
+ {
+ }
+
+ void assertStructuralEquals(String propertyName, String propertyValue)
+ {
+ assertEquals(StateType.STRUCTURAL, propertyName, propertyValue, String.class);
+ }
+
+ <T> void assertNavigationalEquals(String propertyName, T propertyValue, Class<T> propertyClass)
+ {
+ assertEquals(StateType.NAVIGATIONAL, propertyName, propertyValue, propertyClass);
+ }
+
+ <T> void assertEquals(StateType stateType, String propertyName, T propertyValue, Class<T> propertyClass)
+ {
+ 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
+ {
+ UIContext context = createContext();
+ MockObject mockFoo = model.getRoot().addChild("foo", MockObject.Type.PORTAL);
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ model.destroy(mockFoo);
+
+ //
+ try
+ {
+ foo.setProperty(StateType.STRUCTURAL, "foo", "foo_value");
+ fail();
+ }
+ catch (NoSuchStateException e)
+ {
+ }
+ }
+
+ public void testUpdateExistingMutableStructuralProperty() throws MockException
+ {
+ MockObject mockFoo = model.getRoot().addChild("foo", MockObject.Type.PORTAL);
+ String fooId = mockFoo.getId();
+ mockFoo.setPropertyValue("foo", "foo_value");
+ UIContext context = createContext();
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(fooId);
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", "foo_value");
+
+ // Update structural property
+ 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(StateType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_new_value");
+ eventAssert.assertEmpty();
+ }
+
+ public void testUpdateExistingNonMutableStructuralProperty() throws MockException
+ {
+ MockObject mockFoo = model.getRoot().addChild("foo", MockObject.Type.PORTAL);
+ String fooId = mockFoo.getId();
+ mockFoo.setPropertyValue("foo", "foo_value");
+ mockFoo.setPropertyBehavior("foo", MockObject.Failure.veto());
+ UIContext context = createContext();
+ EventAssert eventAssert = new EventAssert();
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(fooId);
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", "foo_value");
+
+ // Try an update
+ try
+ {
+ foo.setProperty(StateType.STRUCTURAL, "foo", "foo_new_value");
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_value");
+ eventAssert.assertEmpty();
+
+ // Try a non string type
+ try
+ {
+ foo.setProperty(StateType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_value");
+ eventAssert.assertEmpty();
+ }
+
+ public void testUpdateNonExistingMutableStructuralProperty() throws MockException
+ {
+ MockObject mockFoo = model.getRoot().addChild("foo", MockObject.Type.PORTAL);
+ String fooId = mockFoo.getId();
+ UIContext context = createContext();
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(fooId);
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", null);
+
+ // Update structural property
+ 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(StateType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", "foo_new_value");
+ eventAssert.assertEmpty();
+ }
+
+ public void testUpdateNonExistingNonMutableStructuralProperty() throws MockException
+ {
+ MockObject mockFoo = model.getRoot().addChild("foo", MockObject.Type.PORTAL);
+ mockFoo.setPropertyBehavior("foo", MockObject.Failure.veto());
+ UIContext context = createContext();
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertStructuralEquals("foo", null);
+
+ // Try an update
+ try
+ {
+ foo.setProperty(StateType.STRUCTURAL, "foo", "foo_new_value");
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", null);
+ eventAssert.assertEmpty();
+
+ // Try a non string type
+ try
+ {
+ foo.setProperty(StateType.STRUCTURAL, "foo", 2);
+ fail("Property update should have been vetoed");
+ }
+ catch (StateChangeVetoException ignore)
+ {
+ }
+ fooAssert.assertStructuralEquals("foo", null);
+ eventAssert.assertEmpty();
+ }
+
+ public void testUpdateNavigationalProperty() throws MockException
+ {
+ MockObject mockFoo = model.getRoot().addChild("foo", MockObject.Type.PORTAL);
+ UIContext context = createContext();
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
+
+ // Check initial state
+ UIPortal foo = (UIPortal)context.getObject(mockFoo.getId());
+ PropertyAssert fooAssert = new PropertyAssert(foo);
+ fooAssert.assertNavigationalEquals("foo", null, String.class);
+
+ // Update navigational state
+ foo.setProperty(StateType.NAVIGATIONAL, "foo", "foo_new_value");
+ fooAssert.assertNavigationalEquals("foo", "foo_new_value", String.class);
+
+ // Update navigational state
+ foo.setProperty(StateType.NAVIGATIONAL, "foo", 2);
+ fooAssert.assertNavigationalEquals("foo", 2, Integer.class);
+ }
+
+ public void testStructuralPropertyUpdateKeepModelStateConsistent()
+ {
+ UIContext context = createContext();
+
+ //
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar");
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar2");
+ }
+
+ public void testConcurrentStructuralPropertyDetection() throws MockException
+ {
+ UIContext context = createContext();
+
+ //
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar");
+
+ // The concurrent update
+ model.getRoot().setPropertyValue("foo", "bar2");
+
+ //
+ try
+ {
+ context.setProperty(StateType.STRUCTURAL, "foo", "bar3");
+ fail("Was expecting an stale state exception");
+ }
+ catch (StaleStateException ignore)
+ {
+ }
+ }
+
+ public void testCreateChild()
+ {
+ UIContext context = createContext();
+ EventAssert eventAssert = new EventAssert();
+ context.addModelListener(eventAssert);
+
+ //
+ Collection<? extends UIObject> rootChildren = context.getChildren();
+ assertNotNull(rootChildren);
+ assertEquals(0, rootChildren.size());
+ assertNull(context.getChild("foo"));
+
+ //
+ UIPortal portal = context.createChild("foo", UIPortal.class);
+ assertNotNull(portal);
+ assertSame(context, portal.getParent());
+ assertSame(portal, context.getChild("foo"));
+ assertEquals(1, rootChildren.size());
+ assertSame(portal, rootChildren.iterator().next());
+ eventAssert.next(portal.getId(), new StructuralStateModification.Creation(UIPortal.class, "foo", new HashMap<String, String>()));
+ }
+
+ public void testDestroyChildUpdatesLoadedDescendant() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+ MockObject mockDaa = mockJuu.addChild("daa", MockObject.Type.PAGE);
+
+ //
+ String daaId = mockDaa.getId();
+
+ //
+ UIContext context = createContext();
+
+ // Load only the descendant
+ UIObject daa = context.getObject(daaId);
+ Collection<? extends UIObject> daaChildren = daa.getChildren();
+
+ // Destroy foo
+ context.destroyChild("foo");
+
+ // Check daa state
+ assertEquals(UIObject.Status.INVALID, daa.getStatus());
+ assertEquals(null, context.getObject(daaId));
+ try
+ {
+ daaChildren.size();
+ fail();
+ }
+ catch (NoSuchStateException ignore)
+ {
+ }
+ }
+
+ public void testDestroyChildUpdatesLoadedSubtree() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+ MockObject mockDaa = mockJuu.addChild("daa", MockObject.Type.PAGE);
+
+ //
+ String fooId = mockFoo.getId();
+ String juuId = mockJuu.getId();
+ String daaId = mockDaa.getId();
+
+ //
+ UIContext context = createContext();
+
+ // Load subtree entirely
+ UIObject foo = context.getChild("foo");
+ UIObject juu = foo.getChild("juu");
+ UIObject daa = juu.getChild("daa");
+ Collection<? extends UIObject> fooChildren = foo.getChildren();
+ Collection<? extends UIObject> juuChildren = juu.getChildren();
+ Collection<? extends UIObject> daaChildren = daa.getChildren();
+
+ //
+ foo.destroyChild("juu");
+
+ //
+ try
+ {
+ juuChildren.size();
+ fail();
+ }
+ catch (NoSuchStateException ignore)
+ {
+ }
+ try
+ {
+ daaChildren.size();
+ fail();
+ }
+ catch (NoSuchStateException ignore)
+ {
+ }
+ assertEquals(0, fooChildren.size());
+ assertEquals(UIObject.Status.VALID, foo.getStatus());
+ assertEquals(UIObject.Status.INVALID, juu.getStatus());
+ assertEquals(UIObject.Status.INVALID, daa.getStatus());
+ assertSame(foo, context.getObject(fooId));
+ assertEquals(null, context.getObject(juuId));
+ assertEquals(null, context.getObject(daaId));
+ }
+
+ public void testParentNavigationUpdatesExistingParentStatus() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ String fooId = mockFoo.getId();
+ String juuId = mockJuu.getId();
+
+ //
+ UIContext context = createContext();
+
+ // Get the object
+ UIObject foo = context.getObject(fooId);
+ UIObject juu = context.getObject(juuId);
+
+ //
+ assertEquals(UIObject.Status.VALID, juu.getStatus());
+ assertEquals(UIObject.Status.VALID, foo.getStatus());
+
+ // Now update foo concurrently
+ mockFoo.setPropertyValue("abc", "def");
+
+ // Now navigate
+ UIObject foo2 = juu.getParent();
+
+ //
+ assertSame(foo, foo2);
+ assertEquals(UIObject.Status.VALID, juu.getStatus());
+ assertEquals(UIObject.Status.STALE, foo.getStatus());
+ }
+
+ public void testChildrenNavigationUpdatesExistingChildStatus() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ String fooId = mockFoo.getId();
+ String juuId = mockJuu.getId();
+
+ //
+ UIContext context = createContext();
+
+ // Get the object
+ UIObject foo = context.getObject(fooId);
+ UIObject juu = context.getObject(juuId);
+
+ //
+ assertEquals(UIObject.Status.VALID, juu.getStatus());
+ assertEquals(UIObject.Status.VALID, foo.getStatus());
+
+ // Now update juu concurrently
+ mockJuu.setPropertyValue("abc", "def");
+
+ // Now navigate
+ Collection<? extends UIObject> fooChildren = foo.getChildren();
+
+ //
+ assertNotNull(fooChildren);
+ assertEquals(1, fooChildren.size());
+ assertSame(juu, fooChildren.iterator().next());
+ assertEquals(UIObject.Status.STALE, juu.getStatus());
+ assertEquals(UIObject.Status.VALID, foo.getStatus());
+ }
+
+ public void testChildrenNavigationCombinesExistingChildrenAndLoadAbsentChildren() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+ MockObject mockDaa = mockFoo.addChild("daa", MockObject.Type.PAGE);
+
+ //
+ String fooId = mockFoo.getId();
+ String juuId = mockJuu.getId();
+ String daaId = mockDaa.getId();
+
+ //
+ UIContext context = createContext();
+
+ // Load foo and juu but not daa
+ UIObject foo = context.getObject(fooId);
+ UIObject juu = context.getObject(juuId);
+
+ // Now navigate
+ Collection<? extends UIObject> fooChildren = foo.getChildren();
+
+ //
+ assertNotNull(fooChildren);
+ Map<String, UIObject> tmp = new HashMap<String, UIObject>();
+ for (UIObject o : fooChildren)
+ {
+ tmp.put(o.getId(), o);
+ }
+
+ //
+ assertEquals(2, tmp.size());
+ assertEquals(Tools.toSet(juuId, daaId), tmp.keySet());
+ assertSame(juu, tmp.get(juuId));
+ UIObject daa = tmp.get(daaId);
+ assertSame(context.getObject(daaId), daa);
+ }
+
+ public void testRefreshAfterConcurrentMove() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PORTAL);
+
+ MockObject mockFooJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+ MockObject mockFooDaa = mockFoo.addChild("daa", MockObject.Type.PAGE);
+
+ MockObject mockBarDaa = mockBar.addChild("daa", MockObject.Type.PAGE);
+
+ // Load fully the context 1
+ UIContext context1 = createContext();
+ loadSubTree(context1);
+
+ // Concurrent move
+ UIContext context2 = createContext();
+ context2.getChild("foo").getChild("juu").move(context2.getChild("bar"));
+
+ //
+ context1.getChild("bar").refresh();
+ }
+
+ public void testPartialRefreshAfterConcurrentMove() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PORTAL);
+ MockObject mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ doTestPartialRefreshAfterConcurrentMove(true);
+
+ //
+ resetModel();
+
+ //
+ mockRoot = model.getRoot();
+ mockBar = mockRoot.addChild("bar", MockObject.Type.PORTAL);
+ mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ mockJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+
+ //
+ doTestPartialRefreshAfterConcurrentMove(false);
+ }
+
+ public void doTestPartialRefreshAfterConcurrentMove(boolean bilto) throws Exception
+ {
+
+ // Load fully the context 1
+ UIContext context1 = createContext();
+ loadSubTree(context1);
+ UIObject foo1 = context1.getChild("foo");
+ UIObject juu1 = foo1.getChild("juu");
+ UIObject bar1 = context1.getChild("bar");
+
+ // Load fully the context 2
+ UIContext context2 = createContext();
+ loadSubTree(context2);
+ UIObject foo2 = context2.getChild("foo");
+ UIObject juu2 = foo2.getChild("juu");
+ UIObject bar2 = context2.getChild("bar");
+
+ // Load fully the context 3
+ UIContext context3 = createContext();
+ loadSubTree(context3);
+ UIObject foo3 = context3.getChild("foo");
+ UIObject juu3 = foo3.getChild("juu");
+ UIObject bar3 = context3.getChild("bar");
+
+ // Load fully the context 4
+ UIContext context4 = createContext();
+ loadSubTree(context4);
+ UIObject foo4 = context4.getChild("foo");
+ UIObject juu4 = foo4.getChild("juu");
+ UIObject bar4 = context4.getChild("bar");
+ String juu4id = juu4.getId();
+
+ // Concurrent move
+ UIContext context = createContext();
+ context.getChild("foo").getChild("juu").move(context.getChild("bar"));
+
+ //
+ System.err.println("-------------");
+ foo1.refresh(CRAWLER);
+ assertEquals(UIObject.Status.VALID, foo1.getStatus());
+ assertEquals(0, foo1.getChildren().size());
+
+ //
+ bar2.refresh(CRAWLER);
+ assertEquals(UIObject.Status.VALID, foo2.getStatus());
+ assertEquals(UIObject.Status.VALID, bar2.getStatus());
+ assertEquals(Tools.toSet(juu2), new HashSet<UIObject>(bar2.getChildren()));
+ assertEquals(bar2, juu2.getParent());
+
+ //
+ System.err.println("bilto = " + bilto);
+ context3.refresh(CRAWLER);
+ assertEquals(UIObject.Status.VALID, foo3.getStatus());
+ assertEquals(UIObject.Status.VALID, bar3.getStatus());
+ if (bilto)
+ {
+ assertEquals(UIObject.Status.INVALID, juu3.getStatus());
+ juu3 = context3.getObject(juu4id);
+ }
+ assertEquals(UIObject.Status.VALID, juu3.getStatus());
+ assertEquals(Tools.toSet(juu3), new HashSet<UIObject>(bar3.getChildren()));
+
+ //
+ }
+
+ private void loadSubTree(UIObject object)
+ {
+ for (UIObject child : object.getChildren())
+ {
+ child.getParent();
+ loadSubTree(child);
+ }
+ }
+
+ public void testMove() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PORTAL);
+
+ MockObject mockFooJuu = mockFoo.addChild("juu", MockObject.Type.PAGE);
+ MockObject mockFooDaa = mockFoo.addChild("daa", MockObject.Type.PAGE);
+
+ MockObject mockBarDaa = mockBar.addChild("daa", MockObject.Type.PAGE);
+
+ //
+ UIContext context = createContext();
+
+ //
+ UIObject foo = context.getChild("foo");
+ Collection<? extends UIObject> fooChildren = foo.getChildren();
+ UIObject fooJuu = foo.getChild("juu");
+ UIObject fooDaa = foo.getChild("daa");
+ UIObject bar = context.getChild("bar");
+ UIObject barDaa = bar.getChild("daa");
+ Collection<? extends UIObject> barChildren = bar.getChildren();
+
+ //
+ fooJuu.move(bar);
+
+ //
+ assertEquals(bar, fooJuu.getParent());
+ assertEquals(Collections.singleton(fooDaa), new HashSet<UIObject>(fooChildren));
+ assertEquals(Tools.toSet(barDaa, fooJuu), new HashSet<UIObject>(barChildren));
+ }
+
+ public void testBlah() throws Exception
+ {
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PORTAL);
+
+ EventAssert blah = new EventAssert();
+
+ UIContext context = createContext();
+ context.addModelListener(blah);
+ UIObject foo = context.getObject(mockFoo.getId());
+ blah.assertEmpty();
+ foo.getParent();
+ blah.next(RelationshipAddedEvent.class);
+ }
+
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIModelTester.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIModelTester.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UIModelTester.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,186 @@
+/******************************************************************************
+ * 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.test.model;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+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.UIContext;
+import org.jboss.portal.presentation.test.model.state.structural.MockModelImpl;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIModelTester extends TestCase
+{
+ private Logger logger = Logger.getLogger(this.getClass());
+ private UIContext uiContext = null;
+
+ /**
+ *
+ */
+ protected void setUp() throws Exception
+ {
+ this.uiContext = new UIObjectContainer(new MockModelImpl().getStructuralStateContext(), new NavigationalStateContextImpl()).getRoot();
+ }
+
+ /**
+ *
+ */
+ protected void tearDown() throws Exception
+ {
+ this.uiContext = null;
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ /*public void testCreateChild() throws Exception
+ {
+ //Adding a UIContext...this should result in an IllegalArgumentException
+ try
+ {
+ this.uiContext.createChild("duplicateRoot", UIContext.class);
+ }
+ catch(Exception e)
+ {
+ this.assertEquals(e.getClass(), IllegalArgumentException.class);
+ }
+
+ //Assert the state of UIPortal added to the UIObject tree
+ UIPortal portal = this.uiContext.createChild("defaultPortal", UIPortal.class);
+ assertEquals(portal.getName(), "defaultPortal");
+ assertEquals(portal.getId(), "/defaultPortal");
+ assertTrue(portal.getParent() instanceof UIContext);
+
+ //Add a UIPage to the UIPortal
+ UIPage page = portal.createChild("defaultPage", UIPage.class);
+ assertEquals(page.getName(), "defaultPage");
+ assertEquals(page.getId(), "/defaultPortal/defaultPage");
+ assertTrue(page.getParent() instanceof UIPortal);
+
+ //Add a UIPage to the UIContainer
+ UIContainer container = page.createChild("defaultContainer", UIContainer.class);
+ assertEquals(container.getName(), "defaultContainer");
+ assertEquals(container.getId(), "/defaultPortal/defaultPage/defaultContainer");
+ assertTrue(container.getParent() instanceof UIPage);
+
+ //Add a UIWindow to UIPage
+ UIWindow window = container.createChild("defaultWindow", UIWindow.class);
+ assertEquals(window.getName(), "defaultWindow");
+ assertEquals(window.getId(), "/defaultPortal/defaultPage/defaultContainer/defaultWindow");
+ assertTrue(window.getParent() instanceof UIContainer);
+ }*/
+
+ /**
+ *
+ * @throws Exception
+ */
+ /*public void testDestroyChild() throws Exception
+ {
+ //Assert the state of UIPortal added to the UIObject tree
+ UIPortal portal = this.uiContext.createChild("defaultPortal", UIPortal.class);
+
+ //Add a UIPage to the UIPortal
+ UIPage page = portal.createChild("defaultPage", UIPage.class);
+
+ //Add a UIPage to the UIContainer
+ UIContainer container = page.createChild("defaultContainer", UIContainer.class);
+
+ //Add a UIWindow to UIPage
+ UIWindow window = container.createChild("defaultWindow", UIWindow.class);
+
+ //Destroy the container. When this is done, both container and window must be destroyed from the UIObject tree
+ page.removeChild(container.getName());
+ List<UIObject> pageChildren = page.getChildren();
+ assertTrue(pageChildren == null || pageChildren.size() == 0);
+ }*/
+
+ /**
+ *
+ * @throws Exception
+ */
+ /*public void testModelLoading() throws Exception
+ {
+ //Setup rootChildrenInfo
+ Map rootChildrenInfo = new HashMap();
+ rootChildrenInfo.put("defaultPortal", UIPortal.class);
+ rootChildrenInfo.put("someOtherPortal", UIPortal.class);
+
+ UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
+ UIPortal defaultPortal = objectTree.getChildren(UIPortal.class).get(0);
+ UIPortal someOtherPortal = objectTree.getChildren(UIPortal.class).get(1);
+
+ assertEquals(defaultPortal.getName(), "defaultPortal");
+ assertEquals(defaultPortal.getId(), "/defaultPortal");
+ assertEquals(someOtherPortal.getName(), "someOtherPortal");
+ assertEquals(someOtherPortal.getId(), "/someOtherPortal");
+ }*/
+
+ /**
+ *
+ * @throws Exception
+ */
+ /*public void testParentLoading() throws Exception
+ {
+ //Setup rootChildrenInfo
+ Map rootChildrenInfo = new HashMap();
+ rootChildrenInfo.put("defaultPortal", UIPortal.class);
+
+ UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
+
+ UIPortal portal = objectTree.getObject("/defaultPortal/defaultPage", UIPortal.class);
+ UIObject parent = portal.getParent();
+
+ assertEquals(parent.getName(), "defaultPortal");
+ assertEquals(parent.getId(), "/defaultPortal");
+ }*/
+
+ /**
+ *
+ * @throws Exception
+ */
+ /*public void testLazyLoading() throws Exception
+ {
+ Map rootChildrenInfo = new HashMap();
+ rootChildrenInfo.put("testingLazyLoading", UIPortal.class);
+
+ UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
+ UIPortal defaultPortal = objectTree.getChildren(UIPortal.class).get(0);
+ List<UIObject> lazyLoadedChildren = defaultPortal.getChildren();
+
+ assertTrue((lazyLoadedChildren != null && lazyLoadedChildren.size()>0));
+ logger.info("-----------------------------------------------------------");
+ for(int i=0; i<lazyLoadedChildren.size(); i++)
+ {
+ UIObject child = lazyLoadedChildren.get(i);
+ logger.info(child.getId());
+ assertEquals(child.getParent().getName(), "testingLazyLoading");
+ assertEquals(child.getParent().getId(), "/testingLazyLoading");
+ }
+ logger.info("--------------------------------------------------------");
+ }*/
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockException.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockException.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockException.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MockException extends Exception
+{
+
+ /** . */
+ private ErrorCode code;
+
+ public MockException(ErrorCode code)
+ {
+ this.code = code;
+ }
+
+ public MockException(String s, ErrorCode code)
+ {
+ super(s);
+ this.code = code;
+ }
+
+ public enum ErrorCode
+ {
+ INVALID_OBJECT,
+ CONSTRAINT_VIOLATION
+ }
+
+ public ErrorCode getCode()
+ {
+ return code;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModel.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModel.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModel.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface MockModel
+{
+
+ StructuralStateContext getStructuralStateContext();
+
+ MockObject getRoot();
+
+ void destroy(MockObject object) throws MockException;
+
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockModelImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,416 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.UIContext;
+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.UIWindow;
+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.ConstraintViolationException;
+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.StructuralStateContext;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MockModelImpl implements MockModel
+{
+
+ /** . */
+ private int generator = 0;
+
+ /** . */
+ private final Map<String, MockObjectImpl> universe = new HashMap<String, MockObjectImpl>();
+
+ /** . */
+ private final MockObjectImpl root = createObject(MockObject.Type.CONTEXT, "");
+
+ /** . */
+ private static final Map<Class<? extends UIObject>, MockObject.Type> map;
+
+ static
+ {
+ map = new HashMap<Class<? extends UIObject>, MockObject.Type>();
+ map.put(UIContext.class, MockObject.Type.CONTEXT);
+ map.put(UIPage.class, MockObject.Type.PAGE);
+ map.put(UIPortal.class, MockObject.Type.PORTAL);
+ map.put(UIWindow.class, MockObject.Type.WINDOW);
+ }
+
+ public StructuralStateContext getStructuralStateContext()
+ {
+ return structuralStateContext;
+ }
+
+ public MockObject getRoot()
+ {
+ return root;
+ }
+
+ public void destroy(MockObject object) throws MockException
+ {
+ destroy((MockObjectImpl)object, new ArrayList<String>());
+ }
+
+ void destroy(MockObjectImpl object, List<String> ids) throws MockException
+ {
+ universe.remove(object.getId());
+
+ // Remove children recursively
+ for (MockObjectImpl child : object.getChildren())
+ {
+ destroy(child, ids);
+ }
+
+ //
+ object.destroy();
+
+ //
+ ids.add(object.getId());
+ }
+
+ MockObjectImpl createObject(MockObject.Type type, String name)
+ {
+ MockObjectImpl mockObject = new MockObjectImpl(this, name, type, "" + generator++);
+ universe.put(mockObject.getId(), mockObject);
+ return mockObject;
+ }
+
+ private final StructuralStateContext structuralStateContext = new AbstractStructuralStateContext()
+ {
+ public StructuralObject load(String objectId) throws IllegalArgumentException
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ MockObjectImpl object = universe.get(objectId);
+
+ //
+ return object != null ? object.takeSnapshot() : null;
+ }
+
+ public String getRootId()
+ {
+ return root.getId();
+ }
+
+ public void validate(StructuralObject object) throws StateException
+ {
+ getValidMockObject(object);
+ }
+
+ public StructuralObject.Refresh refresh(StructuralObject object) throws IllegalArgumentException, StateException
+ {
+ MockObjectImpl mockObject = getMockObject(object, false);
+
+ //
+ StructuralObjectImpl previous = (StructuralObjectImpl)object;
+ StructuralObjectImpl current = mockObject.takeSnapshot();
+
+ //
+ StructuralObject parent = null;
+ if (previous.parentHandle != null)
+ {
+ if (!current.parentHandle.equals(previous.handle))
+ {
+ parent = getMockObject(current.parentHandle, true).takeSnapshot();
+ }
+ }
+
+ //
+ Map<String, StructuralObjectHandle> previousChildren = new HashMap<String, StructuralObjectHandle>();
+ for (StructuralObjectHandle childHandle : previous.childrenHandles)
+ {
+ previousChildren.put(childHandle.id, childHandle);
+ }
+
+ //
+ Map<String, StructuralObjectHandle> currentChildren = new HashMap<String, StructuralObjectHandle>();
+ for (StructuralObjectHandle childHandle : current.childrenHandles)
+ {
+ currentChildren.put(childHandle.id, childHandle);
+ }
+
+ //
+ Map<String, StructuralObjectHandle> addedChildrenHandleMap = new HashMap<String, StructuralObjectHandle>(currentChildren);
+ addedChildrenHandleMap.keySet().removeAll(previousChildren.keySet());
+ Set<StructuralObject> addedChildren = new HashSet<StructuralObject>();
+ for (StructuralObjectHandle handle : addedChildrenHandleMap.values())
+ {
+ StructuralObject snapshot = getMockObject(handle, true).takeSnapshot();
+ addedChildren.add(snapshot);
+ }
+
+ //
+ Map<String, StructuralObjectHandle> removedChildrenHandleMap = new HashMap<String, StructuralObjectHandle>(previousChildren);
+ removedChildrenHandleMap.keySet().removeAll(currentChildren.keySet());
+ Set<String> removedChildren = new HashSet<String>();
+ for (StructuralObjectHandle handle : removedChildrenHandleMap.values())
+ {
+ removedChildren.add(handle.id);
+ }
+
+ //
+ Map<String, StructuralObjectHandle> commonCurrentChildrenHandleMap = new HashMap<String, StructuralObjectHandle>(currentChildren);
+ commonCurrentChildrenHandleMap.keySet().retainAll(previousChildren.keySet());
+
+ //
+ Map<String, StructuralObjectHandle> commonPreviousChildrenHandleMap = new HashMap<String, StructuralObjectHandle>(previousChildren);
+ commonPreviousChildrenHandleMap.keySet().retainAll(currentChildren.keySet());
+
+ //
+ Set<StructuralObjectHandle> validChildrenHandleSet = new HashSet<StructuralObjectHandle>(commonPreviousChildrenHandleMap.values());
+ validChildrenHandleSet.retainAll(commonCurrentChildrenHandleMap.values());
+ Set<String> validChildren = new HashSet<String>();
+ for (StructuralObjectHandle handle : validChildrenHandleSet)
+ {
+ validChildren.add(handle.id);
+ }
+
+ //
+ Set<StructuralObjectHandle> staleChildrenHandleSet = new HashSet<StructuralObjectHandle>(commonPreviousChildrenHandleMap.values());
+ staleChildrenHandleSet.removeAll(commonCurrentChildrenHandleMap.values());
+
+ //
+ Map<String, StructuralObject> staleChildrenHandleMap = new HashMap<String, StructuralObject>();
+ for (StructuralObjectHandle previousHandle : staleChildrenHandleSet)
+ {
+ String id = previousHandle.id;
+ StructuralObjectHandle handle = commonCurrentChildrenHandleMap.get(id);
+ StructuralObject snapshot = getMockObject(handle, true).takeSnapshot();
+ staleChildrenHandleMap.put(id, snapshot);
+ }
+
+ //
+ return new StructuralObject.Refresh(parent, current, addedChildren, removedChildren, staleChildrenHandleMap, validChildren);
+ }
+
+ public StructuralObject.Update update(StructuralObject object, Map<String, String> changes) throws StateChangeVetoException
+ {
+ MockObject mockObject = getValidMockObject(object);
+
+ // Create an non mutable clone (for the event)
+ changes = Collections.unmodifiableMap(new HashMap<String, String>(changes));
+
+ //
+ for (Map.Entry<String, String> entry : changes.entrySet())
+ {
+ String propertyName = entry.getKey();
+ MockObject.UpdateBehavior behavior = mockObject.getPropertyBehavior(propertyName);
+ if (behavior instanceof MockObject.Veto)
+ {
+ throw new StateChangeVetoException("Cannot modify non behavior property");
+ }
+ else if (behavior instanceof MockObject.Failure)
+ {
+ MockObject.Failure failure = (MockObject.Failure)behavior;
+ failure.throwAs(IllegalArgumentException.class).
+ throwAs(StateChangeVetoException.class).
+ throwAs(StateException.class);
+ }
+ else
+ {
+ try
+ {
+ mockObject.setPropertyValue(propertyName, entry.getValue());
+ }
+ catch (MockException e)
+ {
+ throw new AssertionError();
+ }
+ }
+ }
+
+ //
+ return new StructuralObject.Update(mockObject.takeSnapshot(), changes);
+ }
+
+ public StructuralObject.Creation create(StructuralObject parent, Class<? extends UIObject> classType, String name, Map<String, String> properties) throws StateException, IllegalArgumentException
+ {
+ MockObject mockParent = getValidMockObject(parent);
+
+ //
+ MockObject.Type type = map.get(classType);
+
+ //
+ try
+ {
+ MockObject mockChild = mockParent.addChild(name, type, properties);
+
+ //
+ return new StructuralObject.Creation(mockParent.takeSnapshot(), mockChild.takeSnapshot());
+ }
+ catch (MockException e)
+ {
+ switch (e.getCode())
+ {
+ case CONSTRAINT_VIOLATION:
+ throw new ConstraintViolationException();
+ default:
+ throw new AssertionError();
+ }
+ }
+ }
+
+ public StructuralObject.Destruction destroy(StructuralObject object) throws StateException, IllegalArgumentException
+ {
+ MockObjectImpl mockObject = getValidMockObject(object);
+
+ //
+ MockObjectImpl parent = mockObject.getParent();
+
+ //
+ List<String> ids = new ArrayList<String>();
+
+ //
+ try
+ {
+ MockModelImpl.this.destroy(mockObject, ids);
+ }
+ catch (MockException e)
+ {
+ // It is kind of unexpected since we are destroying something valid
+ throw new StateException(e);
+ }
+
+ //
+ return new StructuralObject.Destruction(parent.takeSnapshot(), ids);
+ }
+
+ public StructuralObject.Move move(StructuralObject source, StructuralObject destination) throws StateException, IllegalArgumentException
+ {
+ MockObject mockSource = getValidMockObject(source);
+ MockObject mockDestination = getValidMockObject(destination);
+ MockObject mockParent = mockSource.getParent();
+
+ //
+ try
+ {
+ mockSource.move(mockDestination);
+
+ //
+ return new StructuralObject.Move(mockParent.takeSnapshot(), mockSource.takeSnapshot(), mockDestination.takeSnapshot());
+ }
+ catch (MockException e)
+ {
+ switch (e.getCode())
+ {
+ default:
+ throw new AssertionError();
+ case CONSTRAINT_VIOLATION:
+ throw new ConstraintViolationException();
+ }
+ }
+ }
+
+ public Collection<StructuralObject> loadChildren(StructuralObject parent)
+ {
+ MockObject mockParent = getValidMockObject(parent);
+
+ //
+ List<StructuralObject> tmp = new ArrayList<StructuralObject>();
+ for (MockObject mockChild : mockParent.getChildren())
+ {
+ tmp.add(mockChild.takeSnapshot());
+ }
+ return tmp;
+ }
+
+ public StructuralObject loadParent(StructuralObject child) throws StateException
+ {
+ MockObject mockchild = getValidMockObject(child);
+ MockObject mockParent = mockchild.getParent();
+ return mockParent != null ? mockParent.takeSnapshot() : null;
+ }
+
+ private MockObjectImpl getValidMockObject(StructuralObject object) throws StateException
+ {
+ return getMockObject(object, true);
+ }
+
+ private MockObjectImpl getMockObject(StructuralObject object, boolean validateVersion)
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException("No null object accepted");
+ }
+
+ //
+ StructuralObjectImpl structuralObject = (StructuralObjectImpl)object;
+
+ //
+ return getMockObject(structuralObject.handle, validateVersion);
+ }
+
+ private MockObjectImpl getMockObject(StructuralObjectHandle handle, boolean validateVersion)
+ {
+ if (handle == null)
+ {
+ throw new IllegalArgumentException("No null object accepted");
+ }
+
+ //
+ MockObjectImpl mockObject = universe.get(handle.id);
+
+ //
+ if (mockObject == null)
+ {
+ throw new NoSuchStateException();
+ }
+
+ //
+ if (!mockObject.isValid())
+ {
+ throw new StaleStateException();
+ }
+
+ //
+ if (validateVersion && (mockObject.getVersion() != handle.version))
+ {
+ throw new StaleStateException("Version has changed obtained=" + mockObject.getVersion() + " wanted=" + handle.version);
+ }
+
+ //
+ return mockObject;
+ }
+ };
+}
\ No newline at end of file
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObject.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,128 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.UIContext;
+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.UIWindow;
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface MockObject
+{
+
+ /**
+ *
+ */
+ public enum Type
+ {
+
+ PORTAL(UIPortal.class), PAGE(UIPage.class), WINDOW(UIWindow.class), CONTEXT(UIContext.class);
+
+ /** . */
+ final Class<? extends UIObject> clazz;
+
+ Type(Class<? extends UIObject> clazz)
+ {
+ this.clazz = clazz;
+ }
+ }
+
+ public abstract static class UpdateBehavior
+ {
+ public static UpdateBehavior veto()
+ {
+ return new Veto();
+ }
+ public static UpdateBehavior failure(Throwable throwable)
+ {
+ return new Failure(throwable);
+ }
+ }
+
+ static class Veto extends UpdateBehavior
+ {
+ }
+
+ static class Failure extends UpdateBehavior
+ {
+
+ /** . */
+ final Throwable throwable;
+
+ public Failure(Throwable throwable)
+ {
+ this.throwable = throwable;
+ }
+
+ public <T extends Throwable> Failure throwAs(Class<T> type) throws T
+ {
+ if (type.isInstance(throwable))
+ {
+ throw type.cast(throwable);
+ }
+ return this;
+ }
+ }
+
+ Type getType();
+
+ String getName();
+
+ String getId();
+
+ int getVersion();
+
+ String getPropertyValue(String propertyName) throws IllegalArgumentException;
+
+ void setPropertyBehavior(String propertyName, UpdateBehavior propertyBehavior) throws IllegalArgumentException;
+
+ UpdateBehavior getPropertyBehavior(String propertyName) throws IllegalArgumentException;
+
+ void setPropertyValue(String propertyName, String propertyValue) throws MockException;
+
+ Set<String> getPropertyNames();
+
+ MockObject addChild(String name, Type type, Map<String, String> state) throws IllegalArgumentException, MockException;
+
+ MockObject addChild(String name, Type type) throws IllegalArgumentException, MockException;
+
+ MockObject getParent();
+
+ List<? extends MockObject> getChildren();
+
+ boolean isValid();
+
+ StructuralObject takeSnapshot();
+
+ void move(MockObject destination) throws IllegalArgumentException, MockException;
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/MockObjectImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,304 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class MockObjectImpl implements MockObject
+{
+
+ /** . */
+ private static final Map<String, String> EMPTY_STATE = Collections.emptyMap();
+
+ /** . */
+ private final MockObject.Type type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, String> propertyValues;
+
+ /** . */
+ private final Map<String, UpdateBehavior> propertyBehaviors;
+
+ /** . */
+ private final LinkedHashMap<String, MockObjectImpl> children;
+
+ /** . */
+ private final MockModelImpl model;
+
+ /** . */
+ private MockObjectImpl parent;
+
+ /** . */
+ private boolean valid;
+
+ /** The version id. */
+ private StructuralObjectHandle handle;
+
+ MockObjectImpl(MockModelImpl model, String name, MockObject.Type type, String id)
+ {
+ this.model = model;
+ this.name = name;
+ this.type = type;
+ this.children = new LinkedHashMap<String, MockObjectImpl>();
+ this.propertyValues = new HashMap<String, String>();
+ this.propertyBehaviors = new HashMap<String, UpdateBehavior>();
+ this.valid = true;
+ this.handle = new StructuralObjectHandle(id, 0);
+ }
+
+ public MockObject.Type getType()
+ {
+ return type;
+ }
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getId()
+ {
+ return handle.id;
+ }
+
+ public String getPropertyValue(String propertyName)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return propertyValues.get(propertyName);
+ }
+
+ public MockObjectImpl getParent()
+ {
+ return parent;
+ }
+
+ public List<MockObjectImpl> getChildren()
+ {
+ return Collections.unmodifiableList(new ArrayList<MockObjectImpl>(children.values()));
+ }
+
+ public MockObjectImpl addChild(String name, MockObject.Type type) throws MockException
+ {
+ return addChild(name, type, EMPTY_STATE);
+ }
+
+ public Set<String> getPropertyNames()
+ {
+ return Collections.unmodifiableSet(propertyValues.keySet());
+ }
+
+ public MockObjectImpl addChild(String name, Type type, Map<String, String> state) throws MockException
+ {
+ if (!valid)
+ {
+ throw new MockException(MockException.ErrorCode.INVALID_OBJECT);
+ }
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (children.containsKey(name))
+ {
+ throw new MockException(MockException.ErrorCode.CONSTRAINT_VIOLATION);
+ }
+
+ //
+ MockObjectImpl child = model.createObject(type, name);
+
+ //
+ for (Map.Entry<String, String> entry : state.entrySet())
+ {
+ if (entry.getValue() == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ child.propertyValues.put(entry.getKey(), entry.getValue());
+ }
+
+ //
+ child.parent = this;
+ children.put(child.handle.id, child);
+ handle = handle.nextHandle();
+
+ //
+ return child;
+ }
+
+ public void setPropertyBehavior(String propertyName, UpdateBehavior propertyBehavior)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyBehavior != null)
+ {
+ propertyBehaviors.put(name, propertyBehavior);
+ }
+ else
+ {
+ propertyBehaviors.remove(name);
+ }
+ }
+
+ public UpdateBehavior getPropertyBehavior(String propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return propertyBehaviors.get(propertyName);
+ }
+
+ public void setPropertyValue(String propertyName, String propertyValue) throws MockException
+ {
+ if (!valid)
+ {
+ throw new MockException(MockException.ErrorCode.INVALID_OBJECT);
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyValue != null)
+ {
+ propertyValues.put(propertyName, propertyValue);
+ }
+ else
+ {
+ propertyValues.remove(propertyName);
+ }
+
+ //
+ handle = handle.nextHandle();
+ }
+
+ public int getVersion()
+ {
+ return handle.version;
+ }
+
+ public StructuralObjectImpl takeSnapshot()
+ {
+ StructuralObjectHandle parentHandle = parent == null ? null : parent.handle;
+
+ //
+ List<StructuralObjectHandle> childrenHandles = new ArrayList<StructuralObjectHandle>();
+ for (MockObjectImpl child : children.values())
+ {
+ childrenHandles.add(child.handle);
+ }
+
+ //
+ StructuralStateImpl state = new StructuralStateImpl(type.clazz, name, new HashMap<String, String>(propertyValues));
+
+ //
+ return new StructuralObjectImpl(handle, parentHandle, childrenHandles, state);
+ }
+
+ public void move(MockObject destination) throws IllegalStateException, MockException
+ {
+ move((MockObjectImpl)destination);
+ }
+
+ private void move(MockObjectImpl destination) throws MockException
+ {
+ if (!valid)
+ {
+ throw new MockException(MockException.ErrorCode.INVALID_OBJECT);
+ }
+ if (destination == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ // The source cannot an ancestor of the destination
+ for (MockObject current = destination;current != null;current = current.getParent())
+ {
+ if (current == this)
+ {
+ throw new MockException(MockException.ErrorCode.CONSTRAINT_VIOLATION);
+ }
+ }
+
+ // No duplicate child name
+ for (MockObjectImpl child : destination.children.values())
+ {
+ if (name.equals(child.name))
+ {
+ throw new MockException(MockException.ErrorCode.CONSTRAINT_VIOLATION);
+ }
+ }
+
+ //
+ parent.children.remove(handle.id);
+ parent.handle = parent.handle.nextHandle();
+
+ //
+ destination.children.put(handle.id, this);
+ destination.handle = destination.handle.nextHandle();
+
+ //
+ parent = destination;
+ handle = handle.nextHandle();
+ }
+
+ public void destroy() throws MockException
+ {
+ if (!valid)
+ {
+ throw new MockException(MockException.ErrorCode.INVALID_OBJECT);
+ }
+
+ // Detach from parent
+ if (parent != null)
+ {
+ parent.children.remove(handle.id);
+ parent.handle = parent.handle.nextHandle();
+ parent = null;
+ }
+
+ // We cannot use it anymore
+ valid = false;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectHandle.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectHandle.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectHandle.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class StructuralObjectHandle
+{
+
+ /** . */
+ final String id;
+
+ /** . */
+ final int version;
+
+ StructuralObjectHandle(String id, int version)
+ {
+ if (id == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.id = id;
+ this.version = version;
+ }
+
+ public int hashCode()
+ {
+ return id.hashCode() * version;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof StructuralObjectHandle)
+ {
+ StructuralObjectHandle that = (StructuralObjectHandle)o;
+
+ //
+ return id.equals(that.id) && version == that.version;
+ }
+ return false;
+ }
+
+ StructuralObjectHandle nextHandle()
+ {
+ return new StructuralObjectHandle(id, version + 1);
+ }
+
+ public String toString()
+ {
+ return "StructuralObjectHandle[id=" + id + ",version=" + version + "]";
+ }
+
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralObjectImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class StructuralObjectImpl implements StructuralObject
+{
+
+ /** . */
+ final StructuralObjectHandle handle;
+
+ /** . */
+ final StructuralObjectHandle parentHandle;
+
+ /** . */
+ final List<StructuralObjectHandle> childrenHandles;
+
+ /** . */
+ private final StructuralStateImpl state;
+
+ public StructuralObjectImpl(
+ StructuralObjectHandle handle,
+ StructuralObjectHandle parentHandle,
+ List<StructuralObjectHandle> childrenHandles,
+ StructuralStateImpl state)
+ {
+ this.handle = handle;
+ this.parentHandle = parentHandle;
+ this.childrenHandles = childrenHandles;
+ this.state = state;
+ }
+
+ public String getId()
+ {
+ return handle.id;
+ }
+
+ public StructuralState getState()
+ {
+ return state;
+ }
+
+ public boolean compareTo(StructuralObject other)
+ {
+ if (other == this)
+ {
+ return true;
+ }
+ if (other instanceof StructuralObjectImpl)
+ {
+ StructuralObjectImpl that = (StructuralObjectImpl)other;
+
+ //
+ return handle.equals(that.handle);
+ }
+ return false;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/state/structural/StructuralStateImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * 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.test.model.state.structural;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class StructuralStateImpl implements StructuralState
+{
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ public StructuralStateImpl(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;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockContext.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.test.portal;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockContext extends MockPortalObject
+{
+ /**
+ *
+ */
+ private List portals = null;
+
+ /**
+ *
+ * @param id
+ */
+ public MockContext(String id, List portals)
+ {
+ super(id);
+ this.portals = portals;
+ }
+
+ /**
+ *
+ */
+ public List getChildren()
+ {
+ return this.portals;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockInstance.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockInstance.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockInstance.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.test.portal;
+
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockInstance
+{
+ /**
+ * Invoke the instance
+ *
+ * @param invocation the invocation
+ */
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws PortletInvokerException
+ {
+ return null;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPage.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPage.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPage.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.test.portal;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockPage extends MockPortalObject
+{
+ /**
+ *
+ */
+ private List windows = null;
+
+ /**
+ *
+ * @param id
+ * @param windows
+ */
+ public MockPage(String id, List windows)
+ {
+ super(id);
+ this.windows = windows;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getWindows()
+ {
+ return windows;
+ }
+
+ /**
+ *
+ * @param windows
+ */
+ public void setWindows(List windows)
+ {
+ this.windows = windows;
+ }
+
+ /**
+ *
+ */
+ public List getChildren()
+ {
+ return this.windows;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortal.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortal.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortal.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.test.portal;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockPortal extends MockPortalObject
+{
+ /**
+ *
+ */
+ private List pages = null;
+
+ /**
+ *
+ * @param id
+ */
+ public MockPortal(String id, List pages)
+ {
+ super(id);
+ this.pages = pages;
+ }
+
+ /**
+ *
+ */
+ public List getChildren()
+ {
+ return this.pages;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalEntryPoint.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,324 @@
+package org.jboss.portal.presentation.test.portal;
+
+
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.HashMap;
+import java.net.URLDecoder;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.mx.util.MBeanProxy;
+import org.jboss.mx.util.MBeanServerLocator;
+
+import org.jboss.portal.common.invocation.InterceptorStackFactory;
+import org.jboss.portal.server.RequestControllerFactory;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.server.ServerInvocationContext;
+import org.jboss.portal.server.impl.ServerInvocationContextImpl;
+import org.jboss.portal.server.request.URLContext;
+import org.jboss.portal.server.ServerRequest;
+import org.jboss.portal.server.ServerResponse;
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.server.RequestController;
+import org.jboss.portal.server.RequestControllerDispatcher;
+import org.jboss.portal.web.WebRequest;
+
+import org.jboss.portal.presentation.ajax.client.service.PortalRPC;
+import org.jboss.portal.presentation.ajax.client.model.AjaxUIObject;
+import org.jboss.portal.presentation.ajax.client.protocol.ClientResponse;
+import org.jboss.portal.presentation.ajax.client.protocol.AjaxShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.GetActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+
+import com.google.gwt.user.client.rpc.SerializationException;
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+/**
+ * This serves as the Portal Entry Point for AJAX (Asynchronous) RPC calls being made by the
+ * client-side Ajax agent of the Presentation Framework
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockPortalEntryPoint extends RemoteServiceServlet implements PortalRPC
+{
+ /** The logger. */
+ private Logger log = Logger.getLogger(getClass());
+
+ /**
+ *
+ */
+ private RequestControllerFactory controllerFactory = null;
+
+
+ /** Configure the as default servlet. */
+ public void init() throws ServletException
+ {
+ try
+ {
+ MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
+
+ //Locate the request controller
+ this.controllerFactory = (RequestControllerFactory) MBeanProxy.get(RequestControllerFactory.class, new ObjectName(
+ this.getInitParameter("controllerFactoryName")),
+ mbeanServer);
+
+ }
+ catch (Exception e)
+ {
+ this.controllerFactory = null;
+ String msg = "Ajax Portal Entry point could not be created";
+ log.error(msg, e);
+ throw new UnavailableException(msg);
+ }
+ }
+ //---------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public String processCall(String payload) throws SerializationException
+ {
+ //Perform the remote procedure call
+ String returnVal = super.processCall(payload);
+
+ //Perform any post-processing after calling the actual remote method that will perform
+ //the functionality for this particular remote procedure call
+
+ return returnVal;
+ }
+ // -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ * Asynchronously loads the specified object from the server
+ *
+ * @return The Initial Portal Page
+ */
+ public ClientResponse loadObject(String objectId)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ Object pendingServerAction = request.getSession().getAttribute("serverAction");
+ if(pendingServerAction != null)
+ {
+ request.setAttribute("serverAction", pendingServerAction);
+ request.getSession().removeAttribute("serverAction");
+ }
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ public ClientResponse asyncGet(String url)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Parse the query parameters into a Map of name value pairs
+ Map queryParams = this.parseQueryParams(url);
+
+ //Parse the UIObject target id
+ String targetId = this.parseTargetId(url);
+
+
+ GetActivation get = new GetActivation(targetId, queryParams);
+
+ request.setAttribute("serverAction", get);
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param url
+ * @param body
+ * @return
+ */
+ public ClientResponse asyncPost(String url, String body)
+ {
+ try
+ {
+ ClientResponse clientResponse = null;
+
+ HttpServletRequest request = this.getThreadLocalRequest();
+
+ //Parse the query parameters into a Map of name value pairs
+ Map queryParams = this.parseQueryParams(url);
+
+ //Parse the UIObject target id
+ String targetId = this.parseTargetId(url);
+
+ //Parse the serialized post body into parameters
+ StringTokenizer st = new StringTokenizer(body, "&");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int equalIndex = token.indexOf('=');
+ String name = token.substring(0, equalIndex);
+ String value = token.substring(equalIndex+1);
+
+ queryParams.put(URLDecoder.decode(name, "UTF-8"), new String[]{URLDecoder.decode(value, "UTF-8")});
+ }
+
+ PostActivation post = new PostActivation(targetId, queryParams, null);
+
+ request.setAttribute("serverAction", post);
+
+ //execute the call on the Portal
+ this.callPortalServer();
+
+ //Setup the initial UIContext for the client session
+ AjaxUIObject uiObject = (AjaxUIObject)request.getAttribute("uiObject");
+ if(uiObject != null)
+ {
+ clientResponse = new AjaxShowUIObjectResponse(uiObject);
+ }
+
+ return clientResponse;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ private Map parseQueryParams(String url) throws Exception
+ {
+ Map queryParams = new HashMap();
+
+ if(url.indexOf('?') != -1)
+ {
+ String queryString = url.substring(url.indexOf('?')+1);
+ StringTokenizer st = new StringTokenizer(queryString, "&");
+ while(st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int equalIndex = token.indexOf('=');
+ String name = token.substring(0, equalIndex);
+ String value = token.substring(equalIndex+1);
+
+ queryParams.put(name, new String[]{URLDecoder.decode(value, "UTF-8")});
+ }
+ }
+
+ return queryParams;
+ }
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ private String parseTargetId(String url)
+ {
+ String targetId = null;
+
+ int fromIndex = 0; //hard coding the portal deployment context for now
+ fromIndex = url.indexOf("presentation") != -1 ? url.indexOf("presentation") + "presentation".length() : 0;
+ targetId = url.indexOf('?') != -1 ? url.substring(fromIndex, url.indexOf('?')):url.substring(fromIndex);
+
+ //Removes the PATH data if any found
+ if(targetId.indexOf(';')!=-1)
+ {
+ targetId = targetId.substring(0, targetId.indexOf(';'));
+ }
+
+ return targetId;
+ }
+
+ /**
+ *
+ *
+ */
+ private void callPortalServer() throws Exception
+ {
+ HttpServletRequest req = this.getThreadLocalRequest();
+ HttpServletResponse resp = this.getThreadLocalResponse();
+ String requestURI = req.getRequestURI();
+ String contextPath = req.getContextPath();
+ String portalHost = req.getServerName();
+ String portalRequestPath = requestURI.substring(contextPath.length());
+ String portalContextPath = requestURI.substring(0, contextPath.length());
+ URLContext urlContext = URLContext.newInstance(req.isSecure(), req.getRemoteUser() != null);
+
+ WebRequest webReq = new WebRequest(req);
+
+ //
+ ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
+ req,
+ resp,
+ webReq,
+ portalHost,
+ portalRequestPath,
+ portalContextPath,
+ urlContext
+ );
+
+ //
+ ServerRequest request = new ServerRequest(invocationCtx);
+
+ //
+ ServerResponse response = new ServerResponse(request, invocationCtx);
+
+ //
+ ServerInvocation invocation = new ServerInvocation(invocationCtx);
+ invocation.setRequest(request);
+ invocation.setResponse(response);
+
+ //
+ RequestController controller = this.controllerFactory.createRequestController(invocation);
+ invocation.setHandler(new RequestControllerDispatcher(controller));
+
+ invocation.invokeNext();
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalObject.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalObject.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalObject.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.test.portal;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class MockPortalObject
+{
+ /**
+ *
+ */
+ protected String id = null;
+
+ /**
+ *
+ * @param id
+ */
+ public MockPortalObject(String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return this.id;
+ }
+
+ /**
+ *
+ */
+ public abstract List getChildren();
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalServer.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalServer.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortalServer.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -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.test.portal;
+
+import java.util.Map;
+import java.util.List;
+import java.util.HashMap;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockPortalServer
+{
+ /**
+ *
+ */
+ private static MockPortalServer singleton = null;
+
+ /**
+ *
+ */
+ private Map instances = null;
+
+ /**
+ *
+ *
+ */
+ private MockPortalServer()
+ {
+ //load up the MockPortal instances
+ this.instances = new HashMap();
+
+ //Create 3 MockPortlets
+ MockPortlet portlet1 = new MockPortlet("<div><b>Portlet 1:</b><br/></div>");
+ MockPortlet portlet2 = new MockPortlet("<div><b>Portlet 2:</b><br/></div>");
+ MockPortlet portlet3 = new MockPortlet("<div><b>Portlet 3:</b><br/></div>");
+
+ MockWindow window1 = new MockWindow("default/default/window1",portlet1);
+ MockWindow window2 = new MockWindow("default/default/window2",portlet2);
+ MockWindow window3 = new MockWindow("default/default/window3",portlet3);
+
+ List windows = new ArrayList();
+ windows.add(window1);
+ windows.add(window2);
+ windows.add(window3);
+
+ MockPage page1 = new MockPage("default/default", windows);
+
+ List pages = new ArrayList();
+ pages.add(page1);
+
+ MockPortal mockPortal = new MockPortal("default", pages);
+
+ List portals = new ArrayList();
+ portals.add(mockPortal);
+
+ MockContext mockContext = new MockContext("/", portals);
+
+ this.instances.put("/", mockContext);
+ this.instances.put("default", mockPortal);
+ this.instances.put("default/default", page1);
+ this.instances.put("default/default/window1", window1);
+ this.instances.put("default/default/window2", window2);
+ this.instances.put("default/default/window3", window3);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static MockPortalServer getInstance()
+ {
+ if(MockPortalServer.singleton == null)
+ {
+ MockPortalServer.singleton = new MockPortalServer();
+ }
+ return MockPortalServer.singleton;
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public MockPortalObject getPortalObject(String id)
+ {
+ MockPortalObject portalObject = null;
+
+ if(!id.equals("/") && id.startsWith("/"))
+ {
+ id = id.substring(1);
+ }
+
+ portalObject = (MockPortalObject)this.instances.get(id);
+
+ return portalObject;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void invoke(String id, Map queryParameters)
+ {
+ String[] action = (String[])queryParameters.get("action");
+
+ MockWindow window = (MockWindow)this.getPortalObject(id);
+
+ if(action != null && action[0].equals("2"))
+ {
+ window.getPortlet().processAction();
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortlet.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortlet.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockPortlet.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * 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.test.portal;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockPortlet
+{
+ /**
+ *
+ */
+ private String content = null;
+ private boolean actionActivated = false;
+ private int idCounter = 0;
+
+ /**
+ *
+ *
+ */
+ public MockPortlet(String content)
+ {
+ this.content = content;
+ }
+
+ /**
+ *
+ *
+ */
+ public void processAction()
+ {
+ this.content += "<div id=\"action"+this.idCounter+++"\"><p>Action called:</p><br/><a id=\"viewLink"+this.idCounter+++"\" href=\"default/default/window1?action=1\">View Window1</a><br/><a id=\"viewLink"+this.idCounter+++"\" href=\"default/default/window2?action=1\">View Window2</a><br/><a id=\"viewLink"+this.idCounter+++"\" href=\"default/default/window3?action=1\">View Window3</a><br/></div>";
+ this.actionActivated = true;
+ }
+
+ /**
+ *
+ *
+ */
+ public void doView()
+ {
+ if(!actionActivated)
+ {
+ this.content += "<div id=\"view"+this.idCounter+++"\"><p>View called:</p><br/><a id=\"actionLink"+this.idCounter+++"\" href=\"default/default/window1?action=2\">Action Window1</a><br/><a id=\"actionLink"+this.idCounter+++"\" href=\"default/default/window2?action=2\">Action Window2</a><br/><a id=\"actionLink"+this.idCounter+++"\" href=\"default/default/window3?action=2\">Action Window3</a><br/></div>";
+ }
+ actionActivated = false;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return this.content;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockWindow.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockWindow.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/MockWindow.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.test.portal;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MockWindow extends MockPortalObject
+{
+ /**
+ *
+ */
+ private MockPortlet portlet = null;
+
+ /**
+ *
+ * @param id
+ * @param portlet
+ */
+ public MockWindow(String id, MockPortlet portlet)
+ {
+ super(id);
+ this.portlet = portlet;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public MockPortlet getPortlet()
+ {
+ return portlet;
+ }
+
+ /**
+ *
+ * @param portlet
+ */
+ public void setPortlet(MockPortlet portlet)
+ {
+ this.portlet = portlet;
+ }
+
+ /**
+ *
+ */
+ public List getChildren()
+ {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getMarkup()
+ {
+ this.portlet.doView();
+ return this.portlet.getContent();
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/MainProcessor.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * 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.test.portal.plugin;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.impl.PortletRequestDecoder;
+
+import org.jboss.portal.web.Body;
+
+import org.jboss.portal.server.ServerException;
+
+import org.jboss.portal.presentation.server.Processor;
+import org.jboss.portal.presentation.server.ProcessorRequest;
+import org.jboss.portal.presentation.server.ProcessorResponse;
+
+import org.jboss.portal.presentation.client.PresentationContext;
+
+import org.jboss.portal.presentation.model.StateType;
+import org.jboss.portal.presentation.model.UIWindow;
+
+import org.jboss.portal.presentation.protocol.LinkActivation;
+import org.jboss.portal.presentation.protocol.PostActivation;
+import org.jboss.portal.presentation.protocol.ServerAction;
+import org.jboss.portal.presentation.protocol.ServerResponse;
+import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+
+import org.jboss.portal.presentation.test.portal.MockPortalServer;
+
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class MainProcessor implements Processor
+{
+
+ /** . */
+ private static Logger log = Logger.getLogger(MainProcessor.class);
+
+ /**
+ *
+ */
+ public ProcessorResponse process(PresentationContext presentationContext, ProcessorRequest request) throws ServerException
+ {
+ try
+ {
+
+ ServerAction serverAction = request.getAction();
+
+ ServerResponse response = null;
+
+ if(serverAction instanceof ViewUIObjectAction)
+ {
+ ViewUIObjectAction viewAction = (ViewUIObjectAction)serverAction;
+ response = new ShowUIObjectResponse(viewAction.getTargetId());
+ }
+ else if (serverAction instanceof LinkActivation)
+ {
+ LinkActivation getActivation = (LinkActivation)serverAction;
+ String id = getActivation.getTargetId();
+ PortletRequestDecoder decoder = new PortletRequestDecoder();
+
+ // Get form parameters if any
+ Map formParameters = null;
+ if (serverAction instanceof PostActivation)
+ {
+ PostActivation post = (PostActivation)serverAction;
+ Body body = post.getBody();
+ if (body instanceof Body.Form)
+ {
+ formParameters = ((Body.Form)body).getParameters();
+ }
+ }
+
+ decoder.decode(getActivation.getQueryParameters(), formParameters);
+ StateString contentState = decoder.getNavigationalState();
+
+ //TODO: We assume that for now
+ UIWindow uiWindow = (UIWindow)presentationContext.getUIContext().getObject(id);
+
+
+ //Make an invocation on the Mock Portal Server
+ MockPortalServer.getInstance().invoke(id, getActivation.getQueryParameters());
+
+ // It means we went through a successful action or it is a render
+ uiWindow.setProperty(StateType.NAVIGATIONAL, "content", contentState);
+ response = new ShowUIObjectResponse(uiWindow.getParent().getId());
+ }
+
+ return new ProcessorResponse(response);
+ }
+ catch(Exception e)
+ {
+ throw new ServerException(e);
+ }
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/PresentationServerImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * 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.test.portal.plugin;
+
+import org.jboss.portal.presentation.client.PresentationContext;
+import org.jboss.portal.presentation.server.Processor;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.content.WindowContent;
+import org.jboss.portal.presentation.model.state.structural.StructuralStateContext;
+
+import org.jboss.portal.presentation.test.portal.MockPortalServer;
+import org.jboss.portal.presentation.test.portal.MockWindow;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PresentationServerImpl implements PresentationServer
+{
+
+ /**
+ *
+ */
+ private Processor processor;
+
+ /**
+ *
+ */
+ private StructuralStateContext structuralStateContext;
+
+
+ /**
+ *
+ *
+ */
+ public PresentationServerImpl()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void start()
+ {
+ this.structuralStateContext = new StructuralStateContextImpl();
+ }
+
+ /**
+ *
+ *
+ */
+ public void stop()
+ {
+
+ }
+
+ /**
+ *
+ */
+ public StructuralStateContext getStructuralStateManager()
+ {
+ return structuralStateContext;
+ }
+
+ /**
+ *
+ * @param structuralStateContext
+ */
+ public void setModelLoader(StructuralStateContext structuralStateContext)
+ {
+ this.structuralStateContext = structuralStateContext;
+ }
+
+ /**
+ *
+ */
+ public Processor getProcessor()
+ {
+ return this.processor;
+ }
+
+ /**
+ *
+ * @param processor
+ */
+ public void setProcessor(Processor processor)
+ {
+ this.processor = processor;
+ }
+
+ /**
+ *
+ */
+ public WindowContent render(PresentationContext context, UIWindow uiwindow) throws Exception
+ {
+ MockWindow window = (MockWindow)MockPortalServer.getInstance().getPortalObject(uiwindow.getId());
+ return new WindowContent(-1, "Blah:", window.getMarkup());
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralObjectImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralObjectImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.test.portal.plugin;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+
+import org.jboss.portal.presentation.test.portal.MockPortalObject;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralObjectImpl implements StructuralObject
+{
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final StructuralStateImpl state;
+
+ public StructuralObjectImpl(MockPortalObject portalObject)
+ {
+ this.id = portalObject.getId();
+ this.state = new StructuralStateImpl(portalObject);
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public StructuralState getState()
+ {
+ return state;
+ }
+
+ public boolean compareTo(StructuralObject other)
+ {
+ return true;
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateContextImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateContextImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,168 @@
+/******************************************************************************
+ * 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.test.portal.plugin;
+
+
+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 org.jboss.portal.presentation.test.portal.MockPortalServer;
+import org.jboss.portal.presentation.test.portal.MockPortalObject;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class StructuralStateContextImpl extends AbstractStructuralStateContext
+{
+ /**
+ *
+ */
+ public String getRootId()
+ {
+ return "/";
+ }
+
+ /**
+ * The implementation only validate that an object is present.
+ */
+ public void validate(StructuralObject object) throws IllegalArgumentException, StateException
+ {
+
+ }
+
+ /**
+ *
+ */
+ public StructuralObject.Refresh refresh(StructuralObject object) throws IllegalArgumentException, StateException
+ {
+ throw new NotYetImplemented();
+ }
+
+ /**
+ *
+ */
+ public StructuralObject load(String objectId) throws IllegalArgumentException
+ {
+ StructuralObject cour = null;
+
+ MockPortalObject portalObject = MockPortalServer.getInstance().getPortalObject(objectId);
+ if(portalObject != null)
+ {
+ cour = new StructuralObjectImpl(portalObject);
+ }
+
+ return cour;
+ }
+
+ /**
+ *
+ */
+ public Collection<StructuralObject> loadChildren(StructuralObject parent)
+ {
+ Collection<StructuralObject> children = null;
+
+ MockPortalObject parentPortalObject = MockPortalServer.getInstance().getPortalObject(parent.getId());
+ List cour = parentPortalObject.getChildren();
+
+ if(cour != null)
+ {
+ children = new ArrayList<StructuralObject>();
+ for(int i=0; i<cour.size(); i++)
+ {
+ MockPortalObject child = (MockPortalObject)cour.get(i);
+ children.add(new StructuralObjectImpl(child));
+ }
+ }
+
+ return children;
+ }
+
+ /**
+ *
+ */
+ public StructuralObject loadParent(StructuralObject child)
+ {
+ StructuralObject parent = null;
+
+ String id = child.getId();
+ int lastIndex = id.lastIndexOf('/');
+ String parentId = id.substring(0, lastIndex);
+
+ MockPortalObject parentObject = MockPortalServer.getInstance().getPortalObject(parentId);
+ if(parentObject != null)
+ {
+ parent = new StructuralObjectImpl(parentObject);
+ }
+
+ return parent;
+ }
+
+ /**
+ *
+ * @param left
+ * @param right
+ * @return
+ */
+ 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());
+ }
+ }
+
+ /**
+ *
+ *
+ */
+ public void start()
+ {
+
+ }
+
+ /**
+ *
+ *
+ */
+ public void stop()
+ {
+
+ }
+}
Added: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/portal/plugin/StructuralStateImpl.java 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * 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.test.portal.plugin;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralState;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIWindow;
+
+import org.jboss.portal.presentation.test.portal.MockPortalObject;
+import org.jboss.portal.presentation.test.portal.MockContext;
+import org.jboss.portal.presentation.test.portal.MockPortal;
+import org.jboss.portal.presentation.test.portal.MockPage;
+import org.jboss.portal.presentation.test.portal.MockWindow;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class StructuralStateImpl implements StructuralState
+{
+
+ /** . */
+ private Class<? extends UIObject> type;
+
+ /** . */
+ private String name;
+
+ /** . */
+ private Map<String, String> properties;
+
+ StructuralStateImpl(MockPortalObject portalObject)
+ {
+ type = this.getType(portalObject);
+ this.name = portalObject.getId();
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ *
+ * @param portalObject
+ * @return
+ */
+ private Class<? extends UIObject> getType(MockPortalObject portalObject)
+ {
+ Class<? extends UIObject> type = null;
+
+ if(portalObject instanceof MockContext)
+ {
+ type = UIContext.class;
+ }
+ else if(portalObject instanceof MockPortal)
+ {
+ type = UIPortal.class;
+ }
+ else if(portalObject instanceof MockPage)
+ {
+ type = UIPage.class;
+ }
+ else if(portalObject instanceof MockWindow)
+ {
+ type = UIWindow.class;
+ }
+
+ return type;
+ }
+}
Added: modules/presentation/trunk/readme-eclipse.txt
===================================================================
--- modules/presentation/trunk/readme-eclipse.txt (rev 0)
+++ modules/presentation/trunk/readme-eclipse.txt 2008-03-28 17:51:45 UTC (rev 10401)
@@ -0,0 +1,4 @@
+1/ For your Eclipse workspace to build successfully you will need to add "M2_REPO" variable to your Eclipse classpath and point it to the
+local Maven2 Repository on your machine
+
+How-To: Window > Preferences > Java > Build Path > Classpath Variables
\ No newline at end of file
16 years, 1 month
JBoss Portal SVN: r10400 - in modules/test/tags/JBP_TEST_1_1_0: remote and 4 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-03-28 10:37:42 -0400 (Fri, 28 Mar 2008)
New Revision: 10400
Modified:
modules/test/tags/JBP_TEST_1_1_0/build/pom.xml
modules/test/tags/JBP_TEST_1_1_0/remote/pom.xml
modules/test/tags/JBP_TEST_1_1_0/test/agent/pom.xml
modules/test/tags/JBP_TEST_1_1_0/test/core/pom.xml
modules/test/tags/JBP_TEST_1_1_0/test/generic/pom.xml
modules/test/tags/JBP_TEST_1_1_0/test/jboss/pom.xml
Log:
Use fixed version for common libs
Use shorter name convention for common libs
Modified: modules/test/tags/JBP_TEST_1_1_0/build/pom.xml
===================================================================
--- modules/test/tags/JBP_TEST_1_1_0/build/pom.xml 2008-03-28 14:36:48 UTC (rev 10399)
+++ modules/test/tags/JBP_TEST_1_1_0/build/pom.xml 2008-03-28 14:37:42 UTC (rev 10400)
@@ -50,7 +50,7 @@
<properties>
- <version.portal.common>1.1.0-SNAPSHOT</version.portal.common>
+ <version.portal.common>1.1.0</version.portal.common>
<version.jboss.microcontainer>2.0.0.Beta4</version.jboss.microcontainer>
<version.apache.httpclient>3.0.1</version.apache.httpclient>
<version.cargo>0.9-portal</version.cargo>
@@ -271,7 +271,7 @@
<dependency>
<groupId>org.jboss.portal.common</groupId>
- <artifactId>jboss-portal-modules-common</artifactId>
+ <artifactId>common-common</artifactId>
<version>${version.portal.common}</version>
</dependency>
Modified: modules/test/tags/JBP_TEST_1_1_0/remote/pom.xml
===================================================================
--- modules/test/tags/JBP_TEST_1_1_0/remote/pom.xml 2008-03-28 14:36:48 UTC (rev 10399)
+++ modules/test/tags/JBP_TEST_1_1_0/remote/pom.xml 2008-03-28 14:37:42 UTC (rev 10400)
@@ -23,7 +23,7 @@
</dependency>
<dependency>
<groupId>org.jboss.portal.common</groupId>
- <artifactId>jboss-portal-modules-common</artifactId>
+ <artifactId>common-common</artifactId>
</dependency>
<dependency>
<groupId>apache-httpclient</groupId>
Modified: modules/test/tags/JBP_TEST_1_1_0/test/agent/pom.xml
===================================================================
--- modules/test/tags/JBP_TEST_1_1_0/test/agent/pom.xml 2008-03-28 14:36:48 UTC (rev 10399)
+++ modules/test/tags/JBP_TEST_1_1_0/test/agent/pom.xml 2008-03-28 14:37:42 UTC (rev 10400)
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>org.jboss.portal.common</groupId>
- <artifactId>jboss-portal-modules-common</artifactId>
+ <artifactId>common-common</artifactId>
</dependency>
<dependency>
<groupId>cargo</groupId>
Modified: modules/test/tags/JBP_TEST_1_1_0/test/core/pom.xml
===================================================================
--- modules/test/tags/JBP_TEST_1_1_0/test/core/pom.xml 2008-03-28 14:36:48 UTC (rev 10399)
+++ modules/test/tags/JBP_TEST_1_1_0/test/core/pom.xml 2008-03-28 14:37:42 UTC (rev 10400)
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>org.jboss.portal.common</groupId>
- <artifactId>jboss-portal-modules-common</artifactId>
+ <artifactId>common-common</artifactId>
</dependency>
<dependency>
<groupId>cargo</groupId>
Modified: modules/test/tags/JBP_TEST_1_1_0/test/generic/pom.xml
===================================================================
--- modules/test/tags/JBP_TEST_1_1_0/test/generic/pom.xml 2008-03-28 14:36:48 UTC (rev 10399)
+++ modules/test/tags/JBP_TEST_1_1_0/test/generic/pom.xml 2008-03-28 14:37:42 UTC (rev 10400)
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>org.jboss.portal.common</groupId>
- <artifactId>jboss-portal-modules-common</artifactId>
+ <artifactId>common-common</artifactId>
</dependency>
<dependency>
<groupId>cargo</groupId>
Modified: modules/test/tags/JBP_TEST_1_1_0/test/jboss/pom.xml
===================================================================
--- modules/test/tags/JBP_TEST_1_1_0/test/jboss/pom.xml 2008-03-28 14:36:48 UTC (rev 10399)
+++ modules/test/tags/JBP_TEST_1_1_0/test/jboss/pom.xml 2008-03-28 14:37:42 UTC (rev 10400)
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>org.jboss.portal.common</groupId>
- <artifactId>jboss-portal-modules-common</artifactId>
+ <artifactId>common-common</artifactId>
</dependency>
<dependency>
<groupId>cargo</groupId>
16 years, 1 month