diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java index 00bd0b2..d717615 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/CommonEditor.java @@ -43,4 +43,29 @@ public class CommonEditor { return c; } } + public static class ConditionsCellRenderer extends DefaultListCellRenderer { + private static final long serialVersionUID = 7987880146189575234L; + + @Override + public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (c instanceof JLabel) { + JLabel label = ((JLabel) c); + Common.ActorConditionEffect effect = (Common.ActorConditionEffect) value; + + if (effect.condition != null) { + if (effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) { + label.setIcon(new OverlayIcon(effect.condition.getIcon(), DefaultIcons.getImmunityIcon())); + label.setText("Immune to actor condition " + effect.condition.getDesc()); + } else { + label.setIcon(new ImageIcon(effect.condition.getIcon())); + label.setText("Give actor condition " + effect.condition.getDesc() + " x" + effect.magnitude); + } + } else { + label.setText("New, undefined actor condition effect."); + } + } + return c; + } + } } diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java index 6f956c6..24b88c8 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java @@ -211,7 +211,7 @@ public class ItemEditor extends JSONElementEditor { String titleEquipConditions = "Actor Conditions applied when equipped: "; equipConditionsModel = new ConditionsListModel(equipEffect); - ConditionsCellRenderer cellRendererEquipConditions = new ConditionsCellRenderer(); + CommonEditor.ConditionsCellRenderer cellRendererEquipConditions = new CommonEditor.ConditionsCellRenderer(); BasicLambdaWithArg selectedSetEquipConditions = (value)->selectedEquipEffectCondition = value; BasicLambdaWithReturn selectedGetEquipConditions = ()->selectedEquipEffectCondition ; BasicLambda selectedResetEquipConditions = ()->selectedEquipEffectCondition = null; @@ -1033,31 +1033,6 @@ public class ItemEditor extends JSONElementEditor { } } - public static class ConditionsCellRenderer extends DefaultListCellRenderer { - private static final long serialVersionUID = 7987880146189575234L; - - @Override - public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - if (c instanceof JLabel) { - JLabel label = ((JLabel) c); - Common.ActorConditionEffect effect = (Common.ActorConditionEffect) value; - - if (effect.condition != null) { - if (effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) { - label.setIcon(new OverlayIcon(effect.condition.getIcon(), DefaultIcons.getImmunityIcon())); - label.setText("Immune to actor condition " + effect.condition.getDesc()); - } else { - label.setIcon(new ImageIcon(effect.condition.getIcon())); - label.setText("Give actor condition " + effect.condition.getDesc() + " x" + effect.magnitude); - } - } else { - label.setText("New, undefined actor condition effect."); - } - } - return c; - } - } public static boolean isNull(Item.EquipEffect effect) { if (effect.conditions != null) return false;