use of cbit.vcell.solver.DataSymbolMetadata in project vcell by virtualcell.
the class ODESolverPlotSpecificationPanel method updateChoices.
/**
* Insert the method's description here.
* Creation date: (2/8/2001 4:56:15 PM)
* @param cbit.vcell.solver.ode.ODESolverResultSet
*/
private synchronized void updateChoices(ODEDataInterface odedi) throws ExpressionException, ObjectNotFoundException {
if (odedi == null) {
return;
}
Object xAxisSelection = getXAxisComboBox_frm().getSelectedItem();
Object[] yAxisSelections = getYAxisChoice().getSelectedValues();
ArrayList<ColumnDescription> variableColumnDescriptions = new ArrayList<ColumnDescription>();
ArrayList<ColumnDescription> sensitivityColumnDescriptions = new ArrayList<ColumnDescription>();
ColumnDescription timeColumnDescription = null;
// find TIME columnDescription
ColumnDescription[] columnDescriptions = odedi.getAllColumnDescriptions();
for (int i = 0; i < columnDescriptions.length; i++) {
if (columnDescriptions[i].getName().equals(ReservedVariable.TIME.getName())) {
timeColumnDescription = columnDescriptions[i];
}
}
// find filtered columnDescriptions
columnDescriptions = odedi.getFilteredColumnDescriptions();
DataSymbolMetadataResolver damdr = odedi.getDataSymbolMetadataResolver();
for (int i = 0; i < columnDescriptions.length; i++) {
ColumnDescription cd = columnDescriptions[i];
// If the column is "_initConnt" generated when using concentration as initial condition, we dont' put the function in list. amended again in August, 2008.
if (cd.getParameterName() == null) {
String name = cd.getName();
DataSymbolMetadata damd = damdr.getDataSymbolMetadata(name);
// filter entities measured as count vs concentration, based on the checkbox settings
ModelCategoryType filterCategory = null;
if (damd != null) {
filterCategory = damd.filterCategory;
}
if (countCheckBox != null && concentrationCheckBox != null) {
if (filterCategory instanceof BioModelCategoryType && filterCategory == BioModelCategoryType.Species && cd.getName().endsWith(AbstractMathMapping.MATH_VAR_SUFFIX_SPECIES_COUNT) && !countCheckBox.isSelected()) {
continue;
} else if (filterCategory instanceof BioModelCategoryType && filterCategory == BioModelCategoryType.Species && !cd.getName().endsWith(AbstractMathMapping.MATH_VAR_SUFFIX_SPECIES_COUNT) && !concentrationCheckBox.isSelected()) {
continue;
}
}
// filter out entities starting with "UnitFactor_" prefix
if (filterCategory instanceof BioModelCategoryType && filterCategory == BioModelCategoryType.Other && cd.getName().startsWith(AbstractMathMapping.PARAMETER_K_UNITFACTOR_PREFIX)) {
continue;
}
if (!cd.getName().equals(SimDataConstants.HISTOGRAM_INDEX_NAME) && !cd.getName().contains(DiffEquMathMapping.MATH_FUNC_SUFFIX_SPECIES_INIT_COUNT)) {
variableColumnDescriptions.add(cd);
}
} else {
sensitivityColumnDescriptions.add(cd);
}
}
sortColumnDescriptions(variableColumnDescriptions);
sortColumnDescriptions(sensitivityColumnDescriptions);
// Hack this here, Later we can use an array utility...
ArrayList<ColumnDescription> sortedColumndDescriptions = new ArrayList<ColumnDescription>();
if (timeColumnDescription != null) {
// add time first
sortedColumndDescriptions.add(timeColumnDescription);
}
boolean bMultiTrialData = odedi.isMultiTrialData();
sortedColumndDescriptions.addAll(variableColumnDescriptions);
if (!bMultiTrialData) {
sortedColumndDescriptions.addAll(sensitivityColumnDescriptions);
}
// finally, update widgets
try {
getXAxisComboBox_frm().removeItemListener(ivjEventHandler);
getYAxisChoice().removeListSelectionListener(ivjEventHandler);
getComboBoxModelX_frm().removeAllElements();
if (!bMultiTrialData) {
// Don't put anything in X Axis, if the results of multiple trials are being displayed.
ArrayList<ColumnDescription> xColumnDescriptions = new ArrayList<ColumnDescription>(Arrays.asList(odedi.getAllColumnDescriptions()));
sortColumnDescriptions(xColumnDescriptions);
if (timeColumnDescription != null) {
getComboBoxModelX_frm().addElement(timeColumnDescription.getName());
}
for (ColumnDescription columnDescription : xColumnDescriptions) {
if (!columnDescription.getName().equals((timeColumnDescription == null ? null : timeColumnDescription.getName()))) {
getComboBoxModelX_frm().addElement(columnDescription.getName());
}
}
}
getDefaultListModelY().removeAllElements();
for (int i = 0; i < sortedColumndDescriptions.size(); i++) {
if (sortedColumndDescriptions.get(i).getName().equals(ReservedVariable.TIME.getName())) {
continue;
}
getDefaultListModelY().addElement(sortedColumndDescriptions.get(i).getName());
}
if (sortedColumndDescriptions.size() > 0) {
// Don't put anything in X Axis, if the results of multifple trials are being displayed.
if (!bMultiTrialData) {
getXAxisComboBox_frm().setSelectedItem(xAxisSelection);
if (getXAxisComboBox_frm().getSelectedIndex() == -1) {
getXAxisComboBox_frm().setSelectedIndex(0);
}
}
if (yAxisSelections != null && yAxisSelections.length > 0) {
ArrayList<Integer> carryoverSelections = new ArrayList<Integer>();
for (int i = 0; i < getYAxisChoice().getModel().getSize(); i++) {
for (int j = 0; j < yAxisSelections.length; j++) {
if (getYAxisChoice().getModel().getElementAt(i).equals(yAxisSelections[j])) {
carryoverSelections.add(i);
break;
}
}
}
if (carryoverSelections.size() > 0) {
int[] carryoverInts = new int[carryoverSelections.size()];
for (int i = 0; i < carryoverInts.length; i++) {
carryoverInts[i] = carryoverSelections.get(i);
}
getYAxisChoice().setSelectedIndices(carryoverInts);
} else {
getYAxisChoice().setSelectedIndex((getYAxisChoice().getModel().getSize() > 1 ? 1 : 0));
}
} else {
getYAxisChoice().setSelectedIndex(sortedColumndDescriptions.size() > 1 ? 1 : 0);
}
}
} finally {
getXAxisComboBox_frm().addItemListener(ivjEventHandler);
getYAxisChoice().addListSelectionListener(ivjEventHandler);
}
regeneratePlot2D();
}
use of cbit.vcell.solver.DataSymbolMetadata in project vcell by virtualcell.
the class PDEPlotControlPanel method initConnections.
/**
* Initializes connections
* @exception java.lang.Exception The exception description.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initConnections() throws java.lang.Exception {
// user code begin {1}
// user code end
getJTextField1().addActionListener(ivjEventHandler);
getJTextField1().addFocusListener(ivjEventHandler);
getDefaultListModelCivilized1().addListDataListener(ivjEventHandler);
getViewFunctionButton().addActionListener(ivjEventHandler);
getPlotVariableJList().setModel(getDefaultListModelCivilized1());
getJSliderTime().getModel().addChangeListener(ivjEventHandler);
getPlotVariableJList().addListSelectionListener(ivjEventHandler);
getPlotVariableJList().setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel c = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (dataInfoProvider == null) {
if (value instanceof DataIdentifier) {
DataIdentifier var = (DataIdentifier) value;
if (var.getVariableType() == VariableType.POSTPROCESSING) {
setToolTipText(getText());
setText(var.getName());
}
}
return this;
}
// System.out.println("rendering object "+value+" of type "+value.getClass());
DataIdentifier var = (DataIdentifier) value;
c.setText(var.getName());
c.setToolTipText("dataInfoProvier not found");
DataSymbolMetadataResolver dataSymbolMetadataResolver = dataInfoProvider.getSimulationModelInfo().getDataSymbolMetadataResolver();
if (dataSymbolMetadataResolver != null && dataSymbolMetadataResolver.getDataSymbolMetadata(var.getName()) != null) {
DataSymbolMetadata dsm = dataSymbolMetadataResolver.getDataSymbolMetadata(var.getName());
String tooltipString = "dataInfoProvider found, but identifier " + var.getName() + " not found";
if (dsm == null) {
tooltipString = "did not find info on variable " + var.getDisplayName();
} else {
c.setText(var.getName() + " [" + dsm.unit + "]");
tooltipString = dsm.tooltipString;
}
c.setToolTipText(tooltipString);
}
return this;
}
});
}
use of cbit.vcell.solver.DataSymbolMetadata in project vcell by virtualcell.
the class ODESolverPlotSpecificationPanel method initConnections.
/**
* Initializes connections
* @exception java.lang.Exception The exception description.
*/
@SuppressWarnings({ "serial", "unchecked" })
private void initConnections() throws java.lang.Exception {
// user code begin {1}
// user code end
getFilterPanel().addPropertyChangeListener(ivjEventHandler);
getYAxisChoice().addListSelectionListener(ivjEventHandler);
this.addPropertyChangeListener(ivjEventHandler);
getXAxisComboBox_frm().addItemListener(ivjEventHandler);
getLogSensCheckbox().addActionListener(ivjEventHandler);
getSensitivityParameterSlider().addChangeListener(ivjEventHandler);
connPtoP1SetTarget();
connPtoP3SetTarget();
getYAxisChoice().setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
ODEDataInterface mdi = getMyDataInterface();
if (mdi == null) {
return this;
}
String varName = (String) value;
ColumnDescription cd = null;
try {
cd = mdi.getColumnDescription(varName);
} catch (ObjectNotFoundException e) {
e.printStackTrace();
}
if (cd instanceof FunctionColumnDescription && ((FunctionColumnDescription) cd).getIsUserDefined()) {
if (function_icon == null) {
function_icon = new ImageIcon(getClass().getResource("/icons/function_icon.png"));
}
setIcon(function_icon);
}
if (mdi.getDataSymbolMetadataResolver() != null && mdi.getDataSymbolMetadataResolver().getDataSymbolMetadata(varName) != null) {
DataSymbolMetadata dsm = mdi.getDataSymbolMetadataResolver().getDataSymbolMetadata(varName);
String tooltipString = dsm.tooltipString;
if (tooltipString == null) {
tooltipString = varName;
}
setToolTipText(tooltipString);
}
return this;
}
});
}
use of cbit.vcell.solver.DataSymbolMetadata in project vcell by virtualcell.
the class ODEDataViewer method updateMetadata.
private void updateMetadata() {
/* Set the target from the source */
if (getOdeSolverResultSet() == null) {
return;
}
final HashMap<String, DataSymbolMetadata> auxDataSymbolMap = new HashMap();
for (ColumnDescription columnDescription : getOdeSolverResultSet().getColumnDescriptions()) {
if (columnDescription.getName().startsWith("sens_") && columnDescription.getName().contains("_wrt_")) {
DataSymbolMetadata dataSymbolMetadata = sensitivityMetaDataParser(columnDescription.getName());
auxDataSymbolMap.put(columnDescription.getName(), dataSymbolMetadata);
}
}
try {
AsynchClientTask filterCategoriesTask = new AsynchClientTask("Calculating Filter...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
if (ODEDataViewer.this.getSimulationModelInfo() != null) {
SimulationModelInfo simulationModelInfo = ODEDataViewer.this.getSimulationModelInfo();
simulationModelInfo.getDataSymbolMetadataResolver().populateDataSymbolMetadata(auxDataSymbolMap);
}
}
};
AsynchClientTask firePropertyChangeTask = new AsynchClientTask("Fire Property Change...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
SimulationModelInfo simulationModelInfo = ODEDataViewer.this.getSimulationModelInfo();
ODEDataInterfaceImpl oDEDataInterfaceImpl = new ODEDataInterfaceImpl(getVcDataIdentifier(), getOdeSolverResultSet(), simulationModelInfo);
getODESolverPlotSpecificationPanel1().setMyDataInterface(oDEDataInterfaceImpl);
// new Thread(new Runnable() {
// @Override
// public void run() {
// while(ClientTaskDispatcher.isBusy()){
// try{Thread.sleep(200);}catch(Exception e){e.printStackTrace();}
// }
// SwingUtilities.invokeLater(new Runnable() {
// @Override
// public void run() {
// ((Window)BeanUtils.findTypeParentOfComponent(ODEDataViewer.this, Window.class)).toFront();
// }
// });
// }
// }).start();
}
};
ClientTaskDispatcher.dispatch(ODEDataViewer.this, new Hashtable<String, Object>(), new AsynchClientTask[] { filterCategoriesTask, firePropertyChangeTask }, false, false, false, null, true);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
use of cbit.vcell.solver.DataSymbolMetadata in project vcell by virtualcell.
the class SimulationWorkspaceModelInfo method addAssignmentRuleParametersToMetaData.
private static void addAssignmentRuleParametersToMetaData(SimulationContext simulationContext, HashMap<String, DataSymbolMetadata> metaDataMap) {
if (metaDataMap != null && simulationContext.getAssignmentRules() != null) {
for (AssignmentRule ar : simulationContext.getAssignmentRules()) {
if (ar.getAssignmentRuleVar() instanceof Model.ModelParameter) {
Model.ModelParameter mp = (Model.ModelParameter) ar.getAssignmentRuleVar();
VCUnitDefinition unit = mp.getUnitDefinition();
String tooltip = "Assignment Rule Variable (ModelParameter), Function";
DataSymbolMetadata dsmd = new DataSymbolMetadata(BioModelCategoryType.Other, unit, tooltip);
metaDataMap.put(mp.getName(), dsmd);
}
}
}
}
Aggregations