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