/** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user pressed the remove button
   if (e.getSource() == remove_button) {
     int row = table.getSelectedRow();
     model.removeRow(row);
     table.clearSelection();
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the remove all button
   if (e.getSource() == remove_all_button) {
     model.clearAll();
     table.setRowSelectionInterval(0, 0);
     table.repaint();
     valueChanged(null);
   }
   // Check if the user pressed the filter button
   if (e.getSource() == filter_button) {
     filter.showDialog();
     if (filter.okPressed()) {
       // Update the display with new filter
       model.setFilter(filter);
       table.repaint();
     }
   }
   // Check if the user pressed the start button
   if (e.getSource() == start_button) {
     start();
   }
   // Check if the user pressed the stop button
   if (e.getSource() == stop_button) {
     stop();
   }
   // Check if the user wants to switch layout
   if (e.getSource() == layout_button) {
     details_panel.remove(details_soap);
     details_soap.removeAll();
     if (details_soap.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
       details_soap = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
     } else {
       details_soap = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
     }
     details_soap.setTopComponent(request_panel);
     details_soap.setRightComponent(response_panel);
     details_soap.setResizeWeight(.5);
     details_panel.add(details_soap, BorderLayout.CENTER);
     details_panel.validate();
     details_panel.repaint();
   }
   // Check if the user is changing the reflow option
   if (e.getSource() == reflow_xml) {
     request_text.setReflowXML(reflow_xml.isSelected());
     response_text.setReflowXML(reflow_xml.isSelected());
   }
 }
Ejemplo n.º 2
0
  public void dispose() {
    log.config("(" + m_mTab.toString() + ")");

    // clear info

    stopEditor(false);

    if (m_mTab.needSave(true, false)) {
      m_mTab.dataIgnore();
    }

    vIncludedGC = null;

    // Listeners

    m_mTab.getTableModel().removeDataStatusListener(this);
    m_mTab.getTableModel().removeVetoableChangeListener(this);
    vTable.getSelectionModel().removeListSelectionListener(this);
    m_mTab.removePropertyChangeListener(vTable);

    // editors

    Component[] comp = vPanel.getComponents();

    for (int i = 0; i < comp.length; i++) {
      if (comp[i] instanceof VEditor) {
        VEditor vEditor = (VEditor) comp[i];

        vEditor.removeVetoableChangeListener(this);

        String columnName = comp[i].getName();
        MField mField = m_mTab.getField(columnName);

        if (mField != null) {
          mField.removePropertyChangeListener(vEditor);
        }

        vEditor.dispose();
      }
    }

    vTable.removeAll();
    vTable.setModel(new DefaultTableModel()); // remove reference
    vTable = null;
    vPanel.removeAll();
    vPanel = null;
    splitPane.removeAll();
    splitPane = null;
    m_mTab = null;
    m_tree = null;
    this.removeAll();
  } // dispose