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

HIGHLIGHTS:

CHANGELOG:
Get data also on tree expansion.

Use nice framstick icon for empty nodes.

Update panel after reload if it is current.

Add shallow reload procedure.

Cut Gui prefix from several tree classes.

Bring back counter of GuiTreeNode?.

Use IdentityHashMap? were it is more appriopriate.

Remove TreeListener?.

Do not use TreeListener? in GUI.

Minor change.

Done migration to GuiTreeModel?.

BrowserTest? in that version always crashes frams.linux.

Move rendering implementation into GuiAbstractNode?.

Use hand-crafted list in GuiTreeNode?.

Generally, it would be a great place for WeakIdentityHashMap?
(but there is none in Java Collection Framework).

Remove superfluous logging.

Fix bug in GuiTreeNode?.

Use IdentityHashMap? instead of HashMap?.

Improve structure update.

Filter out invalid uids in UniqueListAccess?.

Improve TreeCellRenderer?.

Add filtering in TrackConsole?.

Improve TreeModel?.

More changes.

More improvements.

More changes.

Remove TreeNode?.

Support MetaNode? in the GuiTreeModel?.

Implement more in GuiTreeModel?.

Add CompositeParam? interface to FramsClass? and AccessInterface?.

Allow access by number to UniqueList?.

Add UidComparator?.

Use TreeMap? as a default accessee in unique list.

It keeps order of keys.

Introduce classes to use with new TreeModel?.

Another step.

Migrate from TreeNode? to Node in many places.

Remove some uses of TreeNode? as DefaultMutableTreeNode?.

Remove Path from TreeNode? interface.

Remove Path from TreeNode?.

Add Path recration from node feature.

Reworking TreeCellRenderer?.

Minor change of TreeOperations? interface.

Remove last methods from TreeNode?.

Another minor step.

Do not store reference to TreeAtFrame? in TreeNode?.

Add proxy exceptionHandler to StatusBar?.

Move panels management to TreeAtFrame?.

Store localChanges in the NodeAtFrame?.

More cleanup.

Move name computing to TreeCellRenderer?.

Move tooltip and icon computations to TreeCellRenderer?.

More dispatches removed.

Remove most dispatching from TreeNode?.

TreeNode? does not actually redispatch tasks.

Make Tree embedded in Browser use SwingDispatcher?.

Make lazy binding of Tree with Dispatcher.

Minor changes.

Organizational change in AbstractTree?.

Make AbstractTree? compose from Thread instead of inherit from it.

Make SwingDispatcher? and AtOnceDispatcher? Joinable compatible.

Add ListPanelProvider?.

Improve Controls readonly and enabled handling.

Properly pass ExceptionHandlers? in more places.

Make Tree.get accept ValueParam?.

  • This is to allow access number of list elements.

Remove not needed get redirection in ClientAtServer?.

Rename tryResolve to tryGet.

Unify tryResolveAndGet into tryResolve.

Remove resolveTop from Tree interface.

Make Tree.get accept Future<Path>.

Use get to implement resolveTop also in ObjectTree?.

Unify resolveTop and get in RemoteTree?.

Another minor step.

More minor changes in tree operations.

Minor organizational changes.

In RemoteTree? first fetch info for root.

Reworking resolving.

Minor changes.

Make ListAccess? return proxy iterators (instead of creating temporary collection).

Let AccessInterface? return Iterable<Param>.

Improve resolving.

More improvements.

First working completion in ManagedConsole?.

Rename resolve to resolveTop.

This reflects the actuall functionality.

Change semantic of tryResolve and tryResolveAndGet.

File:
1 edited

Legend:

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

    r97 r98  
    1212
    1313import javax.swing.*;
     14import javax.swing.tree.TreePath;
    1415
    1516import java.util.Collection;
    16 import java.util.HashMap;
     17import java.util.IdentityHashMap;
    1718import java.util.Map;
    1819import static com.framsticks.util.lang.Containers.filterInstanceof;
    1920
    2021import com.framsticks.util.FramsticksException;
    21 import com.framsticks.util.dispatching.RunAt;
    2222
    2323@SuppressWarnings("serial")
    2424public class ObjectPanel extends ModifiablePanel implements ControlOwner {
    2525
    26         private static final Logger log = Logger.getLogger(ObjectPanel.class.getName());
     26        private static final Logger log = Logger.getLogger(ObjectPanel.class);
    2727
    28         final protected Map<Param, Control> components = new HashMap<Param, Control>();
    29         final protected Map<ValueParam, ValueControl> valueControls = new HashMap<ValueParam, ValueControl>();
     28        final protected Map<Param, Control> components = new IdentityHashMap<Param, Control>();
     29        final protected Map<ValueParam, ValueControl> valueControls = new IdentityHashMap<ValueParam, ValueControl>();
    3030
    3131        public ObjectPanel(Panel.Parameters parameters, Collection<Param> params) {
     
    3737                for (final ValueControl c : filterInstanceof(components.values(), ValueControl.class)) {
    3838                        valueControls.put(c.getParam(), c);
     39                        c.setUserEnabled(true);
    3940                        c.setListener(new ValueControlListener() {
    4041                                @Override
    4142                                public boolean onChange(Object newValue) {
    42                                         if (currentTreeNode == null) {
     43                                        if (currentTreePath == null) {
    4344                                                return true;
    4445                                        }
    45                                         boolean result = currentTreeNode.changeValue(c, newValue);
     46                                        boolean result = treeAtFrame.changeValue(currentTreePath, c, newValue);
    4647                                        refreshControlButtons();
    4748                                        return result;
     
    5758        protected void applyChanges() {
    5859                assert frame.isActive();
    59                 assert currentTreeNode != null;
    60                 currentTreeNode.pushLocalChanges();
     60                assert currentTreePath != null;
     61                treeAtFrame.pushLocalChanges(currentTreePath);
    6162        }
    6263
    6364        protected void refreshControlButtons() {
    6465                assert frame.isActive();
    65                 applyButton.setEnabled(currentTreeNode.localChanges != null);
     66                applyButton.setEnabled(treeAtFrame.hasLocalChanges(currentTreePath));
    6667        }
    6768
     
    7172        @Override
    7273        public void pullValuesFromLocalToUser(AccessInterface access) {
    73                 assert currentTreeNode != null;
    74                 assert currentTreeNode.path.getTree().isActive();
     74                assert currentTreePath != null;
    7575                log.debug("refreshing components");
    7676
    77                 final Map<ValueControl, Object> values = new HashMap<ValueControl, Object>();
     77                final Map<ValueControl, Object> values = new IdentityHashMap<ValueControl, Object>();
    7878                for (Map.Entry<ValueParam, ValueControl> e : valueControls.entrySet()) {
    7979                        values.put(e.getValue(), access.get(e.getKey().getId(), Object.class));
    8080                }
    8181
    82                 frame.dispatch(new RunAt<Frame>(frame) {
    83                         @Override
    84                         protected void runAt() {
    85                                 if (currentTreeNode.localChanges != null) {
    86                                         for (Map.Entry<ValueControl, Object> e : currentTreeNode.localChanges.entrySet()) {
    87                                                 values.put(e.getKey(), e.getValue());
    88                                         }
    89                                 }
    90                                 for (Map.Entry<ValueControl, Object> e : values.entrySet()) {
    91                                         e.getKey().pushValueToUserInterface(e.getValue());
    92                                 }
    93                                 refreshControlButtons();
    94                                 ObjectPanel.this.revalidate();
     82
     83                NodeAtFrame nodeAtFrame = treeAtFrame.getLocalInfo(currentTreePath);
     84                if (nodeAtFrame != null) {
     85                        for (Map.Entry<ValueControl, Object> e : nodeAtFrame.localChanges.entrySet()) {
     86                                values.put(e.getKey(), e.getValue());
    9587                        }
    96                 });
     88                }
     89
     90                for (Map.Entry<ValueControl, Object> e : values.entrySet()) {
     91                        e.getKey().pushValueToUserInterface(e.getValue());
     92                }
     93                refreshControlButtons();
     94                ObjectPanel.this.revalidate();
    9795
    9896        }
     
    109107
    110108        @Override
    111         public TreeNode getCurrentTreeNode() {
    112                 return super.getCurrentTreeNode();
    113         }
    114 
    115         @Override
    116109        public void handle(FramsticksException exception) {
    117110                frame.handle(exception);
    118111        }
    119112
    120         // public void updateValue() {
    121         //      //assert panel.getFrame().isActive();
     113        @Override
     114        public TreePath getCurrentTreePath() {
     115                return super.getCurrentTreePath();
     116        }
    122117
    123         //      final Node n = panel.getCurrentNode();
    124         //      panel.getBrowser().getManager().invokeLater(new Runnable() {
    125         //              @Override
    126         //              public void run() {
    127         //                      Object v = n.getAccess().get(param, Object.class);
    128         //                      if (v == null) {
    129         //                              v = param.getDef(Object.class);
    130         //                      }
    131         //                      final Object fv = v;
    132         //                      panel.getBrowser().invokeLater(new Runnable() {
    133         //                              @Override
    134         //                              public void run() {
    135         //                                      setValueImpl(fv);
    136         //                              }
    137         //                      });
    138         //              }
    139         //      });
    140         // }
    141118
    142119}
Note: See TracChangeset for help on using the changeset viewer.