Ignore:
Timestamp:
07/14/13 23:20:04 (11 years ago)
Author:
psniegowski
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/gui/ObjectPanel.java

    r100 r101  
    55import com.framsticks.gui.controls.ControlOwner;
    66import com.framsticks.gui.controls.ValueControl;
    7 import com.framsticks.gui.controls.ValueControlListener;
    87import com.framsticks.params.Access;
    98import com.framsticks.params.Param;
    10 import com.framsticks.params.ValueParam;
    119
    1210import org.apache.logging.log4j.Logger;
     
    1614
    1715import java.util.Collection;
    18 import java.util.IdentityHashMap;
     16import java.util.HashMap;
    1917import java.util.Map;
    2018import static com.framsticks.util.lang.Containers.filterInstanceof;
    2119
    2220import com.framsticks.util.FramsticksException;
     21
     22import static com.framsticks.core.TreeOperations.*;
    2323
    2424@SuppressWarnings("serial")
     
    2727        private static final Logger log = LogManager.getLogger(ObjectPanel.class);
    2828
    29         final protected Map<Param, Control> components = new IdentityHashMap<Param, Control>();
    30         final protected Map<ValueParam, ValueControl> valueControls = new IdentityHashMap<ValueParam, ValueControl>();
     29        final protected Map<String, Control> controls = new HashMap<String, Control>();
     30        final protected Map<String, ValueControl> valueControls = new HashMap<String, ValueControl>();
    3131
    3232        protected final JPanel contentPanel;
     
    3838                contentPanel = new JPanel();
    3939                scrollPane = new JScrollPane(contentPanel);
    40                 contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
     40
    4141                setupContentComponent(scrollPane);
    4242
    43                 Gui.fillWithControls(this, params, components, Control.class);
     43                Gui.fillWithControls(this, contentPanel, params, controls, Control.class);
    4444                setName(framsClass.getId());
    4545
    46                 for (final ValueControl c : filterInstanceof(components.values(), ValueControl.class)) {
    47                         valueControls.put(c.getParam(), c);
     46                for (final ValueControl c : filterInstanceof(controls.values(), ValueControl.class)) {
     47                        valueControls.put(c.getParam().getId(), c);
    4848                        c.setUserEnabled(true);
    49                         c.setListener(new ValueControlListener() {
    50                                 @Override
    51                                 public boolean onChange(Object newValue) {
    52                                         if (currentPath == null) {
    53                                                 return true;
    54                                         }
    55                                         boolean result = treeAtFrame.changeValue(currentPath.assureResolved().getTopObject(), c, newValue);
    56                                         refreshControlButtons();
    57                                         return result;
    58                                 }
    59                         });
    6049                }
    6150
     
    6857                assert frame.isActive();
    6958                assert currentPath != null;
    70                 treeAtFrame.pushLocalChanges(currentPath);
     59                treeAtFrame.pushUserChangesToTree(currentPath);
     60                refreshControlButtons();
    7161        }
    7262
    73         protected void refreshControlButtons() {
    74                 assert frame.isActive();
    75                 applyButton.setEnabled(treeAtFrame.hasLocalChanges(currentPath.getTopObject()));
     63
     64        @Override
     65        protected void revertChanges() {
     66                assert currentPath != null;
     67                removeSideNote(currentPath, treeAtFrame.getUserChangesKey());
     68                pullValuesFromLocalToUser(bindAccess(currentPath));
    7669        }
    7770
     
    8174                log.debug("refreshing components");
    8275
    83                 final Map<ValueControl, Object> values = new IdentityHashMap<ValueControl, Object>();
    84                 for (Map.Entry<ValueParam, ValueControl> e : valueControls.entrySet()) {
    85                         values.put(e.getValue(), access.get(e.getKey().getId(), Object.class));
     76                UserChanges userChanges = getSideNote(currentPath, treeAtFrame.getUserChangesKey());
     77
     78
     79                for (Map.Entry<String, ValueControl> e : valueControls.entrySet()) {
     80                        String id = e.getKey();
     81                        Object value;
     82                        if (userChanges != null && userChanges.changes.containsKey(id)) {
     83                                value = userChanges.changes.get(id);
     84                        } else {
     85                                value = access.get(id, Object.class);
     86                        }
     87
     88                        e.getValue().pushValueToUserInterface(value);
    8689                }
    8790
    88 
    89                 NodeAtFrame nodeAtFrame = treeAtFrame.getLocalInfo(currentPath.getTopObject());
    90                 if (nodeAtFrame != null) {
    91                         for (Map.Entry<ValueControl, Object> e : nodeAtFrame.localChanges.entrySet()) {
    92                                 values.put(e.getKey(), e.getValue());
    93                         }
     91                for (Map.Entry<String, Control> e : controls.entrySet()) {
     92                        e.getValue().refreshState();
    9493                }
    9594
    96                 for (Map.Entry<ValueControl, Object> e : values.entrySet()) {
    97                         e.getKey().pushValueToUserInterface(e.getValue());
    98                 }
    9995                refreshControlButtons();
    100                 ObjectPanel.this.revalidate();
    101 
     96                // ObjectPanel.this.revalidate();
    10297        }
    10398
     
    105100        public String getTitle() {
    106101                return "Properties";
    107         }
    108 
    109         @Override
    110         public JPanel getPanelForControls() {
    111                 return contentPanel;
    112102        }
    113103
     
    122112        }
    123113
     114        @Override
     115        public boolean onValueChange(ValueControl control, Object newValue) {
     116                if (currentPath == null) {
     117                        return true;
     118                }
     119                boolean result = treeAtFrame.changeValue(currentPath.assureResolved().getTopObject(), control, newValue);
     120                refreshControlButtons();
     121                return result;
     122        }
     123
    124124}
Note: See TracChangeset for help on using the changeset viewer.