source: java/main/src/main/java/com/framsticks/params/ListAccess.java @ 101

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

HIGHLIGHTS:

  • improve tree side notes
  • improve GUI layout
  • add foldable list of occured events to EventControl?
  • improve automatic type conversion in proxy listeners
  • implement several Access functionalities as algorithms independent of Access type
  • introduce draft base classes for distributed experiments
  • automatically register dependant Java classes to FramsClass? registry
  • add testing prime experiment and configuration
  • simplify and improve task dispatching

CHANGELOG:
Improve task dispatching in RemoteTree?.

GUI no longer hangs on connection problems.

Make all dispatchers joinables.

Refactorize Thread dispatcher.

Remove Task and PeriodicTask?.

Use Java utilities in those situations.

Reworking tasks dispatching.

Fix bug in EventControl? listener dispatching.

Minor improvements.

Add testing configuration for ExternalProcess? in GUI.

More improvement to prime.

Support for USERREADONLY in GUI.

Add that flag to various params in Java classes.

Remove redundant register clauses from several FramsClassAnnotations?.

Automatically gather and register dependant classes.

Add configuration for prime.

Improve Simulator class.

Add prime.xml configuration.

Introduce draft Experiment and Simulator classes.

Add prime experiment tests.

Enclose typical map with listeners into SimpleUniqueList?.

Needfile works in GUI.

Improve needfile handling in Browser.

More improvement with NeedFile?.

Implementing needfile.

Update test.

Rename ChangeEvent? to TestChangeEvent?.

Automatic argument type search in RemoteTree? listeners.

MultiParamLoader? uses AccessProvider?. By default old implementation
enclosed in AccessStash? or Registry.

Minor changes.

Rename SourceInterface? to Source.

Also improve toString of File and ListSource?.

Remove unused SimpleSource? class.

Add clearing in HistoryControl?.

Show entries in table at EventControl?.

Improve EventControl?.

Add listeners registration to EventControl?.

Add foldable table to HistoryControl?.

Add control row to Procedure and Event controls.

Improve layout of controls.

Another minor change to gui layout.

Minor improvement in the SliderControl?.

Minor changes.

Move ReflectionAccess?.Backend to separate file.

It was to cluttered.

Cleanup in ReflectionAccess?.

Move setMin, setMax, setDef to AccessOperations?.

Extract loading operation into AccessOperations?.

Append Framsticks to name of UnsupportedOperationException?.

The java.lang.UnsupportedOperationException? was shadowing this class.

Rename params.Util to params.ParamsUtil?.

Several improvements.

Minor changes.

Implement revert functionality.

Improve local changes management.

Minor improvement.

Remove methods rendered superfluous after SideNoteKey? improvement.

Improve SideNoteKey?.

It is now generic type, so explicit type specification at
call site is no more needed.

Introduce SideNoteKey? interface.

Only Objects implementing that key may be used as side note keys.

Minor improvements.

Use strings instead of ValueControls? in several gui mappings.

File size: 2.5 KB
Line 
1package com.framsticks.params;
2
3
4
5import static com.framsticks.util.lang.Containers.filterInstanceof;
6
7import com.framsticks.params.types.EventParam;
8import com.framsticks.params.types.ProcedureParam;
9
10/**
11 * @author Piotr Sniegowski
12 */
13public abstract class ListAccess implements Access {
14
15        final Access elementAccess;
16        final String containedTypeName;
17
18        protected final ParamBuilder paramBuilder;
19
20        public ListAccess(Access elementAccess) {
21                this.elementAccess = elementAccess;
22                this.containedTypeName = elementAccess.getId();
23                paramBuilder = elementAccess.buildParam(new ParamBuilder());
24        }
25
26        // @Override
27        // public Param getGroupMember(int gi, int n) {
28        //      return null;
29        // }
30
31
32        @Override
33        public void save(SinkInterface sink) {
34                for (CompositeParam p : filterInstanceof(getParams(), CompositeParam.class)) {
35                        Object child = get(p, Object.class);
36                        //this is probably an assertion
37                        assert child != null;
38                        elementAccess.select(child);
39                        elementAccess.save(sink);
40                }
41        }
42
43        public Access getElementAccess() {
44                return elementAccess;
45        }
46
47        /**
48         * @return the containedTypeName
49         */
50        public String getContainedTypeName() {
51                return containedTypeName;
52        }
53
54        @Override
55        public final FramsClass getFramsClass() {
56                return elementAccess.getFramsClass();
57        }
58
59        //TODO it could actually be used also
60        @Override
61        public void tryAutoAppend(Object object) {
62                throw new InvalidOperationException();
63        }
64
65        @Override
66        public Object call(String id, Object[] arguments) {
67                throw new InvalidOperationException().msg("list access does not support calling methods").arg("id", id).arg("access", this);
68        }
69
70        @Override
71        public Object call(ProcedureParam param, Object[] arguments) {
72                throw new InvalidOperationException().msg("list access does not support calling methods").arg("param", param).arg("access", this);
73        }
74
75        @Override
76        public void reg(EventParam param, EventListener<?> listener) {
77                throw new InvalidOperationException().msg("list access does not support registering events").arg("param", param).arg("access", this);
78        }
79
80        @Override
81        public void regRemove(EventParam param, EventListener<?> listener) {
82                throw new InvalidOperationException().msg("list access does not support registering events").arg("param", param).arg("access", this);
83        }
84
85
86        @Override
87        public String toString() {
88                StringBuilder b = new StringBuilder();
89                b.append("list of ").append(containedTypeName);
90                if (getSelected() != null) {
91                        b.append("[").append(getParamCount()).append("]");
92                }
93                return b.toString();
94        }
95
96        public CompositeParam prepareParamFor(String id) {
97                return paramBuilder.id(id).finish(CompositeParam.class);
98        }
99};
Note: See TracBrowser for help on using the repository browser.