예제 #1
0
  /** Invoked when removing selected reading list is required. */
  private void onRemoveReadingList() {
    int[] rows = tblReadingLists.getSelectedRows();
    boolean haveFeeds = false;
    for (int i = 0; !haveFeeds && i < rows.length; i++) {
      int row = rows[i];
      haveFeeds = readingListsModel.getLists()[row].getFeeds().length > 0;
    }

    boolean delete = true;
    if (haveFeeds) {
      String msg =
          rows.length == 1
              ? Strings.message("guide.dialog.readinglists.has.feeds")
              : Strings.message("guide.dialog.readinglists.have.feeds");

      delete =
          JOptionPane.showConfirmDialog(
                  this,
                  msg,
                  Strings.message("guide.dialog.delete.readinglist"),
                  JOptionPane.YES_NO_OPTION)
              == JOptionPane.YES_OPTION;
    }

    if (delete) readingListsModel.removeRows(rows);
  }
예제 #2
0
 /** Called when user confirms the information. */
 public void doAccept() {
   String validationMessage = validateInformation();
   if (validationMessage == null) {
     super.doAccept();
   } else {
     JOptionPane.showMessageDialog(
         this,
         validationMessage,
         Strings.message("guide.dialog.error"),
         JOptionPane.ERROR_MESSAGE);
   }
 }