# HG changeset patch
# User dwinter
# Date 1318247474 -7200
# Node ID 207dae29cc09cd7202d7b0d4af6f66bd41671c50
# Parent fbcf122a6a24a4787052c3b59f27a9c6542e0aea
new tabs
diff -r fbcf122a6a24 -r 207dae29cc09 plugin.xml
--- a/plugin.xml Wed Sep 14 14:41:31 2011 +0200
+++ b/plugin.xml Mon Oct 10 13:51:14 2011 +0200
@@ -80,7 +80,12 @@
+ label="DigiImage">
+
+
@@ -89,7 +94,7 @@
+
+
+
+
+
+
texts = new HashMap();
+
+ private Map listeners = new HashMap();
+ private Button button;
+
+
+ //private String labelString = "wh:wh;rgba:rgba;dW:dw;mo:mo;rot:rot;ddpi:ddpi;ddpix:ddpix;ddpiy:ddpiy;brgt:brgt;ws:ws;rgbm:rgbm;wy:wy;wx:ww;dh:dh;pn:pn;cont:cont;fn:fn";
+ public String labelString = "wh:wh;dw:dw;ws:ws;wy:wy;wx:ww;dh:dh";
+
+ private Map parseLabelString(String labelString) {
+ HashMap ret = new HashMap();
+ String[] splitted = labelString.split(";");
+ for (int i = 0; i < splitted.length; i++) {
+ String entry = splitted[i];
+ String[] values = entry.split(":");
+ if (values.length == 2)
+ ret.put(values[0], values[1]);
+ }
+ return ret;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls
+ * (org.eclipse.swt.widgets.Composite,
+ * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ public void createControls(Composite parent,
+ TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+
+ Map labels = parseLabelString(labelString);
+
+ DigiImageParameter dp = new DigiImageParameter("");
+ GridLayout gridLayout = new GridLayout(1, false);
+ parent.setLayout(gridLayout);
+
+ for (String key : dp.createMapFromParameters(null).keySet()) {
+ if (labels.containsKey(key)){
+
+ Composite composite = getWidgetFactory().createFlatFormComposite(
+ parent);
+ FormData data;
+
+ Text t = getWidgetFactory().createText(composite, "");
+ texts.put(key, t);
+ data = new FormData();
+ data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ t.setLayoutData(data);
+
+ CLabel labelLabel = getWidgetFactory().createCLabel(composite, labels.get(key)); //$NON-NLS-1$
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(t, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(t, 0, SWT.CENTER);
+ labelLabel.setLayoutData(data);
+ }
+ }
+ Composite composite = getWidgetFactory()
+ .createFlatFormComposite(parent);
+ button = getWidgetFactory().createButton(composite, "redraw", SWT.None);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#setInput
+ * (org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+
+ // Assert.isTrue(selection instanceof IStructuredSelection);
+ assert (IStructuredSelection.class.isInstance(selection) == true) : "wrong instance type";
+
+ Object input = ((IStructuredSelection) selection).getFirstElement();
+ // Assert.isTrue(input instanceof DigiImage);
+
+ assert (DigiImage.class.isInstance(input) == true) : "wrong instance type for input";
+ this.digiImage = (IDigiImage) input;
+
+ // Map pms =
+ // digiImage.getParameter().createMapFromParameters(null);
+
+ Map labels = parseLabelString(labelString);
+
+ for (String key : digiImage.getParameter()
+ .createMapFromParameters(null).keySet()) {
+ if (labels.containsKey(key)){
+ ModifyListener listener = new DigiImagePropertyListener(key,
+ digiImage);
+
+ texts.get(key).addModifyListener(listener);
+ listeners.put(key, listener);
+ }
+ }
+ button.addMouseListener(new RedrawButtonListener(digiImage, texts));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ public void refresh() {
+
+ DigiImageProperties properties = (DigiImageProperties) digiImage
+ .getAdapter(IPropertySource.class);
+
+ for (String key : texts.keySet()) {
+
+ Text labelText = texts.get(key);
+ labelText.removeModifyListener(listeners.get(key));
+
+ labelText.setText((String) properties.getPropertyValue(key));
+ labelText.addModifyListener(listeners.get(key));
+
+ }
+ super.refresh();
+ }
+
+}
diff -r fbcf122a6a24 -r 207dae29cc09 src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorPart.java
--- a/src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorPart.java Wed Sep 14 14:41:31 2011 +0200
+++ b/src/de/mpg/mpiwg/itgroup/digilib/plugin/editors/DigilibLinkEditorPart.java Mon Oct 10 13:51:14 2011 +0200
@@ -39,6 +39,8 @@
*/
public class DigilibLinkEditorPart extends EditorPart implements Observer, ITabbedPropertySheetPageContributor{
+ private static final int SIZE_DH = 1000;
+ private static final int SIZE_DW = 1000;
private Composite mainComposite;
private ScrolledComposite sc;
private boolean isDirty;
@@ -115,8 +117,8 @@
path=path.replace("/mpiwg/online", "");
DigiImageParameter dp = new DigiImageParameter(path);
dp.setType(input.getType());
- dp.setDh(500);
- dp.setDw(500);
+ dp.setDh(SIZE_DH);
+ dp.setDw(SIZE_DW);
digiImage = new DigiImage(mainComposite, SWT.BORDER, dp);
} catch (JDOMException e) {
// TODO Auto-generated catch block
@@ -129,8 +131,8 @@
path = input.getUri().toASCIIString();
DigiImageParameter dp = new DigiImageParameter(path);
dp.setType(input.getType());
- dp.setDh(500);
- dp.setDw(500);
+ dp.setDh(SIZE_DH);
+ dp.setDw(SIZE_DW);
digiImage = new TextGridDigiImage(mainComposite, SWT.BORDER, dp,input.getSid());
} else {
@@ -174,7 +176,7 @@
/*
* If the argument ist digiImage then rerender the editor and update the properties
*/
- if (DigiImage.class.isInstance(arg)){
+ if (IDigiImage.class.isInstance(arg)){
mainComposite.pack();
sc.setMinSize(mainComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
sc.layout();