Ignore:
Timestamp:
06/22/13 21:51:33 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • simplification of entities management model
  • cleanup around params (improve hierarchy)
  • migrate from JUnit to TestNG
  • introduce FEST to automatically test GUI
  • improve slider control
  • loosen synchronization between gui tree and backend representation
  • and many other bug fixes

NOTICE:

  • a great many of lines is changed only because of substituting spaces with tabs

CHANGELOG (oldest changes at the bottom):

Some cleaning after fix found.

Fix bug with tree.

More changes with TreeNodes?.

Finally fix issue with tree.

Improve gui tree management.

Decouple update of values from fetch request in gui.

Minor changes.

Minor changes.

Minor change.

Change Path construction wording.

More fixes to SliderControl?.

Fix SliderControl?.

Fix SliderControl?.

Minor improvement.

Several changes.

Make NumberParam? a generic class.

Add robot to the gui test.

Setup common testing logging configuration.

Remove Parameters class.

Remove entityOwner from Parameters.

Move name out from Parameters class.

Move configuration to after the construction.

Simplify observers and endpoints.

Remove superfluous configureEntity overrides.

Add dependency on fest-swing-testng.

Use FEST for final print test.

Use FEST for more concise and readable assertions.

Divide test of F0Parser into multiple methods.

Migrate to TestNG

Minor change.

Change convention from LOGGER to log.

Fix reporting of errors during controls filling.

Bound maximal height of SliderControl?.

Minor improvements.

Improve tooltips for controls.

Also use Delimeted in more places.

Move static control utilities to Gui.

Rename package gui.components to controls.

Some cleaning in controls.

Improve Param classes placing.

Move ValueParam?, PrimitiveParam? and CompositeParam? one package up.

Improve ParamBuilder?.

Move getDef to ValueParam? and PrimitiveParam?.

Move getMax and getDef to ValueParam?.

Move getMin to ValueParam?.

Upgrade to laters apache commons versions.

Use filterInstanceof extensively.

Add instanceof filters.

Make ValueParam? in many places of Param.

Place assertions about ValueParam?.

Add ValueParam?

Rename ValueParam? to PrimitiveParam?

Minor changes.

Several improvements to params types.

Add NumberParam?.

Add TextControl? component.

Add .swp files to .gitignore

Greatly improved slider component.

Some improvements.

Make Param.reassign return also a state.

Add IterableIterator?.

Several changes.

  • Move util classes to better packages.
  • Remove warnings from eclim.

Several improvements.

Fix bug with BooleanParam?.

Some experiments with visualization.

Another fix to panel management.

Improve panel management.

Some refactorization around panels.

Add root class for panel.

Location:
java/main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • java/main

    • Property svn:ignore set to
      target
  • java/main/src/main/java/com/framsticks/gui/Panel.java

    r77 r84  
    22
    33import com.framsticks.params.AccessInterface;
    4 import org.apache.log4j.Logger;
     4import com.framsticks.params.CompositeParam;
     5import com.framsticks.params.FramsClass;
     6// import org.apache.log4j.Logger;
    57
    68import javax.swing.*;
    7 import java.awt.*;
    8 import java.awt.event.ActionEvent;
    9 import java.awt.event.ActionListener;
    109
    1110/**
    12  * @author Piotr Sniegowski
     11 * Author: Piotr Śniegowski
    1312 */
     13@SuppressWarnings("serial")
    1414public abstract class Panel extends JPanel {
    1515
    16         private static final Logger LOGGER = Logger.getLogger(Panel.class.getName());
     16        public static class Parameters {
     17                public final EndpointAtFrame endpoint;
     18                public final CompositeParam param;
     19                public final FramsClass framsClass;
    1720
    18         /**
    19          * Pane to which components will be added.
    20          */
    21         protected JPanel contentPanel;
     21                public Parameters(EndpointAtFrame endpoint, CompositeParam param, FramsClass framsClass) {
     22                        this.endpoint = endpoint;
     23                        this.param = param;
     24                        this.framsClass = framsClass;
     25                }
     26        }
     27
     28        // private static final Logger log = Logger.getLogger(Panel.class.getName());
    2229
    2330        protected TreeNode currentTreeNode;
    24     protected EndpointAtFrame endpoint;
    25     protected final Frame frame;
     31        protected final EndpointAtFrame endpoint;
     32        protected final Frame frame;
    2633        protected final String className;
    27         final protected JLabel label;
    28         final protected JButton applyButton;
     34        protected final FramsClass framsClass;
     35        protected final CompositeParam param;
     36        protected String uniqueName = "?";
    2937
    30         public Panel(EndpointAtFrame endpoint, String className) {
    31         this.endpoint = endpoint;
    32                 this.frame = endpoint.getFrame();
    33                 this.className = className;
    34                 LOGGER.debug("create panel for type: " + className);
    35 
    36         endpoint.registerPanel(this);
    37 
    38                 contentPanel = new JPanel();
    39                 contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
    40                 JScrollPane scroll = new JScrollPane(contentPanel);
    41                 //scroll.setBorder(BorderFactory.createEtchedBorder());
    42 
    43                 JPanel pageEndPanel = new JPanel();
    44                 pageEndPanel.setLayout(new BoxLayout(pageEndPanel, BoxLayout.X_AXIS));
    45                 pageEndPanel.add(Box.createHorizontalGlue());
    46 
    47                 applyButton = new JButton("Apply");
    48                 applyButton.addActionListener(new ActionListener() {
    49                         public void actionPerformed(ActionEvent e) {
    50                                 applyChanges();
    51                         }
    52                 });
    53                 pageEndPanel.add(applyButton);
    54 
    55                 pageEndPanel.add(Box.createHorizontalStrut(10));
    56                 pageEndPanel.setPreferredSize(new Dimension(0, 30));
    57 
    58                 label = new JLabel();
    59                 JPanel centerPanel = new JPanel();
    60                 centerPanel.setLayout(new BorderLayout());
    61                 centerPanel.add(Box.createHorizontalStrut(10), BorderLayout.LINE_START);
    62                 centerPanel.add(Box.createHorizontalStrut(10), BorderLayout.LINE_END);
    63                 centerPanel.add(label, BorderLayout.PAGE_START);
    64                 centerPanel.add(scroll, BorderLayout.CENTER);
    65                 centerPanel.add(pageEndPanel, BorderLayout.PAGE_END);
    66 
    67                 this.setLayout(new BorderLayout());
    68                 this.add(centerPanel, BorderLayout.CENTER);
    69 
    70 
     38        public Panel(Parameters parameters) {
     39                this.endpoint = parameters.endpoint;
     40                this.frame = parameters.endpoint.getFrame();
     41                this.framsClass = parameters.framsClass;
     42                this.param = parameters.param;
     43                this.className = parameters.param.getContainedTypeName();
     44                this.setName(parameters.param.getFramsTypeName());
    7145        }
    7246
    73         public void setCurrentTreeNode(TreeNode node) {
    74                 currentTreeNode = node;
    75                 //label.setText(node.getNode().getPath());
    76                 //this.revalidate();
     47        public void setCurrentTreeNode(TreeNode currentTreeNode) {
     48                this.currentTreeNode = currentTreeNode;
    7749        }
    7850
     
    8153        }
    8254
    83         protected abstract void applyChanges();
    84         public abstract void refreshComponents(AccessInterface access);
     55        public final Frame getFrame() {
     56                return frame;
     57        }
     58
     59        public final EndpointAtFrame getEndpointAtFrame() {
     60                return endpoint;
     61        }
     62
     63
     64        public final String getClassName() {
     65                return className;
     66        }
     67
     68        public abstract void pullValuesFromLocalToUser(AccessInterface access);
    8569
    8670        @Override
    8771        public String toString() {
    88                 return currentTreeNode == null ? "?" : currentTreeNode.toString();
     72                return uniqueName;
    8973        }
    9074
    91     public final Frame getFrame() {
    92         return frame;
    93     }
     75        public final String getUniqueName() {
     76                return uniqueName;
     77        }
    9478
    95 
    96     public final String getClassName() {
    97         return className;
    98     }
    99 
    100     public final String getFullName() {
    101         return className + "@" + endpoint.getName();
    102     }
    103 
     79        public abstract String getTitle();
    10480}
Note: See TracChangeset for help on using the changeset viewer.