private void addItemToStore(TreeItem record, SummarySingleDto metricDto) { TreeItem taskItem = getTestItem(metricDto.getMetricName().getTest()); for (TreeItem rec : treeStore.getChildren(taskItem)) { if (rec.getKey().equals(record.getKey())) { return; } } treeStore.add(taskItem, record); }
public void addTestInfo(TaskDataDto test, Map<String, TestInfoDto> testInfoMap) { TreeItem testItem = getTestItem(test); String testInfoId = testItem.getKey() + TEST_INFO; if (treeStore.findModelWithKey(testInfoId) != null) { return; } String testItemName = getTestItemName(test); TreeItem testInfo = new TreeItem(testInfoId); testInfo.put(NAME, TEST_INFO); testInfo.put(TEST_DESCRIPTION, test.getDescription()); testInfo.put(TEST_NAME, testItemName); treeStore.insert(testItem, 0, testInfo); TreeItem clock = new TreeItem(testItem.getKey() + "Clock"); clock.put(NAME, "Clock"); clock.put(TEST_DESCRIPTION, test.getDescription()); clock.put(TEST_NAME, testItemName); clock.put(TEST_INFO, TEST_INFO); for (SessionDataDto session : chosenSessions) { if (testInfoMap.get(session.getSessionId()) != null) clock.put( SESSION_HEADER + session.getSessionId(), testInfoMap.get(session.getSessionId()).getClock()); } treeStore.add(testInfo, clock); TreeItem termination = new TreeItem(testItem.getKey() + "Termination"); termination.put(NAME, "Termination"); termination.put(TEST_DESCRIPTION, test.getDescription()); termination.put(TEST_NAME, testItemName); termination.put(TEST_INFO, TEST_INFO); for (SessionDataDto session : chosenSessions) { if (testInfoMap.get(session.getSessionId()) != null) termination.put( SESSION_HEADER + session.getSessionId(), testInfoMap.get(session.getSessionId()).getTermination()); } treeStore.add(testInfo, termination); TreeItem startTime = new TreeItem(testItem.getKey() + "Start time"); startTime.put(NAME, "Start time"); startTime.put(TEST_DESCRIPTION, test.getDescription()); startTime.put(TEST_NAME, testItemName); startTime.put(TEST_INFO, TEST_INFO); for (SessionDataDto session : chosenSessions) { if (testInfoMap.get(session.getSessionId()) != null) { Date date = testInfoMap.get(session.getSessionId()).getStartTime(); startTime.put(SESSION_HEADER + session.getSessionId(), dateFormatter.format(date)); } } treeStore.add(testInfo, startTime); }
private void removeRecord(SummarySingleDto metric) { TreeItem testItem = getTestItem(metric.getMetricName().getTest()); String key = testItem.getKey() + metric.getMetricName().getMetricName(); for (TreeItem item : treeStore.getChildren(testItem)) { if (item.getKey().equals(key)) { removeWithParent(item); return; } } }
// clear everything but Session Information public void clearTreeStore() { for (TreeItem root : treeStore.getRootItems()) { if (root.getKey().equals(SESSION_INFO_ID)) { continue; } for (TreeItem test : treeStore.getChildren(root)) { for (TreeItem item : treeStore.getChildren(test)) { if (TEST_INFO.equals(item.get(NAME))) { continue; } removeWithParent(item); } } } }
@Override public String getKey(TreeItem item) { return String.valueOf(item.getKey()); }