Author: sohil.shah(a)jboss.com
Date: 2007-11-13 12:07:24 -0500 (Tue, 13 Nov 2007)
New Revision: 8906
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Portal.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java
Log:
refactoring
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Component.java 2007-11-13
17:07:24 UTC (rev 8906)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import java.io.Serializable;
+
+/**
+ * Component represents a UI entity that will be rendered eventually on the client
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface Component extends Serializable
+{
+ /**
+ *
+ * @return
+ */
+ public String getId();
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(String id);
+
+
+ /**
+ *
+ * @return
+ */
+ public String getMarkup();
+}
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Container.java 2007-11-13
17:07:24 UTC (rev 8906)
@@ -0,0 +1,134 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Container is an organizational entity which aggregates the Components that will be
rendered on the client
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Container implements Serializable
+{
+ /**
+ * required unique id of the container. uniqueness in relation to
+ * other containers added to the same instance of the page
+ */
+ protected String id = null;
+
+
+ /**
+ *
+ */
+ private List components = null;
+
+ /**
+ *
+ *
+ */
+ public Container(String id)
+ {
+ this.id = id;
+ this.components = new ArrayList();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public List getComponents()
+ {
+ return components;
+ }
+
+ /**
+ *
+ * @param components
+ */
+ public void setComponents(List components)
+ {
+ this.components = components;
+ }
+
+ /**
+ *
+ * @param componentId
+ * @return
+ */
+ public Component getComponent(String componentId)
+ {
+ Component component = null;
+
+ if(this.components != null)
+ {
+ for(int i=0;i<this.components.size();i++)
+ {
+ Component cour = (Component)this.components.get(i);
+ if(cour.getId().equals(componentId))
+ {
+ component = cour;
+ break;
+ }
+ }
+ }
+
+ return component;
+ }
+
+ /**
+ *
+ * @param component
+ */
+ public void addComponent(Component component)
+ {
+ if(this.components == null)
+ {
+ this.components = new ArrayList();
+ }
+
+ this.components.add(component);
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Page.java 2007-11-13
17:07:24 UTC (rev 8906)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Page extends PortalObject
+{
+ /**
+ * A page consists of multiple containers that are to be displayed/aggregated along
with their corresponding
+ * UI components
+ */
+ private List containers = null;
+
+ /**
+ * Signifies if this page is currently being displayed on the client
+ */
+ private boolean currentlyDisplayed = false;
+
+ /**
+ *
+ *
+ */
+ public Page()
+ {
+ super();
+ this.containers = new ArrayList();
+ }
+
+ /**
+ *
+ */
+ public String toString()
+ {
+ return "Page: "+super.toString();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getWindows()
+ {
+ List windows = new ArrayList();
+
+ if(this.children != null)
+ {
+ for(Iterator itr=this.children.iterator(); itr.hasNext();)
+ {
+ Object child = itr.next();
+
+ if(child instanceof Window)
+ {
+ windows.add(child);
+ }
+ }
+ }
+
+ return windows;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public List getContainers()
+ {
+ return containers;
+ }
+
+ /**
+ *
+ * @param containers
+ */
+ public void setContainers(List containers)
+ {
+ this.containers = containers;
+ }
+
+ /**
+ *
+ * @param container
+ */
+ public void addContainer(Container container)
+ {
+ this.getContainers().add(container);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public boolean isCurrentlyDisplayed()
+ {
+ return currentlyDisplayed;
+ }
+
+ /**
+ *
+ * @param currentlyDisplayed
+ */
+ public void setCurrentlyDisplayed(boolean currentlyDisplayed)
+ {
+ this.currentlyDisplayed = currentlyDisplayed;
+ }
+}
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Portal.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Portal.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Portal.java 2007-11-13
17:07:24 UTC (rev 8906)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Portal extends PortalObject
+{
+ /**
+ *
+ */
+ public String toString()
+ {
+ return "Portal: "+super.toString();
+ }
+}
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java
===================================================================
---
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/PortalObject.java 2007-11-13
17:07:24 UTC (rev 8906)
@@ -0,0 +1,212 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class PortalObject implements Serializable
+{
+ protected String id = null;
+ protected String name = null;
+ protected PortalObject parent = null;
+ protected Collection children = null;
+ protected Map properties = null;
+
+ /**
+ *
+ *
+ */
+ public PortalObject()
+ {
+ this.children = new ArrayList();
+ this.properties = new HashMap(5);
+ }
+
+ /**
+ *
+ * @param id
+ * @param name
+ * @param parent
+ * @param children
+ */
+ public PortalObject(String id, String name, PortalObject parent, Collection children)
+ {
+ this.id = id;
+ this.name = name;
+ this.parent = parent;
+ this.children = children;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getId()
+ {
+ return id;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public PortalObject getParent()
+ {
+ return parent;
+ }
+
+ /**
+ *
+ * @param parent
+ */
+ public void setParent(PortalObject parent)
+ {
+ this.parent = parent;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Collection getChildren()
+ {
+ if(this.children == null)
+ {
+ this.children = new ArrayList();
+ }
+ return children;
+ }
+
+ /**
+ *
+ * @param children
+ */
+ public void setChildren(Collection children)
+ {
+ this.children = children;
+ }
+
+ /**
+ * Recursively traverses the Portal Object's children tree to find a child
registered with the
+ * specified id
+ *
+ * @param id
+ * @return
+ */
+ public PortalObject findChild(String id)
+ {
+ PortalObject child = null;
+
+ for(Iterator itr=this.children.iterator(); itr.hasNext();)
+ {
+ PortalObject cour = (PortalObject)itr.next();
+ if(cour.id.equals(id))
+ {
+ child = cour;
+ }
+ else
+ {
+ child = cour.findChild(id);
+ }
+
+ if(child != null)
+ {
+ return child;
+ }
+ }
+
+ return child;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map getProperties()
+ {
+ return properties;
+ }
+
+ /**
+ *
+ * @param properties
+ */
+ public void setProperties(Map properties)
+ {
+ this.properties = properties;
+ }
+
+ /**
+ *
+ */
+ public String toString()
+ {
+ String rep = null;
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("[");
+ buffer.append("id="+this.id+",");
+ buffer.append("name="+this.name);
+ buffer.append("]");
+
+ rep = buffer.toString();
+
+ return rep;
+ }
+}
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java
(rev 0)
+++
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/Window.java 2007-11-13
17:07:24 UTC (rev 8906)
@@ -0,0 +1,240 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class Window extends PortalObject implements Component
+{
+ /**
+ * Title for this Window
+ */
+ private String title = null;
+
+ /**
+ * Content/Markup to be displayed inside this Window
+ */
+ private String content = null;
+
+ /**
+ * Content/Markup related to the header of this Window
+ */
+ private final String headerContent;
+
+ /**
+ * The State of this Window such as Normal, Maximized, Minimized etc
+ */
+ private final WindowState windowState;
+
+ /**
+ * The Mode of this Window such as View, Edit, Help etc
+ */
+ private final Mode mode;
+
+ /**
+ * Runtime View related meta data associated with this particular window.
+ *
+ * The meta data is provided in the form of Name/Value pairs with Name being the key
of the and Value being the Value
+ * of a Map entry
+ */
+ private Map viewMetaData = null;
+
+
+ /**
+ *
+ *
+ */
+ public Window()
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+ /**
+ *
+ *
+ */
+ public Window(String id,String title, String content, String headerContent,
WindowState windowState, Mode mode)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.title = title;
+ this.content = content;
+ this.headerContent = headerContent;
+ this.windowState = windowState;
+ this.mode = mode;
+ }
+
+ /**
+ *
+ * @param id
+ * @param content
+ */
+ public Window(String id, String content)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.content = content;
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+ /**
+ *
+ * @param id
+ * @param content
+ */
+ public Window(String id)
+ {
+ super();
+ this.viewMetaData = new HashMap(5);
+ this.id = id;
+ this.headerContent = null;
+ this.windowState = null;
+ this.mode = null;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getContent()
+ {
+ return content;
+ }
+
+
+ /**
+ *
+ * @param content
+ */
+ public void setContent(String content)
+ {
+ this.content = content;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getHeaderContent()
+ {
+ return headerContent;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+
+ /**
+ *
+ * @param title
+ */
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+
+ /**
+ *
+ */
+ public String toString()
+ {
+ return "Window: "+super.toString();
+ }
+
+ /**
+ *
+ */
+ public String getMarkup()
+ {
+ String markup = "";
+
+ markup = this.content;
+
+ return markup;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Map getViewMetaData()
+ {
+ return viewMetaData;
+ }
+
+ /**
+ *
+ * @param viewMetaData
+ */
+ public void setViewMetaData(Map viewMetaData)
+ {
+ this.viewMetaData = viewMetaData;
+ }
+}