JBoss Portal SVN: r9447 - branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-01-07 09:38:54 -0500 (Mon, 07 Jan 2008)
New Revision: 9447
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
Log:
Ajax User Agent - minor code cleanup
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-07 11:38:45 UTC (rev 9446)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-07 14:38:54 UTC (rev 9447)
@@ -23,22 +23,12 @@
package org.jboss.portal.presentation.ajax.client.widget;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.ClickListener;
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.Panel;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.Widget;
import net.mygwt.ui.client.widget.ContentPanel;
import net.mygwt.ui.client.Style;
@@ -51,7 +41,6 @@
import org.jboss.portal.presentation.ajax.client.Session;
import org.jboss.portal.presentation.ajax.client.model.AjaxUIWindow;
import org.jboss.portal.presentation.ajax.client.model.AjaxUIPage;
-import org.jboss.portal.presentation.ajax.client.layout.LayoutManager;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxUpdateWindowStateAction;
import org.jboss.portal.presentation.ajax.client.protocol.Caller;
import org.jboss.portal.presentation.ajax.client.protocol.AsyncActivateAction;
@@ -161,7 +150,6 @@
*/
public void callback(Object result)
{
- this.refresh();
Util.displayPortalPage();
}
18 years, 3 months
JBoss Portal SVN: r9446 - in modules/common/trunk/common/src: test/java/org/jboss/portal/test/common and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-07 06:38:45 -0500 (Mon, 07 Jan 2008)
New Revision: 9446
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/i18n/LocalizedString.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/LocalizedStringTestCase.java
Log:
generified LocalizedString
Modified: modules/common/trunk/common/src/main/java/org/jboss/portal/common/i18n/LocalizedString.java
===================================================================
--- modules/common/trunk/common/src/main/java/org/jboss/portal/common/i18n/LocalizedString.java 2008-01-07 09:21:33 UTC (rev 9445)
+++ modules/common/trunk/common/src/main/java/org/jboss/portal/common/i18n/LocalizedString.java 2008-01-07 11:38:45 UTC (rev 9446)
@@ -24,7 +24,6 @@
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
@@ -41,11 +40,14 @@
public final class LocalizedString
{
+ /** Shared empty string. */
+ private static final String[] EMPTY_STRINGS = new String[0];
+
/** The logger. */
private static final Logger log = Logger.getLogger(LocalizedString.class);
- /** An unmodifiable <Locale,String>Map. */
- private final Map values;
+ /** A unmodifiable map. */
+ private final Map<Locale, Value> values;
/** The default locale. */
private final Locale defaultLocale;
@@ -88,8 +90,8 @@
}
//
- Map values = new HashMap(1);
- addValueForLocale(values, defaultLocale, defaultValue);
+ Map<Locale, Value> values = new HashMap<Locale, Value>(1);
+ values.put(defaultLocale, new Value(defaultLocale, defaultValue));
//
this.defaultLocale = defaultLocale;
@@ -111,17 +113,17 @@
//
this.defaultLocale = defaultLocale;
- this.values = Collections.EMPTY_MAP;
+ this.values = Collections.emptyMap();
}
/**
* Build a localized string using a <Locale,String>Map object.
*
* @param values the <Locale,String>Map
- * @param defaultLocale
+ * @param defaultLocale the default locale
* @throws IllegalArgumentException if one argument if null or if the map entries are different from <Locale,String>Map.Entry
*/
- public LocalizedString(Map values, Locale defaultLocale) throws IllegalArgumentException
+ public LocalizedString(Map<Locale, String> values, Locale defaultLocale) throws IllegalArgumentException
{
if (values == null)
{
@@ -133,21 +135,12 @@
}
// Convert strings to value
- Map tmp = new HashMap(values.size());
- for (Iterator i = values.entrySet().iterator(); i.hasNext();)
+ Map<Locale, Value> tmp = new HashMap<Locale, Value>(values.size());
+ for (Map.Entry<Locale, String> entry : values.entrySet())
{
- Map.Entry entry = (Map.Entry)i.next();
- Object key = entry.getKey();
- if (!(key instanceof Locale))
- {
- throw new IllegalArgumentException("Key not a locale " + entry.getKey());
- }
- Object value = entry.getValue();
- if (!(value instanceof String))
- {
- throw new IllegalArgumentException("Value not a string " + entry.getValue());
- }
- addValueForLocale(tmp, (Locale)key, (String)value);
+ Locale key = entry.getKey();
+ String value = entry.getValue();
+ tmp.put(key, new Value(key, value));
}
//
@@ -156,19 +149,6 @@
}
/**
- * Adds a new value for the specified locale to this LocalizedString. Note that if a value existed for this Locale,
- * it will be overwritten.
- *
- * @param locale the locale of the value
- * @param value the value
- * @since 2.4
- */
- private static void addValueForLocale(Map values, Locale locale, String value)
- {
- values.put(locale, new Value(locale, value));
- }
-
- /**
* Determines if this LocalizedString contains any values.
*
* @return <code>true</code> if this LocalizedString contains localized values, <code>false</code> otherwise.
@@ -176,7 +156,7 @@
*/
public boolean hasValues()
{
- return values.isEmpty() == false;
+ return !values.isEmpty();
}
/**
@@ -209,6 +189,8 @@
public String getString(Locale locale, boolean resolve)
{
Value value = getValue(locale, resolve);
+
+ //
if (value != null)
{
return value.getString();
@@ -235,38 +217,39 @@
throw new IllegalArgumentException("No null locale accepted as argument");
}
- // fail fast is there aren't any values
+ // Fail fast is there aren't any values
if (values.isEmpty())
{
return null;
}
+ //
if (resolve)
{
- Value value = (Value)values.get(locale);
+ Value value = values.get(locale);
if (value == null && !locale.getVariant().equals(""))
{
- value = (Value)values.get(new Locale(locale.getLanguage(), locale.getCountry()));
+ value = values.get(new Locale(locale.getLanguage(), locale.getCountry()));
}
if (value == null && !locale.getCountry().equals(""))
{
- value = (Value)values.get(new Locale(locale.getLanguage()));
+ value = values.get(new Locale(locale.getLanguage()));
}
if (value == null)
{
- value = (Value)values.get(defaultLocale);
+ value = values.get(defaultLocale);
}
return value;
}
else
{
- return (Value)values.get(locale);
+ return values.get(locale);
}
}
- public Map getValues()
+ public Map<Locale, Value> getValues()
{
- return Collections.unmodifiableMap(values);
+ return values;
}
/**
@@ -292,7 +275,7 @@
public String getMostAppropriateValueFor(String[] desiredLocales) throws IllegalArgumentException
{
Value mapping = getPreferredOrBestLocalizedMappingFor(desiredLocales);
- return (mapping == null) ? null : mapping.getString();
+ return mapping == null ? null : mapping.getString();
}
/**
@@ -368,7 +351,7 @@
{
if (cachedToString == null)
{
- cachedToString = "LocalizedString[value='" + getMostAppropriateValueFor(new String[0]) + "',defaultLocale=" + getDefaultLocale() + "]";
+ cachedToString = "LocalizedString[value='" + getMostAppropriateValueFor(EMPTY_STRINGS) + "',defaultLocale=" + getDefaultLocale() + "]";
}
return cachedToString;
}
@@ -379,27 +362,25 @@
{
return true;
}
- if (o == null || LocalizedString.class != o.getClass())
+ if (o instanceof LocalizedString)
{
- return false;
+ LocalizedString that = (LocalizedString)o;
+ return defaultLocale.equals(that.defaultLocale) && getMostAppropriateValueFor(EMPTY_STRINGS).equals(that.getMostAppropriateValueFor(EMPTY_STRINGS));
}
-
- //
- LocalizedString that = (LocalizedString)o;
- return defaultLocale.equals(that.defaultLocale) && getMostAppropriateValueFor(new String[0]).equals(that.getMostAppropriateValueFor(new String[0]));
+ return false;
}
public int hashCode()
{
if (hashCode == null)
{
- hashCode = new Integer(31 * getMostAppropriateValueFor(new String[0]).hashCode() + defaultLocale.hashCode());
+ hashCode = 31 * getMostAppropriateValueFor(EMPTY_STRINGS).hashCode() + defaultLocale.hashCode();
}
- return hashCode.intValue();
+ return hashCode;
}
/**
- * A localized string value.
+ * A unmodifiable localized string value.
*/
public static class Value
{
@@ -413,7 +394,7 @@
/**
* @param locale the locale
* @param string the string
- * @throws IllegalArgumentException if one argument is null
+ * @throws IllegalArgumentException if any argument is null
*/
public Value(Locale locale, String string) throws IllegalArgumentException
{
Modified: modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/LocalizedStringTestCase.java
===================================================================
--- modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/LocalizedStringTestCase.java 2008-01-07 09:21:33 UTC (rev 9445)
+++ modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/LocalizedStringTestCase.java 2008-01-07 11:38:45 UTC (rev 9446)
@@ -35,7 +35,7 @@
*/
public class LocalizedStringTestCase extends TestCase
{
- private Map values = new HashMap();
+ private Map<Locale, String> values = new HashMap<Locale, String>();
private LocalizedString localizedString;
protected void setUp() throws Exception
@@ -46,6 +46,18 @@
localizedString = new LocalizedString(values, Locale.US);
}
+ public void testLocalizedStringValuesAreNotModifiable()
+ {
+ try
+ {
+ localizedString.getValues().clear();
+ }
+ catch (Exception expected)
+ {
+ assertTrue(localizedString.hasValues());
+ }
+ }
+
public void testPreferredOrBestLocalizedMappingFor()
{
try
18 years, 3 months
JBoss Portal SVN: r9445 - branches/presentation/presentation/src/main/org/jboss/portal/presentation/model.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-07 04:21:33 -0500 (Mon, 07 Jan 2008)
New Revision: 9445
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java
Log:
added a generic UIAction interface that will be able to describe stuff like window controls etc...
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java 2008-01-07 07:32:16 UTC (rev 9444)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java 2008-01-07 09:21:33 UTC (rev 9445)
@@ -39,13 +39,6 @@
String getDisplayName();
/**
- * Returns the action type.
- *
- * @return the type
- */
- String getType();
-
- /**
* Returns the action icon URL.
*
* @return the icon URL
18 years, 3 months
JBoss Portal SVN: r9444 - in modules/portlet/trunk/test: src/test and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-07 02:32:16 -0500 (Mon, 07 Jan 2008)
New Revision: 9444
Modified:
modules/portlet/trunk/test/pom.xml
modules/portlet/trunk/test/src/test/build.xml
Log:
add possibility to call only one kind of tests in portlet
Modified: modules/portlet/trunk/test/pom.xml
===================================================================
--- modules/portlet/trunk/test/pom.xml 2008-01-07 06:36:03 UTC (rev 9443)
+++ modules/portlet/trunk/test/pom.xml 2008-01-07 07:32:16 UTC (rev 9444)
@@ -276,7 +276,7 @@
<executions>
<execution>
<id>test</id>
- <phase>integration-test</phase>
+ <phase>test</phase>
<configuration>
<tasks>
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-01-07 06:36:03 UTC (rev 9443)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-01-07 07:32:16 UTC (rev 9444)
@@ -10,16 +10,24 @@
<antcall target="package-tests"/>
- <antcall target="tests.local"/>
- <antcall target="tests.jboss"/>
- <antcall target="tests.tomcat"/>
+ <antcall target="tests.call.single"/>
+ <antcall target="tests.call.all"/>
<!--Cleanup-->
<delete dir="${test.temp.dir}"/>
</target>
+ <target name="tests.call.all" unless="tests">
+ <antcall target="tests.local"/>
+ <antcall target="tests.jboss"/>
+ <antcall target="tests.tomcat"/>
+ </target>
+ <target name="tests.call.single" if="tests">
+ <antcall target="tests.${tests}"/>
+ </target>
+
<target name="prepare_env">
<!--Relative path to target dir-->
18 years, 3 months
JBoss Portal SVN: r9443 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client: widget and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-01-07 01:36:03 -0500 (Mon, 07 Jan 2008)
New Revision: 9443
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
Log:
Ajax User Agent - minor code cleanup
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java 2008-01-07 01:31:58 UTC (rev 9442)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java 2008-01-07 06:36:03 UTC (rev 9443)
@@ -24,6 +24,7 @@
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;
@@ -70,6 +71,10 @@
{
AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
Session.getInstance().getUiContext().addObject(uiObject);
+ if(uiObject instanceof AjaxUIPage)
+ {
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ }
caller.callback(uiObject);
}
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java 2008-01-07 01:31:58 UTC (rev 9442)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java 2008-01-07 06:36:03 UTC (rev 9443)
@@ -24,6 +24,7 @@
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;
@@ -69,7 +70,10 @@
{
AjaxUIObject uiObject = ((AjaxShowUIObjectResponse)result).getUiObject();
Session.getInstance().getUiContext().addObject(uiObject);
- Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ if(uiObject instanceof AjaxUIPage)
+ {
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ }
caller.callback(uiObject);
}
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-07 01:31:58 UTC (rev 9442)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-07 06:36:03 UTC (rev 9443)
@@ -61,17 +61,11 @@
*
*/
public class PortletWindow implements Caller
-{
- private static final int windowStateUpdate = 1;
- private static final int getActivation = 2;
- private static final int postActivation = 3;
-
+{
/**
*
*/
private AjaxUIWindow window = null;
- private String newWindowState = null;
- private int requestType = 0;
/**
*
@@ -166,70 +160,11 @@
*
*/
public void callback(Object result)
- {
- if(result instanceof AjaxUIPage)
- {
- if(requestType == PortletWindow.windowStateUpdate)
- {
- boolean valid = this.validateNewWindowState();
- if(valid)
- {
- this.refresh();
- if(this.newWindowState.equals(AjaxUIWindow.NORMAL))
- {
- LayoutManager.normal(this.getName());
- }
- else if(this.newWindowState.equals(AjaxUIWindow.MAXIMIZE))
- {
- LayoutManager.maximize(this.getName());
- }
- else if(this.newWindowState.equals(AjaxUIWindow.MINIMIZE))
- {
- LayoutManager.minimize(this.getName());
- }
- }
- else
- {
- //Do something to handle this situation in a user-friendly manner
- //Probably just laying out the current state of the page
- Util.displayPortalPage();
- }
- }
- else if(requestType == PortletWindow.getActivation)
- {
- Util.displayPortalPage();
- }
- else if(requestType == PortletWindow.postActivation)
- {
- Util.displayPortalPage();
- }
- }
-
- //local state cleanup
- this.newWindowState = null;
+ {
+ this.refresh();
+ Util.displayPortalPage();
}
-
- /**
- *
- *
- */
- private boolean validateNewWindowState()
- {
- boolean valid = false;
- String display = (String)Session.getInstance().getAttribute(Session.display);
- AjaxUIPage displayedPage = (AjaxUIPage)Session.getInstance().getUiContext().getObject(display);
-
- AjaxUIWindow childWindow = (AjaxUIWindow)displayedPage.getChild(this.getName());
-
- if(childWindow != null && childWindow.getState().equals(this.newWindowState))
- {
- valid = true;
- }
-
- return valid;
- }
-
/**
*
*
@@ -251,7 +186,6 @@
private void handlePartialRefreshLink(String url, Widget windowContent)
{
AsyncActivateAction action = new AsyncActivateAction(url);
- this.requestType = PortletWindow.getActivation;
action.execute(this);
}
@@ -274,7 +208,6 @@
}
}
AsyncActivateAction action = new AsyncActivateAction(url);
- this.requestType = PortletWindow.getActivation;
action.execute(this);
}
@@ -397,23 +330,17 @@
//Process the action performed on the window
if(action.equals(AjaxUIWindow.NORMAL))
{
- AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.NORMAL);
- newWindowState = AjaxUIWindow.NORMAL;
- requestType = PortletWindow.windowStateUpdate;
+ 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);
- newWindowState = AjaxUIWindow.MAXIMIZE;
- requestType = PortletWindow.windowStateUpdate;
+ 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);
- newWindowState = AjaxUIWindow.MINIMIZE;
- requestType = PortletWindow.windowStateUpdate;
+ AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MINIMIZE);
stateAction.execute(this.portletWindow);
}
else if(action.equals("save"))
18 years, 3 months
JBoss Portal SVN: r9442 - branches/presentation/presentation/src/main/org/jboss/portal/presentation/model.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-06 20:31:58 -0500 (Sun, 06 Jan 2008)
New Revision: 9442
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java
Log:
added a generic UIAction interface that will be able to describe stuff like window controls etc...
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/UIAction.java 2008-01-07 01:31:58 UTC (rev 9442)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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 type.
+ *
+ * @return the type
+ */
+ String getType();
+
+ /**
+ * Returns the action icon URL.
+ *
+ * @return the icon URL
+ */
+ String getIconURL();
+
+ /**
+ * Returns the action URL.
+ *
+ * @return the url
+ */
+ String getURL();
+
+}
18 years, 3 months
JBoss Portal SVN: r9441 - in branches/presentation/presentation: src/main/org/jboss/portal/presentation/impl/model and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-01-06 12:11:15 -0500 (Sun, 06 Jan 2008)
New Revision: 9441
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventTestCase.java
Modified:
branches/presentation/presentation/build.xml
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
Log:
more stuff related to eventing
Modified: branches/presentation/presentation/build.xml
===================================================================
--- branches/presentation/presentation/build.xml 2008-01-06 15:42:26 UTC (rev 9440)
+++ branches/presentation/presentation/build.xml 2008-01-06 17:11:15 UTC (rev 9441)
@@ -307,8 +307,9 @@
-->
</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.MockModelTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.presentation.test.model.EventTestCase"/>
</x-test>
<x-classpath>
<path refid="jboss.portal/modules/common.classpath"/>
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2008-01-06 15:42:26 UTC (rev 9440)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -133,4 +133,9 @@
{
context.getManagedObject().move(destination);
}
+
+ public String toString()
+ {
+ return context.getManagedObject().toString();
+ }
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java 2008-01-06 15:42:26 UTC (rev 9440)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -30,12 +30,15 @@
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.
@@ -398,4 +401,11 @@
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() + "]";
+ }
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java 2008-01-06 15:42:26 UTC (rev 9440)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/RelationshipContext.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -26,6 +26,8 @@
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;
@@ -33,7 +35,7 @@
import java.util.Collection;
import java.util.AbstractSet;
import java.util.ArrayList;
-import java.util.Collections;
+import java.util.LinkedHashSet;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -89,24 +91,15 @@
private UIContainerObject related;
/** The context pointing at us via a OneToMany. */
- private Set<ObjectContext> refs;
+ private final Set<ObjectContext> refs;
- /** The refs field exposed in a non modifiable manner. */
- private Set<ObjectContext> readOnlyRefs;
-
private ManyToOne()
{
this.loaded = false;
this.related = null;
this.refs = new HashSet<ObjectContext>();
- this.readOnlyRefs = Collections.unmodifiableSet(refs);
}
- Set<ObjectContext> getReferences()
- {
- return readOnlyRefs;
- }
-
/**
* Returns true if the relationship is loaded
*
@@ -171,7 +164,7 @@
throw new IllegalStateException("Cannot clear parent of non loaded association");
}
- // Downgrade realted
+ // Downgrade related
detach();
}
@@ -246,6 +239,14 @@
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()
@@ -269,6 +270,14 @@
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);
+ }
}
/**
@@ -335,22 +344,18 @@
/** Indicates if the relationship is loaded. */
private boolean loaded;
- /** The related object. */
+ /** The related objects. */
private Set<UIContainerObject> relateds;
/** The contexts pointing at us via a ManyToOne. */
private Set<ObjectContext> refs;
- /** The refs field exposed in a non modifiable manner. */
- private Set<ObjectContext> readOnlyRefs;
-
private OneToMany()
{
this.set = new LazySet();
this.loaded = false;
- this.relateds = new HashSet<UIContainerObject>();
+ this.relateds = new LinkedHashSet<UIContainerObject>();
this.refs = new HashSet<ObjectContext>();
- this.readOnlyRefs = Collections.unmodifiableSet(refs);
}
boolean isLoaded()
@@ -432,9 +437,18 @@
return set;
}
- Set<ObjectContext> getReferences()
+ void clear()
{
- return readOnlyRefs;
+ if (!loaded)
+ {
+ throw new IllegalStateException("Cannot clear parent of non loaded association");
+ }
+
+ // Detach relateds
+ for (UIContainerObject related : new HashSet<UIContainerObject>(relateds))
+ {
+ detach(related);
+ }
}
/**
@@ -465,6 +479,14 @@
//
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)
@@ -483,6 +505,14 @@
//
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()
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java 2008-01-06 15:42:26 UTC (rev 9440)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -214,13 +214,12 @@
//
for (String id : destruction.getIds())
{
- UIContainerObject destroyed = universe.remove(id);
+ UIContainerObject toDestroy = universe.get(id);
//
- if (destroyed != null)
+ if (toDestroy != null)
{
- ObjectContext destroyedContext = (ObjectContext)destroyed.getContext();
- destroyedContext.status = UIObject.Status.INVALID;
+ detach(toDestroy, false);
// Eventing
StateChange<StructuralStateModification> stateChange = new StateChange<StructuralStateModification>(id, DESTRUCTION);
@@ -436,6 +435,9 @@
}
//
+ System.err.println("<" + context.getState().getName() + ">");
+
+ //
StructuralObject.Refresh refresh = null;
try
{
@@ -466,11 +468,11 @@
{
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;
- }
+// // 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())
@@ -486,6 +488,8 @@
attach(added);
}
+ System.err.println("added " + added.getName());
+
//
context.relationshipContext.children.addLoadedRelated(added);
}
@@ -508,7 +512,17 @@
UIContainerObject removed = context.relationshipContext.children.removeLoadedRelated(removedId);
//
- detach(removed);
+ 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
@@ -526,29 +540,73 @@
}
}
+ System.err.println("</" + context.getState().getName() + ">");
+
//
scope.leaveObject(object);
}
}
+// void refresh(UIContainerObject object, UIObject.Visitor scope)
+// {
+// // First pass
+//
+//
+//
+// }
+
void attach(UIContainerObject object)
{
- universe.put(object.getId(), 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)
+ void detach(UIContainerObject object, boolean cascade)
{
ObjectContext context = (ObjectContext)object.getContext();
//
- for (UIContainerObject child : context.relationshipContext.children.getRelateds())
+ if (cascade)
{
- detach(child);
+ 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)
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/LifeCycleEvent.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectAddedEvent.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectLifeCycleEvent.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/ObjectRemovedEvent.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipAddedEvent.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipLifeCycleEvent.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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: branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/model/event/lifecycle/RelationshipRemovedEvent.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/AbstractModelTestCase.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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;
+ }
+ };
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java 2008-01-06 15:42:26 UTC (rev 9440)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventAssert.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -80,6 +80,14 @@
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);
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventTestCase.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/EventTestCase.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -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());
+ }
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2008-01-06 15:42:26 UTC (rev 9440)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/test/model/ModelTestCase.java 2008-01-06 17:11:15 UTC (rev 9441)
@@ -23,22 +23,18 @@
package org.jboss.portal.presentation.test.model;
import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
-import org.jboss.portal.presentation.impl.model.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.model.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.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 org.jboss.portal.common.util.Tools;
import java.util.Collections;
@@ -49,39 +45,11 @@
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
*/
-public class ModelTestCase extends TestCase
+public class ModelTestCase extends AbstractModelTestCase
{
- /** . */
- private MockModel model;
-
- public ModelTestCase()
- {
- }
-
- public ModelTestCase(String testName)
- {
- super(testName);
- }
-
- /**
- *
- */
- protected void setUp() throws Exception
- {
- this.model = new MockModelImpl();
- }
-
- /**
- *
- */
- protected void tearDown() throws Exception
- {
- this.model = null;
- }
-
public void testUIContextParentIsNull()
{
UIContext context = createContext();
@@ -113,11 +81,6 @@
}
}
- private UIContext createContext()
- {
- return new UIObjectContainer(model.getStructuralStateContext(), new NavigationalStateContextImpl()).getRoot();
- }
-
public void testGetPropertyThrowsIAE()
{
UIContext context = createContext();
@@ -794,11 +757,29 @@
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);
@@ -820,33 +801,52 @@
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.STALE, foo2.getStatus());
+ 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);
}
}
@@ -884,21 +884,20 @@
assertEquals(Tools.toSet(barDaa, fooJuu), new HashSet<UIObject>(barChildren));
}
- private static final UIObject.Visitor CRAWLER = new UIObject.Visitor()
+ public void testBlah() throws Exception
{
- public boolean enterObject(UIObject object)
- {
- return true;
- }
+ MockObject mockRoot = model.getRoot();
+ MockObject mockFoo = mockRoot.addChild("foo", MockObject.Type.PORTAL);
+ MockObject mockBar = mockRoot.addChild("bar", MockObject.Type.PORTAL);
- public void leaveObject(UIObject object)
- {
- }
+ EventAssert blah = new EventAssert();
- public boolean enterChildren(UIObject object, boolean loaded)
- {
- return loaded;
- }
- };
+ UIContext context = createContext();
+ context.addModelListener(blah);
+ UIObject foo = context.getObject(mockFoo.getId());
+ blah.assertEmpty();
+ foo.getParent();
+ blah.next(RelationshipAddedEvent.class);
+ }
}
18 years, 3 months
JBoss Portal SVN: r9440 - in modules: template and 55 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-06 10:42:26 -0500 (Sun, 06 Jan 2008)
New Revision: 9440
Added:
modules/template/
modules/template/build/
modules/template/build/licences/
modules/template/build/misc/
modules/template/build/pom.xml
modules/template/module-a/
modules/template/module-a/pom.xml
modules/template/module-a/src/
modules/template/module-a/src/main/
modules/template/module-a/src/main/java/
modules/template/module-a/src/main/java/org/
modules/template/module-a/src/main/java/org/jboss/
modules/template/module-a/src/main/java/org/jboss/portal/
modules/template/module-a/src/main/java/org/jboss/portal/templatemodule/
modules/template/module-a/src/main/java/org/jboss/portal/templatemodule/a/
modules/template/module-a/src/main/java/org/jboss/portal/templatemodule/a/SampleModuleAClass.java
modules/template/module-a/src/main/resources/
modules/template/module-a/src/test/
modules/template/module-a/src/test/java/
modules/template/module-a/src/test/java/org/
modules/template/module-a/src/test/java/org/jboss/
modules/template/module-a/src/test/java/org/jboss/portal/
modules/template/module-a/src/test/java/org/jboss/portal/templatemodule/
modules/template/module-a/src/test/java/org/jboss/portal/templatemodule/a/
modules/template/module-a/src/test/java/org/jboss/portal/templatemodule/a/SampleModuleATest.java
modules/template/module-a/src/test/resources/
modules/template/module-b/
modules/template/module-b/module-b1/
modules/template/module-b/module-b1/pom.xml
modules/template/module-b/module-b1/src/
modules/template/module-b/module-b1/src/main/
modules/template/module-b/module-b1/src/main/java/
modules/template/module-b/module-b1/src/main/java/org/
modules/template/module-b/module-b1/src/main/java/org/jboss/
modules/template/module-b/module-b1/src/main/java/org/jboss/portal/
modules/template/module-b/module-b1/src/main/java/org/jboss/portal/templatemodule/
modules/template/module-b/module-b1/src/main/java/org/jboss/portal/templatemodule/c/
modules/template/module-b/module-b1/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleB1Class.java
modules/template/module-b/module-b1/src/main/resources/
modules/template/module-b/module-b1/src/test/
modules/template/module-b/module-b1/src/test/java/
modules/template/module-b/module-b1/src/test/resources/
modules/template/module-b/module-b2/
modules/template/module-b/module-b2/pom.xml
modules/template/module-b/module-b2/src/
modules/template/module-b/module-b2/src/main/
modules/template/module-b/module-b2/src/main/java/
modules/template/module-b/module-b2/src/main/java/org/
modules/template/module-b/module-b2/src/main/java/org/jboss/
modules/template/module-b/module-b2/src/main/java/org/jboss/portal/
modules/template/module-b/module-b2/src/main/java/org/jboss/portal/templatemodule/
modules/template/module-b/module-b2/src/main/java/org/jboss/portal/templatemodule/d/
modules/template/module-b/module-b2/src/main/java/org/jboss/portal/templatemodule/d/SampleModuleB2Class.java
modules/template/module-b/module-b2/src/main/resources/
modules/template/module-b/module-b2/src/test/
modules/template/module-b/module-b2/src/test/java/
modules/template/module-b/module-b2/src/test/resources/
modules/template/module-b/pom.xml
modules/template/module-c/
modules/template/module-c/pom.xml
modules/template/module-c/src/
modules/template/module-c/src/main/
modules/template/module-c/src/main/java/
modules/template/module-c/src/main/java/org/
modules/template/module-c/src/main/java/org/jboss/
modules/template/module-c/src/main/java/org/jboss/portal/
modules/template/module-c/src/main/java/org/jboss/portal/templatemodule/
modules/template/module-c/src/main/java/org/jboss/portal/templatemodule/c/
modules/template/module-c/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleCClass.java
modules/template/module-c/src/main/resources/
modules/template/module-c/src/test/
modules/template/module-c/src/test/java/
modules/template/module-c/src/test/java/org/
modules/template/module-c/src/test/java/org/jboss/
modules/template/module-c/src/test/java/org/jboss/portal/
modules/template/module-c/src/test/java/org/jboss/portal/templatemodule/
modules/template/module-c/src/test/java/org/jboss/portal/templatemodule/c/
modules/template/module-c/src/test/java/org/jboss/portal/templatemodule/c/SampleModuleCTest.java
modules/template/module-c/src/test/resources/
modules/template/module-c/src/test/resources/jboss-unit.xml
modules/template/pom.xml
Log:
initial commit of template module
Copied: modules/template/build/licences (from rev 9433, modules/identity/trunk/build/licences)
Copied: modules/template/build/misc (from rev 9433, modules/identity/trunk/build/misc)
Copied: modules/template/build/pom.xml (from rev 9436, modules/identity/trunk/build/pom.xml)
===================================================================
--- modules/template/build/pom.xml (rev 0)
+++ modules/template/build/pom.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,123 @@
+<?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.templatemodule</groupId>
+ <artifactId>jboss-portal-modules-templatemodule</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Portal TemplateModule</name>
+ <description>JBoss Portal Template Module</description>
+
+ <!--All artifacts versions should be defined here-->
+ <properties>
+ <version.junit>3.8.1</version.junit>
+ <version.jboss.unit>1.1.0-SNAPSHOT</version.jboss.unit>
+ </properties>
+
+
+ <!--JBoss reporitories to be able to grab jboss-portal-parent pom-->
+ <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>
+
+
+ <build>
+ <!--It is important to specify version for every plugin to avoid build errors
+ when maven grab newer version with different behaviour-->
+
+ <plugins>
+ <!--The <skip>true</skip> will by disable default surefire call in all submodules-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ <pluginManagement>
+ <plugins>
+ <!--Only needed if you use jboss-unit maven2 plugin for tests (used in module-c)-->
+ <plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ </build>
+
+
+
+ <!--Sample additional plugin repository. This one is not needed if you don't use maven-antrun-extended-plugin
+ (used in module-c)-->
+ <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>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</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-tooling-ant</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
Added: modules/template/module-a/pom.xml
===================================================================
--- modules/template/module-a/pom.xml (rev 0)
+++ modules/template/module-a/pom.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,36 @@
+<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.templatemodule</groupId>
+ <artifactId>jboss-portal-modules-templatemodule</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-portal-templatemodule-a</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal TemplateModule ModuleA</name>
+
+ <dependencies>
+ <dependency>
+ <artifactId>junit</artifactId>
+ <groupId>junit</groupId>
+ </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>
\ No newline at end of file
Added: modules/template/module-a/src/main/java/org/jboss/portal/templatemodule/a/SampleModuleAClass.java
===================================================================
--- modules/template/module-a/src/main/java/org/jboss/portal/templatemodule/a/SampleModuleAClass.java (rev 0)
+++ modules/template/module-a/src/main/java/org/jboss/portal/templatemodule/a/SampleModuleAClass.java 2008-01-06 15:42:26 UTC (rev 9440)
@@ -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.templatemodule.a;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SampleModuleAClass
+{
+}
Added: modules/template/module-a/src/test/java/org/jboss/portal/templatemodule/a/SampleModuleATest.java
===================================================================
--- modules/template/module-a/src/test/java/org/jboss/portal/templatemodule/a/SampleModuleATest.java (rev 0)
+++ modules/template/module-a/src/test/java/org/jboss/portal/templatemodule/a/SampleModuleATest.java 2008-01-06 15:42:26 UTC (rev 9440)
@@ -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.templatemodule.a;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SampleModuleATest
+{
+ public void testSimple() throws Exception
+ {
+ System.out.println("######## Running simple test with surefire plugin!");
+ }
+}
Added: modules/template/module-b/module-b1/pom.xml
===================================================================
--- modules/template/module-b/module-b1/pom.xml (rev 0)
+++ modules/template/module-b/module-b1/pom.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,14 @@
+<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.templatemodule</groupId>
+ <artifactId>jboss-portal-modules-templatemodule</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-portal-templatemodule-b1</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal TemplateModule ModuleB1</name>
+
+</project>
\ No newline at end of file
Added: modules/template/module-b/module-b1/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleB1Class.java
===================================================================
--- modules/template/module-b/module-b1/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleB1Class.java (rev 0)
+++ modules/template/module-b/module-b1/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleB1Class.java 2008-01-06 15:42:26 UTC (rev 9440)
@@ -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.templatemodule.c;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SampleModuleB1Class
+{
+}
Added: modules/template/module-b/module-b2/pom.xml
===================================================================
--- modules/template/module-b/module-b2/pom.xml (rev 0)
+++ modules/template/module-b/module-b2/pom.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,23 @@
+<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.templatemodule</groupId>
+ <artifactId>jboss-portal-modules-templatemodule</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-portal-templatemodule-b2</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal TemplateModule ModuleB2</name>
+
+ <!--Just a sample how we can refer to other modules in a project-->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.portal.templatemodule</groupId>
+ <artifactId>jboss-portal-templatemodule-b1</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Added: modules/template/module-b/module-b2/src/main/java/org/jboss/portal/templatemodule/d/SampleModuleB2Class.java
===================================================================
--- modules/template/module-b/module-b2/src/main/java/org/jboss/portal/templatemodule/d/SampleModuleB2Class.java (rev 0)
+++ modules/template/module-b/module-b2/src/main/java/org/jboss/portal/templatemodule/d/SampleModuleB2Class.java 2008-01-06 15:42:26 UTC (rev 9440)
@@ -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.templatemodule.d;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SampleModuleB2Class
+{
+}
Copied: modules/template/module-b/pom.xml (from rev 9433, modules/test/trunk/tooling/pom.xml)
===================================================================
--- modules/template/module-b/pom.xml (rev 0)
+++ modules/template/module-b/pom.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.templatemodule</groupId>
+ <artifactId>jboss-portal-modules-templatemodule</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.templatemodule</groupId>
+ <artifactId>jboss-portal-tempatemodule-b-aggregator</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Portal TemplateModule ModuleB (aggregator)</name>
+ <version>1.0-SNAPSHOT</version>
+
+
+ <modules>
+ <module>module-b1</module>
+ <module>module-b2</module>
+ </modules>
+
+</project>
\ No newline at end of file
Added: modules/template/module-c/pom.xml
===================================================================
--- modules/template/module-c/pom.xml (rev 0)
+++ modules/template/module-c/pom.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,134 @@
+<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.templatemodule</groupId>
+ <artifactId>jboss-portal-modules-templatemodule</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-portal-templatemodule-c</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal TemplateModule ModuleC</name>
+
+ <dependencies>
+
+
+ <!--TEST SCOPE-->
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+
+ <plugins>
+
+ <!--Example of JBoss Unit tests with maven2 plugin-->
+ <plugin>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-maven2</artifactId>
+ <executions>
+ <execution>
+ <phase>test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <testsuites>
+ <testsuite>
+ <config>jboss-unit.xml</config>
+ </testsuite>
+ </testsuites>
+ <reports>
+ <xml>target/tests/reports/xml</xml>
+ <html>target/tests/reports/html</html>
+ </reports>
+ </configuration>
+ </plugin>
+
+ <!--If tests require to start AS with cargo and do more complex stuff you should consider using antrun-->
+ <plugin>
+ <!--<groupId>org.jvnet.maven-antrun-extended-plugin</groupId>-->
+
+ <!--A temporary fork of orginal extended plugin until they update to newer ant version-->
+ <groupId>org.jboss.unit</groupId>
+
+ <artifactId>maven-antrun-extended-plugin</artifactId>
+ <version>1.10-SNAPSHOT</version>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.unit</groupId>
+ <artifactId>jboss-unit-tooling-ant</artifactId>
+ <version>${version.jboss.unit}</version>
+ </dependency>
+
+
+ </dependencies>
+ <executions>
+ <execution>
+ <id>test</id>
+ <!-- Can be used in test phase instead -->
+ <phase>integration-test</phase>
+ <configuration>
+ <tasks>
+
+ <!--Get access to maven classpath-->
+ <property name="compile_classpath" refid="maven.compile.classpath"/>
+ <property name="runtime_classpath" refid="maven.runtime.classpath"/>
+ <property name="test_classpath" refid="maven.test.classpath"/>
+ <property name="plugin_classpath" refid="maven.plugin.classpath"/>
+
+ <property name="project.version" value="${project.version}"/>
+
+ <!--This way you can get access to direct path of jars in maven classpath-->
+ <property name="dependency.jboss-unit.jar" value="${maven.dependency.org.jboss.unit.jboss-unit.jar.path}"/>
+ <echo message="Direct path to JBoss Unit jar: ${dependency.jboss-unit.jar}"/>
+
+ <!-- You can redirect ant call to separate build.xml file -->
+ <!--<ant antfile="${basedir}/src/test/build.xml">-->
+ <!--<target name="tests"/>-->
+ <!--</ant>-->
+
+ <taskdef name="jboss-unit" classname="org.jboss.unit.tooling.ant.JBossUnitTask" classpath="${plugin_classpath}"/>
+
+ <!--Use of JBoss Unit ant plugin-->
+ <jboss-unit>
+
+ <tests config="jboss-unit.xml">
+
+ </tests>
+
+ <reports>
+ <xml toDir="target/tests/reports/xml/local"/>
+ <html toDir="target/tests/reports/html/local"/>
+ </reports>
+
+ <classpath>
+ <pathelement location="target/classes"/>
+ <pathelement location="target/test-classes"/>
+ <pathelement path="${test_classpath}"/>
+ </classpath>
+
+ </jboss-unit >
+
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+</project>
\ No newline at end of file
Added: modules/template/module-c/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleCClass.java
===================================================================
--- modules/template/module-c/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleCClass.java (rev 0)
+++ modules/template/module-c/src/main/java/org/jboss/portal/templatemodule/c/SampleModuleCClass.java 2008-01-06 15:42:26 UTC (rev 9440)
@@ -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.templatemodule.c;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SampleModuleCClass
+{
+}
Added: modules/template/module-c/src/test/java/org/jboss/portal/templatemodule/c/SampleModuleCTest.java
===================================================================
--- modules/template/module-c/src/test/java/org/jboss/portal/templatemodule/c/SampleModuleCTest.java (rev 0)
+++ modules/template/module-c/src/test/java/org/jboss/portal/templatemodule/c/SampleModuleCTest.java 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,38 @@
+/*
+* 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.templatemodule.c;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SampleModuleCTest
+{
+ @Test
+ public void testSimple() throws Exception
+ {
+ System.out.println("######## Running simple test with JBoss Unit");
+ }
+}
Added: modules/template/module-c/src/test/resources/jboss-unit.xml
===================================================================
--- modules/template/module-c/src/test/resources/jboss-unit.xml (rev 0)
+++ modules/template/module-c/src/test/resources/jboss-unit.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
+ <pojo>
+ <test>
+ <class name="org.jboss.portal.templatemodule.c.SampleModuleCTest"/>
+ </test>
+ </pojo>
+</jboss-unit>
\ No newline at end of file
Copied: modules/template/pom.xml (from rev 9433, modules/identity/trunk/pom.xml)
===================================================================
--- modules/template/pom.xml (rev 0)
+++ modules/template/pom.xml 2008-01-06 15:42:26 UTC (rev 9440)
@@ -0,0 +1,37 @@
+<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.templatemodule</groupId>
+ <artifactId>jboss-portal-modules-templatemodule-aggregator</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Portal Template Module (aggregator)</name>
+ <version>1.0-SNAPSHOT</version>
+ <url>http://labs.jboss.com/jbossportal</url>
+
+ <dependencies/>
+
+ <!--Repository definition needed to deploy artifacts into JBoss maven repositories-->
+ <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>build</module>
+ <module>module-a</module>
+ <module>module-b</module>
+ <module>module-c</module>
+ </modules>
+
+
+</project>
\ No newline at end of file
18 years, 3 months
JBoss Portal SVN: r9439 - in branches/presentation: presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol and 4 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2008-01-06 01:33:29 -0500 (Sun, 06 Jan 2008)
New Revision: 9439
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java
Modified:
branches/presentation/
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
Log:
Ajax User Agent - Partial Refresh for arbitrary UI interactions like clicking links, submitting forms etc
Property changes on: branches/presentation
___________________________________________________________________
Name: svn:ignore
- thirdparty
.classpath
.project
.settings
core-samples
+ thirdparty
.classpath
.project
.settings
core-samples
cms
core-admin
core-cms
search
workflow
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java 2008-01-04 10:26:54 UTC (rev 9438)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AjaxUpdateWindowStateAction.java 2008-01-06 06:33:29 UTC (rev 9439)
@@ -83,6 +83,6 @@
};
Map queryParams = new HashMap();
queryParams.put("windowstate", this.windowState);
- portalRPC.asyncGet(this.getTargetId(), queryParams, callback);
+ portalRPC.asyncActivate(this.getTargetId(), queryParams, callback);
}
}
Added: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java (rev 0)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/protocol/AsyncActivateAction.java 2008-01-06 06:33:29 UTC (rev 9439)
@@ -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.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 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 AsyncActivateAction extends ClientAction
+{
+ /**
+ *
+ */
+ private String url = null;
+
+ /**
+ *
+ * @param targetId
+ */
+ public AsyncActivateAction(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);
+ Session.getInstance().setAttribute(Session.display, uiObject.getId());
+ caller.callback(uiObject);
+ }
+ }
+
+ public void onFailure(Throwable caught)
+ {
+ /**
+ * TODO: Handle exception properly
+ */
+ }
+ };
+ portalRPC.asyncActivate(this.url, callback);
+ }
+}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java 2008-01-04 10:26:54 UTC (rev 9438)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPC.java 2008-01-06 06:33:29 UTC (rev 9439)
@@ -43,11 +43,19 @@
public ClientResponse loadObject(String objectId);
/**
- * Asynchronously changes the window state of the specified window on the server
+ * Asynchronously send a UI activation to the Portal Server
*
- * @param url
+ * @param uiObjectId
* @gwt.typeArgs queryParams <java.lang.String, java.lang.String>
* @return
*/
- public ClientResponse asyncGet(String url, Map queryParams);
+ public ClientResponse asyncActivate(String uiObjectId, Map queryParams);
+
+ /**
+ * Asynchronously send a UI activation to the Portal Server
+ *
+ * @param url
+ * @return
+ */
+ public ClientResponse asyncActivate(String url);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java 2008-01-04 10:26:54 UTC (rev 9438)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/service/PortalRPCAsync.java 2008-01-06 06:33:29 UTC (rev 9439)
@@ -40,11 +40,19 @@
public void loadObject(String objectId, AsyncCallback callback);
/**
- * Asynchronously changes the window state of the specified window on the server
+ * Asynchronously send a UI activation to the Portal Server
*
- * @param url
+ * @param uiObjectId
* @gwt.typeArgs queryParams <java.lang.String, java.lang.String>
* @param callback
*/
- public void asyncGet(String url, Map queryParams, AsyncCallback callback);
+ public void asyncActivate(String uiObjectId, Map queryParams, AsyncCallback callback);
+
+ /**
+ * Asynchronously send a UI activation to the Portal Server
+ *
+ * @param url
+ * @param callback
+ */
+ public void asyncActivate(String url, AsyncCallback callback);
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-04 10:26:54 UTC (rev 9438)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/ajax/client/widget/PortletWindow.java 2008-01-06 06:33:29 UTC (rev 9439)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.widget;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.DOM;
@@ -44,7 +45,6 @@
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.Listener;
import net.mygwt.ui.client.event.BaseEvent;
import org.jboss.portal.presentation.ajax.client.Util;
@@ -54,6 +54,7 @@
import org.jboss.portal.presentation.ajax.client.layout.LayoutManager;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxUpdateWindowStateAction;
import org.jboss.portal.presentation.ajax.client.protocol.Caller;
+import org.jboss.portal.presentation.ajax.client.protocol.AsyncActivateAction;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -61,11 +62,16 @@
*/
public class PortletWindow implements Caller
{
+ private static final int windowStateUpdate = 1;
+ private static final int getActivation = 2;
+ private static final int postActivation = 3;
+
/**
*
*/
private AjaxUIWindow window = null;
private String newWindowState = null;
+ private int requestType = 0;
/**
*
@@ -95,6 +101,7 @@
ContentPanel portletWindow = new ContentPanel(Style.HEADER);
portletWindow.setId(windowName);
+ portletWindow.layoutOnChange = true;
//Setup listeners
//Event Listener for the decoration components like
@@ -145,56 +152,16 @@
{
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
+ ClickListener contentListener = new ContentListener();
+ windowContent.addClickListener(contentListener);
}
- return portletWindow;
-
- //Event Listener for actions perfomed inside the portlet window content
- //itself. Used for performing Partial Refresh of a Portal Page
- /*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);*/
+ return portletWindow;
}
-
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
/**
*
*/
@@ -202,29 +169,40 @@
{
if(result instanceof AjaxUIPage)
{
- boolean valid = this.validateNewWindowState();
- if(valid)
+ if(requestType == PortletWindow.windowStateUpdate)
{
- this.refresh();
- if(this.newWindowState.equals(AjaxUIWindow.NORMAL))
- {
- LayoutManager.normal(this.getName());
- }
- else if(this.newWindowState.equals(AjaxUIWindow.MAXIMIZE))
- {
- LayoutManager.maximize(this.getName());
+ boolean valid = this.validateNewWindowState();
+ if(valid)
+ {
+ this.refresh();
+ if(this.newWindowState.equals(AjaxUIWindow.NORMAL))
+ {
+ LayoutManager.normal(this.getName());
+ }
+ else if(this.newWindowState.equals(AjaxUIWindow.MAXIMIZE))
+ {
+ LayoutManager.maximize(this.getName());
+ }
+ else if(this.newWindowState.equals(AjaxUIWindow.MINIMIZE))
+ {
+ LayoutManager.minimize(this.getName());
+ }
}
- else if(this.newWindowState.equals(AjaxUIWindow.MINIMIZE))
- {
- LayoutManager.minimize(this.getName());
+ else
+ {
+ //Do something to handle this situation in a user-friendly manner
+ //Probably just laying out the current state of the page
+ Util.displayPortalPage();
}
}
- else
+ else if(requestType == PortletWindow.getActivation)
{
- //Do something to handle this situation in a user-friendly manner
- //Probably just laying out the current state of the page
Util.displayPortalPage();
}
+ else if(requestType == PortletWindow.postActivation)
+ {
+ Util.displayPortalPage();
+ }
}
//local state cleanup
@@ -263,183 +241,52 @@
this.window = (AjaxUIWindow)displayedPage.getChild(this.getName());
}
-
- /**
- *
- * @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);
- newWindowState = AjaxUIWindow.NORMAL;
- stateAction.execute(this.portletWindow);
- }
- else if(action.equals(AjaxUIWindow.MAXIMIZE))
- {
- AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MAXIMIZE);
- newWindowState = AjaxUIWindow.MAXIMIZE;
- stateAction.execute(this.portletWindow);
- }
- else if(action.equals(AjaxUIWindow.MINIMIZE))
- {
- AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MINIMIZE);
- newWindowState = 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....");
- }
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------------------------------------------------------------------------------------------
/**
*
- * @param window
- * @param newState
- */
- /*private void handleWindowStateChanged(String window, String newState)
- {
- PortletServiceAsync portletService = (PortletServiceAsync)GWT.create(PortletService.class);
- ((ServiceDefTarget)portletService).setServiceEntryPoint(GWT.getModuleBaseURL()+"/portalrpc");
-
- 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()+"/portalrpc");
-
- 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)
+ private void handlePartialRefreshLink(String url, Widget windowContent)
{
- HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
- }*/
+ AsyncActivateAction action = new AsyncActivateAction(url);
+ this.requestType = PortletWindow.getActivation;
+ action.execute(this);
+ }
/**
*
* @param url
* @param portletWindow
*/
- /*private void handlePartialRefreshForm(String url, String method, String postData, Widget windowContent)
+ private void handlePartialRefreshForm(String url, String method, String postData, Widget windowContent)
{
- if(method.equalsIgnoreCase("post"))
+ if(postData != null && postData.trim().length() > 0)
{
- HTTPRequest.asyncPost(url, postData, new ResponseTextHandlerImpl(windowContent));
- }
- else if(method.equalsIgnoreCase("get"))
- {
- if(postData != null && postData.trim().length() > 0)
+ if(url.indexOf('?') == -1)
{
url = url + "?" + postData;
}
- HTTPRequest.asyncGet(url, new ResponseTextHandlerImpl(windowContent));
+ else
+ {
+ url = url + "&" + postData;
+ }
}
- }*/
-
- /**
- *
- * @author soshah
- *
- */
- /*private class ResponseTextHandlerImpl implements ResponseTextHandler
- {
- private Widget windowContent = null;
+ AsyncActivateAction action = new AsyncActivateAction(url);
+ this.requestType = PortletWindow.getActivation;
+ action.execute(this);
+ }
- 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)
+ private boolean isPartialRefreshAllowed(String url)
{
String basePortalURL = GWT.getModuleBaseURL();
- String portalContext = "org.jboss.portal.uiserver.Portal"; //This is hard coded for now, but must be populated from the Portal deployment environment
+ String portalContext = "presentation"; //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))
@@ -501,8 +348,8 @@
//If I get here, Async Page Refresh through the Portal should be allowed
return true;
- }
- }*/
+ }
+ }
/**
*
@@ -513,5 +360,115 @@
/*-{
var formData = $wnd.Form.serialize(currentForm);
return formData;
- }-*/;
+ }-*/;
+ //-----------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @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);
+ newWindowState = AjaxUIWindow.NORMAL;
+ requestType = PortletWindow.windowStateUpdate;
+ stateAction.execute(this.portletWindow);
+ }
+ else if(action.equals(AjaxUIWindow.MAXIMIZE))
+ {
+ AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MAXIMIZE);
+ newWindowState = AjaxUIWindow.MAXIMIZE;
+ requestType = PortletWindow.windowStateUpdate;
+ stateAction.execute(this.portletWindow);
+ }
+ else if(action.equals(AjaxUIWindow.MINIMIZE))
+ {
+ AjaxUpdateWindowStateAction stateAction = new AjaxUpdateWindowStateAction(this.portletWindow.window.getId(), AjaxUIWindow.MINIMIZE);
+ newWindowState = AjaxUIWindow.MINIMIZE;
+ requestType = PortletWindow.windowStateUpdate;
+ 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....");
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private class ContentListener implements 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.trim());
+ if(isPartialRefreshAllowed)
+ {
+ DOM.eventPreventDefault(event);
+ handlePartialRefreshLink(link.trim(), 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.trim());
+ 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.trim(), method, serializedForm, sender);
+ }
+ }
+ }
+ }
}
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2008-01-04 10:26:54 UTC (rev 9438)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/PresentationContextImpl.java 2008-01-06 06:33:29 UTC (rev 9439)
@@ -118,8 +118,12 @@
//
if (objectAction instanceof LinkActivation)
{
- StringBuffer portalRequestPath = new StringBuffer("/invoke");
- createPath(target, portalRequestPath);
+ //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;
Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java
===================================================================
--- branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-01-04 10:26:54 UTC (rev 9438)
+++ branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/ajax/entry/PortalEntryPoint.java 2008-01-06 06:33:29 UTC (rev 9439)
@@ -3,7 +3,10 @@
import java.util.Map;
import java.util.List;
+import java.util.Iterator;
+import java.util.StringTokenizer;
import java.util.HashMap;
+import java.net.URLDecoder;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -151,7 +154,7 @@
* @param windowState
* @return
*/
- public ClientResponse asyncGet(String url, Map queryParams)
+ public ClientResponse asyncActivate(String uiObjectId, Map queryParams)
{
try
{
@@ -159,12 +162,15 @@
HttpServletRequest request = this.getThreadLocalRequest();
- if(queryParams.containsKey("windowstate"))
+ Map params = new HashMap();
+ for(Iterator itr=queryParams.keySet().iterator(); itr.hasNext();)
{
- String windowState = (String)queryParams.get("windowstate");
- queryParams.put("windowstate", new String[]{windowState});
+ String key = (String)itr.next();
+ String value = (String)queryParams.get(key);
+ params.put(key, new String[]{value});
}
- GetActivation get = new GetActivation(url, queryParams);
+
+ GetActivation get = new GetActivation(uiObjectId, params);
request.setAttribute("serverAction", get);
@@ -185,6 +191,53 @@
throw new RuntimeException(e);
}
}
+
+ /**
+ *
+ * @param url
+ * @return
+ */
+ public ClientResponse asyncActivate(String url)
+ {
+ try
+ {
+ Map queryParams = new HashMap();
+
+ //Parse the query parameters into a Map of name value pairs
+ 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, URLDecoder.decode(value, "UTF-8"));
+ }
+ }
+
+ //Parse the UIObject id
+ String uiObjectId = null;
+ int invokeIndex = url.indexOf("presentation"); //hard coding the portal deployment context for now
+ int endIndex = url.indexOf('?');
+ if(endIndex != -1)
+ {
+ uiObjectId = url.substring(invokeIndex+"presentation".length(), endIndex);
+ }
+ else
+ {
+ uiObjectId = url.substring(invokeIndex+"presentation".length());
+ }
+
+ return this.asyncActivate(uiObjectId, queryParams);
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------
/**
*
18 years, 3 months
JBoss Portal SVN: r9438 - modules/test/trunk/build.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-01-04 05:26:54 -0500 (Fri, 04 Jan 2008)
New Revision: 9438
Modified:
modules/test/trunk/build/pom.xml
Log:
readd jboss repos
Modified: modules/test/trunk/build/pom.xml
===================================================================
--- modules/test/trunk/build/pom.xml 2008-01-04 10:16:59 UTC (rev 9437)
+++ modules/test/trunk/build/pom.xml 2008-01-04 10:26:54 UTC (rev 9438)
@@ -42,6 +42,40 @@
</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>Codehaus Snapshots</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+
+ </pluginRepositories>
+
<build>
<plugins>
<plugin>
@@ -60,19 +94,10 @@
</build>
- <repositories/>
- <pluginRepositories>
- <pluginRepository>
- <id>Codehaus Snapshots</id>
- <url>http://snapshots.repository.codehaus.org/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
-
- </pluginRepositories>
+
+
<dependencyManagement>
<!-- The parent pom manages the inter-dependencies of the modules. -->
<dependencies>
18 years, 3 months