summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:34:42 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:34:42 +0000
commit80be05f181f8801b0b53531ddcfc0e7814f4d05e (patch)
treee544ec0febfde2e3e155ba2c6a436e7f7d4f0717 /pdf-over-gui/src/main/java/at/asit
parent8aca86f7eb5ff72c201f1029393292088ff5ec55 (diff)
downloadpdf-over-80be05f181f8801b0b53531ddcfc0e7814f4d05e.tar.gz
pdf-over-80be05f181f8801b0b53531ddcfc0e7814f4d05e.tar.bz2
pdf-over-80be05f181f8801b0b53531ddcfc0e7814f4d05e.zip
Grey out config button when disabled
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@391 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java29
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java40
3 files changed, 48 insertions, 24 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
index efb2819b..4b557e1e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
@@ -98,6 +98,9 @@ public class Constants {
"/img/config.png" : //$NON-NLS-1$
"/img/config_p.png"; //$NON-NLS-1$
+ /** Config inactive image resource */
+ public static final String RES_IMG_CONFIG_DISABLED = "/img/config_disabled.png"; //$NON-NLS-1$
+
/** Error image resource */
public static final String RES_IMG_ERROR = "/img/error.png"; //$NON-NLS-1$
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 502c8525..18cabc86 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -84,29 +84,19 @@ public class MainWindow {
* Main bar Buttons
*/
public enum Buttons {
- /**
- * the configuration button
- */
+ /** the configuration button */
CONFIG,
- /**
- * the open button
- */
+ /** the open button */
OPEN,
- /**
- * the position button
- */
+ /** the position button */
POSITION,
- /**
- * the signature button
- */
+ /** the signature button */
SIGN,
- /**
- * the final button
- */
+ /** the final button */
FINAL
}
@@ -283,7 +273,6 @@ public class MainWindow {
this.btn_config
.setToolTipText(Messages.getString("main.configuration")); //$NON-NLS-1$
this.btn_config.addMouseListener(new MouseAdapter() {
-
@Override
public void mouseUp(MouseEvent e) {
MainWindow.this.stateMachine
@@ -294,9 +283,11 @@ public class MainWindow {
this.buttonMap.put(Buttons.CONFIG, this.btn_config);
InputStream is = this.getClass().getResourceAsStream(Constants.RES_IMG_CONFIG);
-
- this.btn_config.setImage(new Image(Display.getDefault(), new ImageData(
- is)));
+ ((MainBarRectangleButton) this.btn_config).setEnabledImage(
+ new Image(Display.getDefault(), new ImageData(is)));
+ is = this.getClass().getResourceAsStream(Constants.RES_IMG_CONFIG_DISABLED);
+ ((MainBarRectangleButton) this.btn_config).setDisabledImage(
+ new Image(Display.getDefault(), new ImageData(is)));
Composite mainbarContainer = new Composite(this.mainbar, SWT.NONE);
mainbarContainer.setLayout(new FormLayout());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
index 102d2c07..ce423977 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java
@@ -17,6 +17,7 @@ package at.asit.pdfover.gui.controls;
// Imports
import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.widgets.Composite;
@@ -27,6 +28,17 @@ import org.slf4j.LoggerFactory;
*
*/
public class MainBarRectangleButton extends MainBarButton {
+
+ /**
+ * SLF4J Logger instance
+ **/
+ @SuppressWarnings("unused")
+ private static final Logger log = LoggerFactory
+ .getLogger(MainBarRectangleButton.class);
+
+ private Image enabledImg = null;
+ private Image disabledImg = null;
+
/**
* @param parent
* @param style
@@ -38,11 +50,24 @@ public class MainBarRectangleButton extends MainBarButton {
}
/**
- * SLF4J Logger instance
- **/
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory
- .getLogger(MainBarRectangleButton.class);
+ * Set the image to display while this control is enabled
+ * @param enabledImg enabled image
+ */
+ public void setEnabledImage(Image enabledImg) {
+ this.enabledImg = enabledImg;
+ if (getEnabled())
+ setImage(enabledImg);
+ }
+
+ /**
+ * Set the image to display while this control is disabled
+ * @param disabledImg disabled image
+ */
+ public void setDisabledImage(Image disabledImg) {
+ this.disabledImg = disabledImg;
+ if (!getEnabled())
+ setImage(disabledImg);
+ }
/*
* (non-Javadoc)
@@ -142,4 +167,9 @@ public class MainBarRectangleButton extends MainBarButton {
return reg;
}
+ @Override
+ public void setEnabled(boolean enabled) {
+ setImage(enabled ? this.enabledImg : this.disabledImg);
+ super.setEnabled(enabled);
+ }
}