source: java/main/src/main/java/com/framsticks/gui/TreePanel.java @ 105

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

HIGHLIGHTS:

  • import refactorization: move Tree, Path, etc.

from core to structure package

  • initial serialization implementation
  • improve PrimeExperiment? test
  • many organizational changes and convenience improvements

CHANGELOG:
Make registry in AbstractTree? final.

Move most classes from core to structure package.

Minor changes.

Switch names of Future and FutureHandler?.

Rename ExceptionResultHandler? to ExceptionHandler?.

Rename ExceptionHandler? to ExceptionDispatcherHandler?.

Fix bug in ParamCandidate? cache.

Add missing synchronization to the BufferedDispatcher?.

Develop @Serialized support.

Rework serialization further.

Add serialization/deserialization interface to ValueParam?.

Move getStorageType and isNumeric from Param down to params hierarchy.

Minor changes.

Improve param type induction.

Add TestSerializedClass? for testing new serialization.

Add info files gor GenePool? and Population.

Add standard.expt exemplary netfile.

Add type name field to PropertiesObject?.

Use PropertiesObject? for PropertiesAccess? instead of ordinary map.

Hide getFramsClass is several more places.

More unification accross FramsClass?, Access and Path.

Add ParamCollection?.

Simplify interface for getting params from FramsClass?, Access
or Path.

Make Access.call() interface variadic.

Add arguments(args) convenience wrapper around new Object[] {args}.

Upgrade to apache.commons.lang version 3.1

Minor improvement with Response constructors.

Develop proper result printing in ClientAtServer?.

Add experimentNetsave to PrimeExperiment?.

File size: 2.7 KB
Line 
1package com.framsticks.gui;
2
3import static com.framsticks.structure.TreeOperations.*;
4
5import com.framsticks.gui.tree.AbstractNode;
6import com.framsticks.gui.tree.TreeNode;
7import com.framsticks.params.Access;
8import com.framsticks.params.CompositeParam;
9import com.framsticks.params.FramsClass;
10import com.framsticks.structure.Path;
11import com.framsticks.structure.Tree;
12import com.framsticks.util.lang.Casting;
13
14import org.apache.logging.log4j.Logger;
15import org.apache.logging.log4j.LogManager;
16
17@SuppressWarnings("serial")
18public abstract class TreePanel extends AbstractPanel {
19
20        private static final Logger log = LogManager.getLogger(TreePanel.class);
21
22        @Override
23        public void fillPanelWith(AbstractNode node) {
24                TreeNode treeNode = Casting.throwCast(TreeNode.class, node);
25
26                Path path = Path.to(treeNode.getTree(), treeNode.getTextual());
27                if (!path.isResolved()) {
28                        log.error("path is not resolved: {}", path);
29                        return;
30                }
31                setCurrentPath(path);
32                pullValuesFromLocalToUser(bindAccess(path));
33        }
34
35        public static class Parameters {
36                public final TreeAtFrame treeAtFrame;
37                public final CompositeParam param;
38
39                /** Contained type FramsClass. */
40                public final FramsClass framsClass;
41
42                public Parameters(TreeAtFrame treeAtFrame, CompositeParam param, FramsClass framsClass) {
43                        this.treeAtFrame = treeAtFrame;
44                        this.param = param;
45                        this.framsClass = framsClass;
46                }
47        }
48
49        protected final TreeAtFrame treeAtFrame;
50        protected final String className;
51        protected final FramsClass framsClass;
52        protected final CompositeParam param;
53        protected Path currentPath;
54
55        public TreePanel(Parameters parameters) {
56                super(parameters.treeAtFrame.getFrame());
57                this.treeAtFrame = parameters.treeAtFrame;
58                this.framsClass = parameters.framsClass;
59                this.param = parameters.param;
60                this.className = parameters.param.getContainedTypeName();
61                this.setName(parameters.param.getFramsTypeName());
62                log.debug("created panel: {}", this);
63        }
64
65        /**
66         * @return the currentTreePath
67         */
68        public Path getCurrentPath() {
69                return currentPath;
70        }
71
72        /**
73         * @param currentTreePath the currentTreePath to set
74         */
75        public void setCurrentPath(Path path) {
76                path.assureResolved();
77                this.currentPath = path;
78        }
79
80        public final TreeAtFrame getTreeAtFrame() {
81                return treeAtFrame;
82        }
83        public final Object getCurrentObject() {
84                assert currentPath != null;
85                return currentPath.getTopObject();
86        }
87        public final Tree getTree() {
88                assert currentPath != null;
89                return currentPath.getTree();
90        }
91
92        public final String getClassName() {
93                return className;
94        }
95
96        public abstract void pullValuesFromLocalToUser(Access access);
97
98        @Override
99        public String toString() {
100                return param.getFramsTypeName() + "(" + uniqueName + ")";
101        }
102
103}
Note: See TracBrowser for help on using the repository browser.