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/communication/Connection.java

    r77 r84  
    11package com.framsticks.communication;
    22
    3 import com.framsticks.util.Pair;
     3import com.framsticks.util.lang.Pair;
    44import org.apache.log4j.Logger;
    55import java.io.BufferedReader;
     
    1515public abstract class Connection {
    1616
    17         protected final static Logger LOGGER = Logger.getLogger(Connection.class);
     17        protected final static Logger log = Logger.getLogger(Connection.class);
    1818
    1919        protected PrintWriter output = null;
     
    2828        protected int protocolVersion = -1;
    2929
    30         protected final com.framsticks.util.Thread senderThread = new com.framsticks.util.Thread();
     30        protected final com.framsticks.util.dispatching.Thread senderThread = new com.framsticks.util.dispatching.Thread();
    3131        protected Thread receiverThread;
    3232
     
    4040                        connected = false;
    4141
    42             senderThread.interrupt();
    43             senderThread.join();
     42                        senderThread.interrupt();
     43                        senderThread.join();
    4444                        if (receiverThread != null) {
    4545                                receiverThread.interrupt();
     
    6464                        }
    6565
    66                         LOGGER.info("connection closed");
     66                        log.info("connection closed");
    6767                } catch (Exception e) {
    68                         LOGGER.error(e);
     68                        log.error(e);
    6969                }
    7070
     
    7777
    7878
    79     protected final Pair<Integer, String> parseRest(String rest) {
    80         Matcher matcher = (requestIdEnabled ? requestIdEnabledPattern : requestIDisabledPattern).matcher(rest);
    81         if (!matcher.matches()) {
    82             LOGGER.fatal("unmatched first line of input: " + rest);
    83             return null;
    84         }
    85         return new Pair<Integer, String>(requestIdEnabled ? Integer.parseInt(matcher.group(1)) : null, matcher.group(requestIdEnabled ? 2 : 1));
    86     }
     79        protected final Pair<Integer, String> parseRest(String rest) {
     80                Matcher matcher = (requestIdEnabled ? requestIdEnabledPattern : requestIDisabledPattern).matcher(rest);
     81                if (!matcher.matches()) {
     82                        log.fatal("unmatched first line of input: " + rest);
     83                        return null;
     84                }
     85                return new Pair<Integer, String>(requestIdEnabled ? Integer.parseInt(matcher.group(1)) : null, matcher.group(requestIdEnabled ? 2 : 1));
     86        }
    8787
    88     static final int BUFFER_LENGTH = 1024;
     88        static final int BUFFER_LENGTH = 1024;
    8989
    90     int readChars = 0;
    91     int iterator = 0;
    92     int bufferStart = 0;
    93     char[] readBuffer = new char[BUFFER_LENGTH];
     90        int readChars = 0;
     91        int iterator = 0;
     92        int bufferStart = 0;
     93        char[] readBuffer = new char[BUFFER_LENGTH];
    9494
    95     protected String getLine() throws Exception {
    96         StringBuilder lineBuffer = new StringBuilder();
    97         while (!Thread.interrupted()) {
    98             while (iterator < readChars) {
    99                 if (readBuffer[iterator] != '\n') {
    100                     ++iterator;
    101                     continue;
    102                 }
    103                 lineBuffer.append(readBuffer, bufferStart, iterator - bufferStart + 1);
    104                 ++iterator;
    105                 bufferStart = iterator;
    106                 return lineBuffer.toString();
    107             }
    108             lineBuffer.append(readBuffer, bufferStart, readChars - bufferStart);
     95        protected String getLine() throws Exception {
     96                StringBuilder lineBuffer = new StringBuilder();
     97                while (!Thread.interrupted()) {
     98                        while (iterator < readChars) {
     99                                if (readBuffer[iterator] != '\n') {
     100                                        ++iterator;
     101                                        continue;
     102                                }
     103                                lineBuffer.append(readBuffer, bufferStart, iterator - bufferStart + 1);
     104                                ++iterator;
     105                                bufferStart = iterator;
     106                                return lineBuffer.toString();
     107                        }
     108                        lineBuffer.append(readBuffer, bufferStart, readChars - bufferStart);
    109109
    110             readChars = 0;
    111             while (readChars == 0) {
    112                 try {
    113                     readChars = input.read(readBuffer);
    114                 } catch (SocketTimeoutException ignored) {
    115                     //timeout - continue
    116                 }
    117             }
    118             iterator = 0;
    119             bufferStart = 0;
    120         }
    121         throw new InterruptedException();
    122     }
     110                        readChars = 0;
     111                        while (readChars == 0) {
     112                                try {
     113                                        readChars = input.read(readBuffer);
     114                                } catch (SocketTimeoutException ignored) {
     115                                        //timeout - continue
     116                                }
     117                        }
     118                        iterator = 0;
     119                        bufferStart = 0;
     120                }
     121                throw new InterruptedException();
     122        }
    123123
    124     protected abstract void receiverThreadRoutine() throws Exception;
     124        protected abstract void receiverThreadRoutine() throws Exception;
    125125
    126     protected void runThreads() {
    127         try {
    128             output = new PrintWriter(socket.getOutputStream(), true);
    129             input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    130         } catch (IOException e) {
    131             LOGGER.error("buffer creation failure");
    132             close();
    133             return;
    134         }
     126        protected void runThreads() {
     127                try {
     128                        output = new PrintWriter(socket.getOutputStream(), true);
     129                        input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
     130                } catch (IOException e) {
     131                        log.error("buffer creation failure");
     132                        close();
     133                        return;
     134                }
    135135
    136         senderThread.setName(this + "-sender");
    137         receiverThread = new Thread(new Runnable() {
    138             @Override
    139             public void run() {
    140                 try {
    141                     receiverThreadRoutine();
    142                 } catch (InterruptedException ignored) {
    143                     LOGGER.debug("receiver thread interrupted");
    144                 } catch (Exception e) {
    145                     LOGGER.error("error: " + e);
    146                     close();
    147                 }
    148             }
    149         });
    150         receiverThread.setName(this + "-receiver");
     136                senderThread.setName(this + "-sender");
     137                receiverThread = new Thread(new Runnable() {
     138                        @Override
     139                        public void run() {
     140                                try {
     141                                        receiverThreadRoutine();
     142                                } catch (InterruptedException ignored) {
     143                                        log.debug("receiver thread interrupted");
     144                                } catch (Exception e) {
     145                                        log.error("error: " + e);
     146                                        close();
     147                                }
     148                        }
     149                });
     150                receiverThread.setName(this + "-receiver");
    151151
    152         senderThread.start();
    153         receiverThread.start();
    154     }
     152                senderThread.start();
     153                receiverThread.start();
     154        }
    155155
    156156
Note: See TracChangeset for help on using the changeset viewer.