mirror of
https://github.com/AndorsTrailRelease/ATCS.git
synced 2025-10-27 18:44:03 +01:00
move ConditionsCellRenderer to CommonEditor
This commit is contained in:
@@ -43,4 +43,29 @@ public class CommonEditor {
|
|||||||
return c;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ public class ItemEditor extends JSONElementEditor {
|
|||||||
|
|
||||||
String titleEquipConditions = "Actor Conditions applied when equipped: ";
|
String titleEquipConditions = "Actor Conditions applied when equipped: ";
|
||||||
equipConditionsModel = new ConditionsListModel(equipEffect);
|
equipConditionsModel = new ConditionsListModel(equipEffect);
|
||||||
ConditionsCellRenderer cellRendererEquipConditions = new ConditionsCellRenderer();
|
CommonEditor.ConditionsCellRenderer cellRendererEquipConditions = new CommonEditor.ConditionsCellRenderer();
|
||||||
BasicLambdaWithArg<Common.ActorConditionEffect> selectedSetEquipConditions = (value)->selectedEquipEffectCondition = value;
|
BasicLambdaWithArg<Common.ActorConditionEffect> selectedSetEquipConditions = (value)->selectedEquipEffectCondition = value;
|
||||||
BasicLambdaWithReturn<Common.ActorConditionEffect> selectedGetEquipConditions = ()->selectedEquipEffectCondition ;
|
BasicLambdaWithReturn<Common.ActorConditionEffect> selectedGetEquipConditions = ()->selectedEquipEffectCondition ;
|
||||||
BasicLambda selectedResetEquipConditions = ()->selectedEquipEffectCondition = null;
|
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) {
|
public static boolean isNull(Item.EquipEffect effect) {
|
||||||
if (effect.conditions != null) return false;
|
if (effect.conditions != null) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user