Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jean
authored and
jean
committed
Jan 11, 2017
1 parent
4635981
commit 7423819
Showing
9 changed files
with
289 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ target | |
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
database-web.xml | ||
pom.xml.versionsBackup | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
https://files2.dorkbox.com/SystemTray_get/system_tray_RC6_javaFX.jar | ||
https://files2.dorkbox.com/SystemTray_get/system_tray_RC6_src.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
nexu-standalone/src/main/java/lu/nowina/nexu/systray/AWTSystrayMenuInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* © Nowina Solutions, 2015-2017 | ||
* | ||
* Concédée sous licence EUPL, version 1.1 ou – dès leur approbation par la Commission européenne - versions ultérieures de l’EUPL (la «Licence»). | ||
* Vous ne pouvez utiliser la présente œuvre que conformément à la Licence. | ||
* Vous pouvez obtenir une copie de la Licence à l’adresse suivante: | ||
* | ||
* http://ec.europa.eu/idabc/eupl5 | ||
* | ||
* Sauf obligation légale ou contractuelle écrite, le logiciel distribué sous la Licence est distribué «en l’état», | ||
* SANS GARANTIES OU CONDITIONS QUELLES QU’ELLES SOIENT, expresses ou implicites. | ||
* Consultez la Licence pour les autorisations et les restrictions linguistiques spécifiques relevant de la Licence. | ||
*/ | ||
package lu.nowina.nexu.systray; | ||
|
||
import java.awt.AWTException; | ||
import java.awt.Image; | ||
import java.awt.MenuItem; | ||
import java.awt.PopupMenu; | ||
import java.awt.SystemTray; | ||
import java.awt.Toolkit; | ||
import java.awt.TrayIcon; | ||
import java.net.URL; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import lu.nowina.nexu.api.SystrayMenuItem; | ||
import lu.nowina.nexu.api.flow.OperationFactory; | ||
|
||
/** | ||
* Implementation of {@link SystrayMenuInitializer} using AWT. | ||
* | ||
* @author Jean Lepropre (jean.lepropre@nowina.lu) | ||
*/ | ||
public class AWTSystrayMenuInitializer implements SystrayMenuInitializer { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(AWTSystrayMenuInitializer.class.getName()); | ||
|
||
public AWTSystrayMenuInitializer() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public void init(final String tooltip, final URL trayIconURL, final OperationFactory operationFactory, | ||
final SystrayMenuItem... systrayMenuItems) { | ||
if (SystemTray.isSupported()) { | ||
final PopupMenu popup = new PopupMenu(); | ||
|
||
for(final SystrayMenuItem systrayMenuItem : systrayMenuItems) { | ||
final MenuItem mi = new MenuItem(systrayMenuItem.getLabel()); | ||
mi.addActionListener((l) -> systrayMenuItem.getFutureOperationInvocation().call(operationFactory)); | ||
popup.add(mi); | ||
} | ||
|
||
final Image image = Toolkit.getDefaultToolkit().getImage(trayIconURL); | ||
final TrayIcon trayIcon = new TrayIcon(image, tooltip, popup); | ||
trayIcon.setImageAutoSize(true); | ||
|
||
try { | ||
SystemTray.getSystemTray().add(trayIcon); | ||
} catch (final AWTException e) { | ||
LOGGER.error("Cannot add TrayIcon", e); | ||
} | ||
} else { | ||
LOGGER.error("System tray is currently not supported."); | ||
} | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
nexu-standalone/src/main/java/lu/nowina/nexu/systray/DorkboxSystrayMenuInitializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* © Nowina Solutions, 2015-2017 | ||
* | ||
* Concédée sous licence EUPL, version 1.1 ou – dès leur approbation par la Commission européenne - versions ultérieures de l’EUPL (la «Licence»). | ||
* Vous ne pouvez utiliser la présente œuvre que conformément à la Licence. | ||
* Vous pouvez obtenir une copie de la Licence à l’adresse suivante: | ||
* | ||
* http://ec.europa.eu/idabc/eupl5 | ||
* | ||
* Sauf obligation légale ou contractuelle écrite, le logiciel distribué sous la Licence est distribué «en l’état», | ||
* SANS GARANTIES OU CONDITIONS QUELLES QU’ELLES SOIENT, expresses ou implicites. | ||
* Consultez la Licence pour les autorisations et les restrictions linguistiques spécifiques relevant de la Licence. | ||
*/ | ||
package lu.nowina.nexu.systray; | ||
|
||
import java.net.URL; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import dorkbox.systemTray.Menu; | ||
import dorkbox.systemTray.MenuItem; | ||
import dorkbox.systemTray.SystemTray; | ||
import lu.nowina.nexu.api.SystrayMenuItem; | ||
import lu.nowina.nexu.api.flow.OperationFactory; | ||
|
||
/** | ||
* Implementation of {@link SystrayMenuInitializer} using | ||
* <a href="https://github.com/dorkbox/SystemTray">SystemTray from Dorkbox</a>. | ||
* | ||
* @author Jean Lepropre (jean.lepropre@nowina.lu) | ||
*/ | ||
public class DorkboxSystrayMenuInitializer implements SystrayMenuInitializer { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(DorkboxSystrayMenuInitializer.class.getName()); | ||
|
||
public DorkboxSystrayMenuInitializer() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public void init(final String tooltip, final URL trayIconURL, final OperationFactory operationFactory, | ||
final SystrayMenuItem... systrayMenuItems) { | ||
final SystemTray systemTray = SystemTray.getNative(); | ||
if (systemTray == null) { | ||
LOGGER.warn("System tray is currently not supported."); | ||
return; | ||
} | ||
|
||
systemTray.setImage(trayIconURL); | ||
|
||
final Menu menu = systemTray.getMenu(); | ||
for(final SystrayMenuItem systrayMenuItem : systrayMenuItems) { | ||
menu.add(new MenuItem(systrayMenuItem.getLabel(), | ||
(e) -> systrayMenuItem.getFutureOperationInvocation().call(operationFactory))); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.