use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class EquipmentPanelController method handleCopyToStash.
private void handleCopyToStash(EQUIMENT_SLOT slot) {
CharacterEquipment equipment = _toonData.getEquipment();
SlotContents contents = equipment.getSlotContents(slot, false);
if (contents != null) {
Item item = contents.getItem();
if (item != null) {
ItemsStash stash = _toon.getStash();
Item newItem = ItemFactory.clone(item);
stash.addItem(newItem);
Integer stashId = newItem.getStashIdentifier();
item.setStashIdentifier(stashId);
_toon.saveStash();
// Broadcast stash update event...
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_STASH_UPDATED, _toon, null);
EventsManager.invokeEvent(event);
}
}
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class TomesEditionPanelController method updateTier.
private void updateTier(int index, int delta) {
TomesSet tomes = _toon.getTomes();
STAT stat = TomesSet.AVAILABLE_TOMES[index];
int currentTierIndex = tomes.getTomeRank(stat);
currentTierIndex += delta;
if (currentTierIndex > TomesSet.MAX_RANK) {
currentTierIndex = 0;
}
if (currentTierIndex < 0) {
currentTierIndex = TomesSet.MAX_RANK;
}
tomes.setTomeRank(stat, currentTierIndex);
_tomeControllers.get(index).update();
// Broadcast toon update event...
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
EventsManager.invokeEvent(event);
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class EquipmentPanelController method refreshToon.
private void refreshToon() {
updateIcons();
// Broadcast equipment update event...
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, _toon, _toonData);
EventsManager.invokeEvent(event);
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class CharacterFileWindowController method cloneCharacterData.
private void cloneCharacterData() {
GenericTableController<CharacterData> controller = _toonsTable.getTableController();
CharacterData data = controller.getSelectedItem();
if (data != null) {
// Build new configuration
CharacterData newInfos = new CharacterData(data);
newInfos.setDate(Long.valueOf(System.currentTimeMillis()));
// Register new configuration
CharacterInfosManager infos = _toon.getInfosManager();
boolean ok = infos.writeNewCharacterData(newInfos);
if (ok) {
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_ADDED, _toon, newInfos);
EventsManager.invokeEvent(event);
}
}
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class CharacterMainAttrsEditionPanelController method buildPanel.
private JPanel buildPanel() {
JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
// 1st line
JPanel firstLinePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(firstLinePanel, c);
// Class icon
_classIcon = GuiFactory.buildIconLabel(null);
firstLinePanel.add(_classIcon);
// Race icon
_raceIcon = GuiFactory.buildIconLabel(null);
firstLinePanel.add(_raceIcon);
// Name
_name = GuiFactory.buildTextField("");
_name.setFont(_name.getFont().deriveFont(16f).deriveFont(Font.BOLD));
_name.setColumns(25);
firstLinePanel.add(_name);
// Level
_level = CharacterUiUtils.buildLevelCombo();
firstLinePanel.add(_level.getComboBox());
ItemSelectionListener<Integer> levelListener = new ItemSelectionListener<Integer>() {
@Override
public void itemSelected(Integer level) {
_toon.setLevel(level.intValue());
// Broadcast level update event...
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
EventsManager.invokeEvent(event);
}
};
_level.addListener(levelListener);
// Date
_date = new DateEditionController(DateFormat.getDateTimeCodec());
firstLinePanel.add(_date.getTextField());
// 2nd line
JPanel secondLinePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
// Short description
secondLinePanel.add(GuiFactory.buildLabel("Description:"));
_shortDescription = GuiFactory.buildTextField("");
_shortDescription.setColumns(50);
secondLinePanel.add(_shortDescription);
c = new GridBagConstraints(0, 1, 1, 1, 0.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(secondLinePanel, c);
return panel;
}
Aggregations