myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skitch...@apache.org
Subject svn commit: r673822 [5/7] - in /myfaces/orchestra/trunk: examples/src/main/java/org/apache/myfaces/examples/annotations/ examples/src/main/java/org/apache/myfaces/examples/ballot/backings/ examples/src/main/java/org/apache/myfaces/examples/ballot/dao/ ...
Date Thu, 03 Jul 2008 21:35:00 GMT
Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilder.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilder.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilder.java Thu Jul  3 14:34:56 2008
@@ -72,1065 +72,1065 @@
  */
 public class JsfGuiBuilder extends GuiBuilder
 {
-	private FacesContext context;
-	private ELContext elcontext;
-	private NewComponentListener newComponentListener;
-	private String backingEntityPrefix;
-
-	private static final Map<String, JsfGuiElementBuilder> builderMap = new TreeMap<String, JsfGuiElementBuilder>();
-
-	public JsfGuiBuilder()
-	{
-	}
-
-	/**
-	 * Add a specialized builder. This builder will be used instead of any default.
-	 */
-	public static void addElementBuilder(Class<?> elementType, JsfGuiElementBuilder builder)
-	{
-		builderMap.put(elementType.getName(), builder);
-	}
-
-	public String getBackingEntityPrefix()
-	{
-		return backingEntityPrefix;
-	}
-
-	public void setBackingEntityPrefix(String backingEntityPrefix)
-	{
-		this.backingEntityPrefix = backingEntityPrefix;
-	}
-
-	public NewComponentListener getNewComponentListener()
-	{
-		return newComponentListener;
-	}
-
-	public void setNewComponentListener(NewComponentListener newComponentListener)
-	{
-		this.newComponentListener = newComponentListener;
-	}
-
-	public void setContext(FacesContext context)
-	{
-		this.context = context;
-	}
-
-	public FacesContext getContext()
-	{
-		return context;
-	}
-
-	public void setELContext(ELContext elcontext)
-	{
-		this.elcontext = elcontext;
-	}
-
-	public ELContext getELContext()
-	{
-		return this.elcontext;
-	}
-
-	/* fulfill the interface */
-	@Override
-	public void createOutputText(MetaField field)
-	{
-		UIComponent cmp = doCreateOutputText(field);
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createInputDate(MetaField field)
-	{
-		UIComponent cmp;
-		if (!isFieldDisplayOnly(field))
-		{
-			cmp = doCreateInputDate(field);
-		}
-		else
-		{
-			cmp = doCreateOutputText(field);
-		}
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createInputText(MetaField field)
-	{
-		UIComponent cmp;
-		if (!isFieldDisplayOnly(field))
-		{
-			cmp = doCreateInputText(field);
-		}
-		else
-		{
-			cmp = doCreateOutputText(field);
-		}
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createInputNumber(MetaField field)
-	{
-		UIComponent cmp;
-		if (!isFieldDisplayOnly(field))
-		{
-			cmp = doCreateInputNumber(field);
-		}
-		else
-		{
-			cmp = doCreateOutputText(field);
-		}
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createInputBoolean(MetaField field)
-	{
-		UIComponent cmp;
-		if (!isFieldDisplayOnly(field))
-		{
-			cmp = doCreateInputBoolean(field);
-		}
-		else
-		{
-			cmp = doCreateOutputText(field);
-		}
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createSelectOneMenu(MetaField field)
-	{
-		UIComponent cmp;
-		if (!isFieldDisplayOnly(field))
-		{
-			cmp = doCreateSelectOneMenu(field);
-		}
-		else
-		{
-			cmp = doCreateOutputText(field);
-		}
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createSearchFor(MetaField field)
-	{
-		UIComponent cmp;
-		if (!isFieldDisplayOnly(field))
-		{
-			cmp = doCreateSearchFor(field);
-		}
-		else
-		{
-			cmp = doCreateOutputText(field);
-		}
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createSearchForSelectMenu(MetaField field)
-	{
-		UIComponent cmp;
-		if (!isFieldDisplayOnly(field))
-		{
-			cmp = doCreateSearchForSelectMenu(field);
-		}
-		else
-		{
-			cmp = doCreateOutputText(field);
-		}
-		fireNewComponent(field, cmp);
-	}
-
-	@Override
-	public void createNative(MetaField field)
-	{
-		Object component = field.getWantedComponent();
-		if (!(component instanceof UIComponent))
-		{
-			throw new IllegalArgumentException("wanted component for field " + field.getName() + " not a UIComponent");
-		}
-
-		UIComponent uinew = cloneComponent((UIComponent) component);
-
-		doCreateNative(field, uinew);
-
-		fireNewComponent(field, uinew);
-	}
-
-	public static UIComponent cloneComponent(UIComponent uicomponent)
-	{
-		// a naive try to clone a component
-		UIComponent uinew;
-		try
-		{
-			uinew = uicomponent.getClass().newInstance();
-		}
-		catch (InstantiationException e)
-		{
-			throw new OrchestraException(e);
-		}
-		catch (IllegalAccessException e)
-		{
-			throw new OrchestraException(e);
-		}
-		uinew.restoreState(FacesContext.getCurrentInstance(), uicomponent.saveState(FacesContext.getCurrentInstance()));
-		return uinew;
-	}
-
-	/* do the hard work */
-	public HtmlOutputText doCreateOutputText(MetaField field)
-	{
-		HtmlOutputText cmp = doCreateOutputTextComponent();
-		initOutputDefaults(cmp, field);
-		return cmp;
-	}
-
-	public HtmlOutputText doCreateOutputTextComponent()
-	{
-		HtmlOutputText cmp = (HtmlOutputText) context.getApplication()
-			.createComponent("javax.faces.HtmlOutputText");
-		return cmp;
-	}
-
-	/**
-	 * Create an HtmlOutputLabel component, ie some text that
-	 * specifically describes another input component.
-	 * <p>
-	 * The labelKey parameter is translated using a resource-bundle
-	 * if possible. If no translation is available then the labelKey
-	 * text is used directly.
-	 */
-	public HtmlOutputLabel doCreateOutputLabel(String labelKey)
-	{
-		HtmlOutputLabel cmp = doCreateOutputLabelComponent();
-		initDefaults(cmp, null);
-		cmp.setValue(translateText(labelKey, labelKey));
-		return cmp;
-	}
-
-	/**
-	 * Create an HtmlOutputText component, ie a component that displays
-	 * a string.
-	 * <p>
-	 * Unlike doCreateOutputLabel, the parameter is the exact string to
-	 * be displayed, not a key into a resource-bundle. This method is used
-	 * to create components wrapping all sorts of strings, only some of
-	 * which may be "translatable" via a resource bundle. If an output
-	 * text component needs to contain translated text, then pass the
-	 * translated value in as the parameter.
-	 */
-	public HtmlOutputText doCreateOutputText(String text)
-	{
-		HtmlOutputText cmp = doCreateOutputTextComponent();
-		initDefaults(cmp, null);
-		cmp.setValue(text);
-		return cmp;
-	}
-
-	public HtmlOutputLabel doCreateOutputLabelComponent()
-	{
-		HtmlOutputLabel cmp = (HtmlOutputLabel) context.getApplication()
-			.createComponent("javax.faces.HtmlOutputLabel");
-		return cmp;
-	}
-
-	public HtmlInputText doCreateInputDate(MetaField field)
-	{
-		HtmlInputText cmp = doCreateInputDateComponent(field);
-		initInputDefaults(cmp, field);
-		// DateTimeConverter cnv = doCreateDateConverter();
-		// cmp.setConverter(cnv);
-		return cmp;
-	}
-
-	public HtmlInputText doCreateInputDateComponent(MetaField field)
-	{
-		HtmlInputText cmp = doCreateInputText(field);
-		return cmp;
-	}
-
-	public Converter doCreateConverter(MetaField field)
-	{
-		if (field.getConverterClass() != null)
-		{
-			return context.getApplication().createConverter(field.getConverterClass());
-		}
-
-		if (field.getConverterId() != null)
-		{
-			return context.getApplication().createConverter(field.getConverterId());
-		}
-
-		if (field.getConverterBean() != null)
-		{
-			String beanName = field.getConverterBean();
-			return new SerializableConverter(beanName);
-		}
-
-		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) || char.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(CharacterConverter.CONVERTER_ID);
-		}
-		if (Byte.class.isAssignableFrom(type) || byte.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(ByteConverter.CONVERTER_ID);
-		}
-		if (Short.class.isAssignableFrom(type) || short.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(ShortConverter.CONVERTER_ID);
-		}
-		if (Integer.class.isAssignableFrom(type) || int.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(IntegerConverter.CONVERTER_ID);
-		}
-		if (Long.class.isAssignableFrom(type) || long.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(LongConverter.CONVERTER_ID);
-		}
-		if (Float.class.isAssignableFrom(type) || float.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(FloatConverter.CONVERTER_ID);
-		}
-		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);
-		}
-		if (BigInteger.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(BigIntegerConverter.CONVERTER_ID);
-		}
-		if (BigDecimal.class.isAssignableFrom(type))
-		{
-			return context.getApplication().createConverter(BigDecimalConverter.CONVERTER_ID);
-		}
-		if (Date.class.isAssignableFrom(type))
-		{
-			return doCreateDateConverter(field);
-		}
-
-		return null;
-	}
-
-	public DateTimeConverter doCreateDateConverter(MetaField field)
-	{
-		DateTimeConverter cnv = (DateTimeConverter) context.getApplication()
-			.createConverter("javax.faces.DateTime");
-		if (field.getTemporalType() != null)
-		{
-			switch (field.getTemporalType())
-			{
-				case DATE:
-					cnv.setType("date");
-					break;
-				case TIME:
-					cnv.setType("time");
-					break;
-				case TIMESTAMP:
-					cnv.setType("both");
-					break;
-			}
-		}
-		else
-		{
-			cnv.setType("both");
-		}
-		cnv.setDateStyle("short");
-		cnv.setTimeStyle("medium");
-		return cnv;
-	}
-
-	public HtmlInputText doCreateInputText(MetaField field)
-	{
-		HtmlInputText cmp = doCreateInputTextComponent();
-		initInputDefaults(cmp, field);
-		if (Boolean.FALSE.equals(field.getCanWrite()))
-		{
-			cmp.setReadonly(true);
-		}
-		if (Boolean.TRUE.equals(field.getDisabled()))
-		{
-			cmp.setDisabled(true);
-		}
-		return cmp;
-	}
-
-	public HtmlInputText doCreateInputTextComponent()
-	{
-		HtmlInputText cmp = (HtmlInputText) context.getApplication()
-			.createComponent("javax.faces.HtmlInputText");
-		return cmp;
-	}
-
-	public UISelectBoolean doCreateInputBoolean(MetaField field)
-	{
-		HtmlSelectBooleanCheckbox cmp = doCreateInputBooleanComponent();
-		initInputDefaults(cmp, field);
-		if (Boolean.FALSE.equals(field.getCanWrite()))
-		{
-			cmp.setReadonly(true);
-		}
-		if (Boolean.TRUE.equals(field.getDisabled()))
-		{
-			cmp.setDisabled(true);
-		}
-		return cmp;
-	}
-
-	public HtmlSelectBooleanCheckbox doCreateInputBooleanComponent()
-	{
-		HtmlSelectBooleanCheckbox cmp = (HtmlSelectBooleanCheckbox) context
-			.getApplication().createComponent("javax.faces.HtmlSelectBooleanCheckbox");
-		return cmp;
-	}
-
-	public HtmlInputText doCreateInputNumber(MetaField field)
-	{
-		HtmlInputText cmp = doCreateInputText(field);
-		cmp.setStyleClass("ff_inputNumber");
-		return cmp;
-	}
-
-	public HtmlSelectOneMenu doCreateSelectOneMenu(MetaField field)
-	{
-		HtmlSelectOneMenu cmp = doCreateSelectOneMenuComponent();
-		initInputDefaults(cmp, field);
-		initSelections(field, cmp);
-
-		if (Boolean.FALSE.equals(field.getCanWrite()))
-		{
-			cmp.setReadonly(true);
-		}
-		if (Boolean.TRUE.equals(field.getDisabled()))
-		{
-			cmp.setDisabled(true);
-		}
-
-		return cmp;
-	}
-
-	public HtmlSelectManyListbox doCreateSelectManyListbox(MetaField field)
-	{
-		HtmlSelectManyListbox cmp = doCreateSelectManyListboxComponent();
-		initInputDefaults(cmp, field);
-		initSelections(field, cmp);
-
-		if (Boolean.FALSE.equals(field.getCanWrite()))
-		{
-			cmp.setReadonly(true);
-		}
-		if (Boolean.TRUE.equals(field.getDisabled()))
-		{
-			cmp.setDisabled(true);
-		}
-
-		return cmp;
-	}
-
-	public HtmlSelectOneMenu doCreateSelectOneMenuComponent()
-	{
-		HtmlSelectOneMenu cmp = (HtmlSelectOneMenu) context.getApplication()
-			.createComponent("javax.faces.HtmlSelectOneMenu");
-		return cmp;
-	}
-
-	public HtmlSelectManyListbox doCreateSelectManyListboxComponent()
-	{
-		HtmlSelectManyListbox cmp = (HtmlSelectManyListbox) context.getApplication()
-			.createComponent("javax.faces.HtmlSelectManyListbox");
-		return cmp;
-	}
-
-	@SuppressWarnings("unchecked")
-	public UIComponent doCreateSearchFor(MetaField field)
-	{
-		throw new UnsupportedOperationException();
-		/*
-		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;
-		*/
-	}
-
-	@SuppressWarnings("unchecked")
-	public UIInput doCreateSearchForSelectMenu(MetaField field)
-	{
-		UIInput select;
-
-		if (!field.getAllowMultipleSelections())
-		{
-			select = doCreateSelectOneMenu(field);
-		}
-		else
-		{
-			select = doCreateSelectManyListbox(field);
-		}
-
-		/*
-		SelectionSourceEnum selectionSource;
-		if (field.isEntityType())
-		{
-			selectionSource = SelectionSourceEnum.relation;
-		}
-		else
-		{
-			selectionSource = SelectionSourceEnum.distinct;
-		}
-		if (field.getSelectionSource() != null)
-		{
-			selectionSource = field.getSelectionSource();
-		}
-		if (!field.isEntityType() && SelectionSourceEnum.relation.equals(selectionSource))
-		{
-			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());
-			}
-		*/
-
-		if (!field.getAllowMultipleSelections() && !Boolean.TRUE.equals(field.getRequired()))
-		{
-			// not required - and a menu, so add the EMPTY entry
-			UISelectItem item = new UISelectItem();
-			// item.setItemValue(ObjectIdentifierConverter.SELECT_NULL_OBJECT);
-			item.setItemValue(ObjectSerializationConverter.SELECT_NULL_OBJECT);
-
-			String labelKey = "SelectAll." + field.getName();
-
-			item.setItemLabel(translateText(labelKey, ""));
-			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);
+    private FacesContext context;
+    private ELContext elcontext;
+    private NewComponentListener newComponentListener;
+    private String backingEntityPrefix;
+
+    private static final Map<String, JsfGuiElementBuilder> builderMap = new TreeMap<String, JsfGuiElementBuilder>();
+
+    public JsfGuiBuilder()
+    {
+    }
+
+    /**
+     * Add a specialized builder. This builder will be used instead of any default.
+     */
+    public static void addElementBuilder(Class<?> elementType, JsfGuiElementBuilder builder)
+    {
+        builderMap.put(elementType.getName(), builder);
+    }
+
+    public String getBackingEntityPrefix()
+    {
+        return backingEntityPrefix;
+    }
+
+    public void setBackingEntityPrefix(String backingEntityPrefix)
+    {
+        this.backingEntityPrefix = backingEntityPrefix;
+    }
+
+    public NewComponentListener getNewComponentListener()
+    {
+        return newComponentListener;
+    }
+
+    public void setNewComponentListener(NewComponentListener newComponentListener)
+    {
+        this.newComponentListener = newComponentListener;
+    }
+
+    public void setContext(FacesContext context)
+    {
+        this.context = context;
+    }
+
+    public FacesContext getContext()
+    {
+        return context;
+    }
+
+    public void setELContext(ELContext elcontext)
+    {
+        this.elcontext = elcontext;
+    }
+
+    public ELContext getELContext()
+    {
+        return this.elcontext;
+    }
+
+    /* fulfill the interface */
+    @Override
+    public void createOutputText(MetaField field)
+    {
+        UIComponent cmp = doCreateOutputText(field);
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createInputDate(MetaField field)
+    {
+        UIComponent cmp;
+        if (!isFieldDisplayOnly(field))
+        {
+            cmp = doCreateInputDate(field);
+        }
+        else
+        {
+            cmp = doCreateOutputText(field);
+        }
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createInputText(MetaField field)
+    {
+        UIComponent cmp;
+        if (!isFieldDisplayOnly(field))
+        {
+            cmp = doCreateInputText(field);
+        }
+        else
+        {
+            cmp = doCreateOutputText(field);
+        }
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createInputNumber(MetaField field)
+    {
+        UIComponent cmp;
+        if (!isFieldDisplayOnly(field))
+        {
+            cmp = doCreateInputNumber(field);
+        }
+        else
+        {
+            cmp = doCreateOutputText(field);
+        }
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createInputBoolean(MetaField field)
+    {
+        UIComponent cmp;
+        if (!isFieldDisplayOnly(field))
+        {
+            cmp = doCreateInputBoolean(field);
+        }
+        else
+        {
+            cmp = doCreateOutputText(field);
+        }
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createSelectOneMenu(MetaField field)
+    {
+        UIComponent cmp;
+        if (!isFieldDisplayOnly(field))
+        {
+            cmp = doCreateSelectOneMenu(field);
+        }
+        else
+        {
+            cmp = doCreateOutputText(field);
+        }
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createSearchFor(MetaField field)
+    {
+        UIComponent cmp;
+        if (!isFieldDisplayOnly(field))
+        {
+            cmp = doCreateSearchFor(field);
+        }
+        else
+        {
+            cmp = doCreateOutputText(field);
+        }
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createSearchForSelectMenu(MetaField field)
+    {
+        UIComponent cmp;
+        if (!isFieldDisplayOnly(field))
+        {
+            cmp = doCreateSearchForSelectMenu(field);
+        }
+        else
+        {
+            cmp = doCreateOutputText(field);
+        }
+        fireNewComponent(field, cmp);
+    }
+
+    @Override
+    public void createNative(MetaField field)
+    {
+        Object component = field.getWantedComponent();
+        if (!(component instanceof UIComponent))
+        {
+            throw new IllegalArgumentException("wanted component for field " + field.getName() + " not a UIComponent");
+        }
+
+        UIComponent uinew = cloneComponent((UIComponent) component);
+
+        doCreateNative(field, uinew);
+
+        fireNewComponent(field, uinew);
+    }
+
+    public static UIComponent cloneComponent(UIComponent uicomponent)
+    {
+        // a naive try to clone a component
+        UIComponent uinew;
+        try
+        {
+            uinew = uicomponent.getClass().newInstance();
+        }
+        catch (InstantiationException e)
+        {
+            throw new OrchestraException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new OrchestraException(e);
+        }
+        uinew.restoreState(FacesContext.getCurrentInstance(), uicomponent.saveState(FacesContext.getCurrentInstance()));
+        return uinew;
+    }
+
+    /* do the hard work */
+    public HtmlOutputText doCreateOutputText(MetaField field)
+    {
+        HtmlOutputText cmp = doCreateOutputTextComponent();
+        initOutputDefaults(cmp, field);
+        return cmp;
+    }
+
+    public HtmlOutputText doCreateOutputTextComponent()
+    {
+        HtmlOutputText cmp = (HtmlOutputText) context.getApplication()
+            .createComponent("javax.faces.HtmlOutputText");
+        return cmp;
+    }
+
+    /**
+     * Create an HtmlOutputLabel component, ie some text that
+     * specifically describes another input component.
+     * <p>
+     * The labelKey parameter is translated using a resource-bundle
+     * if possible. If no translation is available then the labelKey
+     * text is used directly.
+     */
+    public HtmlOutputLabel doCreateOutputLabel(String labelKey)
+    {
+        HtmlOutputLabel cmp = doCreateOutputLabelComponent();
+        initDefaults(cmp, null);
+        cmp.setValue(translateText(labelKey, labelKey));
+        return cmp;
+    }
+
+    /**
+     * Create an HtmlOutputText component, ie a component that displays
+     * a string.
+     * <p>
+     * Unlike doCreateOutputLabel, the parameter is the exact string to
+     * be displayed, not a key into a resource-bundle. This method is used
+     * to create components wrapping all sorts of strings, only some of
+     * which may be "translatable" via a resource bundle. If an output
+     * text component needs to contain translated text, then pass the
+     * translated value in as the parameter.
+     */
+    public HtmlOutputText doCreateOutputText(String text)
+    {
+        HtmlOutputText cmp = doCreateOutputTextComponent();
+        initDefaults(cmp, null);
+        cmp.setValue(text);
+        return cmp;
+    }
+
+    public HtmlOutputLabel doCreateOutputLabelComponent()
+    {
+        HtmlOutputLabel cmp = (HtmlOutputLabel) context.getApplication()
+            .createComponent("javax.faces.HtmlOutputLabel");
+        return cmp;
+    }
+
+    public HtmlInputText doCreateInputDate(MetaField field)
+    {
+        HtmlInputText cmp = doCreateInputDateComponent(field);
+        initInputDefaults(cmp, field);
+        // DateTimeConverter cnv = doCreateDateConverter();
+        // cmp.setConverter(cnv);
+        return cmp;
+    }
+
+    public HtmlInputText doCreateInputDateComponent(MetaField field)
+    {
+        HtmlInputText cmp = doCreateInputText(field);
+        return cmp;
+    }
+
+    public Converter doCreateConverter(MetaField field)
+    {
+        if (field.getConverterClass() != null)
+        {
+            return context.getApplication().createConverter(field.getConverterClass());
+        }
+
+        if (field.getConverterId() != null)
+        {
+            return context.getApplication().createConverter(field.getConverterId());
+        }
+
+        if (field.getConverterBean() != null)
+        {
+            String beanName = field.getConverterBean();
+            return new SerializableConverter(beanName);
+        }
+
+        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) || char.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(CharacterConverter.CONVERTER_ID);
+        }
+        if (Byte.class.isAssignableFrom(type) || byte.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(ByteConverter.CONVERTER_ID);
+        }
+        if (Short.class.isAssignableFrom(type) || short.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(ShortConverter.CONVERTER_ID);
+        }
+        if (Integer.class.isAssignableFrom(type) || int.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(IntegerConverter.CONVERTER_ID);
+        }
+        if (Long.class.isAssignableFrom(type) || long.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(LongConverter.CONVERTER_ID);
+        }
+        if (Float.class.isAssignableFrom(type) || float.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(FloatConverter.CONVERTER_ID);
+        }
+        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);
+        }
+        if (BigInteger.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(BigIntegerConverter.CONVERTER_ID);
+        }
+        if (BigDecimal.class.isAssignableFrom(type))
+        {
+            return context.getApplication().createConverter(BigDecimalConverter.CONVERTER_ID);
+        }
+        if (Date.class.isAssignableFrom(type))
+        {
+            return doCreateDateConverter(field);
+        }
+
+        return null;
+    }
+
+    public DateTimeConverter doCreateDateConverter(MetaField field)
+    {
+        DateTimeConverter cnv = (DateTimeConverter) context.getApplication()
+            .createConverter("javax.faces.DateTime");
+        if (field.getTemporalType() != null)
+        {
+            switch (field.getTemporalType())
+            {
+                case DATE:
+                    cnv.setType("date");
+                    break;
+                case TIME:
+                    cnv.setType("time");
+                    break;
+                case TIMESTAMP:
+                    cnv.setType("both");
+                    break;
+            }
+        }
+        else
+        {
+            cnv.setType("both");
+        }
+        cnv.setDateStyle("short");
+        cnv.setTimeStyle("medium");
+        return cnv;
+    }
+
+    public HtmlInputText doCreateInputText(MetaField field)
+    {
+        HtmlInputText cmp = doCreateInputTextComponent();
+        initInputDefaults(cmp, field);
+        if (Boolean.FALSE.equals(field.getCanWrite()))
+        {
+            cmp.setReadonly(true);
+        }
+        if (Boolean.TRUE.equals(field.getDisabled()))
+        {
+            cmp.setDisabled(true);
+        }
+        return cmp;
+    }
+
+    public HtmlInputText doCreateInputTextComponent()
+    {
+        HtmlInputText cmp = (HtmlInputText) context.getApplication()
+            .createComponent("javax.faces.HtmlInputText");
+        return cmp;
+    }
+
+    public UISelectBoolean doCreateInputBoolean(MetaField field)
+    {
+        HtmlSelectBooleanCheckbox cmp = doCreateInputBooleanComponent();
+        initInputDefaults(cmp, field);
+        if (Boolean.FALSE.equals(field.getCanWrite()))
+        {
+            cmp.setReadonly(true);
+        }
+        if (Boolean.TRUE.equals(field.getDisabled()))
+        {
+            cmp.setDisabled(true);
+        }
+        return cmp;
+    }
+
+    public HtmlSelectBooleanCheckbox doCreateInputBooleanComponent()
+    {
+        HtmlSelectBooleanCheckbox cmp = (HtmlSelectBooleanCheckbox) context
+            .getApplication().createComponent("javax.faces.HtmlSelectBooleanCheckbox");
+        return cmp;
+    }
+
+    public HtmlInputText doCreateInputNumber(MetaField field)
+    {
+        HtmlInputText cmp = doCreateInputText(field);
+        cmp.setStyleClass("ff_inputNumber");
+        return cmp;
+    }
+
+    public HtmlSelectOneMenu doCreateSelectOneMenu(MetaField field)
+    {
+        HtmlSelectOneMenu cmp = doCreateSelectOneMenuComponent();
+        initInputDefaults(cmp, field);
+        initSelections(field, cmp);
+
+        if (Boolean.FALSE.equals(field.getCanWrite()))
+        {
+            cmp.setReadonly(true);
+        }
+        if (Boolean.TRUE.equals(field.getDisabled()))
+        {
+            cmp.setDisabled(true);
+        }
+
+        return cmp;
+    }
+
+    public HtmlSelectManyListbox doCreateSelectManyListbox(MetaField field)
+    {
+        HtmlSelectManyListbox cmp = doCreateSelectManyListboxComponent();
+        initInputDefaults(cmp, field);
+        initSelections(field, cmp);
+
+        if (Boolean.FALSE.equals(field.getCanWrite()))
+        {
+            cmp.setReadonly(true);
+        }
+        if (Boolean.TRUE.equals(field.getDisabled()))
+        {
+            cmp.setDisabled(true);
+        }
+
+        return cmp;
+    }
+
+    public HtmlSelectOneMenu doCreateSelectOneMenuComponent()
+    {
+        HtmlSelectOneMenu cmp = (HtmlSelectOneMenu) context.getApplication()
+            .createComponent("javax.faces.HtmlSelectOneMenu");
+        return cmp;
+    }
+
+    public HtmlSelectManyListbox doCreateSelectManyListboxComponent()
+    {
+        HtmlSelectManyListbox cmp = (HtmlSelectManyListbox) context.getApplication()
+            .createComponent("javax.faces.HtmlSelectManyListbox");
+        return cmp;
+    }
+
+    @SuppressWarnings("unchecked")
+    public UIComponent doCreateSearchFor(MetaField field)
+    {
+        throw new UnsupportedOperationException();
+        /*
+        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;
+        */
+    }
+
+    @SuppressWarnings("unchecked")
+    public UIInput doCreateSearchForSelectMenu(MetaField field)
+    {
+        UIInput select;
+
+        if (!field.getAllowMultipleSelections())
+        {
+            select = doCreateSelectOneMenu(field);
+        }
+        else
+        {
+            select = doCreateSelectManyListbox(field);
+        }
+
+        /*
+        SelectionSourceEnum selectionSource;
+        if (field.isEntityType())
+        {
+            selectionSource = SelectionSourceEnum.relation;
+        }
+        else
+        {
+            selectionSource = SelectionSourceEnum.distinct;
+        }
+        if (field.getSelectionSource() != null)
+        {
+            selectionSource = field.getSelectionSource();
+        }
+        if (!field.isEntityType() && SelectionSourceEnum.relation.equals(selectionSource))
+        {
+            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());
+            }
+        */
+
+        if (!field.getAllowMultipleSelections() && !Boolean.TRUE.equals(field.getRequired()))
+        {
+            // not required - and a menu, so add the EMPTY entry
+            UISelectItem item = new UISelectItem();
+            // item.setItemValue(ObjectIdentifierConverter.SELECT_NULL_OBJECT);
+            item.setItemValue(ObjectSerializationConverter.SELECT_NULL_OBJECT);
+
+            String labelKey = "SelectAll." + field.getName();
+
+            item.setItemLabel(translateText(labelKey, ""));
+            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();
-			items.setValueBinding("value",
-					context.getApplication().createValueBinding(
-						"#{" + backingBeanPrefix + "." + itemSource + "['" + itemSourceName + "']}"));
-			select.getChildren().add(items);
-		}
+        if (itemSource != null)
+        {
+            UISelectItems items = new UISelectItems();
+            items.setValueBinding("value",
+                    context.getApplication().createValueBinding(
+                        "#{" + backingBeanPrefix + "." + itemSource + "['" + itemSourceName + "']}"));
+            select.getChildren().add(items);
+        }
 */
 
-		Converter converter;
-		/*
-		if (field.isEntityType() || SelectionSourceEnum.relation.equals(selectionSource))
-		{
-			// we know this must be an entity, so persist its id only
-			converter = new ObjectIdentifierConverter();
-		}
-		else
-		*/
-		{
-			// use the whole object as value - phu - any better idea?
-			converter = new ObjectSerializationConverter();
-		}
-		select.setConverter(converter);
-
-		return select;
-	}
-
-	/*
-	public HtmlCommandLink doCreateCommandLink(FieldInterface field)
-	{
-		HtmlCommandLink command = doCreateCommandLinkComponent();
-		iniCommandDefaults(command, field, "searchAction", null);
-		return command;
-	}
-	*/
-
-	/*
-	public HtmlCommandLink doCreateCommandLinkComponent()
-	{
-		HtmlCommandLink command = (HtmlCommandLink) context.getApplication()
-			.createComponent("javax.faces.HtmlCommandLink");
-		return command;
-	}
-	*/
-
-	public HtmlPanelGroup doCreatePanelGroupComponent()
-	{
-		HtmlPanelGroup panelGroup = (HtmlPanelGroup) context.getApplication()
-			.createComponent("javax.faces.HtmlPanelGroup");
-		return panelGroup;
-	}
-
-	public void doCreateNative(MetaField field, UIComponent uicomponent)
-	{
-		initDefaults(uicomponent, field);
-		initValueBinding(uicomponent, field);
-	}
-
-	public UIParameter createParameter(String name, String value)
-	{
-		UIParameter parameter = (UIParameter) context.getApplication()
-			.createComponent("javax.faces.Parameter");
-		parameter.setName(name);
-		parameter.setValue(value);
-		return parameter;
-	}
-
-	/**
-	 * jo, we made a component, create a possible label and fire its creation.
-	 */
-	@SuppressWarnings("unchecked")
-	public void fireNewComponent(MetaField field, UIComponent cmp)
-	{
-		UIOutput labelCmp = createLabelFor(field.getBaseName(), cmp);
-
-		cmp.getAttributes().put(DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
-
-		labelCmp.getAttributes().put(DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
-
-		newComponentListener.newComponent(field.getName(), labelCmp, cmp);
-	}
-
-	/**
-	 * Create a label for the specified component using the specified text.
-	 * <p>
-	 * If the component (or one of its children) is an input component, then an
-	 * HtmlOutputLabel component is created, with the "for" attribute referencing
-	 * the id of the input component. Otherwise a plain HtmlOutputText component
-	 * is created.
-	 */
-	public UIOutput createLabelFor(String labelKey, UIComponent cmp)
-	{
-		UIOutput labelCmp;
-		UIInput inputCmp = findInputComponent(cmp);
-		if (inputCmp != null)
-		{
-			HtmlOutputLabel label = doCreateOutputLabel(labelKey);
-			label.setFor(cmp.getId());
-			labelCmp = label;
-		}
-		else
-		{
-			// method doCreateOutputText does not internally translate keys,
-			// so do so here.
-			String labelText = translateText(labelKey, labelKey);
-			labelCmp = doCreateOutputText(labelText);
-		}
-		return labelCmp;
-	}
-
-	/**
-	 * Return the first UIInput component in the tree of components starting at
-	 * the specified node (including the node itself).
-	 */
-	public UIInput findInputComponent(UIComponent cmp)
-	{
-		if (cmp instanceof UIInput)
-		{
-			return (UIInput) cmp;
-		}
-
-		@SuppressWarnings("unchecked")
-		List<UIComponent> children = cmp.getChildren();
-		if (children != null)
-		{
-			for (Object child : children)
-			{
-				if (child instanceof UIComponent)
-				{
-					UIInput input = findInputComponent((UIComponent) child);
-					if (input != null)
-					{
-						return input;
-					}
-				}
-			}
-		}
-
-		return null;
-	}
-
-	/* inits */
-
-	/**
-	 * init global defaults like id
-	 */
-	public void initDefaults(UIComponent cmp, MetaField field)
-	{
-		if (field != null)
-		{
-			cmp.setId(getFieldId(field));
-		}
-	}
-
-	protected String getFieldId(MetaField field)
-	{
-		String idCandidate = field.getExternalName();
-		if (idCandidate == null)
-		{
-			idCandidate = field.getName();
-		}
-		return getCleanedNameForId(idCandidate);
-	}
-
-	/**
-	 * remove all not allowed characters for an jsf ID from the name
-	 */
-	protected String getCleanedNameForId(String name)
-	{
-		StringBuffer ret = new StringBuffer(name.length());
-		for (int i = 0; i < name.length(); i++)
-		{
-			char c = name.charAt(i);
-			if (Character.isDigit(c) || Character.isLetter(c) || c == '_' || c == '-')
-			{
-				ret.append(c);
-			}
-			else
-			{
-				ret.append("_");
-			}
-		}
-		return ret.toString();
-	}
-
-	/**
-	 * init global defaults for output fields
-	 */
-	public void initOutputDefaults(UIOutput cmp, MetaField field)
-	{
-		initDefaults(cmp, field);
-		initValueBinding(cmp, field);
-		initConverter(cmp, field);
-	}
-
-	/**
-	 * init the default value binding
-	 */
-	public void initValueBinding(UIComponent cmp, MetaField field)
-	{
-		String vbString = createValueBindingString(field);
-		_FacesUtils.setValueExpression(cmp, getELContext(), context, vbString);
-	}
-
-	protected String createValueBindingString(MetaField field)
-	{
-		return "#{" + backingEntityPrefix + "." + field.getExternalName() + "}";
-	}
-
-	/**
-	 * init defaults specifically for commands
-	public void iniCommandDefaults(UICommand cmp, FieldInterface field,
-								   String action, String actionListener)
-	{
-		initDefaults(cmp, field);
-
-		if (action == null)
-		{
-			action = "commandAction";
-		}
-
-		cmp.setAction(getContext().getApplication()
-			.createMethodBinding(
-			"#{" + backingBeanPrefix + "." + action
-				+ "}", null));
-
-		if (actionListener != null)
-		{
-			cmp.setActionListener(getContext().getApplication()
-				.createMethodBinding(
-				"#{" + backingBeanPrefix + "." + actionListener
-					+ "}", new Class[]
-				{ActionEvent.class}));
-		}
-	}
-	 */
-
-	/**
-	 * setup all the validators, maxlength, size, ... for HtmlInputText fields
-	 */
-	public void initInputDefaults(HtmlInputText cmp, MetaField field)
-	{
-		initInputDefaults((UIInput) cmp, field);
-
-		int size = -1;
-		int maxlength = -1;
-		Double minValue = null;
-		Double maxValue = null;
-
-		TypeInfos.Info typeInfo = TypeInfos.getInfo(field.getType());
-		if (typeInfo != null)
-		{
-			// init from constants
-			maxlength = typeInfo.getLength();
-			size = maxlength;
-			minValue = typeInfo.getMinValue();
-			maxValue = typeInfo.getMaxValue();
-		}
-
-		if (field.getMaxSize() != null)
-		{
-			maxlength = field.getMaxSize();
-			size = maxlength;
-		}
-		if (field.getMinSize() != null)
-		{
-			size = field.getMinSize();
-		}
-		if (field.getMinValue() != null)
-		{
-			minValue = field.getMinValue();
-		}
-		if (field.getMaxValue() != null)
-		{
-			maxValue = field.getMaxValue();
-		}
-
-		if (maxlength != -1)
-		{
-			cmp.setMaxlength(maxlength);
-		}
-
-		if (field.getDisplaySize() != null)
-		{
-			size = field.getDisplaySize();
-		}
-		else
-		{
-			if (field.getMinSize() == null)
-			{
-				// adjust automatically generated size info
-				if (typeInfo != null && typeInfo.isNumber() && size > 10)
-				{
-					size = 10;
-				}
-				else if (size > 60) // max
-				{
-					size = 60;
-				}
-			}
-		}
-
-		if (size > -1)
-		{
-			cmp.setSize(size);
-		}
-
-		attachRangeValidator(cmp, minValue, maxValue);
-		attachLengthValidator(cmp, field.getMinSize() != null ? field.getMinSize() : 0, maxlength);
-	}
-
-	protected void attachRangeValidator(HtmlInputText cmp, Double minValue, Double maxValue)
-	{
-		DoubleRangeValidator vld = null;
-		if (minValue != null)
-		{
-			if (vld == null)
-			{
-				vld = new DoubleRangeValidator();
-			}
-			vld.setMinimum(minValue);
-		}
-		if (maxValue != null)
-		{
-			if (vld == null)
-			{
-				vld = new DoubleRangeValidator();
-			}
-			vld.setMaximum(maxValue);
-		}
-
-		if (vld != null)
-		{
-			cmp.addValidator(vld);
-		}
-	}
-
-	protected void attachLengthValidator(HtmlInputText cmp, int minSize, int maxSize)
-	{
-		LengthValidator vld = null;
-		if (minSize != -1)
-		{
-			if (vld == null)
-			{
-				vld = new LengthValidator();
-			}
-			vld.setMinimum(minSize);
-		}
-		if (maxSize != -1)
-		{
-			if (vld == null)
-			{
-				vld = new LengthValidator();
-			}
-			vld.setMaximum(maxSize);
-		}
-
-		if (vld != null)
-		{
-			cmp.addValidator(vld);
-		}
-	}
-
-	/**
-	 * setup defaults for input fields like required
-	 */
-	public void initInputDefaults(UIInput cmp, MetaField field)
-	{
-		initDefaults(cmp, field);
-		initValueBinding(cmp, field);
-
-		if (Boolean.TRUE.equals(field.getRequired()))
-		{
-			cmp.setRequired(true);
-		}
-
-		initConverter(cmp, field);
-	}
-
-	/**
-	 * setup a converter if required
-	 */
-	public void initConverter(UIOutput cmp, MetaField field)
-	{
-		// 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)
-		{
-			String dataSourceDescription = field.getDataSourceDescription();
-			if ((Boolean.TRUE.equals(field.getDisplayOnly()) || isFieldDisplayOnly(field))
-				&& dataSourceDescription != null)
-			{
-				// create a special converter for display-only based on the dataSource
-
-				MethodBinding mbLabel = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
-					dataSourceDescription,
-					new Class[]
-						{
-							field.getType()
-						});
-
-				cmp.setConverter(new DataSourceLabelConverter(mbLabel));
-			}
-			else
-			{
-				Converter converter = doCreateConverter(field);
-				if (converter != null)
-				{
-					cmp.setConverter(converter);
-				}
-			}
-		}
-	}
-
-	/**
-	 * insert possible selection items
-	 */
-	@SuppressWarnings("unchecked")
-	public void initSelections(MetaField field, UIComponent cmp)
-	{
-		if (field.getAllowedSelections() == null)
-		{
-			return;
-		}
-
-		Selection[] selections = field.getAllowedSelections();
-		for (Selection selection : selections)
-		{
-			UISelectItem si = new UISelectItem();
-			String labelText = selection.getLabel();
-			si.setItemLabel(translateText(labelText, labelText));
-			si.setItemValue(selection.getValue());
-			cmp.getChildren().add(si);
-		}
-	}
-
-	@Override
-	protected boolean buildField(MetaField field)
-	{
-		String id = getFieldId(field);
-		if (newComponentListener.containsComponent(id))
-		{
-			return true;
-		}
-
-		if (field.getType() != null)
-		{
-			JsfGuiElementBuilder builder = builderMap.get(field.getType().getName());
-			if (builder != null)
-			{
-				if (builder.buildElement(this, field))
-				{
-					return true;
-				}
-			}
-		}
+        Converter converter;
+        /*
+        if (field.isEntityType() || SelectionSourceEnum.relation.equals(selectionSource))
+        {
+            // we know this must be an entity, so persist its id only
+            converter = new ObjectIdentifierConverter();
+        }
+        else
+        */
+        {
+            // use the whole object as value - phu - any better idea?
+            converter = new ObjectSerializationConverter();
+        }
+        select.setConverter(converter);
+
+        return select;
+    }
+
+    /*
+    public HtmlCommandLink doCreateCommandLink(FieldInterface field)
+    {
+        HtmlCommandLink command = doCreateCommandLinkComponent();
+        iniCommandDefaults(command, field, "searchAction", null);
+        return command;
+    }
+    */
+
+    /*
+    public HtmlCommandLink doCreateCommandLinkComponent()
+    {
+        HtmlCommandLink command = (HtmlCommandLink) context.getApplication()
+            .createComponent("javax.faces.HtmlCommandLink");
+        return command;
+    }
+    */
+
+    public HtmlPanelGroup doCreatePanelGroupComponent()
+    {
+        HtmlPanelGroup panelGroup = (HtmlPanelGroup) context.getApplication()
+            .createComponent("javax.faces.HtmlPanelGroup");
+        return panelGroup;
+    }
+
+    public void doCreateNative(MetaField field, UIComponent uicomponent)
+    {
+        initDefaults(uicomponent, field);
+        initValueBinding(uicomponent, field);
+    }
+
+    public UIParameter createParameter(String name, String value)
+    {
+        UIParameter parameter = (UIParameter) context.getApplication()
+            .createComponent("javax.faces.Parameter");
+        parameter.setName(name);
+        parameter.setValue(value);
+        return parameter;
+    }
+
+    /**
+     * jo, we made a component, create a possible label and fire its creation.
+     */
+    @SuppressWarnings("unchecked")
+    public void fireNewComponent(MetaField field, UIComponent cmp)
+    {
+        UIOutput labelCmp = createLabelFor(field.getBaseName(), cmp);
+
+        cmp.getAttributes().put(DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
+
+        labelCmp.getAttributes().put(DynaForm.DYNA_FORM_CREATED, Boolean.TRUE);
+
+        newComponentListener.newComponent(field.getName(), labelCmp, cmp);
+    }
+
+    /**
+     * Create a label for the specified component using the specified text.
+     * <p>
+     * If the component (or one of its children) is an input component, then an
+     * HtmlOutputLabel component is created, with the "for" attribute referencing
+     * the id of the input component. Otherwise a plain HtmlOutputText component
+     * is created.
+     */
+    public UIOutput createLabelFor(String labelKey, UIComponent cmp)
+    {
+        UIOutput labelCmp;
+        UIInput inputCmp = findInputComponent(cmp);
+        if (inputCmp != null)
+        {
+            HtmlOutputLabel label = doCreateOutputLabel(labelKey);
+            label.setFor(cmp.getId());
+            labelCmp = label;
+        }
+        else
+        {
+            // method doCreateOutputText does not internally translate keys,
+            // so do so here.
+            String labelText = translateText(labelKey, labelKey);
+            labelCmp = doCreateOutputText(labelText);
+        }
+        return labelCmp;
+    }
+
+    /**
+     * Return the first UIInput component in the tree of components starting at
+     * the specified node (including the node itself).
+     */
+    public UIInput findInputComponent(UIComponent cmp)
+    {
+        if (cmp instanceof UIInput)
+        {
+            return (UIInput) cmp;
+        }
+
+        @SuppressWarnings("unchecked")
+        List<UIComponent> children = cmp.getChildren();
+        if (children != null)
+        {
+            for (Object child : children)
+            {
+                if (child instanceof UIComponent)
+                {
+                    UIInput input = findInputComponent((UIComponent) child);
+                    if (input != null)
+                    {
+                        return input;
+                    }
+                }
+            }
+        }
+
+        return null;
+    }
+
+    /* inits */
+
+    /**
+     * init global defaults like id
+     */
+    public void initDefaults(UIComponent cmp, MetaField field)
+    {
+        if (field != null)
+        {
+            cmp.setId(getFieldId(field));
+        }
+    }
+
+    protected String getFieldId(MetaField field)
+    {
+        String idCandidate = field.getExternalName();
+        if (idCandidate == null)
+        {
+            idCandidate = field.getName();
+        }
+        return getCleanedNameForId(idCandidate);
+    }
+
+    /**
+     * remove all not allowed characters for an jsf ID from the name
+     */
+    protected String getCleanedNameForId(String name)
+    {
+        StringBuffer ret = new StringBuffer(name.length());
+        for (int i = 0; i < name.length(); i++)
+        {
+            char c = name.charAt(i);
+            if (Character.isDigit(c) || Character.isLetter(c) || c == '_' || c == '-')
+            {
+                ret.append(c);
+            }
+            else
+            {
+                ret.append("_");
+            }
+        }
+        return ret.toString();
+    }
+
+    /**
+     * init global defaults for output fields
+     */
+    public void initOutputDefaults(UIOutput cmp, MetaField field)
+    {
+        initDefaults(cmp, field);
+        initValueBinding(cmp, field);
+        initConverter(cmp, field);
+    }
+
+    /**
+     * init the default value binding
+     */
+    public void initValueBinding(UIComponent cmp, MetaField field)
+    {
+        String vbString = createValueBindingString(field);
+        _FacesUtils.setValueExpression(cmp, getELContext(), context, vbString);
+    }
+
+    protected String createValueBindingString(MetaField field)
+    {
+        return "#{" + backingEntityPrefix + "." + field.getExternalName() + "}";
+    }
+
+    /**
+     * init defaults specifically for commands
+    public void iniCommandDefaults(UICommand cmp, FieldInterface field,
+                                   String action, String actionListener)
+    {
+        initDefaults(cmp, field);
+
+        if (action == null)
+        {
+            action = "commandAction";
+        }
+
+        cmp.setAction(getContext().getApplication()
+            .createMethodBinding(
+            "#{" + backingBeanPrefix + "." + action
+                + "}", null));
+
+        if (actionListener != null)
+        {
+            cmp.setActionListener(getContext().getApplication()
+                .createMethodBinding(
+                "#{" + backingBeanPrefix + "." + actionListener
+                    + "}", new Class[]
+                {ActionEvent.class}));
+        }
+    }
+     */
+
+    /**
+     * setup all the validators, maxlength, size, ... for HtmlInputText fields
+     */
+    public void initInputDefaults(HtmlInputText cmp, MetaField field)
+    {
+        initInputDefaults((UIInput) cmp, field);
+
+        int size = -1;
+        int maxlength = -1;
+        Double minValue = null;
+        Double maxValue = null;
+
+        TypeInfos.Info typeInfo = TypeInfos.getInfo(field.getType());
+        if (typeInfo != null)
+        {
+            // init from constants
+            maxlength = typeInfo.getLength();
+            size = maxlength;
+            minValue = typeInfo.getMinValue();
+            maxValue = typeInfo.getMaxValue();
+        }
+
+        if (field.getMaxSize() != null)
+        {
+            maxlength = field.getMaxSize();
+            size = maxlength;
+        }
+        if (field.getMinSize() != null)
+        {
+            size = field.getMinSize();
+        }
+        if (field.getMinValue() != null)
+        {
+            minValue = field.getMinValue();
+        }
+        if (field.getMaxValue() != null)
+        {
+            maxValue = field.getMaxValue();
+        }
+
+        if (maxlength != -1)
+        {
+            cmp.setMaxlength(maxlength);
+        }
+
+        if (field.getDisplaySize() != null)
+        {
+            size = field.getDisplaySize();
+        }
+        else
+        {
+            if (field.getMinSize() == null)
+            {
+                // adjust automatically generated size info
+                if (typeInfo != null && typeInfo.isNumber() && size > 10)
+                {
+                    size = 10;
+                }
+                else if (size > 60) // max
+                {
+                    size = 60;
+                }
+            }
+        }
+
+        if (size > -1)
+        {
+            cmp.setSize(size);
+        }
+
+        attachRangeValidator(cmp, minValue, maxValue);
+        attachLengthValidator(cmp, field.getMinSize() != null ? field.getMinSize() : 0, maxlength);
+    }
+
+    protected void attachRangeValidator(HtmlInputText cmp, Double minValue, Double maxValue)
+    {
+        DoubleRangeValidator vld = null;
+        if (minValue != null)
+        {
+            if (vld == null)
+            {
+                vld = new DoubleRangeValidator();
+            }
+            vld.setMinimum(minValue);
+        }
+        if (maxValue != null)
+        {
+            if (vld == null)
+            {
+                vld = new DoubleRangeValidator();
+            }
+            vld.setMaximum(maxValue);
+        }
+
+        if (vld != null)
+        {
+            cmp.addValidator(vld);
+        }
+    }
+
+    protected void attachLengthValidator(HtmlInputText cmp, int minSize, int maxSize)
+    {
+        LengthValidator vld = null;
+        if (minSize != -1)
+        {
+            if (vld == null)
+            {
+                vld = new LengthValidator();
+            }
+            vld.setMinimum(minSize);
+        }
+        if (maxSize != -1)
+        {
+            if (vld == null)
+            {
+                vld = new LengthValidator();
+            }
+            vld.setMaximum(maxSize);
+        }
+
+        if (vld != null)
+        {
+            cmp.addValidator(vld);
+        }
+    }
+
+    /**
+     * setup defaults for input fields like required
+     */
+    public void initInputDefaults(UIInput cmp, MetaField field)
+    {
+        initDefaults(cmp, field);
+        initValueBinding(cmp, field);
+
+        if (Boolean.TRUE.equals(field.getRequired()))
+        {
+            cmp.setRequired(true);
+        }
+
+        initConverter(cmp, field);
+    }
+
+    /**
+     * setup a converter if required
+     */
+    public void initConverter(UIOutput cmp, MetaField field)
+    {
+        // 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)
+        {
+            String dataSourceDescription = field.getDataSourceDescription();
+            if ((Boolean.TRUE.equals(field.getDisplayOnly()) || isFieldDisplayOnly(field))
+                && dataSourceDescription != null)
+            {
+                // create a special converter for display-only based on the dataSource
+
+                MethodBinding mbLabel = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
+                    dataSourceDescription,
+                    new Class[]
+                        {
+                            field.getType()
+                        });
+
+                cmp.setConverter(new DataSourceLabelConverter(mbLabel));
+            }
+            else
+            {
+                Converter converter = doCreateConverter(field);
+                if (converter != null)
+                {
+                    cmp.setConverter(converter);
+                }
+            }
+        }
+    }
+
+    /**
+     * insert possible selection items
+     */
+    @SuppressWarnings("unchecked")
+    public void initSelections(MetaField field, UIComponent cmp)
+    {
+        if (field.getAllowedSelections() == null)
+        {
+            return;
+        }
+
+        Selection[] selections = field.getAllowedSelections();
+        for (Selection selection : selections)
+        {
+            UISelectItem si = new UISelectItem();
+            String labelText = selection.getLabel();
+            si.setItemLabel(translateText(labelText, labelText));
+            si.setItemValue(selection.getValue());
+            cmp.getChildren().add(si);
+        }
+    }
+
+    @Override
+    protected boolean buildField(MetaField field)
+    {
+        String id = getFieldId(field);
+        if (newComponentListener.containsComponent(id))
+        {
+            return true;
+        }
+
+        if (field.getType() != null)
+        {
+            JsfGuiElementBuilder builder = builderMap.get(field.getType().getName());
+            if (builder != null)
+            {
+                if (builder.buildElement(this, field))
+                {
+                    return true;
+                }
+            }
+        }
 
-		return super.buildField(field);
-	}
+        return super.buildField(field);
+    }
 }
\ No newline at end of file

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderDecorator.java Thu Jul  3 14:34:56 2008
@@ -41,300 +41,300 @@
  */
 public class JsfGuiBuilderDecorator extends JsfGuiBuilder
 {
-	private final JsfGuiBuilder original;
+    private final JsfGuiBuilder original;
 
-	public JsfGuiBuilderDecorator(JsfGuiBuilder original)
-	{
-		this.original = original;
-	}
-
-	public JsfGuiBuilder getOriginal()
-	{
-		return original;
-	}
-
-	public void createInputBoolean(MetaField field)
-	{
-		original.createInputBoolean(field);
-	}
-
-	public void createInputDate(MetaField field)
-	{
-		original.createInputDate(field);
-	}
-
-	public void createInputNumber(MetaField field)
-	{
-		original.createInputNumber(field);
-	}
-
-	public void createInputText(MetaField field)
-	{
-		original.createInputText(field);
-	}
-
-	public UIOutput createLabelFor(String labelText, UIComponent cmp)
-	{
-		return original.createLabelFor(labelText, cmp);
-	}
-
-	public void createNative(MetaField field)
-	{
-		original.createNative(field);
-	}
-
-	public void createOutputText(MetaField field)
-	{
-		original.createOutputText(field);
-	}
-
-	public UIParameter createParameter(String name, String value)
-	{
-		return original.createParameter(name, value);
-	}
-
-	public void createSearchFor(MetaField field)
-	{
-		original.createSearchFor(field);
-	}
-
-	/*
-	public void createSearchForSelectMenu(MetaField field)
-	{
-		original.createSearchForSelectMenu(field);
-	}
-	*/
-
-	public void createSelectOneMenu(MetaField field)
-	{
-		original.createSelectOneMenu(field);
-	}
-
-	/*
-	public HtmlCommandLink doCreateCommandLinkComponent()
-	{
-		return original.doCreateCommandLinkComponent();
-	}
-	*/
-
-	public DateTimeConverter doCreateDateConverter(MetaField field)
-	{
-		return original.doCreateDateConverter(field);
-	}
-
-	public UISelectBoolean doCreateInputBoolean(MetaField field)
-	{
-		return original.doCreateInputBoolean(field);
-	}
-
-	public HtmlSelectBooleanCheckbox doCreateInputBooleanComponent()
-	{
-		return original.doCreateInputBooleanComponent();
-	}
-
-	public HtmlInputText doCreateInputDate(MetaField field)
-	{
-		return original.doCreateInputDate(field);
-	}
-
-	public HtmlInputText doCreateInputDateComponent(MetaField field)
-	{
-		return original.doCreateInputDateComponent(field);
-	}
-
-	public HtmlInputText doCreateInputNumber(MetaField field)
-	{
-		return original.doCreateInputNumber(field);
-	}
-
-	public HtmlInputText doCreateInputText(MetaField field)
-	{
-		return original.doCreateInputText(field);
-	}
-
-	public HtmlInputText doCreateInputTextComponent()
-	{
-		return original.doCreateInputTextComponent();
-	}
-
-	public void doCreateNative(MetaField field, UIComponent uicomponent)
-	{
-		original.doCreateNative(field, uicomponent);
-	}
-
-	public HtmlOutputLabel doCreateOutputLabel(String text)
-	{
-		return original.doCreateOutputLabel(text);
-	}
-
-	public HtmlOutputLabel doCreateOutputLabelComponent()
-	{
-		return original.doCreateOutputLabelComponent();
-	}
-
-	public HtmlOutputText doCreateOutputText(MetaField field)
-	{
-		return original.doCreateOutputText(field);
-	}
-
-	public HtmlOutputText doCreateOutputText(String text)
-	{
-		return original.doCreateOutputText(text);
-	}
-
-	public HtmlOutputText doCreateOutputTextComponent()
-	{
-		return original.doCreateOutputTextComponent();
-	}
-
-	public HtmlPanelGroup doCreatePanelGroupComponent()
-	{
-		return original.doCreatePanelGroupComponent();
-	}
-
-	public UIComponent doCreateSearchFor(MetaField field)
-	{
-		return original.doCreateSearchFor(field);
-	}
-
-	public HtmlSelectOneMenu doCreateSelectOneMenu(MetaField field)
-	{
-		return original.doCreateSelectOneMenu(field);
-	}
-
-	public HtmlSelectOneMenu doCreateSelectOneMenuComponent()
-	{
-		return original.doCreateSelectOneMenuComponent();
-	}
-
-	public UIInput findInputComponent(UIComponent cmp)
-	{
-		return original.findInputComponent(cmp);
-	}
-
-	public void fireNewComponent(MetaField field, UIComponent cmp)
-	{
-		original.fireNewComponent(field, cmp);
-	}
-
-	/*
-	public String getBackingBeanPrefix()
-	{
-		return original.getBackingBeanPrefix();
-	}
-	*/
-
-	public String getBackingEntityPrefix()
-	{
-		return original.getBackingEntityPrefix();
-	}
-
-	public FacesContext getContext()
-	{
-		return original.getContext();
-	}
-
-	public void setELContext(ELContext elcontext)
-	{
-		original.setELContext(elcontext);
-	}
-
-	public ELContext getELContext()
-	{
-		return original.getELContext();
-	}
-
-	public NewComponentListener getNewComponentListener()
-	{
-		return original.getNewComponentListener();
-	}
-
-	/*
-	public void iniCommandDefaults(UICommand cmp, FieldInterface field, String action, String actionListener)
-	{
-		original.iniCommandDefaults(cmp, field, action, actionListener);
-	}
-	*/
-
-	public void initDefaults(UIComponent cmp, MetaField field)
-	{
-		original.initDefaults(cmp, field);
-	}
-
-	public void initInputDefaults(HtmlInputText cmp, MetaField field)
-	{
-		original.initInputDefaults(cmp, field);
-	}
-
-	public void initInputDefaults(UIInput cmp, MetaField field)
-	{
-		original.initInputDefaults(cmp, field);
-	}
-
-	public void initOutputDefaults(UIOutput cmp, MetaField field)
-	{
-		original.initOutputDefaults(cmp, field);
-	}
-
-	public void initSelections(MetaField field, UIComponent cmp)
-	{
-		original.initSelections(field, cmp);
-	}
-
-	public void initValueBinding(UIComponent cmp, MetaField field)
-	{
-		original.initValueBinding(cmp, field);
-	}
-
-	/*
-	public void setBackingBeanPrefix(String backingBeanPrefix)
-	{
-		original.setBackingBeanPrefix(backingBeanPrefix);
-	}
-	*/
-
-	public void setBackingEntityPrefix(String backingEntityPrefix)
-	{
-		original.setBackingEntityPrefix(backingEntityPrefix);
-	}
-
-	public void setContext(FacesContext context)
-	{
-		original.setContext(context);
-	}
-
-	public void setFormDisplayOnly(boolean displayOnly)
-	{
-		original.setFormDisplayOnly(displayOnly);
-	}
-
-	public void setNewComponentListener(NewComponentListener newComponentListener)
-	{
-		original.setNewComponentListener(newComponentListener);
-	}
-
-	public Map<String, String> getLabelBundle()
-	{
-		return original.getLabelBundle();
-	}
-
-	public void setLabelBundle(Map<String, String> labelBundle)
-	{
-		original.setLabelBundle(labelBundle);
-	}
-
-	protected void attachLengthValidator(HtmlInputText cmp, int minSize, int maxSize)
-	{
-		original.attachLengthValidator(cmp, minSize, maxSize);
-	}
-
-	protected void attachRangeValidator(HtmlInputText cmp, double minValue, double maxValue)
-	{
-		original.attachRangeValidator(cmp, minValue, maxValue);
-	}
-
-	protected boolean buildField(MetaField field)
-	{
-		return super.buildField(field);
-	}
+    public JsfGuiBuilderDecorator(JsfGuiBuilder original)
+    {
+        this.original = original;
+    }
+
+    public JsfGuiBuilder getOriginal()
+    {
+        return original;
+    }
+
+    public void createInputBoolean(MetaField field)
+    {
+        original.createInputBoolean(field);
+    }
+
+    public void createInputDate(MetaField field)
+    {
+        original.createInputDate(field);
+    }
+
+    public void createInputNumber(MetaField field)
+    {
+        original.createInputNumber(field);
+    }
+
+    public void createInputText(MetaField field)
+    {
+        original.createInputText(field);
+    }
+
+    public UIOutput createLabelFor(String labelText, UIComponent cmp)
+    {
+        return original.createLabelFor(labelText, cmp);
+    }
+
+    public void createNative(MetaField field)
+    {
+        original.createNative(field);
+    }
+
+    public void createOutputText(MetaField field)
+    {
+        original.createOutputText(field);
+    }
+
+    public UIParameter createParameter(String name, String value)
+    {
+        return original.createParameter(name, value);
+    }
+
+    public void createSearchFor(MetaField field)
+    {
+        original.createSearchFor(field);
+    }
+
+    /*
+    public void createSearchForSelectMenu(MetaField field)
+    {
+        original.createSearchForSelectMenu(field);
+    }
+    */
+
+    public void createSelectOneMenu(MetaField field)
+    {
+        original.createSelectOneMenu(field);
+    }
+
+    /*
+    public HtmlCommandLink doCreateCommandLinkComponent()
+    {
+        return original.doCreateCommandLinkComponent();
+    }
+    */
+
+    public DateTimeConverter doCreateDateConverter(MetaField field)
+    {
+        return original.doCreateDateConverter(field);
+    }
+
+    public UISelectBoolean doCreateInputBoolean(MetaField field)
+    {
+        return original.doCreateInputBoolean(field);
+    }
+
+    public HtmlSelectBooleanCheckbox doCreateInputBooleanComponent()
+    {
+        return original.doCreateInputBooleanComponent();
+    }
+
+    public HtmlInputText doCreateInputDate(MetaField field)
+    {
+        return original.doCreateInputDate(field);
+    }
+
+    public HtmlInputText doCreateInputDateComponent(MetaField field)
+    {
+        return original.doCreateInputDateComponent(field);
+    }
+
+    public HtmlInputText doCreateInputNumber(MetaField field)
+    {
+        return original.doCreateInputNumber(field);
+    }
+
+    public HtmlInputText doCreateInputText(MetaField field)
+    {
+        return original.doCreateInputText(field);
+    }
+
+    public HtmlInputText doCreateInputTextComponent()
+    {
+        return original.doCreateInputTextComponent();
+    }
+
+    public void doCreateNative(MetaField field, UIComponent uicomponent)
+    {
+        original.doCreateNative(field, uicomponent);
+    }
+
+    public HtmlOutputLabel doCreateOutputLabel(String text)
+    {
+        return original.doCreateOutputLabel(text);
+    }
+
+    public HtmlOutputLabel doCreateOutputLabelComponent()
+    {
+        return original.doCreateOutputLabelComponent();
+    }
+
+    public HtmlOutputText doCreateOutputText(MetaField field)
+    {
+        return original.doCreateOutputText(field);
+    }
+
+    public HtmlOutputText doCreateOutputText(String text)
+    {
+        return original.doCreateOutputText(text);
+    }
+
+    public HtmlOutputText doCreateOutputTextComponent()
+    {
+        return original.doCreateOutputTextComponent();
+    }
+
+    public HtmlPanelGroup doCreatePanelGroupComponent()
+    {
+        return original.doCreatePanelGroupComponent();
+    }
+
+    public UIComponent doCreateSearchFor(MetaField field)
+    {
+        return original.doCreateSearchFor(field);
+    }
+
+    public HtmlSelectOneMenu doCreateSelectOneMenu(MetaField field)
+    {
+        return original.doCreateSelectOneMenu(field);
+    }
+
+    public HtmlSelectOneMenu doCreateSelectOneMenuComponent()
+    {
+        return original.doCreateSelectOneMenuComponent();
+    }
+
+    public UIInput findInputComponent(UIComponent cmp)
+    {
+        return original.findInputComponent(cmp);
+    }
+
+    public void fireNewComponent(MetaField field, UIComponent cmp)
+    {
+        original.fireNewComponent(field, cmp);
+    }
+
+    /*
+    public String getBackingBeanPrefix()
+    {
+        return original.getBackingBeanPrefix();
+    }
+    */
+
+    public String getBackingEntityPrefix()
+    {
+        return original.getBackingEntityPrefix();
+    }
+
+    public FacesContext getContext()
+    {
+        return original.getContext();
+    }
+
+    public void setELContext(ELContext elcontext)
+    {
+        original.setELContext(elcontext);
+    }
+
+    public ELContext getELContext()
+    {
+        return original.getELContext();
+    }
+
+    public NewComponentListener getNewComponentListener()
+    {
+        return original.getNewComponentListener();
+    }
+
+    /*
+    public void iniCommandDefaults(UICommand cmp, FieldInterface field, String action, String actionListener)
+    {
+        original.iniCommandDefaults(cmp, field, action, actionListener);
+    }
+    */
+
+    public void initDefaults(UIComponent cmp, MetaField field)
+    {
+        original.initDefaults(cmp, field);
+    }
+
+    public void initInputDefaults(HtmlInputText cmp, MetaField field)
+    {
+        original.initInputDefaults(cmp, field);
+    }
+
+    public void initInputDefaults(UIInput cmp, MetaField field)
+    {
+        original.initInputDefaults(cmp, field);
+    }
+
+    public void initOutputDefaults(UIOutput cmp, MetaField field)
+    {
+        original.initOutputDefaults(cmp, field);
+    }
+
+    public void initSelections(MetaField field, UIComponent cmp)
+    {
+        original.initSelections(field, cmp);
+    }
+
+    public void initValueBinding(UIComponent cmp, MetaField field)
+    {
+        original.initValueBinding(cmp, field);
+    }
+
+    /*
+    public void setBackingBeanPrefix(String backingBeanPrefix)
+    {
+        original.setBackingBeanPrefix(backingBeanPrefix);
+    }
+    */
+
+    public void setBackingEntityPrefix(String backingEntityPrefix)
+    {
+        original.setBackingEntityPrefix(backingEntityPrefix);
+    }
+
+    public void setContext(FacesContext context)
+    {
+        original.setContext(context);
+    }
+
+    public void setFormDisplayOnly(boolean displayOnly)
+    {
+        original.setFormDisplayOnly(displayOnly);
+    }
+
+    public void setNewComponentListener(NewComponentListener newComponentListener)
+    {
+        original.setNewComponentListener(newComponentListener);
+    }
+
+    public Map<String, String> getLabelBundle()
+    {
+        return original.getLabelBundle();
+    }
+
+    public void setLabelBundle(Map<String, String> labelBundle)
+    {
+        original.setLabelBundle(labelBundle);
+    }
+
+    protected void attachLengthValidator(HtmlInputText cmp, int minSize, int maxSize)
+    {
+        original.attachLengthValidator(cmp, minSize, maxSize);
+    }
+
+    protected void attachRangeValidator(HtmlInputText cmp, double minValue, double maxValue)
+    {
+        original.attachRangeValidator(cmp, minValue, maxValue);
+    }
+
+    protected boolean buildField(MetaField field)
+    {
+        return super.buildField(field);
+    }
 }

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderFactory.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderFactory.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderFactory.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiBuilderFactory.java Thu Jul  3 14:34:56 2008
@@ -29,107 +29,107 @@
 
 public class JsfGuiBuilderFactory
 {
-	public final static String CONTEXT_GUI_BUILDER = "org.apache.myfaces.custom.dynaForm.GUI_BUILDER";
+    public final static String CONTEXT_GUI_BUILDER = "org.apache.myfaces.custom.dynaForm.GUI_BUILDER";
 
-	private JsfGuiBuilderFactory()
-	{
-	}
-
-	public static JsfGuiBuilder create(final FacesContext facesContext)
-	{
-		JsfGuiBuilder guiBuilder = null;
-
-		String guiBuilderName = facesContext.getExternalContext().getInitParameter(CONTEXT_GUI_BUILDER);
-		if (guiBuilderName == null)
-		{
-			guiBuilder = createGuiBuilderInternal();
-		}
-		else
-		{
-			try
-			{
-				@SuppressWarnings("unchecked")
-				Class<? extends JsfGuiBuilder> guiBuilderClass = 
-					(Class<? extends JsfGuiBuilder>) Class.forName(guiBuilderName);
-				try
-				{
-					// try to find a decorator constructor
-					Constructor<? extends JsfGuiBuilder> decoratorConst = 
-						guiBuilderClass.getConstructor(new Class[]{JsfGuiBuilder.class});
-					return decoratorConst.newInstance(new Object[]{
-						createGuiBuilderInternal()
-					});
-				}
-				catch (NoSuchMethodException e)
-				{
-					// not - so letz create a plain instance
-					return (JsfGuiBuilder) guiBuilderClass.newInstance();
-				}
-			}
-			catch (IllegalArgumentException e)
-			{
-				throw new OrchestraException(e);
-			}
-			catch (InvocationTargetException e)
-			{
-				throw new OrchestraException(e);
-			}
-			catch (SecurityException e)
-			{
-				throw new OrchestraException(e);
-			}
-			catch (InstantiationException e)
-			{
-				throw new OrchestraException(e);
-			}
-			catch (IllegalAccessException e)
-			{
-				throw new OrchestraException(e);
-			}
-			catch (ClassNotFoundException e)
-			{
-				throw new OrchestraException(e);
-			}
-		}
-		return guiBuilder;
-	}
-
-	protected static JsfGuiBuilder createGuiBuilderInternal()
-	{
-		JsfGuiBuilder guiBuilder = null;
-		if (MyFacesCheck.isMyFacesAvailable())
-		{
-			try
-			{
-				// See whether the sandbox implementation is also in the classpath. This
-				// generates nicer output...
-				String myfacesImpl = "org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.impl.myfaces.MyFacesGuiBuilder";
-				@SuppressWarnings("unchecked")
-				Class<? extends JsfGuiBuilder> myfacesGuiBuilder = 
-					ClassUtils.classForName(myfacesImpl);
-				guiBuilder = (JsfGuiBuilder) myfacesGuiBuilder.newInstance();
-			}
-			catch (ClassNotFoundException e)
-			{
-				LogFactory.getLog(JsfGuiBuilderFactory.class)
-					.warn("consider using the myfaces-orchestra-sandbox for better gui support", e);
-			}
-			catch (InstantiationException e)
-			{
-				LogFactory.getLog(JsfGuiBuilderFactory.class)
-					.warn("can't create the myfaces gui builder - reverting to plain JSF", e);
-			}
-			catch (IllegalAccessException e)
-			{
-				LogFactory.getLog(JsfGuiBuilderFactory.class)
-					.warn("can't create the myfaces gui builder - reverting to plain JSF", e);
-			}
-		}
-
-		if (guiBuilder == null)
-		{
-			guiBuilder = new JsfGuiBuilder();
-		}
-		return guiBuilder;
-	}
+    private JsfGuiBuilderFactory()
+    {
+    }
+
+    public static JsfGuiBuilder create(final FacesContext facesContext)
+    {
+        JsfGuiBuilder guiBuilder = null;
+
+        String guiBuilderName = facesContext.getExternalContext().getInitParameter(CONTEXT_GUI_BUILDER);
+        if (guiBuilderName == null)
+        {
+            guiBuilder = createGuiBuilderInternal();
+        }
+        else
+        {
+            try
+            {
+                @SuppressWarnings("unchecked")
+                Class<? extends JsfGuiBuilder> guiBuilderClass = 
+                    (Class<? extends JsfGuiBuilder>) Class.forName(guiBuilderName);
+                try
+                {
+                    // try to find a decorator constructor
+                    Constructor<? extends JsfGuiBuilder> decoratorConst = 
+                        guiBuilderClass.getConstructor(new Class[]{JsfGuiBuilder.class});
+                    return decoratorConst.newInstance(new Object[]{
+                        createGuiBuilderInternal()
+                    });
+                }
+                catch (NoSuchMethodException e)
+                {
+                    // not - so letz create a plain instance
+                    return (JsfGuiBuilder) guiBuilderClass.newInstance();
+                }
+            }
+            catch (IllegalArgumentException e)
+            {
+                throw new OrchestraException(e);
+            }
+            catch (InvocationTargetException e)
+            {
+                throw new OrchestraException(e);
+            }
+            catch (SecurityException e)
+            {
+                throw new OrchestraException(e);
+            }
+            catch (InstantiationException e)
+            {
+                throw new OrchestraException(e);
+            }
+            catch (IllegalAccessException e)
+            {
+                throw new OrchestraException(e);
+            }
+            catch (ClassNotFoundException e)
+            {
+                throw new OrchestraException(e);
+            }
+        }
+        return guiBuilder;
+    }
+
+    protected static JsfGuiBuilder createGuiBuilderInternal()
+    {
+        JsfGuiBuilder guiBuilder = null;
+        if (MyFacesCheck.isMyFacesAvailable())
+        {
+            try
+            {
+                // See whether the sandbox implementation is also in the classpath. This
+                // generates nicer output...
+                String myfacesImpl = "org.apache.myfaces.orchestra.dynaForm.jsf.guiBuilder.impl.myfaces.MyFacesGuiBuilder";
+                @SuppressWarnings("unchecked")
+                Class<? extends JsfGuiBuilder> myfacesGuiBuilder = 
+                    ClassUtils.classForName(myfacesImpl);
+                guiBuilder = (JsfGuiBuilder) myfacesGuiBuilder.newInstance();
+            }
+            catch (ClassNotFoundException e)
+            {
+                LogFactory.getLog(JsfGuiBuilderFactory.class)
+                    .warn("consider using the myfaces-orchestra-sandbox for better gui support", e);
+            }
+            catch (InstantiationException e)
+            {
+                LogFactory.getLog(JsfGuiBuilderFactory.class)
+                    .warn("can't create the myfaces gui builder - reverting to plain JSF", e);
+            }
+            catch (IllegalAccessException e)
+            {
+                LogFactory.getLog(JsfGuiBuilderFactory.class)
+                    .warn("can't create the myfaces gui builder - reverting to plain JSF", e);
+            }
+        }
+
+        if (guiBuilder == null)
+        {
+            guiBuilder = new JsfGuiBuilder();
+        }
+        return guiBuilder;
+    }
 }

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiElementBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiElementBuilder.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiElementBuilder.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/JsfGuiElementBuilder.java Thu Jul  3 14:34:56 2008
@@ -22,5 +22,5 @@
 
 public interface JsfGuiElementBuilder
 {
-	public boolean buildElement(JsfGuiBuilder builder, MetaField field);
+    public boolean buildElement(JsfGuiBuilder builder, MetaField field);
 }

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/NewComponentListener.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/NewComponentListener.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/NewComponentListener.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/NewComponentListener.java Thu Jul  3 14:34:56 2008
@@ -28,18 +28,18 @@
  */
 public interface NewComponentListener
 {
-	/**
-	 * the new component and its label
-	 */
-	public void newComponent(String fieldName, UIComponent label, UIComponent component);
+    /**
+     * the new component and its label
+     */
+    public void newComponent(String fieldName, UIComponent label, UIComponent component);
 
-	/**
-	 * check if the component has been added already
-	 */
-	public boolean containsComponent(String id);
+    /**
+     * check if the component has been added already
+     */
+    public boolean containsComponent(String id);
 
-	/**
-	 * find a component by id
-	 */
-	public UIComponent findComponent(String id);
+    /**
+     * find a component by id
+     */
+    public UIComponent findComponent(String id);
 }

Modified: myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java?rev=673822&r1=673821&r2=673822&view=diff
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java (original)
+++ myfaces/orchestra/trunk/sandbox/src/main/java/org/apache/myfaces/orchestra/dynaForm/jsf/guiBuilder/impl/jsf/ValueBindingDataSourceAdapter.java Thu Jul  3 14:34:56 2008
@@ -33,98 +33,98 @@
  */
 public class ValueBindingDataSourceAdapter extends ValueBinding implements StateHolder
 {
-	private MethodBinding mbValues;
-	private MethodBinding mbLabels;
+    private MethodBinding mbValues;
+    private MethodBinding mbLabels;
 
-	private boolean _transient = false;
+    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;
-	}
+    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;
+    }
 }



Mime
View raw message