/*
* TestChooserFrame.java
*
* Created on 03 September 2006, 21:21
*/
package uk.co.bytemark.vm.enigma.inquisition.gui.screens;
/**
*
* @author Matt
*/
abstract public class AbstractQuestionSetSelectorFrame extends javax.swing.JFrame {
abstract protected javax.swing.JMenu createLAFMenu();
abstract protected javax.swing.JTree createQuestionSetTree();
/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of
* this method is always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
beginQuizButton = new javax.swing.JButton();
optionsPanel = new javax.swing.JPanel();
timeSlider = new javax.swing.JSlider();
shuffleCheckBox = new javax.swing.JCheckBox();
useTimerCheckBox = new javax.swing.JCheckBox();
stateOptionsNumberCheckBox = new javax.swing.JCheckBox();
timeTextLabel = new javax.swing.JLabel();
editQuizButton = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
questionSetTree = createQuestionSetTree();
addTestFromWebButton = new javax.swing.JButton();
addTestFromFileButton = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
descriptionText = new javax.swing.JTextPane();
jLabel3 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
numberOfQuestionsText = new javax.swing.JTextField();
menuBar = new javax.swing.JMenuBar();
fileMenuItem = new javax.swing.JMenu();
resumeQuizMenuItem = new javax.swing.JMenuItem();
addTestFromFileMenuItem = new javax.swing.JMenuItem();
addTestFromWebMenuItem = new javax.swing.JMenuItem();
exportQuestionSetAsHtmlMenuItem = new javax.swing.JMenuItem();
exitMenuItem = new javax.swing.JMenuItem();
toolsMenu = new javax.swing.JMenu();
editorMenuItem = new javax.swing.JMenuItem();
lafMenu = createLAFMenu();
helpMenu = new javax.swing.JMenu();
aboutMenuItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Inquisition - Choose a Quiz");
beginQuizButton.setText("Begin");
beginQuizButton.setEnabled(false);
beginQuizButton.setName("beginButton"); // NOI18N
beginQuizButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
beginQuizButtonActionPerformed(evt);
}
});
optionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Options"));
timeSlider.setName("timeSlider"); // NOI18N
timeSlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
timeSliderStateChanged(evt);
}
});
shuffleCheckBox.setSelected(true);
shuffleCheckBox.setText("Randomly shuffle question order");
shuffleCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
shuffleCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
shuffleCheckBox.setName("shuffleCheckBox"); // NOI18N
useTimerCheckBox.setSelected(true);
useTimerCheckBox.setText("Use timer");
useTimerCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
useTimerCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
useTimerCheckBox.setName("useTimerCheckBox"); // NOI18N
useTimerCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
useTimerCheckBoxActionPerformed(evt);
}
});
stateOptionsNumberCheckBox.setText("State how many options need to be selected in multiple-choice questions");
stateOptionsNumberCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
stateOptionsNumberCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
stateOptionsNumberCheckBox.setName("stateOptionsCheckBox"); // NOI18N
timeTextLabel.setText("3 hours");
timeTextLabel.setName("timeSliderLabel"); // NOI18N
org.jdesktop.layout.GroupLayout optionsPanelLayout = new org.jdesktop.layout.GroupLayout(optionsPanel);
optionsPanel.setLayout(optionsPanelLayout);
optionsPanelLayout.setHorizontalGroup(
optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(optionsPanelLayout.createSequentialGroup()
.addContainerGap()
.add(optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(optionsPanelLayout.createSequentialGroup()
.add(optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(shuffleCheckBox)
.add(optionsPanelLayout.createSequentialGroup()
.add(useTimerCheckBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(timeSlider, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
.add(timeTextLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE))))
.add(0, 0, 0))
.add(optionsPanelLayout.createSequentialGroup()
.add(stateOptionsNumberCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 411, Short.MAX_VALUE)
.addContainerGap())))
);
optionsPanelLayout.setVerticalGroup(
optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, optionsPanelLayout.createSequentialGroup()
.add(shuffleCheckBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(stateOptionsNumberCheckBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(optionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(useTimerCheckBox)
.add(timeSlider, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(timeTextLabel)
.addContainerGap())
);
optionsPanelLayout.linkSize(new java.awt.Component[] {shuffleCheckBox, stateOptionsNumberCheckBox, useTimerCheckBox}, org.jdesktop.layout.GroupLayout.VERTICAL);
editQuizButton.setText("Edit Questions");
editQuizButton.setEnabled(false);
editQuizButton.setName("editQuestionsButton"); // NOI18N
editQuizButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
editQuizButtonClicked(evt);
}
});
questionSetTree.setMinimumSize(new java.awt.Dimension(100, 50));
questionSetTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
questionSetTreeValueChanged(evt);
}
});
jScrollPane1.setViewportView(questionSetTree);
addTestFromWebButton.setText("Add from web...");
addTestFromWebButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addTestFromWebButtonActionPerformed(evt);
}
});
addTestFromFileButton.setText("Add from file...");
addTestFromFileButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addTestFromFileButtonActionPerformed(evt);
}
});
descriptionText.setContentType("text/html");
descriptionText.setEditable(false);
descriptionText.setMinimumSize(new java.awt.Dimension(300, 50));
descriptionText.setName("descriptionText"); // NOI18N
jScrollPane2.setViewportView(descriptionText);
jLabel3.setText("Information:");
jLabel1.setText("Number of questions:");
numberOfQuestionsText.setEditable(false);
numberOfQuestionsText.setName("numberOfQuestionsText"); // NOI18N
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(jPanel1Layout.createSequentialGroup()
.add(addTestFromWebButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(addTestFromFileButton))
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 312, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(numberOfQuestionsText, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE))
.add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
.add(jLabel3)
.addContainerGap(547, Short.MAX_VALUE))))
);
jPanel1Layout.linkSize(new java.awt.Component[] {addTestFromFileButton, addTestFromWebButton}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(addTestFromWebButton)
.add(addTestFromFileButton)))
.add(jPanel1Layout.createSequentialGroup()
.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(numberOfQuestionsText, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)))
.addContainerGap())
);
fileMenuItem.setText("File");
resumeQuizMenuItem.setText("Resume quiz...");
resumeQuizMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
resumeQuizMenuItemActionPerformed(evt);
}
});
fileMenuItem.add(resumeQuizMenuItem);
addTestFromFileMenuItem.setText("Add question set from file...");
addTestFromFileMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addTestFromFileMenuItemActionPerformed(evt);
}
});
fileMenuItem.add(addTestFromFileMenuItem);
addTestFromWebMenuItem.setText("Add question set from web...");
addTestFromWebMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addTestFromWebMenuItemActionPerformed(evt);
}
});
fileMenuItem.add(addTestFromWebMenuItem);
exportQuestionSetAsHtmlMenuItem.setText("Export question set as HTML document...");
exportQuestionSetAsHtmlMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exportQuestionSetAsHtmlMenuItemActionPerformed(evt);
}
});
fileMenuItem.add(exportQuestionSetAsHtmlMenuItem);
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuItemActionPerformed(evt);
}
});
fileMenuItem.add(exitMenuItem);
menuBar.add(fileMenuItem);
toolsMenu.setText("Tools");
editorMenuItem.setText("Question editor");
editorMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
editorMenuItemSelected(evt);
}
});
toolsMenu.add(editorMenuItem);
menuBar.add(toolsMenu);
lafMenu.setText("Look and Feel");
menuBar.add(lafMenu);
helpMenu.setText("About");
helpMenu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
helpMenuActionPerformed(evt);
}
});
aboutMenuItem.setText("About...");
aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aboutMenuItemActionPerformed(evt);
}
});
helpMenu.add(aboutMenuItem);
menuBar.add(helpMenu);
setJMenuBar(menuBar);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(optionsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 301, Short.MAX_VALUE)
.add(editQuizButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(beginQuizButton))
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(beginQuizButton)
.add(editQuizButton))
.add(optionsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void questionSetTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_questionSetTreeValueChanged
questionSetTreeValueChanged();
}//GEN-LAST:event_questionSetTreeValueChanged
abstract protected void questionSetTreeValueChanged();
protected void createComponents() {
initComponents();
}
private void addTestFromWebMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTestFromWebMenuItemActionPerformed
addQuizFromWebMenuItemActionPerformed();
}//GEN-LAST:event_addTestFromWebMenuItemActionPerformed
abstract protected void addQuizFromWebMenuItemActionPerformed();
private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
aboutMenuItemActionPerformed();
}//GEN-LAST:event_aboutMenuItemActionPerformed
abstract protected void aboutMenuItemActionPerformed();
private void editQuizButtonClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editQuizButtonClicked
editTestButtonClicked();
}//GEN-LAST:event_editQuizButtonClicked
abstract protected void editTestButtonClicked();
private void editorMenuItemSelected(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editorMenuItemSelected
editorMenuItemSelected();
}//GEN-LAST:event_editorMenuItemSelected
abstract protected void editorMenuItemSelected();
private void addTestFromFileMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTestFromFileMenuItemActionPerformed
addTestFromFileMenuItemActionPerformed();
}//GEN-LAST:event_addTestFromFileMenuItemActionPerformed
abstract protected void addTestFromFileMenuItemActionPerformed();
private void helpMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpMenuActionPerformed
helpMenuActionPerformed();
}//GEN-LAST:event_helpMenuActionPerformed
abstract protected void helpMenuActionPerformed();
private void addTestFromWebButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTestFromWebButtonActionPerformed
addQuizFromWebButtonActionPerformed();
}//GEN-LAST:event_addTestFromWebButtonActionPerformed
abstract protected void addQuizFromWebButtonActionPerformed();
private void addTestFromFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTestFromFileButtonActionPerformed
addQuizFromFileButtonActionPerformed();
}//GEN-LAST:event_addTestFromFileButtonActionPerformed
abstract protected void addQuizFromFileButtonActionPerformed();
private void beginQuizButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_beginQuizButtonActionPerformed
beginQuizButtonActionPerformed();
}//GEN-LAST:event_beginQuizButtonActionPerformed
abstract protected void beginQuizButtonActionPerformed();
private void useTimerCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useTimerCheckBoxActionPerformed
useTimerCheckBoxActionPerformed();
}//GEN-LAST:event_useTimerCheckBoxActionPerformed
abstract protected void useTimerCheckBoxActionPerformed();
private void timeSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_timeSliderStateChanged
timeSliderStateChanged();
}//GEN-LAST:event_timeSliderStateChanged
abstract protected void timeSliderStateChanged();
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
exitMenuItemActionPerformed();
}//GEN-LAST:event_exitMenuItemActionPerformed
abstract protected void exitMenuItemActionPerformed();
private void resumeQuizMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resumeQuizMenuItemActionPerformed
resumeQuizMenuItemActionPerformed();
}//GEN-LAST:event_resumeQuizMenuItemActionPerformed
abstract protected void resumeQuizMenuItemActionPerformed();
private void exportQuestionSetAsHtmlMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportQuestionSetAsHtmlMenuItemActionPerformed
exportQuestionSetAsHtml();
}//GEN-LAST:event_exportQuestionSetAsHtmlMenuItemActionPerformed
abstract protected void exportQuestionSetAsHtml();
// Variables declaration - do not modify//GEN-BEGIN:variables
protected javax.swing.JMenuItem aboutMenuItem;
protected javax.swing.JButton addTestFromFileButton;
protected javax.swing.JMenuItem addTestFromFileMenuItem;
protected javax.swing.JButton addTestFromWebButton;
protected javax.swing.JMenuItem addTestFromWebMenuItem;
protected javax.swing.JButton beginQuizButton;
protected javax.swing.ButtonGroup buttonGroup1;
protected javax.swing.JTextPane descriptionText;
protected javax.swing.JButton editQuizButton;
protected javax.swing.JMenuItem editorMenuItem;
protected javax.swing.JMenuItem exitMenuItem;
protected javax.swing.JMenuItem exportQuestionSetAsHtmlMenuItem;
protected javax.swing.JMenu fileMenuItem;
protected javax.swing.JMenu helpMenu;
protected javax.swing.JLabel jLabel1;
protected javax.swing.JLabel jLabel3;
protected javax.swing.JPanel jPanel1;
protected javax.swing.JScrollPane jScrollPane1;
protected javax.swing.JScrollPane jScrollPane2;
protected javax.swing.JMenu lafMenu;
protected javax.swing.JMenuBar menuBar;
protected javax.swing.JTextField numberOfQuestionsText;
protected javax.swing.JPanel optionsPanel;
protected javax.swing.JTree questionSetTree;
protected javax.swing.JMenuItem resumeQuizMenuItem;
protected javax.swing.JCheckBox shuffleCheckBox;
protected javax.swing.JCheckBox stateOptionsNumberCheckBox;
protected javax.swing.JSlider timeSlider;
protected javax.swing.JLabel timeTextLabel;
protected javax.swing.JMenu toolsMenu;
protected javax.swing.JCheckBox useTimerCheckBox;
// End of variables declaration//GEN-END:variables
}