@Override protected boolean handleOk() { setVisible(false); int selectedRow = assertionsTable.getSelectedRow(); String selection = ((AssertionListEntry) assertionsListTableModel.getValueAt(selectedRow, 0)).getName(); if (selection == null) { return false; } if (!TestAssertionRegistry.getInstance().canAddMultipleAssertions(selection, assertable)) { UISupport.showErrorMessage("This assertion can only be added once"); return false; } TestAssertion assertion = assertable.addAssertion(selection); if (assertion == null) { UISupport.showErrorMessage("Failed to add assertion"); return false; } recentAssertionHandler.add(selection); if (assertion.isConfigurable()) { assertion.configure(); return true; } return true; }
protected Component buildAssertionsList() { assertionsForm = new SimpleForm(); assertionsListTableModel = new AssertionsListTableModel(); assertionsTable = new AssertionsListTable(assertionsListTableModel); int selectedRow = categoriesListTable.getSelectedRow(); String category = (String) categoriesListTable.getModel().getValueAt(selectedRow, 0); if (category != null && categoriesAssertionsMap.containsKey(category)) { assertions = categoriesAssertionsMap.get(category); assertionsListTableModel.setListEntriesSet(assertions); } assertionsTable.setTableHeader(null); assertionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); assertionsTable.getSelectionModel().addListSelectionListener(selectionListener); assertionsTable.setEditable(false); assertionsTable.setGridColor(Color.BLACK); assertionsTable.addMouseListener(mouseAdapter); assertionsTable.getColumnModel().getColumn(0).setCellRenderer(assertionEntryRenderer); assertionsForm.addComponent(assertionsTable); return new JScrollPane(assertionsForm.getPanel()); }
public void release() { assertionsTable.getSelectionModel().removeListSelectionListener(selectionListener); assertionsTable.removeMouseListener(mouseAdapter); hideDescCB.removeItemListener(hideDescListener); }