private void mapInsertButtonActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_mapInsertButtonActionPerformed { // GEN-HEADEREND:event_mapInsertButtonActionPerformed commitTableEdits(); MappingRulesModel model = (MappingRulesModel) mapTable.getModel(); model.addRow(); mapTable.changeSelection(mapTable.getRowCount() - 1, 0, false, false); mapTable.changeSelection( mapTable.getRowCount() - 1, mapTable.getColumnCount() - 1, false, true); } // GEN-LAST:event_mapInsertButtonActionPerformed
private void mapUpButtonActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_mapUpButtonActionPerformed { // GEN-HEADEREND:event_mapUpButtonActionPerformed commitTableEdits(); MappingRulesModel model = (MappingRulesModel) mapTable.getModel(); int selrow = mapTable.getSelectedRow(); model.moveRowUp(selrow); mapTable.getSelectionModel().clearSelection(); mapTable.getSelectionModel().addSelectionInterval(selrow - 1, selrow - 1); } // GEN-LAST:event_mapUpButtonActionPerformed
private void constructor(boolean projectSpecific, SRX defaultSRX, SRX userSRX, SRX projectSRX) { this.isProjectSpecific = projectSpecific; this.defaultSRX = defaultSRX; this.userSRX = userSRX; this.projectSRX = projectSRX; this.editableSRX = isProjectSpecific && projectSRX != null ? projectSRX.clone() : userSRX.clone(); StaticUIUtils.setEscapeAction( this, new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { cancelButtonActionPerformed(null); } }); initComponents(); getRootPane().setDefaultButton(okButton); mapTable.getSelectionModel().addListSelectionListener(this); ruleTable.getSelectionModel().addListSelectionListener(this); MappingRulesModel model = (MappingRulesModel) mapTable.getModel(); model.addExceptionListener( new ExceptionListener() { @Override public void exceptionThrown(Exception e) { mapErrorsLabel.setText(e.getLocalizedMessage()); } }); if (isProjectSpecific) { setTitle(OStrings.getString("GUI_SEGMENTATION_TITLE_PROJECTSPECIFIC")); // NOI18N } else { projectSpecificCB.setVisible(false); } if (projectSpecific && projectSRX == null) { mapTable.setEnabled(false); mapTable.setFocusable(false); mapInsertButton.setEnabled(false); toDefaultsButton.setEnabled(false); } else { if (projectSpecific) projectSpecificCB.setSelected(true); mapTable.setEnabled(true); mapTable.setFocusable(true); mapInsertButton.setEnabled(true); toDefaultsButton.setEnabled(true); } pack(); setSize(getWidth() * 5 / 4, getHeight() * 5 / 4); DockingUI.displayCentered(this); }
private void mapDeleteButtonActionPerformed( java.awt.event.ActionEvent evt) // GEN-FIRST:event_mapDeleteButtonActionPerformed { // GEN-HEADEREND:event_mapDeleteButtonActionPerformed commitTableEdits(); MappingRulesModel model = (MappingRulesModel) mapTable.getModel(); String set = model.getValueAt(mapTable.getSelectedRow(), 0).toString(); String title = OStrings.getString("CONFIRM_DIALOG_TITLE"); String message = StringUtil.format(OStrings.getString("SEG_CONFIRM_REMOVE_SENTSEG_SET"), set); if (JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) model.removeRow(mapTable.getSelectedRow()); } // GEN-LAST:event_mapDeleteButtonActionPerformed
protected void setEditableSRX(SRX srx) { editableSRX = srx.clone(); MappingRulesModel model = new MappingRulesModel(editableSRX); mapTable.setModel(model); model.addExceptionListener( new ExceptionListener() { @Override public void exceptionThrown(Exception e) { mapErrorsLabel.setText(e.getLocalizedMessage()); } }); ruleTable.setModel(new DefaultTableModel()); }