Mercurial > hg > de.mpg.mpiwg.itgroup.digilib.plugin
comparison src/de/mpg/mpiwg/itgroup/digilib/manipulator/extensions/ManipulatorExtension.java @ 9:e63a64652f4d
added comments
author | dwinter |
---|---|
date | Mon, 03 Jan 2011 16:53:48 +0100 |
parents | 83c58ea33792 |
children |
comparison
equal
deleted
inserted
replaced
8:52023cf79d86 | 9:e63a64652f4d |
---|---|
3 import java.io.InputStream; | 3 import java.io.InputStream; |
4 | 4 |
5 import org.eclipse.swt.graphics.Image; | 5 import org.eclipse.swt.graphics.Image; |
6 import org.eclipse.swt.widgets.Composite; | 6 import org.eclipse.swt.widgets.Composite; |
7 | 7 |
8 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImage; | |
9 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; | 8 import de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController; |
10 import de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator; | 9 import de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator; |
11 | 10 |
11 /** | |
12 * Abstract class where all Digilib Manipulator extensions shoud be derived from | |
13 * | |
14 * @author dwinter | |
15 * | |
16 */ | |
12 public abstract class ManipulatorExtension implements IDigilibImageManipulator { | 17 public abstract class ManipulatorExtension implements IDigilibImageManipulator { |
13 | 18 |
14 private String iconOff; | 19 private String iconOff; |
15 private String iconOn; | 20 private String iconOn; |
16 | 21 |
17 private String imagePath; | 22 private String imagePath; |
18 private String keyword; | 23 private String keyword; |
19 | 24 |
20 | 25 |
26 /* (non-Javadoc) | |
27 * @see de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator#getKeyword() | |
28 */ | |
21 public String getKeyword() { | 29 public String getKeyword() { |
22 return keyword; | 30 return keyword; |
23 } | 31 } |
24 | 32 |
25 | 33 |
34 /* (non-Javadoc) | |
35 * @see de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator#run(de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageController) | |
36 */ | |
26 public void run(DigiImageController dc) {}; | 37 public void run(DigiImageController dc) {}; |
27 | 38 |
39 | |
40 /** | |
41 * Set path to icon. path is path with in classpath | |
42 * @param ip | |
43 */ | |
28 public void setImagePath(String ip) { | 44 public void setImagePath(String ip) { |
29 imagePath=ip; | 45 imagePath=ip; |
30 | 46 |
31 } | 47 } |
32 | 48 |
49 /** | |
50 * @return path to the current icon within the class path | |
51 */ | |
33 public String getImagePath() { | 52 public String getImagePath() { |
34 return imagePath; | 53 return imagePath; |
35 | 54 |
36 } | 55 } |
37 | 56 |
57 /** | |
58 * @param keyword keyword which identifies the extension, used by | |
59 * @see {@link de.mpg.mpiwg.itgroup.digilib.manipulator.DigilibImageManipulatorProvider}. | |
60 * | |
61 */ | |
38 public void setKeyword(String keyword) { | 62 public void setKeyword(String keyword) { |
39 this.keyword = keyword; | 63 this.keyword = keyword; |
40 } | 64 } |
41 | 65 |
66 /* (non-Javadoc) | |
67 * @see de.mpg.mpiwg.itgroup.digilib.manipulator.IDigilibImageManipulator#createImage(org.eclipse.swt.widgets.Composite) | |
68 */ | |
42 public Image createImage(Composite parent) { | 69 public Image createImage(Composite parent) { |
43 InputStream is = getClass().getResourceAsStream(getImagePath()); | 70 InputStream is = getClass().getResourceAsStream(getImagePath()); |
44 Image img = new Image(parent.getDisplay(),is); | 71 Image img = new Image(parent.getDisplay(),is); |
45 return img; | 72 return img; |
46 } | 73 } |
47 | 74 |
75 /** | |
76 * Toggle selection state of the navigation icon | |
77 */ | |
48 public void toggleIcon(){ | 78 public void toggleIcon(){ |
49 if(imagePath.equals(iconOff)){ | 79 if(imagePath.equals(iconOff)){ |
50 setImagePath(iconOn); | 80 setImagePath(iconOn); |
51 } else { | 81 } else { |
52 setImagePath(iconOff); | 82 setImagePath(iconOff); |
53 } | 83 } |
54 } | 84 } |
55 | 85 |
86 /** | |
87 * Set icon to off state. | |
88 */ | |
56 public void setOffIcon(){ | 89 public void setOffIcon(){ |
57 setImagePath(iconOff); | 90 setImagePath(iconOff); |
58 } | 91 } |
59 | 92 |
93 /** | |
94 * Setze die Pfade zu den Icons innerhalb des class path. | |
95 * @param iconOff | |
96 * @param iconOn | |
97 */ | |
60 public void setIconPaths(String iconOff, String iconOn) { | 98 public void setIconPaths(String iconOff, String iconOn) { |
61 this.iconOff=iconOff; | 99 this.iconOff=iconOff; |
62 this.iconOn=iconOn; | 100 this.iconOn=iconOn; |
63 | 101 |
64 } | 102 } |