Exemplo n.º 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);
  }
Exemplo n.º 2
0
  /**
   * Shows given list of reading lists.
   *
   * @param lists lists.
   */
  protected void setReadingLists(ReadingList[] lists) {
    tblReadingLists.setEnabled(lists != null);
    btnAddReadingList.setEnabled(lists != null);
    btnRemoveList.setEnabled(lists != null);

    readingListsModel.setLists(lists);
  }
Exemplo n.º 3
0
 /**
  * Returns the default table cell renderer.
  *
  * @param table the <code>JTable</code>
  * @param value the value to assign to the cell at <code>[row, column]</code>
  * @param isSelected true if cell is selected
  * @param hasFocus true if cell has focus
  * @param row the row of the cell to render
  * @param column the column of the cell to render
  * @return the default table cell renderer
  */
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   ReadingList list = model.getLists()[row];
   Component comp =
       super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
   comp.setForeground(list.isMissing() ? Color.GRAY : table.getForeground());
   return comp;
 }
Exemplo n.º 4
0
  /** Invoked when adding new reading list is required. */
  private void onAddReadingList() {
    if (GlobalController.SINGLETON.checkForNewSubscription()) return;

    URL[] newListURLs = queryForURL();
    if (newListURLs != null) {
      for (URL url : newListURLs) readingListsModel.addList(url);
    }
  }
Exemplo n.º 5
0
 /**
  * Returns currently displayed list of reading lists.
  *
  * @return list which is currently displayed.
  */
 public ReadingList[] getReadingLists() {
   return readingListsModel.getLists();
 }