private void clearModel(ComboBoxTableModel model) { int rows = model.getRowCount(); while (0 < rows) { model.removeRow(0); rows--; } }
private void loadViolationType(String ruletypeKey) { for (RuleType ruletype : ruletypes) { if (ruletype.getKey().equals(ruletypeKey)) { clearModel(violationtypeModel); for (ViolationType violationtype : ruletype.getViolationTypes()) { violationtypeModel.addRow( new Object[] {violationtype.getViolationtypeKey(), 1, violationtype.isActive()}); } } } }
public LanguageViolationConfigurationPanel( String language, List<RuleType> ruletypes, List<Severity> severityNames, TaskServiceImpl ts) { this.language = language; this.ruletypes = ruletypes; this.ts = ts; String[] ruletypeColumnNames = {"Ruletype", "Severity"}; ruletypeModel = new ComboBoxTableModel(ruletypeColumnNames, 0, severityNames); ruletypeModel.setTypes(new Class[] {java.lang.String.class, java.lang.String.class}); ruletypeModel.setCanEdit(new Boolean[] {false, true}); String[] violationtypeModelHeaders = {"Violationtype", "Severity", "Active"}; violationtypeModel = new ComboBoxTableModel(violationtypeModelHeaders, 0, severityNames); violationtypeModel.setTypes(new Class[] {String.class, String.class, Boolean.class}); violationtypeModel.setCanEdit(new Boolean[] {false, true, true}); initComponents(); TableColumnModel tcm = ruletypeTable.getColumnModel(); tcm.getColumn(1).setCellEditor(ruletypeModel.getEditor()); LoadRuleTypes(); }
private void LoadRuleTypes() { for (RuleType ruletype : ruletypes) { ruletypeModel.addRow(new Object[] {ruletype.getKey(), ts.getAllSeverities().get(0)}); } }
private void ruletypeTableKeyPressed() { if (ruletypeTable.getSelectedRow() > -1) { loadViolationType((String) ruletypeModel.getValueAt(ruletypeTable.getSelectedRow(), 0)); } }
private void ruletypeTableMouseClicked() { if (ruletypeTable.getSelectedRow() > -1) { System.out.print("test"); loadViolationType((String) ruletypeModel.getValueAt(ruletypeTable.getSelectedRow(), 0)); } }