/** * * Validate the input got by this dialog and store it in * inputValue. Return true if all is OK. */ public boolean validateInput() { if (textInput.getText().trim().equals("")) { oncotcap.util.OncMessageBox.showWarning( "Please enter a value for " + parameter.getName(), "Invalid Input"); return (false); } return (true); }
public void save() { if (parameter != null) { SingleParameterList pList = parameter.getSingleParameterList(); if (pList.getSize() != 1) { oncotcap.util.OncMessageBox.showWarning( "Warning: Unable to save parameter, incorrect number of primitives. [SingleValueInputDialog]", "Internal Error"); } else { pList.getFirst().setDisplayValue(textInput.getText()); } } }
void setupEntry() { textInput = new JTextField(); if (parameter.getSingleParameterList() != null) textInput.setText(parameter.getSingleParameterList().getFirst().toString()); optionPane = new JOptionPane( prompt(), JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, options, options[0]); setContentPane(optionPane); textInput.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Logger.log("The text entered was " + textInput.getText()); optionPane.setValue("Done"); } }); }