public boolean isVisibleOnlyGraph() { return graphButtonGroup.isSelected(visibleOnlyRadio.getModel()); }
public static int getSelectedButton(ButtonGroup group) { Enumeration<AbstractButton> enumeration = group.getElements(); int i = 0; while (enumeration.hasMoreElements()) { AbstractButton button = enumeration.nextElement(); if (group.isSelected(button.getModel())) { return i; } i++; } return -1; }
@SuppressWarnings("ResultOfObjectAllocationIgnored") private String getValidationError() { if(localOrRemoteGroup.isSelected(localRadioButton.getModel())) { String localFile = localFileField.getText(); if(!new File(localFile).exists()) {
@Override public void actionPerformed(ActionEvent e) { if(validateFields()) { ConfigurationLoaderDialog.this.setVisible(false); if(finishAction != null) { if(localOrRemoteGroup.isSelected(localRadioButton.getModel())) { finishAction.data(true, localFileField.getText(), "", 1, "", ""); } else { finishAction.data(false, "", hostField.getText(), Integer.parseInt(portField.getText()), new String(passwordField.getPassword()), remoteFileField.getText()); } } } else { JOptionPane.showMessageDialog(ConfigurationLoaderDialog.this, getValidationError(), "Error", JOptionPane.ERROR_MESSAGE); } } });
private void determineRadioButtons() { boolean isLocal = localOrRemoteGroup.isSelected(localRadioButton.getModel()); setEnabledLocal(isLocal); setEnabledRemote(!isLocal); }
/** * Sets the selected state of the button. * * @param b true selects the toggle button, false deselects the toggle button. */ @Override public void setButtonSelected(boolean b) { ButtonGroup group = getGroup(); if (group != null) { // use the group model instead group.setSelected(this, b); b = group.isSelected(this); } if (isButtonSelected() == b) { return; } if (b) { stateMask |= BUTTON_SELECTED; } else { stateMask &= ~BUTTON_SELECTED; } // Send ChangeEvent fireStateChanged(); // Send ItemEvent fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, this, this.isSelected() ? ItemEvent.SELECTED : ItemEvent.DESELECTED)); }
/** * Sets the selected state of the button. * * @param b true selects the toggle button, false deselects the toggle button. */ @Override public void setSelected(boolean b) { ButtonGroup group = getGroup(); if (group != null) { // use the group model instead group.setSelected(this, b); b = group.isSelected(this); } if (isSelected() == b) { return; } if (b) { stateMask |= SELECTED; } else { stateMask &= ~SELECTED; } // Send ChangeEvent fireStateChanged(); // Send ItemEvent fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED, this, this.isSelected() ? ItemEvent.SELECTED : ItemEvent.DESELECTED)); }
@Override public void stateChanged(ChangeEvent e) { SelectionManager selectionManager = VizController.getInstance().getSelectionManager(); if (selectionManager.isBlocked()) { buttonGroup.clearSelection(); } else if (!selectionManager.isSelectionEnabled()) { buttonGroup.clearSelection(); } else if (selectionManager.isDirectMouseSelection()) { if (!buttonGroup.isSelected(mouseButton.getModel())) { buttonGroup.setSelected(mouseButton.getModel(), true); } } } });
/** * Modifies a given TestElement to mirror the data in the gui components. * * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(org.apache.jmeter.testelement.TestElement) */ @Override public void modifyTestElement(TestElement dnsRes) { GuiUtils.stopTableEditing(dnsServersTable); dnsRes.clear(); configureTestElement(dnsRes); if (dnsRes instanceof DNSCacheManager) { DNSCacheManager dnsCacheManager = (DNSCacheManager) dnsRes; for (int i = 0; i < dnsServersTableModel.getRowCount(); i++) { String server = (String) dnsServersTableModel.getRowData(i)[0]; dnsCacheManager.addServer(server); } for (int i = 0; i < dnsHostsTableModel.getRowCount(); i++) { String host = (String) dnsHostsTableModel.getRowData(i)[0]; String addresses = (String) dnsHostsTableModel.getRowData(i)[1]; dnsCacheManager.addHost(host, addresses); } dnsCacheManager.setClearEachIteration(clearEachIteration.isSelected()); if (providerDNSradioGroup.isSelected(custResButton.getModel())) { dnsCacheManager.setCustomResolver(true); } else { dnsCacheManager.setCustomResolver(false); } } }