Search in sources :

Example 1 with MessagePanelEventListener

use of org.zaproxy.zap.extension.httppanel.MessagePanelEventListener in project zaproxy by zaproxy.

the class AbstractMessageLocationsPanel method createMessagePanelEventListener.

protected MessagePanelEventListener createMessagePanelEventListener() {
    return new MessagePanelEventListener() {

        @Override
        public void componentChanged(ComponentChangedEvent event) {
            for (T entry : getModel().getElements()) {
                MessageLocationHighlight highlight = entry.getHighlight();
                if (highlight != null) {
                    MessageLocationHighlight highlightReference = selectMessageLocationsPanel.highlight(entry.getLocation(), highlight);
                    entry.setHighlightReference(highlightReference);
                }
            }
        }

        @Override
        public void viewSelected(MessageViewSelectedEvent event) {
            HttpPanelView view = event.getCurrentView();
            if (view instanceof MessageLocationHighlighter) {
                MessageLocationHighlighter highlighter = (MessageLocationHighlighter) view;
                for (T entry : getModel().getElements()) {
                    MessageLocationHighlight highlight = entry.getHighlight();
                    if (highlight != null) {
                        MessageLocationHighlight highlightReference = highlighter.highlight(entry.getLocation(), highlight);
                        entry.setHighlightReference(highlightReference);
                    }
                }
            } else {
                for (T entry : getModel().getElements()) {
                    entry.setHighlightReference(null);
                }
            }
        }
    };
}
Also used : HttpPanelView(org.zaproxy.zap.extension.httppanel.view.HttpPanelView) MessageViewSelectedEvent(org.zaproxy.zap.extension.httppanel.MessageViewSelectedEvent) MessagePanelEventListener(org.zaproxy.zap.extension.httppanel.MessagePanelEventListener) ComponentChangedEvent(org.zaproxy.zap.extension.httppanel.ComponentChangedEvent)

Aggregations

ComponentChangedEvent (org.zaproxy.zap.extension.httppanel.ComponentChangedEvent)1 MessagePanelEventListener (org.zaproxy.zap.extension.httppanel.MessagePanelEventListener)1 MessageViewSelectedEvent (org.zaproxy.zap.extension.httppanel.MessageViewSelectedEvent)1 HttpPanelView (org.zaproxy.zap.extension.httppanel.view.HttpPanelView)1