Skip to content

Commit b1d1e48

Browse files
authored
Merge pull request #12 from Prem0707/GSoC18
created a frame containing all the tasks available for sequence
2 parents cd2fe35 + 0d4c71f commit b1d1e48

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package gov.doe.jgi.boost.client.utils;
2+
3+
import java.awt.Desktop;
4+
import java.net.URI;
5+
6+
import javax.swing.JOptionPane;
7+
8+
public class UIUtils {
9+
10+
public static void openWebPage(String url) {
11+
try {
12+
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
13+
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
14+
desktop.browse(new URI(url));
15+
}
16+
throw new NullPointerException();
17+
} catch (Exception e) {
18+
JOptionPane.showMessageDialog(null, url, "", JOptionPane.PLAIN_MESSAGE);
19+
}
20+
}
21+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package gov.doe.jgi.boost.ui;
2+
import javax.swing.JFrame;
3+
import javax.swing.GroupLayout;
4+
import javax.swing.GroupLayout.Alignment;
5+
import javax.swing.JLabel;
6+
import javax.swing.JRadioButton;
7+
import javax.swing.LayoutStyle.ComponentPlacement;
8+
import javax.swing.JButton;
9+
10+
public class AvailableTasksBOOST{
11+
12+
private JFrame frame;
13+
private JLabel instructionText;
14+
private JRadioButton reverseTranstationBtn;
15+
private JRadioButton codonJugglingBtn;
16+
private JRadioButton sequenceModificationBtn;
17+
private JRadioButton sequencePartitionBtn;
18+
private JButton cancelButton;
19+
private JButton submitButton;
20+
21+
public AvailableTasksBOOST() {
22+
23+
JFrame frame = new JFrame("Abailable Operations for Sequence");
24+
frame.setSize(500, 270);
25+
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
26+
placeComponents(frame);
27+
frame.setVisible(true);
28+
}
29+
30+
private void placeComponents(JFrame jFrame) {
31+
32+
GroupLayout layout = new GroupLayout(jFrame.getContentPane());
33+
jFrame.getContentPane().setLayout(layout);
34+
layout.setAutoCreateGaps(true);
35+
layout.setAutoCreateContainerGaps(true);
36+
37+
instructionText = new JLabel("Please select the operaton(s) you want to perform with your sequence");
38+
reverseTranstationBtn = new JRadioButton("Reverse-Translation of protein to DNA sequences");
39+
codonJugglingBtn = new JRadioButton("Codon-Juggling of protein coding DNA sequences");
40+
sequenceModificationBtn = new JRadioButton("Modification of protein coding sequences (\"CDS\") for efficient synthesis");
41+
sequencePartitionBtn = new JRadioButton("Partition of large DNA sequences into synthesizable building blocks");
42+
43+
cancelButton = new JButton("Cancel");
44+
submitButton = new JButton("Submit");
45+
46+
layout.setHorizontalGroup(
47+
layout.createParallelGroup(Alignment.LEADING)
48+
.addGroup(layout.createParallelGroup(Alignment.LEADING)
49+
.addComponent(sequenceModificationBtn)
50+
.addComponent(sequencePartitionBtn)
51+
.addComponent(codonJugglingBtn)
52+
.addComponent(reverseTranstationBtn)
53+
.addGroup(layout.createParallelGroup(Alignment.TRAILING, false)
54+
.addGroup(Alignment.LEADING, layout.createSequentialGroup()
55+
.addComponent(cancelButton)
56+
.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
57+
.addComponent(submitButton))
58+
.addComponent(instructionText, Alignment.LEADING))));
59+
60+
layout.setVerticalGroup(
61+
layout.createParallelGroup(Alignment.LEADING)
62+
.addGroup(layout.createSequentialGroup()
63+
.addGap(26)
64+
.addComponent(instructionText)
65+
.addGap(28)
66+
.addComponent(reverseTranstationBtn)
67+
.addPreferredGap(ComponentPlacement.UNRELATED)
68+
.addComponent(codonJugglingBtn)
69+
.addPreferredGap(ComponentPlacement.UNRELATED)
70+
.addComponent(sequenceModificationBtn)
71+
.addPreferredGap(ComponentPlacement.UNRELATED)
72+
.addComponent(sequencePartitionBtn)
73+
.addPreferredGap(ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
74+
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
75+
.addComponent(cancelButton)
76+
.addComponent(submitButton))
77+
.addGap(29)));
78+
79+
jFrame.pack();
80+
jFrame.setLocationRelativeTo(null);
81+
jFrame.setResizable(true);
82+
}
83+
}

0 commit comments

Comments
 (0)