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 package org.ximtec.igesture.app.showcaseapp.eventhandler;
28
29 import java.awt.Graphics2D;
30 import java.util.logging.Level;
31 import java.util.logging.Logger;
32
33 import org.sigtec.ink.Note;
34 import org.ximtec.igesture.app.showcaseapp.Style;
35 import org.ximtec.igesture.core.DigitalDescriptor;
36 import org.ximtec.igesture.core.Result;
37 import org.ximtec.igesture.core.ResultSet;
38 import org.ximtec.igesture.event.GestureAction;
39
40
41
42
43
44
45
46 public class DrawEventHandler implements GestureAction {
47
48 private static final Logger LOGGER = Logger.getLogger(DrawEventHandler.class
49 .getName());
50
51 private static final String GESTURE_CLASS_NAME = "Gesture class name = ";
52
53 private Graphics2D graphic;
54 private Style style;
55
56
57 public DrawEventHandler(Graphics2D graphic, Style style) {
58 this.graphic = graphic;
59 this.style = style;
60 }
61
62
63 public void actionPerformed(ResultSet resultSet) {
64 Result result = resultSet.getResult();
65 Note note = (Note) resultSet.getGesture().getGesture();
66 LOGGER.log(Level.INFO, GESTURE_CLASS_NAME + result.getGestureClassName());
67 graphic.setStroke(style.getStroke());
68 graphic.setColor(style.getColor());
69 DigitalDescriptor descriptor = result.getGestureClass().getDescriptor(
70 DigitalDescriptor.class);
71 descriptor.getDigitalObject(graphic, note);
72 }
73
74 }