Skip to content

Commit

Permalink
Merge pull request #1070 from sidheshenator/keyword-list-automatic-se…
Browse files Browse the repository at this point in the history
…lection

newly added keyword list is selected by default
  • Loading branch information
rcordovano committed Feb 24, 2015
2 parents 42c7c89 + 72dafd3 commit 902ad99
Showing 1 changed file with 16 additions and 4 deletions.
Expand Up @@ -197,12 +197,14 @@ private void newListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
if (shouldAdd) {
writer.addList(listName, new ArrayList<Keyword>());
}
tableModel.resync();

//This loop selects the recently ADDED keywordslist in the JTable
for (int i = 0; i < listsTable.getRowCount(); i++) {
if (listsTable.getValueAt(i, 0).equals(listName)) {
listsTable.getSelectionModel().addSelectionInterval(i, i);
}
}
tableModel.resync();
}//GEN-LAST:event_newListButtonActionPerformed

private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importButtonActionPerformed
Expand All @@ -214,6 +216,7 @@ private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
chooser.setFileFilter(filter);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);

String listName = null;
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File selFile = chooser.getSelectedFile();
Expand Down Expand Up @@ -245,12 +248,13 @@ private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-

for (KeywordList list : toImport) {
//check name collisions
if (writer.listExists(list.getName())) {
listName = list.getName();
if (writer.listExists(listName)) {
Object[] options = {NbBundle.getMessage(this.getClass(), "KeywordSearch.yesOwMsg"),
NbBundle.getMessage(this.getClass(), "KeywordSearch.noSkipMsg"),
NbBundle.getMessage(this.getClass(), "KeywordSearch.cancelImportMsg")};
int choice = JOptionPane.showOptionDialog(this,
NbBundle.getMessage(this.getClass(), "KeywordSearch.overwriteListPrompt", list.getName()),
NbBundle.getMessage(this.getClass(), "KeywordSearch.overwriteListPrompt", listName),
NbBundle.getMessage(this.getClass(), "KeywordSearch.importOwConflict"),
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE,
Expand Down Expand Up @@ -281,8 +285,16 @@ private void importButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-

}
tableModel.resync();
}//GEN-LAST:event_importButtonActionPerformed

//This loop selects the recently IMPORTED keywordslist in the JTable
if (listName != null) {
for (int i = 0; i < listsTable.getRowCount(); i++) {
if (listsTable.getValueAt(i, 0).equals(listName)) {
listsTable.getSelectionModel().addSelectionInterval(i, i);
}
}
}
}//GEN-LAST:event_importButtonActionPerformed
private void listsTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_listsTableKeyPressed
if(evt.getKeyCode() == KeyEvent.VK_DELETE) {
int[] selected = listsTable.getSelectedRows();
Expand Down

0 comments on commit 902ad99

Please sign in to comment.