Search in sources :

Example 1 with HttpPanelComponentInterface

use of org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface in project zaproxy by zaproxy.

the class HttpPanel method removeComponent.

public void removeComponent(String componentName) {
    synchronized (components) {
        HttpPanelComponentInterface component = components.get(componentName);
        if (component != null) {
            if (component.isEnabled(message)) {
                disableComponent(component);
            }
            if (enabledComponents.size() > 0) {
                switchComponent(enabledComponents.get(0).getName());
            } else {
                switchEmptyComponent();
            }
            components.remove(componentName);
            panelContent.remove(component.getMainPanel());
            this.validate();
        }
    }
}
Also used : HttpPanelComponentInterface(org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface)

Example 2 with HttpPanelComponentInterface

use of org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface in project zaproxy by zaproxy.

the class HttpPanel method highlightBody.

public void highlightBody(SearchMatch sm) {
    if (currentComponent instanceof SearchableHttpPanelComponent) {
        ((SearchableHttpPanelComponent) currentComponent).highlightBody(sm);
    } else {
        HttpPanelComponentInterface component = findSearchablePanel();
        if (component != null) {
            switchComponent(component.getName());
            ((SearchableHttpPanelComponent) currentComponent).highlightBody(sm);
        }
    }
}
Also used : HttpPanelComponentInterface(org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface) SearchableHttpPanelComponent(org.zaproxy.zap.extension.search.SearchableHttpPanelComponent)

Example 3 with HttpPanelComponentInterface

use of org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface in project zaproxy by zaproxy.

the class HttpPanel method setEnableViewSelect.

public void setEnableViewSelect(boolean enableViewSelect) {
    if (isEnableViewSelect != enableViewSelect) {
        isEnableViewSelect = enableViewSelect;
        synchronized (components) {
            Iterator<HttpPanelComponentInterface> it = components.values().iterator();
            while (it.hasNext()) {
                HttpPanelComponentInterface component = it.next();
                component.setEnableViewSelect(enableViewSelect);
                component.getButton().setEnabled(enableViewSelect);
            }
        }
    }
}
Also used : HttpPanelComponentInterface(org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface)

Example 4 with HttpPanelComponentInterface

use of org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface in project zaproxy by zaproxy.

the class HttpPanel method setMessage.

public void setMessage(Message msg) {
    this.message = msg;
    for (Iterator<Entry<String, HttpPanelComponentInterface>> it = components.entrySet().iterator(); it.hasNext(); ) {
        HttpPanelComponentInterface component = it.next().getValue();
        if (!component.isEnabled(message)) {
            if (enabledComponents.contains(component)) {
                disableComponent(component);
            }
        } else if (!enabledComponents.contains(component)) {
            enableComponent(component);
        }
    }
    if (enabledComponents.size() == 0) {
        currentComponent = null;
        switchEmptyComponent();
        return;
    }
    boolean switchView = true;
    if (currentComponent != null && enabledComponents.contains(components.get(currentComponent.getName()))) {
        switchView = false;
    }
    this.validate();
    if (switchView) {
        switchComponent(enabledComponents.get(0).getName());
    } else {
        updateContent();
    }
}
Also used : HttpPanelComponentInterface(org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface) Entry(java.util.Map.Entry)

Example 5 with HttpPanelComponentInterface

use of org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface in project zaproxy by zaproxy.

the class HttpPanel method highlightHeader.

public void highlightHeader(SearchMatch sm) {
    if (currentComponent instanceof SearchableHttpPanelComponent) {
        ((SearchableHttpPanelComponent) currentComponent).highlightHeader(sm);
    } else {
        HttpPanelComponentInterface component = findSearchablePanel();
        if (component != null) {
            switchComponent(component.getName());
            ((SearchableHttpPanelComponent) currentComponent).highlightHeader(sm);
        }
    }
}
Also used : HttpPanelComponentInterface(org.zaproxy.zap.extension.httppanel.component.HttpPanelComponentInterface) SearchableHttpPanelComponent(org.zaproxy.zap.extension.search.SearchableHttpPanelComponent)

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