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