diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-08-19 13:43:02 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-08-19 13:43:02 +0000 |
commit | e72c9994054446f38c5bc53d7da573e366f57963 (patch) | |
tree | 52f2f6ac20e0d29e971d831b98c1cd36550dc1ed /BKUWebStart | |
parent | be6e86c228a37c6d1bce896a4aa564c64b1081fa (diff) | |
download | mocca-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')
30 files changed, 608 insertions, 430 deletions
diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index 2de61fdc..03f5f5f3 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -43,18 +43,6 @@ <overWrite>false</overWrite> <outputDirectory>${project.build.directory}/classes</outputDirectory> </artifactItem> - <!-- - | Will be replaced by TSL in IAIK-PKI - | don't list as dependency, to avoid inclusion in dist zip - | (BKULocal is of type war, therefore not included in dist) - | - <artifactItem> - <groupId>at.gv.egiz</groupId> - <artifactId>BKUCertificates</artifactId> - <version>1.0-SNAPSHOT</version> - <overWrite>false</overWrite> - <outputDirectory>${project.build.directory}/classes</outputDirectory> - </artifactItem--> </artifactItems> <stripVersion>true</stripVersion> </configuration> @@ -89,8 +77,8 @@ <libPath>lib</libPath--> <jnlp> <inputTemplateResourcePath>${project.basedir}/src/main/jnlp</inputTemplateResourcePath> - <inputTemplate>template-local.xml</inputTemplate> - <outputFile>mocca-local.jnlp</outputFile> + <inputTemplate>template.xml</inputTemplate> + <outputFile>mocca.jnlp</outputFile> <mainClass>at.gv.egiz.bku.webstart.Launcher</mainClass> <j2seVersion>1.6+</j2seVersion> <offlineAllowed>true</offlineAllowed> @@ -111,7 +99,7 @@ </sign> <pack200>false</pack200> <!--gzip>true</gzip--> - <outputJarVersions>false</outputJarVersions> + <outputJarVersions>true</outputJarVersions> <!-- unsign IAIK signed libs --> <unsignAlreadySignedJars>true</unsignAlreadySignedJars> <verbose>true</verbose> @@ -165,18 +153,19 @@ <archive> <manifest> <addClasspath>true</addClasspath> - <mainClass>at.gv.egiz.bku.webstart.BKULauncher</mainClass> + <mainClass>at.gv.egiz.bku.webstart.Launcher</mainClass> </manifest> <manifestEntries> <mode>development</mode> <url>${pom.url}</url> - <SplashScreen-Image>splash_standalone.png</SplashScreen-Image> + <SplashScreen-Image>at/gv/egiz/bku/webstart/splash.png</SplashScreen-Image> </manifestEntries> </archive> </configuration> </plugin> </plugins> </build> + <!-- TODO somehow provide javaws.jar on manifest class-path --> </profile> <profile> @@ -211,7 +200,8 @@ </profile> <profile> - <id>include-webstart</id> + <!-- development profile --> + <id>local-webstart</id> <build> <plugins> <plugin> @@ -219,12 +209,10 @@ <groupId>org.codehaus.mojo.webstart</groupId> <configuration> <jnlp> - <inputTemplate>template.xml</inputTemplate> - <outputFile>mocca.jnlp</outputFile> + <inputTemplate>template-local.xml</inputTemplate> + <outputFile>mocca-local.jnlp</outputFile> </jnlp> - <pack200>false</pack200> - <!--gzip>false</gzip--> - <outputJarVersions>true</outputJarVersions> + <outputJarVersions>false</outputJarVersions> </configuration> </plugin> </plugins> @@ -298,4 +286,4 @@ <systemPath>${java.home}/lib/javaws.jar</systemPath> </dependency> </dependencies> -</project>
\ No newline at end of file +</project> diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java index f1349637..bef2246b 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java @@ -18,7 +18,6 @@ package at.gv.egiz.bku.webstart; import at.gv.egiz.bku.utils.StreamUtil; import iaik.asn1.CodingException; -import iaik.xml.crypto.utils.Utils; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; @@ -32,25 +31,19 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.util.Enumeration; import java.util.Iterator; -import java.util.Map; -import java.util.Set; import java.util.UUID; import java.util.jar.Attributes; import java.util.jar.Manifest; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.eclipse.jdt.core.dom.ThisExpression; /** * @@ -63,7 +56,7 @@ public class Configurator { * configurations with less than this (major) version will be backuped and updated * allowed: MAJOR[.MINOR[.X[-SNAPSHOT]]] */ - public static final String MIN_CONFIG_VERSION = "1.0.9-SNAPSHOT"; + public static final String MIN_CONFIG_VERSION = "1.0.9"; public static final String CONFIG_DIR = ".mocca/conf/"; public static final String CERTS_DIR = ".mocca/certs/"; public static final String VERSION_FILE = ".version"; @@ -259,14 +252,20 @@ public class Configurator { int majorEndOld = oldVersion.indexOf("-SNAPSHOT"); if (majorEndOld < 0) { preRelease = false; - majorEndOld = oldVersion.length(); + majorEndOld = oldVersion.indexOf('-'); // 1.0.10-r439 + if (majorEndOld < 0) { + majorEndOld = oldVersion.length(); + } } boolean releaseRequired = false; int majorEndMin = minVersion.indexOf("-SNAPSHOT"); if (majorEndMin < 0) { releaseRequired = true; - majorEndMin = minVersion.length(); + majorEndMin = minVersion.indexOf('-'); + if (majorEndMin < 0) { + majorEndMin = minVersion.length(); + } } xOld = Integer.valueOf(oldVersion.substring(fromInd, majorEndOld)); @@ -301,39 +300,6 @@ public class Configurator { return true; } - /** - - * @param oldVersion - * @param newVersion - * @return - */ -// private boolean updateRequiredStrict(String oldVersion, String newVersion) { -// log.debug("comparing " + oldVersion + " to " + newVersion); -// if (oldVersion != null && !UNKOWN_VERSION.equals(oldVersion)) { -// if (newVersion != null && !UNKOWN_VERSION.equals(newVersion)) { -// String[] oldV = oldVersion.split("-"); -// String[] newV = newVersion.split("-"); -// log.trace("comparing " + oldV[0] + " to " + newV[0]); -// if (oldV[0].compareTo(newV[0]) < 0) { -// log.debug("update required"); -// return true; -// } else { -// log.trace("comparing " + oldV[oldV.length - 1] + " to " + newV[newV.length - 1]); -// if (oldV[oldV.length - 1].compareTo(newV[newV.length - 1]) < 0) { -// log.debug("update required"); -// return true; -// } else { -// log.debug("no update required"); -// return false; -// } -// } -// } -// log.debug("unknown new version, do not update"); -// return true; -// } -// log.debug("unknown old version, update required"); -// return true; -// } protected static void backupAndDelete(File dir, URI relativeTo, ZipOutputStream zip) throws IOException { if (dir.isDirectory()) { File[] subDirs = dir.listFiles(); @@ -454,8 +420,7 @@ public class Configurator { passwdWriter.write(password); passwdWriter.close(); if (!passwdFile.setReadable(false, false) || !passwdFile.setReadable(true, true)) { - passwdFile.delete(); - throw new IOException("failed to make " + passwdFile + " owner readable only, deleting file"); + log.error("failed to make " + passwdFile + " owner readable only (certain file-systems do not support owner's permissions)"); } TLSServerCA ca = new TLSServerCA(); KeyStore ks = ca.generateKeyStore(password); diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index 4ae3b060..08a0808a 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -151,7 +151,7 @@ public class Container { perms.add(new RuntimePermission("getClassLoader"));
// standard permissions
- perms.add(new PropertyPermission("*", "read"));
+ perms.add(new PropertyPermission("*", "read,write"));
perms.add(new RuntimePermission("accessDeclaredMembers"));
perms.add(new RuntimePermission("accessClassInPackage.*"));
perms.add(new RuntimePermission("defineClassInPackage.*"));
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java index f7be7b65..23d832a2 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java @@ -1,27 +1,33 @@ package at.gv.egiz.bku.webstart;
+import at.gv.egiz.bku.webstart.gui.BKUControllerInterface;
+import at.gv.egiz.bku.webstart.gui.TrayMenuListener;
import iaik.asn1.CodingException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Locale;
-import java.util.MissingResourceException;
import java.util.ResourceBundle;
import javax.jnlp.UnavailableServiceException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import at.gv.egiz.bku.webstart.ui.BKUControllerInterface;
-import at.gv.egiz.bku.webstart.ui.TrayIconDialog;
import com.sun.javaws.security.JavaWebStartSecurity;
+import java.awt.AWTException;
import java.awt.Desktop;
+import java.awt.Image;
+import java.awt.MenuItem;
+import java.awt.PopupMenu;
import java.awt.SplashScreen;
+import java.awt.SystemTray;
+import java.awt.TrayIcon;
import java.net.BindException;
import java.net.URI;
import java.net.URL;
import java.security.GeneralSecurityException;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
+import javax.imageio.ImageIO;
import javax.jnlp.BasicService;
import javax.jnlp.ServiceManager;
import org.mortbay.util.MultiException;
@@ -31,18 +37,26 @@ public class Launcher implements BKUControllerInterface { public static final String WEBAPP_RESOURCE = "BKULocal.war";
public static final String CERTIFICATES_RESOURCE = "BKUCertificates.jar";
public static final String WEBAPP_FILE = "BKULocal.war";
- public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/ui/UIMessages";
+ public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/messages";
+ public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/logo_";
/** resource bundle messages */
- public static final String GREETING_CAPTION = "Greetings.Caption";
- public static final String GREETING_MESSAGE = "Greetings.Message";
- public static final String CONFIG_CAPTION = "Config.Caption";
- public static final String CONFIG_MESSAGE = "Config.Message";
- public static final String STARTUP_CAPTION = "Startup.Caption";
- public static final String STARTUP_MESSAGE = "Startup.Message";
- public static final String ERROR_CAPTION = "Error.Caption";
- public static final String ERROR_STARTUP_MESSAGE = "Error.Startup.Message";
- public static final String ERROR_CONF_MESSAGE = "Error.Conf.Message";
- public static final String ERROR_BIND_MESSAGE = "Error.Bind.Message";
+ public static final String CAPTION_DEFAULT = "tray.caption.default";
+ public static final String CAPTION_ERROR = "tray.caption.error";
+ public static final String MESSAGE_START = "tray.message.start";
+ public static final String MESSAGE_START_OFFLINE = "tray.message.start.offline";
+ public static final String MESSAGE_CONFIG = "tray.message.config";
+ public static final String MESSAGE_CERTS = "tray.message.certs";
+ public static final String MESSAGE_FINISHED = "tray.message.finished";
+ public static final String MESSAGE_SHUTDOWN = "tray.message.shutdown";
+ public static final String ERROR_START = "tray.error.start";
+ public static final String ERROR_CONFIG = "tray.error.config";
+ public static final String ERROR_BIND = "tray.error.bind";
+ public static final String LABEL_SHUTDOWN = "tray.label.shutdown";
+ public static final String LABEL_PIN = "tray.label.pin";
+ public static final String LABEL_ABOUT = "tray.label.about";
+ public static final String TOOLTIP_DEFAULT = "tray.tooltip.default";
+
+ /** local bku uri */
public static final URI HTTPS_SECURITY_LAYER_URI;
private static Log log = LogFactory.getLog(Launcher.class);
@@ -56,7 +70,6 @@ public class Launcher implements BKUControllerInterface { HTTPS_SECURITY_LAYER_URI = tmp;
}
}
-
public static final String version;
static {
String tmp = Configurator.UNKOWN_VERSION;
@@ -78,16 +91,107 @@ public class Launcher implements BKUControllerInterface { log.info("BKU Web Start " + version);
}
}
-
private Configurator config;
private Container server;
private BasicService basicService;
+ private TrayIcon trayIcon;
+ private ResourceBundle messages;
+
+ public Launcher() {
+ if (log.isTraceEnabled()) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm instanceof JavaWebStartSecurity) {
+ System.setSecurityManager(new LogSecurityManager((JavaWebStartSecurity) sm));
+ }
+ }
+ messages = ResourceBundle.getBundle(MESSAGES_RESOURCE, Locale.getDefault());
+ trayIcon = initTrayIcon();
+ }
+
+ public void launch() throws Exception {
+ initStart();
+ try {
+ initConfig();
+ } catch (Exception ex) {
+ log.fatal("Failed to initialize configuration", ex);
+ trayIcon.displayMessage(messages.getString(CAPTION_ERROR),
+ messages.getString(ERROR_CONFIG), TrayIcon.MessageType.ERROR);
+ throw ex;
+ }
+ try {
+ startServer();
+ initFinished();
+ } catch (BindException ex) {
+ log.fatal("Failed to launch server, " + ex.getMessage(), ex);
+ trayIcon.displayMessage(messages.getString(CAPTION_ERROR),
+ messages.getString(ERROR_BIND), TrayIcon.MessageType.ERROR);
+ throw ex;
+ } catch (MultiException ex) {
+ log.fatal("Failed to launch server, " + ex.getMessage(), ex);
+ if (ex.getThrowable(0) instanceof BindException) {
+ trayIcon.displayMessage(messages.getString(CAPTION_ERROR),
+ messages.getString(ERROR_BIND), TrayIcon.MessageType.ERROR);
+ } else {
+ trayIcon.displayMessage(messages.getString(CAPTION_ERROR),
+ messages.getString(ERROR_START), TrayIcon.MessageType.ERROR);
+ }
+ throw ex;
+ } catch (Exception ex) {
+ log.fatal("Failed to launch server, " + ex.getMessage(), ex);
+ trayIcon.displayMessage(messages.getString(CAPTION_ERROR),
+ messages.getString(ERROR_START), TrayIcon.MessageType.ERROR);
+ throw ex;
+ }
+ }
+
+ private TrayIcon initTrayIcon() { //ResourceBundle messages, BKUControllerInterface bkuHook) {
+ if (SystemTray.isSupported()) {
+ try {
+ // get the SystemTray instance
+ SystemTray tray = SystemTray.getSystemTray();
+ log.debug("TrayIcon size: " + tray.getTrayIconSize());
+ String iconResource = (tray.getTrayIconSize().height < 25)
+ ? TRAYICON_RESOURCE + "24.png"
+ : TRAYICON_RESOURCE + "32.png";
+ Image image = ImageIO.read(Launcher.class.getClassLoader().getResourceAsStream(iconResource));
+
+ TrayMenuListener listener = new TrayMenuListener(this, messages, version);
+ PopupMenu popup = new PopupMenu();
+
+ MenuItem shutdownItem = new MenuItem(messages.getString(LABEL_SHUTDOWN));
+ shutdownItem.addActionListener(listener);
+ shutdownItem.setActionCommand(TrayMenuListener.SHUTDOWN_COMMAND);
+ popup.add(shutdownItem);
+
+ MenuItem aboutItem = new MenuItem(messages.getString(LABEL_ABOUT));
+ aboutItem.setActionCommand(TrayMenuListener.ABOUT_COMMAND);
+ aboutItem.addActionListener(listener);
+ popup.add(aboutItem);
+
+ TrayIcon ti = new TrayIcon(image, messages.getString(TOOLTIP_DEFAULT), popup);
+ ti.addActionListener(listener);
+ tray.add(ti);
+ return ti;
+ } catch (AWTException ex) {
+ log.error("Failed to init tray icon", ex);
+ } catch (IOException ex) {
+ log.error("Failed to load tray icon image", ex);
+ }
+ } else {
+ log.error("No system tray support");
+ }
+ return null;
+ }
private void initStart() {
try {
+ trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT),
+ messages.getString(MESSAGE_START), TrayIcon.MessageType.INFO);
basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
if (basicService.isOffline()) {
log.info("launching MOCCA Web Start offline");
+ trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT),
+ messages.getString(MESSAGE_START_OFFLINE), TrayIcon.MessageType.INFO);
} else {
log.info("launching MOCCA Web Start online");
}
@@ -96,30 +200,20 @@ public class Launcher implements BKUControllerInterface { }
}
- private void initTrayIcon() {
- log.debug("init MOCCA tray icon");
- Locale loc = Locale.getDefault();
- ResourceBundle resourceBundle;
- try {
- resourceBundle = ResourceBundle.getBundle(
- MESSAGES_RESOURCE, loc);
- } catch (MissingResourceException mx) {
- resourceBundle = ResourceBundle.getBundle(
- MESSAGES_RESOURCE, Locale.ENGLISH);
- }
- TrayIconDialog.getInstance().init(resourceBundle);
- TrayIconDialog.getInstance().setShutdownHook(this);
-// TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE);
- }
-
private void initConfig() throws IOException, CodingException, GeneralSecurityException {
+ trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT),
+ messages.getString(MESSAGE_CONFIG), TrayIcon.MessageType.INFO);
config = new Configurator();
config.ensureConfiguration();
+ trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT),
+ messages.getString(MESSAGE_CERTS), TrayIcon.MessageType.INFO);
config.ensureCertificates();
}
private void startServer() throws Exception {
log.info("init servlet container and MOCCA webapp");
+// trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT),
+// messages.getString(MESSAGE_START), TrayIcon.MessageType.INFO);
server = new Container();
server.init();
server.start();
@@ -127,6 +221,8 @@ public class Launcher implements BKUControllerInterface { private void initFinished() {
try {
+ trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT),
+ messages.getString(MESSAGE_FINISHED), TrayIcon.MessageType.INFO);
// standalone (non-webstart) version has splashscreen
if (SplashScreen.getSplashScreen() != null) {
try {
@@ -162,6 +258,8 @@ public class Launcher implements BKUControllerInterface { @Override
public void shutDown() {
log.info("Shutting down server");
+ trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT),
+ messages.getString(MESSAGE_SHUTDOWN), TrayIcon.MessageType.INFO);
if ((server != null) && (server.isRunning())) {
try {
if (server.isRunning()) {
@@ -179,51 +277,13 @@ public class Launcher implements BKUControllerInterface { }
public static void main(String[] args) throws InterruptedException, IOException {
-
- if (log.isTraceEnabled()) {
- SecurityManager sm = System.getSecurityManager();
- if (sm instanceof JavaWebStartSecurity) {
- System.setSecurityManager(new LogSecurityManager((JavaWebStartSecurity) sm));
- }
- }
-
- Launcher launcher = new Launcher();
- launcher.initStart();
- launcher.initTrayIcon(); //keep reference? BKULauncher not garbage collected after main()
-
try {
- TrayIconDialog.getInstance().displayInfo(CONFIG_CAPTION, CONFIG_MESSAGE);
- launcher.initConfig();
+ Launcher launcher = new Launcher();
+ launcher.launch();
} catch (Exception ex) {
- log.fatal("Failed to initialize configuration", ex);
- TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_CONF_MESSAGE);
- Thread.sleep(5000);
- System.exit(-1000);
- }
-
- try {
- TrayIconDialog.getInstance().displayInfo(STARTUP_CAPTION, STARTUP_MESSAGE);
- launcher.startServer();
- TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE);
- launcher.initFinished();
- } catch (BindException ex) {
- log.fatal("Failed to launch server, " + ex.getMessage(), ex);
- TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE);
- Thread.sleep(5000);
- System.exit(-1000);
- } catch (MultiException ex) {
- log.fatal("Failed to launch server, " + ex.getMessage(), ex);
- if (ex.getThrowable(0) instanceof BindException) {
- TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE);
- } else {
- TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE);
- }
- Thread.sleep(5000);
- System.exit(-1000);
- } catch (Exception e) {
- log.fatal("Failed to launch server, " + e.getMessage(), e);
- TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE);
+ log.info("waiting to shutdown...");
Thread.sleep(5000);
+ log.info("exit");
System.exit(-1000);
}
}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form new file mode 100644 index 00000000..c1cfdab7 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> + <Properties> + <Property name="defaultCloseOperation" type="int" value="2"/> + <Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="at/gv/egiz/bku/webstart/messages.properties" key="about.frame.title" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> + </Property> + </Properties> + <SyntheticProperties> + <SyntheticProperty name="formSizePolicy" type="int" value="1"/> + </SyntheticProperties> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jPanel1" alignment="1" max="32767" attributes="0"/> + <Component id="jPanel3" alignment="1" max="32767" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jPanel1" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="12" max="32767" attributes="0"/> + <Component id="jPanel3" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel1"> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel3" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel2" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/at/gv/egiz/bku/webstart/logo_notext.png"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="getVersionText(bundle)" type="code"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="at/gv/egiz/bku/webstart/messages.properties" key="about.title" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> + </Property> + </Properties> + </Component> + </SubComponents> + </Container> + <Container class="javax.swing.JPanel" name="jPanel3"> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <EmptySpace pref="157" max="32767" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="at/gv/egiz/bku/webstart/messages.properties" key="button.close" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> + </SubComponents> +</Form> diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java new file mode 100644 index 00000000..efa80bd6 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java @@ -0,0 +1,162 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * AboutDialog.java + * + * Created on 18.08.2009, 11:54:44 + */ + +package at.gv.egiz.bku.webstart.gui; + +import java.text.Format; +import java.text.MessageFormat; +import java.util.ResourceBundle; + +/** + * + * @author clemens + */ +public class AboutDialog extends javax.swing.JDialog { + + /** Creates new form AboutDialog */ + public AboutDialog(java.awt.Frame parent, boolean modal, String version) { + super(parent, modal); + this.version = version; + initComponents(); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jPanel3 = new javax.swing.JPanel(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("at/gv/egiz/bku/webstart/messages"); // NOI18N + setTitle(bundle.getString("about.frame.title")); // NOI18N + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/at/gv/egiz/bku/webstart/logo_notext.png"))); // NOI18N + + jLabel2.setText(getVersionText(bundle)); + + jLabel3.setText(bundle.getString("about.title")); // NOI18N + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel2)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel2)) + ); + + jButton1.setText(bundle.getString("button.close")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addContainerGap(157, Short.MAX_VALUE) + .addComponent(jButton1) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + private String getVersionText(ResourceBundle bundle) { + return MessageFormat.format(bundle.getString("about.version"), version); + } + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + setVisible(false); + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + AboutDialog dialog = new AboutDialog(new javax.swing.JFrame(), true, "1.2.3"); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel3; + // End of variables declaration//GEN-END:variables + + private String version; +} 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/gui/BKUControllerInterface.java index fd9838f9..886b55f7 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.webstart.ui; +package at.gv.egiz.bku.webstart.gui; public interface BKUControllerInterface { diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java new file mode 100644 index 00000000..1e5efe8e --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java @@ -0,0 +1,75 @@ +/* + * 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.gui; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.util.ResourceBundle; +import javax.swing.JFrame; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> + */ +public class TrayMenuListener implements ActionListener { + + /** action commands for tray menu */ + public static final String SHUTDOWN_COMMAND = "shutdown"; + public static final String PIN_COMMAND = "pin"; + public static final String ABOUT_COMMAND = "about"; + + private static final Log log = LogFactory.getLog(TrayMenuListener.class); + + protected BKUControllerInterface bku; + protected ResourceBundle messages; + protected String version; + protected AboutDialog aboutDialog; + + public TrayMenuListener(BKUControllerInterface bkuHook, ResourceBundle messages, String version) { + this.messages = messages; + this.version = version; + this.bku = bkuHook; + } + + @Override + public void actionPerformed(ActionEvent e) { + if (SHUTDOWN_COMMAND.equals(e.getActionCommand())) { + log.debug("shutdown requested via tray menu"); + bku.shutDown(); + } else if (ABOUT_COMMAND.equals(e.getActionCommand())) { + log.debug("about dialog requested via tray menu"); + if (aboutDialog == null) { + aboutDialog = new AboutDialog(new JFrame(), true, version); + aboutDialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + aboutDialog.setVisible(false); + } + }); + } + aboutDialog.setLocationByPlatform(true); + aboutDialog.setVisible(true); + } else if (PIN_COMMAND.equals(e.getActionCommand())) { + log.error("not implemented yet."); + } else { + log.error("unknown tray menu command: " + e.getActionCommand()); + } + } +} 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 diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_24.png b/BKUWebStart/src/main/jnlp/resources/img/logo_24.png Binary files differnew file mode 100644 index 00000000..a9074f01 --- /dev/null +++ b/BKUWebStart/src/main/jnlp/resources/img/logo_24.png diff --git a/BKUWebStart/src/main/jnlp/resources/img/splash.png b/BKUWebStart/src/main/jnlp/resources/img/splash.png Binary files differindex 72c1d868..597fbc60 100644 --- a/BKUWebStart/src/main/jnlp/resources/img/splash.png +++ b/BKUWebStart/src/main/jnlp/resources/img/splash.png diff --git a/BKUWebStart/src/main/jnlp/resources/img/version.xml b/BKUWebStart/src/main/jnlp/resources/img/version.xml index 31f43441..1ba3ecda 100644 --- a/BKUWebStart/src/main/jnlp/resources/img/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/img/version.xml @@ -2,43 +2,29 @@ <jnlp-versions> <resource> <pattern> - <name>logo_16.xpm</name> - <version-id>1.0-SNAPSHOT</version-id> + <name>logo_24</name> + <version-id>1.0</version-id> </pattern> - <file>logo_16.xpm</file> + <file>logo_24.png</file> </resource> <resource> <pattern> - <name>logo_16.ico</name> - <version-id>1.0-SNAPSHOT</version-id> - </pattern> - <file>logo_16.ico</file> - </resource> - <resource> - <pattern> - <name>logo_16.png</name> - <version-id>1.0-SNAPSHOT</version-id> - </pattern> - <file>logo_16.png</file> - </resource> - <resource> - <pattern> - <name>logo_32.png</name> - <version-id>1.0-SNAPSHOT</version-id> + <name>logo_32</name> + <version-id>1.0</version-id> </pattern> <file>logo_32.png</file> </resource> <resource> <pattern> - <name>logo_64.png</name> - <version-id>1.0-SNAPSHOT</version-id> + <name>logo_64</name> + <version-id>1.0</version-id> </pattern> <file>logo_64.png</file> </resource> <resource> <pattern> - <name>splash.png</name> - <version-id>1.0-SNAPSHOT</version-id> + <name>splash</name> + <version-id>2.0</version-id> </pattern> <file>splash.png</file> </resource> diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml index 9135ba1b..80447c89 100644 --- a/BKUWebStart/src/main/jnlp/template-local.xml +++ b/BKUWebStart/src/main/jnlp/template-local.xml @@ -10,7 +10,9 @@ <description>$project.Description (BKU) MOCCA Web Start</description> <description kind="short">$project.Description</description> <!--icon kind="shortcut" href="img/logo_16.ico" width="16" height="16" version="1.0-SNAPSHOT"/--> + <icon kind="shortcut" href="img/logo_24.png" width="24" height="24"/> <icon kind="shortcut" href="img/logo_32.png" width="32" height="32"/> + <icon kind="default" href="img/logo_24.png" width="24" height="24"/> <icon kind="default" href="img/logo_32.png" width="32" height="32"/> <icon kind="default" href="img/logo_64.png" width="64" height="64"/> <icon kind="splash" href="img/splash.png"/> diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 0176376a..bbc4c466 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -10,10 +10,10 @@ <description>$project.Description (BKU) MOCCA Web Start</description> <description kind="short">$project.Description</description> <!--icon kind="shortcut" href="img/logo_16.ico" width="16" height="16" version="1.0-SNAPSHOT"/--> - <icon kind="shortcut" href="img/logo_32.png" width="32" height="32" version="1.0-SNAPSHOT"/> - <icon kind="default" href="img/logo_32.png" width="32" height="32" version="1.0-SNAPSHOT"/> - <icon kind="default" href="img/logo_64.png" width="64" height="64" version="1.0-SNAPSHOT"/> - <icon kind="splash" href="img/splash.png" version="1.0-SNAPSHOT"/> + <icon kind="shortcut" href="img/logo_32.png" width="32" height="32" version="1.0"/> + <icon kind="default" href="img/logo_32.png" width="32" height="32" version="1.0"/> + <icon kind="default" href="img/logo_64.png" width="64" height="64" version="1.0"/> + <icon kind="splash" href="img/splash.png" version="2.0"/> <shortcut online="false"> <desktop/> <menu submenu="e-Government"/> diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png Binary files differnew file mode 100644 index 00000000..a9074f01 --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png Binary files differnew file mode 100644 index 00000000..3c77d179 --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png Binary files differnew file mode 100644 index 00000000..407f3b3e --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties new file mode 100644 index 00000000..d965f970 --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties @@ -0,0 +1,35 @@ +# 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. + +tray.caption.default=B\u00FCrgerkarte +tray.caption.error=Fehler +tray.message.start=B\u00FCrgerkartenumgebung wird gestartet... +tray.message.start.offline=B\u00FCrgerkartenumgebung wird offline gestartet... +tray.message.config=Konfiguration wird geladen +tray.message.certs=Zertifikate werden geladen +tray.message.finished=B\u00FCrgerkartenumgebung erfolgreich gestartet +tray.message.shutdown=B\u00FCrgerkartenumgebung wird beendet +tray.error.start=B\u00FCrgerkartenumgebung konnte nicht gestartet werden +tray.error.config=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet +tray.error.bind=Die f\u00FCr die B\u00FCrgerkartenumgebung reservierte Adresse wird bereits von einem anderen Dienst verwendet +tray.label.shutdown=Beenden +tray.label.pin=PIN Verwaltung +tray.label.about=\u00DCber... +tray.tooltip.default=B\u00FCrgerkartenumgebung +about.frame.title=B\u00FCrgerkarte +about.title=<html>B\u00FCrgerkartenumgebung +about.version=<html>Version: {0} +button.ok=Best\u00E4tigen +button.close=Schlie\u00DFen diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/splash.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/splash.png Binary files differnew file mode 100644 index 00000000..597fbc60 --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/splash.png diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties deleted file mode 100644 index bf4e5b8a..00000000 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties +++ /dev/null @@ -1,20 +0,0 @@ -#-------- tray icon messages -------
-TrayMenu.Tooltip=B\u00FCrgerkartenumgebung
-TrayMenu.Shutdown=B\u00FCrgerkartenumgebung beenden
-
-Config.Message=Zertifikate werden geladen
-Config.Caption=B\u00FCrgerkartenumgebung
-Startup.Message=B\u00FCrgerkartenumgebung wird gestartet...
-Startup.Caption=B\u00FCrgerkartenumgebung
-Greetings.Message=B\u00FCrgerkartenumgebung erfolgreich gestartet
-Greetings.Caption=B\u00FCrgerkartenumgebung
-Error.Caption=Fehler
-Error.Startup.Message=B\u00FCrgerkartenumgebung konnte nicht gestartet werden
-Error.Conf.Message=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet
-Error.Bind.Message=Die f\u00FCr die B\u00FCrgerkartenumgebung reservierte Adresse wird bereits von einem anderen Dienst verwendet
-Message.RequestCaption=New Request
-Message.InfoboxReadRequest=Reading Infobox
-Message.SecureSignatureKeypair=Reading secure signature certificate
-Message.CertifiedKeypair=Reading certified certificate
-Message.IdentityLink=Reading Identitylink
-Message.SignRequest=Creating Signature
\ No newline at end of file diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png Binary files differdeleted file mode 100644 index 2d0276de..00000000 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png +++ /dev/null diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png Binary files differdeleted file mode 100644 index f84f108d..00000000 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png +++ /dev/null diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png Binary files differdeleted file mode 100644 index 2c622d88..00000000 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png +++ /dev/null diff --git a/BKUWebStart/src/main/resources/logo_32x32.png b/BKUWebStart/src/main/resources/logo_32x32.png Binary files differdeleted file mode 100644 index 337b144b..00000000 --- a/BKUWebStart/src/main/resources/logo_32x32.png +++ /dev/null diff --git a/BKUWebStart/src/main/resources/logo_90x90.png b/BKUWebStart/src/main/resources/logo_90x90.png Binary files differdeleted file mode 100644 index d7f8bbd0..00000000 --- a/BKUWebStart/src/main/resources/logo_90x90.png +++ /dev/null diff --git a/BKUWebStart/src/main/resources/logo_RGB22x22.png b/BKUWebStart/src/main/resources/logo_RGB22x22.png Binary files differdeleted file mode 100644 index 598ab00b..00000000 --- a/BKUWebStart/src/main/resources/logo_RGB22x22.png +++ /dev/null diff --git a/BKUWebStart/src/main/resources/logo_RGB32x32.png b/BKUWebStart/src/main/resources/logo_RGB32x32.png Binary files differdeleted file mode 100644 index 2c622d88..00000000 --- a/BKUWebStart/src/main/resources/logo_RGB32x32.png +++ /dev/null diff --git a/BKUWebStart/src/main/resources/splash_standalone.png b/BKUWebStart/src/main/resources/splash_standalone.png Binary files differdeleted file mode 100644 index 72c1d868..00000000 --- a/BKUWebStart/src/main/resources/splash_standalone.png +++ /dev/null diff --git a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java index 0c08a276..0ea126cb 100644 --- a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java +++ b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java @@ -119,6 +119,30 @@ public class ConfiguratorTest { assertEquals(expResult, result); oldVersion = "1.0.9-SNAPSHOT-r123"; + minVersion = "1.0.10-r432"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-r123"; + minVersion = "1.0.10-SNAPSHOT"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-r123"; + minVersion = "1.0.9-SNAPSHOT"; + expResult = false; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-SNAPSHOT"; + minVersion = "1.0.9-r349"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-SNAPSHOT-r123"; minVersion = "1.0.10-SNAPSHOT"; expResult = true; result = Configurator.updateRequired(oldVersion, minVersion); |