source: java/main/src/main/java/com/framsticks/gui/windows/ServerLogFrame.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.2 KB
Line 
1package com.framsticks.gui.windows;
2
3import com.framsticks.gui.ImageProvider;
4import org.apache.logging.log4j.LogManager;
5
6import javax.swing.*;
7import java.awt.*;
8import java.awt.event.ActionEvent;
9import java.awt.event.ActionListener;
10
11/**
12 * Frame displaying manager logs.
13 */
14@SuppressWarnings("serial")
15public class ServerLogFrame extends JFrame {
16        public JTextArea logText;
17        private int levelReporting = -1;
18        private boolean popUp = true;
19
20        private final static String[] STR_ = {"DEBUG", "INFO", "WARNING", "ERROR",
21                        "CRITICAL"};
22
23
24        public ServerLogFrame() {
25
26                super("FNC - Manager Log");
27                Dimension size = new Dimension(440, 400);
28                this.setSize(size);
29                this.setMinimumSize(size);
30                this.setIconImage(ImageProvider.loadImage(ImageProvider.LOGO).getImage());
31                JFrame.setDefaultLookAndFeelDecorated(true);
32                /*
33                try {
34                        UIManager
35                                        .setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
36                } catch (Exception ex) {
37                }
38                */
39                this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
40                logText = new JTextArea();
41                //logText.setFont(Control.FONT);
42                logText.setEditable(false);
43                logText.setWrapStyleWord(true);
44                logText.setLineWrap(true);
45                JComboBox<String> levelBox = new JComboBox<String>();
46                for (String i : STR_) {
47                        levelBox.addItem(i);
48                }
49                levelBox.addActionListener(new ActionListener() {
50                        public void actionPerformed(ActionEvent e) {
51                                levelReporting = ((JComboBox<?>) e.getSource()).getSelectedIndex();
52                        }
53                });
54                JCheckBox logPopup = new JCheckBox();
55                logPopup.addActionListener(new ActionListener() {
56                        public void actionPerformed(ActionEvent e) {
57                                popUp = ((JCheckBox) e.getSource()).isSelected();
58                        }
59                });
60                logPopup.setSelected(true);
61                JLabel levelLabel = new JLabel("Select reporting level ");
62                JLabel popupLabel = new JLabel("Window popup ? ");
63                JPanel panel = new JPanel();
64                panel.setLayout(new FlowLayout());
65                panel.add(levelLabel);
66                panel.add(levelBox);
67                panel.add(logPopup);
68                panel.add(popupLabel);
69                JScrollPane scrollPane = new JScrollPane(logText);
70                scrollPane.setBorder(BorderFactory.createEtchedBorder());
71                Container contentPane = this.getContentPane();
72                contentPane.setLayout(new BorderLayout());
73                contentPane.add(scrollPane, BorderLayout.CENTER);
74                contentPane.add(panel, BorderLayout.SOUTH);
75                levelReporting = 0;
76        }
77
78        public void setLevelReporting(int level) {
79                levelReporting = level;
80        }
81
82        public void log(int level, String clazz, String function,
83                        String message) {
84                if (level >= levelReporting) {
85                        if (popUp && !this.isVisible())
86                                this.setVisible(true);
87                        LogManager.getLogger(ServerLogFrame.class).error(
88                                        "level " + level + " class " + clazz + " function "
89                                                        + function + " msg " + message);
90                        logText.append("[" + STR_[level] + "] " + clazz + "::"
91                                        + function + " - " + message + "\n");
92                }
93        }
94
95        /**
96         * Shows frame sets location relative to parent.
97         *
98         * @param parent Frame relative to which console window will be localized.
99         */
100        public void show(final JFrame parent) {
101                if (parent != null) {
102                        final Point parentLocation = parent.getLocation();
103                        final Point location = new Point(parentLocation.x + 20,
104                                        parentLocation.y + 20);
105                        this.setLocation(location);
106                }
107                this.setVisible(true);
108        }
109}
Note: See TracBrowser for help on using the repository browser.