001 /* PAVLOV -- Multiple Choice Study System 002 * Copyright (C) 2000 - 2004 T.J. Willis 003 * 004 * This program is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU General Public License 006 * as published by the Free Software Foundation; either version 2 007 * of the License, or (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program; if not, write to the Free Software 016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. 017 * 018 * $Header: /cvsroot/pavlov/net/sourceforge/pavlov/swing/HardcopyDialog.java,v 1.3 2004/05/10 15:02:41 tj_willis Exp $ 019 */ 020 package net.sourceforge.pavlov.swing; 021 022 // import java.io.File; 023 // import javax.swing.*; 024 // import java.util.Random; 025 // import java.util.Vector; 026 027 // import net.sourceforge.pavlov.event.BookAndChapterListener; 028 // import net.sourceforge.pavlov.main.standalone.Pavlov; 029 // import net.sourceforge.pavlov.user.*; 030 // import net.sourceforge.pavlov.library.*; 031 // import net.sourceforge.pavlov.randommedia.ImageIconUtilities; 032 // import net.sourceforge.pavlov.zipUtilities.HTMLFileFilter; 033 // import net.sourceforge.pavlov.zipUtilities.JPEGFileFilter; 034 035 /** 036 * HardcopyDialog presents a dialog to create printable quizzes in HTML. 037 * @version $Revision: 1.3 $ 038 * @deprecated To be replaced with pluglet in Pavlov 1.1 039 */ 040 @Deprecated public class HardcopyDialog 041 //extends JInternalFrame implements BookAndChapterListener 042 { 043 // //FIXME: separate document generation from UI 044 // //FIXME: UI was generated by IDE, too ugly 045 // //FIXME: there's a GPL'd report writer API at sourceforge to replace 046 // // the document generation code. 047 // protected User user; 048 // protected String bookName; 049 // protected ChapterData chapDat; 050 // protected Chapter chapt; 051 // protected AbstractLibrary library; 052 // protected Pavlov pvlv; 053 // protected java.io.File outputDirectory = null; 054 // private javax.swing.ButtonGroup strategyButtonGroup; 055 // private javax.swing.JLabel numQuestionsLabel; 056 // private javax.swing.JComboBox numberOfQuestionsBox; 057 // private javax.swing.JLabel outputFileLabel; 058 // private javax.swing.JTextField outputFileNameBox; 059 // private javax.swing.JLabel strategyLabel; 060 // private javax.swing.JPanel buttonGroupPanel; 061 // private javax.swing.JRadioButton jRadioButton1; 062 // private javax.swing.JRadioButton jRadioButton2; 063 // private javax.swing.JRadioButton jRadioButton3; 064 // private javax.swing.JRadioButton jRadioButton4; 065 // private javax.swing.JRadioButton jRadioButton5; 066 // private javax.swing.JButton browseOutputFile; 067 // private javax.swing.JLabel bkgdImgLabel; 068 // private javax.swing.JButton browseBAckgroundImage; 069 // private javax.swing.JLabel documentTitleLabel; 070 // private javax.swing.JTextField documentTitleBox; 071 // private javax.swing.JLabel backgroundPreviewLabel; 072 // private javax.swing.JButton createButton; 073 // private javax.swing.JButton cancelButton; 074 075 076 // /** Creates a new HardcopyDialog */ 077 // public HardcopyDialog(Pavlov pavlov, 078 // User usr, 079 // AbstractLibrary theLib, 080 // String theBookName, 081 // Chapter theChapt) 082 // { 083 // super("Create Hardcopy Quiz",true,false,true,true); 084 // assert usr!=null : "Creating hardcopy dialog with null user"; 085 // assert theLib!=null : "Creating hardcopy dialog with null library"; 086 // library = theLib; 087 // user = usr; 088 // pvlv = pavlov; 089 // initComponents(); 090 // newChoice(theBookName,theChapt); 091 // } 092 093 094 // protected void newChoice(String theBookName, Chapter theChapt) 095 // { 096 // if(theChapt==null) return; // if user clicks on a book 097 // assert theBookName!=null : "Creating hardcopy dialog with null Book Name"; 098 // assert user!=null : "Creating hardcopy dialog with null User"; 099 100 101 // bookName = theBookName; 102 // chapt = theChapt; // setChapter(chapt); 103 // chapDat = user.getChapterData(bookName,chapt.getTitle()); 104 // assert chapDat!=null : "Creating hardcopy dialog with null ChapterData"; 105 // //setBookName(bookName); 106 // setDocTitle(); 107 108 // } 109 110 // public void setUser(User usr){ user = usr;} 111 // //public void setChapterData(ChapterData theChapDat){chapDat = theChapDat;} 112 113 // /** This method is called from within the constructor to 114 // * initialize the form. 115 // */ 116 // private void initComponents() { 117 // //strategyButtonGroup = new javax.swing.ButtonGroup(); 118 // numQuestionsLabel = new javax.swing.JLabel(); 119 // numberOfQuestionsBox = new javax.swing.JComboBox(); 120 // outputFileLabel = new javax.swing.JLabel(); 121 // outputFileNameBox = new javax.swing.JTextField(); 122 // //strategyLabel = new javax.swing.JLabel(); 123 // buttonGroupPanel = new javax.swing.JPanel(); 124 // jRadioButton1 = new javax.swing.JRadioButton(); 125 // jRadioButton2 = new javax.swing.JRadioButton(); 126 // jRadioButton3 = new javax.swing.JRadioButton(); 127 // jRadioButton4 = new javax.swing.JRadioButton(); 128 // jRadioButton5 = new javax.swing.JRadioButton(); 129 // browseOutputFile = new javax.swing.JButton(); 130 // bkgdImgLabel = new javax.swing.JLabel(); 131 // browseBAckgroundImage = new javax.swing.JButton(); 132 // documentTitleLabel = new javax.swing.JLabel(); 133 // documentTitleBox = new javax.swing.JTextField(); 134 // backgroundPreviewLabel = new javax.swing.JLabel(); 135 // createButton = new javax.swing.JButton(); 136 // cancelButton = new javax.swing.JButton(); 137 138 139 // getContentPane().setLayout(new java.awt.GridBagLayout()); 140 // java.awt.GridBagConstraints gridBagConstraints1; 141 142 // //setTitle("Create Hardcopy Quiz"); 143 // setName("hardCopyDialog"); 144 // // addWindowListener(new java.awt.event.WindowAdapter() { 145 // // public void windowClosing(java.awt.event.WindowEvent evt) { 146 // // closeDialog(evt); 147 // // } 148 // // }); 149 150 // numQuestionsLabel.setText("Number of Questions:"); 151 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 152 // gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; 153 // gridBagConstraints1.weightx = 0.2; 154 // getContentPane().add(numQuestionsLabel, gridBagConstraints1); 155 156 // numberOfQuestionsBox.setEditable(true); 157 // numberOfQuestionsBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "5", "10", "15", "20", "25", "30", "40", "50" })); 158 // numberOfQuestionsBox.setSelectedIndex(4); 159 // numberOfQuestionsBox.addActionListener(new java.awt.event.ActionListener() { 160 // public void actionPerformed(java.awt.event.ActionEvent evt) { 161 // numberOfQuestionsBoxActionPerformed(evt); 162 // } 163 // }); 164 165 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 166 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 167 // getContentPane().add(numberOfQuestionsBox, gridBagConstraints1); 168 169 // outputFileLabel.setText("Output File:"); 170 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 171 // gridBagConstraints1.gridx = 0; 172 // gridBagConstraints1.gridy = 1; 173 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 174 // gridBagConstraints1.weightx = 0.2; 175 // getContentPane().add(outputFileLabel, gridBagConstraints1); 176 177 // outputFileNameBox.setText("C:\\here.html"); 178 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 179 // gridBagConstraints1.gridy = 1; 180 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 181 // gridBagConstraints1.weightx = 1.0; 182 // getContentPane().add(outputFileNameBox, gridBagConstraints1); 183 184 // //strategyLabel.setText("Choose Questions By:"); 185 // // gridBagConstraints1 = new java.awt.GridBagConstraints(); 186 // // gridBagConstraints1.gridx = 0; 187 // // gridBagConstraints1.gridy = 2; 188 // // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 189 // // gridBagConstraints1.weighty = 0.5; 190 // // getContentPane().add(strategyLabel, gridBagConstraints1); 191 192 // // buttonGroupPanel.setLayout(new javax.swing.BoxLayout(buttonGroupPanel, javax.swing.BoxLayout.Y_AXIS)); 193 194 // // buttonGroupPanel.setBorder(new javax.swing.border.EtchedBorder()); 195 196 197 // // jRadioButton1.setSelected(true); 198 // // jRadioButton1.setText(RandomStrategy.getName()); 199 // // jRadioButton1.setActionCommand(RandomStrategy.getName()); 200 // // strategyButtonGroup.add(jRadioButton1); 201 // // buttonGroupPanel.add(jRadioButton1); 202 // // //jRadioButton1.addActionListener(this); 203 204 // // jRadioButton2.setText(LowestPercentageStrategy.getName()); 205 // // jRadioButton2.setActionCommand(LowestPercentageStrategy.getName()); 206 // // strategyButtonGroup.add(jRadioButton2); 207 // // buttonGroupPanel.add(jRadioButton2); 208 // // //jRadioButton2.addActionListener(this); 209 210 // // jRadioButton3.setText(FewestAnswersStrategy.getName()); 211 // // jRadioButton3.setActionCommand(FewestAnswersStrategy.getName()); 212 // // strategyButtonGroup.add(jRadioButton3); 213 // // buttonGroupPanel.add(jRadioButton3); 214 // // //jRadioButton3.addActionListener(this); 215 216 // // jRadioButton4.setText(FewestRightAnswersStrategy.getName()); 217 // // jRadioButton4.setActionCommand(FewestRightAnswersStrategy.getName()); 218 // // strategyButtonGroup.add(jRadioButton4); 219 // // buttonGroupPanel.add(jRadioButton4); 220 // // //jRadioButton4.addActionListener(this); 221 222 223 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 224 // gridBagConstraints1.gridy = 2; 225 // gridBagConstraints1.gridheight = 4; 226 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 227 // gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; 228 // gridBagConstraints1.weightx = 0.5; 229 // getContentPane().add(buttonGroupPanel, gridBagConstraints1); 230 231 // browseOutputFile.setText("Browse..."); 232 // browseOutputFile.addActionListener(new java.awt.event.ActionListener() { 233 // public void actionPerformed(java.awt.event.ActionEvent evt) { 234 // browseOutputFileActionPerformed(evt); 235 // } 236 // }); 237 238 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 239 // gridBagConstraints1.gridy = 1; 240 // gridBagConstraints1.weightx = 0.2; 241 // getContentPane().add(browseOutputFile, gridBagConstraints1); 242 243 // bkgdImgLabel.setText("Background Image:"); 244 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 245 // gridBagConstraints1.gridx = 0; 246 // gridBagConstraints1.gridy = 6; 247 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 248 // gridBagConstraints1.weighty = 5.0; 249 // getContentPane().add(bkgdImgLabel, gridBagConstraints1); 250 251 // browseBAckgroundImage.setText("Browse..."); 252 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 253 // gridBagConstraints1.gridx = 2; 254 // gridBagConstraints1.gridy = 6; 255 // browseBAckgroundImage.addActionListener(new java.awt.event.ActionListener() { 256 // public void actionPerformed(java.awt.event.ActionEvent evt) { 257 // browseBAckgroundImageActionPerformed(evt); 258 // } 259 // }); 260 // getContentPane().add(browseBAckgroundImage, gridBagConstraints1); 261 262 // documentTitleLabel.setText("Document Title:"); 263 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 264 // gridBagConstraints1.gridx = 0; 265 // gridBagConstraints1.gridy = 8; 266 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 267 // getContentPane().add(documentTitleLabel, gridBagConstraints1); 268 269 // documentTitleBox.setText("jTextField2"); 270 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 271 // gridBagConstraints1.gridy = 8; 272 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 273 // getContentPane().add(documentTitleBox, gridBagConstraints1); 274 275 // backgroundPreviewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 276 // backgroundPreviewLabel.setText("<no image>"); 277 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 278 // gridBagConstraints1.gridx = 1; 279 // gridBagConstraints1.gridy = 6; 280 // gridBagConstraints1.gridheight = 2; 281 // gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 282 // getContentPane().add(backgroundPreviewLabel, gridBagConstraints1); 283 284 // createButton.setText("Create"); 285 // createButton.addActionListener(new java.awt.event.ActionListener() { 286 // public void actionPerformed(java.awt.event.ActionEvent evt) { 287 // createButtonActionPerformed(evt); 288 // } 289 // }); 290 291 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 292 // gridBagConstraints1.gridx = 1; 293 // gridBagConstraints1.gridy = 9; 294 // gridBagConstraints1.anchor = java.awt.GridBagConstraints.EAST; 295 // getContentPane().add(createButton, gridBagConstraints1); 296 297 // cancelButton.setText("Cancel"); 298 // cancelButton.addActionListener(new java.awt.event.ActionListener() { 299 // public void actionPerformed(java.awt.event.ActionEvent evt) { 300 // cancelButtonActionPerformed(evt); 301 // } 302 // }); 303 304 // gridBagConstraints1 = new java.awt.GridBagConstraints(); 305 // gridBagConstraints1.gridx = 2; 306 // gridBagConstraints1.gridy = 9; 307 // gridBagConstraints1.anchor = java.awt.GridBagConstraints.EAST; 308 // getContentPane().add(cancelButton, gridBagConstraints1); 309 310 // pack(); 311 // } 312 // private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) { 313 // this.setVisible(false); 314 // } 315 // private void createButtonActionPerformed(java.awt.event.ActionEvent evt) { 316 // try 317 // { 318 // writeHardCopyQuiz(); 319 // } 320 // catch (Exception ex) 321 // { 322 // System.out.println("Hard Copy: Exception " + ex); 323 // } 324 // // Add your handling code here: 325 // // nqs = getNQs(); 326 // // outputFile = getOutputFile(); 327 // // docTitle = getDocumentTitle(); 328 // // // strategy = getStrategy(); 329 // // user. 330 // // // 331 // } 332 333 // private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) { 334 // // Add your handling code here: 335 // } 336 337 // private void numberOfQuestionsBoxActionPerformed(java.awt.event.ActionEvent evt) { 338 // // Add your handling code here: 339 // } 340 341 // private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) { 342 // // Add your handling code here: 343 // } 344 345 // private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) { 346 // // Add your handling code here: 347 // } 348 349 // private void browseOutputFileActionPerformed(java.awt.event.ActionEvent evt) { 350 // HTMLFileFilter h = new HTMLFileFilter(); 351 // JFileChooser jfc = new JFileChooser(); 352 // jfc.setFileFilter(h); 353 // //jfc.showSaveDialog(this.getParent()); 354 // int retVal =pvlv.showFileChooser(jfc,false); 355 // if(retVal!=JFileChooser.APPROVE_OPTION) return; 356 // java.io.File outputFile = jfc.getSelectedFile(); 357 // if(outputFile==null) 358 // { 359 // JOptionPane.showInternalMessageDialog(this, "Cannot create file.", 360 // "Cannot create this file.", 361 // JOptionPane.INFORMATION_MESSAGE); 362 // return; 363 // } else { 364 // outputFileNameBox.setText(outputFile.toString()); 365 // } 366 // } 367 // private void browseBAckgroundImageActionPerformed(java.awt.event.ActionEvent evt) { 368 // JPEGFileFilter h = new JPEGFileFilter(); 369 // JFileChooser jfc = new JFileChooser(); 370 // jfc.setFileFilter(h); 371 // int retVal = pvlv.showFileChooser(jfc,true); 372 // if(retVal!=JFileChooser.APPROVE_OPTION) return; 373 // java.io.File bgf = jfc.getSelectedFile(); 374 375 // // jfc.showOpenDialog(this.getParent()); 376 // //java.io.File bgf = jfc.getSelectedFile(); 377 // if(bgf==null) 378 // { 379 // JOptionPane.showInternalMessageDialog(this, "Cannot access file.", 380 // "Cannot access this file.", 381 // JOptionPane.INFORMATION_MESSAGE); 382 // return; 383 // } else { 384 // ImageIcon la = new ImageIcon(bgf.toString()); 385 // ImageIcon lala = ImageIconUtilities.formatImage(la,50); 386 // backgroundPreviewLabel.setIcon(lala); 387 // backgroundPreviewLabel.setText(bgf.toString()); 388 // //outputFileNameBox.setText(bgf.toString()); 389 // } 390 // } 391 // /** Closes the dialog */ 392 // private void closeDialog(java.awt.event.WindowEvent evt) { 393 // setVisible(false); 394 // //dispose(); 395 // } 396 397 398 399 // /** 400 // * Sends a representation of this user in XML form to the given writer. 401 // */ 402 // public void writeHardCopyQuiz() 403 // throws java.io.IOException { 404 405 // String outputFileName = outputFileNameBox.getText(); 406 // java.io.FileWriter writer = null; 407 408 // try { 409 // writer = new java.io.FileWriter(outputFileName); 410 // } catch (Exception ex) { 411 // JOptionPane.showInternalMessageDialog(this, "Cannot create file. " + ex, 412 // "Cannot create this file.", 413 // JOptionPane.INFORMATION_MESSAGE); 414 // return; 415 // } 416 417 // int numQs = 25; 418 // try { 419 // Object foo = numberOfQuestionsBox.getSelectedItem(); 420 // if(foo!=null) 421 // { 422 // numQs = Integer.parseInt(foo.toString()); 423 // } 424 // } catch (Exception ex) { 425 // JOptionPane.showInternalMessageDialog(this, "Cannot create file. " + ex, 426 // "Cannot create this file.", 427 // JOptionPane.INFORMATION_MESSAGE); 428 // return; 429 // } 430 431 // boolean hasBackgroundImage = false; 432 // String backgroundImageURL = null; 433 // String backgroundImageFileName = backgroundPreviewLabel.getText(); 434 435 436 // try { 437 // File fo = new File(backgroundImageFileName); 438 // if(fo!=null) 439 // if(fo.isFile() && fo.canRead()) 440 // { 441 // backgroundImageURL = "file:" + fo.getCanonicalPath(); 442 // hasBackgroundImage = true; 443 // } 444 // } catch (Exception ex) { 445 // // do nothing 446 // } 447 448 // String title = documentTitleBox.getText(); 449 450 451 // Vector tmpAnswers = new Vector(); 452 453 // //System.out.println("SHOULD SET STRATEGY TO " + strategyButtonGroup.getSelection().getActionCommand()); 454 455 // // maintenence nightmare... 456 // // int oldStrategy = chapDat.getStrategy(); 457 // // String ac = strategyButtonGroup.getSelection().getActionCommand(); 458 // // if(ac!=null) 459 // // { 460 // // if(RandomStrategy.getName().equals(ac)) 461 // // { 462 // // chapDat.setStrategy(QuestionStrategy.RANDOM); 463 // // } 464 // // else if(LowestPercentageStrategy.getName().equals(ac)) 465 // // { 466 // // chapDat.setStrategy(QuestionStrategy.PERCENTAGE); 467 // // } 468 // // else if(FewestAnswersStrategy.getName().equals(ac)) 469 // // { 470 // // chapDat.setStrategy(QuestionStrategy.COVERAGE); 471 // // } 472 // // else if(FewestRightAnswersStrategy.getName().equals(ac)) 473 // // { 474 // // chapDat.setStrategy(QuestionStrategy.RIGHTS); 475 // // } 476 // // } 477 // writer.write("<html>"); 478 // writer.write("<head>"); 479 480 // writer.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">\n"); 481 // writer.write("</head>\n"); 482 483 // if(hasBackgroundImage) 484 // writer.write("<body background=\""+ backgroundImageURL +"\">\n"); 485 // else 486 // writer.write("<body>\n"); 487 // writer.write("<div align=\"Center\">\n"); 488 // writer.write("<h1>" + title + "</h1>\n"); 489 // writer.write("<small><i>Generated by PAVLOV v.1.0B (C) 2000-2002 by T.J. Willis</i></small></div>\n"); 490 // writer.write("<hr width=\"100%\" size=\"2\" align=\"Left\">\n"); 491 // writer.write("<CENTER><h2>QUESTIONS</h2></CENTER>\n"); 492 493 // // avoid redundant qs as possible 494 // int tmp = chapDat.getExclusionSize(); 495 // chapDat.setExclusionSize(numQs); 496 // Random rand = new Random(); 497 498 // writer.write("<table cellpadding=\"2\" cellspacing=\"2\" border=\"1\" width=\"100%\">"); 499 // writer.write("<tbody>\n"); 500 501 502 // for(int i=1;i<=numQs;i++) 503 // { 504 // if(i%2==1) writer.write("<tr>"); 505 // writer.write("<td valign=\"Top\">\n"); 506 // Question q = user.getValidQuestion(chapDat, chapt); 507 // if(q==null) continue; 508 // writer.write(i +""); 509 // tmpAnswers.add(q.toHTML(writer,rand)); 510 // writer.write("</td>\n"); 511 // if(i%2!=1)writer.write("</tr>"); 512 // } 513 // writer.write("</tbody>"); 514 // writer.write("</table>"); 515 // chapDat.setExclusionSize(tmp); 516 517 // writer.write("<CENTER><h2>ANSWERS</h2></CENTER>\n"); 518 // writer.write("<table cellpadding=\"2\" cellspacing=\"2\" border=\"1\" width=\"100%\">"); 519 // writer.write("<tbody>\n"); 520 // for(int i=0;i<tmpAnswers.size();i++) 521 // { 522 // if(i%2==0) writer.write("<tr>"); 523 // writer.write("<td>"+ (i + 1) + ""); 524 // writer.write(tmpAnswers.elementAt(i) + "</td>\n"); 525 // if(i%2!=0)writer.write("</tr>"); 526 // } 527 // writer.write("</tbody>"); 528 // writer.write("</table>"); 529 // writer.write("<br>\n"); 530 // writer.write("</body>"); 531 // writer.write("</html>"); 532 // //... 533 // writer.flush(); 534 535 // HTMLInternalFrame preview = new HTMLInternalFrame("Preview Window","file:" + outputFileName); 536 // pvlv.addInternalFrame(preview); 537 // // chapDat.setStrategy(oldStrategy); 538 // cancelButton.setText("Done"); 539 // pack(); 540 // //currentStrategy=origStrategy 541 // } 542 543 544 // /** 545 // * This is sent from QuizSelector when the user selects a new book 546 // * and/or chapter. 547 // * 548 // * @param bookName a <code>String</code> value 549 // * @param chapName a <code>String</code> value 550 // */ 551 // public void selectionChanged(ChapterReference ref) 552 // { 553 // //Book bk = library.getBook(bookName); 554 // Chapter ch = ref.getChapter(); 555 // //library.getChapter(bookName,chapName); 556 // newChoice(ref.getBookName(),ch); 557 // } 558 559 // public void setBookName(String n) 560 // { 561 // bookName = n; 562 // newChoice(n,chapt); 563 // setDocTitle(); 564 // } 565 // public void setChapter(Chapter cp) 566 // { 567 // assert cp!=null : "Setting null chapter in HardcopyDialog"; 568 // chapt = cp; 569 // newChoice(bookName,chapt); 570 // setDocTitle(); 571 // } 572 // protected void setDocTitle() 573 // { 574 // setTitle("HardCopy Quiz Writer: " + bookName + " : " + chapt.getTitle()); 575 // documentTitleBox.setText("Test for " + bookName + " : " + chapt.getTitle()); 576 // } 577 578 } 579 580 581 582 583 584 585 586 587