public void setContent(final FieldProvider fieldProvider) { String dialog = ""; if (fieldProvider instanceof SpellLevel) { dialog = "spellDetailPopup"; this.m_property = "describedSpell"; } else if (fieldProvider instanceof Item || fieldProvider instanceof ReferenceItem || fieldProvider instanceof MerchantInventoryItem || fieldProvider instanceof ReferenceItemFieldProvider) { Item item = null; ReferenceItem refItem; if (fieldProvider instanceof Item) { refItem = (ReferenceItem) ((Item) fieldProvider).getReferenceItem(); item = (Item) fieldProvider; } else if (fieldProvider instanceof ReferenceItem) { refItem = (ReferenceItem) fieldProvider; } else if (fieldProvider instanceof MerchantInventoryItem) { refItem = (ReferenceItem) ((MerchantInventoryItem) fieldProvider).getItem().getReferenceItem(); } else { if (!(fieldProvider instanceof ReferenceItemFieldProvider)) { return; } refItem = ((ReferenceItemFieldProvider) fieldProvider).getReferenceItem(); } final ReferenceItemDisplayer refItemDisplayer = refItem.getReferenceItemDisplayer(); final ArrayList<String> characteristicsDesc = refItemDisplayer.getCharacteristicsString(); final ArrayList<String> effectsDesc = refItemDisplayer.getEffectsString(); if (effectsDesc == null && characteristicsDesc == null) { dialog = "itemSimplePopup"; } else { dialog = "itemDetailPopup"; } this.m_property = "itemPopupDetail"; } else if (fieldProvider instanceof Skill) { dialog = "skillDescription2"; } if (this.m_property != null && !this.m_property.isEmpty() && fieldProvider != null && !fieldProvider.equals( PropertiesProvider.getInstance().getObjectProperty(this.m_property))) { PropertiesProvider.getInstance().setPropertyValue(this.m_property, fieldProvider); } if (!dialog.isEmpty() && !dialog.equals(this.m_lastDialog)) { final ElementMap map = Xulor.getInstance().getEnvironment().getElementMap("worldAndFightBarDialog"); if (map != null) { this.m_popupDialog = (PopupElement) map.getElement(dialog); } this.m_lastDialog = dialog; } }
@Override public boolean onMessage(final Message message) { if (message instanceof ClockMessage) { final ClockMessage clockMessage = (ClockMessage) message; MessageScheduler.getInstance().removeClock(clockMessage.getClockId()); if (this.m_cancelTimedPop) { return false; } this.popup(); return false; } else { switch (message.getId()) { case 19301: { final UIShowPopupInfosMessage msg = (UIShowPopupInfosMessage) message; boolean ok = false; if (this.m_popupDialog == null || this.m_fieldProvider == null) { MessageScheduler.getInstance().removeAllClocks(this); return false; } if (this.m_fieldProvider instanceof SpellLevel && msg.getContent() instanceof SpellLevel) { final SpellLevel spellLevel1 = (SpellLevel) this.m_fieldProvider; final SpellLevel spellLevel2 = (SpellLevel) msg.getContent(); ok = (spellLevel1.getSpell().getId() == spellLevel2.getSpell().getId()); } else { ok = this.m_fieldProvider.equals(msg.getContent()); } if (ok) { this.m_cancelTimedPop = !XulorActions.closePopup(null, this.m_popupDialog); PropertiesProvider.getInstance().removeProperty(this.m_property); } return false; } case 19300: { final UIShowPopupInfosMessage msg = (UIShowPopupInfosMessage) message; this.m_fieldProvider = msg.getContent(); if (this.m_fieldProvider == null) { return false; } if (msg.getIntValue() > 0) { this.m_cancelTimedPop = false; MessageScheduler.getInstance().addClock(this, msg.getIntValue(), -1, 1); } else { this.popup(); } return false; } default: { return true; } } } }
public void setSelected(final boolean selected) { this.m_selected = selected; PropertiesProvider.getInstance().firePropertyValueChanged(this, "selected"); }