From portal-commits at lists.jboss.org Mon Nov 26 06:38:38 2007 Content-Type: multipart/mixed; boundary="===============1553827622411087265==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r9103 - in branches/presentation/presentation/src/main/org/jboss/portal/presentation: model and 1 other directory. Date: Mon, 26 Nov 2007 06:38:35 -0500 Message-ID: --===============1553827622411087265== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2007-11-26 06:38:33 -0500 (Mon, 26 Nov 2007) New Revision: 9103 Removed: branches/presentation/presentation/src/main/org/jboss/portal/presentatio= n/model/StateScope.java Modified: branches/presentation/presentation/src/main/org/jboss/portal/presentatio= n/impl/model/UIObjectImpl.java branches/presentation/presentation/src/main/org/jboss/portal/presentatio= n/model/StateScopeType.java Log: kind of implement property access on ui objects Modified: branches/presentation/presentation/src/main/org/jboss/portal/pres= entation/impl/model/UIObjectImpl.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/presentation/presentation/src/main/org/jboss/portal/presentati= on/impl/model/UIObjectImpl.java 2007-11-26 11:24:36 UTC (rev 9102) +++ branches/presentation/presentation/src/main/org/jboss/portal/presentati= on/impl/model/UIObjectImpl.java 2007-11-26 11:38:33 UTC (rev 9103) @@ -22,13 +22,14 @@ *************************************************************************= *****/ package org.jboss.portal.presentation.impl.model; = -import org.jboss.portal.common.NotYetImplemented; import org.jboss.portal.presentation.model.StateScopeType; import org.jboss.portal.presentation.model.UIObject; import org.jboss.portal.presentation.model.state.ObjectState; = import java.io.Serializable; import java.util.List; +import java.util.Map; +import java.util.HashMap; = /** * @author Sohil Shah @@ -46,16 +47,6 @@ * = */ protected final String id; - = - /** - * = - */ - protected final String name; - = - /** - * - */ - protected final String parentId; = /** * @@ -67,31 +58,34 @@ */ private final ObjectState state; = - = /** * */ + private final Map transientState; + + /** + * + */ + private final Map navigationalState; + public UIObjectImpl(UIContextImpl context, String id, ObjectState state) { this.id =3D id; this.state =3D state; - this.parentId =3D state.getParentId(); - this.name =3D state.getName(); = this.context =3D context; this.children =3D new UIObjectList(this.context, state.getChildrenId= s()); + this.transientState =3D new HashMap(); + this.navigationalState =3D new HashMap(); } = - /** - * - */ public UIObjectImpl(String id, ObjectState state) { this.id =3D id; this.state =3D state; - this.parentId =3D state.getParentId(); - this.name =3D state.getName(); = this.context =3D (UIContextImpl)this; this.children =3D new UIObjectList(this.context, state.getChildrenId= s()); + this.transientState =3D new HashMap(); + this.navigationalState =3D new HashMap(); } = //UIObject interface implementation------------------------------------= ---------------------------------------------------------------------------= -------------- @@ -105,7 +99,17 @@ = public String getProperty(StateScopeType scopeType, String propertyName) { - throw new NotYetImplemented("Just a place holder for now"); + switch (scopeType) + { + case TRANSIENT: + return transientState.get(propertyName); + case NAVIGATIONAL: + return navigationalState.get(propertyName); + case PERSISTENT: + return state.getProperties().get(propertyName); + default: + throw new AssertionError(); + } } = public UIObject getChild(String name) @@ -125,7 +129,7 @@ */ public String getName() { - return this.name; + return state.getName(); } = /** @@ -133,7 +137,7 @@ */ public UIObject getParent() { - return parentId !=3D null ? context.getObject(parentId) : null; + return state.getParentId() !=3D null ? context.getObject(state.getPa= rentId()) : null; } = /** @@ -177,12 +181,6 @@ throw new UnsupportedOperationException("todo"); } = = - /** - * = - * @param - * @param type - * @return - */ protected abstract boolean isAllowedAsChild(Class<= T> type); = = Deleted: branches/presentation/presentation/src/main/org/jboss/portal/prese= ntation/model/StateScope.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/presentation/presentation/src/main/org/jboss/portal/presentati= on/model/StateScope.java 2007-11-26 11:24:36 UTC (rev 9102) +++ branches/presentation/presentation/src/main/org/jboss/portal/presentati= on/model/StateScope.java 2007-11-26 11:38:33 UTC (rev 9103) @@ -1,45 +0,0 @@ -/*************************************************************************= ***** - * 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 Julien Viet - * @version $Revision: 1.1 $ - */ -public enum StateScope -{ - /** - * The content scope. = - */ - CONTENT, - - /** - * The navigational scope. - */ - NAVIGATIONAL, - - /** - * The server scope. - */ - SERVER -} Modified: branches/presentation/presentation/src/main/org/jboss/portal/pres= entation/model/StateScopeType.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/presentation/presentation/src/main/org/jboss/portal/presentati= on/model/StateScopeType.java 2007-11-26 11:24:36 UTC (rev 9102) +++ branches/presentation/presentation/src/main/org/jboss/portal/presentati= on/model/StateScopeType.java 2007-11-26 11:38:33 UTC (rev 9103) @@ -29,17 +29,17 @@ public enum StateScopeType { /** - * The content scope. = + * The transient scope type. = */ - CONTENT, + TRANSIENT, = /** - * The navigational scope. + * The navigational scope type. */ NAVIGATIONAL, = /** - * The server scope. + * The persistent scope type. */ - SERVER + PERSISTENT } --===============1553827622411087265==--