Exemplo n.º 1
0
  private void update() {
    // Update the older/newer buttons & label.
    int count = MailItems.getMailItemCount();
    int max = startIndex + VISIBLE_EMAIL_COUNT;
    if (max > count) {
      max = count;
    }

    // Update the nav bar.
    navBar.update(startIndex, count, max);

    // Show the selected emails.
    int i = 0;
    for (; i < VISIBLE_EMAIL_COUNT; ++i) {
      // Don't read past the end.
      if (startIndex + i >= MailItems.getMailItemCount()) {
        break;
      }

      MailItem item = MailItems.getMailItem(startIndex + i);

      // Add a new row to the table, then set each of its columns to the
      // email's sender and subject values.
      table.setText(i, 0, item.sender);
      table.setText(i, 1, item.email);
      table.setText(i, 2, item.subject);
    }

    // Clear any remaining slots.
    for (; i < VISIBLE_EMAIL_COUNT; ++i) {
      table.removeRow(table.getRowCount() - 1);
    }
  }
Exemplo n.º 2
0
 void older() {
   // Move forward a page.
   startIndex += VISIBLE_EMAIL_COUNT;
   if (startIndex >= MailItems.getMailItemCount()) {
     startIndex -= VISIBLE_EMAIL_COUNT;
   } else {
     styleRow(selectedRow, false);
     selectedRow = -1;
     update();
   }
 }