Mercurial > hg > de.mpg.mpiwg.itgroup.digilib.plugin
annotate src/de/mpg/mpiwg/itgroup/digilib/digiImage/DigiImage.java @ 28:0205c3f41d1d default tip
repackaging (separate textgridlab and dgilib local parts more rigorously
author | dwinter |
---|---|
date | Fri, 24 Aug 2012 09:42:57 +0200 |
parents | |
children |
rev | line source |
---|---|
28
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
1 package de.mpg.mpiwg.itgroup.digilib.digiImage; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
2 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
3 import java.io.IOException; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
4 import java.io.InputStream; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
5 import java.net.MalformedURLException; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
6 import java.net.URL; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
7 import java.util.ArrayList; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
8 import java.util.Arrays; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
9 import java.util.List; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
10 import java.util.Map; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
11 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
12 import org.apache.commons.lang.StringUtils; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
13 import org.eclipse.core.runtime.IAdaptable; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
14 import org.eclipse.jface.preference.IPreferenceStore; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
15 import org.eclipse.jface.viewers.ISelection; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
16 import org.eclipse.jface.viewers.ISelectionChangedListener; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
17 import org.eclipse.jface.viewers.ISelectionProvider; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
18 import org.eclipse.jface.viewers.SelectionChangedEvent; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
19 import org.eclipse.jface.viewers.StructuredSelection; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
20 import org.eclipse.swt.graphics.Image; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
21 import org.eclipse.swt.widgets.Composite; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
22 import org.eclipse.swt.widgets.Label; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
23 import org.eclipse.ui.internal.Workbench; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
24 import org.eclipse.ui.views.properties.IPropertySource; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
25 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
26 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
27 import de.mpg.mpiwg.itgroup.digilib.plugin.Activator; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
28 import de.mpg.mpiwg.itgroup.digilib.digiImage.properties.DigiImageProperties; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
29 import de.mpg.mpiwg.itgroup.digilib.listener.MoveClickListener; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
30 import de.mpg.mpiwg.itgroup.digilib.listener.ZoomAreaRectangleListener; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
31 import de.mpg.mpiwg.itgroup.digilib.plugin.editors.DigilibLinkEditorObservable; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
32 import de.mpg.mpiwg.itgroup.digilib.plugin.preferences.PluginPreferencePage; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
33 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
34 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
35 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
36 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
37 /** |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
38 * Refers to an Digilib-Scaler Object either an image or an folder. The object contains an swt-label object, so that it can be embedded e.g. in Eclipse. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
39 * @author dwinter |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
40 * |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
41 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
42 public class DigiImage implements IDigiImage, IAdaptable{ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
43 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
44 /** |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
45 * Implemens a connection to Digilib. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
46 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
47 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
48 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
49 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
50 private List<ISelectionChangedListener> selectionChangeListener = new ArrayList<ISelectionChangedListener>(); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
51 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
52 /* some parameters should not occur in the URL constructed by {@link #createUrlFromParameter(DigiImageParameter)} if set to negative values. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
53 * |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
54 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
55 private static String[] omitIfNegativeArray = {"dw","dh","ddpi","ddpix","ddpiy"}; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
56 private static List<String> omitIfNegative = Arrays.asList(omitIfNegativeArray); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
57 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
58 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
59 //private String baseUrl="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler"; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
60 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
61 /** |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
62 * Get the Url of the digilib scaler, set to http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler, if not changed. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
63 * TODO should be part of a configuration/preference file |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
64 * @return |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
65 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
66 public String getBaseUrl() { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
67 return baseUrl; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
68 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
69 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
70 /** |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
71 * Setze die Basis url des Digilib-Scalers |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
72 * @param baseUrl |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
73 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
74 public void setBaseUrl(String baseUrl) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
75 this.baseUrl = baseUrl; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
76 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
77 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
78 private Label label; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
79 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
80 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
81 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#getLabel() |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
82 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
83 public Label getLabel() { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
84 return label; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
85 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
86 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
87 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
88 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#setLabel(org.eclipse.swt.widgets.Label) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
89 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
90 public void setLabel(Label label) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
91 this.label = label; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
92 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
93 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
94 //private URL url; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
95 private Composite parent; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
96 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
97 private DigiImageParameter dp; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
98 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
99 private String baseUrl; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
100 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
101 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
102 /** |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
103 * |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
104 * @param parent Composite where the image should be become a child of. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
105 * @param style SWT Style how to display the image as a composite. For more the the style parameter at @see import org.eclipse.swt.widgets.Label |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
106 * @param dp Set of Parameters which define how the image should be displayed. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
107 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
108 public DigiImage(Composite parent, int style, DigiImageParameter dp) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
109 //super(parent,style); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
110 label = new Label(parent, style); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
111 this.parent = parent; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
112 this.dp=dp; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
113 IPreferenceStore store = Activator.getDefault().getPreferenceStore(); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
114 this.baseUrl = store.getString(PluginPreferencePage.baseUrl_id); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
115 try { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
116 setNewURL(createUrlFromParameter(dp)); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
117 } catch (MalformedURLException e) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
118 // TODO Auto-generated catch block |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
119 e.printStackTrace(); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
120 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
121 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
122 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
123 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
124 /** |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
125 * Sets the complete URL of the manipulated image and changes the image object in the composite. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
126 * @param url |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
127 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
128 private void setNewURL(URL url) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
129 //this.url = url; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
130 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
131 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
132 InputStream is; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
133 try { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
134 is = url.openStream(); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
135 } catch (IOException e) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
136 // TODO Auto-generated catch block |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
137 e.printStackTrace(); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
138 return; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
139 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
140 Image img = new Image(parent.getDisplay(),is); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
141 //Label label = new Label(parent, SWT.None); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
142 label.setImage(img); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
143 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
144 label.setVisible(true); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
145 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
146 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
147 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
148 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
149 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#getParent() |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
150 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
151 public Composite getParent() { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
152 return parent; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
153 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
154 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
155 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
156 /** |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
157 * Creates the URL to digilib from the given parameter set. For the documentation @see {@link http://developer.berlios.de/docman/display_doc.php?docid=106&group_id=251}. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
158 * @param dp |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
159 * @return |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
160 * @throws MalformedURLException |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
161 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
162 private URL createUrlFromParameter(DigiImageParameter dp) throws MalformedURLException{ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
163 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
164 Map<String, String> qa = dp.createMapFromParameters(omitIfNegative); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
165 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
166 List<String> queryArray = new ArrayList<String>(); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
167 for(String key:qa.keySet()){ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
168 queryArray.add(key+"="+qa.get(key)); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
169 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
170 String queryString = StringUtils.join(queryArray,"&"); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
171 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
172 String stringUrl=baseUrl+"?"+queryString; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
173 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
174 return new URL(stringUrl); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
175 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
176 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
177 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
178 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
179 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
180 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#getParameter() |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
181 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
182 public DigiImageParameter getParameter() { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
183 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
184 return dp; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
185 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
186 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
187 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
188 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#setParameter(de.mpg.mpiwg.itgroup.digilib.digiImage.DigiImageParameter) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
189 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
190 public void setParameter(DigiImageParameter dp) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
191 this.dp=dp; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
192 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
193 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
194 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
195 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
196 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#redraw() |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
197 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
198 public void redraw(){ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
199 try { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
200 setNewURL(createUrlFromParameter(dp)); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
201 setSelection(new StructuredSelection(this)); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
202 DigilibLinkEditorObservable.INSTANCE.imageHasChanged(this); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
203 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
204 } catch (MalformedURLException e) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
205 // TODO Auto-generated catch block |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
206 e.printStackTrace(); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
207 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
208 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
209 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
210 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
211 private ZoomAreaRectangleListener rectangleListener=null; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
212 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
213 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
214 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#getRectangleListener() |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
215 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
216 public ZoomAreaRectangleListener getRectangleListener() { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
217 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
218 return rectangleListener; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
219 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
220 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
221 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
222 * @see de.mpg.mpiwg.itgroup.digilib.digiImage.IDigiImage#setRectangleListener(de.mpg.mpiwg.itgroup.digilib.manipulator.extensions.RectangleListener) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
223 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
224 public void setRectangleListener(ZoomAreaRectangleListener rectangleListener) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
225 this.rectangleListener = rectangleListener; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
226 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
227 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
228 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
229 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
230 * |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
231 * Digiimage shows properties if asked to. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
232 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
233 @SuppressWarnings("rawtypes") |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
234 public DigiImageProperties getAdapter(Class adapter) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
235 if (adapter == IPropertySource.class) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
236 return new DigiImageProperties(this); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
237 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
238 return null; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
239 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
240 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
241 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
242 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
243 * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
244 * Digiimage registeres selelection changers |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
245 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
246 public void addSelectionChangedListener(ISelectionChangedListener listener) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
247 selectionChangeListener.add(listener); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
248 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
249 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
250 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
251 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
252 * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
253 * Selection is the object itself. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
254 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
255 public ISelection getSelection() { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
256 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
257 return new StructuredSelection(this); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
258 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
259 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
260 public void removeSelectionChangedListener( |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
261 ISelectionChangedListener listener) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
262 selectionChangeListener.remove(listener); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
263 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
264 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
265 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
266 /* (non-Javadoc) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
267 * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
268 * Informs all listeners that selection has changed. |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
269 */ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
270 public void setSelection(ISelection selection) { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
271 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
272 for (ISelectionChangedListener sl: selectionChangeListener){ |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
273 SelectionChangedEvent event = new SelectionChangedEvent(this, selection); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
274 sl.selectionChanged(event); |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
275 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
276 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
277 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
278 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
279 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
280 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
281 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
282 @Override |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
283 public MoveClickListener getMoveClickListener() { |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
284 // TODO Auto-generated method stub |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
285 return null; |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
286 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
287 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
288 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
289 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
290 } |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
291 |
0205c3f41d1d
repackaging (separate textgridlab and dgilib local parts more rigorously
dwinter
parents:
diff
changeset
|
292 |