(メッセージはありません)
@@ -1,7 +1,6 @@ | ||
1 | 1 | package jp.gr.java_conf.mitonan.plezntesting.model; |
2 | 2 | |
3 | -import java.util.ArrayList; | |
4 | -import java.util.List; | |
3 | +import java.util.TreeMap; | |
5 | 4 | |
6 | 5 | import org.apache.commons.lang3.builder.ReflectionToStringBuilder; |
7 | 6 | import org.apache.commons.lang3.builder.ToStringStyle; |
@@ -10,15 +9,18 @@ | ||
10 | 9 | |
11 | 10 | private TestElement testElement; |
12 | 11 | private String value; |
13 | - private List<String> markList = new ArrayList<String>(); | |
12 | + private TreeMap<Integer, String> markMap = new TreeMap<Integer, String>(); | |
13 | + | |
14 | 14 | public TestData(TestElement testElement) { |
15 | 15 | this(testElement, ""); |
16 | 16 | } |
17 | - public TestData(TestElement testElement, String value, String... marks) { | |
17 | + public TestData(TestElement testElement, String value, String[]... marks) { | |
18 | 18 | this.testElement = testElement; |
19 | 19 | this.value = value; |
20 | - for (String mark : marks) { | |
21 | - this.markList.add(mark); | |
20 | + for (String[] mark : marks) { | |
21 | + if ((mark != null) && (1 < mark.length)) { | |
22 | + this.markMap.put(Integer.valueOf(mark[0]), mark[1]); | |
23 | + } | |
22 | 24 | } |
23 | 25 | } |
24 | 26 | public String getValue() { |
@@ -27,12 +29,17 @@ | ||
27 | 29 | public void setValue(String value) { |
28 | 30 | this.value = value; |
29 | 31 | } |
30 | - public List<String> getMarkList() { | |
31 | - return markList; | |
32 | + public void putMark(int tcNum, String mark) { | |
33 | + this.markMap.put(tcNum, mark); | |
32 | 34 | } |
33 | - public void setMarkList(List<String> markList) { | |
34 | - this.markList = markList; | |
35 | + public String getMark(int tcNum) { | |
36 | + String value = this.markMap.get(tcNum); | |
37 | + if (value == null) { | |
38 | + value = ""; | |
39 | + } | |
40 | + return value; | |
35 | 41 | } |
42 | + | |
36 | 43 | public String getElementStr() { |
37 | 44 | return ""; |
38 | 45 | } |
@@ -164,77 +164,4 @@ | ||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - class DataDesignTreeViewLabelProvider extends LabelProvider implements ITableLabelProvider { | |
168 | - | |
169 | - @Override | |
170 | - public Image getColumnImage(Object element, int columnIndex) { | |
171 | - return null; | |
172 | - } | |
173 | - | |
174 | - @Override | |
175 | - public String getColumnText(Object element, int columnIndex) { | |
176 | - String text = null; | |
177 | - if (element instanceof TreeNode) { | |
178 | - TreeNode node = (TreeNode)element; | |
179 | - Object nodeValue = node.getValue(); | |
180 | - if (nodeValue instanceof TestElement) { | |
181 | - text = createColumnText((TestElement)nodeValue, columnIndex); | |
182 | - } else if (nodeValue instanceof TestData) { | |
183 | - text = createColumnText((TestData)nodeValue, columnIndex); | |
184 | - } else { | |
185 | - text = element.toString(); | |
186 | - } | |
187 | - } else { | |
188 | - text = element.toString(); | |
189 | - } | |
190 | - return text; | |
191 | - } | |
192 | - | |
193 | - public String getText(Object obj) { | |
194 | - if (obj instanceof TreeNode) { | |
195 | - //return ((TreeNode)obj).getValue().toString(); | |
196 | - return getColumnText(obj, 0); | |
197 | - } else { | |
198 | - return obj.toString(); | |
199 | - } | |
200 | - } | |
201 | - | |
202 | - private String createColumnText(TestElement element, int columnIndex) { | |
203 | - String text = null; | |
204 | - switch(columnIndex) { | |
205 | - case 0: | |
206 | - text = element.getName() + ":" + element.getFqcn(); | |
207 | - break; | |
208 | - default: | |
209 | - text = ""; | |
210 | - } | |
211 | - return text; | |
212 | - } | |
213 | - | |
214 | - private String createColumnText(TestData testData, int columnIndex) { | |
215 | - String text = null; | |
216 | - switch(columnIndex) { | |
217 | - case 0: | |
218 | - /* | |
219 | - TestElement element = testData.getTestElement(); | |
220 | - text = element.getName() + ":" + element.getFqcn(); | |
221 | - */ | |
222 | - text = ""; | |
223 | - break; | |
224 | - case 1: | |
225 | - text = testData.getValue(); | |
226 | - break; | |
227 | - default: | |
228 | - List<String> markList = testData.getMarkList(); | |
229 | - int idx = columnIndex - 2; | |
230 | - if ((0 <= idx) && (idx < markList.size())) { | |
231 | - text = markList.get(idx); | |
232 | - } else { | |
233 | - text = ""; | |
234 | - } | |
235 | - } | |
236 | - return text; | |
237 | - } | |
238 | - } | |
239 | - | |
240 | 167 | } |
@@ -1,7 +1,5 @@ | ||
1 | 1 | package jp.gr.java_conf.mitonan.plezntesting.viewers.provider; |
2 | 2 | |
3 | -import java.util.List; | |
4 | - | |
5 | 3 | import jp.gr.java_conf.mitonan.plezntesting.model.TestData; |
6 | 4 | |
7 | 5 | import org.eclipse.jface.viewers.ColumnLabelProvider; |
@@ -24,11 +22,8 @@ | ||
24 | 22 | String text = ""; |
25 | 23 | if (element instanceof TestData) { |
26 | 24 | TestData testData = (TestData)element; |
27 | - List<String> markList = testData.getMarkList(); | |
28 | - int idx = this.columnIdx - START_IDX_TESTCASE; | |
29 | - if ((0 <= idx) && (idx < markList.size())) { | |
30 | - text = markList.get(idx); | |
31 | - } | |
25 | + int tcNum = this.columnIdx - START_IDX_TESTCASE; | |
26 | + text = testData.getMark(tcNum); | |
32 | 27 | } |
33 | 28 | return text; |
34 | 29 | } |
@@ -40,9 +35,6 @@ | ||
40 | 35 | } |
41 | 36 | TestData testData = (TestData)element; |
42 | 37 | int tcNum = this.columnIdx - START_IDX_TESTCASE; |
43 | - if (tcNum < testData.getMarkList().size()) { | |
44 | - testData.getMarkList().set( | |
45 | - this.columnIdx - START_IDX_TESTCASE, value.toString()); | |
46 | - } | |
38 | + testData.putMark(tcNum, value.toString()); | |
47 | 39 | } |
48 | 40 | } |
@@ -12,13 +12,13 @@ | ||
12 | 12 | root.addTestData(new TestData(root, "new MyBean()")); |
13 | 13 | |
14 | 14 | TestElement idElement = new TestElement(root, "id", "int"); |
15 | - idElement.addTestData(new TestData(idElement, "0", "", "Y", "")); | |
16 | - idElement.addTestData(new TestData(idElement, "1", "", "", "Y")); | |
15 | + idElement.addTestData(new TestData(idElement, "0", new String[]{"2", "Y"})); | |
16 | + idElement.addTestData(new TestData(idElement, "1", new String[]{"3", "Y"})); | |
17 | 17 | root.putChildren(idElement.getName(), idElement); |
18 | 18 | |
19 | 19 | TestElement nameElement = new TestElement(root, "name", "java.lang.String"); |
20 | - nameElement.addTestData(new TestData(nameElement, "abc", "", "Y", "")); | |
21 | - nameElement.addTestData(new TestData(nameElement, "あいう", "", "", "Y")); | |
20 | + nameElement.addTestData(new TestData(nameElement, "abc", new String[]{"2", "Y"})); | |
21 | + nameElement.addTestData(new TestData(nameElement, "あいう", new String[]{"3", "Y"})); | |
22 | 22 | root.putChildren(nameElement.getName(), nameElement); |
23 | 23 | roots[0] = root; |
24 | 24 | return roots; |