diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java index e554c0d..fd05036 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java @@ -152,8 +152,7 @@ public class DialogueEditor extends JSONElementEditor { Dialogue.Reward::new, cellRendererRewards, titleRewards, - (x) -> null, - false + (x) -> null ).collapsiblePanel; if (dialogue.rewards == null || dialogue.rewards.isEmpty()) { rewards.collapse(); @@ -181,8 +180,7 @@ public class DialogueEditor extends JSONElementEditor { Dialogue.Reply::new, cellRendererReplies, titleReplies, - (x) -> null, - true + (x) -> null ).collapsiblePanel; if (dialogue.replies == null || dialogue.replies.isEmpty()) { replies.collapse(); @@ -459,8 +457,7 @@ public class DialogueEditor extends JSONElementEditor { Requirement::new, cellRendererRequirements, titleRequirements, - (x) -> x.required_obj, - false + (x) -> x.required_obj ); CollapsiblePanel requirementsPane = itemsPane.collapsiblePanel; requirementsList = itemsPane.list; diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DroplistEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DroplistEditor.java index 44e50a5..9ac4bab 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DroplistEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DroplistEditor.java @@ -66,8 +66,7 @@ public class DroplistEditor extends JSONElementEditor { DroppedItem::new, new DroppedItemsCellRenderer(), "Items in this droplist: ", - (x) -> x.item, - false + (x) -> x.item ).collapsiblePanel; if (droplist.dropped_items == null || droplist.dropped_items.isEmpty()) { itemsPane.collapse(); diff --git a/src/com/gpl/rpg/atcontentstudio/utils/UiUtils.java b/src/com/gpl/rpg/atcontentstudio/utils/UiUtils.java index a9d5ba0..a40dbcc 100644 --- a/src/com/gpl/rpg/atcontentstudio/utils/UiUtils.java +++ b/src/com/gpl/rpg/atcontentstudio/utils/UiUtils.java @@ -9,7 +9,6 @@ import com.gpl.rpg.atcontentstudio.ui.OrderedListenerListModel; import com.jidesoft.swing.JideBoxLayout; import javax.swing.*; -import java.awt.*; import java.awt.event.*; import java.util.function.Supplier; @@ -40,8 +39,7 @@ public class UiUtils { Supplier tempSupplier, DefaultListCellRenderer cellRenderer, String title, - BasicLambdaWithArgAndReturn getReferencedObj, - boolean withMoveButtons) { + BasicLambdaWithArgAndReturn getReferencedObj) { CollapsiblePanel itemsPane = new CollapsiblePanel(title); itemsPane.setLayout(new JideBoxLayout(itemsPane, JideBoxLayout.PAGE_AXIS)); final JList itemsList = new JList<>(itemsListModel); @@ -62,16 +60,13 @@ public class UiUtils { setSelectedItem.doIt(selectedValue); if (selectedValue == null) { deleteBtn.setEnabled(false); - if (withMoveButtons) { - moveUpBtn.setEnabled(false); - moveDownBtn.setEnabled(false); - } + moveUpBtn.setEnabled(false); + moveDownBtn.setEnabled(false); } else { deleteBtn.setEnabled(true); - if (withMoveButtons) { moveUpBtn.setEnabled(itemsList.getSelectedIndex() > 0); moveDownBtn.setEnabled(itemsList.getSelectedIndex() < (itemsListModel.getSize() - 1)); - } + } updateEditorPane.doIt(editorPane); }); @@ -80,10 +75,8 @@ public class UiUtils { listButtonsPane.setLayout(new JideBoxLayout(listButtonsPane, JideBoxLayout.LINE_AXIS, 6)); addRemoveAndAddButtons(listener, itemsListModel, selectedItemReset, selectedItem, tempSupplier, createBtn, itemsList, listButtonsPane, deleteBtn); + addMoveButtonListeners(listener, itemsListModel, selectedItem, moveUpBtn, itemsList, listButtonsPane, moveDownBtn); - if (withMoveButtons) { - addMoveButtonListeners(listener, itemsListModel, selectedItem, moveUpBtn, itemsList, listButtonsPane, moveDownBtn); - } listButtonsPane.add(new JPanel(), JideBoxLayout.VARY); itemsPane.add(listButtonsPane, JideBoxLayout.FIX); }