Package com.aelitis.azureus.ui.common.table.impl

Examples of com.aelitis.azureus.ui.common.table.impl.TableColumnManager


    layout.numColumns = 4;
    gColumns.setLayout(layout);
   
    Map<String, FakeTableCell>  usable_cols = new HashMap<String, FakeTableCell>();
   
    TableColumnManager col_man = TableColumnManager.getInstance();
   
    TableColumnCore[][] cols_sets = {
      col_man.getAllTableColumnCoreAsArray(DownloadTypeIncomplete.class,
          TableManager.TABLE_MYTORRENTS_INCOMPLETE),
      col_man.getAllTableColumnCoreAsArray(DownloadTypeComplete.class,
          TableManager.TABLE_MYTORRENTS_COMPLETE),
    };
       
    for (int i=0;i<cols_sets.length;i++){
     
View Full Code Here


    this.cCats = cCats;
    AzureusCoreFactory.addCoreRunningListener(new AzureusCoreRunningListener() {
      public void azureusCoreRunning(AzureusCore core) {
        Utils.execSWTThread(new AERunnable() {
          public void runSupport() {
            TableColumnManager tcManager = TableColumnManager.getInstance();
            tcManager.addColumns(getCompleteColumns());
            tcManager.addColumns(getIncompleteColumns());
          }
        });
      }
    });
  }
View Full Code Here

      ETAItem.COLUMN_ID,
      ShareRatioItem.COLUMN_ID,
      TrackerStatusItem.COLUMN_ID,
    };

    TableColumnManager tcManager = TableColumnManager.getInstance();
    Map mapTCs = tcManager.getTableColumnsAsMap(DownloadTypeIncomplete.class, tableID);

    tcManager.setDefaultColumnNames(tableID, defaultVisibleOrder);

    if (!tcManager.loadTableColumnSettings(DownloadTypeIncomplete.class,
        tableID)
        || areNoneVisible(mapTCs)) {
      setVisibility(mapTCs, defaultVisibleOrder);
      RankItem tc = (RankItem) mapTCs.get(RankItem.COLUMN_ID);
      if (tc != null) {
        tcManager.setDefaultSortColumnName(tableID, RankItem.COLUMN_ID);
        tc.setSortAscending(true);
      }
    }

    return (TableColumnCore[]) mapTCs.values().toArray(new TableColumnCore[0]);
View Full Code Here

      ShareRatioItem.COLUMN_ID,
      UpItem.COLUMN_ID,
      TrackerStatusItem.COLUMN_ID,
    };

    TableColumnManager tcManager = TableColumnManager.getInstance();
    Map mapTCs = tcManager.getTableColumnsAsMap(DownloadTypeComplete.class, tableID);

    tcManager.setDefaultColumnNames(tableID, defaultVisibleOrder);

    if (!tcManager.loadTableColumnSettings(DownloadTypeComplete.class,
        tableID)
        || areNoneVisible(mapTCs)) {
      setVisibility(mapTCs, defaultVisibleOrder);

      RankItem tc = (RankItem) mapTCs.get(RankItem.COLUMN_ID);
      if (tc != null) {
        tcManager.setDefaultSortColumnName(tableID, RankItem.COLUMN_ID);
        tc.setSortAscending(true);
      }
    }

    return (TableColumnCore[]) mapTCs.values().toArray(new TableColumnCore[0]);
View Full Code Here

    // Core columns are implementors of TableColumn to save one class creation
    // Otherwise, we'd have to create a generic TableColumnImpl class, pass it
    // to another class so that it could manipulate it and act upon changes.

    TableColumnManager tcManager = TableColumnManager.getInstance();

    TableColumnCoreCreationListener tcCreator = new TableColumnCoreCreationListener() {
      // @see org.gudy.azureus2.ui.swt.views.table.TableColumnCoreCreationListener#createTableColumnCore(java.lang.Class, java.lang.String, java.lang.String)
      public TableColumnCore createTableColumnCore(Class forDataSourceType,
          String tableID, String columnID) {
        cInfo info = (cInfo) c.get(columnID);

        try {
          Constructor constructor = info.cla.getDeclaredConstructor(new Class[] {
            String.class
          });
          TableColumnCore column = (TableColumnCore) constructor.newInstance(new Object[] {
            tableID
          });
          return column;
        } catch (Exception e) {
          Debug.out(e);
        }

        return null;
      }

      public void tableColumnCreated(TableColumn column) {
      }
    };

    for (Iterator iter = c.keySet().iterator(); iter.hasNext();) {
      String id = (String) iter.next();
      cInfo info = (cInfo) c.get(id);

      tcManager.registerColumn(info.forDataSourceType, id, tcCreator);
    }

  }
View Full Code Here

    GCStringPrinter.printString(gc, info, infoBounds, true, false);

    TableColumnInfo columnInfo = (TableColumnInfo) cell.getTableRow().getData(
        "columninfo");
    if (columnInfo == null) {
      final TableColumnManager tcm = TableColumnManager.getInstance();
      columnInfo = tcm.getColumnInfo(column.getForDataSourceType(),
          column.getTableID(), column.getName());
      cell.getTableRowCore().setData("columninfo", columnInfo);
    }
    Rectangle profBounds = new Rectangle(bounds.width - 100, bounds.y - 2, 100, 20);
    byte proficiency = columnInfo.getProficiency();
View Full Code Here

  public void setColumnList(TableColumnCore[] columns,
      String defaultSortColumnID, boolean defaultSortOrder,
      boolean titleIsMinWidth) {
    // XXX Adding Columns only has to be done once per TableID. 
    // Doing it more than once won't harm anything, but it's a waste.
    TableColumnManager tcManager = TableColumnManager.getInstance();
    if (tcManager.getTableColumnCount(sTableID) != columns.length) {
      tcManager.addColumns(basicItems);
    }

    tableColumns = tcManager.getAllTableColumnCoreAsArray(classPluginDataSourceType,
        sTableID);

    // fixup order
    tcManager.ensureIntegrety(sTableID);
  }
View Full Code Here

      swtColumnPos++;
    }

    // Initialize the sorter after the columns have been added
    TableColumnManager tcManager = TableColumnManager.getInstance();

    String sSortColumn = tcManager.getDefaultSortColumnName(sTableID);
    if (sSortColumn == null || sSortColumn.length() == 0) {
      sSortColumn = sDefaultSortOn;
    }

    TableColumnCore tc = tcManager.getTableColumnCore(sTableID, sSortColumn);
    if (tc == null && tableColumns.length > 0) {
      tc = tableColumns[0];
    }
    sortColumn = tc;
    fixAlignment(tc, true);
View Full Code Here

   * @param iColumn Column # that tasks apply to.
   */
  private void fillColumnMenu(final TableColumnOrTreeColumn tcColumn,
      boolean isBlankArea) {
    if (!isBlankArea) {
      TableColumnManager tcm = TableColumnManager.getInstance();
      TableColumnCore[] allTableColumns = tcm.getAllTableColumnCoreAsArray(
          classPluginDataSourceType, sTableID);
     
    Arrays.sort(allTableColumns,
        TableColumnManager.getTableColumnOrderComparator());

      for (final TableColumnCore tc : allTableColumns) {
        boolean visible = tc.isVisible();
        if (!visible) {
          TableColumnInfo columnInfo = tcm.getColumnInfo(classPluginDataSourceType, sTableID, tc.getName());
          if (columnInfo.getProficiency() != TableColumnInfo.PROFICIENCY_BEGINNER) {
            continue;
          }
        }
        MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
        Messages.setLanguageText(menuItem, tc.getTitleLanguageKey());
        if (visible) {
          menuItem.setSelection(true);
        }
        menuItem.addListener(SWT.Selection, new Listener() {
          public void handleEvent(Event e) {
            tc.setVisible(!tc.isVisible());
            tableStructureChanged(true, null);
          }
        });
      }
    }

    if (menu.getItemCount() > 0) {
      new MenuItem(menu, SWT.SEPARATOR);
    }

    final MenuItem itemResetColumns = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(itemResetColumns, "table.columns.reset");
    itemResetColumns.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        TableColumnManager tcm = TableColumnManager.getInstance();
        String[] defaultColumnNames = tcm.getDefaultColumnNames(sTableID);
        if (defaultColumnNames != null) {
          for (TableColumnCore column : tableColumns) {
            column.setVisible(false);
          }
          int i = 0;
          for (String name : defaultColumnNames) {
            TableColumnCore column = tcm.getTableColumnCore(sTableID, name);
            if (column != null) {
              column.reset();
              column.setVisible(true);
              column.setPositionNoShift(i++);
            }
          }
          tcm.saveTableColumns(classPluginDataSourceType, sTableID);
          TableStructureEventDispatcher.getInstance(sTableID).tableStructureChanged(true, classPluginDataSourceType);
        }
      }
    });

View Full Code Here

        }
      }
    }

    TableStructureEventDispatcher.getInstance(sTableID).removeListener(this);
    TableColumnManager tcManager = TableColumnManager.getInstance();
    if (tcManager != null) {
      tcManager.saveTableColumns(classPluginDataSourceType, sTableID);
    }

    if (table != null && !table.isDisposed()) {
      table.dispose();
    }
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.ui.common.table.impl.TableColumnManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.