21import java.awt.BorderLayout;
22import java.awt.event.ActionEvent;
23import java.awt.event.ActionListener;
26import java.util.concurrent.atomic.AtomicInteger;
28import javax.swing.JButton;
29import javax.swing.JComponent;
30import javax.swing.JOptionPane;
32import denoptim.files.FileFormat;
33import denoptim.files.FileUtils;
52 public static AtomicInteger
CPMapTabUID =
new AtomicInteger(1);
73 super.setLayout(
new BorderLayout());
85 this.setLayout(
new BorderLayout());
96 super.add(commandsPane, BorderLayout.SOUTH);
100 btnLoadCPMap.setToolTipText(String.format(
"<html><body width='%1s'>"
101 +
"Reads from file all compatibility matrix data including: "
102 +
"<ul><li>APClass compatibility rules</li>"
103 +
"<li>APClass-to-Bond order rules</li>"
104 +
"<li>Capping rules</li>"
105 +
"<li>Forbidden ends definitions.</li></ul></html>",250));
107 public void actionPerformed(ActionEvent e) {
109 if (inFile ==
null || inFile.getAbsolutePath().equals(
""))
120 +
"<body width='%1s'>Appends all APClasses to the list of "
121 +
"all classes in the current tab.</html>",300));
123 public void actionPerformed(ActionEvent e) {
126 if (files ==
null || files.size() == 0)
131 String[] options =
new String[]{
"Cancel",
133 "Scaffolds and Fragments"};
135 "What type of building block are the imported "
136 +
"APClasses meant for?",
137 "Select Role for Imported APClasses",
139 JOptionPane.QUESTION_MESSAGE,
148 }
else if (res == 2) {
157 JButton btnSaveFrags =
new JButton(
"Save Compatibility Matrix");
158 btnSaveFrags.setToolTipText(String.format(
"<html><body width='%1s'>"
159 +
"Writes to file all compatibility matrix data including: "
160 +
"<ul><li>APClass compatibility rules</li>"
161 +
"<li>APClass-to-Bond order conversion rules</li>"
162 +
"<li>Capping rules</li>"
163 +
"<li>Definition of forbidden ends.</li></ul></html>",250));
164 btnSaveFrags.addActionListener(
new ActionListener() {
165 public void actionPerformed(ActionEvent e) {
176 commandsPane.
add(btnSaveFrags);
178 JButton btnCanc =
new JButton(
"Close Tab");
179 btnCanc.setToolTipText(
"Closes this compatibility matrix editor.");
181 commandsPane.
add(btnCanc);
183 JButton btnHelp =
new JButton(
"?");
184 btnHelp.setToolTipText(
"<html>Hover over the buttons and fields "
185 +
"to get a tip.</html>");
186 btnHelp.addActionListener(
new ActionListener() {
187 public void actionPerformed(ActionEvent e) {
188 String txt =
"<html><body width='%1s'>"
189 +
"<p>The Compatibility Matrix tab allows to create, "
190 +
"inspect, and edit "
191 +
"compatibility matrix data, which includes: "
193 +
"<li>the actual compatibility matrix,</li>"
194 +
"<li>the APClass-to-bond order map,</li>"
195 +
"<li>the APClass-capping rules,</li>"
196 +
"<li>the list of APClasses that cannot be left "
197 +
"unused (i.e., the forbidden ends)</li>"
198 +
"</ul></p></html>";
199 JOptionPane.showMessageDialog(btnHelp,
200 String.format(txt, 400),
202 JOptionPane.PLAIN_MESSAGE);
205 commandsPane.
add(btnHelp);
static void addToRecentFiles(String fileName, FileFormat ff)
Appends an entry to the list of recent files.
Remove the card from the deck of cards and takes care of removing also the entry in the list of activ...
Class of GUI panels meant to occupy one card in the deck-of-cards layout of the main panel.
GUIMainPanel mainPanel
The main panel (cards deck)
A panel for handling of compatibility matrix.
void importCPMapFromFile(JComponent parent, File inFile)
CompatibilityMatrixForm cpMapHandler
void initialize()
Initialize the panel and add buttons.
static AtomicInteger CPMapTabUID
Unique identified for instances of this inspector.
JButton btnImportAPClasses
static final long serialVersionUID
Version UID.
GUICompatibilityMatrixTab(GUIMainPanel mainPanel)
Constructor.
boolean unsavedChanges
Flag signaling that loaded data has changes since last save.
boolean hasUnsavedChanges()
Check whether there are unsaved changes.
File opener for DENOPTIM GUI.
static Set< File > pickManyFiles(Component parent)
static File pickFile(Component parent)
static File pickFileForSaving(Component parent)
The main panel is a deck of cards that occupies all the GUI frame.