source: java/main/src/main/java/com/framsticks/gui/controls/TextAreaControl.java @ 87

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

HIGHLIGHTS:

  • FramsClass? and contained Param are now immutable classes (like String),

which allows to refer to them concurrently without synchronization
(which for example in turn simplifies GUI management)

  • also make Path immutable (which was earlier only assumed)
  • add global cache for FramsClasses? created solely and automatically

on base of Java classes.

representations basing on given FramsClass?

  • above changes greatly improved GUI responsivness during browsing
  • furtherly improve Param class hierarchy
  • allow to inject actions on state changes into MultiParamLoader?
  • add more tests

CHANGELOG:

Add StatusListener? to MultiParamLoader?.

Minor refactorization in MultiParamLoader?.

First step with auto append.

Add SchemaTest?.

Improve Registry.

Clean up in Registry.

Work out Registry.

Use annotations for Param.

Fix ListChange?.

Improve fluent interface of the FramsClassBuilder?.

Done caching of ReflectionAccess?.Backend

Fix hashCode of Pair.

A step on a way to cache ReflectionAccess?.Backend

Make SimpleAbstractAccess?.framsClass a final field.

Add static cache for FramsClasses? based on java.

Only classes created strictly and automatically
based on java classes are using this cache.

Make all Params immutable.

Many improvement to make Param immutable.

Make PrimitiveParam? generic type.

Several changes to make Param immutable.

Make FramsClass? immutable.

Another improvement to Path immutability.

Several improvements to Path.

Improve PathTest?.

Configurarable MutabilityDetector?.

File size: 1.3 KB
Line 
1package com.framsticks.gui.controls;
2
3import com.framsticks.params.PrimitiveParam;
4
5import javax.swing.*;
6import java.awt.*;
7
8@SuppressWarnings("serial")
9public class TextAreaControl extends TextControl {
10
11        // private static final Logger log = Logger.getLogger(TextAreaControl.class.getName());
12
13        protected JTextArea textArea;
14        protected JScrollPane textScrollPane;
15
16        public TextAreaControl(PrimitiveParam<?> valueParam) {
17                super(valueParam);
18                textArea = new JTextArea();
19                textArea.setLineWrap(true);
20                textArea.setWrapStyleWord(true);
21                textArea.setEditable(!isReadOnly());
22                addDefaultDocumentListener(textArea);
23
24                textScrollPane = new JScrollPane(textArea);
25                this.setLayout(new BorderLayout());
26                this.add(textScrollPane, BorderLayout.CENTER);
27                this.setMaximumSize(new Dimension(Integer.MAX_VALUE, LINE_HEIGHT * 3));
28                textArea.setMaximumSize(new Dimension(Integer.MAX_VALUE, LINE_HEIGHT * 3));
29
30                this.revalidate();
31        }
32
33        @Override
34        public Dimension getPreferredSize() {
35                Dimension result = super.getPreferredSize();
36                return new Dimension(result.width, Math.min(result.height, this.getMaximumSize().height));
37        }
38
39        @Override
40        public void pushValueToUserInterfaceImpl(Object value) {
41                textArea.setText((String) value);
42                this.revalidate();
43        }
44
45        @Override
46        public Object pullValueFromUserInterface() {
47                return textArea.getText();
48        }
49
50}
Note: See TracBrowser for help on using the repository browser.