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();
}
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;
}
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);
}
}
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, "");
}
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);
}
Aggregations