From portal-commits at lists.jboss.org Tue Nov 13 12:07:25 2007 Content-Type: multipart/mixed; boundary="===============1587587263754722226==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r8906 - in branches/UIServer/uiserver/src/main/org/jboss/portal/presentation: model and 1 other directory. Date: Tue, 13 Nov 2007 12:07:25 -0500 Message-ID: --===============1587587263754722226== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/mo= del/Component.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 th= e client + * = + * @author Sohil Shah + * + */ +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/mo= del/Container.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 t= hat will be rendered on the client + * = + * @author Sohil Shah + * + */ +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 =3D null; + = + = + /** + * = + */ + private List components =3D null; + = + /** + * = + * + */ + public Container(String id) + { + this.id =3D id; + this.components =3D new ArrayList(); + } + = + /** + * = + * @return + */ + public String getId() + { + return id; + } + + /** + * = + * @param id + */ + public void setId(String id) + { + this.id =3D id; + } + + = + /** + * = + * @return + */ + public List getComponents() + { + return components; + } + + /** + * = + * @param components + */ + public void setComponents(List components) + { + this.components =3D components; + } = + = + /** + * = + * @param componentId + * @return + */ + public Component getComponent(String componentId) + { + Component component =3D null; + = + if(this.components !=3D null) + { + for(int i=3D0;iSohil Shah + * + */ +public class Page extends PortalObject +{ + /** + * A page consists of multiple containers that are to be displayed/aggr= egated along with their corresponding + * UI components + */ + private List containers =3D null; + = + /** + * Signifies if this page is currently being displayed on the client + */ + private boolean currentlyDisplayed =3D false; + = + /** + * = + * + */ + public Page() + { + super(); + this.containers =3D new ArrayList(); + } + = + /** + * = + */ + public String toString() + { + return "Page: "+super.toString(); + } + = + /** + * = + * @return + */ + public List getWindows() + { + List windows =3D new ArrayList(); + = + if(this.children !=3D null) + { + for(Iterator itr=3Dthis.children.iterator(); itr.hasNext();) + { + Object child =3D 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 =3D 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 =3D currentlyDisplayed; + } +} Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/mo= del/Portal.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Sohil Shah + * + */ +public class Portal extends PortalObject +{ + /** + * = + */ + public String toString() + { + return "Portal: "+super.toString(); + } +} Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/mo= del/PortalObject.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Sohil Shah + * + */ +public abstract class PortalObject implements Serializable +{ + protected String id =3D null; + protected String name =3D null; + protected PortalObject parent =3D null; + protected Collection children =3D null; + protected Map properties =3D null; + = + /** + * = + * + */ + public PortalObject() + { + this.children =3D new ArrayList(); + this.properties =3D new HashMap(5); + } + = + /** + * = + * @param id + * @param name + * @param parent + * @param children + */ + public PortalObject(String id, String name, PortalObject parent, Collec= tion children) + { + this.id =3D id; + this.name =3D name; + this.parent =3D parent; + this.children =3D children; + } + + /** + * = + * @return + */ + public String getId() + { + return id; + } + + /** + * = + * @param id + */ + public void setId(String id) + { + this.id =3D id; + } + + /** + * = + * @return + */ + public String getName() + { + return name; + } + + /** + * = + * @param name + */ + public void setName(String name) + { + this.name =3D name; + } + = + /** + * = + * @return + */ + public PortalObject getParent() + { + return parent; + } + + /** + * = + * @param parent + */ + public void setParent(PortalObject parent) + { + this.parent =3D parent; + } + + /** + * = + * @return + */ + public Collection getChildren() + { + if(this.children =3D=3D null) + { + this.children =3D new ArrayList(); + } + return children; + } + + /** + * = + * @param children + */ + public void setChildren(Collection children) + { + this.children =3D children; + } = + = + /** + * Recursively traverses the Portal Object's children tree to find a ch= ild registered with the + * specified id + * = + * @param id + * @return + */ + public PortalObject findChild(String id) + { + PortalObject child =3D null; + = + for(Iterator itr=3Dthis.children.iterator(); itr.hasNext();) + { + PortalObject cour =3D (PortalObject)itr.next(); + if(cour.id.equals(id)) + { + child =3D cour; + } + else + { + child =3D cour.findChild(id); + } + = + if(child !=3D null) + { + return child; + } + } + = + return child; + } + = + /** + * = + * @return + */ = + public Map getProperties() + { + return properties; + } + + /** + * = + * @param properties + */ + public void setProperties(Map properties) + { + this.properties =3D properties; + } + + /** + * = + */ + public String toString() + { + String rep =3D null; + = + StringBuffer buffer =3D new StringBuffer(); + buffer.append("["); + buffer.append("id=3D"+this.id+","); + buffer.append("name=3D"+this.name); + buffer.append("]"); + = + rep =3D buffer.toString(); + = + return rep; + } +} Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/mo= del/Window.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Sohil Shah + * + */ +public class Window extends PortalObject implements Component +{ + /** + * Title for this Window + */ + private String title =3D null; + + /** + * Content/Markup to be displayed inside this Window + */ + private String content =3D 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 windo= w. + * = + * 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 =3D null; + = + = + /** + * = + * + */ + public Window() + { + super(); + this.viewMetaData =3D new HashMap(5); + this.headerContent =3D null; + this.windowState =3D null; + this.mode =3D null; + } + = + /** + * = + * + */ + public Window(String id,String title, String content, String headerCont= ent, WindowState windowState, Mode mode) + { + super(); + this.viewMetaData =3D new HashMap(5); + this.id =3D id; + this.title =3D title; + this.content =3D content; + this.headerContent =3D headerContent; + this.windowState =3D windowState; + this.mode =3D mode; + } + = + /** + * = + * @param id + * @param content + */ + public Window(String id, String content) + { + super(); + this.viewMetaData =3D new HashMap(5); + this.id =3D id; + this.content =3D content; + this.headerContent =3D null; + this.windowState =3D null; + this.mode =3D null; + } + = + /** + * = + * @param id + * @param content + */ + public Window(String id) + { + super(); + this.viewMetaData =3D new HashMap(5); + this.id =3D id; = + this.headerContent =3D null; + this.windowState =3D null; + this.mode =3D null; + } + = + = + /** + * = + * @return + */ + public String getContent() + { + return content; + } + + = + /** + * = + * @param content + */ + public void setContent(String content) + { + this.content =3D 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 =3D title; + } + + + /** + * = + * @return + */ + public WindowState getWindowState() + { + return windowState; + } + + + /** + * = + */ + public String toString() + { + return "Window: "+super.toString(); + } + = + /** + * = + */ + public String getMarkup() + { + String markup =3D ""; + = + markup =3D this.content; + = + return markup; + } + + /** + * = + * @return + */ + public Map getViewMetaData() + { + return viewMetaData; + } + + /** + * = + * @param viewMetaData + */ + public void setViewMetaData(Map viewMetaData) + { + this.viewMetaData =3D viewMetaData; + } +} --===============1587587263754722226==--