20 package net.sf.gridarta.gui.dialog.goexit;
22 import java.awt.Component;
23 import java.awt.Point;
24 import java.util.Comparator;
25 import javax.swing.DefaultListCellRenderer;
26 import javax.swing.JList;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
39 public class MapListCellRenderer extends DefaultListCellRenderer implements Comparator<GameObject<?, ?, ?>> {
62 public Component
getListCellRendererComponent(
final JList<?> list,
final Object value,
final int index,
final boolean isSelected,
final boolean cellHasFocus) {
63 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
68 final StringBuilder sb =
new StringBuilder();
69 sb.append(gameObject.getBestName());
71 if (mapLocation ==
null) {
77 sb.append(mapCoordinate.x);
79 sb.append(mapCoordinate.y);
82 setText(sb.toString());
102 final String name1 = o1.getBestName();
103 final String name2 = o2.getBestName();
104 final int cmp1 = name1.compareToIgnoreCase(name2);
111 if (mapLocation1 ==
null) {
112 if (mapLocation2 !=
null) {
115 }
else if (mapLocation2 ==
null) {
118 final int cmp2 = mapLocation1.
compareTo(mapLocation2);
124 final String faceObjName1 = o1.getFaceObjName();
125 final String faceObjName2 = o2.getFaceObjName();
126 if (faceObjName1 ==
null) {
127 if (faceObjName2 !=
null) {
130 }
else if (faceObjName2 ==
null) {
133 final int cmp3 = faceObjName1.compareTo(faceObjName2);