示例#1
0
 /** @see org.tramper.gui.viewer.Viewer#previous() */
 public void previous() {
   int selectedRowView = feedTable.getSelectedRow();
   feedTable.changeSelection(selectedRowView - 1, 0, false, false);
   int selectedRowModel = feedTable.convertRowIndexToModel(selectedRowView);
   document.setIndex(selectedRowModel - 1);
   FeedItem selectedItem = document.getItem(selectedRowModel - 1);
   String displayableItem = renderFeedItem(selectedItem);
   feedItemDetail.setText(displayableItem);
 }
示例#2
0
 /** @see org.tramper.gui.viewer.Viewer#last() */
 public void last() {
   int maxRowView = feedTable.getModel().getRowCount();
   feedTable.changeSelection(maxRowView - 1, 0, false, false);
   int maxRowModel = feedTable.convertRowIndexToModel(maxRowView);
   document.setIndex(maxRowModel - 1);
   FeedItem selectedItem = document.getItem(maxRowModel - 1);
   String displayableItem = renderFeedItem(selectedItem);
   feedItemDetail.setText(displayableItem);
 }
示例#3
0
 /** @see org.tramper.gui.viewer.Viewer#first() */
 public void first() {
   int minRowView = 0;
   feedTable.changeSelection(minRowView, 0, false, false);
   int minRowModel = feedTable.convertRowIndexToModel(minRowView);
   document.setIndex(minRowModel);
   FeedItem selectedItem = document.getItem(minRowModel);
   String displayableItem = renderFeedItem(selectedItem);
   feedItemDetail.setText(displayableItem);
 }
示例#4
0
 public void mousePressed(MouseEvent e) {
   int clickedButton = e.getButton();
   if (clickedButton == MouseEvent.BUTTON1) {
     Library.getInstance().setActiveDocument(target);
     int selectedRowView = feedTable.getSelectedRow();
     int selectedRowModel = feedTable.convertRowIndexToModel(selectedRowView);
     document.setIndex(selectedRowModel);
     FeedItem selectedItem = document.getItem(selectedRowModel);
     String displayableItem = renderFeedItem(selectedItem);
     feedItemDetail.setText(displayableItem);
   }
 }
示例#5
0
 public void keyReleased(KeyEvent e) {
   int keyCode = e.getKeyCode();
   if (keyCode == KeyEvent.VK_UP
       || keyCode == KeyEvent.VK_DOWN
       || keyCode == KeyEvent.VK_PAGE_DOWN
       || keyCode == KeyEvent.VK_PAGE_UP) {
     int selectedRowView = feedTable.getSelectedRow();
     int selectedRowModel = feedTable.convertRowIndexToModel(selectedRowView);
     document.setIndex(selectedRowModel);
     FeedItem selectedItem = document.getItem(selectedRowModel);
     String displayableItem = renderFeedItem(selectedItem);
     feedItemDetail.setText(displayableItem);
   }
 }
示例#6
0
  public void paintMiniature(Graphics2D g2d, Dimension miniatureSize, boolean mouseOver) {
    Image feedIcon = document.getIcon();
    if (feedIcon != null) {
      int iconWidth = feedIcon.getWidth(this);
      int iconHeight = feedIcon.getHeight(this);

      double scale = (double) miniatureSize.width / (double) iconWidth;
      if (scale > 1) {
        scale = 1.0;
      }
      g2d.scale(scale, scale);
      int x = (miniatureSize.width - iconWidth) / 2;
      if (x < 0) {
        x = 0;
      }
      int y = (miniatureSize.height - iconHeight) / 2;
      if (y < 0) {
        y = 0;
      }
      g2d.setRenderingHint(
          RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
      g2d.drawImage(feedIcon, x, y, this);

      // reset scale
      g2d.scale(1 / scale, 1 / scale);
    } else {
      double scale = 0.8;
      g2d.scale(scale, scale);

      feedTable.paint(g2d);

      // reset scale
      g2d.scale(1 / scale, 1 / scale);
    }
  }
示例#7
0
  /**
   * @see org.tramper.gui.viewer.Body#displayDocument(org.tramper.doc.SimpleDocument,
   *     org.tramper.doc.Target, int)
   */
  public void displayDocument(SimpleDocument doc, Target target, int documentPart) {
    if (!(doc instanceof Feed)) {
      throw new RuntimeException(doc.getTitle() + " is not a Feed");
    }
    document = (Feed) doc;
    this.target = target;

    feedTable.setModel(document);
    TableRowSorter<TableModel> tableSorter = new TableRowSorter<TableModel>(document);
    feedTable.setRowSorter(tableSorter);

    long indexModel = document.getIndex();
    int indexView = feedTable.convertColumnIndexToView((int) indexModel);
    feedTable.changeSelection(indexView, 0, false, false);
    TableColumnModel model = feedTable.getColumnModel();

    ListTableCellRenderer linkCellRenderer = new ListTableCellRenderer();
    ListTableCellEditor linkCellEditor = new ListTableCellEditor();
    TableColumn descColumn = model.getColumn(2);
    descColumn.setCellRenderer(linkCellRenderer);
    descColumn.setCellEditor(linkCellEditor);

    DateTableCellRenderer dateCellRenderer = new DateTableCellRenderer();
    descColumn = model.getColumn(3);
    descColumn.setCellRenderer(dateCellRenderer);
    descColumn = model.getColumn(4);
    descColumn.setCellRenderer(dateCellRenderer);

    this.initColumnSizes(feedTable);
  }