forked from RBVI/scNetViz
-
Notifications
You must be signed in to change notification settings - Fork 3
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
herme
committed
Feb 8, 2024
1 parent
5131b26
commit 5fa458a
Showing
15 changed files
with
297 additions
and
207 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
61 changes: 61 additions & 0 deletions
61
src/main/java/be/kuleuven/mgG/internal/tasks/AboutTask.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,61 @@ | ||
package be.kuleuven.mgG.internal.tasks; | ||
|
||
import java.awt.BorderLayout; | ||
import java.awt.Cursor; | ||
import java.awt.Desktop; | ||
import java.awt.event.MouseAdapter; | ||
import java.awt.event.MouseEvent; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
import javax.swing.BorderFactory; | ||
import javax.swing.BoxLayout; | ||
import javax.swing.JDialog; | ||
import javax.swing.JFrame; | ||
import javax.swing.JLabel; | ||
import javax.swing.JPanel; | ||
import javax.swing.SwingConstants; | ||
import javax.swing.SwingUtilities; | ||
|
||
import org.cytoscape.work.AbstractTask; | ||
import org.cytoscape.work.TaskMonitor; | ||
|
||
import be.kuleuven.mgG.internal.utils.AboutPanel; | ||
|
||
public class AboutTask extends AbstractTask { | ||
|
||
|
||
|
||
@Override | ||
public void run(TaskMonitor taskMonitor) throws Exception { | ||
SwingUtilities.invokeLater(this::showAboutPanel); | ||
} | ||
|
||
private void showAboutPanel() { | ||
// Create a new dialog to display the AboutPanel | ||
JDialog aboutDialog = new JDialog(); | ||
aboutDialog.setTitle("About MGG"); | ||
|
||
|
||
// make dialog modal | ||
aboutDialog.setModalityType(JDialog.ModalityType.APPLICATION_MODAL); | ||
|
||
// dialog always on top | ||
//aboutDialog.setAlwaysOnTop(true); | ||
|
||
// Add AboutPanel | ||
AboutPanel aboutPanel = new AboutPanel(); | ||
aboutDialog.add(aboutPanel); | ||
|
||
// dialog props | ||
aboutDialog.pack(); | ||
aboutDialog.setSize(200, 200); // Set the desired width and height | ||
aboutDialog.setLocationRelativeTo(null); // Center on screen | ||
aboutDialog.setVisible(true); | ||
|
||
} | ||
} | ||
|
||
|
||
|
24 changes: 24 additions & 0 deletions
24
src/main/java/be/kuleuven/mgG/internal/tasks/AboutTaskFactory.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,24 @@ | ||
package be.kuleuven.mgG.internal.tasks; | ||
|
||
import javax.swing.JFrame; | ||
|
||
import org.cytoscape.work.TaskFactory; | ||
import org.cytoscape.work.TaskIterator; | ||
|
||
public class AboutTaskFactory implements TaskFactory{ | ||
|
||
|
||
|
||
@Override | ||
public TaskIterator createTaskIterator() { | ||
|
||
return new TaskIterator(new AboutTask()); | ||
} | ||
|
||
@Override | ||
public boolean isReady() { | ||
|
||
return true; | ||
} | ||
|
||
} |
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
52 changes: 52 additions & 0 deletions
52
src/main/java/be/kuleuven/mgG/internal/utils/AboutPanel.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,52 @@ | ||
package be.kuleuven.mgG.internal.utils; | ||
|
||
import java.awt.BorderLayout; | ||
import java.awt.Cursor; | ||
import java.awt.Desktop; | ||
import java.awt.event.MouseAdapter; | ||
import java.awt.event.MouseEvent; | ||
import java.net.URI; | ||
|
||
import javax.swing.BorderFactory; | ||
import javax.swing.BoxLayout; | ||
import javax.swing.JLabel; | ||
import javax.swing.JPanel; | ||
|
||
|
||
public class AboutPanel extends JPanel { | ||
|
||
public AboutPanel() { | ||
setLayout(new BorderLayout()); | ||
|
||
// Main content | ||
JPanel contentPanel = new JPanel(); | ||
contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); | ||
contentPanel.add(new JLabel("Under Construction")); | ||
contentPanel.add(new JLabel("App Version: 0.9.2")); | ||
// | ||
add(contentPanel, BorderLayout.CENTER); | ||
|
||
// Link label | ||
JLabel linkLabel = new JLabel("<html><a href=''> Documentation</a></html>"); | ||
linkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); | ||
linkLabel.addMouseListener(new MouseAdapter() { | ||
public void mouseClicked(MouseEvent e) { | ||
openWebpage("https://hariszaf.github.io/microbetag/docs/cytoApp/"); | ||
} | ||
}); | ||
add(linkLabel, BorderLayout.SOUTH); | ||
|
||
|
||
setBorder(BorderFactory.createEtchedBorder()); | ||
} | ||
|
||
private void openWebpage(String url) { | ||
try { | ||
Desktop.getDesktop().browse(new URI(url)); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
|
||
|
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
Oops, something went wrong.