Search in sources :

Example 61 with CardLayout

use of java.awt.CardLayout in project zaproxy by zaproxy.

the class AbstractParamContainerPanel method showParamPanel.

/**
     * Shows the panel with the given name.
     * <p>
     * The previously shown panel (if any) is notified that it will be hidden.
     * 
     * @param panel the panel that will be notified that is now shown, must not be {@code null}.
     * @param name the name of the panel that will be shown, must not be {@code null}.
     * @see AbstractParamPanel#onHide()
     * @see AbstractParamPanel#onShow()
     */
public void showParamPanel(AbstractParamPanel panel, String name) {
    if (currentShownPanel == panel) {
        return;
    }
    // ZAP: Notify previously shown panel that it was hidden
    if (currentShownPanel != null) {
        currentShownPanel.onHide();
    }
    nameLastSelectedPanel = name;
    currentShownPanel = panel;
    getPanelHeadline();
    getTxtHeadline().setText(name);
    getHelpButton().setVisible(panel.getHelpIndex() != null);
    getShowHelpAction().setHelpIndex(panel.getHelpIndex());
    CardLayout card = (CardLayout) getPanelParam().getLayout();
    card.show(getPanelParam(), name);
    // ZAP: Notify the new panel that it is now shown
    panel.onShow();
}
Also used : CardLayout(java.awt.CardLayout)

Example 62 with CardLayout

use of java.awt.CardLayout in project zaproxy by zaproxy.

the class MainFrame method getPaneDisplay.

// ZAP: Removed the method getTxtStatus()
// ZAP: Removed the method setStatus(String). The status label
// ("txtStatus") that was in the footer panel is no longer used.
/**
	 * This method initializes paneDisplay
	 *
	 * @return JPanel
	 */
public JPanel getPaneDisplay() {
    if (paneDisplay == null) {
        paneDisplay = new JPanel();
        paneDisplay.setLayout(new CardLayout());
        paneDisplay.setName("paneDisplay");
        paneDisplay.add(getWorkbench(), getWorkbench().getName());
    }
    return paneDisplay;
}
Also used : JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout)

Example 63 with CardLayout

use of java.awt.CardLayout in project zaproxy by zaproxy.

the class HttpPanelComponentViewsManager method switchView.

private void switchView(final String name) {
    if (this.currentView != null && this.currentView.getCaptionName().equals(name)) {
        currentView.setSelected(true);
        if (owner != null) {
            owner.fireMessageViewChangedEvent(currentView, currentView);
        }
        return;
    }
    HttpPanelView view = views.get(name);
    if (view == null) {
        logger.info("No view found with name: " + name);
        return;
    }
    HttpPanelView previousView = currentView;
    if (this.currentView != null) {
        this.currentView.setSelected(false);
        this.currentView.getModel().clear();
    }
    this.currentView = view;
    comboBoxModel.setSelectedItem(viewItems.get(name));
    this.currentView.getModel().setMessage(message);
    ((CardLayout) panelViews.getLayout()).show(panelViews, name);
    this.currentView.setSelected(true);
    if (owner != null) {
        owner.fireMessageViewChangedEvent(previousView, currentView);
    }
}
Also used : HttpPanelView(org.zaproxy.zap.extension.httppanel.view.HttpPanelView) SearchableHttpPanelView(org.zaproxy.zap.extension.search.SearchableHttpPanelView) CardLayout(java.awt.CardLayout)

Example 64 with CardLayout

use of java.awt.CardLayout in project zaproxy by zaproxy.

the class HttpPanel method switchEmptyComponent.

private void switchEmptyComponent() {
    if (this.currentComponent != null) {
        currentComponent.setSelected(false);
        currentComponent.clearView();
        if (currentComponent.getOptionsPanel() != null) {
            componentOptions.remove(0);
        }
        if (currentComponent.getMoreOptionsPanel() != null) {
            moreOptionsComponent.remove(0);
        }
        currentComponent = null;
    }
    if (noComponentsPanel == null) {
        noComponentsPanel = new JPanel(new BorderLayout(5, 5));
        noComponentsPanel.add(new JLabel(NO_SUITABLE_COMPONENT_FOUND_LABEL));
        getPanelContent().add(new JScrollPane(noComponentsPanel), "");
    }
    componentOptions.removeAll();
    componentOptions.validate();
    ((CardLayout) getPanelContent().getLayout()).show(panelContent, "");
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout) BorderLayout(java.awt.BorderLayout) JLabel(javax.swing.JLabel)

Example 65 with CardLayout

use of java.awt.CardLayout 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

CardLayout (java.awt.CardLayout)92 JPanel (javax.swing.JPanel)37 BorderLayout (java.awt.BorderLayout)16 JLabel (javax.swing.JLabel)14 JScrollPane (javax.swing.JScrollPane)12 Dimension (java.awt.Dimension)9 GridBagLayout (java.awt.GridBagLayout)8 Insets (java.awt.Insets)8 JButton (javax.swing.JButton)7 ImageIcon (javax.swing.ImageIcon)6 ListSelectionEvent (javax.swing.event.ListSelectionEvent)6 JSplitPane (javax.swing.JSplitPane)5 ListSelectionListener (javax.swing.event.ListSelectionListener)5 FlowLayout (java.awt.FlowLayout)4 Font (java.awt.Font)4 Point (java.awt.Point)4 JList (javax.swing.JList)4 EmptyBorder (javax.swing.border.EmptyBorder)4 AWTException (java.awt.AWTException)3 GridBagConstraints (java.awt.GridBagConstraints)3