|
|
@@ -7,12 +7,12 @@ import javax.swing.JOptionPane;
|
|
|
import org.leumasjaffe.charsheet.model.inventory.DDInventory;
|
|
|
import org.leumasjaffe.charsheet.model.inventory.DDItem;
|
|
|
import org.leumasjaffe.charsheet.model.inventory.EquipmentSlot;
|
|
|
-import org.leumasjaffe.charsheet.view.dialog.EquipItemPanel;
|
|
|
+import org.leumasjaffe.charsheet.view.dialog.EquipItemDialog;
|
|
|
import org.leumasjaffe.observer.ObserverDispatch;
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
-public class EquipItemHelper {
|
|
|
+public class EquipItemController {
|
|
|
|
|
|
public static void accept(final DDInventory inv, final DDItem item) {
|
|
|
if ( item.getUnequippedCount() == 0 ) { return; }
|
|
|
@@ -38,14 +38,14 @@ public class EquipItemHelper {
|
|
|
|
|
|
private boolean selectToReplaceAllOf(final EquipmentSlot base,
|
|
|
final EquipmentSlot slot1, final EquipmentSlot slot2) {
|
|
|
- final EquipItemPanel panel;
|
|
|
+ final EquipItemDialog panel;
|
|
|
if ( inv.getEquipment().get(slot1).getSlot() == base ) {
|
|
|
- panel = new EquipItemPanel("Do you want to replace the following item?",
|
|
|
+ panel = new EquipItemDialog("Do you want to replace the following item?",
|
|
|
slot1, inv.getEquipment().get(slot1));
|
|
|
} else {
|
|
|
- panel = new EquipItemPanel("Do you want to replace both of the following items?",
|
|
|
- new EquipItemPanel.Tuple(slot1, inv.getEquipment().get(slot1)),
|
|
|
- new EquipItemPanel.Tuple(slot2, inv.getEquipment().get(slot2)));
|
|
|
+ panel = new EquipItemDialog("Do you want to replace both of the following items?",
|
|
|
+ new EquipItemDialog.Tuple(slot1, inv.getEquipment().get(slot1)),
|
|
|
+ new EquipItemDialog.Tuple(slot2, inv.getEquipment().get(slot2)));
|
|
|
}
|
|
|
if ( JOptionPane.showConfirmDialog(null,
|
|
|
panel, "Replace Equipped Item", JOptionPane.YES_NO_OPTION)
|
|
|
@@ -60,9 +60,9 @@ public class EquipItemHelper {
|
|
|
private boolean selectToReplaceOneOf(final EquipmentSlot slot1,
|
|
|
final EquipmentSlot slot2) {
|
|
|
final int choice = JOptionPane.showOptionDialog(null,
|
|
|
- new EquipItemPanel("Which of the following items would you like to replace?",
|
|
|
- new EquipItemPanel.Tuple(slot1, inv.getEquipment().get(slot1)),
|
|
|
- new EquipItemPanel.Tuple(slot2, inv.getEquipment().get(slot2))),
|
|
|
+ new EquipItemDialog("Which of the following items would you like to replace?",
|
|
|
+ new EquipItemDialog.Tuple(slot1, inv.getEquipment().get(slot1)),
|
|
|
+ new EquipItemDialog.Tuple(slot2, inv.getEquipment().get(slot2))),
|
|
|
"Replace Equipped Item", JOptionPane.YES_NO_CANCEL_OPTION,
|
|
|
JOptionPane.QUESTION_MESSAGE, null,
|
|
|
new String[] {"Cancel", slot1.toString(), slot2.toString()}, null );
|
|
|
@@ -78,7 +78,7 @@ public class EquipItemHelper {
|
|
|
|
|
|
private boolean selectToReplace(final EquipmentSlot slot) {
|
|
|
if ( JOptionPane.showConfirmDialog(null,
|
|
|
- new EquipItemPanel("Do you want to replace the following item?", slot, inv.getEquipment().get(slot)),
|
|
|
+ new EquipItemDialog("Do you want to replace the following item?", slot, inv.getEquipment().get(slot)),
|
|
|
"Replace Equipped Item", JOptionPane.YES_NO_OPTION)
|
|
|
== JOptionPane.YES_OPTION ) {
|
|
|
inv.unequip( slot );
|