source: java/main/src/main/java/com/framsticks/gui/controls/Control.java @ 86

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

HIGHLIGHTS:

  • use java annotations to mark classes and fields to be used when:
    • using java classes with ReflectionAccess? to represent remote objects with FramsClass? description found by "info ..." requests
    • to build up FramsClass? representation of objects not present at remote server
  • allow using primitive types (instead of wraping counterparts) in reflected classes
  • rework FramsClass? creation process (add FramsClassBuilder?)
  • add more tests

CHANGELOG:
Prepare model.World class.

Minor change.

Use primitive types for Genotype and Creature classes.

Use primitive types in model.Neuro* classes.

Use primitive types in model.Joint* classes.

Use primitive types in model.Part* classes.

Fix primitive values.

Extract FramsClassBuilder?.

Add tests of Model classes.

More fixes.

Refactorize out ParamCandidate?.

Several fixes.

Fix all regressions after introducing annotations.

Use annotations throughout the project.

Add exception classes.

Improve creation of FramsClass?.

More changes.

Many changes regarding annotations.

Annotate classes in com.framsticks.model package.

Remove manual FramsClass? constructor.

Construct FramsClass? for Creature. Add test.

Add default values to the ParamAnnotation?.

Add ParamBuilderTest? and ParamAnnotation?.

Add FramsClassAnnotation?.

File size: 1.0 KB
Line 
1package com.framsticks.gui.controls;
2
3import java.awt.BorderLayout;
4
5import javax.swing.JComponent;
6import javax.swing.JPanel;
7
8import com.framsticks.gui.Frame;
9import com.framsticks.params.Flags;
10import com.framsticks.params.Param;
11
12/**
13 * Interface that each class that want to be component must implement.
14 */
15@SuppressWarnings("serial")
16public abstract class Control extends JPanel {
17
18        public static final int LINE_HEIGHT = 36;
19
20        // private static final Logger log = Logger.getLogger(Control.class.getName());
21
22        protected Frame frame;
23        protected final Param param;
24
25        public Control(Param param) {
26                this.param = param;
27
28                this.setEnabled(!param.hasFlag(Flags.READONLY));
29                // TODO: take care of textField exception: setEditable
30        }
31
32        public Param getParam() {
33                return param;
34        }
35
36        public void setFrame(Frame frame) {
37                this.frame = frame;
38        }
39
40        protected void addAsOnlyChild(JComponent component) {
41                this.setLayout(new BorderLayout());
42                this.add(component, BorderLayout.CENTER);
43        }
44
45        @Override
46        public String toString() {
47                return param.toString();
48        }
49}
Note: See TracBrowser for help on using the repository browser.