use of javax.swing.JTabbedPane in project ats-framework by Axway.
the class SwingElementLocator method findFixture.
public static ComponentFixture<? extends Component> findFixture(UiElement uiElement) {
SwingDriverInternal driver = (SwingDriverInternal) uiElement.getUiDriver();
ContainerFixture<?> containerFixture = (ContainerFixture<?>) driver.getActiveContainerFixture();
Class<? extends Component> componentClass = componentsMap.get(uiElement.getClass());
try {
if (componentClass.equals(JButton.class)) {
return (ComponentFixture<? extends Component>) new JButtonFixture(containerFixture.robot, (JButton) findElement(uiElement));
} else if (componentClass.equals(JTextComponent.class)) {
return (ComponentFixture<? extends Component>) new JTextComponentFixture(containerFixture.robot, (JTextComponent) findElement(uiElement));
} else if (componentClass.equals(JMenuItem.class)) {
if (uiElement.getElementProperty("path") != null) {
return containerFixture.menuItemWithPath(uiElement.getElementProperty("path").split("[\\,\\/]+"));
} else {
return (ComponentFixture<? extends Component>) new JMenuItemFixture(containerFixture.robot, (JMenuItem) findElement(uiElement));
}
} else if (componentClass.equals(JPopupMenu.class)) {
return (ComponentFixture<? extends Component>) new JPopupMenuFixture(containerFixture.robot, (JPopupMenu) findElement(uiElement));
} else if (componentClass.equals(JTree.class)) {
return (ComponentFixture<? extends Component>) new JTreeFixture(containerFixture.robot, (JTree) findElement(uiElement));
} else if (componentClass.equals(JList.class)) {
return (ComponentFixture<? extends Component>) new JListFixture(containerFixture.robot, (JList) findElement(uiElement));
} else if (componentClass.equals(JCheckBox.class)) {
return (ComponentFixture<? extends Component>) new JCheckBoxFixture(containerFixture.robot, (JCheckBox) findElement(uiElement));
} else if (componentClass.equals(JToggleButton.class)) {
return (ComponentFixture<? extends Component>) new JToggleButtonFixture(containerFixture.robot, (JToggleButton) findElement(uiElement));
} else if (componentClass.equals(JComboBox.class)) {
return (ComponentFixture<? extends Component>) new JComboBoxFixture(containerFixture.robot, (JComboBox) findElement(uiElement));
} else if (componentClass.equals(JRadioButton.class)) {
return (ComponentFixture<? extends Component>) new JRadioButtonFixture(containerFixture.robot, (JRadioButton) findElement(uiElement));
} else if (componentClass.equals(JTable.class)) {
return (ComponentFixture<? extends Component>) new JTableFixture(containerFixture.robot, (JTable) findElement(uiElement));
} else if (componentClass.equals(JSpinner.class)) {
return (ComponentFixture<? extends Component>) new JSpinnerFixture(containerFixture.robot, (JSpinner) findElement(uiElement));
} else if (componentClass.equals(JTabbedPane.class)) {
return (ComponentFixture<? extends Component>) new JTabbedPaneFixture(containerFixture.robot, (JTabbedPane) findElement(uiElement));
} else if (componentClass.equals(JOptionPane.class)) {
return (ComponentFixture<? extends Component>) containerFixture.optionPane();
} else if (componentClass.equals(JLabel.class)) {
return (ComponentFixture<? extends Component>) new JLabelFixture(containerFixture.robot, (JLabel) findElement(uiElement));
} else if (componentClass.equals(Component.class)) {
return new ComponentFixture<Component>(containerFixture.robot, findElement(uiElement)) {
};
} else if (componentClass.equals(JFileChooser.class)) {
// TODO - might be searched by name too
return containerFixture.fileChooser(Timeout.timeout(UiEngineConfigurator.getInstance().getElementStateChangeDelay()));
} else {
throw new ElementNotFoundException(uiElement.toString() + " not found. No such Fixture");
}
} catch (ComponentLookupException cle) {
throw new ElementNotFoundException(uiElement.toString() + " not found.", cle);
} catch (WaitTimedOutError exc) {
// thrown for OptionPane search, wait for Window (BasicRobot.waitForWindow), AbstractJTableCellWriter, JTreeDriver.waitForChildrenToShowUp, each Pause wait
throw new ElementNotFoundException(uiElement.toString() + " not found.", exc);
}
}
use of javax.swing.JTabbedPane in project otapij by FellowTraveler.
the class MainPage method jTabbedPane_MainPageStateChanged.
//GEN-LAST:event_jButton_RegisterNymActionPerformed
private void jTabbedPane_MainPageStateChanged(javax.swing.event.ChangeEvent evt) {
//GEN-FIRST:event_jTabbedPane_MainPageStateChanged
JTabbedPane pane = (JTabbedPane) evt.getSource();
int sel = pane.getSelectedIndex();
System.out.println("Mainpage tab eventState changed:" + sel);
if (sel == 4 && Helpers.isLoadNymTrades()) {
String serverID = "ALL";
String nymID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox5.getSelectedIndex() > -1) {
serverID = ((String[]) serverMap.get((Integer) jComboBox5.getSelectedIndex()))[1];
}
if (nymRegisteredMap != null && nymRegisteredMap.size() > 0 && jComboBox6.getSelectedIndex() > -1) {
nymID = ((String[]) nymRegisteredMap.get((Integer) jComboBox6.getSelectedIndex()))[1];
}
if (!"ALL".equalsIgnoreCase(nymID)) {
Map nymTrades = Market.getNymTrades(serverID, nymID);
if (nymTrades != null) {
((MarketTradesTableModel) jTable16.getModel()).setValue(nymTrades, jTable16);
}
Helpers.setLoadNymTrades(false);
}
}
if (sel == 3 && !isBasketInit) {
initBasketsTab();
isBasketInit = true;
}
if (sel == 4 && !isMarketInit) {
initMarketsTab();
isMarketInit = true;
}
if (sel == 5 && !isPaymentsInit) {
initPaymentsInitTab();
isPaymentsInit = true;
}
}
use of javax.swing.JTabbedPane in project sonarqube by SonarSource.
the class ScannerReportViewerApp method initialize.
/**
* Initialize the contents of the frame.
*/
private void initialize() {
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
splitPane = new JSplitPane();
frame.getContentPane().add(splitPane, BorderLayout.CENTER);
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setPreferredSize(new Dimension(500, 7));
splitPane.setRightComponent(tabbedPane);
componentDetailsTab = new JScrollPane();
tabbedPane.addTab("Component details", null, componentDetailsTab, null);
componentEditor = new JEditorPane();
componentDetailsTab.setViewportView(componentEditor);
sourceTab = new JScrollPane();
tabbedPane.addTab("Source", null, sourceTab, null);
sourceEditor = createSourceEditor();
sourceEditor.setEditable(false);
sourceTab.setViewportView(sourceEditor);
textLineNumber = createTextLineNumber();
sourceTab.setRowHeaderView(textLineNumber);
highlightingTab = new JScrollPane();
tabbedPane.addTab("Highlighting", null, highlightingTab, null);
highlightingEditor = new JEditorPane();
highlightingTab.setViewportView(highlightingEditor);
symbolTab = new JScrollPane();
tabbedPane.addTab("Symbol references", null, symbolTab, null);
symbolEditor = new JEditorPane();
symbolTab.setViewportView(symbolEditor);
coverageTab = new JScrollPane();
tabbedPane.addTab("Coverage", null, coverageTab, null);
coverageEditor = new JEditorPane();
coverageTab.setViewportView(coverageEditor);
duplicationTab = new JScrollPane();
tabbedPane.addTab("Duplications", null, duplicationTab, null);
duplicationEditor = new JEditorPane();
duplicationTab.setViewportView(duplicationEditor);
testsTab = new JScrollPane();
tabbedPane.addTab("Tests", null, testsTab, null);
testsEditor = new JEditorPane();
testsTab.setViewportView(testsEditor);
issuesTab = new JScrollPane();
tabbedPane.addTab("Issues", null, issuesTab, null);
issuesEditor = new JEditorPane();
issuesTab.setViewportView(issuesEditor);
measuresTab = new JScrollPane();
tabbedPane.addTab("Measures", null, measuresTab, null);
measuresEditor = new JEditorPane();
measuresTab.setViewportView(measuresEditor);
scmTab = new JScrollPane();
tabbedPane.addTab("SCM", null, scmTab, null);
scmEditor = new JEditorPane();
scmTab.setViewportView(scmEditor);
treeScrollPane = new JScrollPane();
treeScrollPane.setPreferredSize(new Dimension(200, 400));
splitPane.setLeftComponent(treeScrollPane);
componentTree = new JTree();
componentTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode("empty") {
{
}
}));
treeScrollPane.setViewportView(componentTree);
componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
componentTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();
if (node == null) {
// Nothing is selected.
return;
}
frame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
updateDetails((Component) node.getUserObject());
frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
}
});
frame.pack();
}
use of javax.swing.JTabbedPane in project zaproxy by zaproxy.
the class AbstractPanel method setTabFocus.
public void setTabFocus() {
if (parent != null) {
// Just in case the tab has been hidden
parent.setVisible(this, true);
}
Component c = this.getParent();
if (c instanceof JTabbedPane) {
JTabbedPane tab = (JTabbedPane) c;
tab.setSelectedComponent(this);
}
}
use of javax.swing.JTabbedPane in project zaproxy by zaproxy.
the class AddOnDependencyChecker method confirmUninstallChanges.
/**
* Asks the user for confirmation of uninstall changes.
* <p>
* User will also be warned about add-ons that are being uninstalled which are required by add-ons being downloaded.
*
* @param parent the parent component of the confirmation dialogue
* @param result the calculation result of the uninstallation
* @param addOnsBeingDownloaded the add-ons being downloaded to check if depend on the add-ons being uninstalled
* @return {@code true} if the user accept the changes, {@code false} otherwise
*/
public boolean confirmUninstallChanges(Component parent, UninstallationResult result, Set<AddOn> addOnsBeingDownloaded) {
Set<AddOn> forcedUninstallations = new HashSet<>(result.getUninstallations());
forcedUninstallations.removeAll(result.getSelectedAddOns());
boolean dependencyDownloadFound = false;
for (AddOn addOnDownloading : addOnsBeingDownloaded) {
if (containsAny(addOnDownloading.getIdsAddOnDependencies(), forcedUninstallations)) {
dependencyDownloadFound = true;
break;
}
}
if (!dependencyDownloadFound) {
for (AddOn addOnDownloading : addOnsBeingDownloaded) {
if (containsAny(addOnDownloading.getIdsAddOnDependencies(), result.getSelectedAddOns())) {
dependencyDownloadFound = true;
break;
}
}
}
if (dependencyDownloadFound) {
if (JOptionPane.showConfirmDialog(parent, new Object[] { Constant.messages.getString("cfu.confirmation.dialogue.message.uninstallsRequiredByAddOnsDownloading"), Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUninstallation") }, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
return false;
}
}
if (forcedUninstallations.isEmpty() && result.getExtensions().isEmpty()) {
return JOptionPane.showConfirmDialog(parent, Constant.messages.getString("cfu.uninstall.confirm"), Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
if (result.getExtensions().isEmpty()) {
return JOptionPane.showConfirmDialog(parent, new Object[] { Constant.messages.getString("cfu.uninstall.dependentAddOns.confirm"), createScrollableTable(new AddOnTableModel(forcedUninstallations, false)), Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUninstallation") }, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
if (forcedUninstallations.isEmpty()) {
return JOptionPane.showConfirmDialog(parent, new Object[] { Constant.messages.getString("cfu.uninstall.dependentExtensions.confirm"), createScrollableTable(new ExtensionsTableModel(result.getExtensions())), Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUninstallation") }, Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
JPanel panel = new JPanel(new BorderLayout());
JTabbedPane tabs = new JTabbedPane();
panel.add(tabs);
tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.uninstallations"), createScrollableTable(new AddOnTableModel(forcedUninstallations, false)));
tabs.add(Constant.messages.getString("cfu.confirmation.dialogue.tab.header.extensionUnloads"), createScrollableTable(new ExtensionsTableModel(result.getExtensions())));
List<Object> optionPaneContents = new ArrayList<>();
optionPaneContents.add(Constant.messages.getString("cfu.uninstall.dependentAddonsAndExtensions.confirm"));
optionPaneContents.add(panel);
optionPaneContents.add(Constant.messages.getString("cfu.confirmation.dialogue.message.continueWithUninstallation"));
return JOptionPane.showConfirmDialog(parent, optionPaneContents.toArray(), Constant.PROGRAM_NAME, JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
}
Aggregations