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/dumping/SaveStream.java

    r78 r84  
    44import com.framsticks.core.Path;
    55import com.framsticks.params.AccessInterface;
     6import com.framsticks.params.CompositeParam;
    67import com.framsticks.params.FramsClass;
    78import com.framsticks.params.ListAccess;
    8 import com.framsticks.params.Param;
    9 import com.framsticks.params.types.CompositeParam;
    109import com.framsticks.params.SinkInterface;
    1110import com.framsticks.parsers.Savers;
    1211import com.framsticks.core.Instance;
    1312import com.framsticks.util.*;
     13import com.framsticks.util.dispatching.Dispatching;
    1414import org.apache.log4j.Logger;
    1515
    1616import java.util.HashSet;
    1717import java.util.Set;
     18import static com.framsticks.util.lang.Containers.filterInstanceof;
    1819
    1920/**
     
    2223public class SaveStream {
    2324
    24     private final static Logger LOGGER = Logger.getLogger(SaveStream.class.getName());
     25        private final static Logger log = Logger.getLogger(SaveStream.class.getName());
    2526
    26     protected final SinkInterface sink;
    27     protected final Instance instance;
    28     protected final StateFunctor stateFunctor;
    29     protected final Stopwatch stopwatch = new Stopwatch();
    30     protected final Set<FramsClass> storedInfo = new HashSet<FramsClass>();
     27        protected final SinkInterface sink;
     28        protected final Instance instance;
     29        protected final StateFunctor stateFunctor;
     30        protected final Stopwatch stopwatch = new Stopwatch();
     31        protected final Set<FramsClass> storedInfo = new HashSet<FramsClass>();
    3132
    32     private int dispatched = 0;
     33        private int dispatched = 0;
    3334
    34     public SaveStream(SinkInterface sink, Instance instance, Path root, StateFunctor stateFunctor) {
    35         assert Dispatching.isThreadSafe();
    36         this.sink = sink;
    37         this.instance = instance;
    38         this.stateFunctor = stateFunctor;
     35        public SaveStream(SinkInterface sink, Instance instance, Path root, StateFunctor stateFunctor) {
     36                assert Dispatching.isThreadSafe();
     37                this.sink = sink;
     38                this.instance = instance;
     39                this.stateFunctor = stateFunctor;
    3940                dispatchWrite(root);
    40     }
     41        }
    4142
    4243        protected void dispatchWrite(final Path path) {
     
    5051        }
    5152
    52     protected void finished() {
    53         assert instance.isActive();
    54         LOGGER.info("stored in " + stopwatch);
    55         stateFunctor.call(null);
    56     }
     53        protected void finished() {
     54                assert instance.isActive();
     55                log.info("stored in " + stopwatch);
     56                stateFunctor.call(null);
     57        }
    5758
    58     public void write(final Path path) {
    59         assert instance.isActive();
    60         if (!path.isResolved()) {
    61             LOGGER.debug("path " + path + " is not resolved - skipping");
    62         } else {
    63             AccessInterface access = instance.bindAccess(path);
     59        public void write(final Path path) {
     60                assert instance.isActive();
     61                if (!path.isResolved()) {
     62                        log.debug("path " + path + " is not resolved - skipping");
     63                } else {
     64                        AccessInterface access = instance.bindAccess(path);
    6465                        assert access != null;
    65             FramsClass framsClass = access.getFramsClass();
    66             assert framsClass != null;
    67             if (!storedInfo.contains(framsClass)) {
    68                 storedInfo.add(framsClass);
    69                 sink.print("info ").print(path.getTextual()).breakLine();
    70                 sink.print("file").breakLine();
    71                 Savers.saveFramsClass(sink, framsClass);
    72                 sink.print("eof").breakLine();
    73                 sink.print("ok").breakLine();
    74             }
    75             if (!(access instanceof ListAccess)) {
    76                 sink.print("get ").print(path.getTextual()).breakLine();
    77                 sink.print("file").breakLine();
    78                 //stream.print("#" + access.getSelected().getClass().getCanonicalName() + "\n");
    79                 access.save(sink);
    80                 sink.print("eof").breakLine();
    81                 sink.print("ok").breakLine();
    82             }
    83             for (Param p : access.getParams()) {
    84                 if (p instanceof CompositeParam) {
    85                     CompositeParam childParam = (CompositeParam)p;
    86                     final Path childPath = path.appendNode(new Node(childParam, access.get(childParam, Object.class)));
    87                     if (childPath.isResolved() && instance.getInfoFromCache(childPath) != null) {
    88                                                 dispatchWrite(childPath);
    89                     }
    90                 }
    91             }
    92         }
    93         --dispatched;
    94         if (dispatched == 0) {
    95             finished();
    96         }
    97     }
     66                        FramsClass framsClass = access.getFramsClass();
     67                        assert framsClass != null;
     68                        if (!storedInfo.contains(framsClass)) {
     69                                storedInfo.add(framsClass);
     70                                sink.print("info ").print(path.getTextual()).breakLine();
     71                                sink.print("file").breakLine();
     72                                Savers.saveFramsClass(sink, framsClass);
     73                                sink.print("eof").breakLine();
     74                                sink.print("ok").breakLine();
     75                        }
     76                        if (!(access instanceof ListAccess)) {
     77                                sink.print("get ").print(path.getTextual()).breakLine();
     78                                sink.print("file").breakLine();
     79                                //stream.print("#" + access.getSelected().getClass().getCanonicalName() + "\n");
     80                                access.save(sink);
     81                                sink.print("eof").breakLine();
     82                                sink.print("ok").breakLine();
     83                        }
     84                        for (CompositeParam p : filterInstanceof(access.getParams(), CompositeParam.class)) {
     85                                final Path childPath = path.appendNode(new Node(p, access.get(p, Object.class)));
     86                                if (childPath.isResolved() && instance.getInfoFromCache(childPath) != null) {
     87                                        dispatchWrite(childPath);
     88                                }
     89                        }
     90                }
     91                --dispatched;
     92                if (dispatched == 0) {
     93                        finished();
     94                }
     95        }
    9896}
Note: See TracChangeset for help on using the changeset viewer.