Index: JDynFormFieldDynObject.java
===================================================================
--- JDynFormFieldDynObject.java	(revision 1404)
+++ JDynFormFieldDynObject.java	(revision 1405)
@@ -3,142 +3,132 @@
  *
  * Copyright (C) 2007-2013 gvSIG Association.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later
+ * version.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * For any additional information, do not hesitate to contact us
- * at info AT gvsig.com, or visit our website www.gvsig.com.
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
  */
 package org.gvsig.tools.dynform.services.dynformfield.DynObject;
 
 import java.awt.BorderLayout;
-import java.awt.Color;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
-import javax.swing.BorderFactory;
 
 import javax.swing.JPanel;
 
-import org.gvsig.tools.dynform.DynFormFieldDefinition;
 import org.gvsig.tools.dynform.DynFormLocator;
-import org.gvsig.tools.dynform.JDynForm;
 import org.gvsig.tools.dynform.JDynForm.JDynFormListener;
 import org.gvsig.tools.dynform.JDynFormField;
 import org.gvsig.tools.dynform.spi.AbstractJDynForm;
 import org.gvsig.tools.dynform.spi.dynformfield.AbstractJDynFormField;
-import org.gvsig.tools.dynobject.DynField_v2;
 import org.gvsig.tools.dynobject.DynObject;
 import org.gvsig.tools.dynobject.DynStruct;
 import org.gvsig.tools.service.spi.ServiceManager;
 
 public class JDynFormFieldDynObject extends AbstractJDynFormField implements JDynFormField, JDynFormListener, FocusListener {
-	
-	protected DynObject assignedValue  = null;
-	protected DynObject currentValue = null;
-	protected JDynForm jdynForm = null;
-	protected boolean readonly = false;
 
-	public JDynFormFieldDynObject(DynObject parameters,
-			ServiceManager serviceManager) {
-		super(parameters, serviceManager);
-		this.assignedValue = (DynObject) this.getParameterValue();
-	}
+    protected DynObject assignedValue = null;
+    protected DynObject currentValue = null;
+    protected AbstractJDynForm jdynForm = null;
+    protected boolean readonly = false;
 
-	public void setReadOnly(boolean readonly) {
-		super.setReadOnly(readonly);
-		if( this.jdynForm != null ) {
-			this.jdynForm.setReadOnly(readonly);
-		}
-	}
-	
-	public Object getAssignedValue() {
-		return this.assignedValue;
-	}
-	
-	public void initComponent() {
-		this.contents = new JPanel();
-		this.contents.setLayout(new BorderLayout());
-		try {
-			DynStruct struct = this.getDefinition().getDynClassOfValue();
-			this.jdynForm = DynFormLocator.getDynFormManager().createJDynForm(struct);
-        		this.jdynForm.setLayoutMode(getTagValueAsInt("layoutMode", "dynform.layoutmode", JDynForm.USE_PLAIN ));
-			this.jdynForm.setUseScrollBars(false);
-			this.jdynForm.setShowMessageStatus(false);
-			this.jdynForm.addListener(this);
-			this.contents.add(jdynForm.asJComponent(),BorderLayout.CENTER);
-			this.contents.setVisible(true);
-			this.jdynForm.setReadOnly(readonly);
-                        if( !getTagValueAsBoolean("dynform.border.empty", false) ) {
-                            if( this.jdynForm instanceof AbstractJDynForm ) {
-                                ((AbstractJDynForm)this.jdynForm).setBorder(true);
-                            }
-                        }
-			this.setValue(this.assignedValue);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-//		this.jdynForm.addFocusListener(this);
+    public JDynFormFieldDynObject(DynObject parameters,
+            ServiceManager serviceManager) {
+        super(parameters, serviceManager);
+        this.assignedValue = (DynObject) this.getParameterValue();
+    }
 
-	}
-	
-	
-	public void setValue(Object value) {
-		if( value == null ) {
+    @Override
+    public void setReadOnly(boolean readonly) {
+        super.setReadOnly(readonly);
+        if (this.jdynForm != null) {
+            this.jdynForm.setReadOnly(readonly);
+        }
+    }
+
+    @Override
+    public Object getAssignedValue() {
+        return this.assignedValue;
+    }
+
+    @Override
+    public void initComponent() {
+        this.contents = new JPanel();
+        this.contents.setLayout(new BorderLayout());
+        try {
+            DynStruct struct = this.getDefinition().getDynClassOfValue();
+            this.jdynForm = (AbstractJDynForm) DynFormLocator.getDynFormManager().createJDynForm(struct);
+            this.jdynForm.setUseScrollBars(false);
+            this.jdynForm.setReadOnly(readonly);
+            this.jdynForm.loadDefaultValuesFromTags(this.getDefinition().getTags());
+
+            this.jdynForm.addListener(this);
+            this.contents.add(jdynForm.asJComponent(), BorderLayout.CENTER);
+            this.jdynForm.setShowMessageStatus(false);
+            this.contents.setVisible(true);
+            this.setValue(this.assignedValue);
+        } catch (Exception e) {
+            logger.warn("Can't initialize JDynFormFiledDynObject.", e);
+        }
+
+    }
+
+    public void setValue(Object value) {
+        if (value == null) {
 			// TODO
-			// this.jdynForm.clear();
-		} else {
-			if( !(value instanceof DynObject) ) {
-				logger.info("setValue invoked with non DynObject value ("+value.toString()+").");
-				return;
-			}
-			this.jdynForm.setValues((DynObject)value);
-		}
-		this.assignedValue = (DynObject) value;
-		this.currentValue = this.assignedValue;
-	}
-	
-	public Object getValue() {
-		this.jdynForm.getValues(this.currentValue);
-		return this.currentValue;
-	}
-	
-	public boolean hasValidValue() {
-		return true;
-	}
+            // this.jdynForm.clear();
+        } else {
+            if (!(value instanceof DynObject)) {
+                logger.info("setValue invoked with non DynObject value (" + value.toString() + ").");
+                return;
+            }
+            this.jdynForm.setValues((DynObject) value);
+        }
+        this.assignedValue = (DynObject) value;
+        this.currentValue = this.assignedValue;
+    }
 
-	public void focusGained(FocusEvent arg0) {
-		fireFieldEnterEvent();
-		this.problemIndicator().restore();
-	}
+    public Object getValue() {
+        this.jdynForm.getValues(this.currentValue);
+        return this.currentValue;
+    }
 
-	public void focusLost(FocusEvent arg0) {
-		fireFieldExitEvent();
-	}
+    public boolean hasValidValue() {
+        return true;
+    }
 
-	public void message(String message) {
-		fireMessageEvent(message);
-	}
+    public void focusGained(FocusEvent arg0) {
+        fireFieldEnterEvent();
+        this.problemIndicator().restore();
+    }
 
-	public void fieldChanged(JDynFormField field) {
+    public void focusLost(FocusEvent arg0) {
+        fireFieldExitEvent();
+    }
+
+    public void message(String message) {
+        fireMessageEvent(message);
+    }
+
+    public void fieldChanged(JDynFormField field) {
 		// TODO Auto-generated method stub
-		
-	}
-	
+
+    }
+
     public void clear() {
-        if( this.jdynForm!=null ) {
+        if (this.jdynForm != null) {
             this.jdynForm.clear();
         }
     }
