Search in sources :

Example 6 with HttpPanelComponentInterface

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);
}
Also used : HttpPanelComponentInterface(org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface) JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout)

Aggregations

HttpPanelComponentInterface (org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface)6 SearchableHttpPanelComponent (org.zaproxy.zap.extension.search.SearchableHttpPanelComponent)2 CardLayout (java.awt.CardLayout)1 Entry (java.util.Map.Entry)1 JPanel (javax.swing.JPanel)1