Commit 472cf859 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Merge branch 'jr/topology-ui-extension' into 'master'

Extended the VisualizationTopologyView

A minor extension that allows entries in the checkbox list to be hidden and, thus, make the visualization more intuitive. All changes are backwards-compatible.

This feature is used by the new Visualization of Transit++.

The remote branch can be deleted once the feature was merged.

See merge request !3
parents 35f9ff03 593b509f
......@@ -576,8 +576,14 @@ public class VisualizationTopologyView extends JFrame implements TopologyView,
public static void injectComponent(String name, int priority,
JComponent component, boolean active) {
injectComponent(name, priority, component, active, true);
}
public static void injectComponent(String name, int priority,
JComponent component, boolean active, boolean showInList) {
VisInfo visInfo = new VisInfo(name, priority, component);
visInfo.setActiveByDefault(active);
visInfo.setShowInList(showInList);
components.add(visInfo);
nameToVisInfoMap.put(name, visInfo);
......
......@@ -246,12 +246,15 @@ public class ComponentVisManager {
* @version 1.0, 12.07.2012
*/
public static class VisInfo {
private String name;
private int priority;
private boolean activeByDefault = true;
private boolean showInList = true;
private List<JComponent> components = Lists.newArrayList();
public VisInfo(String name, int priority, JComponent... component) {
......@@ -299,6 +302,14 @@ public class ComponentVisManager {
public void setActiveByDefault(boolean activeByDefault) {
this.activeByDefault = activeByDefault;
}
public boolean isShowInList() {
return showInList;
}
public void setShowInList(boolean showInList) {
this.showInList = showInList;
}
}
/**
......
......@@ -105,7 +105,9 @@ public class ComponentToggler extends JPanel {
constraints.weighty = 0;
constraints.ipady = 0;
add(checkBox, constraints);
if (visInfo.isShowInList())
add(checkBox, constraints);
componentNameToCheckBoxMap.put(visInfo.getName(), checkBox);
for (JComponent comp : visInfo.getComponents()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment