source: java/main/src/main/java/com/framsticks/params/PropertiesAccess.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.4 KB
Line 
1package com.framsticks.params;
2
3import java.util.HashMap;
4import java.util.Map;
5
6import com.framsticks.params.types.EventParam;
7import com.framsticks.params.types.ProcedureParam;
8
9
10/**
11 * The Class PropertiesAccess.
12 *
13 * @author Jarek Szymczak <name.surname@gmail.com> (please replace name and
14 *         surname with my personal data)
15 *
16 * @author Piotr Śniegowski
17 */
18public class PropertiesAccess extends SimpleAbstractAccess {
19
20        public Map<String, Object> properties;
21
22        @Override
23        public Map<String, Object> createAccessee() {
24                return PropertiesAccess.createPropertiesMap();
25        }
26
27        public static Map<String, Object> createPropertiesMap() {
28                return new HashMap<String, Object>();
29        }
30
31        public PropertiesAccess(FramsClass framsClass) {
32                super(framsClass);
33        }
34
35        @Override
36        public void clearValues() {
37                assert properties != null;
38                properties.clear();
39        }
40
41        @Override
42        public <T> T get(ValueParam param, Class<T> type) {
43                assert properties != null;
44                assert param != null;
45                Object object = properties.get(param.getId());
46                if (object != null) {
47                        try {
48                                return type.cast(object);
49                        } catch (ClassCastException e) {
50                                throw (ClassCastException) new ClassCastException("property " + param + " type is " + object.getClass().getName() + ", not " + type.getName()).initCause(e);
51                        }
52                }
53                try {
54                        return param.getDef(type);
55                } catch (ClassCastException e) {
56                        throw (ClassCastException) new ClassCastException("default value of property " + param + " is not of type " + type.getName()).initCause(e);
57                }
58
59        }
60
61        @Override
62        protected <T> void internalSet(ValueParam param, T value) {
63                properties.put(param.getId(), value);
64        }
65
66        /**
67         * Sets the new values to operate on. It does not check whether the values
68         * which are set through this method are correct. If set values are not
69         * correct exceptions might occurred while getting / setting the parameters
70         * values
71         *
72         * @param object
73         *            the properties with parameters values
74         */
75        @SuppressWarnings("unchecked")
76        @Override
77        public PropertiesAccess select(Object object) {
78                properties = Util.selectObjectForAccess(this, object, Map.class);
79                return this;
80        }
81
82        /** covariant */
83        @Override
84        public Map<String, Object> getSelected() {
85                return properties;
86        }
87
88        @Override
89        public PropertiesAccess cloneAccess() {
90                return new PropertiesAccess(framsClass);
91        }
92
93        @Override
94        public void tryAutoAppend(Object object) {
95                throw new InvalidOperationException();
96        }
97
98        @Override
99        public Object call(String id, Object[] arguments) {
100                throw new InvalidOperationException().msg("properties access does not support calling methods").arg("id", id);
101        }
102
103        @Override
104        public Object call(ProcedureParam param, Object[] arguments) {
105                throw new InvalidOperationException().msg("properties access does not support calling methods").arg("param", param);
106        }
107
108        @Override
109        public void reg(EventParam param, EventListener<?> listener) {
110                throw new InvalidOperationException().msg("properties access does not support registering events").arg("param", param).arg("access", this);
111        }
112
113        @Override
114        public void regRemove(EventParam param, EventListener<?> listener) {
115                throw new InvalidOperationException().msg("properties access does not support registering events").arg("param", param).arg("access", this);
116        }
117
118        @Override
119        public String toString() {
120                StringBuilder b = new StringBuilder();
121                b.append(framsClass);
122                if (getSelected() != null) {
123                        b.append("(").append(getSelected().size()).append(")");
124                }
125                return b.toString();
126        }
127}
Note: See TracBrowser for help on using the repository browser.