-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
š remove rGUI related dependency and usage in old code, remove bits.nā¦
ā¦etbeans.org maven repository reference
- Loading branch information
Showing
9 changed files
with
35 additions
and
6,663 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
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 |
---|---|---|
|
@@ -18,29 +18,12 @@ | |
*/ | ||
package pt.ua.dicoogle.rGUI.client.UIHelper; | ||
|
||
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.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.MouseEvent; | ||
import java.awt.event.MouseListener; | ||
import java.net.URL; | ||
import java.util.concurrent.Semaphore; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import pt.ua.dicoogle.rGUI.client.ClientCore; | ||
import pt.ua.dicoogle.rGUI.client.windows.About; | ||
import pt.ua.dicoogle.rGUI.client.windows.ClientOptions; | ||
import pt.ua.dicoogle.rGUI.client.windows.MainWindow; | ||
import pt.ua.dicoogle.rGUI.client.windows.ServerOptions; | ||
|
||
import java.awt.*; | ||
import java.net.URL; | ||
import java.util.concurrent.Semaphore; | ||
|
||
/** | ||
* @author Samuel Campos <[email protected]> | ||
|
@@ -70,159 +53,5 @@ public static Image getImage(final String pathAndFileName) { | |
final URL url = Thread.currentThread().getContextClassLoader().getResource(pathAndFileName); | ||
return Toolkit.getDefaultToolkit().getImage(url); | ||
} | ||
|
||
|
||
private TrayIconCreator() { | ||
setTrayIcon(); | ||
} | ||
|
||
|
||
private void setTrayIcon(){ | ||
if (SystemTray.isSupported()) { | ||
SystemTray tray = SystemTray.getSystemTray(); | ||
Image image = getImage("trayicon.gif"); | ||
|
||
MouseListener mouseListener = new MouseListener() { | ||
|
||
public void mouseClicked(MouseEvent e) { | ||
MainWindow m = MainWindow.getInstance(); | ||
|
||
if (e.getClickCount() == 2 && m.getExtendedState() == MainWindow.ICONIFIED) { | ||
m.setExtendedState(MainWindow.NORMAL); | ||
m.setVisible(true); | ||
} | ||
|
||
m.toFront(); | ||
} | ||
|
||
public void mouseEntered(MouseEvent e) { | ||
//System.out.println("Tray Icon - Mouse entered!"); | ||
} | ||
|
||
public void mouseExited(MouseEvent e) { | ||
//System.out.println("Tray Icon - Mouse exited!"); | ||
} | ||
|
||
public void mousePressed(MouseEvent e) { | ||
//System.out.println("Tray Icon - Mouse pressed!"); | ||
} | ||
|
||
public void mouseReleased(MouseEvent e) { | ||
//System.out.println("Tray Icon - Mouse released!"); | ||
} | ||
}; | ||
|
||
|
||
PopupMenu popup = new PopupMenu(); | ||
|
||
|
||
MenuItem mainItem = new MenuItem("Show Dicoogle Window"); | ||
mainItem.addActionListener(new ActionListener() { | ||
|
||
public void actionPerformed(ActionEvent e) { | ||
MainWindow m = MainWindow.getInstance(); | ||
|
||
m.setExtendedState(MainWindow.NORMAL); | ||
m.setVisible(true); | ||
m.toFront(); | ||
} | ||
}); | ||
|
||
popup.add(mainItem); | ||
popup.addSeparator(); | ||
|
||
|
||
ClientCore core = ClientCore.getInstance(); | ||
|
||
if(core.isAdmin()){ | ||
MenuItem settingsItem = new MenuItem("Server Preferences"); | ||
settingsItem.addActionListener(new ActionListener() { | ||
|
||
public void actionPerformed(ActionEvent e) { | ||
ServerOptions s = ServerOptions.getInstance(); | ||
s.setReturnToMain(false); | ||
s.setVisible(true); | ||
} | ||
}); | ||
|
||
|
||
popup.add(settingsItem); | ||
} | ||
|
||
if(core.isUser()){ | ||
MenuItem settingsItem = new MenuItem("Client Preferences"); | ||
settingsItem.addActionListener(new ActionListener() { | ||
|
||
public void actionPerformed(ActionEvent e) { | ||
ClientOptions s = ClientOptions.getInstance(); | ||
s.setVisible(true); | ||
} | ||
}); | ||
|
||
|
||
popup.add(settingsItem); | ||
} | ||
|
||
popup.addSeparator(); | ||
|
||
MenuItem aboutItem = new MenuItem("About"); | ||
aboutItem.addActionListener(new ActionListener() { | ||
|
||
public void actionPerformed(ActionEvent e) { | ||
About a = About.getInstance(); | ||
a.setReturnToMain(false); | ||
a.setVisible(true); | ||
} | ||
}); | ||
|
||
popup.add(aboutItem); | ||
popup.addSeparator(); | ||
|
||
MenuItem defaultItem = new MenuItem("Exit"); | ||
defaultItem.addActionListener(new ActionListener() { | ||
|
||
public void actionPerformed(ActionEvent e) { | ||
MainWindow m = MainWindow.getInstance(); | ||
m.dispatchEvent(new java.awt.event.WindowEvent(m, java.awt.Event.WINDOW_DESTROY)); | ||
} | ||
}); | ||
|
||
|
||
|
||
popup.add(defaultItem); | ||
|
||
trayIcon = new TrayIcon(image, "Dicoogle PACS", popup); | ||
|
||
ActionListener actionListener = new ActionListener() { | ||
|
||
public void actionPerformed(ActionEvent e) { | ||
} | ||
}; | ||
|
||
trayIcon.addActionListener(actionListener); | ||
trayIcon.setImageAutoSize(true); | ||
|
||
trayIcon.addMouseListener(mouseListener); | ||
|
||
try { | ||
tray.add(trayIcon); | ||
|
||
} catch (AWTException e) { | ||
//System.err.println("TrayIcon could not be added."); | ||
} | ||
|
||
} else { | ||
//DebugManager.getInstance().debug("System Tray is not supported"); | ||
} | ||
} | ||
|
||
public void distroyTrayIcon(){ | ||
if (SystemTray.isSupported()) { | ||
SystemTray tray = SystemTray.getSystemTray(); | ||
|
||
tray.remove(trayIcon); | ||
trayIcon = null; | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.