Search in sources :

Example 1 with ProfessionComparator

use of delta.games.lotro.lore.crafting.ProfessionComparator in project lotro-companion by dmorcellet.

the class CraftingSynopsisTableController method buildProfessionColumn.

private TableColumnController<CraftingSynopsisItem, Profession> buildProfessionColumn() {
    CellDataProvider<CraftingSynopsisItem, Profession> professionCell = new CellDataProvider<CraftingSynopsisItem, Profession>() {

        @Override
        public Profession getData(CraftingSynopsisItem item) {
            return item.getProfession();
        }
    };
    TableColumnController<CraftingSynopsisItem, Profession> professionColumn = new TableColumnController<CraftingSynopsisItem, Profession>("Profession", Profession.class, professionCell);
    professionColumn.setWidthSpecs(50, 50, 50);
    // Header renderer
    JPanel emptyHeaderPanel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    TableCellRenderer headerRenderer = buildSimpleCellRenderer(emptyHeaderPanel);
    professionColumn.setHeaderCellRenderer(headerRenderer);
    // Cell renderer
    TableCellRenderer cellRenderer = buildProfessionCellRenderer();
    professionColumn.setCellRenderer(cellRenderer);
    // Comparator
    ProfessionComparator comparator = new ProfessionComparator();
    professionColumn.setComparator(comparator);
    return professionColumn;
}
Also used : JPanel(javax.swing.JPanel) TableCellRenderer(javax.swing.table.TableCellRenderer) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) ProfessionComparator(delta.games.lotro.lore.crafting.ProfessionComparator) Profession(delta.games.lotro.lore.crafting.Profession) GridBagLayout(java.awt.GridBagLayout) TableColumnController(delta.common.ui.swing.tables.TableColumnController) CellDataProvider(delta.common.ui.swing.tables.CellDataProvider)

Aggregations

CellDataProvider (delta.common.ui.swing.tables.CellDataProvider)1 TableColumnController (delta.common.ui.swing.tables.TableColumnController)1 Profession (delta.games.lotro.lore.crafting.Profession)1 ProfessionComparator (delta.games.lotro.lore.crafting.ProfessionComparator)1 GridBagLayout (java.awt.GridBagLayout)1 JPanel (javax.swing.JPanel)1 DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)1 TableCellRenderer (javax.swing.table.TableCellRenderer)1