| 54 | |
| 55 | |
| 56 | public abstract class ItemManager<T extends InventoryItem> extends FContainer implements IItemManager<T>, ActivateHandler { |
| 57 | private ItemManager<T> instance; |
| 58 | private float itemLeft = 0f, itemWidth = 0f; |
| 59 | private ItemPool<T> pool; |
| 60 | protected final ItemManagerModel<T> model; |
| 61 | private Predicate<? super T> filterPredicate = null; |
| 62 | private AdvancedSearchFilter<? extends T> advancedSearchFilter; |
| 63 | private Supplier<List<ItemFilter<? extends T>>> filters = Suppliers.memoize(ArrayList::new); |
| 64 | private boolean hideFilters = false; |
| 65 | private boolean wantUnique = false; |
| 66 | private boolean showRanking = false; |
| 67 | private boolean showPriceInfo = false; |
| 68 | private boolean multiSelectMode = false; |
| 69 | private boolean allowGroupIdentical = false; |
| 70 | private FEventHandler selectionChangedHandler, itemActivateHandler; |
| 71 | private ContextMenuBuilder<T> contextMenuBuilder; |
| 72 | private ContextMenu contextMenu; |
| 73 | private final Class<T> genericType; |
| 74 | private ItemManagerConfig config; |
| 75 | private Function<Entry<? extends InventoryItem, Integer>, Object> fnNewGet, fnFavoriteGet; |
| 76 | private boolean viewUpdating, needSecondUpdate; |
| 77 | private Supplier<List<ItemColumn>> sortCols = Suppliers.memoize(ArrayList::new); |
| 78 | private final TextSearchFilter<? extends T> searchFilter; |
| 79 | |
| 80 | private final FLabel btnSearch = new FLabel.ButtonBuilder() |
| 81 | .icon(Forge.hdbuttons ? FSkinImage.HDSEARCH : FSkinImage.SEARCH).iconScaleFactor(0.9f).selectable().build(); |
| 82 | private final FLabel btnView = new FLabel.ButtonBuilder() |
| 83 | .iconScaleFactor(0.9f).selectable().build(); //icon set later |
| 84 | private final FLabel btnAdvancedSearchOptions = new FLabel.Builder() |
| 85 | .selectable(true).align(Align.center) |
| 86 | .icon(Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS).iconScaleFactor(0.9f) |
| 87 | .build(); |
| 88 | |
| 89 | private final FComboBox<ItemColumn> cbxSortOptions; |
| 90 | |
| 91 | private final List<ItemView<T>> views = new ArrayList<>(); |
| 92 | private final ItemListView<T> listView; |
| 93 | private final ImageView<T> imageView; |
| 94 | private ItemView<T> currentView; |
| 95 | private boolean initialized; |
| 96 | protected boolean lockFiltering; |
| 97 | |
| 98 | /** |
| 99 | * ItemManager Constructor. |
| 100 | * |
| 101 | * @param genericType0 the class of item that this table will contain |
| 102 | * @param wantUnique0 whether this table should display only one item with the same name |
| 103 | */ |
| 104 | protected ItemManager(final Class<T> genericType0, final boolean wantUnique0) { |
| 105 | instance = this; |
| 106 | genericType = genericType0; |
| 107 | wantUnique = wantUnique0; |
| 108 | model = new ItemManagerModel<>(genericType0); |
| 109 | |
| 110 | searchFilter = createSearchFilter(); |
| 111 | |
| 112 | listView = new ItemListView<>(this, model); |
| 113 | imageView = createImageView(model); |
nothing calls this directly
no test coverage detected