source: java/main/src/main/java/com/framsticks/visualization/ViewerTest.java @ 100

Last change on this file since 100 was 100, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

  • add <include/> to configuration
  • add side notes to tree
    • used to store arbitrary information alongside the tree structure
  • migrate to log4j2
    • supports lazy string evaluation of passed arguments
  • improve GUI tree
    • it stays in synchronization with actual state (even in high load test scenario)
  • improve panel management in GUI
  • make loading objects in GUI more lazy
  • offload parsing to connection receiver thread
    • info parsing
    • first step of objects parsing
  • fix connection parsing bug (eof in long values)
  • support zero-arguments procedure in table view

CHANGELOG:
Implement procedure calls from table view.

Refactorization around procedures in tables.

Add table editor for buttons.

Render buttons in the the list view.

Further improve Columns.

Add Column class for TableModel?.

Accept also non-arguments ProcedureParams? in tableView.

Increase maximal TextAreaControl? size.

Add tooltip to ProcedureControl?.

Fix bug of interpreting eofs in long values by connection reader.

Further rework connection parsing.

Simplify client connection processing.

Test ListChange? modification.

Test ListChange? events with java server.

Add TestChild?.

Fix bug with fast deregistering when connecting to running server.

Another minor refactorization in TreeOperations?.

Fix bug in SimpleAbstractAccess? loading routine.

Another minor improvement.

Minor change.

Make reading of List objects two-phase.

Another minor change.

Dispatch parsing into receiver thread.

Another step.

Enclose passing value in ObjectParam? case in closure.

Minor step.

Minor change on way to offload parsing.

Temporarily comment out single ValueParam? get.

It will be generalized to multi ValueParam?.

Process info in receiver thread.

Add DispatchingExceptionHandler?.

Make waits in browser test longer.

Use FETCHED_MARK.

It is honored in GUI, where it used to decide whether to get values

after user action.

It is set in standard algorithm for processing fetched values.

Add remove operation to side notes.

Make loading more lazy.

Improve loading policy.

On node choose load itself, on node expansion, load children.

Minor improvement.

Fix bug with panel interleaving.

Minor improvements.

Improve panel management.

More cleaning around panels.

Reorganize panels.

Further improve tree.

Fix bug in TreeModel?.

Remove children from TreeNode?.

Implement TreeNode? hashCode and equals.

Make TreeNode? delegate equals and hashcode to internal reference.

Move listeners from TreeNode? to side notes.

Store path.textual as a side note.

Side note params instead of accesses for objects.

More refactorizations.

In TreeNode? bindAccess based on side notes.

Minor step.

Hide createAccess.

Rename AccessInterface? to Access.

Minor changes.

Several improvements in high load scenarios.

Change semantics of ArrayListAccess?.set(index, null);

It now removes the element, making list shorter
(it was set to null before).

Add path remove handler.

Handle exceptions in Connection.

Update .gitignore

Configure logging to file.

Move registration to TreeModel?.

Further refactorization.

Minor refactorization.

Minor improvements.

Use specialized event also for Modify action of ListChange?.

Use remove events.

Use the insertion events for tree.

Further improve tree refreshing.

Further improve reacting on events in GUI.

Fix problem with not adding objects on addition list change.

Migrate to log4j lazy String construction interface.

Migrate imports to log4j2.

Drop dependency on adapter to version 1.2.

Switch log4j implementation to log4j2.

Add dirty mark to the NodeAtFrame?.

Make selecting in AccessInterfaces? type safe.

Ignore containers size settings in Model and Genotype.

Use tree side notes to remember local changes and panels.

Add sideNotes to tree.

They will be used to store various accompanying information
right in the tree.

Use ReferenceIdentityMap? from apache in TreeNode?.

It suits the need perfectly (weak semantics on both key and value).

Make ArrayListParam? do not react size changes.

Guard in TableModel? before not yet loaded objects.

Add <include/> clause and AutoInjector?.

Extract common columns configuration to separate xml,
that can be included by other configurations.

File size: 3.6 KB
Line 
1package com.framsticks.visualization;
2
3import com.sun.j3d.utils.universe.*;
4import com.sun.j3d.utils.geometry.ColorCube;
5import org.apache.logging.log4j.Logger;
6import org.apache.logging.log4j.LogManager;
7
8import javax.media.j3d.*;
9import javax.swing.*;
10import javax.vecmath.*;
11import java.awt.*;
12import java.awt.event.ComponentEvent;
13import java.awt.event.ComponentListener;
14
15/**
16 * Author: Piotr Śniegowski
17 */
18@SuppressWarnings("serial")
19public class ViewerTest extends JPanel {
20        private static final Logger log = LogManager.getLogger(ViewerTest.class.getName());
21
22        private SimpleUniverse univ = null;
23        private BranchGroup scene = null;
24
25        public BranchGroup createSceneGraph() {
26                // Create the root of the branch graph
27                BranchGroup objRoot = new BranchGroup();
28
29                // Create the TransformGroup node and initialize it to the
30                // identity. Enable the TRANSFORM_WRITE capability so that
31                // our behavior code can modify it at run time. Add it to
32                // the root of the subgraph.
33                TransformGroup objTrans = new TransformGroup();
34                objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
35                objRoot.addChild(objTrans);
36
37                // Create a simple Shape3D node; add it to the scene graph.
38                objTrans.addChild(new ColorCube(0.4));
39
40                // Create a new Behavior object that will perform the
41                // desired operation on the specified transform and add
42                // it into the scene graph.
43                Transform3D yAxis = new Transform3D();
44                Alpha rotationAlpha = new Alpha(-1, 4000);
45
46                RotationInterpolator rotator =
47                                new RotationInterpolator(rotationAlpha, objTrans, yAxis,
48                                                0.0f, (float) Math.PI * 2.0f);
49                BoundingSphere bounds =
50                                new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);
51                rotator.setSchedulingBounds(bounds);
52                objRoot.addChild(rotator);
53
54                // Have Java 3D perform optimizations on this scene graph.
55                objRoot.compile();
56
57                return objRoot;
58        }
59
60        private Canvas3D createUniverse() {
61                // Get the preferred graphics configuration for the default screen
62                GraphicsConfiguration config =
63                                SimpleUniverse.getPreferredConfiguration();
64
65                // Create a Canvas3D using the preferred configuration
66                final Canvas3D c = new Canvas3D(config) {
67                        @Override
68                        public void paint(Graphics graphics) {
69                                super.paint(graphics);
70                                Toolkit.getDefaultToolkit().sync();
71                        }
72
73                        @Override
74                        public void postRender() {
75                                super.postRender();
76                                //log.info("postRender()");
77                        }
78                        @Override
79                        public void postSwap() {
80                                super.postSwap();
81                                //log.info("postSwap()");
82                        }
83                };
84
85
86                c.addComponentListener(new ComponentListener() {
87                        @Override
88                        public void componentResized(ComponentEvent componentEvent) {
89                        }
90
91                        @Override
92                        public void componentMoved(ComponentEvent componentEvent) {
93                        }
94
95                        @Override
96                        public void componentShown(ComponentEvent componentEvent) {
97                                log.info("shown");
98                                c.startRenderer();
99                        }
100
101                        @Override
102                        public void componentHidden(ComponentEvent componentEvent) {
103                                log.info("hidden");
104                                c.stopRenderer();
105                        }
106                });
107
108                // Create simple universe with view branch
109                univ = new SimpleUniverse(c);
110
111                // This will move the ViewPlatform back a bit so the
112                // objects in the scene can be viewed.
113                univ.getViewingPlatform().setNominalViewingTransform();
114
115                // Ensure at least 5 msec per frame (i.e., < 200Hz)
116                univ.getViewer().getView().setMinimumFrameCycleTime(16);
117
118                return c;
119        }
120
121        public ViewerTest() {
122
123                this.setLayout(new java.awt.BorderLayout());
124
125                this.setPreferredSize(new java.awt.Dimension(250, 250));
126
127                Canvas3D c = createUniverse();
128                c.setSize(100, 100);
129                this.add(c, java.awt.BorderLayout.CENTER);
130
131                // Create the content branch and add it to the universe
132                scene = createSceneGraph();
133                univ.addBranchGraph(scene);
134        }
135}
Note: See TracBrowser for help on using the repository browser.