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/params/ReflectionAccess.java

    r78 r84  
    44import java.lang.reflect.InvocationTargetException;
    55import java.lang.reflect.Modifier;
    6 import java.lang.reflect.Type;
    7 import java.util.List;
    86
    9 import com.framsticks.params.types.ListParam;
    107import org.apache.log4j.Logger;
     8
     9import com.framsticks.util.lang.Containers;
    1110
    1211
    1312/**
    1413 * The Class ReflectionAccess. Stores data in provided object using reflection.
    15  * 
     14 *
    1615 * @author Mateusz Jarus <name.surname@gmail.com> (please replace name and
    1716 *         surname with my personal data)
     
    2019 */
    2120public class ReflectionAccess extends SimpleAbstractAccess {
    22         private final static Logger LOGGER = Logger.getLogger(ReflectionAccess.class
    23                         .getName());
     21        private final static Logger log = Logger.getLogger(ReflectionAccess.class.getName());
    2422
    25 
    26     protected final Class reflectedClass;
     23        protected final Class<?> reflectedClass;
    2724        private Object object;
    2825
    29         public ReflectionAccess(Class reflectedClass, FramsClass framsClass) {
    30         this.reflectedClass = reflectedClass;
     26        public ReflectionAccess(Class<?> reflectedClass, FramsClass framsClass) {
     27                this.reflectedClass = reflectedClass;
    3128                setFramsClass(framsClass);
    3229        }
     
    3734
    3835        @Override
    39         public <T> T get(Param param, Class<T> type) {
     36        public <T> T get(ValueParam param, Class<T> type) {
    4037                if (object == null) {
    4138                        return null;
     
    5451                        } catch (InvocationTargetException e) {
    5552                                //e.printStackTrace();
    56             }
     53                        }
    5754
    5855                } catch (IllegalAccessException ex) {
    59                         LOGGER.warn("illegal access error occurred while trying to access returnedObject");
     56                        log.warn("illegal access error occurred while trying to access returnedObject");
    6057                        ex.printStackTrace();
    61         } catch (ClassCastException ignored) {
     58                } catch (ClassCastException ignored) {
    6259
    63         }
     60                }
    6461                return null;
    6562        }
    6663
    6764        @Override
    68         protected <T> void internalSet(Param param, T value) {
     65        protected <T> void internalSet(ValueParam param, T value) {
    6966                setValue(param, value);
    7067        }
    7168
    72         private <T> void setValue(Param param, T value) {
     69        private <T> void setValue(ValueParam param, T value) {
    7370                if (object == null) {
    7471                        return;
    75         }
     72                }
    7673                try {
    7774                        String id = param.getId();
    7875                        try {
    7976                                Field f = reflectedClass.getField(id);
    80                                 Class t = f.getType();
     77                                Class<?> t = f.getType();
    8178                                if (Modifier.isFinal(f.getModifiers())) {
    8279                                        return;
     
    111108
    112109                try {
    113                         for (Param p : framsClass.getParamEntries()) {
     110                        for (ValueParam p : Containers.filterInstanceof(framsClass.getParamEntries(), ValueParam.class)) {
    114111                                setValue(p, p.getDef(Object.class));
    115112                        }
     
    121118        /**
    122119         * Sets the new object to operate on.
    123          * 
     120         *
    124121         * @param object
    125122         *            new object to operate on
    126123         */
    127124        @Override
    128         public void select(Object object) {
     125        public ReflectionAccess select(Object object) {
    129126                assert object == null || reflectedClass.isInstance(object);
    130127                this.object = object;
     128                return this;
    131129        }
    132130
     
    159157        }
    160158
    161     @Override
    162     public Object createAccessee() {
    163         try {
    164             return reflectedClass.newInstance();
    165         } catch (InstantiationException e) {
    166             e.printStackTrace();
    167         } catch (IllegalAccessException e) {
    168             e.printStackTrace();
    169         }
    170         LOGGER.fatal("failed to create reflected object of class " + reflectedClass.getCanonicalName() + " for frams type " + framsClass.getId());
    171         return null;
    172     }
     159        @Override
     160        public Object createAccessee() {
     161                try {
     162                        return reflectedClass.newInstance();
     163                } catch (InstantiationException e) {
     164                        e.printStackTrace();
     165                } catch (IllegalAccessException e) {
     166                        e.printStackTrace();
     167                }
     168                log.fatal("failed to create reflected object of class " + reflectedClass.getCanonicalName() + " for frams type " + framsClass.getId());
     169                return null;
     170        }
    173171}
Note: See TracChangeset for help on using the changeset viewer.