/** * Set state depending on property * @param element TestElement * @param propName String property name */ public void setTristateFromProperty(TestElement element,String propName) { JMeterProperty jmp = element.getProperty(propName); if (jmp instanceof NullProperty) { this.setIndeterminate(); } else { this.setSelected(jmp.getBooleanValue()); } }
private JPanel createCloseConnectionPanel() { JLabel label = new JLabel(JMeterUtils.getResString("closeconnection")); // $NON-NLS-1$ closeConnection = new TristateCheckBox("", TCPSampler.CLOSE_CONNECTION_DEFAULT); label.setLabelFor(closeConnection); JPanel closeConnectionPanel = new JPanel(new FlowLayout()); closeConnectionPanel.add(label); closeConnectionPanel.add(closeConnection); return closeConnectionPanel; }
@Override public void stateChanged(ChangeEvent e) { TristateCheckBox.this.setFocusable( getModel().isEnabled()); } }
private void displayState() { super.setSelected(state != TristateState.DESELECTED); if (original) { super.setArmed(state == TristateState.INDETERMINATE); } else { if (state == TristateState.INDETERMINATE) { tristateCheckBox.setIcon(icon); // Needed for all but Nimbus tristateCheckBox.setSelectedIcon(icon); // Nimbus works - after a fashion - with this tristateCheckBox.setDisabledSelectedIcon(icon); // Nimbus works - after a fashion - with this } else { // reset if (tristateCheckBox!= null){ tristateCheckBox.setIcon(null); tristateCheckBox.setSelectedIcon(null); tristateCheckBox.setDisabledSelectedIcon(null); // Nimbus works - after a fashion - with this } } } super.setPressed(state == TristateState.INDETERMINATE); }
private void iterateState() { //Maybe do nothing at all? if (!getModel().isEnabled()) { return; } grabFocus(); // Iterate state getTristateModel().iterateState(); // Fire ActionEvent int modifiers = 0; AWTEvent currentEvent = EventQueue.getCurrentEvent(); if (currentEvent instanceof InputEvent) { modifiers = ((InputEvent) currentEvent).getModifiers(); } else if (currentEvent instanceof ActionEvent) { modifiers = ((ActionEvent) currentEvent).getModifiers(); } fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, getText(), System.currentTimeMillis(), modifiers)); }
/** * Sets a boolean property from a tristate checkbox. * * @param element the test element * @param propName the property name */ public void setPropertyFromTristate(TestElement element, String propName) { if (isIndeterminate()) { element.removeProperty(propName); } else { element.setProperty(propName, isSelected()); } }
/** * Implements JMeterGUIComponent.clearGui */ @Override public void clearGui() { super.clearGui(); serverPanel.clear(); classname.setText(""); //$NON-NLS-1$ requestData.setInitialText(""); //$NON-NLS-1$ reUseConnection.setSelected(true); setNoDelay.setSelected(false); // TODO should this be indeterminate? closeConnection.setSelected(TCPSampler.CLOSE_CONNECTION_DEFAULT); // TODO should this be indeterminate? soLinger.setText(""); //$NON-NLS-1$ eolByte.setText(""); //$NON-NLS-1$ }
public boolean isIndeterminate() { return getTristateModel().isIndeterminate(); }
public void setIndeterminate() { getTristateModel().setIndeterminate(); }
public TristateState getState() { return getTristateModel().getState(); }
private JPanel createNoDelayPanel() { JLabel label = new JLabel(JMeterUtils.getResString("tcp_nodelay")); // $NON-NLS-1$ setNoDelay = new TristateCheckBox(); label.setLabelFor(setNoDelay); JPanel nodelayPanel = new JPanel(new FlowLayout()); nodelayPanel.add(label); nodelayPanel.add(setNoDelay); return nodelayPanel; }