示例#1
0
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      if (isSelected) this.setBackground(table.getSelectionBackground());
      else this.setBackground(table.getBackground());

      Node node = nodes.get(row);
      Request request = nodeIDToRequest.get(node.getNodeID());
      if (request == null) {
        this.setString("NONE");
        this.setValue(0);
      } else {
        int percent = (int) Math.round(request.getPercentDone());
        this.setString(request.getType().toString() + "  " + percent + "%");
        this.setValue(percent);
      }
      return this;
    }
示例#2
0
  public synchronized Object getValueAt(int row, int col) {
    Node node = nodes.get(row);

    switch (col) {
      case 0:
        return node.getNodeID();
      case 1:
        return node.getCurrState();
      case 2:
        return node.getTailBlockID();
      case 3:
        return node.getHeadBlockID();
      case 4:
        return node.getLocalTime();
      case 5:
        return node.getGlobalTime();
      case 6:
        return node.getIsTimeSynchronized();
      case 7:
        return new LastRequestCellRendererClass();
      default:
        return "UNKNOWN";
    }
  }