source: java/main/src/main/java/com/framsticks/gui/FrameJoinable.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;
2
3import java.awt.BorderLayout;
4import java.awt.Container;
5import java.awt.event.WindowAdapter;
6import java.awt.event.WindowEvent;
7import java.util.concurrent.atomic.AtomicBoolean;
8
9import javax.swing.JFrame;
10import javax.swing.UIManager;
11
12import org.apache.logging.log4j.Logger;
13import org.apache.logging.log4j.LogManager;
14
15import com.framsticks.util.FramsticksException;
16import com.framsticks.util.dispatching.ExceptionResultHandler;
17import com.framsticks.util.dispatching.RunAt;
18import com.framsticks.util.dispatching.ThrowExceptionHandler;
19
20public abstract class FrameJoinable extends SwingJoinable<JFrame> implements ExceptionResultHandler {
21        private static final Logger log =
22                LogManager.getLogger(FrameJoinable.class);
23
24        protected String title;
25
26        protected final StatusBar statusBar;
27
28
29        /**
30         *
31         */
32        public FrameJoinable() {
33                statusBar = new StatusBar();
34        }
35
36        public void setTitle(String title) {
37                this.title = title;
38                if (hasSwing()) {
39                        getSwing().setTitle(title);
40                }
41        }
42
43        /**
44         * @return the statusBar
45         */
46        public StatusBar getStatusBar() {
47                return statusBar;
48        }
49
50        @Override
51        public String getName() {
52                return title;
53        }
54
55        private final static AtomicBoolean sentGuiInitialization = new AtomicBoolean(false);
56
57
58        @Override
59        protected void joinableStart() {
60
61                if (sentGuiInitialization.compareAndSet(false, true)) {
62                        dispatch(new RunAt<FrameJoinable>(ThrowExceptionHandler.getInstance()) {
63                                @Override
64                                protected void runAt() {
65                                        try {
66                                                boolean found = false;
67                                                // for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
68                                                //      log.info("look and feel available: {}", info.getName());
69                                                //      if ("Nimbus".equals(info.getName())) {
70                                                //              UIManager.setLookAndFeel(info.getClassName());
71                                                //              found = true;
72                                                //              break;
73                                                //      }
74                                                // }
75                                                if (!found) {
76                                                        UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
77                                                }
78                                                JFrame.setDefaultLookAndFeelDecorated(true);
79                                        } catch (Exception e) {
80                                                throw new FramsticksException().msg("failed to initialize Look&Feel").cause(e);
81                                        }
82                                }
83                        });
84                }
85
86                super.joinableStart();
87                dispatch(new RunAt<FrameJoinable>(ThrowExceptionHandler.getInstance()) {
88                        @Override
89                        protected void runAt() {
90                                getSwing().setVisible(true);
91                        }
92                });
93
94        }
95
96        @Override
97        protected void joinableInterrupt() {
98                super.joinableInterrupt();
99
100                dispatch(new RunAt<Frame>(ThrowExceptionHandler.getInstance()) {
101                        @Override
102                        protected void runAt() {
103                                finish();
104                        }
105                });
106
107        }
108
109        @Override
110        protected void joinableFinish() {
111                super.joinableFinish();
112                log.debug("disposing frame {}", this);
113                getSwing().dispose();
114        }
115
116        @Override
117        protected void joinableJoin() throws InterruptedException {
118                super.joinableJoin();
119
120        }
121
122        @Override
123        protected void initializeGui() {
124                setSwing(new JFrame(title));
125                statusBar.initializeGui();
126
127                Container contentPane = getSwing().getContentPane();
128                contentPane.setLayout(new BorderLayout());
129                contentPane.add(statusBar.getSwing(), BorderLayout.SOUTH);
130
131                getSwing().setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
132
133                getSwing().addWindowListener(new WindowAdapter() {
134                        @Override
135                        public void windowClosing(WindowEvent e) {
136                                log.info("received closing");
137                                interrupt();
138                        }
139                });
140
141
142        }
143
144        @Override
145        public void handle(FramsticksException exception) {
146                statusBar.handle(exception);
147        }
148
149}
Note: See TracBrowser for help on using the repository browser.