/** * Sets the input table whose rows will specify the multiple queries. * * @param tcModel input table */ private void setInputTable(TopcatModel tcModel) { if (tcModel_ != null && tcListener_ != null) { tcModel_.removeTopcatListener(tcListener_); } tcModel_ = tcModel; if (tcModel_ != null && tcListener_ != null) { tcModel_.addTopcatListener(tcListener_); } /* Set the column selectors up to select from the correct table. */ raSelector_.setTable(tcModel); decSelector_.setTable(tcModel); /* For the size selector, jump through some hoops. * Although its value has the same form as for the RA and Dec * selectors (value may be a JEL expression or column name), * in practice it will often be a constant expression, so * making sure that a default constant value is in place should * make it more obvious for users rather than leaving it blank. * Check if the existing value makes sense for the new table; * if it does, leave it, otherwise, set it to a sensible default. */ if (srSelector_.getModel() == null) { srSelector_.setTable(tcModel); service_.setSizeDefault(srSelector_); } else { String txt = srSelector_.getStringValue(); Object conv = srSelector_.getModel().getConverterModel().getSelectedItem(); srSelector_.setTable(tcModel); ComboBoxModel srColModel = srSelector_.getModel().getColumnModel(); assert srColModel instanceof ColumnDataComboBoxModel; if (srColModel instanceof ColumnDataComboBoxModel) { try { ((ColumnDataComboBoxModel) srColModel).stringToColumnData(txt); srSelector_.setStringValue(txt); srSelector_.getModel().getConverterModel().setSelectedItem(conv); } catch (CompilationException e) { service_.setSizeDefault(srSelector_); } } } }