if (pos < 0) {
return;
}
DefaultItem actual = (DefaultItem) filteredItems.get(pos);
if (actual.getItemName() == null) {
return;
}
itemName.setText(actual.getItemName());
itemImplementation.setSelectedItem(actual.getImplementation().getCanonicalName());
itemDescription.setText(actual.getDescription());
itemClass.setSelectedItem(actual.getItemClass());
itemSubclass.setText(actual.getItemSubclass());
String gfxLocation = "/" + actual.getItemClass() + "/"
+ actual.getItemSubclass() + ".png";
Sprite spr = SpriteStore.get().getSprite(
"stendhal/data/sprites/items" + gfxLocation);
drawSinglePart(spr, 1, 1, imageResource.getGraphics());
itemGFXLocation.setText(gfxLocation);
StringBuilder os = new StringBuilder();
for (Map.Entry<String, String> entry : actual.getAttributes().entrySet()) {
os.append(entry.getKey());
if (entry.getValue() != null) {
os.append(" = " + entry.getValue() + "\n");
}
}
itemAttributes.setText(os.toString());
itemWeight.setText(Double.toString(actual.getWeight()));
itemValue.setText(Integer.toString(actual.getValue()));
suggestedValueButtonActionPerformed(null);
itemEquipable.clearSelection();
Vector<Integer> selected = new Vector<Integer>();
for (String slot : actual.getEquipableSlots()) {
for (int i = 0; i < EditorXML.slots.length; i++) {
if (slot.equals(EditorXML.slots[i])) {
selected.add(i);
break;
}
}
}
int[] array = new int[selected.size()];
for (int i = 0; i < array.length; i++) {
array[i] = selected.get(i);
}
itemEquipable.setSelectedIndices(array);
usedAt = new LinkedList<Pair<DefaultCreature, DropItem>>();
for (DefaultCreature c : xml.getCreatures()) {
List<DropItem> drops = c.getDropItems();
for (DropItem it : drops) {
if (it.name.equals(actual.getItemName())) {
usedAt.add(new Pair<DefaultCreature, DropItem>(c, it));
break;
}
}
}