예제 #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
  private void init() {
    this.visited.clear();
    this.hosted.clear();
    this.visited.addAll(Arrays.asList(DBManager.instance().getIFAMatches(false)));
    this.hosted.addAll(Arrays.asList(DBManager.instance().getIFAMatches(true)));

    this.maxCoolness = 0.0;
    WorldDetailLeague[] leagues = WorldDetailsManager.instance().getLeagues();
    for (WorldDetailLeague league : leagues) {
      this.maxCoolness += PluginIfaUtils.getCoolness(league.getCountryId());
    }
    fireModelChanged();
  }
예제 #3
0
  public static Transfer getTransfer(int playerId) {
    int teamId = HOVerwaltung.instance().getModel().getBasics().getTeamId();
    String query =
        "Select price, BUYERID, sellerid, date from transfer WHERE PLAYERID="
            + playerId
            + " and (BUYERID="
            + teamId
            + " OR SELLERID="
            + teamId
            + ")";

    ResultSet rs = DBManager.instance().getAdapter().executeQuery(query);
    Transfer t = new Transfer();
    try {
      while (rs.next()) {
        // TODO player might by bought/sold multiple times by the same team
        if (rs.getInt("BUYERID") == teamId) {
          t.purchasePrice = rs.getInt("price");
          t.purchaseDate = rs.getDate("date");
        }
        if (rs.getInt("sellerid") == teamId) {
          t.sellingPrice = rs.getInt("price");
          t.sellingDate = rs.getDate("date");
        }
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return t;
  }
예제 #4
0
 public final void saveColumnOrder() {
   final UserColumn[] columns = m_clTableModel.getDisplayedColumns();
   final TableColumnModel tableColumnModel = getColumnModel();
   for (int i = 0; i < columns.length; i++) {
     columns[i].setIndex(convertColumnIndexToView(i));
     columns[i].setPreferredWidth(
         tableColumnModel.getColumn(convertColumnIndexToView(i)).getWidth());
   }
   m_clTableModel.setCurrentValueToColumns(columns);
   DBManager.instance().saveHOColumnModel(m_clTableModel);
 }
예제 #5
0
 private void reInitModel(int matchtyp) {
   m_clTableModel = DBManager.instance().getArenaStatistikModel(matchtyp);
   m_clTableSorter = new TableSorter(m_clTableModel, 5, -1);
   setModel(m_clTableSorter);
 }