source: java/main/src/main/java/com/framsticks/gui/console/Console.java @ 100

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

HIGHLIGHTS:

  • add <include/> to configuration
  • add side notes to tree
    • used to store arbitrary information alongside the tree structure
  • migrate to log4j2
    • supports lazy string evaluation of passed arguments
  • improve GUI tree
    • it stays in synchronization with actual state (even in high load test scenario)
  • improve panel management in GUI
  • make loading objects in GUI more lazy
  • offload parsing to connection receiver thread
    • info parsing
    • first step of objects parsing
  • fix connection parsing bug (eof in long values)
  • support zero-arguments procedure in table view

CHANGELOG:
Implement procedure calls from table view.

Refactorization around procedures in tables.

Add table editor for buttons.

Render buttons in the the list view.

Further improve Columns.

Add Column class for TableModel?.

Accept also non-arguments ProcedureParams? in tableView.

Increase maximal TextAreaControl? size.

Add tooltip to ProcedureControl?.

Fix bug of interpreting eofs in long values by connection reader.

Further rework connection parsing.

Simplify client connection processing.

Test ListChange? modification.

Test ListChange? events with java server.

Add TestChild?.

Fix bug with fast deregistering when connecting to running server.

Another minor refactorization in TreeOperations?.

Fix bug in SimpleAbstractAccess? loading routine.

Another minor improvement.

Minor change.

Make reading of List objects two-phase.

Another minor change.

Dispatch parsing into receiver thread.

Another step.

Enclose passing value in ObjectParam? case in closure.

Minor step.

Minor change on way to offload parsing.

Temporarily comment out single ValueParam? get.

It will be generalized to multi ValueParam?.

Process info in receiver thread.

Add DispatchingExceptionHandler?.

Make waits in browser test longer.

Use FETCHED_MARK.

It is honored in GUI, where it used to decide whether to get values

after user action.

It is set in standard algorithm for processing fetched values.

Add remove operation to side notes.

Make loading more lazy.

Improve loading policy.

On node choose load itself, on node expansion, load children.

Minor improvement.

Fix bug with panel interleaving.

Minor improvements.

Improve panel management.

More cleaning around panels.

Reorganize panels.

Further improve tree.

Fix bug in TreeModel?.

Remove children from TreeNode?.

Implement TreeNode? hashCode and equals.

Make TreeNode? delegate equals and hashcode to internal reference.

Move listeners from TreeNode? to side notes.

Store path.textual as a side note.

Side note params instead of accesses for objects.

More refactorizations.

In TreeNode? bindAccess based on side notes.

Minor step.

Hide createAccess.

Rename AccessInterface? to Access.

Minor changes.

Several improvements in high load scenarios.

Change semantics of ArrayListAccess?.set(index, null);

It now removes the element, making list shorter
(it was set to null before).

Add path remove handler.

Handle exceptions in Connection.

Update .gitignore

Configure logging to file.

Move registration to TreeModel?.

Further refactorization.

Minor refactorization.

Minor improvements.

Use specialized event also for Modify action of ListChange?.

Use remove events.

Use the insertion events for tree.

Further improve tree refreshing.

Further improve reacting on events in GUI.

Fix problem with not adding objects on addition list change.

Migrate to log4j lazy String construction interface.

Migrate imports to log4j2.

Drop dependency on adapter to version 1.2.

Switch log4j implementation to log4j2.

Add dirty mark to the NodeAtFrame?.

Make selecting in AccessInterfaces? type safe.

Ignore containers size settings in Model and Genotype.

Use tree side notes to remember local changes and panels.

Add sideNotes to tree.

They will be used to store various accompanying information
right in the tree.

Use ReferenceIdentityMap? from apache in TreeNode?.

It suits the need perfectly (weak semantics on both key and value).

Make ArrayListParam? do not react size changes.

Guard in TableModel? before not yet loaded objects.

Add <include/> clause and AutoInjector?.

Extract common columns configuration to separate xml,
that can be included by other configurations.

File size: 3.3 KB
Line 
1package com.framsticks.gui.console;
2
3import java.awt.BorderLayout;
4import java.awt.Dimension;
5
6import javax.swing.BorderFactory;
7import javax.swing.JPanel;
8import javax.swing.JScrollPane;
9import javax.swing.JTextPane;
10
11import org.apache.logging.log4j.Logger;
12import org.apache.logging.log4j.LogManager;
13
14import com.framsticks.communication.Connection;
15import com.framsticks.gui.FrameJoinable;
16import com.framsticks.params.annotations.FramsClassAnnotation;
17import com.framsticks.util.FramsticksException;
18import com.framsticks.util.dispatching.Dispatching;
19import com.framsticks.util.dispatching.ExceptionResultHandler;
20import com.framsticks.util.dispatching.Joinable;
21import com.framsticks.util.dispatching.JoinableParent;
22import com.framsticks.util.dispatching.JoinableState;
23import com.framsticks.util.dispatching.RunAt;
24
25@FramsClassAnnotation
26public abstract class Console extends FrameJoinable implements JoinableParent {
27        private static final Logger log = LogManager.getLogger(Console.class);
28
29        /**
30         * Painter coloring manager responses before display.
31         */
32        protected ConsolePainter consolePainter;
33
34        protected Connection connection;
35
36        protected JPanel panel;
37
38        /**
39         * @param connection
40         */
41        public Console() {
42                setTitle("console");
43        }
44
45        /**
46         * @return the connection
47         */
48        public Connection getConnection() {
49                return connection;
50        }
51
52        @Override
53        public String getName() {
54                return connection != null ? "console for " + connection.getName() : "console";
55        }
56
57        @Override
58        protected void initializeGui() {
59                super.initializeGui();
60                panel = new JPanel();
61                panel.setLayout(new BorderLayout());
62                panel.setSize(new Dimension(440, 400));
63                panel.setMinimumSize(new Dimension(440, 400));
64
65                JTextPane text = new JTextPane();
66                consolePainter = new ConsolePainter(text);
67
68                text.setEditable(false);
69                final JScrollPane scrollText = new JScrollPane(text);
70                scrollText.setBorder(BorderFactory.createEtchedBorder());
71
72                JPanel scrollPanel = new JPanel();
73                scrollPanel.setLayout(new BorderLayout());
74                scrollPanel.add(scrollText, BorderLayout.CENTER);
75                scrollPanel.setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));
76
77                panel.add(scrollPanel, BorderLayout.CENTER);
78
79                getSwing().getContentPane().add(panel, BorderLayout.CENTER);
80
81                log.debug("initialized gui");
82        }
83
84        @Override
85        public void childChangedState(Joinable joinable, JoinableState state) {
86                if (joinable == connection) {
87                        proceedToState(state);
88                }
89        }
90
91        protected ExceptionResultHandler getExceptionHandler() {
92                return new ExceptionResultHandler() {
93
94                        @Override
95                        public void handle(FramsticksException exception) {
96                                throw exception;
97
98                        }
99                };
100        }
101
102        @Override
103        protected void joinableStart() {
104                if (connection == null) {
105                        throw new FramsticksException().msg("connection was not set").arg("console", this);
106                }
107                super.joinableStart();
108                Dispatching.use(connection, this);
109        }
110
111        @Override
112        protected void joinableInterrupt() {
113                Dispatching.drop(connection, this);
114                super.joinableInterrupt();
115        }
116
117        @Override
118        protected void joinableFinish() {
119                super.joinableFinish();
120        }
121
122        @Override
123        protected void joinableJoin() throws InterruptedException {
124                Dispatching.join(connection);
125                super.joinableJoin();
126        }
127
128        protected void dispatchWrite(final String line) {
129                dispatch(new RunAt<Console>(getExceptionHandler()) {
130                        @Override
131                        protected void runAt() {
132                                consolePainter.userLine(line);
133                        }
134                });
135        }
136
137}
Note: See TracBrowser for help on using the repository browser.