Esempio n. 1
0
  @Override
  public Component prepareRenderer(
      final TableCellRenderer renderer, final int row, final int column) {
    Component component = super.prepareRenderer(renderer, row, column);
    boolean isSelected = isCellSelected(row, column);
    Value value = tableModel.getElementAt(row);
    String columnName =
        (String) this.getTableHeader().getColumnModel().getColumn(column).getHeaderValue();
    Object object = getValueAt(row, column);
    boolean string;
    if (object instanceof String) {
      string = true;
    } else {
      string = false;
    }

    // UGrand Total
    if (value.isGrandTotal()) {
      if (!isSelected) {
        component.setBackground(new Color(230, 230, 230));
      } else {
        component.setBackground(this.getSelectionBackground().darker());
      }
      return component;
    }
    // Best Asset: none
    if (string
        && TabsValues.get().none().equals(value.getBestAssetName())
        && columnName.equals(ValueTableFormat.BEST_ASSET_NAME.getColumnName())) {
      Font font = component.getFont();
      component.setFont(new Font(font.getName(), Font.ITALIC, font.getSize()));
    }
    // Best Module: none
    if (string
        && TabsValues.get().none().equals(value.getBestModuleName())
        && columnName.equals(ValueTableFormat.BEST_MODULE_NAME.getColumnName())) {
      Font font = component.getFont();
      component.setFont(new Font(font.getName(), Font.ITALIC, font.getSize()));
    }
    // Best Ship (Fitted): none
    if (string
        && TabsValues.get().none().equals(value.getBestShipFittedName())
        && columnName.equals(ValueTableFormat.BEST_SHIP_FITTED_NAME.getColumnName())) {
      Font font = component.getFont();
      component.setFont(new Font(font.getName(), Font.ITALIC, font.getSize()));
    }
    // Best Ship: none
    if (string
        && TabsValues.get().none().equals(value.getBestShipName())
        && columnName.equals(ValueTableFormat.BEST_SHIP_NAME.getColumnName())) {
      Font font = component.getFont();
      component.setFont(new Font(font.getName(), Font.ITALIC, font.getSize()));
    }
    return component;
  }
  /** Clears the data model and releases resources used by the event list. */
  public void clearEventList() {
    // Get table model and dispose resources.
    TableModel tableModel = getModel();
    if (tableModel instanceof DefaultEventTableModel) {
      ((DefaultEventTableModel) tableModel).dispose();
    }

    // Set default model to remove old reference.
    setModel(new DefaultTableModel());

    // Dispose connection list.
    connectionList.dispose();
    connectionList = null;
  }