[portal-commits] JBoss Portal SVN: r8917 - in branches/UIServer/uiserver/src/main/org/jboss/portal/presentation: impl/model2 and 1 other directories.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Tue Nov 13 18:03:14 EST 2007


Author: sohil.shah at jboss.com
Date: 2007-11-13 18:03:14 -0500 (Tue, 13 Nov 2007)
New Revision: 8917

Added:
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java
Modified:
   branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java
Log:
model implementation

Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java	                        (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java	2007-11-13 23:03:14 UTC (rev 8917)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model2;
+
+import org.jboss.portal.presentation.model2.UIContainer;
+
+/**
+ * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIContainerImpl extends UIObjectImpl implements UIContainer
+{
+
+}

Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java	                        (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java	2007-11-13 23:03:14 UTC (rev 8917)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model2;
+
+import org.jboss.portal.presentation.model2.UIContext;
+import org.jboss.portal.presentation.model2.UIObject;
+
+/**
+ * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIContextImpl extends UIObjectImpl implements UIContext
+{
+   /**
+    * 
+    */
+   public UIObject getObject(String id)
+   {
+      return null;
+   }
+}

Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java	                        (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java	2007-11-13 23:03:14 UTC (rev 8917)
@@ -0,0 +1,211 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model2;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jboss.portal.presentation.model2.UIObject;
+
+/**
+ * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class UIObjectImpl implements UIObject
+{
+   /**
+    * 
+    */
+   protected String id = null;
+   
+   /**
+    * 
+    */
+   protected String name = null;
+   
+   /**
+    * 
+    */
+   protected List<UIObject> children = new ArrayList<UIObject>();
+   
+   /**
+    * 
+    */
+   protected UIObject parent = null;
+   
+   /**
+    * 
+    */
+   public UIObjectImpl()
+   {      
+   }
+   
+   /**
+    * 
+    */
+   public String getId()
+   {
+      return this.id;
+   }
+   
+   /**
+    * 
+    */
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   /**
+    * 
+    */
+   public UIObject getParent()
+   {
+      return this.parent;
+   }
+   
+   /**
+    * 
+    */
+   public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
+   {
+      try
+      {
+         T child = null;
+         
+         if(type == UIContainerImpl.class)
+         {
+            child = type.newInstance();            
+            ((UIContainerImpl)child).name = name;
+            ((UIContainerImpl)child).parent = this;
+            ((UIContainerImpl)child).id = this.generateId(name);
+         }
+         else if(type == UIContextImpl.class)
+         {
+            child = type.newInstance();            
+            ((UIContextImpl)child).name = name;
+            ((UIContextImpl)child).parent = this;
+            ((UIContextImpl)child).id = this.generateId(name);
+         }
+         else if(type == UIPageImpl.class)
+         {
+            child = type.newInstance();            
+            ((UIPageImpl)child).name = name;
+            ((UIPageImpl)child).parent = this;
+            ((UIPageImpl)child).id = this.generateId(name);
+         }
+         else if(type == UIPortalImpl.class)
+         {
+            child = type.newInstance();            
+            ((UIPortalImpl)child).name = name;
+            ((UIPortalImpl)child).parent = this;
+            ((UIPortalImpl)child).id = this.generateId(name);
+         }
+         else if(type == UIWindowImpl.class)
+         {
+            child = type.newInstance();            
+            ((UIWindowImpl)child).name = name;
+            ((UIWindowImpl)child).parent = this;
+            ((UIWindowImpl)child).id = this.generateId(name);
+         }
+         
+         this.children.add(child);
+         return child;
+      }
+      catch(InstantiationException ie)
+      {
+         throw new RuntimeException(ie);
+      }
+      catch(IllegalAccessException iae)
+      {
+         throw new RuntimeException(iae);
+      }
+   }
+
+   /**
+    * 
+    */
+   public void destroyChild(String name)
+   { 
+      if(this.children != null)
+      {
+         for(int i=0; i<this.children.size(); i++)
+         {
+            UIObject child = this.children.get(i);
+            if(child.getName().equals(name))
+            {
+               this.children.remove(child);
+               break;
+            }
+         }
+      }
+   }
+
+   /**
+    * 
+    */
+   public List<UIObject> getChildren()
+   {
+      return this.children;
+   }
+
+   /**
+    * 
+    */
+   public <T extends UIObject> List<UIObject> getChildren(Class<T> type)
+   {
+      List<UIObject> filteredList = new ArrayList<UIObject>();
+      if(this.children != null)
+      {
+         for(int i=0; i<this.children.size(); i++)
+         {
+            UIObject child = this.children.get(i);
+            if(type == child.getClass())
+            {
+               filteredList.add(child);
+            }
+         }
+      }
+      return filteredList;
+   } 
+   
+   /**
+    * 
+    * @return
+    */
+   private String generateId(String childName)
+   {
+      String newId = null;
+      
+      if(this.parent != null)
+      {
+         newId = this.parent.getId() + "/" + this.name + "/" + childName; 
+      }
+      else
+      {
+         newId = this.name + "/" + childName;
+      }
+      
+      return newId;
+   }
+}

Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java	                        (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java	2007-11-13 23:03:14 UTC (rev 8917)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model2;
+
+import org.jboss.portal.presentation.model2.UIPage;
+
+/**
+ * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIPageImpl extends UIObjectImpl implements UIPage
+{   
+}

Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java	                        (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java	2007-11-13 23:03:14 UTC (rev 8917)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model2;
+
+import org.jboss.portal.presentation.model2.UIPortal;
+
+/**
+ * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIPortalImpl extends UIObjectImpl implements UIPortal
+{
+
+}

Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java	                        (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java	2007-11-13 23:03:14 UTC (rev 8917)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model2;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.presentation.model2.UIWindow;
+
+/**
+ * @author <a href="mailto:sshah at redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIWindowImpl extends UIObjectImpl implements UIWindow
+{
+   /**
+    * 
+    */
+   private Mode mode = null;
+   
+   /**
+    * 
+    */
+   private WindowState windowState = null;
+   
+   /**
+    * 
+    */
+   private String title = null;
+   
+   /**
+    * 
+    */
+   public Mode getMode()
+   {      
+      return this.mode;
+   }
+
+   /**
+    * 
+    */
+   public String getTitle()
+   {      
+      return this.title;
+   }
+
+   /**
+    * 
+    */
+   public WindowState getWindowState()
+   {      
+      return this.windowState;
+   }
+
+   /**
+    * 
+    */
+   public void setMode(Mode mode)
+   {
+      this.mode = mode;
+   }
+
+   /**
+    * 
+    */
+   public void setTitle(String title)
+   {      
+      this.title = title;
+   }
+
+   /**
+    * 
+    */
+   public void setWindowState(WindowState windowState)
+   {
+      this.windowState = windowState;
+   }
+}

Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java	2007-11-13 22:07:31 UTC (rev 8916)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java	2007-11-13 23:03:14 UTC (rev 8917)
@@ -30,8 +30,23 @@
  */
 public interface UIObject
 {
-
+   /**
+    * 
+    * @return
+    */
    String getId();
+   
+   /**
+    * 
+    * @return
+    */
+   String getName();
+   
+   /**
+    * 
+    * @return
+    */
+   UIObject getParent();
 
    /**
     * Create a child with a specified type.
@@ -41,12 +56,25 @@
     * @return the newly created child
     * @throws IllegalArgumentException if the name is null, already exists or this kind of object does not accept children of the specified type
     */
-   <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException;
+   <T extends UIObject>T createChild(String name, Class<T> type) throws IllegalArgumentException;
 
+   /**
+    * 
+    * @param name
+    */
    void destroyChild(String name);
 
+   /**
+    * 
+    * @return
+    */
    List<UIObject> getChildren();
 
-   <T extends UIObject> List<T> getChildren(Class<T> type);
-
+   /**
+    * 
+    * @param <T>
+    * @param type
+    * @return
+    */
+   <T extends UIObject> List<UIObject> getChildren(Class<T> type);   
 }




More information about the portal-commits mailing list