|
@@ -24,8 +24,10 @@ package uk.co.md87.evetool.ui.pages;
|
24
|
24
|
|
25
|
25
|
import java.awt.event.ActionEvent;
|
26
|
26
|
import java.awt.event.ActionListener;
|
|
27
|
+import java.util.ArrayList;
|
27
|
28
|
import java.util.Collections;
|
28
|
29
|
|
|
30
|
+import java.util.List;
|
29
|
31
|
import javax.swing.JSeparator;
|
30
|
32
|
|
31
|
33
|
import net.miginfocom.swing.MigLayout;
|
|
@@ -43,6 +45,7 @@ import uk.co.md87.evetool.ui.components.ListablePanel;
|
43
|
45
|
import uk.co.md87.evetool.ui.data.TrainedSkillInfoSurrogate;
|
44
|
46
|
import uk.co.md87.evetool.ui.dialogs.listableconfig.ListableConfigDialog;
|
45
|
47
|
import uk.co.md87.evetool.ui.listable.Listable;
|
|
48
|
+import uk.co.md87.evetool.ui.listable.ListableComparator;
|
46
|
49
|
import uk.co.md87.evetool.ui.listable.ListableConfig;
|
47
|
50
|
import uk.co.md87.evetool.ui.listable.ListableParser;
|
48
|
51
|
|
|
@@ -81,6 +84,12 @@ public class SkillPage extends Page implements ActionListener {
|
81
|
84
|
config.bottomLeft = new ListableConfig.BasicConfigElement("group name");
|
82
|
85
|
config.bottomRight = new ListableConfig.BasicConfigElement("time to next level");
|
83
|
86
|
config.group = new ListableConfig.BasicConfigElement("group name");
|
|
87
|
+
|
|
88
|
+ config.sortOrder = new ListableConfig.ConfigElement[]{
|
|
89
|
+ new ListableConfig.BasicConfigElement("group name"),
|
|
90
|
+ new ListableConfig.BasicConfigElement("current level"),
|
|
91
|
+ new ListableConfig.BasicConfigElement("trained skillpoints"),
|
|
92
|
+ };
|
84
|
93
|
}
|
85
|
94
|
|
86
|
95
|
/** {@inheritDoc} */
|
|
@@ -99,19 +108,23 @@ public class SkillPage extends Page implements ActionListener {
|
99
|
108
|
|
100
|
109
|
removeAll();
|
101
|
110
|
|
102
|
|
- Collections.sort(character.getSheet().getResult().getSkills(),
|
103
|
|
- new TrainingTimeComparator(true));
|
104
|
|
-
|
105
|
111
|
final ListableParser parser = new ListableParser(TrainedSkillInfoSurrogate.class);
|
|
112
|
+ final List<TrainedSkillInfoSurrogate> list = new ArrayList<TrainedSkillInfoSurrogate>();
|
|
113
|
+
|
|
114
|
+ for (TrainedSkillInfo skill : character.getSheet().getResult().getSkills()) {
|
|
115
|
+ list.add(new TrainedSkillInfoSurrogate(skill));
|
|
116
|
+ }
|
|
117
|
+
|
|
118
|
+ if (config.sortOrder != null) {
|
|
119
|
+ Collections.sort(list, new ListableComparator(config.sortOrder, parser));
|
|
120
|
+ }
|
106
|
121
|
|
107
|
122
|
String lastGroup = null;
|
108
|
123
|
boolean first = true;
|
109
|
124
|
|
110
|
|
- for (TrainedSkillInfo skill : character.getSheet().getResult().getSkills()) {
|
111
|
|
- final Listable wrapper = new TrainedSkillInfoSurrogate(skill);
|
112
|
|
-
|
|
125
|
+ for (TrainedSkillInfoSurrogate skill : list) {
|
113
|
126
|
if (config.group != null) {
|
114
|
|
- final String thisGroup = config.group.getValue(wrapper, parser);
|
|
127
|
+ final String thisGroup = config.group.getValue(skill, parser);
|
115
|
128
|
|
116
|
129
|
if (lastGroup == null || !thisGroup.equals(lastGroup)) {
|
117
|
130
|
first = true;
|
|
@@ -126,7 +139,7 @@ public class SkillPage extends Page implements ActionListener {
|
126
|
139
|
add(new JSeparator(), "growx, pushx");
|
127
|
140
|
}
|
128
|
141
|
|
129
|
|
- add(new ListablePanel(wrapper, parser, config),
|
|
142
|
+ add(new ListablePanel(skill, parser, config),
|
130
|
143
|
"growx, pushx");
|
131
|
144
|
}
|
132
|
145
|
}
|