source: java/main/src/main/java/com/framsticks/gui/table/ListPanel.java @ 101

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

HIGHLIGHTS:

  • improve tree side notes
  • improve GUI layout
  • add foldable list of occured events to EventControl?
  • improve automatic type conversion in proxy listeners
  • implement several Access functionalities as algorithms independent of Access type
  • introduce draft base classes for distributed experiments
  • automatically register dependant Java classes to FramsClass? registry
  • add testing prime experiment and configuration
  • simplify and improve task dispatching

CHANGELOG:
Improve task dispatching in RemoteTree?.

GUI no longer hangs on connection problems.

Make all dispatchers joinables.

Refactorize Thread dispatcher.

Remove Task and PeriodicTask?.

Use Java utilities in those situations.

Reworking tasks dispatching.

Fix bug in EventControl? listener dispatching.

Minor improvements.

Add testing configuration for ExternalProcess? in GUI.

More improvement to prime.

Support for USERREADONLY in GUI.

Add that flag to various params in Java classes.

Remove redundant register clauses from several FramsClassAnnotations?.

Automatically gather and register dependant classes.

Add configuration for prime.

Improve Simulator class.

Add prime.xml configuration.

Introduce draft Experiment and Simulator classes.

Add prime experiment tests.

Enclose typical map with listeners into SimpleUniqueList?.

Needfile works in GUI.

Improve needfile handling in Browser.

More improvement with NeedFile?.

Implementing needfile.

Update test.

Rename ChangeEvent? to TestChangeEvent?.

Automatic argument type search in RemoteTree? listeners.

MultiParamLoader? uses AccessProvider?. By default old implementation
enclosed in AccessStash? or Registry.

Minor changes.

Rename SourceInterface? to Source.

Also improve toString of File and ListSource?.

Remove unused SimpleSource? class.

Add clearing in HistoryControl?.

Show entries in table at EventControl?.

Improve EventControl?.

Add listeners registration to EventControl?.

Add foldable table to HistoryControl?.

Add control row to Procedure and Event controls.

Improve layout of controls.

Another minor change to gui layout.

Minor improvement in the SliderControl?.

Minor changes.

Move ReflectionAccess?.Backend to separate file.

It was to cluttered.

Cleanup in ReflectionAccess?.

Move setMin, setMax, setDef to AccessOperations?.

Extract loading operation into AccessOperations?.

Append Framsticks to name of UnsupportedOperationException?.

The java.lang.UnsupportedOperationException? was shadowing this class.

Rename params.Util to params.ParamsUtil?.

Several improvements.

Minor changes.

Implement revert functionality.

Improve local changes management.

Minor improvement.

Remove methods rendered superfluous after SideNoteKey? improvement.

Improve SideNoteKey?.

It is now generic type, so explicit type specification at
call site is no more needed.

Introduce SideNoteKey? interface.

Only Objects implementing that key may be used as side note keys.

Minor improvements.

Use strings instead of ValueControls? in several gui mappings.

File size: 2.5 KB
Line 
1package com.framsticks.gui.table;
2
3
4import com.framsticks.gui.ModifiablePanel;
5import com.framsticks.params.Access;
6import com.framsticks.params.ListAccess;
7import com.framsticks.params.Param;
8import com.framsticks.util.FramsticksException;
9import com.framsticks.util.lang.Casting;
10
11import org.apache.logging.log4j.Logger;
12import org.apache.logging.log4j.LogManager;
13
14import javax.swing.*;
15
16/**
17 * Panel contains table and allows to manages displaying columns.
18 */
19@SuppressWarnings("serial")
20public class ListPanel extends ModifiablePanel {
21
22        private static final Logger log = LogManager.getLogger(ListPanel.class.getName());
23
24        protected final TableModel tableModel;
25        protected final JTable table;
26        protected final JScrollPane scrollPane;
27
28        public ListPanel(Parameters parameters, ListPanelProvider provider) {
29                super(parameters);
30
31                final ColumnsConfig config = provider.getColumnsConfigs().get(framsClass.getName());
32                log.debug("creating ListPanel for {} using config {}", parameters.framsClass, config);
33
34                tableModel = new TableModel(this);
35                if (config != null) {
36                        for (String id : config.getColumnsNames()) {
37                                Param param = framsClass.getParam(id);
38                                if (param == null) {
39                                        throw new FramsticksException().msg("requested param not found in frams class").arg("param", id).arg("frams class", framsClass);
40                                }
41                                if (!tableModel.addColumnIfSupported(param)) {
42                                        throw new FramsticksException().msg("param is not supported in table view").arg("param", param).arg("frams class", framsClass);
43                                }
44                        }
45                } else {
46                        for (Param param : framsClass.getParamEntries()) {
47                                if (provider.getMaximumColumnNumber() != null && tableModel.getColumnCount() >= provider.getMaximumColumnNumber()) {
48                                        break;
49                                }
50                                tableModel.addColumnIfSupported(param);
51                        }
52                }
53
54                table = new JTable(tableModel);
55                tableModel.setupTable();
56                table.setShowGrid(false);
57
58                scrollPane = new JScrollPane(table);
59                setupContentComponent(scrollPane);
60
61                table.getTableHeader().setReorderingAllowed(false);
62                table.setColumnSelectionAllowed(false);
63                table.setCellSelectionEnabled(false);
64                table.setColumnSelectionAllowed(false);
65
66                this.revalidate();
67        }
68
69
70        @Override
71        protected void applyChanges() {
72        }
73
74        @Override
75        protected void revertChanges() {
76        }
77
78        @Override
79        public void pullValuesFromLocalToUser(Access access) {
80                tableModel.attachSource(Casting.throwCast(ListAccess.class, access));
81                refreshControlButtons();
82        }
83
84        @Override
85        public String getTitle() {
86                return "List";
87        }
88
89        /**
90         * @return the table
91         */
92        public JTable getTable() {
93                return table;
94        }
95
96}
Note: See TracBrowser for help on using the repository browser.