You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2008/09/16 16:31:05 UTC

svn commit: r695904 [1/2] - in /labs/magma/trunk/foundation-beans-view: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/magma/ src/main/java/org/apache/magma/view/ src/main/java/org/apache/magma/vi...

Author: simoneg
Date: Tue Sep 16 07:31:00 2008
New Revision: 695904

URL: http://svn.apache.org/viewvc?rev=695904&view=rev
Log:
Initial import.

Added:
    labs/magma/trunk/foundation-beans-view/pom.xml
    labs/magma/trunk/foundation-beans-view/src/
    labs/magma/trunk/foundation-beans-view/src/main/
    labs/magma/trunk/foundation-beans-view/src/main/java/
    labs/magma/trunk/foundation-beans-view/src/main/java/org/
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddToUserToBeans.aj
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewSettingsToPropertyInfo.aj
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewTreeToBeanData.aj
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/After.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Before.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListAfter.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListBefore.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListOrder.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Listed.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Order.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalConstraint.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalSetting.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Side.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/View.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ViewSettings.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Zone.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ZoneSetting.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ContainerProperty.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/FieldNode.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/HiddenNode.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/LabelNode.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Node.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/NullViewCustomizer.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/PropertyNode.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/SimpleViewFilter.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewCustomizer.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewUtils.java
    labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Zone.java
    labs/magma/trunk/foundation-beans-view/src/test/
    labs/magma/trunk/foundation-beans-view/src/test/java/
    labs/magma/trunk/foundation-beans-view/src/test/java/org/
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/BeanViewListTreeTest.java
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/BeanViewTreeTest.java
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/InBeanViewSettingsTest.java
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/ToUserTest.java
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/ViewBean.java
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/tree/
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/tree/CreatingTreeTest.java
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/tree/DeCamelCaseTest.java
    labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/tree/ZoneTest.java

Added: labs/magma/trunk/foundation-beans-view/pom.xml
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/pom.xml?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/pom.xml (added)
+++ labs/magma/trunk/foundation-beans-view/pom.xml Tue Sep 16 07:31:00 2008
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<parent>
+	  <groupId>org.apache.magma</groupId>
+	  <artifactId>magma-parent</artifactId>
+	  <version>1</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.apache.magma</groupId>
+	<artifactId>foundation-beans-view</artifactId>
+	<name>Foundation View</name>
+	<packaging>magma</packaging>
+	<version>0.0.1-SNAPSHOT</version>
+	<description>
+		Provides foundation functions and classes to achieve view
+	</description>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.magma</groupId>
+			<artifactId>foundation-beans</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.4</version>
+			<scope>test</scope>
+		</dependency>
+	  <dependency>
+      <groupId>org.apache.magma</groupId>
+      <artifactId>foundation-conversion</artifactId>
+      <version>0.0.1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.magma.tools</groupId>
+				<artifactId>maven-magma-plugin</artifactId>
+				<extensions>true</extensions>
+			</plugin>
+		</plugins>
+	</build>
+</project>

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddToUserToBeans.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddToUserToBeans.aj?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddToUserToBeans.aj (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddToUserToBeans.aj Tue Sep 16 07:31:00 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.magma.beans.BeanData;
+import org.apache.magma.beans.MagmaBeanSupport;
+import org.apache.magma.conversion.Converter;
+import org.apache.magma.conversion.Converters;
+import org.apache.magma.view.tree.FieldNode;
+import org.apache.magma.view.tree.Node;
+import org.apache.magma.view.tree.ViewUtils;
+import org.apache.magma.view.tree.Zone;
+
+public aspect AddToUserToBeans {
+
+	public List<FieldNode> BeanData.toUserNodes = null;
+	
+	public String MagmaBeanSupport.toUser() {
+		BeanData b = this.beanData();
+		if (b.toUserNodes == null) {
+			Node node = b.getViewTree();
+			Zone zone = node.getZone(Side.Bottom);
+			List<Node> nodes = zone.getNodes();
+			List<FieldNode> fldnodes = new ArrayList<FieldNode>();
+			for (Node acnode : nodes) {
+				if (acnode instanceof FieldNode) {
+					fldnodes.add((FieldNode)acnode);
+					if (fldnodes.size() >= 3) break;
+				}
+			}
+			b.toUserNodes = fldnodes;
+		}
+		if (b.toUserNodes.size() > 0) {
+			StringBuffer ret = new StringBuffer();
+			for (FieldNode fieldNode : b.toUserNodes) {
+				ret.append(ViewUtils.getStringNodeValue(fieldNode, this));
+				ret.append(" ");
+			}
+			return ret.toString();
+		}
+		Converter converter = Converters.getConverterFor(this.getClass());
+		if (converter != null) {
+			return converter.toString(this);
+		}
+		return this.toString();
+	}
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewSettingsToPropertyInfo.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewSettingsToPropertyInfo.aj?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewSettingsToPropertyInfo.aj (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewSettingsToPropertyInfo.aj Tue Sep 16 07:31:00 2008
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import org.apache.magma.beans.PropertyInfo;
+import org.apache.magma.view.tree.ViewUtils;
+
+import java.beans.PropertyDescriptor;
+
+public aspect AddViewSettingsToPropertyInfo {
+	
+	private ViewSettings PropertyInfo.viewSettings = null;
+	private ViewSettings PropertyInfo.viewListSettings = null;
+
+	public ViewSettings PropertyInfo.getViewSettings() {
+		return this.viewSettings;
+	}	
+	public ViewSettings PropertyInfo.getViewListSettings() {
+		return this.viewListSettings;
+	}	
+	
+	after(PropertyInfo info, PropertyDescriptor desc) : 
+		execution(* PropertyInfo.init(PropertyDescriptor, Class)) && target(info) && args(desc,..) {
+		info.viewSettings = ViewUtils.createSettings(desc.getReadMethod());
+		if (info.viewSettings != null) {
+			String aclab = info.viewSettings.getLabel();
+			if (aclab != null && aclab.equals("__NS__")) info.viewSettings.setLabel(ViewUtils.getLabelFromName(info.getName()));
+		}
+		info.viewListSettings = ViewUtils.createListSettings(desc.getReadMethod(), info.viewSettings);
+		if (info.viewListSettings != null) {
+			String aclab = info.viewListSettings.getLabel();
+			if (aclab != null && aclab.equals("__NS__")) {
+				if (info.viewSettings != null) {
+					info.viewListSettings.setLabel(info.viewSettings.getLabel());
+				} else {
+					info.viewListSettings.setLabel(ViewUtils.getLabelFromName(info.getName()));
+				}
+			}
+		}
+	}
+
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewTreeToBeanData.aj
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewTreeToBeanData.aj?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewTreeToBeanData.aj (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/AddViewTreeToBeanData.aj Tue Sep 16 07:31:00 2008
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.ref.SoftReference;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.WeakHashMap;
+
+import org.apache.magma.view.tree.Node;
+import org.apache.magma.view.tree.NullViewCustomizer;
+import org.apache.magma.view.tree.ViewCustomizer;
+import org.apache.magma.view.tree.ViewUtils;
+import org.apache.magma.beans.BeanData;
+
+public aspect AddViewTreeToBeanData {
+
+	private Map<ViewCustomizer, Node> BeanData.viewTree = new WeakHashMap<ViewCustomizer, Node>();
+	private Map<ViewCustomizer, Node> BeanData.viewListTree = new WeakHashMap<ViewCustomizer, Node>();
+	
+	public Node BeanData.getViewTree() {
+		return getViewTree(null);
+	}
+	
+	public Node BeanData.getViewTree(ViewCustomizer filter) {
+		if (filter == null) filter = NullViewCustomizer.instance();
+		Node ret = viewTree.get(filter);
+		if (ret == null) {
+			ret = ViewUtils.createTree(this, filter);
+			viewTree.put(filter, ret);
+		}
+		return ret;
+	}
+
+	public Node BeanData.getViewListTree() {
+		return getViewListTree(null);
+	}
+	
+	public Node BeanData.getViewListTree(ViewCustomizer filter) {
+		if (filter == null) filter = NullViewCustomizer.instance();
+		Node ret = viewListTree.get(filter);
+		if (ret == null) {
+			ret = ViewUtils.createListTree(this, filter);
+			viewListTree.put(filter, ret);
+		}
+		return ret;
+	}
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/After.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/After.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/After.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/After.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface After {
+	public String value();	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Before.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Before.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Before.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Before.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Before {
+
+	public String value();
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListAfter.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListAfter.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListAfter.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListAfter.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ListAfter {
+	public String value();	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListBefore.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListBefore.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListBefore.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListBefore.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ListBefore {
+
+	public String value();
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListOrder.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListOrder.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListOrder.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ListOrder.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ListOrder {
+	public float value();
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Listed.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Listed.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Listed.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Listed.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Listed {
+
+	String label() default "__NS__";
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Order.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Order.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Order.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Order.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Order {
+	public float value();
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalConstraint.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalConstraint.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalConstraint.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalConstraint.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+public class OrdinalConstraint {
+
+	private boolean before = false;
+	private String of = null;
+	
+	public OrdinalConstraint(boolean before, String of) {
+		super();
+		this.before = before;
+		this.of = of;
+	}
+	public OrdinalConstraint(OrdinalConstraint other) {
+		this(other.before, other.of);
+	}
+	public boolean isBefore() {
+		return before;
+	}
+	public void setBefore(boolean before) {
+		this.before = before;
+	}
+	public String getOf() {
+		return of;
+	}
+	public void setOf(String value) {
+		this.of = value;
+	}
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalSetting.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalSetting.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalSetting.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/OrdinalSetting.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class OrdinalSetting {
+
+	private float order = -1;
+	private List<OrdinalConstraint> contraints = new ArrayList<OrdinalConstraint>();
+	
+	public OrdinalSetting() {}
+	
+	public OrdinalSetting(OrdinalSetting other) {
+		this.order = other.order;
+		if (other.contraints.size() > 0) {
+			for (OrdinalConstraint othconst : other.contraints) {
+				this.contraints.add(new OrdinalConstraint(othconst));
+			}
+		}
+	}
+	public float getOrder() {
+		return order;
+	}
+	public void setOrder(float order) {
+		this.order = order;
+	}
+	
+	public void addConstraint(OrdinalConstraint constraint) {
+		this.contraints.add(constraint);
+	}
+	
+	public void removeConstraint(OrdinalConstraint constraint) {
+		this.contraints.remove(constraint);
+	}
+	
+	public List<OrdinalConstraint> getConstraints() {
+		return Collections.unmodifiableList(this.contraints);
+	}
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Side.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Side.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Side.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Side.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * 
+ */
+package org.apache.magma.view;
+
+public enum Side {
+	Top,
+	Bottom,
+	InsideLeft,
+	OutsideLeft,
+	InsideRight,
+	OutsideRight
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/View.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/View.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/View.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/View.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface View {
+
+	String label() default "__NS__";
+	String tip() default "__NS__";
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ViewSettings.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ViewSettings.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ViewSettings.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ViewSettings.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+public class ViewSettings {
+
+	private String label = null;
+	private String tip = null;
+	
+	private ZoneSetting zone = null;
+	private OrdinalSetting ordinal = null;
+	
+	public ViewSettings() {}
+	
+	public ViewSettings(ViewSettings other) {
+		if (other == null) return;
+		this.label = other.label;
+		this.tip = other.tip;
+		if (other.zone != null) {
+			this.zone = new ZoneSetting(other.zone);
+		}
+		if (other.ordinal != null) {
+			this.ordinal = new OrdinalSetting(other.ordinal);
+		}
+	}
+	public String getLabel() {
+		return label;
+	}
+	public void setLabel(String label) {
+		this.label = label;
+	}
+	public String getTip() {
+		return tip;
+	}
+	public void setTip(String tip) {
+		this.tip = tip;
+	}
+	public ZoneSetting getZone() {
+		return zone;
+	}
+	public void setZone(ZoneSetting zone) {
+		this.zone = zone;
+	}
+	public OrdinalSetting getOrdinal() {
+		return ordinal;
+	}
+	public void setOrdinal(OrdinalSetting ordinal) {
+		this.ordinal = ordinal;
+	}
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Zone.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Zone.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Zone.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/Zone.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Zone {
+
+	public Side side();
+	public String of();
+	public boolean shared() default false;
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ZoneSetting.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ZoneSetting.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ZoneSetting.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/ZoneSetting.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+public class ZoneSetting {
+	
+	private Side side;
+	private boolean shared;
+	private String of;
+	
+	public ZoneSetting() {}
+	
+	public ZoneSetting(ZoneSetting other) {
+		this.side = other.side;
+		this.shared = other.shared;
+		this.of = other.of;
+	}
+	public Side getSide() {
+		return side;
+	}
+	public void setSide(Side position) {
+		this.side = position;
+	}
+	public boolean isShared() {
+		return shared;
+	}
+	public void setShared(boolean shared) {
+		this.shared = shared;
+	}
+	public String getOf() {
+		return of;
+	}
+	public void setOf(String othid) {
+		this.of = othid;
+	}
+	
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ContainerProperty.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ContainerProperty.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ContainerProperty.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ContainerProperty.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.beans.PropertyInfo;
+import org.apache.magma.view.ViewSettings;
+
+public class ContainerProperty extends PropertyNode {
+
+	public ContainerProperty(PropertyInfo prop, ViewSettings settings) {
+		super(prop, "", settings);
+	}
+
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/FieldNode.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/FieldNode.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/FieldNode.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/FieldNode.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.beans.PropertyInfo;
+
+public class FieldNode extends PropertyNode {
+
+	public FieldNode(PropertyInfo property) {
+		super(property, "", property.getViewSettings());
+	}
+
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/HiddenNode.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/HiddenNode.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/HiddenNode.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/HiddenNode.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.beans.PropertyInfo;
+import org.apache.magma.view.Side;
+import org.apache.magma.view.ZoneSetting;
+
+public class HiddenNode extends PropertyNode {
+
+	public HiddenNode(PropertyInfo prop) {
+		super(prop, "");
+	}
+
+	@Override
+	public boolean addSubnode(Node node) {
+		ZoneSetting zoneSet = node.getZoneSettings();
+		if (zoneSet != null) {
+			String of = zoneSet.getOf();
+			if (of != null) {
+				if (of.equals(getId())) {
+					Side side = zoneSet.getSide();
+					if (side != null) {
+						if (!(side.equals(Side.OutsideLeft) || side.equals(Side.OutsideRight))) {
+							return true;
+						}
+					}
+				}
+			}
+		}
+		return super.addSubnode(node);
+	}
+	
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/LabelNode.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/LabelNode.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/LabelNode.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/LabelNode.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.beans.PropertyInfo;
+import org.apache.magma.view.ViewSettings;
+
+public class LabelNode extends PropertyNode {
+
+	public LabelNode(PropertyInfo prop, ViewSettings settings) {
+		super(prop, "-label", settings);
+	}
+	
+	public String getCorrespondingFieldId() {
+		String othid = this.getId();
+		return othid.substring(0, othid.length() - 6);
+	}
+
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Node.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Node.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Node.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Node.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.view.OrdinalSetting;
+import org.apache.magma.view.Side;
+import org.apache.magma.view.ViewSettings;
+import org.apache.magma.view.ZoneSetting;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class Node {
+
+	protected OrdinalSetting ordinal;
+	protected ZoneSetting zone;
+	protected float givenOrdinal = -1;
+	protected boolean validated = false;
+	
+	protected String id;
+	protected Map<Side, Zone> zones = new HashMap<Side, Zone>();
+	protected Zone parent = null;
+	
+	public Node(String id) {
+		this.id = id;
+	}
+	
+	public Node(String id, ViewSettings settings) {
+		this(id);
+		if (settings != null) {
+			this.ordinal = settings.getOrdinal();
+			if (ordinal != null) {
+				this.givenOrdinal = ordinal.getOrder();
+			}
+			this.zone = settings.getZone();
+		}
+	}
+
+	public boolean addSubnode(Node node) {
+		ZoneSetting zoneSet = node.getZoneSettings();
+		if (zoneSet == null) {
+			zoneSet = new ZoneSetting();
+			zoneSet.setSide(Side.Bottom);
+		}
+		String of = zoneSet.getOf();
+		if (of != null) {
+			if (!of.equals(getId())) {
+				Node okparent = findById(of);
+				if (okparent == null) return false;
+				return okparent.addSubnode(node);
+			}
+		}
+		Zone zone = zones.get(zoneSet.getSide());
+		if (zone == null) {
+			zone = new Zone(zoneSet.getSide(), this);
+			zones.put(zoneSet.getSide(), zone);
+		}
+		zone.addNode(node);
+		return true;
+	}
+	
+	void addZone(Zone zone) {
+		this.zones.put(zone.getSide(), zone);
+	}
+
+	ZoneSetting getZoneSettings() {
+		return this.zone;
+	}
+
+	public Zone getZone(Side side) {
+		return zones.get(side);
+	}
+
+	public String getId() {
+		return this.id;
+	}
+	
+	public Node findById(String id) {
+		if (getId().equals(id)) return this;
+		for (Side side : zones.keySet()) {
+			Zone zone = zones.get(side);
+			if (zone == null) continue;
+			Node found = zone.findById(id);
+			if (found != null) return found;
+		}
+		return null;
+	}
+
+	float getGivenOrdinal() {
+		return givenOrdinal;
+	}
+
+	void setGivenOrdinal(float givenOrdinal) {
+		this.givenOrdinal = givenOrdinal;
+	}
+
+	OrdinalSetting getOrdinal() {
+		return ordinal;
+	}
+	
+	public void validate() {
+		if (this.validated) return;
+		for (Zone zone : this.zones.values()) {
+			zone.validate();
+		}
+		this.validated = true;
+	}
+	
+	void invalidate() {
+		if (!this.validated) return;
+		this.validated = false;
+		if (this.parent != null) this.parent.invalidate();
+	}
+	
+	void setParent(Zone parent) {
+		this.parent = parent;
+	}
+	
+	@Override
+	public String toString() {
+		return getId() + " (" + this.givenOrdinal + ")";
+	}
+	
+	public boolean hasInsideZones() {
+		return this.zones.containsKey(Side.InsideLeft) ||
+		this.zones.containsKey(Side.InsideRight) ||
+		this.zones.containsKey(Side.Top) ||
+		this.zones.containsKey(Side.Bottom);
+	}
+	public boolean hasOutsideZones() {
+		return this.zones.containsKey(Side.OutsideLeft) ||
+		this.zones.containsKey(Side.OutsideRight);
+	}
+	
+	
+	public boolean hasSingleZone() {
+		return this.zones.size() == 1;
+	}
+
+	public Zone getUniqueZone() {
+		return this.zones.values().iterator().next();
+	}
+
+	public void setLogicalParent(Node parent) {
+		this.id = parent.getId() + "-" + this.id;
+		for (Zone zone : this.zones.values()) {
+			zone.setLogicalParent(parent);
+		}
+	}
+	
+	public Set<Node> getAllNodes() {
+		Set<Node> ret = new HashSet<Node>();
+		fillAllNodes(ret);
+		return ret;
+	}
+
+	private void fillAllNodes(Set<Node> ret) {
+		ret.add(this);
+		for (Zone zone : this.zones.values()) {
+			List<Node> nodes = zone.getNodes();
+			for (Node node : nodes) {
+				node.fillAllNodes(ret);
+			}
+		}
+	}
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/NullViewCustomizer.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/NullViewCustomizer.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/NullViewCustomizer.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/NullViewCustomizer.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+public class NullViewCustomizer implements ViewCustomizer {
+
+	private static final NullViewCustomizer instance = new NullViewCustomizer();
+	
+	private NullViewCustomizer() {
+	}
+	
+	public static NullViewCustomizer instance() {
+		return instance;
+	}
+	
+	public boolean expand(Node parent, Node node) {
+		return false;
+	}
+
+	public boolean hide(Node parent, Node node) {
+		return false;
+	}
+
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/PropertyNode.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/PropertyNode.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/PropertyNode.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/PropertyNode.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.magma.beans.PropertyInfo;
+import org.apache.magma.view.ViewSettings;
+
+public class PropertyNode extends Node {
+
+	
+	protected List<PropertyInfo> logicalParents = null;
+	protected PropertyInfo property = null;
+	
+	public PropertyNode(PropertyInfo prop, String suffix) {
+		super(prop.getName() + suffix);
+		this.property = prop;
+	}
+
+	public PropertyNode(PropertyInfo prop, String suffix, ViewSettings settings) {
+		super(prop.getName() + suffix, settings);
+		this.property = prop;
+	}
+	
+	public PropertyInfo getProperty() {
+		return property;
+	}
+	
+	/**
+	 * Property nodes always has a main, so are never single zoned
+	 */
+	public boolean hasSingleZone() {
+		return false;
+	}
+	
+	public List<PropertyInfo> getLogicalPropertyParents() {
+		return this.logicalParents;
+	}
+	
+	@Override
+	public void setLogicalParent(Node parent) {
+		if (parent instanceof PropertyNode) {
+			PropertyNode pnp = (PropertyNode) parent;
+			this.logicalParents = new ArrayList<PropertyInfo>();
+			List<PropertyInfo> ppl = pnp.getLogicalPropertyParents();
+			if (ppl != null) {
+				this.logicalParents.addAll(ppl);
+			}
+			this.logicalParents.add(pnp.getProperty());
+		}
+		super.setLogicalParent(parent);
+	}
+	
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/SimpleViewFilter.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/SimpleViewFilter.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/SimpleViewFilter.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/SimpleViewFilter.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.basics.MagmaException;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class SimpleViewFilter implements ViewCustomizer {
+
+	private Set<String> expand = new HashSet<String>();
+	private Set<String> hide = new HashSet<String>();
+	
+	private int hashcode = 0;
+		
+	public SimpleViewFilter(String... idAction) {
+		if (!idAction[0].startsWith("+") && !idAction[0].startsWith("-")) {
+			idAction[0] = null;
+		}
+		for (String prop : idAction) {
+			if (prop == null) continue;
+			if (prop.startsWith("+")) {
+				expand.add(prop.substring(1));
+			} else if (prop.startsWith("-")) {
+				hide.add(prop.substring(1));
+			} else {
+				throw new MagmaException("Cannot understand what to do with {0}, maybe you intend +{0} or -{0}?", prop);
+			}
+		}
+		hashcode = Arrays.hashCode(idAction);
+	}
+	
+	public boolean expand(Node parent, Node node) {
+		String id = node.getId();
+		if (parent != null) {
+			id = parent.getId() + "-" + id;
+		}
+		return this.expand.contains(id);
+	}
+	
+	public boolean hide(Node parent, Node node) {
+		String id = node.getId();
+		if (parent != null) {
+			id = parent.getId() + "-" + id;
+		}
+		return this.hide.contains(id);
+	}
+	
+	@Override
+	public int hashCode() {
+		return hashcode;
+	}
+	
+	@Override
+	public boolean equals(Object obj) {
+		if (!(obj instanceof SimpleViewFilter)) return false;
+		SimpleViewFilter oth = (SimpleViewFilter) obj;
+		return oth.expand.equals(this.expand) && oth.hide.equals(this.hide);
+	}
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewCustomizer.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewCustomizer.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewCustomizer.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewCustomizer.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+public interface ViewCustomizer {
+
+	public boolean expand(Node parent, Node node);
+	
+	public boolean hide(Node parent, Node node);
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewUtils.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewUtils.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewUtils.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/ViewUtils.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,356 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.basics.MagmaException;
+import org.apache.magma.basics.utils.AnnotationToInstance;
+import org.apache.magma.beans.BeanData;
+import org.apache.magma.beans.MagmaBeanSupport;
+import org.apache.magma.beans.PropertyInfo;
+import org.apache.magma.view.After;
+import org.apache.magma.view.Before;
+import org.apache.magma.view.ListAfter;
+import org.apache.magma.view.ListBefore;
+import org.apache.magma.view.ListOrder;
+import org.apache.magma.view.Listed;
+import org.apache.magma.view.Order;
+import org.apache.magma.view.OrdinalConstraint;
+import org.apache.magma.view.OrdinalSetting;
+import org.apache.magma.view.Side;
+import org.apache.magma.view.View;
+import org.apache.magma.view.ViewSettings;
+import org.apache.magma.view.Zone;
+import org.apache.magma.view.ZoneSetting;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.magma.conversion.Converter;
+import org.apache.magma.conversion.Converters;
+
+public class ViewUtils {
+
+	public static ViewSettings createSettings(Method method) {
+		if (method != null) {
+			ViewSettings setting = new ViewSettings();
+			boolean atlo = false;
+			View view = method.getAnnotation(View.class);
+			if (view != null) {
+				atlo = true;
+				AnnotationToInstance.setup(view, setting);
+			}
+			Zone zone = method.getAnnotation(Zone.class);
+			if (zone != null) {
+				ZoneSetting relative = new ZoneSetting();
+				atlo = true;
+				AnnotationToInstance.setup(zone, relative);
+				setting.setZone(relative);
+			}
+			Before beforeann = method.getAnnotation(Before.class);
+			After afterann = method.getAnnotation(After.class);
+			Order orderann = method.getAnnotation(Order.class);
+			if (beforeann != null || afterann != null || orderann != null) {
+				atlo = true;
+				OrdinalSetting set = new OrdinalSetting();
+				if (orderann != null) {
+					set.setOrder(orderann.value());
+				} else {
+					if (beforeann != null) {
+						set.addConstraint(new OrdinalConstraint(true, beforeann.value()));
+					}
+					if (afterann != null) {
+						set.addConstraint(new OrdinalConstraint(false, afterann.value()));
+					}
+				}
+				setting.setOrdinal(set);
+			}
+			if (atlo)
+				return setting;
+		}
+		return null;
+	}
+
+	public static ViewSettings createListSettings(Method method, ViewSettings fieldSettings) {
+		if (method != null) {
+			ViewSettings setting = new ViewSettings(fieldSettings);
+			boolean atlo = false;
+			Listed view = method.getAnnotation(Listed.class);
+			if (view != null) {
+				atlo = true;
+				AnnotationToInstance.setup(view, setting);
+			}
+			ListBefore beforeann = method.getAnnotation(ListBefore.class);
+			ListAfter afterann = method.getAnnotation(ListAfter.class);
+			ListOrder orderann = method.getAnnotation(ListOrder.class);
+			if (beforeann != null || afterann != null || orderann != null) {
+				atlo = true;
+				OrdinalSetting set = new OrdinalSetting();
+				if (orderann != null) {
+					set.setOrder(orderann.value());
+				} else {
+					if (beforeann != null) {
+						set.addConstraint(new OrdinalConstraint(true, beforeann.value()));
+					}
+					if (afterann != null) {
+						set.addConstraint(new OrdinalConstraint(false, afterann.value()));
+					}
+				}
+				setting.setOrdinal(set);
+			}
+			if (atlo)
+				return setting;
+		}
+		return null;
+	}
+	
+	public static Node createTree(BeanData data, ViewCustomizer filter) {
+		return createTree(data, filter, null);
+	}
+	
+	
+	private static Node createTree(BeanData data, ViewCustomizer filter, Node parent) {
+		Node root = new Node("root");
+		
+		List<FieldNode> nodelist = new ArrayList<FieldNode>();
+		Set<String> propertyNames = data.getPropertyNames();
+		for (String name : propertyNames) {
+			PropertyInfo property = data.getProperty(name);
+			ViewSettings settings = property.getViewSettings();
+			if (settings == null) continue;
+			nodelist.add(new FieldNode(property));
+		}
+		
+		int cnt = 0;
+		while (nodelist.size() > 0 && cnt < 100) {
+			cnt++;
+			for (Iterator<FieldNode> iterator = nodelist.iterator(); iterator.hasNext();) {
+				FieldNode node = iterator.next();				
+				PropertyInfo property = node.getProperty();
+				ViewSettings settings = property.getViewSettings();
+				boolean added = false;
+				if (filter.hide(parent, node)) {
+					Node nnode = new HiddenNode(property);
+					added = root.addSubnode(nnode);
+				} else if (filter.expand(parent, node)) {
+					Node nnode = new ContainerProperty(property, settings);
+					Node sub = createTree(BeanData.getFor(property.getType()), filter, nnode);
+					sub.setLogicalParent(nnode);
+					nnode.addSubnode(sub);
+					added = root.addSubnode(nnode);
+				} else {
+					added = root.addSubnode(node);
+					if (settings.getLabel() == null) {
+						settings.setLabel(getLabelFromName(property.getName()));
+					}
+					if (settings.getLabel().length() > 0) {
+						ViewSettings labset = new ViewSettings();
+						ZoneSetting zoneSetting = new ZoneSetting();
+						zoneSetting.setOf(node.getId());
+						zoneSetting.setSide(Side.OutsideLeft);
+						zoneSetting.setShared(true);
+						labset.setZone(zoneSetting);
+						Node labelnode = new LabelNode(property, labset);
+						root.addSubnode(labelnode);
+					}
+				}
+				if (added) {
+					iterator.remove();
+				}
+			}
+		}
+		root.validate();
+		return root;
+	}
+	
+	public static String getLabelFromName(String name) {
+		String autolabel = deCamelCase(name);
+		if (autolabel.length() > 0) {
+			autolabel = Character.toUpperCase(autolabel.charAt(0)) + autolabel.substring(1);
+		}
+		return autolabel;
+	}
+
+	/**
+	 * De camel cases a camelCase string. 
+	 * <p>
+	 * This is used to automatically generate labels for 
+	 * properties that does not have a label explicitly set.
+	 * </p>
+   	 * <p>
+   	 * Anyway, there are a number of exceptions :
+   	 * </p>
+   	 * <ul><li>URLTarget should be "URL target"
+   	 * </li><li>targetURL should be "target URL"
+   	 * </li><li>tellAUser should be "tell a user"
+   	 * </li><li>tell200 should be "tell 200"
+   	 * </li><li>tell_them should be "tell them" 
+   	 * </li></ul><p>
+   	 * @param name the name to de camel case.
+	 * @return the de camel cased name
+	 */
+	public static String deCamelCase(String name) {
+		List<String> tokens = new ArrayList<String>();
+		{
+			String buff = "";
+			boolean preupper = false;
+			for (int i = 0; i < name.length(); i++) {
+				char c = name.charAt(i);
+				if (!Character.isLetterOrDigit(c)) {
+					if (buff.length() > 0) {
+						tokens.add(buff);
+						buff = "";
+					}
+					continue;
+				}
+				boolean isupper = Character.isDigit(c) || Character.isUpperCase(c); 
+				if (i == 0) {
+					preupper = isupper;
+					buff += c;
+				} else {
+					if (preupper != isupper) {
+						if (buff.length() > 0) {
+							tokens.add(buff);
+							buff = Character.toString(c);
+						}	
+						preupper = isupper;
+					} else {
+						buff += c;
+					}
+				}
+			}
+			if (buff.length() > 0) tokens.add(buff);
+		}
+		if (tokens.size() == 0) return "";
+		{
+			List<String> ntoks = new ArrayList<String>();
+			for (Iterator<String> iterator = tokens.iterator(); iterator.hasNext();) {
+				String act = iterator.next();
+				if (act.length() > 1) {
+					if (act.toUpperCase().equals(act) && iterator.hasNext()) {
+						ntoks.add(act.substring(0, act.length() - 1));
+						ntoks.add(act.substring(act.length() - 1));
+						continue;
+					}
+				}
+				ntoks.add(act);
+			}
+			tokens = ntoks;
+		}
+		StringBuilder res = new StringBuilder();
+		{
+			boolean preupper = tokens.get(0).toUpperCase().equals(tokens.get(0));
+			for (String act : tokens) {
+				if (act.toUpperCase().equals(act)) {
+					preupper = true;
+					res.append(' ');
+					if (act.length() == 1) {
+						res.append(act.toLowerCase());
+					} else {
+						res.append(act);						
+					}
+				} else {
+					if (!preupper) res.append(' ');
+					res.append(act);
+				}
+			}
+		}
+		return res.toString().trim();
+	}
+
+	public static Node createListTree(BeanData data, ViewCustomizer filter) {
+		return createListTree(data, filter, null);
+	}
+	
+	
+	private static Node createListTree(BeanData data, ViewCustomizer filter, Node parent) {
+		Node root = new Node("list");
+		Set<String> propertyNames = data.getPropertyNames();
+		for (String name : propertyNames) {
+			PropertyInfo property = data.getProperty(name);
+			ViewSettings settings = property.getViewListSettings();
+			if (settings == null) continue;
+			Node node = new FieldNode(property);
+			if (filter.hide(parent, node)) continue;
+			if (filter.expand(parent, node)) {
+				node = new ContainerProperty(property, settings);
+				Node sub = createTree(BeanData.getFor(property.getType()), filter, node);
+				sub.setLogicalParent(node);
+				node.addSubnode(sub);
+				root.addSubnode(node);
+			} else {
+				root.addSubnode(node);
+			}
+		}
+		root.validate();
+		return root;
+	}
+	
+	public static String getStringNodeValue(FieldNode node, MagmaBeanSupport bean) {
+		Object value = getNodeValue(node, bean);
+		return getStringValue(value);
+	}
+
+	public static String getStringValue(Object value) {
+		if (value == null) return "";
+		if (value instanceof MagmaBeanSupport) {
+			return ((MagmaBeanSupport)value).toUser();
+		} else {
+			Converter conv = Converters.getConverterFor(value.getClass());
+			if (conv != null) {
+				return conv.toString(value);
+			}
+		}
+		return value.toString();
+	}
+	
+	public static Object getNodeValue(FieldNode node, MagmaBeanSupport bean) {
+		MagmaBeanSupport acbean = findProperBean(node, bean, false);
+		if (acbean == null) return null;
+		Object value = acbean.handler().getValue(node.getProperty().getName());
+		return value;
+	}
+	
+	public static MagmaBeanSupport findProperBean(FieldNode node, MagmaBeanSupport bean, boolean create) {
+		MagmaBeanSupport acbean = bean;
+		if (node.getLogicalPropertyParents() != null) {
+			for (PropertyInfo acprop : node.getLogicalPropertyParents()) {
+				Object acobj = acbean.handler().getValue(acprop.getName());
+				if (acobj == null) {
+					if (MagmaBeanSupport.class.isAssignableFrom(acprop.getType()) && create) {
+						try {
+							acobj = acprop.getType().newInstance();
+							acbean.handler().setValue(acprop.getName(), acobj);
+						} catch (InstantiationException e) {
+							throw new MagmaException(e, "Could not create a new {0} to set in {1}.{2}", acprop.getType().getSimpleName(), acbean.getClass().getSimpleName(), acprop.getName());
+						} catch (IllegalAccessException e) {
+							throw new MagmaException(e, "Could not create a new {0} to set in {1}.{2}", acprop.getType().getSimpleName(), acbean.getClass().getSimpleName(), acprop.getName());
+						}
+					} else {
+						return null;
+					}
+				}
+				if (!(acobj instanceof MagmaBeanSupport)) throw new MagmaException("The bean {0} obtained with property {1}.{2} is not a magma bean!", acobj.getClass().getName(), acprop.getName(), acbean.getClass().getName());
+				acbean = (MagmaBeanSupport) acobj;
+			}
+		}
+		return acbean;
+	}
+	
+}

Added: labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Zone.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Zone.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Zone.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/main/java/org/apache/magma/view/tree/Zone.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,200 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view.tree;
+
+import org.apache.magma.view.OrdinalConstraint;
+import org.apache.magma.view.OrdinalSetting;
+import org.apache.magma.view.Side;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+public class Zone {
+
+	private Side side = null;
+	private List<Node> nodes = new ArrayList<Node>();
+	private List<Integer> slices = new ArrayList<Integer>();
+	private boolean validated = false;
+	private Node parent = null;
+	
+	public Zone(Side side, Node parent) {
+		this.side = side;
+		this.parent = parent;
+	}
+	
+	public Side getSide() {
+		return this.side;
+	}
+
+	public void addNode(Node node) {
+		this.nodes.add(node);
+		node.setParent(this);
+		this.invalidate();
+	}
+
+	public List<Node> getNodes() {
+		return Collections.unmodifiableList(nodes);
+	}
+	
+	public int getSlices() {
+		return this.slices.size();
+	}
+	
+	public List<Node> getSliceNodes(int slice) {
+		int from = 0;
+		int to = this.slices.get(slice);
+		if (slice > 0) {
+			from = this.slices.get(slice - 1) + 1;
+		}
+		return Collections.unmodifiableList(this.nodes.subList(from, to + 1));
+	}
+	
+	public void validate() {
+		if (this.validated) return;
+		this.slices.clear();
+		if (this.nodes.size() <= 1) {
+			this.nodes.get(0).validate();
+			this.slices.add(0);
+			this.validated = true;
+			return;
+		}
+		Comparator<Node> ordinalComparator = new Comparator<Node>() {
+			public int compare(Node o1, Node o2) {
+				return Float.compare(o1.getGivenOrdinal(), o2.getGivenOrdinal());
+			}
+		};
+
+		Collections.sort(this.nodes, ordinalComparator);
+		List<Node> needsPosition = new ArrayList<Node>();
+		for (Node acnode : this.nodes) {
+			if (acnode.getGivenOrdinal() <= 0) {
+				needsPosition.add(acnode);
+			}
+		}
+		while (needsPosition.size() > 0) {
+			this.nodes.removeAll(needsPosition);
+			float maxsofar = 1;
+			if (this.nodes.size() > 0) {
+				maxsofar = this.nodes.get(this.nodes.size() - 1).getGivenOrdinal();
+			}
+			boolean atlo = true;
+			while (atlo && needsPosition.size() > 0) {
+				atlo = false;
+				for (Iterator<Node> iterator = needsPosition.iterator(); iterator.hasNext();) {
+					Node acnode = (Node) iterator.next();
+					OrdinalSetting ordinal = acnode.getOrdinal();
+					if (ordinal != null && ordinal.getConstraints() != null && ordinal.getConstraints().size() != 0) {
+						Node bestBefore = null;
+						Node bestAfter = null;
+						for (OrdinalConstraint constraint : ordinal.getConstraints()) {
+							String of = constraint.getOf();
+							Node other = findById(of);
+							if (other == null) continue;
+							if (constraint.isBefore()) {
+								if (bestBefore == null || bestBefore.getGivenOrdinal() > other.getGivenOrdinal()) {
+									bestBefore = other;
+								}
+							} else {
+								if (bestAfter == null || bestAfter.getGivenOrdinal() < other.getGivenOrdinal()) {
+									bestAfter = other;
+								}
+							}
+						}						
+						if (bestBefore == null && bestAfter == null) continue;
+						
+						if (bestBefore != null) {
+							int ind = this.nodes.indexOf(bestBefore);
+							float prebef = 0;
+							if (ind > 0) prebef = nodes.get(ind - 1).getGivenOrdinal();
+							acnode.setGivenOrdinal(prebef + ((bestBefore.getGivenOrdinal() - prebef) / 2));
+						} else {
+							int ind = this.nodes.indexOf(bestAfter);
+							float postaft = bestAfter.getGivenOrdinal() + 1;
+							if (ind < nodes.size() - 1) postaft = nodes.get(ind + 1).getGivenOrdinal();
+							acnode.setGivenOrdinal(postaft - ((postaft - bestAfter.getGivenOrdinal()) / 2));
+						}
+					} else {
+						// Add those not having an ordinal as last elements
+						acnode.setGivenOrdinal(++maxsofar);
+					}
+					if (acnode.getGivenOrdinal() > 0) {
+						atlo = true;
+						nodes.add(acnode);						
+						iterator.remove();
+						Collections.sort(nodes, ordinalComparator);
+					}
+				}
+			}
+			if (needsPosition.size() > 0) {
+				// Give a node the next sofar and try another iteration
+				Node acnode = needsPosition.remove(0);
+				acnode.setGivenOrdinal(++maxsofar);
+				nodes.add(acnode);						
+				Collections.sort(nodes, ordinalComparator);
+			}			
+		}
+
+		for (Node node : nodes) {
+			node.validate();
+		}		
+		
+		this.slices.clear();
+		boolean wasSharing = false;
+		for (int i = 0; i < nodes.size(); i++) {
+			Node acnode = nodes.get(i);
+			boolean shares = false;
+			if (acnode.getZoneSettings() != null) shares = acnode.getZoneSettings().isShared();
+			if (shares) {
+				wasSharing = true;
+				continue;
+			} else {
+				if (wasSharing) {
+					slices.add(i - 1);
+				}
+				slices.add(i);
+			}
+		}
+		if (wasSharing) {
+			slices.add(nodes.size() - 1);
+		}
+		
+		this.validated = true;
+	}
+	
+	void invalidate() {
+		if (!this.validated) return;
+		this.validated = false;
+		if (this.parent != null) this.parent.invalidate();		
+	}
+
+	public Node findById(String id) {
+		for (Node node : nodes) {
+			Node found = node.findById(id);
+			if (found != null) return found;
+		}
+		return null;
+	}
+
+	public void setLogicalParent(Node parent2) {
+		for (Node node : nodes) {
+			node.setLogicalParent(parent2);
+		}		
+	}
+}

Added: labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/BeanViewListTreeTest.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/BeanViewListTreeTest.java?rev=695904&view=auto
==============================================================================
--- labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/BeanViewListTreeTest.java (added)
+++ labs/magma/trunk/foundation-beans-view/src/test/java/org/apache/magma/view/BeanViewListTreeTest.java Tue Sep 16 07:31:00 2008
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.magma.view;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.matchers.JUnitMatchers.*;
+import static org.hamcrest.CoreMatchers.*;
+
+import org.apache.magma.beans.BeanData;
+import org.apache.magma.beans.PropertyInfo;
+import org.apache.magma.view.tree.Node;
+import org.apache.magma.view.tree.SimpleViewFilter;
+import org.apache.magma.view.tree.ViewCustomizer;
+
+import org.junit.Test;
+
+
+public class BeanViewListTreeTest {
+	@Test
+	public void simpleTree() throws Exception {
+		ViewBean bean = new ViewBean();
+		BeanData data = bean.beanData();
+		Node root = data.getViewListTree();
+		assertNotNull(root);		
+		simpleCheck(data, root, null);
+	}
+
+
+	private void simpleCheck(BeanData data, Node root, String parented) {
+		for (String prop : data.getPropertyNames()) {
+			PropertyInfo property = data.getProperty(prop);
+			if (property.getViewListSettings() != null) {
+				Node propnode = root.findById((parented != null ? parented + "-" : "") + property.getName());
+				assertNotNull(propnode);
+			}
+		}
+	}
+	
+	
+	@Test
+	public void filters() throws Exception {
+		ViewCustomizer flt = new SimpleViewFilter("basictest", "+another", "-age");
+		ViewBean bean = new ViewBean();
+		BeanData data = bean.beanData();
+		Node root = data.getViewListTree(flt);
+		assertNotNull(root);
+		for (String prop : data.getPropertyNames()) {
+			PropertyInfo property = data.getProperty(prop);
+			if (property.getViewListSettings() != null) {
+				Node propnode = root.findById(property.getName());
+				assertThat(property.getName(), not(equalTo("age")));
+				if (property.getName().equals("another")) {
+					assertNotNull(propnode);
+					simpleCheck(data, propnode, "another");
+				} else {
+					assertNotNull(propnode);
+				}
+			}
+		}
+		
+	}
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org