- Timestamp:
- 07/12/13 23:41:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/gui/controls/ProcedureControl.java
r99 r100 1 1 package com.framsticks.gui.controls; 2 2 3 import com.framsticks.core.Tree;4 3 import com.framsticks.core.Path; 5 4 import com.framsticks.gui.Frame; … … 10 9 import com.framsticks.util.dispatching.ExceptionResultHandler; 11 10 import com.framsticks.util.dispatching.FutureHandler; 12 import com.framsticks.util.dispatching.RunAt;13 11 import com.framsticks.util.dispatching.ThrowExceptionHandler; 12 import com.framsticks.util.swing.TooltipConstructor; 14 13 15 14 import javax.swing.*; 16 15 import javax.swing.border.BevelBorder; 17 import javax.swing.tree.TreePath;18 16 19 import org.apache.log4j.Logger; 17 import org.apache.logging.log4j.Logger; 18 import org.apache.logging.log4j.LogManager; 20 19 21 20 import java.awt.event.ActionEvent; … … 29 28 public class ProcedureControl extends Control implements ControlOwner { 30 29 31 private static final Logger log = Log ger.getLogger(ProcedureControl.class);30 private static final Logger log = LogManager.getLogger(ProcedureControl.class); 32 31 33 32 protected final JButton procedureButton; … … 37 36 public ProcedureControl(ProcedureParam procedureParam) { 38 37 super(procedureParam); 38 39 this.setToolTipText(new TooltipConstructor() 40 .append("name", procedureParam.getName()) 41 .append("id", procedureParam.getId()) 42 .append("help", procedureParam.getHelp()) 43 .build()); 39 44 40 45 procedureButton = new JButton("Call"); … … 56 61 public void actionPerformed(ActionEvent e) { 57 62 58 final Path path = get Frame().getTreeModel().convertToPath(getCurrentTreePath());63 final Path path = getCurrentPath(); 59 64 60 65 final List<Object> arguments = new LinkedList<Object>(); … … 62 67 Object value = components.get(arg).getCurrentValue(); 63 68 arguments.add(value); 64 log.debug("argument " + arg + ": " +value);69 log.debug("argument {}: {}", arg, value); 65 70 } 66 71 //TODO FEH: make it show dialog 67 final ExceptionResultHandler handler = ThrowExceptionHandler.getInstance();72 callProcedure(path, getParam(), arguments.toArray()); 68 73 69 path.getTree().dispatch(new RunAt<Tree>(handler) {70 @Override71 protected void runAt() {72 path.getTree().call(path, getParam(), arguments.toArray(), new FutureHandler<Object>(handler) {73 74 @Override75 public void result(Object result) {76 77 }78 });79 }80 });81 74 } 82 75 }); 83 76 this.add(procedureButton); 84 77 78 } 79 80 public static void callProcedure(final Path path, final ProcedureParam param, Object[] arguments) { 81 final ExceptionResultHandler handler = ThrowExceptionHandler.getInstance(); 82 83 assert path.getTree().isActive(); 84 85 path.getTree().call(path, param, arguments, new FutureHandler<Object>(handler) { 86 87 @Override 88 public void result(Object result) { 89 90 } 91 }); 85 92 } 86 93 … … 109 116 110 117 @Override 111 public TreePath getCurrentTreePath() {112 return owner.getCurrent TreePath();118 public Path getCurrentPath() { 119 return owner.getCurrentPath(); 113 120 } 114 121
Note: See TracChangeset
for help on using the changeset viewer.