/** * Popups have a single purpose, to populate the Text fields with valid values, but users can * type those in manually. The following parse functions try to recover the source storage, columns * from the Text fields for quantities. On successful parsing (names and sources local variables are set). * The syntax for File sources is File:<xxxx>:<yyyyy> **/ private boolean parseDomainOrRangeText(JTextField jQtyTextField, boolean isDomain) { String text = jQtyTextField.getText(); // Check for Empty if (text.length()==0) return false; // Check for qualifiers // We need to be forgiving in case the user types in the quantity manually String trimmed = text.trim(); // Split around ": String columnNameList = trimmed; // If file doesn't exist or doesn't have column complain, otherwise // set Storage and Column String[] columns=columnNameList.trim().split(",",-1); if (isDomain){ if (columns.length!=1){ JOptionPane.showMessageDialog(this, "Can't have more than one column for domain"); return false; } else{ setDomainName(columns[0].trim()); return true; // Should check coordinate exists } } else { // range for(int i=0; i<columns.length; i++){ columns[i]=columns[i].trim(); } rangeNames = new String[columns.length]; System.arraycopy(columns, 0, rangeNames, 0, columns.length); // set sourceY here after all error detection is done. return true; } }