use of org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface in project zaproxy by zaproxy.
the class HttpPanel method switchComponent.
private void switchComponent(String name) {
if (this.currentComponent != null && currentComponent.getName().equals(name)) {
currentComponent.setSelected(true);
return;
}
HttpPanelComponentInterface newComponent = components.get(name);
if (newComponent == null) {
logger.info("No component found with name: " + name);
return;
}
if (this.currentComponent != null) {
currentComponent.setSelected(false);
currentComponent.clearView();
if (currentComponent.getOptionsPanel() != null) {
componentOptions.remove(0);
}
if (currentComponent.getMoreOptionsPanel() != null) {
moreOptionsComponent.remove(0);
}
}
HttpPanelComponentInterface previousComponent = currentComponent;
this.currentComponent = newComponent;
updateContent();
JPanel componentOptionsPanel = currentComponent.getOptionsPanel();
if (componentOptionsPanel != null) {
componentOptions.add(componentOptionsPanel);
}
componentOptions.validate();
JPanel componentMoreOptionsPanel = currentComponent.getMoreOptionsPanel();
if (componentMoreOptionsPanel != null) {
moreOptionsComponent.add(componentMoreOptionsPanel);
}
moreOptionsComponent.validate();
((CardLayout) getPanelContent().getLayout()).show(panelContent, name);
currentComponent.setSelected(true);
fireComponentChangedEvent(previousComponent, currentComponent);
}
Aggregations