use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.
the class EquipmentPanelController method chooseItem.
private Item chooseItem(EQUIMENT_SLOT slot, List<Item> items) {
ItemsManager itemsManager = new ItemsManager(items);
List<Item> selectedItems = itemsManager.getItems(_toonData, slot);
ItemFilterConfiguration cfg = new ItemFilterConfiguration();
cfg.initFromItems(selectedItems);
ItemFilterController filterController = new ItemFilterController(cfg);
Filter<Item> filter = filterController.getFilter();
String id = ItemChoiceWindowController.ITEM_CHOOSER_PROPERTIES_ID + "#" + slot.name();
TypedProperties props = _parentWindow.getUserProperties(id);
ItemChoiceWindowController choiceCtrl = new ItemChoiceWindowController(_parentWindow, props, selectedItems, filter, filterController);
Item ret = choiceCtrl.editModal();
return ret;
}
use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.
the class EquipmentPanelController method handleChooseItem.
private void handleChooseItem(EQUIMENT_SLOT slot, List<Item> items) {
Item item = chooseItem(slot, items);
if (item != null) {
CharacterEquipment equipment = _toonData.getEquipment();
SlotContents contents = equipment.getSlotContents(slot, true);
Item clonedItem = ItemFactory.clone(item);
contents.setItem(clonedItem);
refreshToon();
}
}
use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.
the class EquipmentPanelController method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (cmd.startsWith(SLOT_SEED)) {
cmd = cmd.substring(SLOT_SEED.length());
// Straight click
EQUIMENT_SLOT slot = EQUIMENT_SLOT.valueOf(cmd);
if (slot != null) {
Item currentItem = getItemForSlot(slot);
if (currentItem != null) {
handleEditItem(slot);
} else {
List<Item> items = ItemsManager.getInstance().getAllItems();
handleChooseItem(slot, items);
}
}
} else {
// From contextual menu
Component invoker = _contextMenu.getInvoker();
EQUIMENT_SLOT slot = findSlotForButton(invoker);
if (slot != null) {
if (EDIT_COMMAND.equals(cmd)) {
handleEditItem(slot);
} else if (CHOOSE_COMMAND.equals(cmd)) {
List<Item> items = ItemsManager.getInstance().getAllItems();
handleChooseItem(slot, items);
} else if (CHOOSE_FROM_STASH_COMMAND.equals(cmd)) {
ItemsStash stash = _toon.getStash();
List<Item> items = stash.getAll();
handleChooseItem(slot, items);
} else if (REMOVE_COMMAND.equals(cmd)) {
handleRemoveItem(slot);
} else if (COPY_TO_STASH_COMMAND.equals(cmd)) {
handleCopyToStash(slot);
}
}
}
}
use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.
the class StashWindowController method removeItem.
private void removeItem() {
GenericTableController<Item> controller = _itemsTable.getTableController();
Item item = controller.getSelectedItem();
if (item != null) {
ItemsStash stash = _toon.getStash();
stash.removeItem(item.getStashIdentifier());
_toon.saveStash();
_itemsTable.getTableController().refresh();
}
}
use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.
the class StashWindowController method buildContents.
@Override
protected JComponent buildContents() {
// Whole panel
JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
// Build table
JPanel tablePanel = buildTablePanel();
// Filter
ItemFilterController filterController = new ItemFilterController();
Filter<Item> filter = filterController.getFilter();
filterController.setFilterUpdateListener(this);
JPanel filterPanel = filterController.getPanel();
TitledBorder filterBorder = GuiFactory.buildTitledBorder("Filter");
filterPanel.setBorder(filterBorder);
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(filterPanel, c);
// Items table
c.gridy = 1;
c.weighty = 1;
c.fill = GridBagConstraints.BOTH;
panel.add(tablePanel, c);
tablePanel.setBorder(GuiFactory.buildTitledBorder("Items"));
_itemsTable.getTableController().setFilter(filter);
return panel;
}
Aggregations