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 2006/10/17 20:00:22 UTC
svn commit: r464981 - in /myfaces/tomahawk/trunk/sandbox15:
core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/
core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/
core/src/main/java/org/apache/myfaces/custom/dynaForm/component...
Author: imario
Date: Tue Oct 17 11:00:21 2006
New Revision: 464981
URL: http://svn.apache.org/viewvc?view=rev&rev=464981
Log:
added a "customized property" sample - customization through the view (jsp here) - uses inputHtml instead of inputText
added a "relation bean" sample - manyToOne to another bean using a drop-down list or ajax suggest, though, the ajax suggest stuff is not working yet due to a limitation in the used component, should get fixed soon
Added:
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java (with props)
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java (with props)
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java (with props)
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java (with props)
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java (contents, props changed)
- copied, changed from r464398, myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/MartialStatus.java
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java (contents, props changed)
- copied, changed from r464398, myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBean.java
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java (with props)
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java (with props)
myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties (contents, props changed)
- copied, changed from r464398, myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/simpleBean_messages.properties
myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp (with props)
Removed:
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/MartialStatus.java
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBean.java
myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/simpleBean_messages.properties
Modified:
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaForm.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaFormRenderer.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/ComponentEnum.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/GuiBuilder.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java
myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/EjbExtractor.java
myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBeanBacking.java
myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/WEB-INF/examples-config.xml
myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/customizedSimpleBean.jsp
myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/home.jsp
myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/simpleBean.jsp
Added: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java?view=auto&rev=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java (added)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java Tue Oct 17 11:00:21 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.custom.dynaForm.annot.jsf;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * setup a converter. <br />
+ * converterId and converterClass are mutually exclusive
+ */
+@Target(value={ElementType.METHOD, ElementType.FIELD})
+@Retention(value= RetentionPolicy.RUNTIME)
+public @interface Converter
+{
+ /**
+ * attach a converter by its id
+ */
+ String converterId() default "";
+
+ /**
+ * attach a converter by its class
+ */
+ Class converterClass() default Void.class;
+}
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/jsf/Converter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java?view=auto&rev=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java (added)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java Tue Oct 17 11:00:21 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.custom.dynaForm.annot.ui;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * 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/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/annot/ui/DataProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaForm.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaForm.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaForm.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaForm.java Tue Oct 17 11:00:21 2006
@@ -268,16 +268,6 @@
}
/**
- * we need to inject our "var" early in decoding phase
- */
- public void processDecodes(FacesContext context)
- {
- ((DynaFormRenderer) getRenderer(context)).processDecodes(context, this);
-
- super.processDecodes(context);
- }
-
- /**
* Find the dynaForm component
*/
public static DynaForm getDynaForm(UIComponent component)
@@ -318,7 +308,7 @@
return formConfigs;
}
}
-
+
return null;
}
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaFormRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaFormRenderer.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaFormRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/component/dynaForm/DynaFormRenderer.java Tue Oct 17 11:00:21 2006
@@ -21,7 +21,6 @@
import org.apache.myfaces.custom.dynaForm.guiBuilder.impl.jsf.NewComponentListener;
import org.apache.myfaces.custom.dynaForm.jsfext.ComponentUtils;
import org.apache.myfaces.custom.dynaForm.lib.ViewType;
-import org.apache.myfaces.custom.dynaForm.metadata.FieldInterface;
import org.apache.myfaces.custom.dynaForm.metadata.MetaData;
import org.apache.myfaces.custom.dynaForm.metadata.impl.jsf.JsfExclusiveExtractor;
import org.apache.myfaces.custom.dynaForm.metadata.impl.jsf.JsfExtractor;
@@ -34,8 +33,6 @@
import javax.faces.context.FacesContext;
import javax.faces.render.Renderer;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -114,17 +111,6 @@
}
/**
- * pre decode - early inject var to make children happy
- */
- public void processDecodes(FacesContext context, DynaForm dynaForm)
- {
- UIComponent layoutComponent = findLayoutComponent(dynaForm);
- ViewType viewType = getViewType(layoutComponent);
-
- injectVar(context, dynaForm, layoutComponent, viewType);
- }
-
- /**
* on create view or in development mode this will build the component tree
*/
@Override
@@ -144,23 +130,6 @@
{
addComponents(context, dynaForm, layoutComponent, viewType);
}
-
- injectVar(context, dynaForm, layoutComponent, viewType);
- }
-
- protected FieldInterface getFieldMetaData(final DynaForm dynaForm, String propertyName)
- {
- MetaData metaData = new MetaData();
-
- // we are only interested in the property we are configured for
- metaData.requestField(propertyName);
- MetaData.FieldImpl field = metaData.getOrCreateField(propertyName);
- metaData.setLockFields(true);
-
- // use the users extractor
- dynaForm.getExtractor().getMetaData(metaData, dynaForm.getConfiguration().getEntity());
-
- return field;
}
/**
@@ -219,37 +188,6 @@
}
return null;
- }
-
- /**
- * provide access to the form controller
- */
- @SuppressWarnings("unchecked")
- protected void injectVar(FacesContext context, DynaForm dynaForm,
- UIComponent layoutComponent, ViewType viewType)
- {
- // todo: what todo?
- }
-
- /**
- * get rid of var again
- */
- protected void removeVar(FacesContext context, DynaForm dynaForm)
- {
- context.getExternalContext().getRequestMap().remove(
- dynaForm.getVar());
- }
-
- /**
- * collect all input components within our layout component
- */
- protected List<UIInput> getInputComponents(UIComponent layoutComponent)
- {
- List<UIInput> ret = new ArrayList<UIInput>(30);
-
- collectInputComponents(ret, layoutComponent);
-
- return Collections.unmodifiableList(ret);
}
/**
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/ComponentEnum.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/ComponentEnum.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/ComponentEnum.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/ComponentEnum.java Tue Oct 17 11:00:21 2006
@@ -22,7 +22,7 @@
InputText,
InputDate,
SelectOneMenu,
- SelectSearchMenu,
+ // SelectSearchMenu,
InputNumber,
- InputBoolean
+ InputBoolean
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/GuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/GuiBuilder.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/GuiBuilder.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/GuiBuilder.java Tue Oct 17 11:00:21 2006
@@ -98,8 +98,13 @@
*/
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
*/
@@ -117,7 +122,7 @@
createNative(field);
return true;
}
-
+
if (!field.getWantedComponentType().equals(ComponentEnum.Automatic))
{
switch(field.getWantedComponentType())
@@ -125,15 +130,15 @@
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()))
{
@@ -145,16 +150,18 @@
createSelectOneMenu(field);
}
return true;
-
+
+ /*
case SelectSearchMenu:
createSearchForSelectMenu(field);
return true;
-
+ */
+
case InputNumber:
createInputNumber(field);
return true;
-
- case InputBoolean:
+
+ case InputBoolean:
createInputBoolean(field);
return true;
}
@@ -182,7 +189,7 @@
{
throw new IllegalArgumentException("No type for field '" + field.getName() + "' detected.");
}
-
+
if (Date.class.isAssignableFrom(fieldType))
{
createInputDate(field);
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilder.java Tue Oct 17 11:00:21 2006
@@ -16,13 +16,13 @@
package org.apache.myfaces.custom.dynaForm.guiBuilder.impl.jsf;
import org.apache.myfaces.custom.dynaForm.guiBuilder.GuiBuilder;
-import org.apache.myfaces.custom.dynaForm.lib.SelectionSourceEnum;
-import org.apache.myfaces.custom.dynaForm.lib.ObjectSerializationConverter;
import org.apache.myfaces.custom.dynaForm.metadata.FieldInterface;
import org.apache.myfaces.custom.dynaForm.metadata.Selection;
import org.apache.myfaces.custom.dynaForm.metadata.utils.TypeInfos;
+import org.apache.myfaces.custom.dynaForm.lib.ObjectSerializationConverter;
import javax.faces.FacesException;
+import javax.faces.el.MethodBinding;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
@@ -40,27 +40,27 @@
import javax.faces.component.html.HtmlSelectManyListbox;
import javax.faces.component.html.HtmlSelectOneMenu;
import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.DateTimeConverter;
+import javax.faces.convert.BigDecimalConverter;
+import javax.faces.convert.BigIntegerConverter;
import javax.faces.convert.BooleanConverter;
-import javax.faces.convert.CharacterConverter;
import javax.faces.convert.ByteConverter;
-import javax.faces.convert.ShortConverter;
+import javax.faces.convert.CharacterConverter;
+import javax.faces.convert.Converter;
+import javax.faces.convert.DateTimeConverter;
+import javax.faces.convert.FloatConverter;
import javax.faces.convert.IntegerConverter;
import javax.faces.convert.LongConverter;
-import javax.faces.convert.FloatConverter;
import javax.faces.convert.NumberConverter;
-import javax.faces.convert.BigIntegerConverter;
-import javax.faces.convert.BigDecimalConverter;
+import javax.faces.convert.ShortConverter;
import javax.faces.event.ActionEvent;
import javax.faces.validator.DoubleRangeValidator;
import javax.faces.validator.LengthValidator;
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-import java.util.Date;
/**
* concrete gui builder which knows how to build JSF forms
@@ -237,6 +237,23 @@
fireNewComponent(field, cmp);
}
+ /*
+ @Override
+ public void createSearchForSelectMenu(FieldInterface field)
+ {
+ UIComponent cmp;
+ if (!isDisplayOnly())
+ {
+ cmp = doCreateSearchForSelectMenu(field);
+ }
+ else
+ {
+ cmp = doCreateOutputText(field);
+ }
+ fireNewComponent(field, cmp);
+ }
+ */
+
@Override
public void createNative(FieldInterface field)
{
@@ -335,37 +352,50 @@
public Converter doCreateConverter(FieldInterface field)
{
- Class type = field.getType();
+ if (field.getConverterClass() != null)
+ {
+ return context.getApplication().createConverter(field.getConverterClass());
+ }
+ if (field.getConverterId() != null)
+ {
+ return context.getApplication().createConverter(field.getConverterId());
+ }
- if (Boolean.class.isAssignableFrom(type))
+ Class type = field.getType();
+ if (type == null)
+ {
+ return null;
+ }
+
+ if (Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type))
{
return context.getApplication().createConverter(BooleanConverter.CONVERTER_ID);
}
- if (Character.class.isAssignableFrom(type))
+ if (Character.class.isAssignableFrom(type) || char.class.isAssignableFrom(type))
{
return context.getApplication().createConverter(CharacterConverter.CONVERTER_ID);
}
- if (Byte.class.isAssignableFrom(type))
+ if (Byte.class.isAssignableFrom(type) || byte.class.isAssignableFrom(type))
{
return context.getApplication().createConverter(ByteConverter.CONVERTER_ID);
}
- if (Short.class.isAssignableFrom(type))
+ if (Short.class.isAssignableFrom(type) || short.class.isAssignableFrom(type))
{
return context.getApplication().createConverter(ShortConverter.CONVERTER_ID);
}
- if (Integer.class.isAssignableFrom(type))
+ if (Integer.class.isAssignableFrom(type) || int.class.isAssignableFrom(type))
{
return context.getApplication().createConverter(IntegerConverter.CONVERTER_ID);
}
- if (Long.class.isAssignableFrom(type))
+ if (Long.class.isAssignableFrom(type) || long.class.isAssignableFrom(type))
{
return context.getApplication().createConverter(LongConverter.CONVERTER_ID);
}
- if (Float.class.isAssignableFrom(type))
+ if (Float.class.isAssignableFrom(type) || float.class.isAssignableFrom(type))
{
return context.getApplication().createConverter(FloatConverter.CONVERTER_ID);
}
- if (Double.class.isAssignableFrom(type))
+ if (Double.class.isAssignableFrom(type) || double.class.isAssignableFrom(type))
{
// use the number converter to have locale sensitive input
return context.getApplication().createConverter(NumberConverter.CONVERTER_ID);
@@ -516,8 +546,10 @@
}
@SuppressWarnings("unchecked")
- public HtmlPanelGroup doCreateSearchFor(FieldInterface field)
+ public UIComponent doCreateSearchFor(FieldInterface field)
{
+ throw new UnsupportedOperationException();
+ /*
HtmlPanelGroup panel = doCreatePanelGroupComponent();
HtmlCommandLink command = doCreateCommandLink(field);
@@ -546,6 +578,7 @@
panel.setId("pnl_" + command.getId());
return panel;
+ */
}
@SuppressWarnings("unchecked")
@@ -562,6 +595,7 @@
select = doCreateSelectManyListbox(field);
}
+ /*
SelectionSourceEnum selectionSource;
if (field.isEntityType())
{
@@ -579,26 +613,29 @@
{
throw new IllegalArgumentException("cant use selectionSource 'relation' for property " + field.getName());
}
+ */
- String itemSource;
- String itemSourceName;
- switch (selectionSource)
- {
- case manual:
- itemSource=null;
- itemSourceName=null;
- break;
- case relation:
- itemSource="relationValues";
- itemSourceName=field.getType().getName();
- break;
- case distinct:
- itemSource="distinctValues";
- itemSourceName=field.getName();
- break;
- default:
- throw new IllegalArgumentException("dont know how to handle selectionSource: " + field.getSelectionSource());
- }
+ /*
+ String itemSource;
+ String itemSourceName;
+ switch (selectionSource)
+ {
+ case manual:
+ itemSource=null;
+ itemSourceName=null;
+ break;
+ case relation:
+ itemSource="relationValues";
+ itemSourceName=field.getType().getName();
+ break;
+ case distinct:
+ itemSource="distinctValues";
+ itemSourceName=field.getName();
+ break;
+ default:
+ throw new IllegalArgumentException("dont know how to handle selectionSource: " + field.getSelectionSource());
+ }
+ */
if (!field.getAllowMultipleSelections() && !Boolean.TRUE.equals(field.getRequired()))
{
@@ -620,6 +657,19 @@
select.getChildren().add(item);
}
+ MethodBinding mbValues = context.getApplication().createMethodBinding(
+ field.getDataSource(),
+ new Class[]{String.class});
+ MethodBinding mbLabels = context.getApplication().createMethodBinding(
+ field.getDataSourceDescription(),
+ new Class[]{field.getType()});
+
+ UISelectItems items = new UISelectItems();
+ items.setValueBinding("value",
+ new ValueBindingDataSourceAdapter(mbValues, mbLabels));
+ select.getChildren().add(items);
+
+/*
if (itemSource != null)
{
UISelectItems items = new UISelectItems();
@@ -628,6 +678,7 @@
"#{" + backingBeanPrefix + "." + itemSource + "['" + itemSourceName + "']}"));
select.getChildren().add(items);
}
+*/
Converter converter;
/*
@@ -988,7 +1039,7 @@
// if there is no converter setup one now.
// we need this if the binding point to a map instead to a bean.
// For a map JSF cant determine the wanted value type
- if (cmp.getConverter() == null && field.getType() != null)
+ if (cmp.getConverter() == null)
{
Converter converter = doCreateConverter(field);
if (converter != null)
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java Tue Oct 17 11:00:21 2006
@@ -41,7 +41,7 @@
public class JsfGuiBuilderDecorator extends JsfGuiBuilder
{
private final JsfGuiBuilder original;
-
+
public JsfGuiBuilderDecorator(JsfGuiBuilder original)
{
this.original = original;
@@ -51,7 +51,7 @@
{
return original;
}
-
+
public void createInputBoolean(FieldInterface field)
{
original.createInputBoolean(field);
@@ -96,11 +96,13 @@
{
original.createSearchFor(field);
}
-
+
+ /*
public void createSearchForSelectMenu(FieldInterface field)
{
original.createSearchForSelectMenu(field);
}
+ */
public void createSelectOneMenu(FieldInterface field)
{
@@ -192,7 +194,7 @@
return original.doCreatePanelGroupComponent();
}
- public HtmlPanelGroup doCreateSearchFor(FieldInterface field)
+ public UIComponent doCreateSearchFor(FieldInterface field)
{
return original.doCreateSearchFor(field);
}
Added: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java?view=auto&rev=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java (added)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java Tue Oct 17 11:00:21 2006
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.custom.dynaForm.guiBuilder.impl.jsf;
+
+import javax.faces.el.ValueBinding;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.MethodBinding;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import java.util.Collection;
+
+/**
+ * wraps a datasource and presents it as selectItem list
+ */
+public class ValueBindingDataSourceAdapter extends ValueBinding implements StateHolder
+{
+ private MethodBinding mbValues;
+ private MethodBinding mbLabels;
+
+ private boolean _transient = false;
+
+ public ValueBindingDataSourceAdapter()
+ {
+ }
+
+ public ValueBindingDataSourceAdapter(MethodBinding mbValues, MethodBinding mbLabels)
+ {
+ this.mbValues = mbValues;
+ this.mbLabels = mbLabels;
+ }
+
+
+ @Override
+ public Class getType(FacesContext facesContext) throws EvaluationException, PropertyNotFoundException
+ {
+ return SelectItem[].class;
+ }
+
+ @Override
+ public Object getValue(FacesContext facesContext) throws EvaluationException, PropertyNotFoundException
+ {
+ Object valueList = mbValues.invoke(facesContext, new Object[]{null});
+ if (valueList == null)
+ {
+ return null;
+ }
+
+ if (valueList instanceof Collection)
+ {
+ Collection valueCollection = (Collection) valueList;
+
+ SelectItem[] selectItems = new SelectItem[valueCollection.size()];
+
+ int i = -1;
+ for (Object value : valueCollection)
+ {
+ i++;
+
+ String label = (String) mbLabels.invoke(facesContext, new Object[]
+ {
+ value
+ });
+
+ SelectItem si=new SelectItem(value, label);
+ selectItems[i] = si;
+ }
+
+ return selectItems;
+ }
+
+ throw new IllegalArgumentException("don't know how to access " + valueList.getClass().getName());
+ }
+
+ @Override
+ public boolean isReadOnly(FacesContext facesContext) throws EvaluationException, PropertyNotFoundException
+ {
+ return true;
+ }
+
+ @Override
+ public void setValue(FacesContext facesContext, Object object) throws EvaluationException, PropertyNotFoundException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object saveState(FacesContext facesContext)
+ {
+ return new Object[]
+ {
+ UIComponentBase.saveAttachedState(facesContext, mbValues),
+ UIComponentBase.saveAttachedState(facesContext, mbLabels),
+ };
+ }
+
+ public void restoreState(FacesContext facesContext, Object object)
+ {
+ Object[] states = (Object[]) object;
+ mbValues = (MethodBinding) UIComponentBase.restoreAttachedState(facesContext, states[0]);
+ mbLabels = (MethodBinding) UIComponentBase.restoreAttachedState(facesContext, states[1]);
+ }
+
+ public boolean isTransient()
+ {
+ return _transient;
+ }
+
+ public void setTransient(boolean flag)
+ {
+ _transient = flag;
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java Tue Oct 17 11:00:21 2006
@@ -19,13 +19,17 @@
import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlPanelGroup;
import javax.faces.convert.Converter;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
import javax.persistence.TemporalType;
import org.apache.myfaces.custom.dynaForm.guiBuilder.impl.jsf.JsfGuiBuilder;
import org.apache.myfaces.custom.dynaForm.metadata.FieldInterface;
+import org.apache.myfaces.custom.dynaForm.lib.ObjectSerializationConverter;
import org.apache.myfaces.custom.calendar.HtmlInputCalendar;
import org.apache.myfaces.custom.convertNumber.TypedNumberConverter;
+import org.apache.myfaces.custom.suggestajax.inputsuggestajax.InputSuggestAjax;
import java.math.BigDecimal;
@@ -50,6 +54,7 @@
|| double.class.isAssignableFrom(type)
|| BigDecimal.class.isAssignableFrom(type))
{
+ // use the super duper intelligent number converter
return getContext().getApplication().createConverter(TypedNumberConverter.CONVERTER_ID);
}
@@ -98,9 +103,77 @@
HtmlPanelGroup panel = doCreatePanelGroupComponent();
panel.setId("pnl_" + cmp.getId());
panel.getChildren().add(cmp);
- panel.setStyleClass("ff_nowrap");
+ panel.setStyle("white-space:nowrap;");
// <==
fireNewComponent(field, panel);
+ }
+
+ @Override
+ public UIComponent doCreateSearchFor(FieldInterface field)
+ {
+ HtmlPanelGroup panel = doCreatePanelGroupComponent();
+
+ InputSuggestAjax cmp = new InputSuggestAjax();
+ initInputDefaults(cmp, field);
+
+ String dataSource = field.getDataSource();
+ String dataSourceDescription = field.getDataSourceDescription();
+
+ MethodBinding mbSearch = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
+ dataSource,
+ new Class[]
+ {
+ String.class
+ });
+ MethodBinding mbLabel = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
+ dataSourceDescription,
+ new Class[]
+ {
+ field.getType()
+ });
+
+ cmp.setSuggestedItemsMethod(mbSearch);
+ //cmp.setSuggestedItemsLabel(mbLabel);
+
+ if (cmp.getConverter() == null)
+ {
+ cmp.setConverter(new ObjectSerializationConverter());
+ }
+
+ panel.getChildren().add(cmp);
+ return panel;
+
+ /*
+ HtmlPanelGroup panel = doCreatePanelGroupComponent();
+
+
+ HtmlCommandLink command = doCreateCommandLink(field);
+ // avoid duplicate id
+ command.setId("cmd_" + command.getId());
+ command.setValue("...");
+ command.setStyleClass("ff_searchLink");
+ command.setImmediate(true);
+
+ command.getChildren().add(
+ createParameter(SEARCH_ENTITY_TYPE, field.getType().getName()));
+ command.getChildren().add(
+ createParameter(SEARCH_ENTITY_BINDING,
+ createValueBindingString(field)));
+
+ Converter converter = context.getApplication().createConverter(field.getType());
+ HtmlOutputText text = doCreateOutputText(field);
+ if (converter != null)
+ {
+ text.setConverter(converter);
+ }
+ panel.getChildren().add(text);
+
+ panel.getChildren().add(command);
+
+ panel.setId("pnl_" + command.getId());
+
+ return panel;
+ */
}
}
Added: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java?view=auto&rev=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java (added)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java Tue Oct 17 11:00:21 2006
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.custom.dynaForm.guiBuilder.impl.myfaces;
+
+import org.apache.commons.beanutils.BeanUtils;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.MethodNotFoundException;
+import javax.faces.model.SelectItem;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Intercepts the method binding used to build the suggest selection list
+ */
+public class SuggestSelectListMethodWrapper extends MethodBinding
+{
+ private final MethodBinding original;
+ private final String valueProperty;
+ private final String[] descriptionPropertiesArray;
+
+ SuggestSelectListMethodWrapper(MethodBinding original, String valueProperty, String descriptionProperties)
+ {
+ this.original = original;
+ this.valueProperty = valueProperty;
+ if (descriptionProperties != null)
+ {
+ descriptionPropertiesArray = descriptionProperties.split(",\\s*");
+ }
+ else
+ {
+ descriptionPropertiesArray = new String[]{};
+ }
+ }
+
+ @Override
+ public Class getType(FacesContext facesContext) throws MethodNotFoundException
+ {
+ return List.class;
+ }
+
+ @Override
+ public Object invoke(FacesContext facesContext, Object[] objects) throws EvaluationException
+ {
+ Object items = original.invoke(facesContext, objects);
+ if (items == null)
+ {
+ return items;
+ }
+
+ if (!(items instanceof Collection))
+ {
+ throw new UnsupportedOperationException("unknown return type " + items.getClass().getName() + " for " + getExpressionString() + " awaited instanceof java.util.Collection");
+ }
+
+ Collection coll = (Collection) items;
+
+ List<SelectItem> selectItems = new ArrayList<SelectItem>(coll.size());
+ for (Object o : coll)
+ {
+ SelectItem si;
+
+ if (o instanceof SelectItem)
+ {
+ si = (SelectItem) o;
+ }
+ else
+ {
+ Object value = getValueProperty(o, valueProperty);
+ String description = buildDescription(o, descriptionPropertiesArray);
+
+ si = new SelectItem(value, description);
+ }
+
+ selectItems.add(si);
+ }
+
+ return selectItems;
+ }
+
+ protected String buildDescription(Object o, String[] descriptionPropertiesArray)
+ {
+ StringBuffer sb = new StringBuffer(80);
+
+ for (String descriptionProperty : descriptionPropertiesArray)
+ {
+ Object descriptionValue = null;
+ try
+ {
+ descriptionValue = BeanUtils.getProperty(o, descriptionProperty);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new EvaluationException(e);
+ }
+
+ if (descriptionValue != null)
+ {
+ if (sb.length() > 0)
+ {
+ sb.append(", ");
+ }
+
+ sb.append(descriptionValue);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ protected Object getValueProperty(Object o, String valueProperty)
+ {
+ if (valueProperty == null || valueProperty.trim().length() < 1)
+ {
+ return o;
+ }
+
+ try
+ {
+ return BeanUtils.getProperty(o, valueProperty);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new EvaluationException(e);
+ }
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java Tue Oct 17 11:00:21 2006
@@ -58,4 +58,9 @@
public TemporalType getTemporalType();
public boolean getAllowMultipleSelections();
public SelectionSourceEnum getSelectionSource();
+
+ public String getDataSource();
+ public String getDataSourceDescription();
+ public String getConverterId();
+ public Class getConverterClass();
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java Tue Oct 17 11:00:21 2006
@@ -48,29 +48,35 @@
private final String name;
private final String baseName;
private String preferredExternalName;
- private Class type = null;
- private boolean entityType = false;
- private Boolean canRead = null;
- private Boolean canWrite = null;
- private Boolean disabled = null;
- private Boolean displayOnly = null;
- private boolean required = false;
+ private Class type;
+ private boolean entityType;
+ private Boolean canRead;
+ private Boolean canWrite;
+ private Boolean disabled;
+ private Boolean displayOnly;
+ private boolean required;
private RelationType relationType = RelationType.NONE;
private boolean embedded = true;
- private Integer displaySize = null;
- private Integer minSize = null;
- private Integer maxSize = null;
- private Double minValue = null;
- private Double maxValue = null;
- private TemporalType temporalType = null;
-
- private Selection[] allowedSelection = null;
- private boolean allowMultipleSelections = false;
- private SelectionSourceEnum selectionSource = null;
+ private Integer displaySize;
+ private Integer minSize;
+ private Integer maxSize;
+ private Double minValue;
+ private Double maxValue;
+ private TemporalType temporalType;
+
+ private Selection[] allowedSelection;
+ private boolean allowMultipleSelections;
+ private SelectionSourceEnum selectionSource;
- private UIComponent wantedComponent = null;
+ private UIComponent wantedComponent;
private ComponentEnum wantedComponentType = ComponentEnum.Automatic;
+ private String dataSource;
+ private String dataSourceDescription;
+
+ private String converterId;
+ private Class converterClass;
+
protected FieldImpl(String name)
{
this.name = name;
@@ -324,6 +330,46 @@
public void setEmbedded(boolean embedded)
{
this.embedded = embedded;
+ }
+
+ public String getDataSource()
+ {
+ return dataSource;
+ }
+
+ public void setDataSource(String dataSource)
+ {
+ this.dataSource = dataSource;
+ }
+
+ public String getDataSourceDescription()
+ {
+ return dataSourceDescription;
+ }
+
+ public void setDataSourceDescription(String dataSourceDescription)
+ {
+ this.dataSourceDescription = dataSourceDescription;
+ }
+
+ public String getConverterId()
+ {
+ return converterId;
+ }
+
+ public void setConverterId(String converterId)
+ {
+ this.converterId = converterId;
+ }
+
+ public Class getConverterClass()
+ {
+ return converterClass;
+ }
+
+ public void setConverterClass(Class converterClass)
+ {
+ this.converterClass = converterClass;
}
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/EjbExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/EjbExtractor.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/EjbExtractor.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/EjbExtractor.java Tue Oct 17 11:00:21 2006
@@ -52,6 +52,7 @@
import org.apache.myfaces.custom.dynaForm.annot.ui.Range;
import org.apache.myfaces.custom.dynaForm.annot.ui.NotNull;
import org.apache.myfaces.custom.dynaForm.annot.ui.Length;
+import org.apache.myfaces.custom.dynaForm.annot.ui.DataProvider;
import org.apache.myfaces.custom.dynaForm.metadata.Extractor;
import org.apache.myfaces.custom.dynaForm.metadata.MetaData;
import org.apache.myfaces.custom.dynaForm.metadata.RelationType;
@@ -479,6 +480,12 @@
if (accessibleObject.isAnnotationPresent(ManyToMany.class))
{
mdField.setRelationType(RelationType.MANY_TO_MANY);
+ }
+ if (accessibleObject.isAnnotationPresent(DataProvider.class))
+ {
+ DataProvider dataProvider = accessibleObject.getAnnotation(DataProvider.class);
+ mdField.setDataSource(dataProvider.value());
+ mdField.setDataSourceDescription(dataProvider.description());
}
// get Temporal from model ...
Modified: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBeanBacking.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBeanBacking.java?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBeanBacking.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBeanBacking.java Tue Oct 17 11:00:21 2006
@@ -15,14 +15,18 @@
*/
package org.apache.myfaces.examples.dynaForm;
+import org.apache.myfaces.examples.dynaForm.lib.Person;
+import org.apache.myfaces.examples.dynaForm.lib.PersonRelation;
+
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
public class SimpleBeanBacking
{
- private SimpleBean simpleBean;
- private List<SimpleBean> simpleBeans;
+ private PersonRelation personRelation;
+ private Person person;
+ private List<Person> persons;
public SimpleBeanBacking()
{
@@ -31,41 +35,56 @@
protected void initBean()
{
- simpleBean = new SimpleBean();
+ person = new Person();
+ person.setId(666L);
- SimpleBean s1 = new SimpleBean();
- s1.setCheckedData(true);
+ Person s1 = new Person();
+ s1.setId(4711L);
+ s1.setCheckedData(true);
s1.setCreationDate(new Date());
s1.setAge(1L);
- s1.setUser("bean 1");
- SimpleBean s2 = new SimpleBean();
- s2.setCheckedData(true);
+ s1.setUserName("bean 1");
+ Person s2 = new Person();
+ s2.setId(815L);
+ s2.setCheckedData(true);
s2.setCreationDate(new Date());
s2.setAge(2L);
- s2.setUser("bean 2");
+ s2.setUserName("bean 2");
- simpleBeans = new ArrayList<SimpleBean>();
- simpleBeans.add(s1);
- simpleBeans.add(s2);
- }
+ persons = new ArrayList<Person>();
+ persons.add(s1);
+ persons.add(s2);
+
+ personRelation = new PersonRelation();
+ }
- public SimpleBean getSimpleBean()
+ public Person getPerson()
{
- return simpleBean;
+ return person;
}
- public void setSimpleBean(SimpleBean simpleBean)
+ public void setPerson(Person person)
{
- this.simpleBean = simpleBean;
+ this.person = person;
}
- public List<SimpleBean> getSimpleBeans()
+ public List<Person> getPersons()
{
- return simpleBeans;
+ return persons;
}
- public void setSimpleBeans(List<SimpleBean> simpleBeans)
+ public void setPersons(List<Person> persons)
{
- this.simpleBeans = simpleBeans;
- }
+ this.persons = persons;
+ }
+
+ public PersonRelation getPersonRelation()
+ {
+ return personRelation;
+ }
+
+ public void setPersonRelation(PersonRelation personRelation)
+ {
+ this.personRelation = personRelation;
+ }
}
Copied: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java (from r464398, myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/MartialStatus.java)
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java?view=diff&rev=464981&p1=myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/MartialStatus.java&r1=464398&p2=myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/MartialStatus.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java Tue Oct 17 11:00:21 2006
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.myfaces.examples.dynaForm;
+package org.apache.myfaces.examples.dynaForm.lib;
public enum MartialStatus
{
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/MartialStatus.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java (from r464398, myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBean.java)
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java?view=diff&rev=464981&p1=myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBean.java&r1=464398&p2=myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/SimpleBean.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java Tue Oct 17 11:00:21 2006
@@ -13,15 +13,20 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.myfaces.examples.dynaForm;
+package org.apache.myfaces.examples.dynaForm.lib;
+
+import org.apache.myfaces.custom.dynaForm.annot.ui.DisplayOnly;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import java.io.Serializable;
import java.util.Date;
-public class SimpleBean
+public class Person implements Serializable
{
- private String user;
+ private Long id;
+
+ private String userName;
private long age;
private Date creationDate;
private Date birthday;
@@ -29,14 +34,25 @@
private String description;
private boolean checkedData;
- public String getUser()
+ @DisplayOnly
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getUserName()
{
- return user;
+ return userName;
}
- public void setUser(String user)
+ public void setUserName(String userName)
{
- this.user = user;
+ this.userName = userName;
}
public long getAge()
@@ -99,4 +115,12 @@
{
this.description = description;
}
+
+ @Override
+ public boolean equals(Object o)
+ {
+ Person p = (Person) o;
+
+ return id.equals(p.id);
+ }
}
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/Person.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java?view=auto&rev=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java (added)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java Tue Oct 17 11:00:21 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.examples.dynaForm.lib;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PersonProvider
+{
+ public List<Person> persons = new ArrayList<Person>();
+
+ public PersonProvider()
+ {
+ for (int i=0;i<20; i++)
+ {
+ persons.add(createPersonFake("dummy", i));
+ }
+ }
+
+ public List<Person> getSearchPersons(String searchString)
+ {
+ return persons;
+ }
+
+ private Person createPersonFake(String search, long count)
+ {
+ Person p = new Person();
+ p.setId(count);
+ p.setUserName(search + " " + count);
+ p.setAge(count);
+ p.setMartialStatus(MartialStatus.MARRIED);
+ return p;
+ }
+
+ public String getPersonDescription(Person person)
+ {
+ if (person == null)
+ {
+ return "#null?";
+ }
+
+ return person.getUserName() + ", " + person.getAge();
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonProvider.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java?view=auto&rev=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java (added)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java Tue Oct 17 11:00:21 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.examples.dynaForm.lib;
+
+import org.apache.myfaces.custom.dynaForm.annot.ui.NotNull;
+import org.apache.myfaces.custom.dynaForm.annot.ui.DataProvider;
+import org.apache.myfaces.custom.dynaForm.annot.ui.UIComponent;
+import org.apache.myfaces.custom.dynaForm.guiBuilder.ComponentEnum;
+
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.ManyToOne;
+import java.util.Date;
+import java.io.Serializable;
+
+public class PersonRelation implements Serializable
+{
+ private Person person1;
+ private Person person2;
+ private Date liveTogetherSince;
+
+ @NotNull
+ @ManyToOne
+ @DataProvider(
+ value="#{personProvider.getSearchPersons}",
+ description="#{personProvider.getPersonDescription}"
+ )
+ public Person getPerson1()
+ {
+ return person1;
+ }
+
+ public void setPerson1(Person person1)
+ {
+ this.person1 = person1;
+ }
+
+ @NotNull
+ @ManyToOne
+ @UIComponent(type= ComponentEnum.SelectOneMenu)
+ @DataProvider(
+ value="#{personProvider.getSearchPersons}",
+ description="#{personProvider.getPersonDescription}"
+ )
+ public Person getPerson2()
+ {
+ return person2;
+ }
+
+ public void setPerson2(Person person2)
+ {
+ this.person2 = person2;
+ }
+
+ @Temporal(value=TemporalType.DATE)
+ public Date getLiveTogetherSince()
+ {
+ return liveTogetherSince;
+ }
+
+ public void setLiveTogetherSince(Date liveTogetherSince)
+ {
+ this.liveTogetherSince = liveTogetherSince;
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/java/org/apache/myfaces/examples/dynaForm/lib/PersonRelation.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties (from r464398, myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/simpleBean_messages.properties)
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties?view=diff&rev=464981&p1=myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/simpleBean_messages.properties&r1=464398&p2=myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/simpleBean_messages.properties (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties Tue Oct 17 11:00:21 2006
@@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations under
# the License.
#
-user=User
+id=Id
+userName=Username
age=Age
creationDate=Creation Date
birthday=Birthday
@@ -23,4 +24,7 @@
SINGLE=single
MARRIED=married
DIVORCED=divorced
-COHABIT=cohabit
\ No newline at end of file
+COHABIT=cohabit
+person1=First person
+person2=Second person
+liveTogetherSince=They live together since
\ No newline at end of file
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/resources/org/apache/myfaces/examples/resource/dynaForm_messages.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/WEB-INF/examples-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/WEB-INF/examples-config.xml?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/WEB-INF/examples-config.xml (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/WEB-INF/examples-config.xml Tue Oct 17 11:00:21 2006
@@ -30,7 +30,13 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
- <navigation-rule>
+ <managed-bean>
+ <managed-bean-name>personProvider</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.examples.dynaForm.lib.PersonProvider</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+
+ <navigation-rule>
<navigation-case>
<from-action>go_home</from-action>
<to-view-id>/home.jsp</to-view-id>
@@ -40,5 +46,5 @@
<to-view-id>/dynaForm/home.jsp</to-view-id>
</navigation-case>
</navigation-rule>
-
+
</faces-config>
Modified: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/customizedSimpleBean.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/customizedSimpleBean.jsp?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/customizedSimpleBean.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/customizedSimpleBean.jsp Tue Oct 17 11:00:21 2006
@@ -30,7 +30,7 @@
<h:form>
<%@include file="/inc/page_header.jsp" %>
- <f:loadBundle basename="org.apache.myfaces.examples.resource.simpleBean_messages" var="simpleBeanBundle"/>
+ <f:loadBundle basename="org.apache.myfaces.examples.resource.dynaForm_messages" var="dynaFormBundle"/>
<h:panelGrid>
@@ -39,18 +39,18 @@
</t:htmlTag>
<sn:dynaForm
- var="simpleBean"
- uri="org.apache.myfaces.examples.dynaForm.SimpleBean"
- valueBindingPrefix="simpleBeanBacking.simpleBean"
- bundle="simpleBeanBundle">
+ var="person"
+ uri="org.apache.myfaces.examples.dynaForm.lib.Person"
+ valueBindingPrefix="simpleBeanBacking.person"
+ bundle="dynaFormBundle">
<sn:dynaFormConfigs>
<sn:dynaFormConfig for="description">
<t:inputHtml/>
</sn:dynaFormConfig>
</sn:dynaFormConfigs>
-
+
<h:panelGrid
- id="simpleBean-layout"
+ id="person-layout"
columns="2" />
</sn:dynaForm>
Modified: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/home.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/home.jsp?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/home.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/home.jsp Tue Oct 17 11:00:21 2006
@@ -25,7 +25,7 @@
<%@include file="/inc/head.inc" %>
</t:documentHead>
<t:documentBody>
-
+
<h:form>
<%@include file="/inc/page_header.jsp" %>
@@ -33,8 +33,9 @@
<h:outputLink value="simpleBean.jsf" ><f:verbatim>Show a simple bean as form and list</f:verbatim></h:outputLink>
<h:outputLink value="customizedSimpleBean.jsf" ><f:verbatim>Show a simple bean as form with customized property</f:verbatim></h:outputLink>
+ <h:outputLink value="relationBean.jsf" ><f:verbatim>Show a bean which as a relation to another bean</f:verbatim></h:outputLink>
- </h:panelGrid>
+ </h:panelGrid>
<%@include file="/inc/page_footer.jsp" %>
</h:form>
Added: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp?view=auto&rev=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp (added)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp Tue Oct 17 11:00:21 2006
@@ -0,0 +1,80 @@
+<%--
+ Copyright 2006 The Apache Software Foundation.
+
+ Licensed 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.
+ --%>
+
+<%@ page session="false" contentType="text/html;charset=utf-8"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+<%@ taglib uri="http://myfaces.apache.org/sandbox15" prefix="sn"%>
+
+<f:view>
+<t:document>
+<t:documentHead>
+ <%@include file="/inc/head.inc" %>
+</t:documentHead>
+<t:documentBody>
+
+ <h:form>
+ <%@include file="/inc/page_header.jsp" %>
+
+ <f:loadBundle basename="org.apache.myfaces.examples.resource.dynaForm_messages" var="dynaFormBundle"/>
+
+ <h:panelGrid>
+
+ <t:htmlTag value="h2">
+ <h:outputText value="A bean where a property has a relation to another bean" />
+ </t:htmlTag>
+
+ <sn:dynaForm
+ var="personRelation"
+ uri="org.apache.myfaces.examples.dynaForm.lib.PersonRelation"
+ valueBindingPrefix="simpleBeanBacking.personRelation"
+ bundle="dynaFormBundle">
+
+ <h:panelGrid
+ id="personRelation-layout"
+ columns="2" />
+ </sn:dynaForm>
+
+ <h:commandButton/>
+
+
+ <t:htmlTag value="h2">
+ <h:outputText value="Current bean values" />
+ </t:htmlTag>
+
+ <sn:dynaForm
+ var="personRelationOutput"
+ uri="org.apache.myfaces.examples.dynaForm.lib.PersonRelation"
+ valueBindingPrefix="simpleBeanBacking.personRelation"
+ bundle="dynaFormBundle"
+ displayOnly="true">
+
+ <h:panelGrid
+ id="personRelationOutput-layout"
+ columns="2" />
+
+ </sn:dynaForm>
+
+ </h:panelGrid>
+
+ <%@include file="/inc/page_footer.jsp" %>
+ </h:form>
+
+</t:documentBody>
+</t:document>
+</f:view>
+
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/relationBean.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/simpleBean.jsp
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/simpleBean.jsp?view=diff&rev=464981&r1=464980&r2=464981
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/simpleBean.jsp (original)
+++ myfaces/tomahawk/trunk/sandbox15/examples/src/main/webapp/dynaForm/simpleBean.jsp Tue Oct 17 11:00:21 2006
@@ -30,7 +30,7 @@
<h:form>
<%@include file="/inc/page_header.jsp" %>
- <f:loadBundle basename="org.apache.myfaces.examples.resource.simpleBean_messages" var="simpleBeanBundle"/>
+ <f:loadBundle basename="org.apache.myfaces.examples.resource.dynaForm_messages" var="dynaFormBundle"/>
<h:panelGrid>
@@ -39,13 +39,13 @@
</t:htmlTag>
<sn:dynaForm
- var="simpleBean"
- uri="org.apache.myfaces.examples.dynaForm.SimpleBean"
- valueBindingPrefix="simpleBeanBacking.simpleBean"
- bundle="simpleBeanBundle">
-
+ var="person"
+ uri="org.apache.myfaces.examples.dynaForm.lib.Person"
+ valueBindingPrefix="simpleBeanBacking.person"
+ bundle="dynaFormBundle">
+
<h:panelGrid
- id="simpleBean-layout"
+ id="person-layout"
columns="2" />
</sn:dynaForm>
@@ -55,13 +55,13 @@
</t:htmlTag>
<sn:dynaForm
- var="simpleBean2"
- uri="org.apache.myfaces.examples.dynaForm.SimpleBean"
- bundle="simpleBeanBundle">
+ var="person2"
+ uri="org.apache.myfaces.examples.dynaForm.lib.Person"
+ bundle="dynaFormBundle">
<h:dataTable
var="entry"
- id="simpleBean2-layout"
- value="#{simpleBeanBacking.simpleBeans}" />
+ id="person2-layout"
+ value="#{simpleBeanBacking.persons}" />
</sn:dynaForm>
@@ -71,14 +71,14 @@
</t:htmlTag>
<sn:dynaForm
- var="simpleBean3"
- uri="org.apache.myfaces.examples.dynaForm.SimpleBean"
+ var="person3"
+ uri="org.apache.myfaces.examples.dynaForm.lib.Person"
displayOnly="true"
- bundle="simpleBeanBundle">
+ bundle="dynaFormBundle">
<h:dataTable
var="entry"
- id="simpleBean3-layout"
- value="#{simpleBeanBacking.simpleBeans}" />
+ id="person3-layout"
+ value="#{simpleBeanBacking.persons}" />
</sn:dynaForm>