source: java/main/src/main/java/com/framsticks/gui/controls/Control.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: 1.8 KB
Line 
1package com.framsticks.gui.controls;
2
3// import java.awt.BorderLayout;
4
5
6import javax.swing.JPanel;
7
8import com.framsticks.core.Path;
9import com.framsticks.params.ParamFlags;
10import com.framsticks.params.Param;
11import com.framsticks.util.FramsticksException;
12import com.framsticks.util.Misc;
13import com.framsticks.util.dispatching.ExceptionResultHandler;
14
15/**
16 * Interface that each class that want to be component must implement.
17 */
18@SuppressWarnings("serial")
19public abstract class Control extends JPanel implements ExceptionResultHandler {
20
21        public static final int LINE_HEIGHT = 36;
22
23        // private static final Logger log = LogManager.getLogger(Control.class.getName());
24
25        protected final Param param;
26        protected ControlOwner owner;
27
28        protected abstract void updateEnabled(boolean enabled);
29
30        private boolean userEnabled = true;
31
32        public Control(Param param) {
33                this.param = param;
34                setName(param.getId());
35        }
36
37        public Param getParam() {
38                return param;
39        }
40
41        public void setOwner(ControlOwner owner) {
42                this.owner = owner;
43        }
44
45        /**
46         * @return the userEnabled
47         */
48        public final boolean isUserEnabled() {
49                return userEnabled;
50        }
51
52        /**
53         * @param userEnabled the userEnabled to set
54         */
55        public final void setUserEnabled(boolean userEnabled) {
56                this.userEnabled = userEnabled;
57                updateEnabled(!isReadonly());
58        }
59
60        public final boolean isReadonly() {
61                return !userEnabled || param.hasFlag(ParamFlags.READONLY) || param.hasFlag(ParamFlags.USERREADONLY);
62        }
63
64
65        @Override
66        public String toString() {
67                return param.toString();
68        }
69
70        @Override
71        public void handle(FramsticksException exception) {
72                owner.handle(exception);
73        }
74
75        public Path getCurrentPath() {
76                return owner.getCurrentPath();
77        }
78
79        public Path assureCurrentPath() {
80                return Misc.throwIfNull(owner.getCurrentPath());
81        }
82
83        public void refreshState() {
84        }
85}
Note: See TracBrowser for help on using the repository browser.