use of com.biglybt.pif.ui.tables.TableColumnInfo in project BiglyBT by BiglySoftware.
the class TableColumnSetupWindow method fillAvail.
/**
* @since 4.0.0.5
*/
protected void fillAvail() {
String selectedCat = null;
if (CAT_BUTTONS) {
Control[] children = cCategories.getChildren();
for (int i = 0; i < children.length; i++) {
Control child = children[i];
if (child instanceof Button) {
Button btn = (Button) child;
if (btn.getSelection()) {
selectedCat = (String) btn.getData("cat");
break;
}
}
}
} else {
selectedCat = comboFilter.getItem(comboFilter.getSelectionIndex());
}
if (selectedCat != null && selectedCat.equals("all")) {
selectedCat = null;
}
byte selectedProf = 0;
for (byte i = 0; i < radProficiency.length; i++) {
Button btn = radProficiency[i];
if (btn.getSelection()) {
selectedProf = i;
break;
}
}
String s;
// = "Available " + radProficiency[selectedProf].getText() + " Columns";
if (selectedCat != null) {
s = MessageText.getString("ColumnSetup.availcolumns.filteredby", new String[] { radProficiency[selectedProf].getText(), selectedCat });
} else {
s = MessageText.getString("ColumnSetup.availcolumns", new String[] { radProficiency[selectedProf].getText() });
}
cPickArea.setText(s);
tvAvail.removeAllTableRows();
final TableColumnManager tcm = TableColumnManager.getInstance();
TableColumnCore[] datasources = tcm.getAllTableColumnCoreAsArray(forDataSourceType, forTableID);
if (selectedCat == "uncat") {
datasources = listColumnsNoCat.toArray(new TableColumnCore[listColumnsNoCat.size()]);
}
for (int i = 0; i < datasources.length; i++) {
TableColumnCore column = datasources[i];
TableColumnInfo info = tcm.getColumnInfo(forDataSourceType, forTableID, column.getName());
String[] cats = info == null ? null : info.getCategories();
if (cats == null) {
if (selectedCat == null || selectedCat.equals("uncat")) {
tvAvail.addDataSource(column);
}
} else {
for (int j = 0; j < cats.length; j++) {
String cat = cats[j];
if ((selectedCat == null || selectedCat.equalsIgnoreCase(cat)) && info.getProficiency() <= selectedProf) {
tvAvail.addDataSource(column);
break;
}
}
}
}
tvAvail.processDataSourceQueue();
}
Aggregations