source: java/main/src/main/java/com/framsticks/params/Param.java @ 84

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

HIGHLIGHTS:

  • simplification of entities management model
  • cleanup around params (improve hierarchy)
  • migrate from JUnit to TestNG
  • introduce FEST to automatically test GUI
  • improve slider control
  • loosen synchronization between gui tree and backend representation
  • and many other bug fixes

NOTICE:

  • a great many of lines is changed only because of substituting spaces with tabs

CHANGELOG (oldest changes at the bottom):

Some cleaning after fix found.

Fix bug with tree.

More changes with TreeNodes?.

Finally fix issue with tree.

Improve gui tree management.

Decouple update of values from fetch request in gui.

Minor changes.

Minor changes.

Minor change.

Change Path construction wording.

More fixes to SliderControl?.

Fix SliderControl?.

Fix SliderControl?.

Minor improvement.

Several changes.

Make NumberParam? a generic class.

Add robot to the gui test.

Setup common testing logging configuration.

Remove Parameters class.

Remove entityOwner from Parameters.

Move name out from Parameters class.

Move configuration to after the construction.

Simplify observers and endpoints.

Remove superfluous configureEntity overrides.

Add dependency on fest-swing-testng.

Use FEST for final print test.

Use FEST for more concise and readable assertions.

Divide test of F0Parser into multiple methods.

Migrate to TestNG

Minor change.

Change convention from LOGGER to log.

Fix reporting of errors during controls filling.

Bound maximal height of SliderControl?.

Minor improvements.

Improve tooltips for controls.

Also use Delimeted in more places.

Move static control utilities to Gui.

Rename package gui.components to controls.

Some cleaning in controls.

Improve Param classes placing.

Move ValueParam?, PrimitiveParam? and CompositeParam? one package up.

Improve ParamBuilder?.

Move getDef to ValueParam? and PrimitiveParam?.

Move getMax and getDef to ValueParam?.

Move getMin to ValueParam?.

Upgrade to laters apache commons versions.

Use filterInstanceof extensively.

Add instanceof filters.

Make ValueParam? in many places of Param.

Place assertions about ValueParam?.

Add ValueParam?

Rename ValueParam? to PrimitiveParam?

Minor changes.

Several improvements to params types.

Add NumberParam?.

Add TextControl? component.

Add .swp files to .gitignore

Greatly improved slider component.

Some improvements.

Make Param.reassign return also a state.

Add IterableIterator?.

Several changes.

  • Move util classes to better packages.
  • Remove warnings from eclim.

Several improvements.

Fix bug with BooleanParam?.

Some experiments with visualization.

Another fix to panel management.

Improve panel management.

Some refactorization around panels.

Add root class for panel.

File size: 2.5 KB
Line 
1package com.framsticks.params;
2
3import com.framsticks.params.types.DecimalParam;
4import com.framsticks.params.types.StringParam;
5
6/**
7 * Based on c++ struct ParamEntry located in cpp/gdk/param.h
8 * Here  it is a root of Param hierarchy.
9 *
10 * @author Jarek Szymczak <name.surname@gmail.com>, Mateusz Jarus
11 * (please replace name and surname with my personal data)
12 *
13 * @author Piotr Śniegowski
14 */
15public abstract class Param {
16
17        /** The parameter id. */
18        protected String id;
19
20        /**
21         * The parameter internal id. It's set by a user to use user's own getId in
22         * code
23         */
24        protected String internalId;
25
26        /** The parameter name. */
27        protected String name;
28
29        /** The help (description) concerning parameter. */
30        protected String help;
31
32        /** The number of group, that parameter belongs to. */
33        protected Integer group;
34
35        /** The getFlags stored as a bit sum. */
36        protected Integer flags;
37
38        /** The variable determining whether the parameter is an extra parameter. */
39        protected Integer extra;
40
41
42        public Param() {
43
44        }
45
46        public String getId() {
47                return id;
48        }
49
50        public String getInternalId() {
51                return internalId;
52        }
53
54        public String getName() {
55                return name;
56        }
57
58        public String getHelp() {
59                return help;
60        }
61
62        public Integer getGroup() {
63                return group;
64        }
65
66        public Integer getFlags() {
67                return flags;
68        }
69
70        public abstract String getFramsTypeName();
71
72
73        public String getEffectiveId() {
74                return (internalId != null) ? internalId : id;
75        }
76
77
78        public Integer getExtra() {
79                return extra;
80        }
81
82        public void setInternalId(String internalId) {
83                this.internalId = internalId;
84        }
85
86        @Override
87        public String toString() {
88                return getId() + ":" + this.getClass().getSimpleName();
89        }
90
91        public boolean isNumeric() {
92                return false;
93        }
94
95        public abstract Class<?> getStorageType();
96
97        public boolean hasFlag(int flag) {
98                return flags != null && (flags & flag) != 0;
99        }
100
101        public boolean isUserHidden() {
102                return (flags & Flags.USERHIDDEN) != 0;
103        }
104
105        public static FramsClass getFramsClass() {
106                return new FramsClass("prop", "prop", null)
107                                .append(new ParamBuilder().setId("name").setName("Name").setType(StringParam.class).build())
108                                .append(new ParamBuilder().setId("id").setName("Id").setType(StringParam.class).build())
109                                .append(new ParamBuilder().setId("type").setName("Type").setType(StringParam.class).build())
110                                .append(new ParamBuilder().setId("help").setName("Help").setType(StringParam.class).build())
111                                .append(new ParamBuilder().setId("flags").setName("Flags").setType(DecimalParam.class).build());
112        }
113
114}
Note: See TracBrowser for help on using the repository browser.