summaryrefslogtreecommitdiff
path: root/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-19 13:43:02 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-08-19 13:43:02 +0000
commite72c9994054446f38c5bc53d7da573e366f57963 (patch)
tree52f2f6ac20e0d29e971d831b98c1cd36550dc1ed /BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui
parentbe6e86c228a37c6d1bce896a4aa564c64b1081fa (diff)
downloadmocca-e72c9994054446f38c5bc53d7da573e366f57963.tar.gz
mocca-e72c9994054446f38c5bc53d7da573e366f57963.tar.bz2
mocca-e72c9994054446f38c5bc53d7da573e366f57963.zip
make "include-webstart" profile default (added "local-webstart" for development)
updateRequired (versioning) bug fixed AboutDialog Branding (removed MOCCA/Bean) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@444 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui')
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java23
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java205
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java33
3 files changed, 0 insertions, 261 deletions
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java
deleted file mode 100644
index fd9838f9..00000000
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package at.gv.egiz.bku.webstart.ui;
-
-public interface BKUControllerInterface {
-
- public void shutDown();
-
-}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java
deleted file mode 100644
index fb7c40dd..00000000
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package at.gv.egiz.bku.webstart.ui;
-
-import java.awt.AWTException;
-import java.awt.Image;
-import java.awt.MenuItem;
-import java.awt.PopupMenu;
-import java.awt.SystemTray;
-import java.awt.TrayIcon;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.ResourceBundle;
-
-import javax.imageio.ImageIO;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class TrayIconDialog implements TrayIconDialogInterface {
- public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/ui/trayicon_32.png";
- public static final String TRAYMENU_SHUTDOWN = "TrayMenu.Shutdown";
- public static final String TRAYMENU_TOOLTIP = "TrayMenu.Tooltip";
-
- private static Log log = LogFactory.getLog(TrayIconDialog.class);
- private static TrayIconDialogInterface instance;
- private boolean isSupported;
- private BKUControllerInterface shutDown;
- private TrayIcon trayIcon = null;
- private ResourceBundle resourceBundle = null;
-
- private TrayIconDialog() {
- }
-
- private void displayTrayMsg(String captionID, String messageID,
- TrayIcon.MessageType type) {
- if ((isSupported) && (resourceBundle != null)) {
- try {
- trayIcon.displayMessage(resourceBundle.getString(captionID),
- resourceBundle.getString(messageID), type);
- } catch (Exception ex) {
- log.error(ex);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayInfo(java.lang.String
- * , java.lang.String)
- */
- public void displayInfo(String captionID, String messageID) {
- displayTrayMsg(captionID, messageID, TrayIcon.MessageType.INFO);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayWarning(java.lang
- * .String, java.lang.String)
- */
- public void displayWarning(String captionID, String messageID) {
- displayTrayMsg(captionID, messageID, TrayIcon.MessageType.WARNING);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayError(java.lang.
- * String, java.lang.String)
- */
- public void displayError(String captionID, String messageID) {
- displayTrayMsg(captionID, messageID, TrayIcon.MessageType.ERROR);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#init(java.util.ResourceBundle
- * )
- */
- public void init(ResourceBundle resourceBundel) {
- this.resourceBundle = resourceBundel;
- isSupported = SystemTray.isSupported();
- log.info("Trayicon supported: " + isSupported);
- try {
- if (isSupported) {
- SystemTray tray = SystemTray.getSystemTray();
- Image image = ImageIO.read(getClass().getClassLoader()
- .getResourceAsStream(TRAYICON_RESOURCE));
- PopupMenu popup = new PopupMenu();
- MenuItem exitItem = new MenuItem(resourceBundel
- .getString(TRAYMENU_SHUTDOWN));
- popup.add(exitItem);
- exitItem.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- log.info("Calling Shutdown");
- if (shutDown != null) {
- shutDown.shutDown();
- }
- }
- });
-
- trayIcon = new TrayIcon(image, "BKULogo", popup);
- trayIcon.setImageAutoSize(true);
- trayIcon.setToolTip(resourceBundel.getString(TRAYMENU_TOOLTIP));
- try {
- tray.add(trayIcon);
- } catch (AWTException e) {
- log.error("TrayIcon could not be added.", e);
- isSupported = false;
- }
- }
- } catch (IOException e) {
- log.error(e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#setShutdownHook(at.gv.egiz
- * .bku.local.ui.BKUControllerInterface)
- */
- public void setShutdownHook(BKUControllerInterface shutDown) {
- this.shutDown = shutDown;
- }
-
- @SuppressWarnings("unchecked")
- public synchronized static TrayIconDialogInterface getInstance() {
- ClassLoader cl = TrayIconDialog.class.getClassLoader();
- if (instance == null) {
- if (cl.toString().equals(cl.getParent().toString())) {
- instance = new TrayIconDialog();
- return instance;
- }
- ClassLoader parent = cl;
- while (!parent.toString().equals(cl.getParent().toString())) {
- parent = parent.getParent();
- }
- try {
- Class<TrayIconDialog> otherClassInstance = (Class<TrayIconDialog>) parent
- .loadClass(TrayIconDialog.class.getName());
- Method getInstanceMethod = otherClassInstance.getDeclaredMethod(
- "getInstance", new Class[] {});
- Object otherSingleton = getInstanceMethod.invoke(null, new Object[] {});
- instance = (TrayIconDialogInterface) Proxy.newProxyInstance(cl,
- new Class[] { TrayIconDialogInterface.class },
- new PassThroughProxyHandler(otherSingleton));
- } catch (ClassNotFoundException ce) {
- instance = new TrayIconDialog();
- } catch (Exception e) {
- log.error(e);
- instance = new TrayIconDialog();
- }
- return instance;
- }
- return instance;
- }
-
- /**
- *
- * Only works for public methods
- *
- */
- static class PassThroughProxyHandler implements InvocationHandler {
- private final Object delegate;
-
- public PassThroughProxyHandler(Object delegate) {
- this.delegate = delegate;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- Method delegateMethod = delegate.getClass().getMethod(method.getName(),
- method.getParameterTypes());
- return delegateMethod.invoke(delegate, args);
- }
- }
-
-}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java
deleted file mode 100644
index 078844cb..00000000
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package at.gv.egiz.bku.webstart.ui;
-
-import java.util.ResourceBundle;
-
-public interface TrayIconDialogInterface {
-
- public abstract void displayInfo(String captionID, String messageID);
-
- public abstract void displayWarning(String captionID, String messageID);
-
- public abstract void displayError(String captionID, String messageID);
-
- public abstract void init(ResourceBundle resourceBundel);
-
- public abstract void setShutdownHook(BKUControllerInterface shutDown);
-
-} \ No newline at end of file