Skip to content

Commit

Permalink
šŸœ remove rGUI related dependency and usage in old code, remove bits.nā€¦
Browse files Browse the repository at this point in the history
ā€¦etbeans.org maven repository reference
  • Loading branch information
Enet4 committed Jul 31, 2016
1 parent 7aa5d66 commit 075ba25
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 6,663 deletions.
13 changes: 0 additions & 13 deletions dicoogle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@
<url>http://maven.restlet.org</url>
</repository>

<!--These are needed for Swing/Netbeans -->
<repository>
<id>maven2-repository.netbeans.maven2</id>
<name>Netbeans Maven Repository</name>
<url>http://bits.netbeans.org/maven2/</url>
<layout>default</layout>
</repository>
</repositories>

<build>
Expand Down Expand Up @@ -326,12 +319,6 @@
<version>1.8</version>
</dependency>

<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>RELEASE701</version>
</dependency>

<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]>
Expand Down Expand Up @@ -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;
}
}

}
Loading

0 comments on commit 075ba25

Please sign in to comment.