You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/02/22 18:25:50 UTC
svn commit: r510598 [3/6] - in /myfaces/fusion/trunk: ./ core/ core/src/
core/src/main/ core/src/main/java/ core/src/main/java/org/
core/src/main/java/org/apache/ core/src/main/java/org/apache/myfaces/
core/src/main/java/org/apache/myfaces/fusion/ core...
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/jsf/Converter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/jsf/Converter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/jsf/Converter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DataProvider.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DataProvider.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DataProvider.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DataProvider.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * where to get the data for a relation between entities
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface DataProvider
+{
+ /**
+ * points to a method returning a list
+ */
+ public String value();
+
+ /**
+ * the properties to use as description. This can be a JSF value-binding.
+ */
+ public String description();
+}
\ No newline at end of file
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DataProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DataProvider.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DataProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DisplayOnly.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DisplayOnly.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DisplayOnly.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DisplayOnly.java Thu Feb 22 09:25:41 2007
@@ -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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * do not render any input. e.g uses outputText instead
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface DisplayOnly
+{
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DisplayOnly.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DisplayOnly.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/DisplayOnly.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/IgnoreProperty.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/IgnoreProperty.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/IgnoreProperty.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/IgnoreProperty.java Thu Feb 22 09:25:41 2007
@@ -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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Ignore (skip) this property so it will not appear on any gui
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface IgnoreProperty
+{
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/IgnoreProperty.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/IgnoreProperty.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/IgnoreProperty.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Length.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Length.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Length.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Length.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * set the minimum and maximum characters allowed for input
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface Length
+{
+ int min() default 0;
+
+ int max() default Integer.MAX_VALUE;
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Length.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Length.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Length.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Max.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Max.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Max.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Max.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * set the maximum allowed value
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface Max
+{
+ long value();
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Max.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Max.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Max.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Min.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Min.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Min.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Min.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * set the minimum allowed value
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface Min
+{
+ long value();
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Min.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Min.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Min.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/NotNull.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/NotNull.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/NotNull.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/NotNull.java Thu Feb 22 09:25:41 2007
@@ -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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * required field
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface NotNull
+{
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/NotNull.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/NotNull.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/NotNull.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Range.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Range.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Range.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Range.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * set the minimum and maximum allowed value
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface Range
+{
+ long min();
+
+ long max();
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Range.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Range.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Range.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/ReadOnly.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/ReadOnly.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/ReadOnly.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/ReadOnly.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.myfaces.fusion.dynaForm.annot.ui;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * render a readonly element.
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface ReadOnly
+{
+ /**
+ * set to true if you would like to render as disabled control
+ */
+ boolean disabled() default false;
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/ReadOnly.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/ReadOnly.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/ReadOnly.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Temporal.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Temporal.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Temporal.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Temporal.java Thu Feb 22 09:25:41 2007
@@ -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.myfaces.fusion.dynaForm.annot.ui;
+
+import javax.persistence.TemporalType;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * much like javax.persistence.Temporal but to allow to work with any date library
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface Temporal
+{
+ /**
+ * set to true if you would like to render as disabled control
+ */
+ TemporalType value() default TemporalType.TIMESTAMP;
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Temporal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Temporal.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/Temporal.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/UIComponent.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/UIComponent.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/UIComponent.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.myfaces.fusion.dynaForm.annot.ui;
+
+import org.apache.myfaces.fusion.dynaForm.guiBuilder.ComponentEnum;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * render the n:1 as select box
+ */
+@Target(value = {ElementType.METHOD, ElementType.FIELD})
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface UIComponent
+{
+ ComponentEnum type() default ComponentEnum.OutputText;
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/UIComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/UIComponent.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/annot/ui/UIComponent.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfig.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfig.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfig.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfig.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,204 @@
+/*
+ * 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.myfaces.fusion.dynaForm.component.dynaForm;
+
+import org.apache.myfaces.fusion.dynaForm.metadata.MetaData.FieldImpl;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+/**
+ * the dynaForm configuration component<br />
+ * handles overruled field setup
+ */
+public class DynaConfig extends UIComponentBase
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.dynaForm.DynaConfig";
+ public static final String COMPONENT_FAMILY = "org.apache.myfaces.dynaForm.DynaConfig";
+
+ private String forProperty;
+ private Integer displaySize;
+ private Boolean displayOnly;
+ private Boolean readOnly;
+ private Boolean disabled;
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ /**
+ * @see #setDisplaySize(Integer)
+ */
+ public Integer getDisplaySize()
+ {
+ if (displaySize != null)
+ {
+ return displaySize;
+ }
+ ValueBinding vb = getValueBinding("displaySize");
+ return vb != null ? (Integer) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * a hint for the size the ui should use when rendering the field
+ */
+ public void setDisplaySize(Integer displaySize)
+ {
+ this.displaySize = displaySize;
+ }
+
+ /**
+ * @see #setDisplayOnly(Boolean)
+ */
+ public Boolean getDisplayOnly()
+ {
+ if (displayOnly != null)
+ {
+ return displayOnly;
+ }
+ ValueBinding vb = getValueBinding("displayOnly");
+ return vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * set the field to display only
+ */
+ public void setDisplayOnly(Boolean displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ /**
+ * @see #setReadOnly(Boolean)
+ */
+ public Boolean getReadOnly()
+ {
+ if (readOnly != null)
+ {
+ return readOnly;
+ }
+ ValueBinding vb = getValueBinding("readOnly");
+ return vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * configure this field as readOnly - noneditable input field
+ */
+ public void setReadOnly(Boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ /**
+ * @see #setDisabled(Boolean)
+ */
+ public Boolean getDisabled()
+ {
+ if (disabled != null)
+ {
+ return disabled;
+ }
+ ValueBinding vb = getValueBinding("disabled");
+ return vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * configure this field as disabled - like readOnly but grayed too
+ */
+ public void setDisabled(Boolean disabled)
+ {
+ this.disabled = disabled;
+ }
+
+ /**
+ * @see #setFor(String)
+ */
+ public String getFor()
+ {
+ if (forProperty != null)
+ {
+ return forProperty;
+ }
+ ValueBinding vb = getValueBinding("for");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * the name of the property this configuration is for
+ */
+ public void setFor(String forProperty)
+ {
+ this.forProperty = forProperty;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object stateArray)
+ {
+ Object[] states = (Object[]) stateArray;
+ super.restoreState(context, states[0]);
+ displaySize = (Integer) states[1];
+ forProperty = (String) states[2];
+ displayOnly = (Boolean) states[3];
+ readOnly = (Boolean) states[4];
+ disabled = (Boolean) states[5];
+ }
+
+ @Override
+ public Object saveState(FacesContext context)
+ {
+ return new Object[]
+ {
+ super.saveState(context),
+ displaySize,
+ forProperty,
+ displayOnly,
+ readOnly,
+ disabled
+ };
+ }
+
+ public void configureMetaData(FieldImpl field)
+ {
+ if (getDisplaySize() != null)
+ {
+ field.setDisplaySize(getDisplaySize().intValue());
+ }
+ if (getDisplayOnly() != null)
+ {
+ field.setDisplayOnly(getDisplayOnly());
+ }
+ if (getReadOnly() != null)
+ {
+ field.setCanWrite(getReadOnly().booleanValue());
+ }
+ if (getDisabled() != null)
+ {
+ field.setDisabled(getDisabled().booleanValue());
+ }
+
+ if (getChildCount() > 0)
+ {
+ field.setWantedComponent((UIComponent) getChildren().get(0));
+ }
+ }
+}
\ No newline at end of file
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfig.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfig.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfig.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigTag.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigTag.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigTag.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigTag.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,140 @@
+/*
+ * 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.myfaces.fusion.dynaForm.component.dynaForm;
+
+import org.apache.myfaces.shared_fusion.taglib.UIComponentBodyTagBase;
+
+import javax.faces.component.UIComponent;
+
+public class DynaConfigTag extends UIComponentBodyTagBase
+{
+ private String displaySize;
+ private String forProperty;
+ private String displayOnly;
+ private String readOnly;
+ private String disabled;
+
+ public void release()
+ {
+ super.release();
+
+ displaySize = null;
+ forProperty = null;
+ }
+
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setIntegerProperty(component, "displaySize", displaySize);
+ setStringProperty(component, "for", forProperty);
+ setBooleanProperty(component, "displayOnly", displayOnly);
+ setBooleanProperty(component, "readOnly", readOnly);
+ setBooleanProperty(component, "disabled", disabled);
+ }
+
+ /**
+ * @see DynaConfig#setDisplaySize(Integer)
+ */
+ public String getDisplaySize()
+ {
+ return displaySize;
+ }
+
+ /**
+ * @see DynaConfig#setDisplaySize(Integer)
+ */
+ public void setDisplaySize(String size)
+ {
+ this.displaySize = size;
+ }
+
+ /**
+ * @see DynaConfig#setFor(String)
+ */
+ public String getFor()
+ {
+ return forProperty;
+ }
+
+ /**
+ * @see DynaConfig#setFor(String)
+ */
+ public void setFor(String forProperty)
+ {
+ this.forProperty = forProperty;
+ }
+
+ /**
+ * @see DynaConfig#setDisplayOnly(Boolean)
+ */
+ public String getDisplayOnly()
+ {
+ return displayOnly;
+ }
+
+ /**
+ * @see DynaConfig#setDisplayOnly(Boolean)
+ */
+ public void setDisplayOnly(String displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ /**
+ * @see DynaConfig#setDisabled(Boolean)
+ */
+ public String getDisabled()
+ {
+ return disabled;
+ }
+
+ /**
+ * @see DynaConfig#setDisabled(Boolean)
+ */
+ public void setDisabled(String disabled)
+ {
+ this.disabled = disabled;
+ }
+
+ /**
+ * @see DynaConfig#setReadOnly(Boolean)
+ */
+ public String getReadOnly()
+ {
+ return readOnly;
+ }
+
+ /**
+ * @see DynaConfig#setReadOnly(Boolean)
+ */
+ public void setReadOnly(String readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
+ public String getComponentType()
+ {
+ return DynaConfig.COMPONENT_TYPE;
+ }
+
+ public String getRendererType()
+ {
+ return null;
+ }
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigTag.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigTag.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigs.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigs.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigs.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigs.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,77 @@
+/*
+ * 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.myfaces.fusion.dynaForm.component.dynaForm;
+
+import javax.faces.component.UIComponentBase;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * the dynaForm configuration component<br />
+ * handles overruled field setup
+ */
+public class DynaConfigs extends UIComponentBase
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.dynaForm.DynaConfigs";
+ public static final String COMPONENT_FAMILY = "org.apache.myfaces.dynaForm.DynaConfigs";
+
+ private transient Map<String, DynaConfig> configMap = null;
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ public DynaConfig getConfig(String name)
+ {
+ Map<String, DynaConfig> configMap = getConfigMap();
+ return configMap.get(name);
+ }
+
+ protected Map<String, DynaConfig> getConfigMap()
+ {
+ if (configMap != null)
+ {
+ return configMap;
+ }
+ configMap = new LinkedHashMap<String, DynaConfig>();
+
+ for (Object child : getChildren())
+ {
+ if (child instanceof DynaConfig)
+ {
+ DynaConfig dynaConfig = (DynaConfig) child;
+ if (configMap.containsKey(dynaConfig.getFor()))
+ {
+ throw new IllegalStateException("duplicate config for property '" + dynaConfig.getFor() + "'");
+ }
+ configMap.put(dynaConfig.getFor(), dynaConfig);
+ }
+ }
+
+ return configMap;
+ }
+
+ public Iterator<DynaConfig> iterator()
+ {
+ return getConfigMap().values().iterator();
+ }
+}
\ No newline at end of file
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigs.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigs.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigs.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigsTag.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigsTag.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigsTag.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigsTag.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.myfaces.fusion.dynaForm.component.dynaForm;
+
+import org.apache.myfaces.shared_fusion.taglib.UIComponentBodyTagBase;
+
+public class DynaConfigsTag extends UIComponentBodyTagBase
+{
+ public void release()
+ {
+ super.release();
+ }
+
+ public String getComponentType()
+ {
+ return DynaConfigs.COMPONENT_TYPE;
+ }
+
+ public String getRendererType()
+ {
+ return null;
+ }
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigsTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigsTag.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaConfigsTag.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaForm.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaForm.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaForm.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaForm.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,317 @@
+/*
+ * 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.myfaces.fusion.dynaForm.component.dynaForm;
+
+import org.apache.myfaces.fusion.dynaForm.metadata.Extractor;
+import org.apache.myfaces.fusion.dynaForm.uri.FacesUriResolver;
+import org.apache.myfaces.fusion.dynaForm.uri.UriResolver;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.persistence.Transient;
+
+/**
+ * the dynaForm component<br />
+ * handles whats needed to dynamically create JSF component trees
+ */
+public class DynaForm extends UIComponentBase
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.dynaForm.DynaForm";
+ public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.dynaForm.DynaForm";
+ public static final String COMPONENT_FAMILY = "org.apache.myfaces.dynaForm.DynaForm";
+
+ public static final String DYNA_FORM_CREATED = "org.apache.myfaces.dynaForm.CREATED";
+
+ private String uri;
+ private String bundle;
+ private String var;
+ private String valueBindingPrefix;
+ private Boolean displayOnly;
+ private Boolean exclusiveFields;
+
+ @Transient
+ private transient UriResolver.Configuration configuration = null;
+ private transient DynaConfigs formConfigs = null;
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ /**
+ * @see #setUri
+ */
+ public String getUri()
+ {
+ if (uri != null)
+ {
+ return uri;
+ }
+ ValueBinding vb = getValueBinding("uri");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * how to reach the model<br />
+ * e.g. ejb:fqn.to.model.Entity means use EJB3 to work with the given entity<br />
+ * beside the model itself the uri scheme also configures what to do with this entity
+ *
+ * @see org.apache.myfaces.fusion.dynaForm.uri.UriResolver
+ */
+ public void setUri(String uri)
+ {
+ this.uri = uri;
+ }
+
+ /**
+ * @see #setValueBindingPrefix
+ */
+ public String getValueBindingPrefix()
+ {
+ if (valueBindingPrefix != null)
+ {
+ return valueBindingPrefix;
+ }
+ ValueBinding vb = getValueBinding("valueBindingPrefix");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * The value binding prefix which will be used to create the real value binding.
+ * If this is missing and the layout component has a "var" attribute its
+ * value will be used.
+ */
+ public void setValueBindingPrefix(String valueBindingPrefix)
+ {
+ this.valueBindingPrefix = valueBindingPrefix;
+ }
+
+ /**
+ * @see #setBundle
+ */
+ public String getBundle()
+ {
+ if (bundle != null)
+ {
+ return bundle;
+ }
+ ValueBinding vb = getValueBinding("bundle");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * The bundle to use to convert the labels to readable strings
+ */
+ public void setBundle(String bundle)
+ {
+ this.bundle = bundle;
+ }
+
+ /**
+ * @see #setVar
+ */
+ public String getVar()
+ {
+ if (var != null)
+ {
+ return var;
+ }
+ ValueBinding vb = getValueBinding("var");
+ return vb != null ? (String) vb.getValue(getFacesContext()) : null;
+ }
+
+ /**
+ * Display the whole form in read only mode
+ */
+ public void setDisplayOnly(boolean displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ /**
+ * @see #setVar
+ */
+ public boolean isDisplayOnly()
+ {
+ if (displayOnly != null)
+ {
+ return displayOnly.booleanValue();
+ }
+ ValueBinding vb = getValueBinding("displayOnly");
+ if (vb != null)
+ {
+ Boolean ret = (Boolean) vb.getValue(getFacesContext());
+ if (ret != null)
+ {
+ return ret.booleanValue();
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Process only fields listed by their facets
+ */
+ public void setExclusiveFields(boolean exclusiveFields)
+ {
+ this.exclusiveFields = exclusiveFields;
+ }
+
+ /**
+ * @see #setExclusiveFields(boolean)
+ */
+ public boolean isExclusiveFields()
+ {
+ if (exclusiveFields != null)
+ {
+ return exclusiveFields.booleanValue();
+ }
+ ValueBinding vb = getValueBinding("exclusiveFields");
+ if (vb != null)
+ {
+ Boolean ret = (Boolean) vb.getValue(getFacesContext());
+ if (ret != null)
+ {
+ return ret.booleanValue();
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * the var name used to allow access to the form controller
+ */
+ public void setVar(String var)
+ {
+ this.var = var;
+ }
+
+ @Override
+ public void restoreState(FacesContext context, Object stateArray)
+ {
+ Object[] states = (Object[]) stateArray;
+ super.restoreState(context, states[0]);
+ uri = (String) states[1];
+ var = (String) states[2];
+ displayOnly = (Boolean) states[3];
+ bundle = (String) states[4];
+ valueBindingPrefix = (String) states[5];
+ }
+
+ @Override
+ public Object saveState(FacesContext context)
+ {
+ return new Object[]
+ {
+ super.saveState(context),
+ uri,
+ var,
+ displayOnly,
+ bundle,
+ valueBindingPrefix
+ };
+ }
+
+ /**
+ * get the overall configuration based on the given uri
+ *
+ * @see org.apache.myfaces.fusion.dynaForm.uri.UriResolver
+ */
+ protected UriResolver.Configuration getConfiguration()
+ {
+ if (configuration == null)
+ {
+ configuration = new FacesUriResolver().resolveUri(getUri());
+ }
+ return configuration;
+ }
+
+ public Extractor getExtractor()
+ {
+ return getConfiguration().getExtractor();
+ }
+
+ /**
+ * try to find a parent dyna form+
+ */
+ protected DynaForm findParentDynaForm(DynaForm start)
+ {
+ UIComponent component = start.getParent();
+ while (component != null)
+ {
+ if (component instanceof DynaForm)
+ {
+ return (DynaForm) component;
+ }
+ component = component.getParent();
+ }
+
+ return null;
+ }
+
+ /**
+ * Find the dynaForm component
+ */
+ public static DynaForm getDynaForm(UIComponent component)
+ {
+ if (component == null)
+ {
+ throw new IllegalArgumentException("component==null not allowed");
+ }
+
+ UIComponent dynaFormComponent = component;
+ while (dynaFormComponent != null && (!(dynaFormComponent instanceof DynaForm)))
+ {
+ dynaFormComponent = dynaFormComponent.getParent();
+ }
+ if (dynaFormComponent == null)
+ {
+ throw new IllegalArgumentException("component with id '" + component.getId() + "' not contained in an dynaForm");
+ }
+
+ return (DynaForm) dynaFormComponent;
+ }
+
+ /**
+ * get access to the special form configurations
+ */
+ public DynaConfigs getFormConfigs()
+ {
+ if (formConfigs != null)
+ {
+ return formConfigs;
+ }
+
+ for (Object obj : getChildren())
+ {
+ if (obj instanceof DynaConfigs)
+ {
+ formConfigs = (DynaConfigs) obj;
+ return formConfigs;
+ }
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaForm.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaForm.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaForm.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormRenderer.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormRenderer.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormRenderer.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,363 @@
+/*
+ * 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.myfaces.fusion.dynaForm.component.dynaForm;
+
+import org.apache.myfaces.fusion.dynaForm.guiBuilder.Slipstream;
+import org.apache.myfaces.fusion.dynaForm.guiBuilder.impl.jsf.JsfGuiBuilder;
+import org.apache.myfaces.fusion.dynaForm.guiBuilder.impl.jsf.JsfGuiBuilderFactory;
+import org.apache.myfaces.fusion.dynaForm.guiBuilder.impl.jsf.NewComponentListener;
+import org.apache.myfaces.fusion.dynaForm.jsfext.ComponentUtils;
+import org.apache.myfaces.fusion.dynaForm.lib.ViewType;
+import org.apache.myfaces.fusion.dynaForm.metadata.MetaData;
+import org.apache.myfaces.fusion.dynaForm.metadata.impl.jsf.JsfExclusiveExtractor;
+import org.apache.myfaces.fusion.dynaForm.metadata.impl.jsf.JsfExtractor;
+import org.apache.myfaces.fusion.dynaForm.metadata.impl.jsf.JsfRequestFieldExtractor;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * the dynaForm renderer<br />
+ * regardles what the component told you, this is where the work happens ;-)
+ */
+public class DynaFormRenderer extends Renderer
+{
+ public final static String CONTEXT_GUI_BUILDER = "org.apache.myfaces.custom.dynaForm.GUI_BUILDER";
+
+ private final class AddComponentToTable implements NewComponentListener
+ {
+ private final UIComponent destCmp;
+
+ private AddComponentToTable(UIComponent component)
+ {
+ super();
+ this.destCmp = component;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void newComponent(String fieldName, UIComponent label, UIComponent component)
+ {
+ component.getAttributes().put(
+ DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
+
+ UIColumn column = new UIColumn();
+ column.getChildren().add(component);
+ column.setHeader(label);
+
+ int addPos = -1;
+ UIComponent dataIndicator = this.destCmp.findComponent("data");
+ if (dataIndicator != null)
+ {
+ addPos = this.destCmp.getChildren().indexOf(dataIndicator);
+ }
+
+ if (addPos > -1)
+ {
+ this.destCmp.getChildren().add(addPos, column);
+ }
+ else
+ {
+ this.destCmp.getChildren().add(column);
+ }
+ }
+ }
+
+ protected static class AddComponentSimple implements NewComponentListener
+ {
+ private final UIComponent destCmp;
+
+ protected AddComponentSimple(UIComponent component)
+ {
+ super();
+ this.destCmp = component;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void newComponent(String fieldName, UIComponent label, UIComponent component)
+ {
+ component.getAttributes().put(
+ DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
+
+ this.destCmp.getChildren().add(label);
+ this.destCmp.getChildren().add(component);
+ }
+ }
+
+ @Override
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+ /**
+ * on create view or in development mode this will build the component tree
+ */
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException
+ {
+ super.encodeBegin(context, component);
+
+ DynaForm dynaForm = (DynaForm) component;
+
+ UIComponent layoutComponent = findLayoutComponent(dynaForm);
+ ViewType viewType = getViewType(layoutComponent);
+
+ // create & add components
+ boolean needAdd = processPreviouslyAdded(context, layoutComponent);
+ if (needAdd)
+ {
+ addComponents(context, dynaForm, layoutComponent, viewType);
+ }
+ }
+
+ /**
+ * determine the current view type
+ * <ul>
+ * <li>"list" means: the layout component "is a" or "is embedded in an" list component (UIData)</li>
+ * <li>"form" means: anything else</li>
+ * </ul>
+ */
+ protected ViewType getViewType(UIComponent startComponent)
+ {
+ UIComponent component = startComponent;
+ while (component != null && !(component instanceof DynaForm))
+ {
+ if (isTable(component))
+ {
+ return ViewType.LIST;
+ }
+
+ component = component.getParent();
+ }
+
+ return ViewType.FORM;
+ }
+
+ protected UIComponent findLayoutComponent(DynaForm dynaForm)
+ {
+ UIComponent layoutComponent = findComponentEx(dynaForm, dynaForm.getVar() + "-layout");
+ if (layoutComponent == null)
+ {
+ throw new IllegalStateException("DynaForm '" + dynaForm.getId()
+ + "' has no layout component (id=\"layout\")");
+ }
+ return layoutComponent;
+ }
+
+ /**
+ * find a component "by id" by simply traversing the tree
+ */
+ protected UIComponent findComponentEx(UIComponent base, String id)
+ {
+ if (id.equals(base.getId()))
+ {
+ return base;
+ }
+
+ Iterator iterChildren = base.getFacetsAndChildren();
+ while (iterChildren.hasNext())
+ {
+ UIComponent child = (UIComponent) iterChildren.next();
+ UIComponent found = findComponentEx(child, id);
+ if (found != null)
+ {
+ return found;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * collect all input components recursiv starting with <code>component</code>
+ */
+ protected void collectInputComponents(List<UIInput> components, UIComponent baseComponent)
+ {
+ if (baseComponent instanceof UIInput)
+ {
+ components.add((UIInput) baseComponent);
+ }
+
+ if (baseComponent.getChildren() == null)
+ {
+ return;
+ }
+
+ for (Object component : baseComponent.getChildren())
+ {
+ UIComponent componentChild = (UIComponent) component;
+ collectInputComponents(components, componentChild);
+ }
+ }
+
+ /**
+ * create and add the components to the layout component
+ */
+ protected void addComponents(final FacesContext context,
+ final DynaForm dynaForm, final UIComponent layoutComponent,
+ final ViewType viewType)
+ {
+ MetaData metaData = extractMetaData(dynaForm);
+
+ Slipstream slipstream = new Slipstream();
+ slipstream.setModelMetaData(metaData);
+ slipstream.setDisplayOnly(dynaForm.isDisplayOnly());
+
+ if (dynaForm.getBundle() != null)
+ {
+ // get the bundle and attach it
+ Map bundleMap = (Map) context.getApplication().createValueBinding("#{" + dynaForm.getBundle() + "}").getValue(context);
+ slipstream.setLabelBundle(bundleMap);
+ }
+
+ JsfGuiBuilder guiBuilder = createGuiBuilder(context);
+
+ guiBuilder.setContext(context);
+ guiBuilder.setBackingBeanPrefix(dynaForm.getVar());
+
+ if (isTable(layoutComponent))
+ {
+ guiBuilder.setNewComponentListener(new AddComponentToTable(layoutComponent));
+ }
+ else
+ {
+ guiBuilder.setNewComponentListener(new AddComponentSimple(layoutComponent));
+ }
+
+ String valueBindingPrefix = getValueBindingPrefix(dynaForm, layoutComponent);
+ if (valueBindingPrefix == null)
+ {
+ throw new UnsupportedOperationException("can't determine the value binding prefix");
+ }
+ guiBuilder.setBackingEntityPrefix(valueBindingPrefix);
+
+ slipstream.setGuiBuilder(guiBuilder);
+ slipstream.process();
+ }
+
+ private boolean isTable(UIComponent layoutComponent)
+ {
+ return layoutComponent instanceof UIData || UIData.COMPONENT_FAMILY.equals(layoutComponent.getFamily());
+ }
+
+ protected String getValueBindingPrefix(DynaForm dynaForm, UIComponent layoutComponent)
+ {
+ String valueBindingPrefix = dynaForm.getValueBindingPrefix();
+ if (valueBindingPrefix == null)
+ {
+ valueBindingPrefix = (String) layoutComponent.getAttributes().get("var");
+ }
+
+ return valueBindingPrefix;
+ }
+
+ private MetaData extractMetaData(final DynaForm dynaForm)
+ {
+ MetaData metaData = new MetaData();
+
+ try
+ {
+ // lookup which fields to process
+ new JsfRequestFieldExtractor().getMetaData(metaData, dynaForm);
+
+ if (dynaForm.isExclusiveFields())
+ {
+ // the same as above, but keep their ordering and some additional metadata
+ new JsfExclusiveExtractor().getMetaData(metaData, dynaForm);
+ metaData.setLockFields(true);
+ }
+
+ // use the users extractor
+ dynaForm.getExtractor().getMetaData(metaData, dynaForm.getConfiguration().getEntity());
+
+ // processs the jsf stuff
+ new JsfExtractor().getMetaData(metaData, dynaForm);
+
+ }
+ finally
+ {
+ metaData.setLockFields(false);
+ }
+
+ return metaData;
+ }
+
+ protected JsfGuiBuilder createGuiBuilder(final FacesContext facesContext)
+ {
+ return JsfGuiBuilderFactory.create(facesContext);
+ }
+
+ /**
+ * check if we already added components to the layout component.<br />
+ * <p/>
+ * if this is the case then:
+ * <ul>
+ * <li>keep them cached and avoid readd</li>
+ * <li><strike>in development mode: remove the components</strike></li>
+ * <li><strike>in production mode: keep them cached</strike></li>
+ * </ul>
+ * <p/>
+ * TODO: need to figure out whats the best way to recreate the components
+ *
+ * @return true if we have to add our components again
+ */
+ protected boolean processPreviouslyAdded(FacesContext context,
+ UIComponent root)
+ {
+ List rootComponentChildren = root.getChildren();
+ if (rootComponentChildren != null)
+ {
+ for (Object component : rootComponentChildren)
+ {
+ UIComponent child = (UIComponent) component;
+ if (Boolean.TRUE.equals(child.getAttributes().get(
+ DynaForm.DYNA_FORM_CREATED)))
+ {
+ return false;
+ }
+
+ if (!processPreviouslyAdded(context, child))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException
+ {
+ // TODO: remove this (and maybe the method at all) afer myfaces > 1.1.1
+ // is out ==>
+ ComponentUtils.renderChildren(context, component);
+ // TODO: remove this afer myfaces > 1.1.1 is out <==
+ }
+}
\ No newline at end of file
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormRenderer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormRenderer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormTag.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormTag.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormTag.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormTag.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,162 @@
+/*
+ * 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.myfaces.fusion.dynaForm.component.dynaForm;
+
+import org.apache.myfaces.shared_fusion.taglib.UIComponentBodyTagBase;
+
+import javax.faces.component.UIComponent;
+
+public class DynaFormTag extends UIComponentBodyTagBase
+{
+ private String uri;
+ private String var;
+ private String valueBindingPrefix;
+ private String displayOnly;
+ private String bundle;
+ private String exclusiveFields;
+
+ public void release()
+ {
+ super.release();
+
+ uri = null;
+ var = null;
+ displayOnly = null;
+ bundle = null;
+ exclusiveFields = null;
+ valueBindingPrefix = null;
+ }
+
+ protected void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setStringProperty(component, "uri", uri);
+ setStringProperty(component, "var", var);
+ setStringProperty(component, "valueBindingPrefix", valueBindingPrefix);
+ setBooleanProperty(component, "displayOnly", displayOnly);
+ setStringProperty(component, "bundle", bundle);
+ setBooleanProperty(component, "exclusiveFields", exclusiveFields);
+ }
+
+ /**
+ * @see org.apache.myfaces.fusion.dynaForm.component.dynaForm.DynaForm#setUri(String)
+ */
+ public String getUri()
+ {
+ return uri;
+ }
+
+ /**
+ * @see org.apache.myfaces.fusion.dynaForm.component.dynaForm.DynaForm#setUri(String)
+ */
+ public void setUri(String uri)
+ {
+ this.uri = uri;
+ }
+
+ /**
+ * @see DynaForm#setVar(String)
+ */
+ public String getVar()
+ {
+ return var;
+ }
+
+ /**
+ * @see DynaForm#setVar(String)
+ */
+ public void setVar(String var)
+ {
+ this.var = var;
+ }
+
+ /**
+ * @see DynaForm#setDisplayOnly(boolean)
+ */
+ public String getDisplayOnly()
+ {
+ return displayOnly;
+ }
+
+ /**
+ * @see DynaForm#setDisplayOnly(boolean)
+ */
+ public void setDisplayOnly(String displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ /**
+ * @see DynaForm#setBundle(String)
+ */
+ public String getBundle()
+ {
+ return bundle;
+ }
+
+ /**
+ * @see DynaForm#setBundle(String)
+ */
+ public void setBundle(String bundle)
+ {
+ this.bundle = bundle;
+ }
+
+ /**
+ * @see DynaForm#setExclusiveFields(boolean)
+ */
+ public String getExclusiveFields()
+ {
+ return exclusiveFields;
+ }
+
+ /**
+ * @see DynaForm#setExclusiveFields(boolean)
+ */
+ public void setExclusiveFields(String exclusiveFields)
+ {
+ this.exclusiveFields = exclusiveFields;
+ }
+
+ /**
+ * @see DynaForm#setValueBindingPrefix(String)
+ */
+ public String getValueBindingPrefix()
+ {
+ return valueBindingPrefix;
+ }
+
+ /**
+ * @see DynaForm#setValueBindingPrefix(String)
+ */
+ public void setValueBindingPrefix(String valueBindingPrefix)
+ {
+ this.valueBindingPrefix = valueBindingPrefix;
+ }
+
+ public String getComponentType()
+ {
+ return DynaForm.COMPONENT_TYPE;
+ }
+
+ public String getRendererType()
+ {
+ return DynaForm.DEFAULT_RENDERER_TYPE;
+ }
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormTag.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/component/dynaForm/DynaFormTag.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/ComponentEnum.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/ComponentEnum.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/ComponentEnum.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/ComponentEnum.java Thu Feb 22 09:25:41 2007
@@ -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.myfaces.fusion.dynaForm.guiBuilder;
+
+public enum ComponentEnum
+{
+ Automatic,
+ OutputText,
+ InputText,
+ InputDate,
+ SelectOneMenu,
+ // SelectSearchMenu,
+ InputNumber,
+ InputBoolean
+}
\ No newline at end of file
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/ComponentEnum.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/ComponentEnum.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/ComponentEnum.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/GuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/GuiBuilder.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/GuiBuilder.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/GuiBuilder.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,223 @@
+/*
+ * 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.myfaces.fusion.dynaForm.guiBuilder;
+
+import org.apache.myfaces.fusion.dynaForm.metadata.FieldInterface;
+import org.apache.myfaces.fusion.dynaForm.metadata.RelationType;
+import org.apache.myfaces.fusion.dynaForm.metadata.utils.TypeInfos;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * The interface to the gui builder which creates all needed gui elements.<br />
+ * You have implement each of them.
+ */
+public abstract class GuiBuilder
+{
+ private boolean displayOnly;
+ private Map labelBundle;
+
+ /**
+ * @see #setDisplayOnly(boolean)
+ */
+ public boolean isDisplayOnly()
+ {
+ return displayOnly;
+ }
+
+ /**
+ * set if the guiBuilder should build a read only form only
+ */
+ public void setDisplayOnly(boolean displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ /**
+ * @see #setLabelBundle(Map)
+ */
+ public Map getLabelBundle()
+ {
+ return labelBundle;
+ }
+
+ /**
+ * the bundle to use with labels
+ */
+ public void setLabelBundle(Map labelBundle)
+ {
+ this.labelBundle = labelBundle;
+ }
+
+ /**
+ * output text using the field as value provider
+ */
+ public abstract void createOutputText(FieldInterface field);
+
+ /**
+ * input field
+ */
+ public abstract void createInputText(FieldInterface field);
+
+ /**
+ * input date
+ */
+ public abstract void createInputDate(FieldInterface field);
+
+ /**
+ * select one menu
+ */
+ public abstract void createSelectOneMenu(FieldInterface field);
+
+ /**
+ * enter a number
+ */
+ public abstract void createInputNumber(FieldInterface field);
+
+ /**
+ * select a boolean
+ */
+ public abstract void createInputBoolean(FieldInterface field);
+
+ /**
+ * search for component
+ */
+ public abstract void createSearchFor(FieldInterface field);
+
+ /**
+ * search for component
+ */
+ public abstract void createSearchForSelectMenu(FieldInterface field);
+
+ // public abstract void createSearchForSelectMenu(FieldInterface field);
+
+ /**
+ * this is when the user passed in a component to use for the this field
+ */
+ public abstract void createNative(FieldInterface field);
+
+ /**
+ * actuallly build the fields gui component
+ */
+ protected boolean buildField(FieldInterface field)
+ {
+ Class fieldType = field.getType();
+
+ if (field.getWantedComponent() != null)
+ {
+ createNative(field);
+ return true;
+ }
+
+ if (!field.getWantedComponentType().equals(ComponentEnum.Automatic))
+ {
+ switch (field.getWantedComponentType())
+ {
+ case OutputText:
+ createOutputText(field);
+ return true;
+
+ case InputText:
+ createInputText(field);
+ return true;
+
+ case InputDate:
+ createInputDate(field);
+ return true;
+
+ case SelectOneMenu:
+ if (RelationType.MANY_TO_ONE.equals(field.getRelationType()))
+ {
+ createSearchForSelectMenu(field);
+ }
+ else
+ {
+ // TODO: will not work now
+ createSelectOneMenu(field);
+ }
+ return true;
+
+ /*
+ case SelectSearchMenu:
+ createSearchForSelectMenu(field);
+ return true;
+ */
+
+ case InputNumber:
+ createInputNumber(field);
+ return true;
+
+ case InputBoolean:
+ createInputBoolean(field);
+ return true;
+ }
+ }
+
+ if (Boolean.TRUE.equals(field.getDisplayOnly()))
+ {
+ createOutputText(field);
+ return true;
+ }
+
+ if (field.getAllowedSelections() != null)
+ {
+ createSelectOneMenu(field);
+ return true;
+ }
+
+ if (RelationType.MANY_TO_ONE.equals(field.getRelationType()))
+ {
+ createSearchFor(field);
+ return true;
+ }
+
+ if (fieldType == null)
+ {
+ throw new IllegalArgumentException("No type for field '" + field.getName() + "' detected.");
+ }
+
+ if (Date.class.isAssignableFrom(fieldType))
+ {
+ createInputDate(field);
+ return true;
+ }
+
+ TypeInfos.Info typeInfo = TypeInfos.getInfo(fieldType);
+ if (typeInfo != null && typeInfo.isNumber())
+ {
+ createInputNumber(field);
+ return true;
+ }
+
+ if (String.class.isAssignableFrom(fieldType))
+ {
+ createInputText(field);
+ return true;
+ }
+
+ if (Boolean.class.isAssignableFrom(fieldType) || boolean.class.equals(fieldType))
+ {
+ createInputBoolean(field);
+ return true;
+ }
+
+ return false;
+ }
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/GuiBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/GuiBuilder.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/GuiBuilder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/Slipstream.java
URL: http://svn.apache.org/viewvc/myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/Slipstream.java?view=auto&rev=510598
==============================================================================
--- myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/Slipstream.java (added)
+++ myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/Slipstream.java Thu Feb 22 09:25:41 2007
@@ -0,0 +1,102 @@
+/*
+ * 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.myfaces.fusion.dynaForm.guiBuilder;
+
+import org.apache.myfaces.fusion.dynaForm.metadata.FieldInterface;
+import org.apache.myfaces.fusion.dynaForm.metadata.MetaDataInterface;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * The slipstream will bring the configuration-metaData/gui together
+ */
+public class Slipstream
+{
+ private boolean displayOnly;
+ private MetaDataInterface modelMetaData;
+ private GuiBuilder guiBuilder;
+ private Map labelBundle;
+
+ public Slipstream()
+ {
+ }
+
+ public boolean isDisplayOnly()
+ {
+ return displayOnly;
+ }
+
+ public void setDisplayOnly(boolean displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ public MetaDataInterface getModelMetaData()
+ {
+ return modelMetaData;
+ }
+
+ public void setModelMetaData(MetaDataInterface modelMetaData)
+ {
+ this.modelMetaData = modelMetaData;
+ }
+
+ public GuiBuilder getGuiBuilder()
+ {
+ return guiBuilder;
+ }
+
+ public void setGuiBuilder(GuiBuilder guiBuilder)
+ {
+ this.guiBuilder = guiBuilder;
+ }
+
+ public Map getLabelBundle()
+ {
+ return labelBundle;
+ }
+
+ public void setLabelBundle(Map labelBundle)
+ {
+ this.labelBundle = labelBundle;
+ }
+
+ public void process()
+ {
+ configureGuiBuilder();
+
+ MetaDataInterface metaData = modelMetaData;
+ Iterator<String> iterFieldNames = metaData.iterFieldNames();
+ while (iterFieldNames.hasNext())
+ {
+ String fieldName = iterFieldNames.next();
+ FieldInterface field = modelMetaData.getField(fieldName);
+
+ guiBuilder.buildField(field);
+ }
+ }
+
+ protected void configureGuiBuilder()
+ {
+ guiBuilder.setDisplayOnly(isDisplayOnly());
+ guiBuilder.setLabelBundle(getLabelBundle());
+ }
+
+}
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/Slipstream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/Slipstream.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/fusion/trunk/core15/src/main/java/org/apache/myfaces/fusion/dynaForm/guiBuilder/Slipstream.java
------------------------------------------------------------------------------
svn:mime-type = text/plain