-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathHandleDelegate.java
More file actions
69 lines (61 loc) · 2.41 KB
/
HandleDelegate.java
File metadata and controls
69 lines (61 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package nodebox.handle;
import nodebox.node.Node;
/**
* A Handle Delegate can react to changes requested by a Handle.
*/
public interface HandleDelegate {
/**
* Set a value on the node.
* <p/>
* This callback is fired whenever we want to set a value and have an error reported back.
* This method can be called for every drag or move of the mouse, if needed.
*
* @param node The node to set the value on.
* @param parameterName The parameter this value is linked to.
* @param value The ne value.
*/
public void setValue(Node node, String parameterName, Object value);
/**
* Set a value on the node without causing an error.
* <p/>
* This callback is fired whenever we want to set a value, but ignore every error.
* For handles, this is the default, since we don't want to mess with error handling.
* This automatically does the right thing.
* <p/>
* For example, on a constrained handle where width / height need to be equal, calling this method
* will keep them in sync without raising errors that one can't be bigger than the other.
*
* @param node The node to set the value on.
* @param parameterName The parameter this value is linked to.
* @param value The ne value.
*/
public void silentSet(Node node, String parameterName, Object value);
/**
* Edits are no longer recorded until you call stopEditing. This allows you to batch edits.
*
* @param command the command name of the edit batch
*/
public void startEdits(String command);
/**
* Indicates that the user has stopped an editing operation.
* <p/>
* Use this when something significant has happened in your code, e.g. when you've drawn a line in the freehand node.
* <p/>
* This causes the undo mechanism to create a new undo "step".
*
* @param node The node we're editing.
*/
public void stopEditing(Node node);
/**
* Indicates that the handle needs to be updated.
* <p/>
* This calls the update method on the handle, then repaints it.
* <p/>
* The handle is updated every time a value is changed.
* Use this method whenever you want to update the handle state without changing a value,
* for example to redraw a handle cursor.
*
* @param node The node we're editing.
*/
public void updateHandle(Node node);
}