Mercurial > hg > de.mpg.mpiwg.itgroup.digilib.core
comparison src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/Rotate.java @ 1:83c58ea33792
first release (continued)
author | dwinter |
---|---|
date | Mon, 03 Jan 2011 09:11:25 +0100 |
parents | |
children | e63a64652f4d |
comparison
equal
deleted
inserted
replaced
0:6829553d2378 | 1:83c58ea33792 |
---|---|
1 package de.mpg.mpiwg.itgroup.digilib.manipulator.extensions; | |
2 | |
3 | |
4 | |
5 import org.eclipse.swt.widgets.Button; | |
6 import org.eclipse.swt.widgets.Event; | |
7 import org.eclipse.swt.widgets.Listener; | |
8 import org.eclipse.swt.widgets.Shell; | |
9 import org.eclipse.swt.widgets.Text; | |
10 import org.eclipse.swt.widgets.Widget; | |
11 | |
12 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; | |
13 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; | |
14 import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog; | |
15 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; | |
16 | |
17 public class Rotate extends ManipulatorExtension { | |
18 | |
19 public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate.png"; | |
20 public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate-on.png"; | |
21 | |
22 | |
23 public Rotate() { | |
24 setIconPaths(iconOff,iconOn); | |
25 setOffIcon(); | |
26 setKeyword("rotateHorizontal"); | |
27 } | |
28 | |
29 public void run(final DigiImageController dc) { | |
30 | |
31 //digiImage.hmir(); | |
32 //toggleIcon(); | |
33 | |
34 Listener buttonListener = new Listener() { | |
35 int rotateValue=0; | |
36 public void handleEvent(Event event) { | |
37 Widget wg = event.widget; | |
38 if (Button.class.isInstance(wg)){ | |
39 dc.rotate(rotateValue); | |
40 Shell sh = ((Button)wg).getShell(); | |
41 DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage); | |
42 setOffIcon(); | |
43 sh.close(); | |
44 } else if (Text.class.isInstance(wg)) { | |
45 Text txt = (Text)wg; | |
46 if (txt.getText()!=null){ | |
47 String t = txt.getText(); | |
48 try{ | |
49 rotateValue=Integer.valueOf(t); | |
50 } catch (NumberFormatException e) { | |
51 // TODO: handle exception | |
52 } | |
53 } | |
54 } | |
55 } | |
56 }; | |
57 | |
58 RotateDialog rd = new RotateDialog(buttonListener,dc); | |
59 rd.open(); | |
60 } | |
61 } |