source: java/main/src/main/java/com/framsticks/test/TestClass.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.test;
2
3import java.util.Collections;
4import java.util.LinkedList;
5import java.util.List;
6import java.util.Map;
7
8import org.apache.logging.log4j.Logger;
9import org.apache.logging.log4j.LogManager;
10
11import com.framsticks.core.ListChange;
12import com.framsticks.params.EventListener;
13import com.framsticks.params.UniqueListAccess;
14import com.framsticks.params.annotations.FramsClassAnnotation;
15import com.framsticks.params.annotations.ParamAnnotation;
16import com.framsticks.params.types.ProcedureParam;
17
18@FramsClassAnnotation(
19        order = {
20                "name",
21                "history",
22                "history_changed",
23                "appendHistory",
24                "resetHistory",
25                "children",
26                "createChild",
27                "children_changed"
28        },
29        register = {
30                ChangeEvent.class,
31                TestChild.class,
32                ListChange.class
33        }
34)
35public class TestClass {
36        private static final Logger log =
37                LogManager.getLogger(TestClass.class);
38
39
40        protected String name = "test";
41        protected String history = "initial|";
42        protected final List<EventListener<ChangeEvent>> historyListeners = new LinkedList<>();
43        protected final List<EventListener<ListChange>> childrenListeners = new LinkedList<>();
44
45        protected final Map<String, TestChild> children = UniqueListAccess.createMap(TestChild.class, this);
46        protected int counter = 0;
47
48        /**
49         *
50         */
51        public TestClass() {
52        }
53
54        /**
55         * @return the name
56         */
57        @ParamAnnotation
58        public String getName() {
59                return name;
60        }
61
62        /**
63         * @param name the name to set
64         */
65        @ParamAnnotation
66        public void setName(String name) {
67                this.name = name;
68        }
69
70        /**
71         * @return the history
72         */
73        @ParamAnnotation
74        public String getHistory() {
75                return history;
76        }
77
78        /**
79         * @param history the history to set
80         */
81        @ParamAnnotation
82        public void setHistory(String history) {
83                this.history = history;
84        }
85
86        /**
87         * @return the children
88         */
89        @ParamAnnotation
90        public Map<String, TestChild> getChildren() {
91                return Collections.unmodifiableMap(children);
92        }
93
94        @ParamAnnotation(paramType = ProcedureParam.class)
95        public int appendHistory(String line) {
96                log.debug("appending '{}'", line);
97                history = history + line + "|";
98                fireHistoryChange();
99                return history.length();
100        }
101
102        @ParamAnnotation(paramType = ProcedureParam.class)
103        public void resetHistory() {
104                log.debug("reseting");
105                history = "";
106                fireHistoryChange();
107        }
108
109        @ParamAnnotation(paramType = ProcedureParam.class)
110        public void createChild(String name) {
111                TestChild child = new TestChild(this);
112                child.name = name;
113                children.put(child.getUid(), child);
114                fireChildrenChange(child, ListChange.Action.Add);
115        }
116
117        protected void fireHistoryChange() {
118                for (EventListener<ChangeEvent> l : historyListeners) {
119                        ChangeEvent event = new ChangeEvent();
120                        event.history = history;
121                        l.action(event);
122                }
123        }
124
125        protected void fireChildrenChange(TestChild child, ListChange.Action action) {
126                ListChange change = new ListChange(action, UniqueListAccess.getNumberInMap(children, child), child.getUid());
127                for (EventListener<ListChange> l : childrenListeners) {
128                        l.action(change);
129                }
130        }
131
132        @ParamAnnotation(id = "history_changed")
133        public void addHistoryListener(EventListener<ChangeEvent> listener) {
134                historyListeners.add(listener);
135        }
136
137        @ParamAnnotation(id = "history_changed")
138        public void removeHistoryListener(EventListener<ChangeEvent> listener) {
139                historyListeners.remove(listener);
140        }
141
142        @ParamAnnotation(id = "children_changed")
143        public void addChildrenListener(EventListener<ListChange> listener) {
144                childrenListeners.add(listener);
145        }
146
147        @ParamAnnotation(id = "children_changed")
148        public void removeChildrenListener(EventListener<ListChange> listener) {
149                childrenListeners.remove(listener);
150        }
151
152        @Override
153        public String toString() {
154                return "test class " + history;
155        }
156
157}
Note: See TracBrowser for help on using the repository browser.