Пример #1
0
  private void initModel(int matchtyp) {
    setOpaque(false);

    if (m_clTableModel == null) {
      m_clTableModel = UserColumnController.instance().getMatchesModel();
      m_clTableModel.setValues(
          DBManager.instance()
              .getMatchesKurzInfo(
                  HOVerwaltung.instance().getModel().getBasics().getTeamId(), matchtyp, false));
      m_clTableSorter =
          new TableSorter(m_clTableModel, m_clTableModel.getDisplayedColumns().length - 1, -1);

      final ToolTipHeader header = new ToolTipHeader(getColumnModel());
      header.setToolTipStrings(m_clTableModel.getTooltips());
      header.setToolTipText("");
      setTableHeader(header);

      setModel(m_clTableSorter);

      final TableColumnModel tableColumnModel = getColumnModel();

      for (int i = 0; i < m_clTableModel.getColumnCount(); i++) {
        tableColumnModel.getColumn(i).setIdentifier(new Integer(i));
      }

      int[][] targetColumn = m_clTableModel.getColumnOrder();

      // Reihenfolge -> nach [][1] sortieren
      targetColumn = Helper.sortintArray(targetColumn, 1);

      if (targetColumn != null) {
        for (int i = 0; i < targetColumn.length; i++) {
          this.moveColumn(
              getColumnModel().getColumnIndex(Integer.valueOf(targetColumn[i][0])),
              targetColumn[i][1]);
        }
      }

      m_clTableSorter.addMouseListenerToHeaderInTable(this);
      m_clTableModel.setColumnsSize(getColumnModel());
    } else {
      // Werte neu setzen
      m_clTableModel.setValues(
          DBManager.instance()
              .getMatchesKurzInfo(
                  HOVerwaltung.instance().getModel().getBasics().getTeamId(), matchtyp, false));
      m_clTableSorter.reallocateIndexes();
    }

    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    setRowSelectionAllowed(true);

    m_clTableSorter.initsort();
  }
Пример #2
0
  /** Markiert ein Match, wenn es in der Tabelle vorhanden ist, sonst wird die Selektion gelöscht */
  public final void markiereMatch(int matchid) {
    final int row = m_clTableSorter.getRow4Match(matchid);

    if (row > -1) {
      setRowSelectionInterval(row, row);
    } else {
      clearSelection();
    }
  }
Пример #3
0
  /**
   * Initialisiert das Model
   *
   * @param matchtyp matches typ (e.g. own league matches only)
   */
  private void initModel(int matchtyp) {
    setOpaque(false);

    reInitModel(matchtyp);

    final ToolTipHeader header = new ToolTipHeader(getColumnModel());
    header.setToolTipStrings(m_clTableModel.m_sToolTipStrings);
    header.setToolTipText("");
    setTableHeader(header);

    final TableColumnModel tableColumnModel = getColumnModel();

    for (int i = 0; i < 14; i++) {
      tableColumnModel.getColumn(i).setIdentifier(new Integer(i));
    }

    m_clTableSorter.addMouseListenerToHeaderInTable(this);

    setAutoResizeMode(AUTO_RESIZE_OFF);
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(0)))
        .setPreferredWidth(Helper.calcCellWidth(75));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(0)))
        .setMinWidth(Helper.calcCellWidth(70));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(1)))
        .setPreferredWidth(Helper.calcCellWidth(20));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(1)))
        .setMinWidth(Helper.calcCellWidth(20));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(2)))
        .setMinWidth(Helper.calcCellWidth(55));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(2)))
        .setPreferredWidth(Helper.calcCellWidth(120));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(3)))
        .setMinWidth(Helper.calcCellWidth(55));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(3)))
        .setPreferredWidth(Helper.calcCellWidth(60));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(4)))
        .setPreferredWidth(Helper.calcCellWidth(30));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(5)))
        .setPreferredWidth(Helper.calcCellWidth(55));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(6)))
        .setPreferredWidth(Helper.calcCellWidth(150));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(7)))
        .setPreferredWidth(Helper.calcCellWidth(150));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(8)))
        .setPreferredWidth(Helper.calcCellWidth(110));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(9)))
        .setPreferredWidth(Helper.calcCellWidth(110));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(10)))
        .setPreferredWidth(Helper.calcCellWidth(90));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(11)))
        .setPreferredWidth(Helper.calcCellWidth(90));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(12)))
        .setPreferredWidth(Helper.calcCellWidth(90));
    tableColumnModel
        .getColumn(tableColumnModel.getColumnIndex(Integer.valueOf(13)))
        .setPreferredWidth(Helper.calcCellWidth(90));

    setSelectionMode(0);
    setRowSelectionAllowed(true);

    m_clTableSorter.initsort();
  }