nl.nn.testtool.echo2.run.TreePane Maven / Gradle / Ivy
/*
Copyright 2018 Nationale-Nederlanden
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package nl.nn.testtool.echo2.run;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import echopointng.tree.DefaultMutableTreeNode;
import echopointng.tree.TreePath;
import nl.nn.testtool.MetadataExtractor;
import nl.nn.testtool.Report;
import nl.nn.testtool.echo2.BeanParent;
import nl.nn.testtool.echo2.RunPane;
import nl.nn.testtool.filter.View;
import nl.nn.testtool.storage.Storage;
import nl.nn.testtool.storage.StorageException;
public class TreePane extends nl.nn.testtool.echo2.reports.TreePane implements BeanParent {
private static final long serialVersionUID = 1L;
private InfoPane infoPane;
private BeanParent beanParent;
private Storage storage;
private List reportsWithDirtyPaths = new ArrayList();
public void setStorage(Storage storage) {
this.storage = storage;
}
@Override
public void setInfoPane(nl.nn.testtool.echo2.reports.InfoPane infoPane) {
throw new RuntimeException("Not implemented");
}
/**
* @see nl.nn.testtool.echo2.Echo2Application#initBean()
*/
public void initBean(BeanParent beanParent) {
this.beanParent = beanParent;
RunPane runPane = (RunPane)beanParent;
infoPane = runPane.getInfoPane();
}
public BeanParent getBeanParent() {
return beanParent;
}
/**
* @see nl.nn.testtool.echo2.Echo2Application#initBean()
*/
@Override
public void init() {
super.init();
redisplayReports((String)null, null);
}
@Override
public void selectNode(DefaultMutableTreeNode node) {
selectNode(node, null);
}
@Override
protected void selectNode(DefaultMutableTreeNode node, DefaultMutableTreeNode nodeFromOtherTree, boolean compare) {
selectNode(node, null);
}
protected void selectNode(DefaultMutableTreeNode node, Set selectedStorageIds) {
if (node != null) {
TreePath treePath = new TreePath(node.getPath());
tree.setSelectionPath(treePath);
String path = "";
for (int i = 1; i < treePath.getPath().length; i++) {
path = path + "/" + treePath.getPath()[i];
}
path = path + "/";
log.debug("Display: " + path);
infoPane.display(path, selectedStorageIds);
}
}
@Override
synchronized public DefaultMutableTreeNode addReport(Report report, View view, boolean sortReports) {
throw new RuntimeException("Not implemented");
}
@Override
public Storage getStorage() throws StorageException {
throw new RuntimeException("Not implemented");
}
@Override
public void redisplayReports(View view) {
throw new RuntimeException("Not implemented");
}
public void redisplayReports(String selectPath, Set selectedStorageIds) {
rootNode.removeAllChildren();
reportsWithDirtyPaths.clear();
List metadataNames = new ArrayList();
metadataNames.add("storageId");
metadataNames.add("path");
List> metadata = null;
try {
metadata = storage.getMetadata(-1, metadataNames, null, MetadataExtractor.VALUE_TYPE_OBJECT);
} catch (StorageException e) {
// TODO iets doen
e.printStackTrace();
}
List pathsToAdd = new ArrayList();
Iterator> metadataIterator = metadata.iterator();
while (metadataIterator.hasNext()) {
List