Author: julien(a)jboss.com
Date: 2008-06-27 20:22:22 -0400 (Fri, 27 Jun 2008)
New Revision: 11184
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
Log:
added logger in GWT to display what's going on
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -25,12 +25,19 @@
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
import org.jboss.portal.presentation.ajax.client.model.AjaxObject;
import org.jboss.portal.presentation.ajax.client.utils.Bootstrap;
+import org.jboss.portal.presentation.ajax.client.utils.Appender;
+import org.jboss.portal.presentation.ajax.client.utils.Level;
+import org.jboss.portal.presentation.ajax.client.utils.Logger;
import java.util.Map;
import java.util.HashMap;
@@ -42,8 +49,9 @@
public class PresentationClientAgent implements EntryPoint
{
+ /** . */
+ private static final Logger log = Logger.getLogger(PresentationClientAgent.class);
-
/** . */
private Map pages = new HashMap();
@@ -52,6 +60,22 @@
public void onModuleLoad()
{
+ VerticalPanel main = new VerticalPanel();
+
+ //
+ RootPanel.get().add(main);
+
+ //
+ SimpleAppender appender = new SimpleAppender();
+ main.add(appender);
+ Logger.registerAppender(appender);
+ log.info("Added logger");
+
+ //
+ final AbsolutePanel bottom = new AbsolutePanel();
+ main.add(bottom);
+
+ //
Bootstrap.init();
// Initialize the remote service
@@ -65,7 +89,7 @@
{
public void onFailure(Throwable throwable)
{
- Window.alert("Ping failed " + throwable.getMessage());
+ log.info("Ping failed " + throwable.getMessage());
}
public void onSuccess(Object o)
@@ -82,11 +106,45 @@
context.getRoot().refresh();
//
- RootPanel.get().add(context.getRoot().getWidget());
+ bottom.add(context.getRoot().getWidget());
}
};
//
remote.ping(callback);
}
+
+ private static class SimpleAppender extends FlowPanel implements Appender
+ {
+
+ // width:auto; height:100px; overflow:hidden;
+
+ /** . */
+ private Element container;
+
+ private SimpleAppender()
+ {
+ container = getElement();
+
+ //
+ DOM.setStyleAttribute(container, "width", "auto");
+ DOM.setStyleAttribute(container, "height", "128px");
+ DOM.setStyleAttribute(container, "overflow", "scroll");
+
+ //
+ setStylePrimaryName("log");
+ }
+
+ public void append(Level level, String category, String msg)
+ {
+ Element div = DOM.createDiv();
+
+ //
+ DOM.setInnerHTML(div, level + " " + category + " " + msg);
+
+ //
+ DOM.appendChild(container, div);
+ }
+ }
+
}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -40,6 +40,7 @@
import org.jboss.portal.presentation.ajax.client.protocol.AjaxRequest;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxResponse;
import org.jboss.portal.presentation.ajax.client.utils.DOMTools;
+import org.jboss.portal.presentation.ajax.client.utils.Logger;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
@@ -49,6 +50,9 @@
{
/** . */
+ private static final Logger log = Logger.getLogger(AjaxWindow.class);
+
+ /** . */
private Label title;
/** . */
@@ -95,7 +99,7 @@
String uri = DOM.getElementAttribute(target, "href");
// This is a get
- Window.alert("This is link click " + uri);
+ log.info("This is link click " + uri);
//
OpaqueWindowAction windowAction = new OpaqueWindowAction(uri);
@@ -130,12 +134,12 @@
if (stale != null)
{
- Window.alert("Going to refresh portlet window " +
staleObject);
+ log.info("Going to refresh portlet window " +
staleObject);
stale.refresh();
}
else
{
- Window.alert("No stale window found for " +
staleObject);
+ log.info("No stale window found for " +
staleObject);
}
}
@@ -148,7 +152,7 @@
DOM.eventPreventDefault(event);
// This is maybe a form submit
- Window.alert("This is maybe a form submit");
+ log.info("This is maybe a form submit");
}
}
});
@@ -177,7 +181,7 @@
{
public void onFailure(Throwable throwable)
{
- Window.alert("Refresh failed " + throwable.getMessage());
+ log.info("Refresh failed " + throwable.getMessage());
}
public void onSuccess(Object o)
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client.utils;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface Appender
+{
+
+ void append(Level level, String category, String msg);
+
+}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -38,6 +38,9 @@
{
/** . */
+ private static final Logger log = Logger.getLogger(Bootstrap.class);
+
+ /** . */
private static Bootstrap instance;
public static void init()
@@ -77,7 +80,7 @@
DOM.eventPreventDefault(event);
//
- Window.alert("Element " + element + " clicked");
+ log.info("Element " + element + " clicked");
// for (Iterator i = listeners.iterator();i.hasNext();)
// {
@@ -88,7 +91,7 @@
private static void handle(Element element)
{
- Window.alert("Element " + element + " clicked");
+ log.info("Element " + element + " clicked");
// for (Iterator i = listeners.iterator();i.hasNext();)
// {
// ElementListener listener = (ElementListener)i.next();
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client.utils;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class Level
+{
+
+ /** . */
+ public static final Level TRACE = new Level("TRACE");
+
+ /** . */
+ public static final Level DEBUG = new Level("DEBUG");
+
+ /** . */
+ public static final Level INFO = new Level("INFO");
+
+ /** . */
+ public static final Level ERROR = new Level("ERROR");
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String toString;
+
+ private Level(String name)
+ {
+ this.name = name;
+ this.toString = "[" + name + "]";
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String toString()
+ {
+ return toString;
+ }
+}
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -0,0 +1,138 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client.utils;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class Logger
+{
+
+ /** . */
+ private static final Map loggers = new HashMap();
+
+ /** . */
+ private static final Set appenders = new HashSet();
+
+ /**
+ * Returns a logger.
+ *
+ * @param clazz the logger key
+ * @return the logger
+ * @throws IllegalArgumentException if the clazz argument is null
+ */
+ public static Logger getLogger(Class clazz) throws IllegalArgumentException
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("No null clazz accepted");
+ }
+
+ //
+ String name = clazz.toString();
+
+ //
+ Logger logger = (Logger)loggers.get(name);
+
+ //
+ if (logger == null)
+ {
+ loggers.put(name, logger = new Logger(name));
+ }
+
+ //
+ return logger;
+ }
+
+ public static void registerAppender(Appender appender)
+ {
+ if (appender == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ appenders.add(appender);
+ }
+
+ /** . */
+ private final String category;
+
+ private Logger(String category)
+ {
+ this.category = category;
+ }
+
+ public String getCategory()
+ {
+ return category;
+ }
+
+ public void log(Level level, String msg)
+ {
+ if (level == null)
+ {
+ throw new IllegalArgumentException("No null level");
+ }
+ if (msg == null)
+ {
+ throw new IllegalArgumentException("No null msg");
+ }
+
+ //
+ for (Iterator i = appenders.iterator();i.hasNext();)
+ {
+ Appender appender = (Appender)i.next();
+
+ //
+ appender.append(level, category, msg);
+ }
+ }
+
+ public void info(String msg)
+ {
+ log(Level.INFO, msg);
+ }
+
+ public void error(String msg)
+ {
+ log(Level.ERROR, msg);
+ }
+
+ public void debug(String msg)
+ {
+ log(Level.DEBUG, msg);
+ }
+
+ public void trace(String msg)
+ {
+ log(Level.TRACE, msg);
+ }
+}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html 2008-06-28
00:22:22 UTC (rev 11184)
@@ -1,7 +1,8 @@
<html>
<head>
<title>Presentation</title>
- </head>
+ <link rel="stylesheet" href="style.css"
type="text/css">
+ </head>
<body bgcolor="white">
<script language="javascript"
src="org.jboss.portal.presentation.ajax.Presentation.nocache.js"></script>
</body>
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
(rev 0)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-06-28
00:22:22 UTC (rev 11184)
@@ -0,0 +1,6 @@
+.log {
+ white-space:pre;
+ font-family:Courier New;
+ font-size:12px;
+ font-weight:bold;
+}
\ No newline at end of file
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -1,95 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.io.Serializable;
-
-/**
- * An item part of the layout system.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class LayoutItem
-{
-
- /** . */
- private LayoutItemContext context;
-
- /** The structure to which this element belongs. */
- LayoutStructure structure;
-
- protected LayoutItem()
- {
- }
-
- LayoutItemContext getContext()
- {
- return context;
- }
-
- void register(LayoutItemContext context)
- {
- this.context = context;
- }
-
- void unregister()
- {
- throw new NotYetImplemented("No need for now");
- }
-
- public final LayoutStructure getStructure()
- {
- return structure;
- }
-
- public final String getId()
- {
- if (context == null)
- {
- throw new IllegalStateException();
- }
-
- //
- return context.getId();
- }
-
- /**
- * Returns the state of the layout object.
- *
- * @return the state
- */
- public abstract LayoutItemState getState();
-
- public Serializable getProperty(String name)
- {
- return getState().getProperty(name);
- }
-
- public void setProperty(String name, Serializable value)
- {
- getState().setProperty(name, value);
- }
-}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-/**
- * The context of a layout item that is not exposed.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-class LayoutItemContext
-{
-
- /** . */
- private final LayoutStore store;
-
- /** . */
- private final String id;
-
- /** . */
- private final LayoutItem item;
-
- LayoutItemContext(LayoutStore store, String id, LayoutItem item)
- {
- this.store = store;
- this.id = id;
- this.item = item;
- }
-
- LayoutItem getObject()
- {
- return item;
- }
-
- String getId()
- {
- return id;
- }
-
- void register(LayoutItem item)
- {
- store.register(item);
- }
-}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -1,84 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * A generic state of layout items.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class LayoutItemState
-{
-
- /** The properties. */
- private final Map<String, Serializable> properties;
-
- /** . */
- private final Map<String, Serializable> immutableProperties;
-
- LayoutItemState()
- {
- this.properties = new HashMap<String, Serializable>();
- this.immutableProperties = Collections.unmodifiableMap(properties);
- }
-
- public Map<String, Serializable> getProperties()
- {
- return immutableProperties;
- }
-
- public Serializable getProperty(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- return properties.get(name);
- }
-
- public void setProperty(String name, Serializable value)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (value != null)
- {
- properties.put(name, value);
- }
- else
- {
- properties.remove(name);
- }
- }
-}
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -83,9 +83,4 @@
// Register and contextualize
getContext().register(element);
}
-
- public LayoutElementState getState()
- {
- return state;
- }
}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java 2008-06-27
22:38:06 UTC (rev 11183)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java 2008-06-28
00:22:22 UTC (rev 11184)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class SimpleItem extends LayoutItem
-{
-
- /** . */
- private final String ref;
-
- /** . */
- private final LayoutItemState state;
-
- SimpleItem(String ref)
- {
- this.ref = ref;
- this.state = new LayoutItemState();
- }
-
- public String getRef()
- {
- return ref;
- }
-
- public LayoutItemState getState()
- {
- return state;
- }
-}