Commit d8c28cc2 authored by Dumoulin Nicolas's avatar Dumoulin Nicolas
Browse files

editor displayed for simple ohobject

parent 4ebc346b
......@@ -26,9 +26,11 @@ import fr.cemagref.ohoui.reflect.DefaultObjectIntrospector;
import fr.cemagref.ohoui.reflect.IntrospectionException;
import fr.cemagref.ohoui.reflect.OhOuiContext;
import fr.cemagref.ohoui.structure.OhObject;
import fr.cemagref.ohoui.structure.OhObjectCollection;
import fr.cemagref.ohoui.structure.OhObjectComplex;
import fr.cemagref.ohoui.ui.panels.AbstractOhEditor;
import fr.cemagref.ohoui.ui.panels.DefaultObjectEditor;
import fr.cemagref.ohoui.ui.panels.PanelsProvider;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.HashMap;
......@@ -101,10 +103,22 @@ public class NodesAndPanelsPanel extends JPanel implements ListSelectionListener
editorsCardLayout.show(editorsPanel, getCode(selectedObject));
} else {
// retrieve editor and put it in cache
AbstractOhEditor<Object, JComponent> editor = new DefaultObjectEditor(selectedObject);
AbstractOhEditor<Object, JComponent> editor = null;
if (selectedObject instanceof OhObjectCollection) {
// TODO bring an editor with a list and add/remove buttons
} else if (selectedObject instanceof OhObjectComplex) {
editor = new DefaultObjectEditor(selectedObject);
} else {
// TODO pay attention if object value is null ?
editor = PanelsProvider.getEditor(selectedObject).getEditor(selectedObject);
}
editorsMap.put(selectedObject, editor);
editorsPanel.add(editor.getPanel(), getCode(selectedObject));
editorsCardLayout.show(editorsPanel, getCode(selectedObject));
if (editor != null) {
editorsPanel.add(editor.getPanel(), getCode(selectedObject));
editorsCardLayout.show(editorsPanel, getCode(selectedObject));
} else {
editorsCardLayout.show(editorsPanel, EMPTY_EDITOR_CODE);
}
}
}
editorsPanel.revalidate();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment