Changeset 96 for java/main/src/main/java/com/framsticks/gui/TreeNode.java
- Timestamp:
- 07/04/13 20:29:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/gui/TreeNode.java
r90 r96 5 5 import com.framsticks.communication.util.LoggingStateCallback; 6 6 import com.framsticks.core.Instance; 7 import com.framsticks.core.InstanceUtils; 7 8 import com.framsticks.core.ListChange; 8 9 import com.framsticks.core.Path; … … 15 16 import com.framsticks.remote.*; 16 17 import com.framsticks.util.lang.Casting; 18 import com.framsticks.util.lang.Holder; 17 19 import com.framsticks.util.swing.TooltipConstructor; 18 20 import com.framsticks.util.dispatching.Future; 21 import com.framsticks.util.AbstractStateFunctor; 19 22 import com.framsticks.util.Logging; 20 import com.framsticks.util.StateFunctor;21 23 import org.apache.log4j.Logger; 22 24 import com.framsticks.util.dispatching.RunAt; … … 29 31 import static com.framsticks.util.lang.Containers.filterInstanceof; 30 32 import com.framsticks.util.swing.TreeNodeUtils; 33 import static com.framsticks.core.InstanceUtils.*; 31 34 32 35 /** … … 73 76 assert p.getInstance().isActive(); 74 77 log.debug("fetching: " + p); 75 p.getInstance().fetchValues(p, new StateFunctor() { 76 @Override 77 public void call(Exception e) { 78 //TODO removing should stay here 78 p.getInstance().fetchValues(p, new AbstractStateFunctor() { 79 @Override 80 public void call() { 79 81 // reactForFetchResult(p, e); 80 82 } … … 140 142 assert p.getInstance().isActive(); 141 143 log.debug("updating children of " + this); 142 AccessInterface access = p.getInstance().bindAccess(p.getTop());144 AccessInterface access = InstanceUtils.bindAccess(p.getInstance(), p.getTop()); 143 145 if (access == null) { 144 146 return; … … 199 201 return; 200 202 } 201 p.getInstance().resolve(updated, new Future<Path>( ) {203 p.getInstance().resolve(updated, new Future<Path>(Logging.logger(log, "resolve and select", TreeNode.this)) { 202 204 @Override 203 public void result(final Path result, Exception e) { 204 if (Logging.log(log, "resolve and select", TreeNode.this, e)) { 205 return; 206 } 207 205 protected void result(Path result) { 208 206 fetch(result); 209 207 postUpdatePath(result); … … 231 229 return; 232 230 } 233 AccessInterface access = p.getInstance().bindAccess(p); 234 if (access == null) { 235 return; 236 } 231 AccessInterface access = InstanceUtils.bindAccess(p); 237 232 238 233 final String tooltip = new TooltipConstructor() … … 309 304 @Override 310 305 public void run() { 311 AccessInterface access = p.getInstance().bindAccess(p);306 AccessInterface access = InstanceUtils.bindAccess(p); 312 307 panel.pullValuesFromLocalToUser(access); 313 308 … … 501 496 return; 502 497 } 503 finalMap<ValueControl, Object> changes = localChanges;498 Map<ValueControl, Object> changes = localChanges; 504 499 localChanges = null; 505 instanceAtFrame.getInstance().dispatch(new RunAt<Instance>() { 506 @Override 507 public void run() { 508 for (Map.Entry<ValueControl, Object> e : changes.entrySet()) { 509 final ValueControl key = e.getKey(); 510 final Path p = path; 511 instanceAtFrame.getInstance().storeValue(p, e.getKey().getParam(), e.getValue(), new StateFunctor() { 500 final Holder<Integer> counter = new Holder<>(changes.size()); 501 final Path p = path; 502 503 for (Map.Entry<ValueControl, Object> e : localChanges.entrySet()) { 504 storeValue(p, e.getKey().getParam(), e.getValue(), new AbstractStateFunctor() { 505 @Override 506 public void call() { 507 counter.set(counter.get() - 1); 508 if (counter.get() != 0) { 509 return; 510 } 511 log.debug("applied changes for: " + p); 512 frame.dispatch(new RunAt<Frame>() { 512 513 @Override 513 public void call(Exception e) { 514 changes.remove(key); 515 if (!changes.isEmpty()) { 516 return; 517 } 518 log.debug("applied changes for: " + p); 519 frame.dispatch(new RunAt<Frame>() { 520 @Override 521 public void run() { 522 fillPanelWithValues(); 523 } 524 }); 514 public void run() { 515 fillPanelWithValues(); 525 516 } 526 517 }); 527 518 } 528 } 529 } );519 }); 520 } 530 521 } 531 522 }
Note: See TracChangeset
for help on using the changeset viewer.