1
|
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.DigiImageController;
|
|
13 import de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.dialogs.RotateDialog;
|
|
14
|
9
|
15 /**
|
|
16 * Open an dialog for entering the ration angle.
|
|
17 * @author dwinter
|
|
18 *
|
|
19 */
|
1
|
20 public class Rotate extends ManipulatorExtension {
|
|
21
|
|
22 public String iconOff="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate.png";
|
|
23 public String iconOn="/de/mpg/mpiwg/itgroup/digilib/icons/greyskin/rotate-on.png";
|
|
24
|
|
25
|
|
26 public Rotate() {
|
|
27 setIconPaths(iconOff,iconOn);
|
|
28 setOffIcon();
|
|
29 setKeyword("rotateHorizontal");
|
|
30 }
|
|
31
|
|
32 public void run(final DigiImageController dc) {
|
|
33
|
|
34 //digiImage.hmir();
|
|
35 //toggleIcon();
|
|
36
|
|
37 Listener buttonListener = new Listener() {
|
|
38 int rotateValue=0;
|
|
39 public void handleEvent(Event event) {
|
|
40 Widget wg = event.widget;
|
|
41 if (Button.class.isInstance(wg)){
|
|
42 dc.rotate(rotateValue);
|
|
43 Shell sh = ((Button)wg).getShell();
|
21
|
44 //DigilibLinkEditorObservable.INSTANCE.imageHasChanged(dc.digiImage);
|
1
|
45 setOffIcon();
|
|
46 sh.close();
|
|
47 } else if (Text.class.isInstance(wg)) {
|
|
48 Text txt = (Text)wg;
|
|
49 if (txt.getText()!=null){
|
|
50 String t = txt.getText();
|
|
51 try{
|
|
52 rotateValue=Integer.valueOf(t);
|
|
53 } catch (NumberFormatException e) {
|
|
54 // TODO: handle exception
|
|
55 }
|
|
56 }
|
|
57 }
|
|
58 }
|
|
59 };
|
|
60
|
|
61 RotateDialog rd = new RotateDialog(buttonListener,dc);
|
|
62 rd.open();
|
|
63 }
|
|
64 }
|