Search in sources :

Example 1 with LC_MODS

use of main.swing.generic.components.editors.lists.GenericListChooser.LC_MODS in project Eidolons by IDemiurge.

the class ListObjRenderer method getListCellRendererComponent.

@Override
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
    if (TYPE == null) {
        return getLabel(value, isSelected);
    }
    Entity type = null;
    if (value != null) {
        type = DataManager.getType(value.toString(), TYPE);
    }
    if (type == null) {
        return new JLabel(value.toString());
    }
    ListItem<Entity> item = new ListItem<>(type, isSelected, cellHasFocus, 0);
    // item.setIcon(ListRenderer.getCompIcon(type, isSelected));
    if (mods != null) {
        Component component = item;
        for (LC_MODS sub : mods) {
            switch(sub) {
                case TEXT_DISPLAYED:
                    component = SwingMaster.decorateWithText(type.getName(), Color.black, component, "pos 0 20");
                    break;
                default:
                    break;
            }
        }
        return component;
    }
    return item;
}
Also used : Entity(main.entity.Entity) LC_MODS(main.swing.generic.components.editors.lists.GenericListChooser.LC_MODS) ListItem(main.swing.generic.components.list.ListItem)

Aggregations

Entity (main.entity.Entity)1 LC_MODS (main.swing.generic.components.editors.lists.GenericListChooser.LC_MODS)1 ListItem (main.swing.generic.components.list.ListItem)1