Search in sources :

Example 1 with PrefTableColumnModel

use of pcgen.gui2.tools.PrefTableColumnModel in project pcgen by PCGen.

the class JTreeViewTable method createTableColumnModel.

private DynamicTableColumnModel createTableColumnModel(TreeView<?> startingView, DataView<?> dataView) {
    @SuppressWarnings("unchecked") ListMap<Visibility, TableColumn, List<TableColumn>> listMap = CollectionMaps.createListMap(HashMap.class, ArrayList.class);
    int index = 1;
    for (DataViewColumn column : dataView.getDataColumns()) {
        TableColumn tableColumn = new TableColumn(index++);
        tableColumn.setHeaderValue(column.getName());
        Visibility vis = column.getVisibility();
        listMap.add(vis, tableColumn);
    }
    List<TableColumn> columns = listMap.get(Visibility.ALWAYS_VISIBLE);
    if (columns == null) {
        columns = Collections.emptyList();
    }
    PrefTableColumnModel model = new PrefTableColumnModel(this.viewModel.getDataView().getPrefsKey(), columns.size() + 1);
    TableColumn viewColumn = new TableColumn();
    viewColumn.setHeaderValue(startingView.getViewName());
    viewColumn.setIdentifier(TREE_VIEW_COL_PREFS_KEY);
    model.addColumn(viewColumn, true, 150);
    for (TableColumn column : columns) {
        model.addColumn(column, true, 75);
    }
    columns = listMap.get(Visibility.INITIALLY_VISIBLE);
    if (columns != null) {
        for (TableColumn column : columns) {
            model.addColumn(column, true, 75);
        }
    }
    columns = listMap.get(Visibility.INITIALLY_INVISIBLE);
    if (columns != null) {
        for (TableColumn column : columns) {
            model.addColumn(column, false, 75);
        }
    }
    return model;
}
Also used : PrefTableColumnModel(pcgen.gui2.tools.PrefTableColumnModel) DataViewColumn(pcgen.gui2.util.treeview.DataViewColumn) Visibility(pcgen.gui2.util.treeview.DataViewColumn.Visibility) ArrayList(java.util.ArrayList) List(java.util.List) TableColumn(javax.swing.table.TableColumn)

Example 2 with PrefTableColumnModel

use of pcgen.gui2.tools.PrefTableColumnModel in project pcgen by PCGen.

the class DomainInfoTab method createDomainColumnModel.

public DynamicTableColumnModel createDomainColumnModel() {
    PrefTableColumnModel model = new PrefTableColumnModel("DomainList", 1);
    TableColumn column = new TableColumn(0);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_domains"));
    model.addColumn(column, true, 150);
    column = new TableColumn(1);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_descrip"));
    model.addColumn(column, false, 150);
    column = new TableColumn(2);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_source"));
    model.addColumn(column, true, 150);
    return model;
}
Also used : PrefTableColumnModel(pcgen.gui2.tools.PrefTableColumnModel) TableColumn(javax.swing.table.TableColumn)

Example 3 with PrefTableColumnModel

use of pcgen.gui2.tools.PrefTableColumnModel in project pcgen by PCGen.

the class EquipInfoTab method createEquipmentColumnModel.

private DynamicTableColumnModel createEquipmentColumnModel() {
    PrefTableColumnModel model = new PrefTableColumnModel("EquipList", 1);
    TableColumn column = new TableColumn(0);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_nameLabel"));
    model.addColumn(column, true, 150);
    column = new TableColumn(1);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_type"));
    model.addColumn(column, true, 75);
    column = new TableColumn(2);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_equipLocationAbbrev"));
    model.addColumn(column, true, 75);
    column = new TableColumn(3);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_equipQuantityAbbrev"));
    model.addColumn(column, true, 75);
    column = new TableColumn(4);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_equipWeightAbbrev"));
    model.addColumn(column, true, 75);
    column = new TableColumn(5);
    //$NON-NLS-1$
    column.setHeaderValue(LanguageBundle.getString("in_descrip"));
    model.addColumn(column, false, 75);
    return model;
}
Also used : PrefTableColumnModel(pcgen.gui2.tools.PrefTableColumnModel) TableColumn(javax.swing.table.TableColumn)

Aggregations

TableColumn (javax.swing.table.TableColumn)3 PrefTableColumnModel (pcgen.gui2.tools.PrefTableColumnModel)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DataViewColumn (pcgen.gui2.util.treeview.DataViewColumn)1 Visibility (pcgen.gui2.util.treeview.DataViewColumn.Visibility)1