Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/dynobject/unavailable.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/resources/org/gvsig/tools/swing/impl/dynobject/unavailable.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StringJDynObjectComponent.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StringJDynObjectComponent.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StringJDynObjectComponent.java	(revision 168)
@@ -1,70 +0,0 @@
-/* gvSIG. Geographic Information System of the Valencian Government
- *
- * Copyright (C) 2007-2008 Infrastructures and Transports Department
- * of the Valencian Government (CIT)
- * 
- * 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 2
- * 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.
- * 
- * 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.
- * 
- */
-
-/*
- * AUTHORS (In addition to CIT):
- * 2010 {}  {{Task}}
- */
-package org.gvsig.tools.swing.impl.dynobject;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-
-import org.gvsig.tools.dynobject.DynObject;
-import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
-
-/**
- * Simple {@link JDynObjectComponent} implementation which shows a
- * {@link DynObject} as a String.
- * <p>
- * <strong>NOTE:</strong> initial dummy implementation to be replaced with a
- * more complete one.
- * </p>
- * 
- * @author 2010- César Ordiñana - gvSIG team
- */
-public class StringJDynObjectComponent extends JDynObjectComponent {
-
-	private static final long serialVersionUID = 5716325904557339463L;
-
-	/**
-	 * @see JDynObjectView#JDynObjectView(DynObject).
-	 */
-	public StringJDynObjectComponent(DynObject dynObject) {
-		super(dynObject);
-		initUI();
-	}
-
-	private void initUI() {
-		setLayout(new BorderLayout());
-		JLabel label = new JLabel("<html><pre>".concat(
-				getDynObject().toString()).concat("</pre></html>"));
-		add(label, BorderLayout.CENTER);
-	}
-
-	@Override
-	public void storeData() {
-		// Nothing to do, as this component is not able to edit the DynObject
-		// data.
-	}
-}
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectModelElement.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectModelElement.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectModelElement.java	(revision 168)
@@ -0,0 +1,52 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class DefaultDynObjectModelElement extends AbstractDynObjectModelElement implements DynFieldComponentModel{
+
+    /**
+     * @param field
+     * @param theClass
+     */
+    public DefaultDynObjectModelElement(String fieldName, DynClass theClass, String group) {
+	super(fieldName, theClass, group);
+    }
+   
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultJDynObjectComponent.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultJDynObjectComponent.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultJDynObjectComponent.java	(revision 168)
@@ -26,39 +26,32 @@
  */
 package org.gvsig.tools.swing.impl.dynobject;
 
-import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.Insets;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 
-import javax.swing.JComboBox;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.JSpinner;
-import javax.swing.JTextField;
-import javax.swing.ScrollPaneConstants;
-import javax.swing.SpinnerModel;
-import javax.swing.SpinnerNumberModel;
+import javax.swing.JTabbedPane;
 
 import org.gvsig.tools.ToolsLocator;
-import org.gvsig.tools.dataTypes.DataTypes;
 import org.gvsig.tools.dynobject.DynField;
 import org.gvsig.tools.dynobject.DynObject;
-import org.gvsig.tools.dynobject.DynObjectValueItem;
 import org.gvsig.tools.i18n.I18nManager;
-import org.gvsig.tools.swing.api.ToolsSwingLocator;
-import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
 import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.AbstractDynObjectComponent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -68,7 +61,7 @@
  * @author 2008-2009 José Manuel Vivó
  * @author 2010- César Ordiñana - gvSIG team
  */
-public class DefaultJDynObjectComponent extends JDynObjectComponent {
+public class DefaultJDynObjectComponent extends AbstractDynObjectComponent implements JDynObjectComponent, ValueField, ValueChangedListener{
 	// implements ActionListener {
 
 	private static final long serialVersionUID = 2888673056424008867L;
@@ -77,788 +70,353 @@
 			.getLogger(DefaultJDynObjectComponent.class);
 
 	private final I18nManager i18nManager = ToolsLocator.getI18nManager();
-	// private final UsabilitySwingManager usManager = ToolsSwingLocator
-	// .getUsabilitySwingManager();
-	private final DynObjectSwingManager dsManager = ToolsSwingLocator
-			.getDynObjectSwingManager();
 
-	public static final int SHOW_ALL = 0;
-	public static final int SHOW_ONLY_THIS_PARAMS = 1;
-	public static final int HIDDE_THIS_PARAMS = 2;
-
-	// private String title;
-
 	private DynObject parameters;
-	private List<DynField> fields;
-	// private JButton botAcept;
-	// private JButton botCancel;
-	// private JButton botRestoreDefaults;
-	// private boolean showButtons;
-	// private JPanel panButtons;
-	private JPanel panParameters;
-	private Map<DynField, Component> componentField;
 
 	private Color mandatoryLabelColor = Color.red;
-	// private boolean modal;
-	private JScrollPane parametersScroll;
-
 	protected Map<String, Object> tempValue = new HashMap<String, Object>();
-	public boolean srsShowTransformPanel;
+	private HashMap<DynField, JLabel> labelList;
 
-	public DefaultJDynObjectComponent(DynObject parameters) {
-		this(parameters, SHOW_ALL, null);
-	}
+	private JTabbedPane tabPanel;
 
-	public DefaultJDynObjectComponent(DynObject parameters, int mode,
-			List<String> paramsNames) {
-		this(parameters, mode, paramsNames,
-		// true,
-				false);
-	}
-
-	public DefaultJDynObjectComponent(DynObject parameters, int mode,
-			List<String> paramsNames,
-			// boolean showButtons,
-			boolean srsShowTransformPanel) {
-
-		super(parameters);
+	public DefaultJDynObjectComponent(DynObject parameters, DynObjectModel model) throws ServiceException {
+		super(parameters,model);
+		//added to handle labels correctly   
+		this.labelList = new HashMap<DynField,JLabel>();
 		this.parameters = parameters;
-		this.fields = Arrays.asList(parameters.getDynClass().getDynFields());
-		// this.showButtons = showButtons;
-		this.srsShowTransformPanel = srsShowTransformPanel;
-		if (mode == SHOW_ONLY_THIS_PARAMS || mode == HIDDE_THIS_PARAMS) {
-			if (paramsNames == null) {
-				throw new IllegalArgumentException("must expecify a name list");
-			}
-			ArrayList<DynField> toShow = new ArrayList<DynField>();
-			List<DynField> fields = Arrays.asList(parameters.getDynClass()
-					.getDynFields());
-			Iterator<DynField> iter = fields.iterator();
-			DynField field;
-			while (iter.hasNext()) {
-				field = iter.next();
+		this.tabPanel = new JTabbedPane();
+		//Uncomment the following line to use scrolling tabs.
+		this.tabPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+		addParametersFromModel();
 
-				if (mode == SHOW_ONLY_THIS_PARAMS
-						&& paramsNames.contains(field.getName())) {
-					toShow.add(field);
-				} else if (mode == HIDDE_THIS_PARAMS
-						&& !(paramsNames.contains(field.getName()))) {
-					toShow.add(field);
-				}
-			}
-			this.fields = toShow;
-		} else if (mode == SHOW_ALL) {
-
-		} else {
-			throw new IllegalArgumentException();
-		}
-		this.initialize();
-
 	}
-
-	private void initialize() {
-		this.setLayout(new BorderLayout(6, 6));
-		this.add(this.getParametersScroll(), BorderLayout.CENTER);
-
-		// if (this.showButtons) {
-		// this.add(this.getButtonsPanel(), BorderLayout.SOUTH);
-		// }
-		this.fromParamsToUI();
-	}
-
-	// private JPanel getButtonsPanel() {
-	// if (this.panButtons == null) {
-	// this.panButtons = new JPanel();
-	// this.panButtons.setLayout(new GridBagLayout());
-	// GridBagConstraints constr = new GridBagConstraints();
-	// constr.anchor = GridBagConstraints.LAST_LINE_END;
-	// constr.fill = GridBagConstraints.HORIZONTAL;
-	// constr.weightx = 1;
-	// constr.weighty = 0;
-	// this.panButtons.add(new JLabel(), constr);
-	//
-	// constr = this.getDefaultParametersConstraints();
-	// constr.fill = GridBagConstraints.NONE;
-	// constr.weightx = 0;
-	// constr.weighty = 0;
-	//
-	// this.panButtons.add(this.getAcceptButton(), constr);
-	// this.panButtons.add(this.getCancelButton(), constr);
-	// this.panButtons.add(this.getRestoreDefaults(), constr);
-	// }
-	// return this.panButtons;
-	// }
-
-	// private JButton getRestoreDefaults() {
-	// if (this.botRestoreDefaults == null) {
-	// this.botRestoreDefaults = usManager.createJButton(i18nManager
-	// .getTranslation("restoreDefaults"));
-	// this.botRestoreDefaults.addActionListener(this);
-	// }
-	// return this.botRestoreDefaults;
-	// }
-	//
-	// private JButton getCancelButton() {
-	// if (this.botCancel == null) {
-	// this.botCancel = usManager.createJButton(i18nManager
-	// .getTranslation("cancel"));
-	// this.botCancel.addActionListener(this);
-	// }
-	// return this.botCancel;
-	// }
-	//
-	// private JButton getAcceptButton() {
-	// if (this.botAcept == null) {
-	// this.botAcept = usManager.createJButton(i18nManager
-	// .getTranslation("accept"));
-	// this.botAcept.addActionListener(this);
-	// }
-	// return this.botAcept;
-	// }
-
-	private GridBagConstraints getDefaultParametersConstraints() {
+	
+	private void addGridBagComponent(JPanel panel, DynField field, int row) throws ServiceException {
+	    
+	    	JDynFieldComponent input =  getJDynFieldComponent(field, this);
+		
+		StatusLabel label = this.createFieldLabel(input);
+		input.addValueChangedListener(label);
+		
+		Component component = (Component) input.getComponent();
+		component.setName(field.getName());	
+		addComponentToList(component,input);
+			
+		//Arranging label and component into panel
+		
 		GridBagConstraints constr = new GridBagConstraints();
 		constr.insets = new Insets(2, 2, 2, 2);
+		constr.weighty = row;
 		constr.ipadx = 2;
 		constr.ipady = 2;
-		constr.anchor = GridBagConstraints.PAGE_START;
-		return constr;
-
-	}
-
-	private Component getParametersScroll() {
-		if (parametersScroll == null) {
-			parametersScroll = new JScrollPane();
-			parametersScroll.setViewportView(getParametersPanel());
-			parametersScroll.setBorder(null);
-			parametersScroll
-					.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
-			parametersScroll
-					.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		}
-		return parametersScroll;
-	}
-
-	private JPanel getParametersPanel() {
-		if (this.panParameters == null) {
-			this.panParameters = new JPanel();
-			this.panParameters.setLayout(new GridBagLayout());
-			// this.panParameters.setBorder(BorderFactory
-			// .createTitledBorder(this
-			// .getLocalizedText("values")));
-
-			Iterator<DynField> iter = this.fields.iterator();
-			DynField field;
-			while (iter.hasNext()) {
-				field = iter.next();
-				switch (field.getTheTypeOfAvailableValues()) {
-				case DynField.ANY:
-					this.addFieldSingle(this.panParameters, field);
-					break;
-				case DynField.CHOICE:
-					this.addFieldChoice(this.panParameters, field);
-					break;
-				case DynField.RANGE:
-					this.addFieldRange(this.panParameters, field);
-					break;
-
-				default:
-					// FIXME lanzar un warning???
-					this.addFieldSingle(this.panParameters, field);
-					break;
-				}
-
-			}
-			GridBagConstraints constr = new GridBagConstraints();
-			constr.fill = GridBagConstraints.BOTH;
-			constr.weightx = 1;
-			constr.weighty = 1;
-			constr.gridheight = GridBagConstraints.REMAINDER;
-			constr.gridwidth = GridBagConstraints.REMAINDER;
-			this.panParameters.add(new JLabel(), constr);
-		}
-		return this.panParameters;
-	}
-
-	private JLabel createFieldLabel(DynField field) {
-		JLabel label = new JLabel();
-		label.setText(i18nManager.getTranslation(field.getDescription()));
-
-		if (field.isMandatory()) {
-			label.setForeground(this.mandatoryLabelColor);
-		}
-		return label;
-	}
-
-	private void addFieldRange(JPanel panel, DynField field) {
-		GridBagConstraints constr = this.getDefaultParametersConstraints();
 		constr.fill = GridBagConstraints.HORIZONTAL;
-		constr.weighty = 0;
-		constr.weightx = 0;
+		constr.anchor = GridBagConstraints.NORTHWEST;
 
-		JLabel label = this.createFieldLabel(field);
-		constr.gridwidth = GridBagConstraints.RELATIVE;
+		constr.gridx = 0;
+		constr.gridy = row;
 		panel.add(label, constr);
 
-		constr.gridwidth = GridBagConstraints.REMAINDER;
-		constr.weightx = 1;
 
-		Object max, min;
-		double dmax, dmin, step;
-		max = field.getMaxValue();
-		min = field.getMinValue();
-		boolean decimal;
+		constr.fill = GridBagConstraints.HORIZONTAL;
+		constr.gridx = 1;
+		constr.weightx = 0.7;
+		panel.add(component, constr);
+		
+		input.fireValueChangedEvent();
+	}
 
-		if (!(max instanceof Number)) {
-			max = null;
-		}
-		if (!(min instanceof Number)) {
-			min = null;
-		}
-		dmax = 0;
-		dmin = 0;
-		step = 1;
+	private void addParametersFromModel() throws ServiceException {
+	    DynField field;
+	    JPanel pane;
+	    String[] groups = this.getModel().getGroups();
 
-		switch (field.getType()) {
-		case DataTypes.INT:
-			decimal = false;
-			if (max == null) {
-				max = Integer.MAX_VALUE;
-			} else {
-				dmax = ((Integer) max).doubleValue();
-			}
-			if (min == null) {
-				dmin = Integer.MIN_VALUE;
-			} else {
-				dmin = ((Integer) min).doubleValue();
-			}
-			break;
+	    for (String group: groups){
+		List items = this.getModel().getGroupElements(group);
+		
+		pane = new JPanel(new GridBagLayout());
+		
+	    	for (int i=0;i<items.size();i++) {
+		    field = ((DynFieldComponentModel)items.get(i))
+		    		.getDynField();
+		    addGridBagComponent(pane,field,i);
 
-		case DataTypes.LONG:
-			decimal = false;
-			if (max == null) {
-				dmax = Long.MAX_VALUE;
-			} else {
-				dmax = ((Long) max).doubleValue();
-			}
-			if (min == null) {
-				dmin = Long.MIN_VALUE;
-			} else {
-				dmin = ((Long) min).doubleValue();
-			}
-			break;
-
-		case DataTypes.BYTE:
-			decimal = false;
-			if (max == null) {
-				dmax = Byte.MAX_VALUE;
-			} else {
-				dmax = ((Byte) max).doubleValue();
-			}
-			if (min == null) {
-				dmin = Byte.MIN_VALUE;
-			} else {
-				dmin = ((Byte) min).doubleValue();
-			}
-			break;
-
-		case DataTypes.FLOAT:
-			decimal = true;
-			if (max == null) {
-				dmax = Float.MAX_VALUE;
-			} else {
-				dmax = ((Float) max).doubleValue();
-			}
-			if (min == null) {
-				dmin = Float.MIN_VALUE;
-			} else {
-				dmin = ((Float) min).doubleValue();
-			}
-			break;
-
-		case DataTypes.DOUBLE:
-			decimal = true;
-			if (max == null) {
-				dmax = Double.MAX_VALUE;
-			} else {
-				dmax = ((Double) max).doubleValue();
-			}
-			if (min == null) {
-				dmin = Double.MIN_VALUE;
-			} else {
-				dmin = ((Double) min).doubleValue();
-			}
-			break;
-
-		default:
-			JTextField text = new JTextField();
-			text.setEnabled(false);
-			panel.add(text, constr);
-			this.getComponentField().put(field, text);
-			return;
 		}
-		if ((dmax - dmin) != 0) {
-			step = (dmax - dmin) / 20;
-		}
+		this.tabPanel.addTab(group,createScrollPane(pane));
+	    }
+	}
 
-		SpinnerModel spinnerModel;
-		if (decimal) {
-			spinnerModel = new SpinnerNumberModel(dmin, dmin, dmax, step);
-		} else {
-			spinnerModel = new SpinnerNumberModel((int) dmin, (int) dmin,
-					(int) dmax, (int) step);
-		}
-		JSpinner spinner = new JSpinner(spinnerModel);
-		spinner.setName(field.getName());
-		constr.gridwidth = GridBagConstraints.REMAINDER;
-		constr.weightx = 1;
-		panel.add(spinner, constr);
-		this.getComponentField().put(field, spinner);
+	/**
+	 * @param label
+	 * @param field
+	 */
+	private void checkValidation(JLabel label, JDynFieldComponent field) {
+	    if (label==null) return;
+	    if (!isValid(field)){
+		label.setForeground(this.mandatoryLabelColor);
+	    }else{
+		label.setForeground(Color.BLACK);
+	    }
 	}
+	
+	protected void closeWindow() {
+		LOG.debug("Result DynObject: {}", parameters);
 
-	private void addFieldChoice(JPanel panel, DynField field) {
-		GridBagConstraints constr = this.getDefaultParametersConstraints();
-		constr.fill = GridBagConstraints.HORIZONTAL;
-		constr.weighty = 0;
-		constr.weightx = 0;
-
-		JLabel label = this.createFieldLabel(field);
-		constr.gridwidth = GridBagConstraints.RELATIVE;
-		panel.add(label, constr);
-
-		JComboBox combo = new JComboBox(field.getAvailableValues());
-		combo.setName(field.getName());
-		constr.gridwidth = GridBagConstraints.REMAINDER;
-		constr.weightx = 1;
-		panel.add(combo, constr);
-		this.getComponentField().put(field, combo);
-
+		// if (PluginServices.getMainFrame() == null) {
+		// ((JFrame) (getParent().getParent().getParent().getParent()))
+		// .dispose();
+		// } else {
+		// PluginServices.getMDIManager().closeWindow(this);
+		// }
 	}
+	
+	private StatusLabel createFieldLabel(JDynFieldComponent component) {
+	    	DynField field = component.getDynField();
+		String text = i18nManager.getTranslation(field.getDescription());
 
-	private void addFieldSingle(JPanel panel, DynField field) {
-		GridBagConstraints constr = this.getDefaultParametersConstraints();
-		constr.fill = GridBagConstraints.HORIZONTAL;
-		constr.weighty = 0;
-		constr.weightx = 0;
-
-		JLabel label = this.createFieldLabel(field);
-		constr.gridwidth = GridBagConstraints.RELATIVE;
-		panel.add(label, constr);
-
-		// JTextField text = new JTextField();
-		Component input = getComponentFor(field);
-		input.setName(field.getName());
-		constr.gridwidth = GridBagConstraints.REMAINDER;
-		constr.weightx = 1;
-		panel.add(input, constr);
-		this.getComponentField().put(field, input);
-
+		StatusLabel label = new StatusLabel(text, field.isMandatory());
+	
+		//adding label to a hashmap
+		this.labelList.put (field,label);
+		
+		return label;
 	}
 
-	private Component getComponentFor(DynField field) {
-		Component result = dsManager.createJDynFieldComponent(field,
-				getDynObject());
 
-		return (result == null) ? new JTextField() : result;
+	private Component createScrollPane(JPanel panel) throws ServiceException {
+	    JScrollPane scrollPane = new JScrollPane();
+	    scrollPane.setAlignmentX(JScrollPane.LEFT_ALIGNMENT);	 
+	    scrollPane.setAlignmentY(JScrollPane.TOP_ALIGNMENT);
+	   
+	    
+	    scrollPane.setViewportView(panel);
+	    scrollPane.setAutoscrolls(true);
+////	    scrollPane.setBorder(null);
+//	    scrollPane
+//		.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
+//	    scrollPane
+//		.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+	    return scrollPane;
 	}
 
-	// class MyProjectionSelector extends JPanel {
-	// /**
-	// *
-	// */
-	// private static final long serialVersionUID = -6331922386501903468L;
+/* (non-Javadoc)
+ * @see org.gvsig.tools.swing.api.dynobject.JComponent#getComponent()
+ */
+public Object getComponent() {
+    return this.tabPanel;
+//	    return this.panel;
+}
+
+	/**
+	 * 	OTRAS PRUEBAS DELAYOUT
+	 */
+		
+	//	private GridBagConstraints getDefaultParametersConstraints() {
+	//	GridBagConstraints constr = new GridBagConstraints();
+	//	constr.insets = new Insets(2, 2, 2, 2);
+	//	constr.ipadx = 2;
+	//	constr.ipady = 2;
+	//	return constr;
+	//}
+	
+	//	private JPanel createNorthWestPane(JPanel pane){
+	//	    //Make a panel
+	//	    JPanel northWestPanel = new JPanel(new GridLayout(1,1));
+	//	    GridBagConstraints c = new GridBagConstraints();
+	//	    c.gridx = 0;
+	//	    c.gridy = 0;
+	//	    c.anchor = GridBagConstraints.NORTHWEST;
+	//	    c.insets = new Insets(0,0,0,0);
+	//	    northWestPanel.add(pane, c);
 	//
-	// private CRSSelectPanel crsSelector = null;
-	// private IProjection srs = null;
+	//	    northWestPanel.add(pane);
+	//	    return northWestPanel;
+	//	}
+		
+	//	/**
+	//	 * @throws ServiceException 
+	//	 * 
+	//	 */
+	//	private void addGridBagParametersFromModel() throws ServiceException {
 	//
-	// MyProjectionSelector(){
-	// super();
-	// init();
-	// }
+	//	    DynField field;
+	//	    JPanel pane;
+	//	    String[] groups = this.getModel().getGroups();
 	//
-	// private void init() {
-	// this.setValue(null);
-	// }
+	//	    for (String group: groups){
+	//		List items = this.getModel().getGroupElements(group);
+	//		
+	//		pane = new JPanel(new GridBagLayout());
+	//	    	pane.setBorder(BorderFactory.createTitledBorder("Prueba"));
+	//		
+	//	    	for (int i=0;i<items.size();i++) {
+	//		    field = ((DynFieldComponentModel)items.get(i))
+	//		    		.getDynField();
+	//		    addGridBagFieldSingle(pane,field,i);
+	//		}
+	////		this.tabPanel.addTab(group,createScrollPane(pane));
+	//		this.tabPanel.addTab(group,pane);
+	//	    }
+	//	    
+	//	    this.tabPanel.setSelectedIndex(0);
+	//	}
+		
+	//	private void addFieldSingle(JPanel panel, DynField field, int row) throws ServiceException {
+	//	    
+	//	    	JDynFieldComponent input =  getJDynFieldComponent(field, this);
+	//		
+	//		StatusLabel label = this.createFieldLabel(input);
+	//		input.addValueChangedListener(label);
+	//		
+	//		// JTextField text = new JTextField();
+	//		//Component input = getComponentFor(field);
+	//		Component component = (Component) input.getComponent();
+	//		component.setName(field.getName());	
+	//		addComponentToList(component,input);
+	//		
+	//		
+	//		//Arranging label and component into panel
+	//		
+	//		GridBagConstraints constr = this.getDefaultParametersConstraints();
+	//		
+	//		constr.fill = GridBagConstraints.HORIZONTAL;
+	//			    
+	//		constr.gridx = 0;
+	////		constr.gridy = row;
+	//		constr.gridheight = GridBagConstraints.RELATIVE;
+	//		constr.anchor = GridBagConstraints.PAGE_START;
+	//		constr.weighty = 0;
+	////		constr.w =  1;
+	////		constr.weightx = 0;
+	////		constr.gridheight = GridBagConstraints.RELATIVE;
+	//		panel.add(label, BorderLayout.WEST);
 	//
-	// private void setCurrentProj(IProjection proj) {
-	// if (proj == null){
-	// srs = null;
-	// } else {
-	// srs = proj;
-	// }
-	// }
 	//
-	// public void setValue(IProjection proj) {
-	// if (crsSelector != null) {
-	// this.remove(crsSelector);
-	// }
+	//		
+	//		panel.add(component, BorderLayout.CENTER);
+	//		
+	//		input.fireValueChangedEvent();
+	//	}
+	
+	//	private void initialize() throws ServiceException {
+	//		this.panel = new JPanel(new BorderLayout(6,6));
+	//		this.panel.setPreferredSize(new Dimension(800, 560));
+	//		
+	////		this.panel.add(this.getParametersScroll(), BorderLayout.PAGE_START);
 	//
-	// crsSelector = CRSSelectPanel.getPanel(proj);
-	// crsSelector
-	// .setTransPanelActive(DynObjectEditor.this.srsShowTransformPanel);
-	// crsSelector.addActionListener(new ActionListener() {
-	// public void actionPerformed(ActionEvent e) {
-	// setCurrentProj(crsSelector.getCurProj());
-	// }
-	// });
+	//		this.panel.add(this.getParametersPanel(isMainPanel), BorderLayout.PAGE_START);
+	////		this.panel =  this.getParametersScroll();
 	//
-	// this.add(crsSelector);
-	// this.doLayout();
-	// }
-	//
-	// public IProjection getValue() {
-	// return srs;
-	// }
-	//
-	//
-	//
-	// }
-
-	private void fromParamsToUISingle(DynField field, Component component) {
-
-		// Object value = parameters.getDynValue(field.getName());
-		// JTextField text;
-		// switch (field.getType()) {
-		// case DataTypes.STRING:
-		// text = (JTextField) component;
-		// if (value == null) {
-		// text.setText("");
-		// return;
-		// }
+	//		//		this.panel.add(this.panParameters);
+	//		// if (this.showButtons) {
+	//		// this.add(this.getButtonsPanel(), BorderLayout.SOUTH);
+	//		// }
+	////		this.fromParamsToUI();
+	//	}
+	
+		// private JPanel getButtonsPanel() {
+		// if (this.panButtons == null) {
+		// this.panButtons = new JPanel();
+		// this.panButtons.setLayout(new GridBagLayout());
+		// GridBagConstraints constr = new GridBagConstraints();
+		// constr.anchor = GridBagConstraints.LAST_LINE_END;
+		// constr.fill = GridBagConstraints.HORIZONTAL;
+		// constr.weightx = 1;
+		// constr.weighty = 0;
+		// this.panButtons.add(new JLabel(), constr);
 		//
-		// text.setText((String) value);
-		// break;
+		// const3r = this.getDefaultParametersConstraints();
+		// constr33.fill = GridBagConstraints.NONE;
+		// constr.weightx = 0;
+		// constr.weighty = 0;
 		//
-		// // case DataTypes.SRS:
-		// // ((MyProjectionSelector) component).setValue((IProjection) value);
-		// // break;
-		//
-		// default:
-		// text = (JTextField) component;
-		// if (value == null) {
-		// text.setText("");
-		// return;
+		// this.panButtons.add(this.getAcceptButton(), constr);
+		// this.panButtons.add(this.getCancelButton(), constr);
+		// this.panButtons.add(this.getRestoreDefaults(), constr);
 		// }
+		// return this.panButtons;
+		// }
+	
+		// private JButton getRestoreDefaults() {
+		// if (this.botRestoreDefaults == null) {
+		// this.botRestoreDefaults = usManager.createJButton(i18nManager
+		// .getTranslation("restoreDefaults"));
+		// this.botRestoreDefaults.addActionListener(this);
+		// }
+		// return this.botRestoreDefaults;
+		// }
 		//
-		// text.setText(value.toString());
-		// break;
+		// private JButton getCancelButton() {
+		// if (this.botCancel == null) {
+		// this.botCancel = usManager.createJButton(i18nManager
+		// .getTranslation("cancel"));
+		// this.botCancel.addActionListener(this);
 		// }
-
-	}
-
-	private void fromParamsToUIRange(DynField field, Component component) {
-		JSpinner spinner = (JSpinner) component;
-
-		Object value = parameters.getDynValue(field.getName());
-		double dValue = 0;
-		if (value == null) {
-			value = field.getMinValue();
-		}
-		if (value instanceof Double) {
-			dValue = ((Double) value).doubleValue();
-		} else if (value instanceof String) {
-			dValue = Double.parseDouble((String) value);
-		} else {
-			// FIXME ????
-			dValue = 0;
-		}
-		spinner.setValue(dValue);
-
-	}
-
-	private void fromParamsToUIChoice(DynField field, Component component) {
-		JComboBox combo = (JComboBox) component;
-		Object value = parameters.getDynValue(field.getName());
-
-		DynObjectValueItem item = null;
-		for (int i = 0; i < field.getAvailableValues().length; i++) {
-			if (value == null) {
-				if (field.getAvailableValues()[i].getValue() == null) {
-					item = field.getAvailableValues()[i];
-					break;
-				}
-			} else {
-				if (field.getAvailableValues()[i].getValue().equals(value)) {
-					item = field.getAvailableValues()[i];
-					break;
-				}
-
-			}
-		}
-
-		combo.getModel().setSelectedItem(item);
-
-	}
-
-	private void fromDefaultsToUISingle(DynField field, Component component) {
-		JTextField text = (JTextField) component;
-
-		if (field.getDefaultValue() == null) {
-			text.setText("");
-		} else if (field.getType() == DataTypes.STRING) {
-			text.setText((String) field.getDefaultValue());
-		} else {
-			text.setText(field.getDefaultValue().toString());
-		}
-
-	}
-
-	private void fromDefaultsToUIChoice(DynField field, Component component) {
-		JComboBox combo = (JComboBox) component;
-		Object value = field.getDefaultValue();
-
-		DynObjectValueItem item = null;
-		for (int i = 0; i < field.getAvailableValues().length; i++) {
-			if (value == null) {
-				if (field.getAvailableValues()[i].getValue() == null) {
-					item = field.getAvailableValues()[i];
-					break;
-				}
-			} else {
-				if (field.getAvailableValues()[i].getValue().equals(value)) {
-					item = field.getAvailableValues()[i];
-					break;
-				}
-
-			}
-		}
-
-		combo.getModel().setSelectedItem(item);
-	}
-
-	private void fromDefaultsToUIRange(DynField field, Component component) {
-		JSpinner spinner = (JSpinner) component;
-		Object value = field.getDefaultValue();
-		double dValue = 0;
-		if (value == null) {
-			value = field.getMinValue();
-		}
-
-		if (value instanceof Double) {
-			dValue = ((Double) value).doubleValue();
-		} else if (value instanceof String) {
-			dValue = Double.parseDouble((String) value);
-		} else {
-			// FIXME ????
-			dValue = 0;
-		}
-
-		spinner.setValue(dValue);
-	}
-
-	public void fromParamsToUI() {
-		Iterator<Entry<DynField, Component>> iter = this.getComponentField()
-				.entrySet().iterator();
-		Entry<DynField, Component> entry;
-		while (iter.hasNext()) {
-			entry = iter.next();
-
-			switch (entry.getKey().getTheTypeOfAvailableValues()) {
-			case DynField.ANY:
-				this.fromParamsToUISingle(entry.getKey(), entry.getValue());
-				break;
-			case DynField.CHOICE:
-				this.fromParamsToUIChoice(entry.getKey(), entry.getValue());
-				break;
-			case DynField.RANGE:
-				this.fromParamsToUIRange(entry.getKey(), entry.getValue());
-				break;
-
-			default:
-				// FIXME warning??
-				this.fromParamsToUISingle(entry.getKey(), entry.getValue());
-				break;
-			}
-
-		}
-	}
-
-	public void fromDefaultsToUI() {
-		Iterator<Entry<DynField, Component>> iter = this.getComponentField()
-				.entrySet().iterator();
-		Entry<DynField, Component> entry;
-		while (iter.hasNext()) {
-			entry = iter.next();
-
-			switch (entry.getKey().getTheTypeOfAvailableValues()) {
-			case DynField.ANY:
-				this.fromDefaultsToUISingle(entry.getKey(), entry.getValue());
-				break;
-			case DynField.CHOICE:
-				this.fromDefaultsToUIChoice(entry.getKey(), entry.getValue());
-				break;
-			case DynField.RANGE:
-				this.fromDefaultsToUIRange(entry.getKey(), entry.getValue());
-				break;
-
-			default:
-				// FIXME warning??
-				this.fromParamsToUISingle(entry.getKey(), entry.getValue());
-				break;
-			}
-
-		}
-	}
-
-	@Override
-	public void storeData() {
-		// TODO go through all JDynFieldComponents and call storeData() on them
-	}
-
-	private void fromUIToParams() {
-		Iterator<Entry<DynField, Component>> iter = this.getComponentField()
-				.entrySet().iterator();
-		Entry<DynField, Component> entry;
-		while (iter.hasNext()) {
-			entry = iter.next();
-
-			switch (entry.getKey().getTheTypeOfAvailableValues()) {
-			case DynField.ANY:
-				this.fromUIToParamsSingle(entry.getKey(), entry.getValue());
-				break;
-			case DynField.CHOICE:
-				this.fromUIToParamsChoice(entry.getKey(), entry.getValue());
-				break;
-			case DynField.RANGE:
-				this.fromUIToParamsRange(entry.getKey(), entry.getValue());
-				break;
-
-			default:
-				// FIXME warning??
-				this.fromUIToParamsSingle(entry.getKey(), entry.getValue());
-				break;
-			}
-
-		}
-
-	}
-
-	private void fromUIToParamsSingle(DynField field, Component component) {
-		JTextField text;
-
-		switch (field.getType()) {
-		case DataTypes.STRING:
-			text = (JTextField) component;
-			if (text.getText().length() == 0) {
-				String curValue = (String) parameters.getDynValue(field
-						.getName());
-				if (curValue == null || curValue.length() == 0) {
-					return;
-				}
-			}
-			parameters.setDynValue(field.getName(), text.getText());
-			break;
-
-		case DataTypes.INT:
-			text = (JTextField) component;
-			if (text.getText().length() == 0) {
-				Integer curValue = (Integer) parameters.getDynValue(field
-						.getName());
-				if (curValue == null) {
-					return;
-				}
-			}
-
-			// try{
-			parameters.setDynValue(field.getName(), new Integer(Integer
-					.parseInt(text.getText())));
-			// } catch (NumberFormatException e) {
-			// NotificationManager.addError(e);
-			// }
-			break;
-
-		case DataTypes.BOOLEAN:
-			text = (JTextField) component;
-
-			if (text.getText().length() == 0) {
-				Boolean curValue = (Boolean) parameters.getDynValue(field
-						.getName());
-				if (curValue == null) {
-					return;
-				}
-			}
-
-			parameters.setDynValue(field.getName(), new Boolean(Boolean
-					.parseBoolean(text.getText())));
-
-			break;
-
-		// case DataTypes.SRS:
-		// parameters.setDynValue(field.getName(),
-		// ((MyProjectionSelector) component).getValue());
+		// return this.botCancel;
+		// }
 		//
-		// break;
-
-		case DataTypes.OBJECT:
-			// TODO
-
-			break;
-		default:
-			// FIXME Warning !!!
-			text = (JTextField) component;
-			if (text.getText().length() == 0) {
-				Object curValue = parameters.getDynValue(field.getName());
-				if (curValue == null) {
-					return;
-				}
-			}
-
-			parameters.setDynValue(field.getName(), text.getText());
-			break;
-		}
-	}
-
-	private void fromUIToParamsChoice(DynField field, Component component) {
-		JComboBox combo = (JComboBox) component;
-		parameters.setDynValue(field.getName(), ((DynObjectValueItem) combo
-				.getSelectedItem()).getValue());
-	}
-
-	private void fromUIToParamsRange(DynField field, Component component) {
-		JSpinner spinner = (JSpinner) component;
-		parameters.setDynValue(field.getName(), spinner.getValue());
-
-	}
-
-	private Map<DynField, Component> getComponentField() {
-		if (this.componentField == null) {
-			this.componentField = new HashMap<DynField, Component>();
-		}
-		return componentField;
-
-	}
-
-	// public void actionPerformed(ActionEvent e) {
-	// Component source = (Component) e.getSource();
-	// if (source == this.botAcept) {
-	// this.fromUIToParams();
-	// this.closeWindow();
+		// private JButton getAcceptButton() {
+		// if (this.botAcept == null) {
+		// this.botAcept = usManager.createJButton(i18nManager
+		// .getTranslation("accept"));
+		// this.botAcept.addActionListener(this);
+		// }
+		// return this.botAcept;
+		// }
+	
+	//	private void addGridLayoutComponent(JPanel panel, DynField field, int row) throws ServiceException {
+	//	    
+	//	    	JDynFieldComponent input =  getJDynFieldComponent(field, this);
+	//		
+	//		StatusLabel label = this.createFieldLabel(input);
+	//		input.addValueChangedListener(label);
+	//		
+	//		// JTextField text = new JTextField();
+	//		//Component input = getComponentFor(field);
+	//		Component component = (Component) input.getComponent();
+	//		component.setName(field.getName());	
+	//		addComponentToList(component,input);
+	//		
+	//		
+	//		//Arranging label and component into panel
+	//		
+	//		GridBagConstraints constr = this.getDefaultParametersConstraints();
+	//		
+	////		constr.fill = GridBagConstraints.HORIZONTAL;
+	////			    
+	////		constr.gridx = 0;
+	//////		constr.gridy = row;
+	////		constr.gridheight = GridBagConstraints.RELATIVE;
+	////		if (row==0){
+	////		    constr.anchor = GridBagConstraints.NORTHWEST;
+	////		}else{
+	////		    constr.anchor = GridBagConstraints.PAGE_START;
+	////		}
+	////		constr.weighty = 0;
+	////		constr.w =  1;
+	////		constr.weightx = 0;
+	////		constr.gridheight = GridBagConstraints.RELATIVE;
+	//		panel.add(label);
 	//
-	// } else if (source == this.botCancel) {
-	// // TODO Close windows
-	// this.closeWindow();
-	// } else if (source == this.botRestoreDefaults) {
-	// this.fromDefaultsToUI();
 	//
-	// }
-	// if (!this.getComponentField().containsValue(e.getSource())) {
-	// return;
-	// }
-	// System.out.println("Action perform:" + source);
-	//
-	// }
+	////		constr.fill = GridBagConstraints.BOTH;
+	////		if (row==0){
+	////		    constr.anchor = GridBagConstraints.NORTHWEST;
+	////		}else{
+	////		    constr.anchor = GridBagConstraints.PAGE_START;
+	////		}
+	////		constr.gridx = 1;
+	////		constr.gridwidth = GridBagConstraints.NONE;
+	////		constr.weightx = 0.70;
+	//		panel.add(component);
+	//		
+	//		input.fireValueChangedEvent();
+	//	}
+	
+		
+		private JLabel getFieldLabel (DynField field){
+		    return this.labelList.get(field);
+		}
 
-	protected void closeWindow() {
-		LOG.debug("Result DynObject: {}", parameters);
-
-		// if (PluginServices.getMainFrame() == null) {
-		// ((JFrame) (getParent().getParent().getParent().getParent()))
-		// .dispose();
-		// } else {
-		// PluginServices.getMDIManager().closeWindow(this);
-		// }
-	}
-
 	// /* (non-Javadoc)
 	// * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
 	// */
@@ -877,51 +435,56 @@
 	// }
 
 	/**
-	 * @param mandatoryLabelColor
-	 *            the mandatoryLabelColor to set
+	 * @return the mandatoryLabelColor
 	 */
-	public void setMandatoryLabelColor(Color mandatoryLabelColor) {
-		this.mandatoryLabelColor = mandatoryLabelColor;
+	public Color getMandatoryLabelColor() {
+		return mandatoryLabelColor;
 	}
 
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.swing.spi.AbstractDynObjectComponent#getValue()
+	 */
+	@Override
+	public Object getValue() {
+	    return this.getDynObject();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.swing.api.dynobject.ValueChangedListener#handleValueChanged(org.gvsig.tools.swing.api.dynobject.JDynObjectComponent, org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent)
+	 */
+	public void handleValueChanged(JDynFieldComponent field) {
+	    JLabel label = getFieldLabel(field.getDynField());
+	    this.checkValidation(label, field);
+	}
+
 	/**
-	 * @return the mandatoryLabelColor
+	 * @param field
+	 * @return
 	 */
-	public Color getMandatoryLabelColor() {
-		return mandatoryLabelColor;
+	protected boolean isValid(JDynFieldComponent field) {   
+	    return field.isValid();
 	}
 
-	// public void editObject(boolean modal) {
-	// // this.modal = modal;
-	// // try {
-	// // PluginServices.getMDIManager().addWindow(this);
-	// // } catch (Exception e) {
-	// // JFrame frame = new JFrame();
-	// // frame.setLayout(new BorderLayout());
-	// // frame.add(this);
-	// // frame.setBounds(10, 10, 400, 400);
-	// // frame.setVisible(true);
-	// // }
-	// }
 
-	// public String getTitle() {
-	// return title;
-	// }
-	//
-	// public void setTitle(String title) {
-	// this.title = title;
-	// }
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.swing.api.dynobject.JDynObjectComponent#requestFocus()
+	 */
+	public void requestFocus() {
+	}
 
-	// public Object getWindowProfile() {
-	// return WindowInfo.PROPERTIES_PROFILE;
-	// }
+	/**
+	 * @param mandatoryLabelColor
+	 *            the mandatoryLabelColor to set
+	 */
+	public void setMandatoryLabelColor(Color mandatoryLabelColor) {
+		this.mandatoryLabelColor = mandatoryLabelColor;
+	}
 
-	// public boolean isSrsShowTransformPanel() {
-	// return srsShowTransformPanel;
-	// }
-	//
-	// public void setSrsShowTransformPanel(boolean srsShowTransformPanel) {
-	// this.srsShowTransformPanel = srsShowTransformPanel;
-	// }
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#setValue(java.lang.Object)
+	 */
+	public void setValue(Object value) {
+	   
+	}
 
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StatusLabel.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StatusLabel.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/StatusLabel.java	(revision 168)
@@ -0,0 +1,105 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+
+import java.awt.Color;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ * 
+ */
+public class StatusLabel extends JLabel implements ValueChangedListener{
+
+    private static final String NOT_VALIDATED = "unavailable.png";
+    
+    private static final Color COLOR_MANDATORY = Color.RED;
+    
+
+    public StatusLabel(String text, boolean isMandatory) {
+	setOpaque(true);
+	setHorizontalTextPosition(JLabel.LEFT);
+	setHorizontalAlignment(LEFT);
+	setVerticalAlignment(CENTER);
+	setIconTextGap(10);
+	if (isMandatory){
+	    this.setForeground(COLOR_MANDATORY);
+	    this.setText("<html><u>" + text + "</u><html>");
+	}else
+	    setText(text);
+    }
+
+
+    /**
+     * @param notValidated
+     * @return
+     */
+    private Icon getIcon(String notValidated, String description) {
+	String path = this.getClass().getResource(NOT_VALIDATED).getPath();
+	if ((path==null)||(path.equals("")))
+	    return null;
+	ImageIcon icon = new ImageIcon(path);
+	icon.setDescription(description);
+	icon.setImageObserver(this);
+	return icon;
+    }
+//
+//    // Set the font and text when no image was found.
+//    protected void setText(String text, Font normalFont) {
+//	if (uhOhFont == null) { // lazily create this font
+//	    uhOhFont = normalFont.deriveFont(Font.ITALIC);
+//	}
+//	setFont(uhOhFont);
+//	setText(uhOhText);
+//    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.ValueChangedListener#handleValueChanged(org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent)
+     */
+    public void handleValueChanged(JDynFieldComponent field) {
+
+	// Set the icon and text. If icon was null, say so.
+	if (!field.isValid()){	    
+	    this.setIcon(getIcon(NOT_VALIDATED, "Not Validated"));	    
+	}else{
+	    setIcon(null);	    
+	}
+    }
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/AbstractDynObjectModel.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/AbstractDynObjectModel.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/AbstractDynObjectModel.java	(revision 168)
@@ -0,0 +1,138 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public abstract class AbstractDynObjectModel implements DynObjectModel{
+
+    private Map modelsList;
+    protected DynClass dynClass;
+
+    
+    public AbstractDynObjectModel(DynClass theClass, boolean initAll){
+	this.dynClass = theClass;
+	this.modelsList = new LinkedHashMap();
+	if (initAll)
+	    initDynFieldComponentModelList();
+    }
+    
+    public DynFieldComponentModel add(String fieldName) {
+	return add("General",fieldName);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynObjectComponentModel#add(org.gvsig.tools.dynobject.DynField)
+     */
+    public DynFieldComponentModel add(String group, String fieldName) {
+	addGroup(group);
+	if (fieldName!=null){
+	    DynFieldComponentModel elem = createDynObjectModelElement(fieldName,dynClass, group);
+	    List list = getGroup(group);
+	    if (isNewElement(list, elem))
+		list.add(list.size(),elem);
+	    return elem;
+	}	    
+	return null;
+    }
+
+    public void addGroup(String group){
+	if (!hasGroup(group))
+	    this.modelsList.put(group, new ArrayList());
+    }
+
+    
+    /**
+     * @param field
+     * @param dynClass
+     * @return
+     */
+    protected abstract DynFieldComponentModel createDynObjectModelElement(
+	    String fieldName, DynClass dynClass, String group);
+    
+    
+
+    protected List getGroup(String group){
+	return (List) this.modelsList.get(group);
+    }
+   
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynObjectComponentModel#getFieldModel()
+     */
+    public List getGroupElements(String group) {
+	return (List) this.modelsList.get(group);
+    }
+
+    public String[] getGroups(){
+	return (String[]) this.modelsList.keySet().toArray(new String[0]);
+    }
+    
+    protected boolean hasGroup(String group){
+	return this.modelsList.containsKey(group);
+    }
+    /**
+     * 
+     */
+    public abstract void initDynFieldComponentModelList();
+
+    /**
+     * @param list
+     * @param elem
+     * @return
+     */
+    private boolean isNewElement(List list, DynFieldComponentModel elem) {
+	if ((list==null)||(elem==null))
+	    return false;
+	DynFieldComponentModel item;
+	for (int i=0;i<list.size();i++){
+	    item = (DynFieldComponentModel) list.get(i);
+	    if (item.equals(elem)){
+		return false;
+	    }
+	}
+	return true;
+    }
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectModel.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectModel.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectModel.java	(revision 168)
@@ -0,0 +1,79 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class DefaultDynObjectModel extends AbstractDynObjectModel implements DynObjectModel{
+
+    /**
+     * @param initAll 
+     * @param theClass
+     */
+    public DefaultDynObjectModel(DynClass dynClass, boolean initAll) {
+	super(dynClass, initAll);
+	
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractDynObjectModel#createDynObjectComponentModelElement(org.gvsig.tools.dynobject.DynField, org.gvsig.tools.dynobject.DynClass)
+     */
+    protected DynFieldComponentModel createDynObjectModelElement(
+	    String fieldName, DynClass dynClass, String group) {
+	return new DefaultDynObjectModelElement(fieldName,dynClass, group);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractDynObjectModel#initDynFieldComponentModelList()
+     */
+    public void initDynFieldComponentModelList() {
+	if (this.dynClass==null) return;
+	DynField[] fields = this.dynClass.getDeclaredDynFields();
+	if (fields!=null){
+	    DynField field = null;
+	    for (int i=0;i<fields.length;i++){
+		field = fields[i];
+		if (!field.isHidden()){
+		    this.add(field.getName());
+		}
+	    }
+	}
+    }
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectSwingManager.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectSwingManager.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectSwingManager.java	(revision 168)
@@ -26,15 +26,19 @@
  */
 package org.gvsig.tools.swing.impl.dynobject;
 
-import java.util.HashMap;
-import java.util.Map;
-
+import org.gvsig.tools.dynobject.DynClass;
 import org.gvsig.tools.dynobject.DynField;
 import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.AbstractMultiServiceImplManager;
+import org.gvsig.tools.service.Service;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
 import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
 import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
-import org.gvsig.tools.swing.api.dynobject.dynfield.DynFieldComponentFactory;
 import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.DynObjectSwingServiceManager;
+import org.gvsig.tools.swing.spi.ToolsSwingServiceLocator;
 
 /**
  * Default {@link DynObjectSwingManager} implementation.
@@ -45,34 +49,104 @@
  * 
  * @author 2010- César Ordiñana - gvSIG team
  */
-public class DefaultDynObjectSwingManager implements DynObjectSwingManager {
+public class DefaultDynObjectSwingManager extends
+	AbstractMultiServiceImplManager implements DynObjectSwingManager {
 
-	private Map<Integer, DynFieldComponentFactory> fieldFactories = new HashMap<Integer, DynFieldComponentFactory>(
-			10);
 
-	public JDynObjectComponent createJDynObjectComponent(DynObject dynObject) {
-		return createJDynObjectComponent(dynObject, MODE_FORM);
-	}
+    //
+    // private Map<Integer, DynFieldComponentFactory> fieldFactories = new
+    // HashMap<Integer, DynFieldComponentFactory>(
+    // 10);
 
-	public JDynObjectComponent createJDynObjectComponent(DynObject dynObject,
-			String mode) {
-		return new DefaultJDynObjectComponent(dynObject);
-	}
+    /**
+     * @param serviceManager
+     */
+    public DefaultDynObjectSwingManager() {
+	super(ToolsSwingServiceLocator.getServiceManager());
+    }
 
-	public JDynFieldComponent createJDynFieldComponent(DynField field,
-			DynObject dynObject) {
-		DynFieldComponentFactory factory = getFactoryFor(field.getType());
-		return (factory == null) ? null : factory.createJDynFieldComponent(
-				field, dynObject);
-	}
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager#createJDynObjectModel(org.gvsig.tools.dynobject.DynClass)
+     */
+    public DynObjectModel createDynObjectModel(DynClass dynClass)
+	    throws ServiceException {
+	return new DefaultDynObjectModel(dynClass, true);
+    }
 
-	public void registerDynFieldComponentFactory(
-			DynFieldComponentFactory factory, int dataType) {
-		fieldFactories.put(dataType, factory);
-	}
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager#createEmptyDynObjectModel(org.gvsig.tools.dynobject.DynClass)
+     */
+    public DynObjectModel createEmptyDynObjectModel(DynClass dynClass)
+	    throws ServiceException {
+	return new DefaultDynObjectModel(dynClass, false);
+    }
 
-	private DynFieldComponentFactory getFactoryFor(int dataType) {
-		return fieldFactories.get(dataType);
-	}
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager#createJDynFieldComponent(org.gvsig.tools.dynobject.DynField, org.gvsig.tools.dynobject.DynObject)
+     */
+    public JDynFieldComponent createJDynFieldComponent(ValueField parent, DynField field) throws ServiceException {
+	JDynFieldComponent component;
+	if (field.getElementsType()!=null)
+	    component = ((DynObjectSwingServiceManager) this.getServiceManager()).getJDynFieldComponent(parent,field, true);
+	else
+	    component = ((DynObjectSwingServiceManager) this.getServiceManager()).getJDynFieldComponent(parent,field, false);
+	return component;
+    }
 
+    public JDynObjectComponent createJDynObjectComponent(DynObject dynObject) throws ServiceException {
+	return createJDynObjectComponent(dynObject, createDynObjectModel(dynObject.getDynClass()));
+    }
+
+    public JDynObjectComponent createJDynObjectComponent(DynObject dynObject,
+	    DynObjectModel model) throws ServiceException {
+	return createJDynObjectComponent(dynObject, model, MODE_FORM);
+    }
+
+
+
+//    /*
+//     * (non-Javadoc)
+//     * 
+//     * @see
+//     * org.gvsig.tools.service.Manager#createServiceParameters(java.lang.String)
+//     */
+//    public DynObject createServiceParameters(String serviceName)
+//	    throws ServiceException {
+//
+//	return ToolsLocator.getDynObjectManager().createDynObject(serviceName);
+//    }
+
+    public JDynObjectComponent createJDynObjectComponent(DynObject dynObject,
+	    DynObjectModel model, String mode) throws ServiceException {
+	DynObject serviceParams = this.createServiceParameters(getServiceName(dynObject,mode));
+	
+	serviceParams
+		.setDynValue(JDynObjectComponent.PARAMETERS.DYNMODEL, model);
+	serviceParams.setDynValue(JDynObjectComponent.PARAMETERS.DYNOBJECT,
+		dynObject);
+
+	return (JDynObjectComponent) this.getService(serviceParams);
+
+    }
+    
+    public JDynObjectComponent createJDynObjectComponent(DynObject dynObject,
+	    String mode) throws ServiceException {
+	return createJDynObjectComponent(dynObject, createDynObjectModel(dynObject.getDynClass()));
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.service.Manager#getService(org.gvsig.tools.dynobject.DynObject)
+     */
+    public Service getService(DynObject serviceParams) throws ServiceException {
+	return this.getServiceManager().createService(serviceParams);
+    }
+
+    /**
+     * @param dynObject
+     * @param mode
+     * @return
+     */
+    private String getServiceName(DynObject dynObject, String mode) {
+	return mode;
+    }
 }
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectSwingServiceManager.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectSwingServiceManager.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultDynObjectSwingServiceManager.java	(revision 168)
@@ -0,0 +1,156 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.AbstractServiceManager;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.impl.dynobject.dynfield.JComboBoxDynFieldComponent;
+import org.gvsig.tools.swing.spi.DynObjectSwingServiceManager;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class DefaultDynObjectSwingServiceManager extends AbstractServiceManager implements DynObjectSwingServiceManager{
+
+    private DynObject createJDynFieldParams(DynField field){
+	int times =0;
+	Object res=null;
+	
+	while ((res==null)&& (times<4))
+	    res = getServiceParams(field,times++);
+	if (res == null) return null;
+	
+	return (DynObject) res;
+	
+    }
+
+    public JDynFieldComponent getJDynFieldComponent(ValueField parent, DynField field,boolean getContainerType) throws ServiceException {
+	
+	DynObject serviceParams = createJDynFieldParams(field);
+
+	serviceParams
+		.setDynValue(JDynFieldComponent.PARAMETERS.DYNFIELD, field);
+	serviceParams
+		.setDynValue(JDynFieldComponent.PARAMETERS.PARENT, parent);
+
+	return (JDynFieldComponent) this.createService(serviceParams);
+	
+  }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DynObjectSwingServiceManager#getJSingleComboBoxDynFieldComponent(org.gvsig.tools.dynobject.DynField, org.gvsig.tools.swing.api.dynobject.dynfield.ValueField)
+     */
+    public JDynFieldComponent getJSingleComboBoxDynFieldComponent(JDynFieldComponent component, DynField field) {
+	return  new JComboBoxDynFieldComponent(component, field);
+
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.service.spi.AbstractServiceManager#getRegistryDescription()
+     */
+    @Override
+    protected String getRegistryDescription() {
+	// TODO Auto-generated method stub
+	return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.service.spi.AbstractServiceManager#getRegistryKey()
+     */
+    @Override
+    protected String getRegistryKey() {
+	return "DefaultDynObjectSwingServiceManager";
+    }
+    
+    /**
+     * @param field
+     * @return
+     */
+    private String getServiceName(DynField field, int times) {
+//	if (field.getType()==DataTypes.DYNOBJECT)
+//	    getServiceName(field.getType(),field.get.getFullName(),true);
+        
+	if (times==0){
+	    // Search in type and subtype
+//	    if (field.getElementsType()!=null) // if container
+//		 getServiceName(field.getType(),field.getSubType(),true);
+//	        	
+	    return getServiceName(field.getType(),field.getSubtype(),true);	     
+	}
+	if (times==1)
+	    return getServiceName(field.getType(),field.getSubtype(), false);
+	return getServiceName(DataTypes.STRING,null,true);
+    }
+    
+    public String getServiceName(int type, String subType){
+	return getServiceName(type,subType,true);
+    }
+    
+    
+    public String getServiceName(int type, String subType, boolean useSubType){
+	if ((subType==null)||(subType.equals(""))){
+	    //No subtype
+	    return "field." + ToolsLocator.getDataTypesManager().getTypeName(type);	    
+	}
+	if (useSubType)
+	    return "field." + ToolsLocator.getDataTypesManager().getTypeName(type)+ "." + subType;	    
+	return "field." + ToolsLocator.getDataTypesManager().getTypeName(type);	    			
+    }
+
+    private DynObject getServiceParams(DynField field, int times){
+	try {
+	    return this.createServiceParameters(getServiceName(field,times));
+	} catch (ServiceException e) {
+	    return null;
+	}
+
+    }
+
+//    /* (non-Javadoc)
+//     * @see org.gvsig.tools.swing.spi.DynObjectSwingServiceManager#getJSingleReadOnlyDynFieldComponent(org.gvsig.tools.dynobject.DynField, org.gvsig.tools.swing.api.dynobject.dynfield.ValueField)
+//     */
+//    public JDynFieldComponent getJSingleReadOnlyDynFieldComponent(JDynFieldComponent component,
+//	    DynField field) {
+//	   return new JReadOnlyDynFieldComponent(component, field);	
+//    }
+
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultJDynObjectComponentFactory.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultJDynObjectComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/DefaultJDynObjectComponentFactory.java	(revision 168)
@@ -0,0 +1,99 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.service.spi.ServiceFactory;
+import org.gvsig.tools.swing.api.dynobject.DynObjectModel;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponentFactory;
+import org.gvsig.tools.swing.spi.AbstractDynObjectFactory;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class DefaultJDynObjectComponentFactory extends AbstractDynObjectFactory implements ServiceFactory, JDynObjectComponentFactory{
+
+    private static final String SERVICE_NAME = "form";
+    private static final String SERVICE_DESCRIPTIPON = "";
+    
+   
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.JDynObjectComponentFactory#createJDynObjectComponent(org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager, org.gvsig.tools.dynobject.DynObject, org.gvsig.tools.swing.api.dynobject.DynObjectComponentModel)
+     */
+    public JDynObjectComponent createJDynObjectComponent(DynObject dynObject,
+	    DynObjectModel model) throws ServiceException {
+	return new DefaultJDynObjectComponent(dynObject, model);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.impl.dynobject.AbstractSwingServiceFactory#getServiceDescription()
+     */
+    @Override
+    public String getFactoryDescription() {
+	return SERVICE_DESCRIPTIPON;
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractDynObjectFactory#getFactoryName()
+     */
+    @Override
+    public String getFactoryName() {
+	return SERVICE_NAME;
+    }
+        
+    
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.impl.dynobject.AbstractSwingServiceFactory#getFactorySubType()
+     */
+    @Override
+    public String getFactorySubType() {
+	return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.impl.dynobject.AbstractSwingServiceFactory#getFactoryType()
+     */
+    @Override
+    public Integer getFactoryType() {
+	return null;
+    }
+
+  
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/ListItemValueField.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/ListItemValueField.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/ListItemValueField.java	(revision 168)
@@ -0,0 +1,107 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class ListItemValueField  implements ValueField {
+
+    private List<Object> items;
+    private Object defaultValue;
+
+    /**
+     * @param dynObject
+     * @param fieldName
+     */
+    public ListItemValueField(DynObject dynObject,String fieldName, int index) {
+	
+	Object value = dynObject.getDynValue(fieldName);
+
+	this.items = new ArrayList<Object>();
+	if (value!=null){
+	    this.setValue(value);
+	    return;
+	}
+	   
+	DynField fieldType = dynObject.getDynClass().getDynField(fieldName);
+	this.defaultValue = fieldType.getDefaultValue();
+	if (defaultValue!=null)
+	    this.setValue(defaultValue);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#getDefaultValue()
+     */
+    public Object getDefaultValue() {
+	return this.defaultValue;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#getValue()
+     */
+    public Object getValue() {
+	return this.items;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#getValue()
+     */
+    public Object getValueItem(int index) {
+	return this.items.get(index);
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#setValue(java.lang.Object)
+     */
+    public void setValue(Object value) {
+	this.items = (List<Object>) value;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#setValue(java.lang.Object)
+     */
+    public void setValueItem(Object item, int index) {
+	this.items.set(index, item);
+    }
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/NumberFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/NumberFieldComponentFactory.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/NumberFieldComponentFactory.java	(revision 168)
@@ -1,47 +0,0 @@
-/* gvSIG. Geographic Information System of the Valencian Government
-*
-* Copyright (C) 2007-2008 Infrastructures and Transports Department
-* of the Valencian Government (CIT)
-* 
-* 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 2
-* 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.
-* 
-* 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.
-* 
-*/
-
-/*
-* AUTHORS (In addition to CIT):
-* 2010 {}  {{Task}}
-*/
-package org.gvsig.tools.swing.impl.dynobject.dynfield;
-
-import org.gvsig.tools.dynobject.DynField;
-import org.gvsig.tools.dynobject.DynObject;
-import org.gvsig.tools.swing.api.dynobject.dynfield.DynFieldComponentFactory;
-import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
-
-/**
- * Factory to create {@link JDynFieldComponent} objects to render
- * {@link DynObject} attribute values of byte, short, int or long types.
- * 
- * @author 2010- César Ordiñana - gvSIG team
- */
-public class NumberFieldComponentFactory implements DynFieldComponentFactory {
-
-	public JDynFieldComponent createJDynFieldComponent(DynField dynField,
-			DynObject dynObject) {
-		return new JNumberDynFieldComponent(dynField, dynObject);
-	}
-
-}
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDefaultDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDefaultDynFieldComponent.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDefaultDynFieldComponent.java	(revision 168)
@@ -1,67 +0,0 @@
-/* gvSIG. Geographic Information System of the Valencian Government
- *
- * Copyright (C) 2007-2008 Infrastructures and Transports Department
- * of the Valencian Government (CIT)
- * 
- * 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 2
- * 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.
- * 
- * 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.
- * 
- */
-
-/*
- * AUTHORS (In addition to CIT):
- * 2010 {}  {{Task}}
- */
-package org.gvsig.tools.swing.impl.dynobject.dynfield;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JLabel;
-
-import org.gvsig.tools.dynobject.DynField;
-import org.gvsig.tools.dynobject.DynObject;
-import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
-
-/**
- * @author 2010- César Ordiñana - gvSIG team
- */
-public class JDefaultDynFieldComponent extends JDynFieldComponent {
-
-	/**
-	 * @param dynField
-	 * @param dynObject
-	 */
-	public JDefaultDynFieldComponent(DynField dynField, DynObject dynObject) {
-		super(dynField, dynObject);
-		initUI();
-	}
-
-	@Override
-	public void storeData() {
-		// TODO Auto-generated method stub
-
-	}
-
-	/**
-	 * Creates the component ui.
-	 */
-	private void initUI() {
-		setLayout(new BorderLayout());
-		Object value = getFieldValue();
-		JLabel label = new JLabel((value == null) ? "" : value.toString());
-		add(label, BorderLayout.CENTER);
-	}
-
-}
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JNumberDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JNumberDynFieldComponent.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JNumberDynFieldComponent.java	(revision 168)
@@ -1,85 +0,0 @@
-/* gvSIG. Geographic Information System of the Valencian Government
- *
- * Copyright (C) 2007-2008 Infrastructures and Transports Department
- * of the Valencian Government (CIT)
- * 
- * 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 2
- * 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.
- * 
- * 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.
- * 
- */
-
-/*
- * AUTHORS (In addition to CIT):
- * 2010 {}  {{Task}}
- */
-package org.gvsig.tools.swing.impl.dynobject.dynfield;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JSpinner;
-import javax.swing.SpinnerModel;
-import javax.swing.SpinnerNumberModel;
-
-import org.gvsig.tools.dynobject.DynField;
-import org.gvsig.tools.dynobject.DynObject;
-import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
-
-/**
- * Component for numeric {@link DynObject} fields.
- * 
- * @author 2010- César Ordiñana - gvSIG team
- */
-public class JNumberDynFieldComponent extends JDynFieldComponent {
-
-	private static final long serialVersionUID = -8120715001446683582L;
-
-	private SpinnerModel model;
-
-	/**
-	 * @see JDynFieldComponent#JDynFieldComponent(DynField, DynObject).
-	 */
-	public JNumberDynFieldComponent(DynField dynField, DynObject dynObject) {
-		super(dynField, dynObject);
-		initUI();
-	}
-
-	@Override
-	public void storeData() {
-		if (model != null) {
-			setFieldValue(model.getValue());
-		}
-	}
-
-	/**
-	 * Creates the component ui.
-	 */
-	private void initUI() {
-		setLayout(new BorderLayout());
-		model = createSpinnerModel();
-		JSpinner spinner = new JSpinner(model);
-		add(spinner, BorderLayout.CENTER);
-	}
-
-	/**
-	 * Creates a SpinnerModel for the component's spinner.
-	 */
-	private SpinnerModel createSpinnerModel() {
-		DynField field = getDynField();
-		Number value = (Number) getFieldValue();
-		return new SpinnerNumberModel(value, (Comparable<?>) field
-				.getMinValue(), (Comparable<?>) field.getMaxValue(), Integer
-				.valueOf(1));
-	}
-}
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JComboBoxDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JComboBoxDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JComboBoxDynFieldComponent.java	(revision 168)
@@ -0,0 +1,196 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject.dynfield;
+
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+import javax.swing.JComboBox;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.spi.DelegatedJFieldComponent;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class JComboBoxDynFieldComponent extends DelegatedJFieldComponent implements JDynFieldComponent, ItemListener{
+
+    private JComboBox combo;
+    private DynObjectValueItem[] items;
+
+    /**
+     * @param component
+     */
+    public JComboBoxDynFieldComponent(JDynFieldComponent component, DynField dynField) {
+	super(component, dynField);
+    }
+
+    /**
+     * 
+     */
+    protected void afterUI() {
+	Object value = this.getFieldValue();
+	Object item;
+	if (value!=null)
+	   for (int i=0;i<this.items.length;i++){
+	       item = items[i].getValue();
+	       if (item==null) continue;
+	       if (item.equals(value)){
+		   this.combo.setSelectedIndex(i+1);
+		   break;
+	       }
+	   }
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.JComponent#getComponent()
+     */
+    public Object getComponent() {
+	return this.combo;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#getValue()
+     */
+    @Override
+    public Object getValue() {
+	int index = this.combo.getSelectedIndex();
+	if ((isMandatory())&&(index<1))
+	    return null;
+	else
+	    //null is at combo position 0, so the index is one unit ahead as of the items index
+	    return this.items[index-1].getValue();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractJDynField#initData()
+     */
+    @Override
+    protected void initData() {
+	
+    }
+
+    /**
+     * 
+     */
+    protected void initUI() {
+	items = getDynField().getAvailableValues();
+	this.combo = new JComboBox();
+	this.combo.addItem(null);
+	for (DynObjectValueItem item : items){
+	    this.combo.addItem(item.getLabel());
+	}
+	this.combo.setSelectedIndex(0);
+	this.combo.addItemListener(this);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#isValid()
+     */
+    public boolean isValid() {
+	return this.combo.getSelectedIndex()>0;
+    }
+
+    /* (non-Javadoc)
+     * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+     */
+    public void itemStateChanged(ItemEvent evt) {
+        this.fireValueChangedEvent();
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#requestFocus()
+     */
+    public void requestFocus() {
+	this.combo.requestFocus();
+    }
+
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#saveStatus()
+     */
+    public void saveStatus() {
+	this.setFieldValue(this.getValue());
+    }
+
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setEnabled(boolean)
+     */
+    public void setEnabled(boolean isEnabled) {
+	// Do nothing, it's a combobox so it's just readonly
+    }
+
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setFieldValue(java.lang.Object)
+     */
+    public void setFieldValue(Object value) {
+	this.component.setFieldValue(value);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#setReadOnly()
+     */
+    @Override
+    protected void setReadOnly() {
+	// Do nothing, it's a combobox so it's just readonly
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#setValue(java.lang.Object)
+     */
+    @Override
+    public void setValue(Object value) {
+	Object item;
+	for (int i=0;i<this.items.length;i++){
+	    item = this.items[i].getValue();
+	    if (item==null) continue; 
+	    
+	    if (item.equals(value)){
+		this.combo.setSelectedIndex(i+1);
+		break;
+	    }
+	}
+    }
+
+
+ 
+}
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDynObjectDynfieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDynObjectDynfieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDynObjectDynfieldComponentFactory.java	(revision 168)
@@ -0,0 +1,86 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject.dynfield;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class JDynObjectDynfieldComponentFactory extends AbstractJDynFieldComponentFactory
+implements JDynFieldComponentFactory {
+
+    private static final String DESCRIPTION = null;
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory#createJDynFieldComponent(org.gvsig.tools.dynobject.DynField, org.gvsig.tools.swing.api.dynobject.dynfield.ValueField)
+     */
+    public JDynFieldComponent createJDynFieldComponent(DynField dynField,
+	    ValueField dynObject) throws ServiceException {
+	return new JDynObjectDynFieldComponent(dynField,dynObject);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractSwingServiceFactory#getFactoryDescription()
+     */
+    @Override
+    public String getFactoryDescription() {
+	// TODO Auto-generated method stub
+	return this.DESCRIPTION;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractSwingServiceFactory#getFactorySubType()
+     */
+    @Override
+    public String getFactorySubType() {
+	return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractSwingServiceFactory#getFactoryType()
+     */
+    @Override
+    public Integer getFactoryType() {
+	return DataTypes.DYNOBJECT;
+    }
+
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/DefaultJNDynFieldComponentFactory.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/DefaultJNDynFieldComponentFactory.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/DefaultJNDynFieldComponentFactory.java	(revision 168)
@@ -0,0 +1,110 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject.dynfield;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.AbstractJDynFieldComponentFactory;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class DefaultJNDynFieldComponentFactory extends AbstractJDynFieldComponentFactory
+implements JDynFieldComponentFactory {
+
+    private Integer dataType = null;
+    private DynClass dynClass = null;
+
+    /**
+     * @param dataType
+     */
+    public DefaultJNDynFieldComponentFactory(DynClass dynClass) {
+	this.dataType = DataTypes.DYNOBJECT;
+	this.dynClass = dynClass;
+    }
+
+
+    /**
+     * @param dataType
+     */
+    public DefaultJNDynFieldComponentFactory(Integer dataType) {
+	this.dataType = dataType;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponentFactory#createJDynFieldComponent(org.gvsig.tools.dynobject.DynField, org.gvsig.tools.swing.api.dynobject.JDynObjectComponent)
+     */
+    public JDynFieldComponent createJDynFieldComponent(DynField dynField,
+	    ValueField valueField) throws ServiceException {
+	return new JNDynFieldComponent(valueField, dynField);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractSwingServiceFactory#getFactoryDescription()
+     */
+    @Override
+    public String getFactoryDescription() {
+	return null;
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.serv.field.AbstractJDynFieldComponentFactory#getFactorySubType()
+     */
+    @Override
+    public String getFactorySubType() {
+	if (dynClass!=null)
+	    return this.dynClass.getFullName();
+	return null;
+    }
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.serv.field.AbstractJDynFieldComponentFactory#getFactoryType()
+     */
+    @Override
+    public Integer getFactoryType() {
+	if (dataType!=null)
+	    return dataType;
+	return DataTypes.LIST;
+    }
+
+    
+
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JNDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JNDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JNDynFieldComponent.java	(revision 168)
@@ -0,0 +1,515 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject.dynfield;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.gvsig.tools.dataTypes.DataTypes;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+import org.gvsig.tools.swing.spi.DelegatedJFieldComponent;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class JNDynFieldComponent  extends DelegatedJFieldComponent implements JDynFieldComponent, ListSelectionListener {
+    
+    
+    private static final int  MINIMUM_LIST_SIZE = 5;
+
+    private JList list;
+
+    private JButton sbutton;
+
+    private JButton jbutton;
+
+//    private DefaultListModel model;
+
+    private JPanel panel;
+
+    private JScrollPane listScrollPane;
+
+    private NValueField items;
+
+    private JPanel upperSubPanel;
+
+//    private DynField defaultField;
+
+
+    
+    /**
+     * @param serviceManager
+     * @param dynObject
+     * @param dynField
+     */
+    public JNDynFieldComponent(ValueField parent, DynField dynField) {
+	super(parent,dynField);
+    }
+
+    private void addElement(Object element) {
+	items.add(element);	
+	this.list.setSelectedIndex(items.getModel().getSize()-1);
+    }
+    
+//    private void addElement(int index, Object item, boolean addItemToInnerList) {
+//	addItem(index,item);
+////	if (addItemToInnerList)
+////	    this.items.add(index,item);
+//	
+//	if (index>=0)
+//	    this.list.setSelectedIndex(index);
+//    }
+    
+    
+//    /**
+//     * @param parent
+//     * @param dynField
+//     * @return
+//     */
+//    private static JDynFieldComponent createComponent(ValueField parent,
+//	    DynField dynField) {
+//	ToolsSwingLocator.getDynObjectSwingManager()
+//	    .createJDynFieldComponent(this, dynField.getElementsType());
+//
+//    }
+
+
+//    /**
+//     * @param object
+//     * @param object2 
+//     */
+//    private void addItem(Integer index, Object value) {
+//	if (value==null) return;
+//	if (index!=null){
+//	    this.items.add(index, value);	
+//	}else
+//	    this.items.add(value);
+////	this.items.setValue(value);
+//    }
+
+    /**
+     * 
+     */
+    protected void afterUI() {
+	//
+//	Object valueItems = getFieldValue();
+//	if (valueItems instanceof List) {
+//	    populateItems((List) valueItems);   
+//	}
+	refresh();
+    }
+
+    private JButton createButton(String text){
+	return ToolsSwingLocator.getUsabilitySwingManager().createJToolButton(text.toString());	
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.JComponent#getComponent()
+     */
+    public Object getComponent() {
+	return this.panel;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#getDefaultValue()
+     */
+    public Object getDefaultValue() {
+	return this.getDynField().getDefaultValue();
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#getFieldValue()
+     */
+    @Override
+    public Object getFieldValue() {
+	Object value = getParentValueField().getValue();
+	if (value==null) 
+	    value = getParentValueField().getDefaultValue();
+	return value;
+//	Object value = this..getValue();
+//	if (value==null) 
+//	    value = parentValues.getDefaultValue();
+//	return value;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#getValue()
+     */
+    @Override
+    public Object getValue() {
+	if (this.list==null)
+	    return null;
+	if (this.getDynField().getType()==DataTypes.STRING)
+	    return this.list.getSelectedValue();
+   	return this.list.getSelectedIndex();	
+    }
+
+
+    /**
+     *  
+     */
+    private void initBoxLayout() { 
+	panel = new JPanel(new BorderLayout(2,2));
+	panel.setBorder(BorderFactory.createTitledBorder(""));
+	
+	JPanel subPanel = new JPanel(new GridBagLayout());
+//	subPanel.setBorder(BorderFactory.createTitledBorder(""));
+
+	list.setVisibleRowCount(4);
+//	list.setLayout(new GridBagLayout());
+	GridBagConstraints c = new GridBagConstraints();
+//	c.insets = new Insets(2, 2, 2, 2);
+//	c.anchor = GridBagConstraints.PAGE_START;
+//	c.ipadx = 0;
+//	c.fill = GridBagConstraints.HORIZONTAL;	   
+	
+	listScrollPane = new JScrollPane(list);
+	listScrollPane.setViewportView(this.list);
+
+	
+	//Adding elements
+	
+	c.insets = new Insets(2, 2, 2, 2);
+	c.anchor = GridBagConstraints.LINE_START;
+	c.ipadx = 0;
+	c.weightx = 0.75;
+	c.fill = GridBagConstraints.HORIZONTAL;	   
+	
+	c.gridx = 0;
+	c.gridy = 0;
+	subPanel.add((Component) component.getComponent(),c);
+	
+//	c.insets = new Insets(2, 2, 2, 2);
+	c.gridx = 1;
+	c.gridy = 0;
+	c.weightx = 0.0;  // 0
+	c.fill = GridBagConstraints.NONE;
+	c.anchor = GridBagConstraints.LINE_END;
+	subPanel.add(jbutton,c);
+	
+	
+	panel.add(subPanel, BorderLayout.NORTH);
+	
+	this.upperSubPanel = panel;
+	
+	subPanel = new JPanel(new GridBagLayout());
+	
+	c.insets = new Insets(2, 2, 2, 2);
+	c.anchor = GridBagConstraints.LINE_START;
+	c.ipadx = 0;
+	c.weightx = 0.75;
+	c.ipady = 40;
+	c.fill = GridBagConstraints.HORIZONTAL;	   
+	
+	c.gridx = 0;
+	c.gridy = 0;
+	subPanel.add(this.listScrollPane,c);
+	
+		
+	c.insets = new Insets(4, 2, 2, 2);
+	c.gridx = 1;
+	c.gridy = 0;
+	c.ipady = 0;
+	c.weightx = 0.0;  // 0
+	c.fill = GridBagConstraints.BASELINE;
+	c.anchor = GridBagConstraints.PAGE_START;
+	subPanel.add(sbutton,c);
+
+	panel.add(subPanel);
+//	c.fill = GridBagConstraints.HORIZONTAL;
+////	c.anchor = GridBagConstraints.LAST_LINE_END; 
+////	c.gridx = 7;      // Cell start at (2,0)
+////	c.gridy = 5;
+////	c.gridheight = 0;  // span of 2
+////	c.gridwidth = 0;  // no span
+//////	c.gridheight = 0;  // no span
+//////	c.weightx = 0.5;  // 
+//	panel.add(sbutton,c);
+
+//	panel.add((Component) component.getComponent(), BorderLayout.PAGE_START);
+	
+	
+
+//	c.fill = GridBagConstraints.HORIZONTAL;
+//	c.ipady = 2;       //reset to default
+//	c.weighty = 1.0;   //request any extra vertical space
+//	c.anchor = GridBagConstraints.PAGE_END; //bottom of space
+//	c.insets = new Insets(10,0,0,0);  //top padding
+//	c.gridx = 1;       //aligned with button 2
+//	c.gridwidth = 2;   //2 columns wide
+//	c.gridy = 2;       //third row
+//	pane.add(button, c);
+//	
+//	JPanel pane = createGridBagLayout((Component) component.getComponent(),jbutton, 1,1,null);	   
+    }
+    
+    protected void initData(){
+	// Creates a list that allows adds and removes
+	this.items = getValueField();
+    }
+    
+    
+    public void initJButtons(){	
+	sbutton = createButton("-");
+	sbutton.setActionCommand("-");
+	sbutton.addActionListener(new ActionListener(){
+
+	    public void actionPerformed(ActionEvent e) {
+		removeElement(list.getSelectedIndex());
+		refresh();
+	    }
+	});
+
+	jbutton = createButton("+");
+	jbutton.setActionCommand("+");
+	jbutton.addActionListener(new ActionListener(){
+
+	    public void actionPerformed(ActionEvent e) {
+		// add at the end of the list
+		if (component.isValid()){
+		    addElement(component.getValue());
+		    refresh();
+		 }		
+	    }});
+    }
+    
+    /**
+     * 
+     */
+    private void initJList() {
+	this.list = new JList(this.items.getModel());
+	this.list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+	this.list.addListSelectionListener(this);
+	if (this.items.getModel().getSize()>0) 
+	    this.list.setSelectedIndex(0);
+    }
+
+    /**
+     * @throws ServiceException 
+     * 
+     */
+    protected void initUI(){
+	initJList();
+	initJButtons();
+	initBoxLayout();
+//	initListPanel();	
+	refresh();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#isValid()
+     */
+    public boolean isValid() {
+	return this.component.isValid();
+    }
+
+    /**
+     * 
+     */
+    private void populateItems(List items) {
+	if (items == null)
+	    return;
+	Object element;
+	for (int i = 0; i < items.size(); i++) {
+	    element = items.get(i);
+	    this.items.add(element);
+	}
+//	if (!items.isEmpty())
+//	    this.list.setSelectedIndex(0);
+    }
+
+    public void refresh(){
+	if ((items.getModel().isEmpty())||(list.getSelectedIndex()<0)){
+	   this.sbutton.setEnabled(false);
+	   this.component.requestFocus();
+	}else
+	    this.sbutton.setEnabled(true);
+    }
+
+    private void removeElement(int ind) {
+	
+	if ((ind>=0)&&(ind<this.items.getModel().getSize()))
+	removeItem(ind);
+	
+	if (items.getModel().getSize()<0)
+	    sbutton.setEnabled(false);
+	else{
+	    if (ind>0)
+		this.list.setSelectedIndex(ind-1);
+	}
+	resize();
+    }
+
+    /**
+     * @param ind
+     */
+    private void removeItem(int ind) {
+//	model.removeElement(model.get(ind));
+	this.items.removeItem(ind);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#requestFocus()
+     */
+    public void requestFocus() {
+	this.component.requestFocus();
+    }
+
+    /**
+     * 
+     */
+    private void resize() {
+
+//	int list_height =  this.list.getSize().height;
+//	int scrollpane_width = this.listScrollPane.getSize().width;
+//	int scrollpane_height = this.listScrollPane.getSize().height;
+//	int min_height = this.listScrollPane.getMinimumSize().height;
+//
+//	if (scrollpane_height!=list_height)
+//	    if (list_height < min_height)
+//		this.listScrollPane.setSize(scrollpane_width,min_height);
+//	    else
+//		this.listScrollPane.setSize(scrollpane_width,list_height);
+//	this.listScrollPane.revalidate();
+//	this.panel.revalidate();
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#saveStatus()
+     */
+    public void saveStatus() {
+//	for (int i=0;i<this.model.size();i++){
+//	    this.items.addItem(i,this.model.get(i));
+//	}
+	setFieldValue(this.items.toArray());
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setEnabled(boolean)
+     */
+    public void setEnabled(boolean isEnabled) {
+	if ((isEnabled)&&(this.getDynField().isReadOnly()))
+		return;
+	this.sbutton.setVisible(isEnabled);
+	this.upperSubPanel.setEnabled(isEnabled);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setFieldValue(java.lang.Object)
+     */
+    public void setFieldValue(Object value) {
+	this.getParentValueField().setValue(value);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.AbstractJDynField#setReadOnly()
+     */
+    @Override
+    protected void setReadOnly() {
+	this.setEnabled(false);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#setValue(java.lang.Object)
+     */
+    @Override
+    public void setValue(Object value) {
+	if (value instanceof List){
+	   populateItems((List) value);
+	}else{
+	    this.list.setSelectedValue(value, true);		
+	}
+
+    }
+
+
+    /* (non-Javadoc)
+     * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
+     */
+    public void valueChanged(ListSelectionEvent e) {
+	if (list.getSelectedIndex()>=0){
+	    this.component.setValue(this.items.getModel().getElementAt(list.getSelectedIndex()));
+//	    this.list.setVisibleRowCount(model.getSize());
+	    this.sbutton.setVisible(true);
+//	    this.listScrollPane.setVisible(true);
+	}else{
+	    if (this.items.getModel().getSize()<1){
+//		this.sbutton.setVisible(false);
+//		this.listScrollPane.setVisible(false);
+	    }else{
+		int index =this.items.getModel().indexOf(this.items.getModel().firstElement());
+		if (index!=this.list.getSelectedIndex())
+		    this.list.setSelectedIndex(index);
+	    }
+	}
+	refresh();
+	if (!isValid())
+	    this.fireValueChangedEvent();
+    }
+
+
+//    /* (non-Javadoc)
+//     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#getDynField()
+//     */
+//    @Override
+//    public DynField getDynField() {
+//	return this.defaultField;
+//    }
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDynObjectDynFieldComponent.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDynObjectDynFieldComponent.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/dynfield/JDynObjectDynFieldComponent.java	(revision 168)
@@ -0,0 +1,202 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject.dynfield;
+
+
+import java.awt.Component;
+
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.service.Manager;
+import org.gvsig.tools.service.ServiceException;
+import org.gvsig.tools.swing.api.ToolsSwingLocator;
+import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
+import org.gvsig.tools.swing.api.dynobject.ValueChangedListener;
+import org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent;
+import org.gvsig.tools.swing.api.dynobject.dynfield.ValueField;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public class JDynObjectDynFieldComponent implements JDynFieldComponent{
+    
+    private JDynObjectComponent jDynObjectComponent;
+    private DynObject dynObject;
+    private DynField dynField;
+    private Component component;
+
+    /**
+     * @param dynField
+     * @param dynObject
+     * @throws ServiceException 
+     */
+    public JDynObjectDynFieldComponent(DynField dynField, ValueField dynObjectValue) throws ServiceException {
+	this.dynField = dynField;
+	this.dynObject = (DynObject) dynObjectValue.getValue();
+	this.jDynObjectComponent = ToolsSwingLocator.getDynObjectSwingManager().createJDynObjectComponent(getDynObjectValue());
+	this.component = (Component) this.jDynObjectComponent.getComponent();	
+    }
+
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#addValueChangedListener(org.gvsig.tools.swing.api.dynobject.ValueChangedListener)
+     */
+    public void addValueChangedListener(ValueChangedListener listener) {
+	// TODO Auto-generated method stub
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#fireValueChangedEvent()
+     */
+    public void fireValueChangedEvent() {
+	// TODO Auto-generated method stub
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JComponent#getComponent()
+     */
+    public Object getComponent() {
+	return this.jDynObjectComponent.getComponent();
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#getDefaultValue()
+     */
+    public Object getDefaultValue() {
+	return this.dynField.getDefaultValue();
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#getDynField()
+     */
+    public DynField getDynField() {
+	return this.dynField;
+    }
+
+
+    private DynObject getDynObjectValue(){
+	if (this.dynObject == null)
+	    this.dynObject = (DynObject) getFieldValue();   
+	return this.dynObject;	 
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#getFieldValue()
+     */
+    public Object getFieldValue() {
+	return this.dynObject;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.service.Service#getManager()
+     */
+    public Manager getManager() {
+	// TODO Auto-generated method stub
+	return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#getValue()
+     */
+    public Object getValue() {
+	return getDynObjectValue();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#isMandatory()
+     */
+    public boolean isMandatory() {
+	return this.dynField.isMandatory();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#isValid()
+     */
+    public boolean isValid() {
+	return this.jDynObjectComponent.isValid();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#requestFocus()
+     */
+    public void requestFocus() {
+	this.component.requestFocus();
+	
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#saveStatus()
+     */
+    public void saveStatus() {
+	this.jDynObjectComponent.saveStatus();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.JDynFieldComponent#setEnabled(boolean)
+     */
+    public void setEnabled(boolean isEnabled) {
+	component.setEnabled(isEnabled);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.spi.DelegatedJFieldComponent#setFieldValue(java.lang.Object)
+     */
+    public void setFieldValue(Object value) {
+	if (value instanceof DynObject){
+	    this.dynObject = (DynObject) value;
+	}
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.dynfield.ValueField#setValue(java.lang.Object)
+     */
+    public void setValue(Object value) {
+	if (this.dynObject!=null)
+	    this.dynObject = (DynObject) value;	  
+    }
+
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/AbstractDynObjectModelElement.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/AbstractDynObjectModelElement.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/dynobject/AbstractDynObjectModelElement.java	(revision 168)
@@ -0,0 +1,108 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+/*
+ * AUTHORS (In addition to CIT):
+ * 2010 Institute of New Imaging Technologies (INIT): 
+ *   http://www.init.uji.es
+ * Geographic Information research group: 
+ *   http://www.geoinfo.uji.es
+ * Universitat Jaume I, Spain
+ */
+
+/**
+ * 
+ */
+package org.gvsig.tools.swing.impl.dynobject;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel;
+
+/**
+ * @author <a href="mailto:reinhold@uji.es">cmartin</a>
+ *
+ */
+public abstract class AbstractDynObjectModelElement implements DynFieldComponentModel{
+    private DynClass theClass;
+    private String fieldName;
+
+    private boolean isReadOnly;
+    private String group; 
+    
+    public AbstractDynObjectModelElement(String fieldName, DynClass theClass, String group){
+	this.theClass = theClass;
+	this.fieldName = fieldName;
+	this.isReadOnly = false;
+	this.group = group;
+    }
+    
+    
+    public boolean equals(Object elem){
+	if (!(elem instanceof DynFieldComponentModel))
+	    return false;
+	DynFieldComponentModel fieldElem = (DynFieldComponentModel) elem;
+	if ( this.getDynField().equals(fieldElem.getDynField()) )
+	    return true;
+	return false;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel#getDynClass()
+     */
+    public DynClass getDynClass() {
+	return this.theClass;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel#getDynField()
+     */
+    public DynField getDynField() {
+	return this.theClass.getDynField(this.fieldName);
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel#getGroup()
+     */
+    public String getGroup() {
+	return this.group;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel#isReadOnly()
+     */
+    public boolean isReadOnly() {
+	return isReadOnly;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel#setGroup(java.lang.String)
+     */
+    public void setGroup(String group) {
+	this.group = group;
+    }
+
+    /* (non-Javadoc)
+     * @see org.gvsig.tools.swing.api.dynobject.DynFieldComponentModel#setReadOnly(boolean)
+     */
+    public void setReadOnly(boolean isReadOnly) {
+	this.isReadOnly = isReadOnly;
+    }
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/ToolsSwingDefaultImplLibrary.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/ToolsSwingDefaultImplLibrary.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/ToolsSwingDefaultImplLibrary.java	(revision 168)
@@ -25,12 +25,15 @@
 import org.gvsig.tools.library.AbstractLibrary;
 import org.gvsig.tools.library.Library;
 import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.service.spi.ServiceManager;
 import org.gvsig.tools.swing.api.ToolsSwingLocator;
-import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
-import org.gvsig.tools.swing.api.dynobject.dynfield.DynFieldComponentFactory;
 import org.gvsig.tools.swing.impl.dynobject.DefaultDynObjectSwingManager;
-import org.gvsig.tools.swing.impl.dynobject.dynfield.NumberFieldComponentFactory;
+import org.gvsig.tools.swing.impl.dynobject.DefaultDynObjectSwingServiceManager;
+import org.gvsig.tools.swing.impl.dynobject.DefaultJDynObjectComponentFactory;
+import org.gvsig.tools.swing.impl.dynobject.dynfield.DefaultJNDynFieldComponentFactory;
+import org.gvsig.tools.swing.impl.dynobject.dynfield.JDynObjectDynfieldComponentFactory;
 import org.gvsig.tools.swing.impl.usability.DefaultUsabilitySwingManager;
+import org.gvsig.tools.swing.spi.ToolsSwingServiceLocator;
 
 /**
  * {@link Library} for the default tools swing implementation.
@@ -39,29 +42,34 @@
  */
 public class ToolsSwingDefaultImplLibrary extends AbstractLibrary {
 
-	@Override
-	protected void doInitialize() throws LibraryException {
-		ToolsSwingLocator
-				.registerDynObjectSwingManager(DefaultDynObjectSwingManager.class);
-		ToolsSwingLocator
-				.registerUsabilitySwingManager(DefaultUsabilitySwingManager.class);
-	}
+    @Override
+    protected void doInitialize() throws LibraryException {
+	ToolsSwingLocator
+		.registerDynObjectSwingManager(DefaultDynObjectSwingManager.class);
+	ToolsSwingLocator
+		.registerUsabilitySwingManager(DefaultUsabilitySwingManager.class);
+	ToolsSwingServiceLocator
+		.registerDynObjectServiceManager(DefaultDynObjectSwingServiceManager.class);
+    }
 
-	@Override
-	protected void doPostInitialize() throws LibraryException {
-		DynObjectSwingManager dsManager = ToolsSwingLocator
-				.getDynObjectSwingManager();
+    @Override
+    protected void doPostInitialize() throws LibraryException {
+	ServiceManager dsManager = ToolsSwingServiceLocator.getServiceManager();
 
-		DynFieldComponentFactory numberFactory = new NumberFieldComponentFactory();
-		dsManager.registerDynFieldComponentFactory(numberFactory,
-				DataTypes.BYTE);
-		dsManager
-				.registerDynFieldComponentFactory(numberFactory, DataTypes.INT);
-		dsManager.registerDynFieldComponentFactory(numberFactory,
-				DataTypes.LONG);
-		dsManager.registerDynFieldComponentFactory(numberFactory,
-				DataTypes.FLOAT);
-		dsManager.registerDynFieldComponentFactory(numberFactory,
-				DataTypes.DOUBLE);
-	}
+	dsManager.addServiceFactory(new DefaultJDynObjectComponentFactory());
+	dsManager.addServiceFactory(new DefaultJNDynFieldComponentFactory(DataTypes.LIST));
+	dsManager.addServiceFactory(new JDynObjectDynfieldComponentFactory());
+	
+	// dsManager.addServiceFactory(new NumberFieldComponentFactory());
+	// dsManager.addServiceFactory(new NumberFieldComponentFactory());
+	// dsManager.addServiceFactory(new NumberFieldComponentFactory());
+
+	// .registerDynFieldComponentFactory(numberFactory, DataTypes.INT);
+	// dsManager.registerDynFieldComponentFactory(numberFactory,
+	// DataTypes.LONG);
+	// dsManager.registerDynFieldComponentFactory(numberFactory,
+	// DataTypes.FLOAT);
+	// dsManager.registerDynFieldComponentFactory(numberFactory,
+	// DataTypes.DOUBLE);
+    }
 }
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedToolButton.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedToolButton.java	(revision 0)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedToolButton.java	(revision 168)
@@ -0,0 +1,215 @@
+/* gvSIG. Sistema de Información Geográfica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ibáñez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.tools.swing.impl.usability.button;
+
+import java.awt.Dimension;
+
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JButton;
+
+/**
+ * According to the gvSIG's GUI style sheet all the buttons in the application
+ * will have a normative size. No smaller than a concrete size, and big enough
+ * to contain the text and avoiding the "..." characters. The button will grow
+ * up in width by a set of widths defined in this style sheet, always choosing
+ * the smallest width that can contain the text. If the biggest width is not
+ * enought for this purpose then the button will automatically grow up to the
+ * smallest necessary width to fit the text.<br>
+ * <p>
+ * The button resizing is based on the <b>setText(String txt)</b> method.
+ * However, it is possible to use a custom size if you invoke one of
+ * <b>setSize(..)</b>, <b>setBorders(...)</b> or <b>setPreferredSize(...)</b>
+ * after invoking the <b>setText(...)<b> method.
+ * <p>
+ * This class is just a standard javax.swing.JButton that handles this issue.
+ * </p>
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ * 
+ */
+public class JStandardizedToolButton extends JButton {
+	private static final long serialVersionUID = -1635879317292710725L;
+
+	// TODO this should be initialized from a properties file or so.
+	private static int[][] buttonSizes = new int[][] { 
+	    new int[] {  22, 22 },
+	    new int[] {  44, 22 },
+	    new int[] {  66, 22 },
+	    new int[] {  88, 22 },
+	    new int[] { 110, 22 }, 
+	    new int[] { 132, 22 }, 
+	    new int[] { 154, 22 } };
+
+	private String enableText;
+	private String toolTip;
+
+	/**
+	 * Creates a new empty instance of org.gvsig.gui.beans.swing.JButton.
+	 */
+	public JStandardizedToolButton() {
+		super();
+	}
+
+	/**
+	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton from an
+	 * {@link Action}.
+	 */
+	public JStandardizedToolButton(Action action) {
+		super(action);
+	}
+
+	/**
+	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
+	 * image.
+	 */
+	public JStandardizedToolButton(Icon icon) {
+		super(icon);
+	}
+
+	/**
+	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing a
+	 * text.
+	 * 
+	 * @param text
+	 */
+	public JStandardizedToolButton(String text) {
+		super();
+		setText(text);
+	}
+
+	/**
+	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
+	 * image and a text.
+	 * 
+	 * @param text
+	 * @param icon
+	 */
+	public JStandardizedToolButton(String text, Icon icon) {
+		super(icon);
+		setText(text);
+	}
+
+	/**
+	 * Gets the text that appears in the tooltip when the button is disabled.
+	 * 
+	 * @return String
+	 */
+	public String getEnableText() {
+		return enableText;
+	}
+
+	@Override
+	public Dimension getMaximumSize() {
+		return getPreferredSize();
+	}
+
+	@Override
+	public Dimension getMinimumSize() {
+		return getPreferredSize();
+	}
+
+	@Override
+	public Dimension getPreferredSize() {
+		Dimension d = getUI().getMinimumSize(this);
+		int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+		int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+
+		// figure out the suitable width
+		for (int i = buttonSizes.length - 1; i >= 0; i--)
+			if (oldWidth < buttonSizes[i][0])
+				newWidth = buttonSizes[i][0];
+
+		// figure out the suitable height
+		for (int i = buttonSizes.length - 1; i >= 0; i--)
+			if (oldHeight < buttonSizes[i][1])
+				newHeight = buttonSizes[i][1];
+
+		return new Dimension(newWidth, newHeight);
+	}
+
+	// public void setText(String text) {
+	// super.setText(text);
+	// Dimension d = getUI().getMinimumSize(this);
+	// int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+	// int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+	//
+	// // figure out the suitable width
+	// for (int i = buttonSizes.length - 1; i >= 0; i--)
+	// if (oldWidth < buttonSizes[i][0])
+	// newWidth = buttonSizes[i][0];
+	//
+	// // figure out the suitable height
+	// for (int i = buttonSizes.length - 1; i >= 0; i--)
+	// if (oldHeight < buttonSizes[i][1])
+	// newHeight = buttonSizes[i][1];
+	//
+	// Dimension sz = new Dimension(newWidth, newHeight);
+	// super.setSize(sz);
+	// super.setPreferredSize(sz);
+	// }
+
+	public void setEnabled(boolean aFlag) {
+		super.setEnabled(aFlag);
+		if (aFlag) {
+			setToolTipText(toolTip);
+		} else {
+			setToolTipText(enableText);
+		}
+	}
+
+	/**
+	 * Sets the text that appears in the tooltip when the button is disabled.
+	 * 
+	 * @param enableText
+	 *            The enableText to set.
+	 */
+	public void setEnableText(String enableText) {
+		this.enableText = enableText;
+	}
+
+	/**
+	 * Sets the text that appears in the tooltip when the button is enabled.
+	 */
+	public void setToolTip(String text) {
+		toolTip = text;
+	}
+}
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedButton.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedButton.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/button/JStandardizedButton.java	(revision 168)
@@ -84,6 +84,22 @@
 	}
 
 	/**
+	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton from an
+	 * {@link Action}.
+	 */
+	public JStandardizedButton(Action action) {
+		super(action);
+	}
+
+	/**
+	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
+	 * image.
+	 */
+	public JStandardizedButton(Icon icon) {
+		super(icon);
+	}
+
+	/**
 	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing a
 	 * text.
 	 * 
@@ -107,22 +123,6 @@
 	}
 
 	/**
-	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton containing an
-	 * image.
-	 */
-	public JStandardizedButton(Icon icon) {
-		super(icon);
-	}
-
-	/**
-	 * Creates a new instance of org.gvsig.gui.beans.swing.JButton from an
-	 * {@link Action}.
-	 */
-	public JStandardizedButton(Action action) {
-		super(action);
-	}
-
-	/**
 	 * Gets the text that appears in the tooltip when the button is disabled.
 	 * 
 	 * @return String
@@ -131,30 +131,33 @@
 		return enableText;
 	}
 
-	/**
-	 * Sets the text that appears in the tooltip when the button is disabled.
-	 * 
-	 * @param enableText
-	 *            The enableText to set.
-	 */
-	public void setEnableText(String enableText) {
-		this.enableText = enableText;
+	@Override
+	public Dimension getMaximumSize() {
+		return getPreferredSize();
 	}
 
-	public void setEnabled(boolean aFlag) {
-		super.setEnabled(aFlag);
-		if (aFlag) {
-			setToolTipText(toolTip);
-		} else {
-			setToolTipText(enableText);
-		}
+	@Override
+	public Dimension getMinimumSize() {
+		return getPreferredSize();
 	}
 
-	/**
-	 * Sets the text that appears in the tooltip when the button is enabled.
-	 */
-	public void setToolTip(String text) {
-		toolTip = text;
+	@Override
+	public Dimension getPreferredSize() {
+		Dimension d = getUI().getMinimumSize(this);
+		int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
+		int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
+
+		// figure out the suitable width
+		for (int i = buttonSizes.length - 1; i >= 0; i--)
+			if (oldWidth < buttonSizes[i][0])
+				newWidth = buttonSizes[i][0];
+
+		// figure out the suitable height
+		for (int i = buttonSizes.length - 1; i >= 0; i--)
+			if (oldHeight < buttonSizes[i][1])
+				newHeight = buttonSizes[i][1];
+
+		return new Dimension(newWidth, newHeight);
 	}
 
 	// public void setText(String text) {
@@ -178,32 +181,29 @@
 	// super.setPreferredSize(sz);
 	// }
 
-	@Override
-	public Dimension getPreferredSize() {
-		Dimension d = getUI().getMinimumSize(this);
-		int oldWidth = (int) d.getWidth(), newWidth = oldWidth;
-		int oldHeight = (int) d.getHeight(), newHeight = oldHeight;
-
-		// figure out the suitable width
-		for (int i = buttonSizes.length - 1; i >= 0; i--)
-			if (oldWidth < buttonSizes[i][0])
-				newWidth = buttonSizes[i][0];
-
-		// figure out the suitable height
-		for (int i = buttonSizes.length - 1; i >= 0; i--)
-			if (oldHeight < buttonSizes[i][1])
-				newHeight = buttonSizes[i][1];
-
-		return new Dimension(newWidth, newHeight);
+	public void setEnabled(boolean aFlag) {
+		super.setEnabled(aFlag);
+		if (aFlag) {
+			setToolTipText(toolTip);
+		} else {
+			setToolTipText(enableText);
+		}
 	}
 
-	@Override
-	public Dimension getMaximumSize() {
-		return getPreferredSize();
+	/**
+	 * Sets the text that appears in the tooltip when the button is disabled.
+	 * 
+	 * @param enableText
+	 *            The enableText to set.
+	 */
+	public void setEnableText(String enableText) {
+		this.enableText = enableText;
 	}
 
-	@Override
-	public Dimension getMinimumSize() {
-		return getPreferredSize();
+	/**
+	 * Sets the text that appears in the tooltip when the button is enabled.
+	 */
+	public void setToolTip(String text) {
+		toolTip = text;
 	}
 }
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/DefaultUsabilitySwingManager.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/DefaultUsabilitySwingManager.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/usability/DefaultUsabilitySwingManager.java	(revision 168)
@@ -26,12 +26,19 @@
 */
 package org.gvsig.tools.swing.impl.usability;
 
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
 import javax.swing.Action;
 import javax.swing.Icon;
 import javax.swing.JButton;
+import javax.swing.JPanel;
 
 import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
 import org.gvsig.tools.swing.impl.usability.button.JStandardizedButton;
+import org.gvsig.tools.swing.impl.usability.button.JStandardizedToolButton;
 
 /**
  * Default implementation for the {@link UsabilitySwingManager}.
@@ -40,24 +47,82 @@
  */
 public class DefaultUsabilitySwingManager implements UsabilitySwingManager {
 
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.swing.api.usability.UsabilitySwingManager#createBoxLayout(java.awt.Component, java.awt.Component, java.lang.Integer, java.lang.Integer)
+	 */
+	public JPanel createGridBagRowPanel(JPanel gridBagPanel, Component labelComponent,
+		Component fieldComponent,
+		Integer labelMargin, Integer fieldMargin) {
+	    // Create a panel that uses BoxLayout.
+	    JPanel panel;
+	    if (gridBagPanel==null){
+		panel = new JPanel();
+		panel.setLayout(new GridBagLayout());
+	    }else
+		panel = gridBagPanel;
+	    
+	    GridBagConstraints constr = this.getDefaultParametersConstraints();
+	    constr.fill = GridBagConstraints.HORIZONTAL;	   
+
+	    constr.gridwidth = GridBagConstraints.RELATIVE;
+	    constr.weighty = 0;
+	    
+	    if (labelComponent != null) {
+//		constr.weightx = 0;
+//		int width = labelComponent.getSize().width;
+		
+		if (labelMargin != null)
+		    constr.weightx = labelMargin;
+		panel.add(labelComponent, constr);
+	    }
+	    constr.fill = GridBagConstraints.NONE;  
+//	    constr.gridwidth = GridBagConstraints.RELATIVE;
+	       
+	    
+	    if (fieldComponent != null) {
+		constr.weightx = 0;
+		if (fieldMargin != null)
+		    constr.weightx = labelMargin;
+		panel.add(fieldComponent, constr);
+	    }
+	    return panel;
+	}
+
 	public JButton createJButton() {
 		return new JStandardizedButton();
 	}
 
-	public JButton createJButton(String text) {
-		return new JStandardizedButton(text);
+	public JButton createJButton(Action action) {
+		return new JStandardizedButton(action);
 	}
 
 	public JButton createJButton(Icon icon) {
 		return new JStandardizedButton(icon);
 	}
 
+	public JButton createJButton(String text) {
+		return new JStandardizedButton(text);
+	}
+	
 	public JButton createJButton(String text, Icon icon) {
 		return new JStandardizedButton(text, icon);
 	}
+	
 
-	public JButton createJButton(Action action) {
-		return new JStandardizedButton(action);
+	public JButton createJToolButton(String text) {
+		return new JStandardizedToolButton(text);
 	}
+	
+	/**
+	 * @return
+	 */
+	private GridBagConstraints getDefaultParametersConstraints() {
+	    GridBagConstraints constr = new GridBagConstraints();
+	    constr.insets = new Insets(2, 2, 2, 2);
+	    constr.ipadx = 2;
+	    constr.ipady = 2;
+	    constr.anchor = GridBagConstraints.PAGE_START;
+	    return constr;
+	}	
 
 }
\ No newline at end of file
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/test/java/org/gvsig/tools/AppTest.java
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/test/java/org/gvsig/tools/AppTest.java	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/test/java/org/gvsig/tools/AppTest.java	(revision 168)
@@ -11,6 +11,14 @@
     extends TestCase
 {
     /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
      * Create the test case
      *
      * @param testName name of the test case
@@ -21,14 +29,6 @@
     }
 
     /**
-     * @return the suite of tests being tested
-     */
-    public static Test suite()
-    {
-        return new TestSuite( AppTest.class );
-    }
-
-    /**
      * Rigourous Test :-)
      */
     public void testApp()
Index: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/pom.xml
===================================================================
--- org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/pom.xml	(revision 167)
+++ org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/pom.xml	(revision 168)
@@ -15,5 +15,10 @@
 			<artifactId>org.gvsig.tools.swing.api</artifactId>
 			<version>2.1.0-SNAPSHOT</version>
 		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.swing.spi</artifactId>
+			<version>2.1.0-SNAPSHOT</version>
+		</dependency>
 	</dependencies>
 </project>

Property changes on: org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl
___________________________________________________________________
Modified: svn:ignore
   - target
.settings
.classpath
.project

   + target
.settings
.classpath
.project
bin


