use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class TableManagerImpl method unregisterColumn.
@Override
public void unregisterColumn(final Class forDataSourceType, final String cellID, final TableColumnCreationListener listener) {
TableColumnManager tcManager = TableColumnManager.getInstance();
tcManager.unregisterColumn(forDataSourceType, cellID, listener);
String[] tables = tcManager.getTableIDs();
for (String tid : tables) {
TableColumnCore col = tcManager.getTableColumnCore(tid, cellID);
if (col != null) {
col.remove();
}
}
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class TableColumnImpl method setVisible.
// @see com.biglybt.pif.ui.tables.TableColumn#setVisible(boolean)
@Override
public void setVisible(boolean visible) {
if (bVisible == visible) {
return;
}
// System.out.println("set " + sTableID + "/" + sName + " to " + visible
// + " via " + Debug.getCompressedStackTrace());
bVisible = visible;
if (bVisible && iPosition == POSITION_INVISIBLE) {
TableColumnCore[] allColumns = TableColumnManager.getInstance().getAllTableColumnCoreAsArray(null, sTableID);
iPosition = 0;
for (TableColumnCore tableColumnCore : allColumns) {
if (tableColumnCore.getPosition() > iPosition) {
iPosition = tableColumnCore.getPosition() + 1;
}
}
}
invalidateCells();
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class TableColumnManager method generateDiagnostics.
/**
* @param writer
*/
public void generateDiagnostics(IndentWriter writer) {
try {
items_mon.enter();
writer.println("TableColumns");
for (Iterator iter = items.keySet().iterator(); iter.hasNext(); ) {
String sTableID = (String) iter.next();
Map mTypes = (Map) items.get(sTableID);
writer.indent();
writer.println(sTableID + ": " + mTypes.size() + " columns:");
writer.indent();
for (Iterator iter2 = mTypes.values().iterator(); iter2.hasNext(); ) {
TableColumnCore tc = (TableColumnCore) iter2.next();
tc.generateDiagnostics(writer);
}
writer.exdent();
writer.exdent();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
items_mon.exit();
}
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class TableColumnManager method addColumns.
/**
* Adds a column definition to the list
* @param itemsToAdd The column definition object
*/
public void addColumns(TableColumnCore[] itemsToAdd) {
try {
items_mon.enter();
for (int i = 0; i < itemsToAdd.length; i++) {
TableColumnCore item = itemsToAdd[i];
if (item == null || item.isRemoved()) {
continue;
}
String name = item.getName();
String sTableID = item.getTableID();
Map mTypes = (Map) items.get(sTableID);
if (mTypes == null) {
// LinkedHashMap to preserve order
mTypes = new LinkedHashMap();
items.put(sTableID, mTypes);
}
if (!mTypes.containsKey(name)) {
mTypes.put(name, item);
Map mapColumnConfig = getTableConfigMap(sTableID);
item.loadSettings(mapColumnConfig);
}
}
for (int i = 0; i < itemsToAdd.length; i++) {
TableColumnCore item = itemsToAdd[i];
if (item != null && !item.isRemoved() && !item.getColumnAdded()) {
item.setColumnAdded();
}
}
} catch (Exception e) {
System.out.println("Error while adding Table Column Extension");
Debug.printStackTrace(e);
} finally {
items_mon.exit();
}
}
use of com.biglybt.ui.common.table.TableColumnCore in project BiglyBT by BiglySoftware.
the class TableColumnManager method resetColumns.
public void resetColumns(Class dataSourceType, String tableID) {
TableColumnCore[] allTableColumns = getAllTableColumnCoreAsArray(dataSourceType, tableID);
if (allTableColumns != null) {
for (TableColumnCore column : allTableColumns) {
if (column != null) {
column.setVisible(false);
column.reset();
}
}
}
String[] defaultColumnNames = getDefaultColumnNames(tableID);
if (defaultColumnNames != null) {
int i = 0;
for (String name : defaultColumnNames) {
TableColumnCore column = getTableColumnCore(tableID, name);
if (column != null) {
column.setVisible(true);
column.setPositionNoShift(i++);
}
}
}
saveTableColumns(dataSourceType, tableID);
TableStructureEventDispatcher.getInstance(tableID).tableStructureChanged(true, dataSourceType);
}
Aggregations