Commit 727b5b23 authored by Dumoulin Nicolas's avatar Dumoulin Nicolas
Browse files

changes can be seen with a button

parent cbfd2258
......@@ -6,6 +6,7 @@
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal>
</goals>
<preAction>build-with-dependencies</preAction>
<properties>
<exec.classpathScope>runtime</exec.classpathScope>
<exec.args>-classpath %classpath fr.cemagref.ohoui.demo.View</exec.args>
......
......@@ -28,6 +28,11 @@
<artifactId>ohoui-ui-swing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>lang</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<repositories>
......
......@@ -16,7 +16,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="495" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="387" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
......
......@@ -4,13 +4,18 @@ import fr.cemagref.ohoui.annotations.Description;
import fr.cemagref.ohoui.ui.nodes.ValueProperty;
import fr.cemagref.ohoui.reflect.IntrospectionException;
import fr.cemagref.ohoui.ui.swing.NodesAndPanelsPanel;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.view.NodeTableModel;
import org.openide.explorer.view.TreeTableView;
......@@ -30,14 +35,6 @@ class MyClass {
}
}
/*
*
* TODO:
* - value editor in nodes for OhObject
* - Leaf types management as String. Should we enumerate them in OhOuiContext,
* or should it be managed by the UI part?
*
*/
public class View extends javax.swing.JPanel implements ExplorerManager.Provider {
private final ExplorerManager explorerManager = new ExplorerManager();
......@@ -66,7 +63,7 @@ public class View extends javax.swing.JPanel implements ExplorerManager.Provider
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
......@@ -89,17 +86,19 @@ public class View extends javax.swing.JPanel implements ExplorerManager.Provider
Logger.getLogger(View.class.getName()).log(Level.WARNING,
"Problems to load the logging configuration file", ex);
}
JFrame f = new JFrame("OhOUI");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setContentPane(new NodesAndPanelsPanel(new MyClass()));
/*OhObjectComplex o = DefaultObjectIntrospector.introspect("test", new MyClass(), new OhOuiContext());
f.getContentPane().setLayout(new FlowLayout(FlowLayout.RIGHT));
f.getContentPane().add(new View(new fr.cemagref.ohoui.ui.nodesandpanels.ObjectNode(o, new PanelsProvider())));
f.getContentPane().add(new View(new fr.cemagref.ohoui.ui.nodes.ObjectNode(o)));*/
final MyClass myObject = new MyClass();
final NodesAndPanelsPanel nodesAndPanelsPanel = new NodesAndPanelsPanel(myObject);
f.add(nodesAndPanelsPanel);
f.add(new JButton(new AbstractAction("Update and print to the console") {
@Override
public void actionPerformed(ActionEvent e) {
nodesAndPanelsPanel.applyChanges();
System.out.println(ToStringBuilder.reflectionToString(myObject));
}
}), BorderLayout.NORTH);
f.pack();
f.setVisible(true);
}
......
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