use of java.awt.Component in project zaproxy by zaproxy.
the class TabbedPanel2 method pinVisibleTabs.
public void pinVisibleTabs() {
for (int i = 0; i < this.getTabCount(); i++) {
Component tabCom = this.getTabComponentAt(i);
if (tabCom != null && tabCom instanceof TabbedPanelTab && tabCom.isVisible()) {
TabbedPanelTab jp = (TabbedPanelTab) tabCom;
jp.setPinned(true);
this.saveTabState(jp.getAbstractPanel());
}
}
}
use of java.awt.Component in project zaproxy by zaproxy.
the class StandardFieldsDialog method setComboBoxModel.
/**
* Sets the given combo box model into the combo box with the given label.
* <p>
* Control of selection state (i.e. set/get selected item) is done through the combo box model.
*
* @param <E> the type of the elements of the combo box model.
* @param fieldLabel the name of the label of the combo box field
* @param comboBoxModel the model to set into the combo box
* @since TODO add version
* @see #addComboField(String, ComboBoxModel)
* @see #addComboField(int, String, ComboBoxModel)
*/
public <E> void setComboBoxModel(String fieldLabel, ComboBoxModel<E> comboBoxModel) {
Component c = this.fieldMap.get(fieldLabel);
if (c instanceof JComboBox) {
@SuppressWarnings("unchecked") JComboBox<E> comboBox = (JComboBox<E>) c;
comboBox.setModel(comboBoxModel);
} else if (c == null) {
// Ignore - could be during init
logger.debug("No field for " + fieldLabel);
} else {
logger.error("Unrecognised field class " + fieldLabel + ": " + c.getClass().getCanonicalName());
}
}
use of java.awt.Component in project zaproxy by zaproxy.
the class StandardFieldsDialog method setComboFields.
public void setComboFields(String fieldLabel, List<String> choices, String value) {
Component c = this.fieldMap.get(fieldLabel);
if (c instanceof JComboBox) {
@SuppressWarnings("unchecked") JComboBox<String> comboBox = (JComboBox<String>) c;
comboBox.removeAllItems();
for (String str : choices) {
comboBox.addItem(str);
}
if (value != null) {
comboBox.setSelectedItem(value);
}
} else if (c == null) {
// Ignore - could be during init
logger.debug("No field for " + fieldLabel);
} else {
logger.error("Unrecognised field class " + fieldLabel + ": " + c.getClass().getCanonicalName());
}
}
use of java.awt.Component in project zaproxy by zaproxy.
the class ViewMenu method updateState.
public void updateState(HttpPanelSyntaxHighlightTextArea httpPanelTextArea) {
antiAliasingOption.setSelected(httpPanelTextArea.getAntiAliasingEnabled());
boolean selected = false;
boolean enabled = false;
Component c = httpPanelTextArea.getParent();
if (c instanceof JViewport) {
c = c.getParent();
if (c instanceof RTextScrollPane) {
enabled = true;
final RTextScrollPane scrollPane = (RTextScrollPane) c;
selected = scrollPane.getLineNumbersEnabled();
}
}
lineNumbersOption.setVisible(enabled);
lineNumbersOption.setSelected(selected);
wordWrapOption.setSelected(httpPanelTextArea.getLineWrap());
highlightCurrentLineOption.setSelected(httpPanelTextArea.getHighlightCurrentLine());
fadeCurrentHighlightLineOption.setSelected(httpPanelTextArea.getFadeCurrentLineHighlight());
showWhitespacesOption.setSelected(httpPanelTextArea.isWhitespaceVisible());
showNewlinesOption.setSelected(httpPanelTextArea.getEOLMarkersVisible());
markOccurrencesOption.setSelected(httpPanelTextArea.getMarkOccurrences());
roundedSelectionEdgesOption.setSelected(httpPanelTextArea.getRoundedSelectionEdges());
bracketMatchingOption.setSelected(httpPanelTextArea.isBracketMatchingEnabled());
animatedBracketMatchingOption.setSelected(httpPanelTextArea.getAnimateBracketMatching());
}
use of java.awt.Component in project zaproxy by zaproxy.
the class PopupMenuUtils method addSeparatorIfNeeded.
/**
* Appends a separator to the end of the menu if it exists at least one non separator menu component immediately before and
* if there isn't, already, a separator at the end of the menu.
*
* @param popupMenu the pop up menu that will be processed
* @return {@code true} if the separator was added, {@code false} otherwise.
* @see javax.swing.JPopupMenu.Separator
*/
public static boolean addSeparatorIfNeeded(JPopupMenu popupMenu) {
final int menuComponentCount = popupMenu.getComponentCount();
if (menuComponentCount == 0) {
return false;
}
final Component lastMenuComponent = popupMenu.getComponent(menuComponentCount - 1);
if (isPopupMenuSeparator(lastMenuComponent)) {
return false;
}
popupMenu.addSeparator();
return true;
}
Aggregations