summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:56:48 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:56:48 +0000
commit9f07d0ac1f3d53d03a4f105b1b99dccd4ac2d473 (patch)
tree1514f371d120bfdcd15d2851b055b4531890536a /pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls
parent0de1ae638645c2ece3d4276a88dbb261b27310b0 (diff)
downloadmocca-9f07d0ac1f3d53d03a4f105b1b99dccd4ac2d473.tar.gz
mocca-9f07d0ac1f3d53d03a4f105b1b99dccd4ac2d473.tar.bz2
mocca-9f07d0ac1f3d53d03a4f105b1b99dccd4ac2d473.zip
Working on Configuration UI. (still work in progress!)
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@52 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java109
1 files changed, 109 insertions, 0 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java
new file mode 100644
index 00000000..11cefa13
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorMarker.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.gui.controls;
+
+// Imports
+import java.io.InputStream;
+
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public class ErrorMarker {
+
+ /**
+ * SLF4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(ErrorMarker.class);
+
+ private Label lbl;
+
+ /**
+ * @param parent
+ * @param style
+ * @param exception
+ * @param message
+ */
+ public ErrorMarker(Composite parent, int style, Throwable exception,
+ String message, Control control) {
+ //super(parent, style);
+
+ this.lbl = new Label(parent, style);
+
+ String imgPath = "/img/error.png"; //$NON-NLS-1$
+
+ InputStream stream = this.getClass().getResourceAsStream(imgPath);
+
+ Point size = control.getSize();
+
+ int width = size.x == 0 ? 32 : size.x;
+ int height = size.y == 0 ? 32 : size.y;
+
+ this.lbl.setSize(new Point(width, height));
+
+ this.orig = new Image(this.lbl.getDisplay(), new ImageData(stream).scaledTo(width, height));
+
+ this.lbl.setToolTipText(message);
+
+ this.lbl.setImage(this.orig);
+ }
+
+ public void setLayoutData(Object object) {
+ this.lbl.setLayoutData(object);
+ }
+
+ public void setVisible(boolean visible) {
+ this.lbl.setVisible(visible);
+ }
+
+ public void setToolTipText(String msg) {
+ this.lbl.setToolTipText(msg);
+ }
+
+
+ public void resize(Point size) {
+ String imgPath = "/img/error.png"; //$NON-NLS-1$
+
+ InputStream stream = this.getClass().getResourceAsStream(imgPath);
+
+ int width = size.x == 0 ? 32 : size.x;
+ int height = size.y == 0 ? 32 : size.y;
+
+ this.orig = new Image(this.lbl.getDisplay(), new ImageData(stream).scaledTo(width, height));
+
+ this.lbl.setSize(size);
+ this.lbl.setImage(this.orig);
+ }
+
+ public Point getSize() {
+ return this.lbl.getSize();
+ }
+
+ private Image orig;
+}