00001 package edu.ksu.cis.bandera.bui;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 import edu.ksu.cis.bandera.specification.datastructure.*;
00036 import edu.ksu.cis.bandera.jjjc.*;
00037 import edu.ksu.cis.bandera.annotation.*;
00038 import edu.ksu.cis.bandera.specification.assertion.datastructure.*;
00039 import java.awt.*;
00040 import java.util.*;
00041 import javax.swing.*;
00042 import javax.swing.tree.*;
00043 public class AssertionBrowser extends JFrame {
00044 private JLabel ivjConstraintLabel = null;
00045 private JTextField ivjConstraintTextField = null;
00046 private JLabel ivjDescriptionLabel = null;
00047 private JScrollPane ivjDescriptionScrollPane = null;
00048 private JTextArea ivjDescriptionTextArea = null;
00049 private JButton ivjGotoButton = null;
00050 private JLabel ivjNameLabel = null;
00051 private JTextField ivjNameTextField = null;
00052 private JButton ivjOkButton = null;
00053 private JLabel ivjTypeLabel = null;
00054 private JTextField ivjTypeTextField = null;
00055 private JButton ivjErrorMessageButton = null;
00056 IvjEventHandler ivjEventHandler = new IvjEventHandler();
00057 private JTree ivjAssertionTree = null;
00058 private JPanel ivjAssertionBrowserContentPane = null;
00059 private JSplitPane ivjAssertionBrowserSplitPane = null;
00060 private JPanel ivjAssertionPanel = null;
00061 private JScrollPane ivjAssertionScrollPane = null;
00062
00063 class IvjEventHandler implements java.awt.event.ActionListener, javax.swing.event.TreeSelectionListener {
00064 public void actionPerformed(java.awt.event.ActionEvent e) {
00065 if (e.getSource() == AssertionBrowser.this.getOkButton())
00066 connEtoM1(e);
00067 if (e.getSource() == AssertionBrowser.this.getErrorMessageButton())
00068 connEtoC2();
00069 if (e.getSource() == AssertionBrowser.this.getGotoButton())
00070 connEtoC3();
00071 if (e.getSource() == AssertionBrowser.this.getAddButton())
00072 connEtoC4();
00073 };
00074 public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
00075 if (e.getSource() == AssertionBrowser.this.getAssertionTree())
00076 connEtoC1();
00077 };
00078 };
00079 private JButton ivjAddButton = null;
00080
00081
00082
00083 public AssertionBrowser() {
00084 super();
00085 initialize();
00086 }
00087
00088
00089
00090
00091 public AssertionBrowser(String title) {
00092 super(title);
00093 }
00094
00095
00096
00097 public void addButton_ActionEvents() {
00098 Object o = ((DefaultMutableTreeNode) getAssertionTree().getLastSelectedPathComponent()).getUserObject();
00099 if (o instanceof Assertion) {
00100 Assertion a = (Assertion) o;
00101 AssertionProperty ap = (AssertionProperty) BUI.property.getActivatedAssertionProperties().iterator().next();
00102 ap.addAssertion(a.getName());
00103 BUI.propertyManager.updateEnabledAssertionList();
00104 BUI.propertyManager.getEnabledAssertionList().setSelectedValue(a, true);
00105 BUI.propertyManager.setVisible(true);
00106 BUI.propertyManager.requestFocus();
00107 BUI.propertyManager.getPropertyManagerTabbedPane().setSelectedIndex(2);
00108 }
00109 }
00110
00111
00112
00113 public void assertionTree_TreeSelectionEvents() {
00114 Object o = ((DefaultMutableTreeNode) getAssertionTree().getLastSelectedPathComponent()).getUserObject();
00115 if (o instanceof Assertion) {
00116 Assertion a = (Assertion) o;
00117 getNameTextField().setText(a.getName().toString());
00118 if (a instanceof LocationAssertion) {
00119 getTypeTextField().setText("Location Assertion on label '" + ((LocationAssertion) a).getLabel() + "'");
00120 } else if (a instanceof PostAssertion) {
00121 getTypeTextField().setText("Post-condition Assertion");
00122 } else if (a instanceof PreAssertion) {
00123 getTypeTextField().setText("Pre-condition Assertion");
00124 }
00125 getConstraintTextField().setText(a.getConstraint().toString().trim());
00126 getDescriptionTextArea().setText("".equals(a.getDescription().trim()) ? "none" : a.getDescription());
00127 getErrorMessageButton().setEnabled(!a.isValid());
00128 getGotoButton().setEnabled(true);
00129 getAddButton().setEnabled(a.isValid() && (BUI.property.getActivatedAssertionProperties().size() == 1));
00130 } else {
00131 getErrorMessageButton().setEnabled(false);
00132 getGotoButton().setEnabled(false);
00133 getAddButton().setEnabled(false);
00134 getNameTextField().setText("");
00135 getTypeTextField().setText("");
00136 getConstraintTextField().setText("");
00137 getDescriptionTextArea().setText("");
00138 }
00139 }
00140
00141
00142
00143
00144
00145
00146 private DefaultMutableTreeNode buildTree(DefaultMutableTreeNode root, Object object) {
00147 if (object instanceof Hashtable) {
00148 Hashtable table = (Hashtable) object;
00149 TreeSet ts = new TreeSet();
00150 for (Enumeration e = table.keys(); e.hasMoreElements();) {
00151 ts.add(e.nextElement());
00152 }
00153
00154 for (Iterator i = ts.iterator(); i.hasNext();) {
00155 Object key = i.next();
00156 Object value = table.get(key);
00157 root.add(buildTree(new DefaultMutableTreeNode(key.toString()), value));
00158 }
00159 } else if (object instanceof AssertionSet) {
00160 AssertionSet set = (AssertionSet) object;
00161 Hashtable table = set.getAssertionTable();
00162 TreeSet ts = new TreeSet();
00163 for (Enumeration e = table.keys(); e.hasMoreElements();) {
00164 ts.add(e.nextElement());
00165 }
00166 for (Iterator i = ts.iterator(); i.hasNext();) {
00167 root.add(new DefaultMutableTreeNode(table.get(i.next())));
00168 }
00169 }
00170 return root;
00171 }
00172
00173
00174
00175
00176 private void connEtoC1() {
00177 try {
00178
00179
00180 this.assertionTree_TreeSelectionEvents();
00181
00182
00183 } catch (java.lang.Throwable ivjExc) {
00184
00185
00186 handleException(ivjExc);
00187 }
00188 }
00189
00190
00191
00192
00193 private void connEtoC2() {
00194 try {
00195
00196
00197 this.errorMessageButton_ActionEvents();
00198
00199
00200 } catch (java.lang.Throwable ivjExc) {
00201
00202
00203 handleException(ivjExc);
00204 }
00205 }
00206
00207
00208
00209
00210 private void connEtoC3() {
00211 try {
00212
00213
00214 this.gotoButton_ActionEvents();
00215
00216
00217 } catch (java.lang.Throwable ivjExc) {
00218
00219
00220 handleException(ivjExc);
00221 }
00222 }
00223
00224
00225
00226
00227 private void connEtoC4() {
00228 try {
00229
00230
00231 this.addButton_ActionEvents();
00232
00233
00234 } catch (java.lang.Throwable ivjExc) {
00235
00236
00237 handleException(ivjExc);
00238 }
00239 }
00240
00241
00242
00243
00244
00245 private void connEtoM1(java.awt.event.ActionEvent arg1) {
00246 try {
00247
00248
00249 this.setVisible(false);
00250
00251
00252 } catch (java.lang.Throwable ivjExc) {
00253
00254
00255 handleException(ivjExc);
00256 }
00257 }
00258
00259
00260
00261 public void errorMessageButton_ActionEvents() {
00262 StringBuffer buffer = new StringBuffer();
00263 Assertion a = (Assertion) ((DefaultMutableTreeNode) getAssertionTree().getLastSelectedPathComponent()).getUserObject();
00264 for (Enumeration e = a.getExceptions().elements(); e.hasMoreElements();) {
00265 Exception ex = (Exception) e.nextElement();
00266 buffer.append(ex.getMessage() + "\n");
00267 }
00268 JOptionPane.showMessageDialog(this, buffer.toString(), "Information", JOptionPane.INFORMATION_MESSAGE);
00269 }
00270
00271
00272
00273
00274
00275 private javax.swing.JButton getAddButton() {
00276 if (ivjAddButton == null) {
00277 try {
00278 ivjAddButton = new javax.swing.JButton();
00279 ivjAddButton.setName("AddButton");
00280 ivjAddButton.setMnemonic('a');
00281 ivjAddButton.setText("Add to property");
00282 ivjAddButton.setBackground(new java.awt.Color(204,204,255));
00283 ivjAddButton.setEnabled(false);
00284
00285
00286 } catch (java.lang.Throwable ivjExc) {
00287
00288
00289 handleException(ivjExc);
00290 }
00291 }
00292 return ivjAddButton;
00293 }
00294
00295
00296
00297
00298
00299 private javax.swing.JPanel getAssertionBrowserContentPane() {
00300 if (ivjAssertionBrowserContentPane == null) {
00301 try {
00302 ivjAssertionBrowserContentPane = new javax.swing.JPanel();
00303 ivjAssertionBrowserContentPane.setName("AssertionBrowserContentPane");
00304 ivjAssertionBrowserContentPane.setBorder(new javax.swing.border.EtchedBorder());
00305 ivjAssertionBrowserContentPane.setLayout(new java.awt.BorderLayout());
00306 ivjAssertionBrowserContentPane.setBackground(new java.awt.Color(204,204,255));
00307 getAssertionBrowserContentPane().add(getOkButton(), "South");
00308 getAssertionBrowserContentPane().add(getAssertionBrowserSplitPane(), "Center");
00309
00310
00311 } catch (java.lang.Throwable ivjExc) {
00312
00313
00314 handleException(ivjExc);
00315 }
00316 }
00317 return ivjAssertionBrowserContentPane;
00318 }
00319
00320
00321
00322
00323
00324 private javax.swing.JSplitPane getAssertionBrowserSplitPane() {
00325 if (ivjAssertionBrowserSplitPane == null) {
00326 try {
00327 ivjAssertionBrowserSplitPane = new javax.swing.JSplitPane(javax.swing.JSplitPane.HORIZONTAL_SPLIT);
00328 ivjAssertionBrowserSplitPane.setName("AssertionBrowserSplitPane");
00329 getAssertionBrowserSplitPane().add(getAssertionScrollPane(), "left");
00330 getAssertionBrowserSplitPane().add(getAssertionPanel(), "right");
00331
00332
00333 } catch (java.lang.Throwable ivjExc) {
00334
00335
00336 handleException(ivjExc);
00337 }
00338 }
00339 return ivjAssertionBrowserSplitPane;
00340 }
00341
00342
00343
00344
00345
00346 private javax.swing.JPanel getAssertionPanel() {
00347 if (ivjAssertionPanel == null) {
00348 try {
00349 ivjAssertionPanel = new javax.swing.JPanel();
00350 ivjAssertionPanel.setName("AssertionPanel");
00351 ivjAssertionPanel.setBorder(new javax.swing.border.EtchedBorder());
00352 ivjAssertionPanel.setLayout(new java.awt.GridBagLayout());
00353 ivjAssertionPanel.setBackground(new java.awt.Color(204,204,255));
00354
00355 java.awt.GridBagConstraints constraintsNameLabel = new java.awt.GridBagConstraints();
00356 constraintsNameLabel.gridx = 0; constraintsNameLabel.gridy = 0;
00357 constraintsNameLabel.fill = java.awt.GridBagConstraints.BOTH;
00358 constraintsNameLabel.insets = new java.awt.Insets(10, 10, 0, 0);
00359 getAssertionPanel().add(getNameLabel(), constraintsNameLabel);
00360
00361 java.awt.GridBagConstraints constraintsNameTextField = new java.awt.GridBagConstraints();
00362 constraintsNameTextField.gridx = 1; constraintsNameTextField.gridy = 0;
00363 constraintsNameTextField.gridwidth = 4;
00364 constraintsNameTextField.fill = java.awt.GridBagConstraints.HORIZONTAL;
00365 constraintsNameTextField.weightx = 1.0;
00366 constraintsNameTextField.insets = new java.awt.Insets(10, 10, 0, 10);
00367 getAssertionPanel().add(getNameTextField(), constraintsNameTextField);
00368
00369 java.awt.GridBagConstraints constraintsTypeLabel = new java.awt.GridBagConstraints();
00370 constraintsTypeLabel.gridx = 0; constraintsTypeLabel.gridy = 1;
00371 constraintsTypeLabel.fill = java.awt.GridBagConstraints.BOTH;
00372 constraintsTypeLabel.insets = new java.awt.Insets(10, 10, 0, 0);
00373 getAssertionPanel().add(getTypeLabel(), constraintsTypeLabel);
00374
00375 java.awt.GridBagConstraints constraintsTypeTextField = new java.awt.GridBagConstraints();
00376 constraintsTypeTextField.gridx = 1; constraintsTypeTextField.gridy = 1;
00377 constraintsTypeTextField.gridwidth = 4;
00378 constraintsTypeTextField.fill = java.awt.GridBagConstraints.HORIZONTAL;
00379 constraintsTypeTextField.weightx = 1.0;
00380 constraintsTypeTextField.insets = new java.awt.Insets(10, 10, 0, 10);
00381 getAssertionPanel().add(getTypeTextField(), constraintsTypeTextField);
00382
00383 java.awt.GridBagConstraints constraintsConstraintLabel = new java.awt.GridBagConstraints();
00384 constraintsConstraintLabel.gridx = 0; constraintsConstraintLabel.gridy = 2;
00385 constraintsConstraintLabel.fill = java.awt.GridBagConstraints.BOTH;
00386 constraintsConstraintLabel.insets = new java.awt.Insets(10, 10, 0, 0);
00387 getAssertionPanel().add(getConstraintLabel(), constraintsConstraintLabel);
00388
00389 java.awt.GridBagConstraints constraintsConstraintTextField = new java.awt.GridBagConstraints();
00390 constraintsConstraintTextField.gridx = 1; constraintsConstraintTextField.gridy = 2;
00391 constraintsConstraintTextField.gridwidth = 4;
00392 constraintsConstraintTextField.fill = java.awt.GridBagConstraints.HORIZONTAL;
00393 constraintsConstraintTextField.weightx = 1.0;
00394 constraintsConstraintTextField.insets = new java.awt.Insets(10, 10, 0, 10);
00395 getAssertionPanel().add(getConstraintTextField(), constraintsConstraintTextField);
00396
00397 java.awt.GridBagConstraints constraintsDescriptionLabel = new java.awt.GridBagConstraints();
00398 constraintsDescriptionLabel.gridx = 0; constraintsDescriptionLabel.gridy = 3;
00399 constraintsDescriptionLabel.gridwidth = 5;
00400 constraintsDescriptionLabel.fill = java.awt.GridBagConstraints.BOTH;
00401 constraintsDescriptionLabel.insets = new java.awt.Insets(15, 10, 0, 10);
00402 getAssertionPanel().add(getDescriptionLabel(), constraintsDescriptionLabel);
00403
00404 java.awt.GridBagConstraints constraintsDescriptionScrollPane = new java.awt.GridBagConstraints();
00405 constraintsDescriptionScrollPane.gridx = 0; constraintsDescriptionScrollPane.gridy = 4;
00406 constraintsDescriptionScrollPane.gridwidth = 5;
00407 constraintsDescriptionScrollPane.fill = java.awt.GridBagConstraints.BOTH;
00408 constraintsDescriptionScrollPane.weightx = 1.0;
00409 constraintsDescriptionScrollPane.weighty = 1.0;
00410 constraintsDescriptionScrollPane.insets = new java.awt.Insets(5, 10, 0, 10);
00411 getAssertionPanel().add(getDescriptionScrollPane(), constraintsDescriptionScrollPane);
00412
00413 java.awt.GridBagConstraints constraintsGotoButton = new java.awt.GridBagConstraints();
00414 constraintsGotoButton.gridx = 2; constraintsGotoButton.gridy = 5;
00415 constraintsGotoButton.fill = java.awt.GridBagConstraints.HORIZONTAL;
00416 constraintsGotoButton.weightx = 1.0;
00417 constraintsGotoButton.insets = new java.awt.Insets(15, 10, 10, 10);
00418 getAssertionPanel().add(getGotoButton(), constraintsGotoButton);
00419
00420 java.awt.GridBagConstraints constraintsErrorMessageButton = new java.awt.GridBagConstraints();
00421 constraintsErrorMessageButton.gridx = 4; constraintsErrorMessageButton.gridy = 5;
00422 constraintsErrorMessageButton.fill = java.awt.GridBagConstraints.BOTH;
00423 constraintsErrorMessageButton.weightx = 1.0;
00424 constraintsErrorMessageButton.insets = new java.awt.Insets(15, 0, 10, 10);
00425 getAssertionPanel().add(getErrorMessageButton(), constraintsErrorMessageButton);
00426
00427 java.awt.GridBagConstraints constraintsAddButton = new java.awt.GridBagConstraints();
00428 constraintsAddButton.gridx = 0; constraintsAddButton.gridy = 5;
00429 constraintsAddButton.gridwidth = 2;
00430 constraintsAddButton.fill = java.awt.GridBagConstraints.HORIZONTAL;
00431 constraintsAddButton.weightx = 1.0;
00432 constraintsAddButton.insets = new java.awt.Insets(15, 10, 10, 0);
00433 getAssertionPanel().add(getAddButton(), constraintsAddButton);
00434
00435
00436 } catch (java.lang.Throwable ivjExc) {
00437
00438
00439 handleException(ivjExc);
00440 }
00441 }
00442 return ivjAssertionPanel;
00443 }
00444
00445
00446
00447
00448
00449 private javax.swing.JScrollPane getAssertionScrollPane() {
00450 if (ivjAssertionScrollPane == null) {
00451 try {
00452 ivjAssertionScrollPane = new javax.swing.JScrollPane();
00453 ivjAssertionScrollPane.setName("AssertionScrollPane");
00454 ivjAssertionScrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
00455 getAssertionScrollPane().setViewportView(getAssertionTree());
00456
00457
00458 } catch (java.lang.Throwable ivjExc) {
00459
00460
00461 handleException(ivjExc);
00462 }
00463 }
00464 return ivjAssertionScrollPane;
00465 }
00466
00467
00468
00469
00470
00471 private javax.swing.JTree getAssertionTree() {
00472 if (ivjAssertionTree == null) {
00473 try {
00474 ivjAssertionTree = new javax.swing.JTree();
00475 ivjAssertionTree.setName("AssertionTree");
00476 ivjAssertionTree.setBackground(new java.awt.Color(204,204,204));
00477 ivjAssertionTree.setBounds(0, 0, 526, 299);
00478
00479 ivjAssertionTree.setUI(new javax.swing.plaf.metal.MetalTreeUI() {
00480 public javax.swing.plaf.metal.MetalTreeUI setAngledColor() {
00481 setHashColor(Color.black);
00482 return this;
00483 }
00484 }.setAngledColor());
00485 ivjAssertionTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
00486 ivjAssertionTree.setCellRenderer(new DefaultTreeCellRenderer() {
00487 public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
00488 super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
00489 setIcon(null);
00490 Object o = ((DefaultMutableTreeNode) value).getUserObject();
00491 if (o instanceof AssertionSet) {
00492 setText(((AssertionSet) o).getName().toString());
00493 } else if (o instanceof Assertion) {
00494 Assertion a = (Assertion) o;
00495 setText(a.getName().getLastIdentifier());
00496 if (!a.isValid())
00497 setIcon(IconLibrary.errorIcon);
00498 }
00499 return this;
00500 }
00501 });
00502 ((DefaultTreeCellRenderer) ivjAssertionTree.getCellRenderer()).setBackgroundNonSelectionColor(new Color(204, 204, 204));
00503 ivjAssertionTree.putClientProperty("JTree.lineStyle", "Angled");
00504
00505 } catch (java.lang.Throwable ivjExc) {
00506
00507
00508 handleException(ivjExc);
00509 }
00510 }
00511 return ivjAssertionTree;
00512 }
00513
00514
00515
00516
00517 private static void getBuilderData() {
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567 }
00568
00569
00570
00571
00572
00573 private javax.swing.JLabel getConstraintLabel() {
00574 if (ivjConstraintLabel == null) {
00575 try {
00576 ivjConstraintLabel = new javax.swing.JLabel();
00577 ivjConstraintLabel.setName("ConstraintLabel");
00578 ivjConstraintLabel.setText("Constraint:");
00579 ivjConstraintLabel.setForeground(java.awt.Color.black);
00580
00581
00582 } catch (java.lang.Throwable ivjExc) {
00583
00584
00585 handleException(ivjExc);
00586 }
00587 }
00588 return ivjConstraintLabel;
00589 }
00590
00591
00592
00593
00594
00595 private javax.swing.JTextField getConstraintTextField() {
00596 if (ivjConstraintTextField == null) {
00597 try {
00598 ivjConstraintTextField = new javax.swing.JTextField();
00599 ivjConstraintTextField.setName("ConstraintTextField");
00600 ivjConstraintTextField.setBorder(BorderFactory.createLoweredBevelBorder());
00601 ivjConstraintTextField.setEditable(false);
00602
00603
00604 } catch (java.lang.Throwable ivjExc) {
00605
00606
00607 handleException(ivjExc);
00608 }
00609 }
00610 return ivjConstraintTextField;
00611 }
00612
00613
00614
00615
00616
00617 private javax.swing.JLabel getDescriptionLabel() {
00618 if (ivjDescriptionLabel == null) {
00619 try {
00620 ivjDescriptionLabel = new javax.swing.JLabel();
00621 ivjDescriptionLabel.setName("DescriptionLabel");
00622 ivjDescriptionLabel.setText("Description:");
00623 ivjDescriptionLabel.setForeground(java.awt.Color.black);
00624
00625
00626 } catch (java.lang.Throwable ivjExc) {
00627
00628
00629 handleException(ivjExc);
00630 }
00631 }
00632 return ivjDescriptionLabel;
00633 }
00634
00635
00636
00637
00638
00639 private javax.swing.JScrollPane getDescriptionScrollPane() {
00640 if (ivjDescriptionScrollPane == null) {
00641 try {
00642 ivjDescriptionScrollPane = new javax.swing.JScrollPane();
00643 ivjDescriptionScrollPane.setName("DescriptionScrollPane");
00644 getDescriptionScrollPane().setViewportView(getDescriptionTextArea());
00645
00646
00647 } catch (java.lang.Throwable ivjExc) {
00648
00649
00650 handleException(ivjExc);
00651 }
00652 }
00653 return ivjDescriptionScrollPane;
00654 }
00655
00656
00657
00658
00659
00660 private javax.swing.JTextArea getDescriptionTextArea() {
00661 if (ivjDescriptionTextArea == null) {
00662 try {
00663 ivjDescriptionTextArea = new javax.swing.JTextArea();
00664 ivjDescriptionTextArea.setName("DescriptionTextArea");
00665 ivjDescriptionTextArea.setBorder(BorderFactory.createLoweredBevelBorder());
00666 ivjDescriptionTextArea.setBackground(new java.awt.Color(204,204,204));
00667 ivjDescriptionTextArea.setBounds(0, 0, 160, 120);
00668 ivjDescriptionTextArea.setEditable(false);
00669
00670
00671 } catch (java.lang.Throwable ivjExc) {
00672
00673
00674 handleException(ivjExc);
00675 }
00676 }
00677 return ivjDescriptionTextArea;
00678 }
00679
00680
00681
00682
00683
00684 private javax.swing.JButton getErrorMessageButton() {
00685 if (ivjErrorMessageButton == null) {
00686 try {
00687 ivjErrorMessageButton = new javax.swing.JButton();
00688 ivjErrorMessageButton.setName("ErrorMessageButton");
00689 ivjErrorMessageButton.setMnemonic('e');
00690 ivjErrorMessageButton.setText("Show Error Message(s)");
00691 ivjErrorMessageButton.setBackground(new java.awt.Color(204,204,255));
00692 ivjErrorMessageButton.setEnabled(false);
00693
00694
00695 } catch (java.lang.Throwable ivjExc) {
00696
00697
00698 handleException(ivjExc);
00699 }
00700 }
00701 return ivjErrorMessageButton;
00702 }
00703
00704
00705
00706
00707
00708 private javax.swing.JButton getGotoButton() {
00709 if (ivjGotoButton == null) {
00710 try {
00711 ivjGotoButton = new javax.swing.JButton();
00712 ivjGotoButton.setName("GotoButton");
00713 ivjGotoButton.setMnemonic('g');
00714 ivjGotoButton.setText("Goto Definition");
00715 ivjGotoButton.setBackground(new java.awt.Color(204,204,255));
00716 ivjGotoButton.setEnabled(false);
00717
00718
00719 } catch (java.lang.Throwable ivjExc) {
00720
00721
00722 handleException(ivjExc);
00723 }
00724 }
00725 return ivjGotoButton;
00726 }
00727
00728
00729
00730
00731
00732 private javax.swing.JLabel getNameLabel() {
00733 if (ivjNameLabel == null) {
00734 try {
00735 ivjNameLabel = new javax.swing.JLabel();
00736 ivjNameLabel.setName("NameLabel");
00737 ivjNameLabel.setText("Name:");
00738 ivjNameLabel.setForeground(java.awt.Color.black);
00739
00740
00741 } catch (java.lang.Throwable ivjExc) {
00742
00743
00744 handleException(ivjExc);
00745 }
00746 }
00747 return ivjNameLabel;
00748 }
00749
00750
00751
00752
00753
00754 private javax.swing.JTextField getNameTextField() {
00755 if (ivjNameTextField == null) {
00756 try {
00757 ivjNameTextField = new javax.swing.JTextField();
00758 ivjNameTextField.setName("NameTextField");
00759 ivjNameTextField.setBorder(BorderFactory.createLoweredBevelBorder());
00760 ivjNameTextField.setEditable(false);
00761
00762
00763 } catch (java.lang.Throwable ivjExc) {
00764
00765
00766 handleException(ivjExc);
00767 }
00768 }
00769 return ivjNameTextField;
00770 }
00771
00772
00773
00774
00775
00776 private javax.swing.JButton getOkButton() {
00777 if (ivjOkButton == null) {
00778 try {
00779 ivjOkButton = new javax.swing.JButton();
00780 ivjOkButton.setName("OkButton");
00781 ivjOkButton.setMnemonic('o');
00782 ivjOkButton.setText("Ok");
00783 ivjOkButton.setBackground(new java.awt.Color(204,204,255));
00784
00785
00786 } catch (java.lang.Throwable ivjExc) {
00787
00788
00789 handleException(ivjExc);
00790 }
00791 }
00792 return ivjOkButton;
00793 }
00794
00795
00796
00797
00798
00799 private javax.swing.JLabel getTypeLabel() {
00800 if (ivjTypeLabel == null) {
00801 try {
00802 ivjTypeLabel = new javax.swing.JLabel();
00803 ivjTypeLabel.setName("TypeLabel");
00804 ivjTypeLabel.setText("Type:");
00805 ivjTypeLabel.setForeground(java.awt.Color.black);
00806
00807
00808 } catch (java.lang.Throwable ivjExc) {
00809
00810
00811 handleException(ivjExc);
00812 }
00813 }
00814 return ivjTypeLabel;
00815 }
00816
00817
00818
00819
00820
00821 private javax.swing.JTextField getTypeTextField() {
00822 if (ivjTypeTextField == null) {
00823 try {
00824 ivjTypeTextField = new javax.swing.JTextField();
00825 ivjTypeTextField.setName("TypeTextField");
00826 ivjTypeTextField.setBorder(BorderFactory.createLoweredBevelBorder());
00827 ivjTypeTextField.setEditable(false);
00828
00829
00830 } catch (java.lang.Throwable ivjExc) {
00831
00832
00833 handleException(ivjExc);
00834 }
00835 }
00836 return ivjTypeTextField;
00837 }
00838
00839
00840
00841 public void gotoButton_ActionEvents() {
00842 Assertion p = (Assertion) ((DefaultMutableTreeNode) getAssertionTree().getLastSelectedPathComponent()).getUserObject();
00843 Annotation a = p.getAnnotation();
00844 if (a instanceof LabeledStmtAnnotation) {
00845 a = CompilationManager.getAnnotationManager().getMethodAnnotationContainingAnnotation(a);
00846 }
00847 BUI.sessionPane.select(a, p);
00848 }
00849
00850
00851
00852
00853 private void handleException(java.lang.Throwable exception) {
00854
00855
00856
00857
00858 }
00859
00860
00861
00862
00863
00864 private void initConnections() throws java.lang.Exception {
00865
00866
00867 getOkButton().addActionListener(ivjEventHandler);
00868 getErrorMessageButton().addActionListener(ivjEventHandler);
00869 getAssertionTree().addTreeSelectionListener(ivjEventHandler);
00870 getGotoButton().addActionListener(ivjEventHandler);
00871 getAddButton().addActionListener(ivjEventHandler);
00872 }
00873
00874
00875
00876
00877 private void initialize() {
00878 try {
00879
00880
00881 setName("AssertionBrowser");
00882 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
00883 setSize(529, 335);
00884 setTitle("Assertion Browser");
00885 setContentPane(getAssertionBrowserContentPane());
00886 initConnections();
00887 } catch (java.lang.Throwable ivjExc) {
00888 handleException(ivjExc);
00889 }
00890
00891 updateTree();
00892
00893 }
00894
00895
00896
00897
00898 public static void main(java.lang.String[] args) {
00899 try {
00900 PredicateBrowser aPredicateBrowser;
00901 aPredicateBrowser = new PredicateBrowser();
00902 aPredicateBrowser.addWindowListener(new java.awt.event.WindowAdapter() {
00903 public void windowClosing(java.awt.event.WindowEvent e) {
00904 System.exit(0);
00905 };
00906 });
00907 aPredicateBrowser.setVisible(true);
00908 } catch (Throwable exception) {
00909 System.err.println("Exception occurred in main() of javax.swing.JFrame");
00910 exception.printStackTrace(System.out);
00911 }
00912 }
00913
00914
00915
00916 public void updateTree() {
00917 getAssertionTree().setModel(new DefaultTreeModel(buildTree(new DefaultMutableTreeNode("Assertion"), AssertionSet.getAssertionSetTable())));
00918 getAssertionScrollPane().validate();
00919 getAssertionScrollPane().repaint();
00920
00921 }
00922 }