use of cbit.vcell.math.MathDescription in project vcell by virtualcell.
the class IssuePanel method invokeHyperlink.
private void invokeHyperlink(Issue issue) {
if (selectionManager != null) {
// followHyperlink is no-op if selectionManger null, so no point in proceeding if it is
IssueContext issueContext = issue.getIssueContext();
IssueSource object = issue.getSource();
if (object instanceof DecoratedIssueSource) {
DecoratedIssueSource dis = (DecoratedIssueSource) object;
dis.activateView(selectionManager);
} else if (object instanceof Parameter) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.BIOMODEL_PARAMETERS_NODE, ActiveViewID.parameters_functions), new Object[] { object });
} else if (object instanceof StructureMapping) {
StructureMapping structureMapping = (StructureMapping) object;
StructureMappingNameScope structureMappingNameScope = (StructureMappingNameScope) structureMapping.getNameScope();
SimulationContext simulationContext = ((SimulationContextNameScope) (structureMappingNameScope.getParent())).getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
} else if (object instanceof SpatialObject) {
SpatialObject spatialObject = (SpatialObject) object;
SimulationContext simulationContext = spatialObject.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.spatial_objects), new Object[] { object });
} else if (object instanceof SpatialProcess) {
SpatialProcess spatialProcess = (SpatialProcess) object;
SimulationContext simulationContext = spatialProcess.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.spatial_processes), new Object[] { object });
} else if (object instanceof GeometryContext.UnmappedGeometryClass) {
UnmappedGeometryClass unmappedGeometryClass = (UnmappedGeometryClass) object;
SimulationContext simulationContext = unmappedGeometryClass.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
} else if (object instanceof MicroscopeMeasurement) {
SimulationContext simulationContext = ((MicroscopeMeasurement) object).getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.microscope_measuremments), new Object[] { object });
} else if (object instanceof BioEvent) {
BioEvent be = (BioEvent) object;
SimulationContext simulationContext = be.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.events), new Object[] { object });
} else if (object instanceof OutputFunctionIssueSource) {
SimulationOwner simulationOwner = ((OutputFunctionIssueSource) object).getOutputFunctionContext().getSimulationOwner();
if (simulationOwner instanceof SimulationContext) {
SimulationContext simulationContext = (SimulationContext) simulationOwner;
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SIMULATIONS_NODE, ActiveViewID.output_functions), new Object[] { ((OutputFunctionIssueSource) object).getAnnotatedFunction() });
} else if (simulationOwner instanceof MathModel) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_OUTPUT_FUNCTIONS_NODE, ActiveViewID.math_output_functions), new Object[] { ((OutputFunctionIssueSource) object).getAnnotatedFunction() });
}
} else if (object instanceof Simulation) {
Simulation simulation = (Simulation) object;
SimulationOwner simulationOwner = simulation.getSimulationOwner();
if (simulationOwner instanceof SimulationContext) {
SimulationContext simulationContext = (SimulationContext) simulationOwner;
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SIMULATIONS_NODE, ActiveViewID.simulations), new Object[] { simulation });
} else if (simulationOwner instanceof MathModel) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE, ActiveViewID.math_simulations), new Object[] { simulation });
}
} else if (object instanceof GeometryContext) {
setActiveView(new ActiveView(((GeometryContext) object).getSimulationContext(), DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition));
} else if (object instanceof Structure) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.STRUCTURES_NODE, ActiveViewID.structures), new Object[] { object });
} else if (object instanceof MolecularType) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE, ActiveViewID.structures), new Object[] { object });
} else if (object instanceof ReactionStep) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] { object });
} else if (object instanceof ReactionRule) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] { object });
} else if (object instanceof SpeciesContextSpec) {
SpeciesContextSpec scs = (SpeciesContextSpec) object;
ActiveView av = new ActiveView(scs.getSimulationContext(), DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.species_settings);
followHyperlink(av, new Object[] { object });
} else if (object instanceof ReactionCombo) {
ReactionCombo rc = (ReactionCombo) object;
followHyperlink(new ActiveView(rc.getReactionContext().getSimulationContext(), DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.reaction_setting), new Object[] { ((ReactionCombo) object).getReactionSpec() });
} else if (object instanceof SpeciesContext) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species), new Object[] { object });
} else if (object instanceof RbmObservable) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.OBSERVABLES_NODE, ActiveViewID.observables), new Object[] { object });
} else if (object instanceof MathDescription) {
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE, ActiveViewID.generated_math), new Object[] {object});
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
} else if (object instanceof SpeciesPattern) {
// if (issue.getIssueContext().hasContextType(ContextType.SpeciesContext)){
// SpeciesContext thing = (SpeciesContext)issue.getIssueContext().getContextObject(ContextType.SpeciesContext);
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species), new Object[] {thing});
// }else if(issue.getIssueContext().hasContextType(ContextType.ReactionRule)) {
// ReactionRule thing = (ReactionRule)issue.getIssueContext().getContextObject(ContextType.ReactionRule);
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] {thing});
// }else if(issue.getIssueContext().hasContextType(ContextType.RbmObservable)) {
// RbmObservable thing = (RbmObservable)issue.getIssueContext().getContextObject(ContextType.RbmObservable);
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.OBSERVABLES_NODE, ActiveViewID.observables), new Object[] {thing});
// } else {
System.err.println("SpeciesPattern object missing a proper issue context.");
// }
} else if (object instanceof SimulationContext) {
SimulationContext sc = (SimulationContext) object;
IssueCategory ic = issue.getCategory();
switch(ic) {
case RbmNetworkConstraintsBad:
NetworkConstraints nc = sc.getNetworkConstraints();
if (issue.getMessage() == SimulationContext.IssueInsufficientMolecules) {
NetworkConstraintsEntity nce = new NetworkConstraintsEntity(NetworkConstraintsTableModel.sMaxMoleculesName, NetworkConstraintsTableModel.sValueType, nc.getMaxMoleculesPerSpecies() + "");
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { nce });
} else {
NetworkConstraintsEntity nce = new NetworkConstraintsEntity(NetworkConstraintsTableModel.sMaxIterationName, NetworkConstraintsTableModel.sValueType, nc.getMaxIteration() + "");
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { nce });
}
break;
default:
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { object });
break;
}
} else if (object instanceof Geometry) {
if (issueContext.hasContextType(ContextType.SimContext)) {
SimulationContext simContext = (SimulationContext) issueContext.getContextObject(ContextType.SimContext);
followHyperlink(new ActiveView(simContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition), new Object[] { object });
} else if (issueContext.hasContextType(ContextType.MathModel)) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_GEOMETRY_NODE, ActiveViewID.math_geometry), new Object[] { object });
} else if (issueContext.hasContextType(ContextType.MathDescription)) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition), new Object[] { object });
}
} else {
System.err.println("unknown object type in IssuePanel.invokeHyperlink(): " + object.getClass() + ", context type: " + issueContext.getContextType());
}
}
}
use of cbit.vcell.math.MathDescription in project vcell by virtualcell.
the class CheckBeforeDelete method checkLostResults.
/**
* Insert the method's description here.
* Creation date: (6/1/2004 3:44:03 PM)
* @return cbit.vcell.solver.SolverResultSetInfo[]
* @param mathmodel cbit.vcell.mathmodel.Mathmodel
*/
private Simulation[] checkLostResults(MathModel oldMathmodel, MathModel newlySavedMathmodel, cbit.vcell.clientdb.DocumentManager documentManager, Simulation[] submittedSimulations) throws Exception {
//
// before deleting old version, prompt user if old simulation results will not be availlable in new edition
//
Vector<Simulation> lostResultsSimulationList = new Vector<Simulation>();
Simulation[] oldSimulations = oldMathmodel.getSimulations();
for (int i = 0; i < oldSimulations.length; i++) {
Simulation oldSimulation = oldSimulations[i];
// SolverResultSetInfo rsInfo = null;
SimulationStatus simStatus = null;
SimulationInfo oldSimInfo = oldSimulation.getSimulationInfo();
if (oldSimInfo != null) {
//
// we need to ask for previous sim results (here we need possible translation to ask for parent's results).
//
simStatus = documentManager.getServerSimulationStatus(oldSimInfo.getAuthoritativeVCSimulationIdentifier());
}
if (simStatus != null && simStatus.getHasData()) {
//
// results exist in old version (the Mathmodel to be deleted) for SimulationInfo "oldSimInfo"
// Users should be warned when they are going to loose any simulation results in any unexpected way.
//
// WARN if the lost data is because new simulation is not mathematically equivalent to old edition
// (different MathDescription key)
//
// IGNORE if the lost data is from edits of a Simulation only (same MathDescription)
// (same MathDescription key, different Simulation key)
//
// IGNORE if Simulation has been deleted
// (Simulation not found in current Mathmodel)
//
// IGNORE if Simulation has been submitted for running
//
boolean bDataInNewEdition = false;
Simulation[] newSimulations = newlySavedMathmodel.getSimulations();
Simulation correspondingSimulation = null;
for (int j = 0; j < newSimulations.length; j++) {
if (newSimulations[j].getName().equals(oldSimulation.getName())) {
correspondingSimulation = newSimulations[j];
if (correspondingSimulation.getKey().equals(oldSimulation.getKey())) {
//
// exactly same simulation (same key), so no lost data
//
bDataInNewEdition = true;
} else if (correspondingSimulation.getSimulationVersion().getParentSimulationReference() != null) {
//
// new simulation changed but points to same results
//
bDataInNewEdition = true;
}
break;
}
}
if (!bDataInNewEdition && correspondingSimulation != null) {
//
// result set (for "rsInfo") will be lost, should we ignore this fact?
//
boolean bIgnore = false;
//
// ignore if only Simulation has been edited (same MathDescription)
//
MathDescription mdCorr = correspondingSimulation.getMathDescription();
MathDescription mdOld = oldSimulation.getMathDescription();
if (mdCorr.getKey().equals(mdOld.getKey())) {
bIgnore = true;
}
//
for (int j = 0; submittedSimulations != null && j < submittedSimulations.length; j++) {
if (correspondingSimulation.getName().equals(submittedSimulations[j].getName())) {
bIgnore = true;
}
}
//
if (!bIgnore) {
lostResultsSimulationList.add(correspondingSimulation);
}
}
}
}
return (Simulation[]) BeanUtils.getArray(lostResultsSimulationList, Simulation.class);
}
use of cbit.vcell.math.MathDescription in project vcell by virtualcell.
the class RunSims method isSmoldynTimeStepOK.
private boolean isSmoldynTimeStepOK(Simulation sim) {
for (int jobIndex = 0; jobIndex < sim.getScanCount(); jobIndex++) {
SimulationSymbolTable simSymbolTable = new SimulationSymbolTable(sim, jobIndex);
double Dmax = 0;
MathDescription mathDesc = sim.getMathDescription();
Enumeration<SubDomain> subDomainEnumeration = mathDesc.getSubDomains();
while (subDomainEnumeration.hasMoreElements()) {
SubDomain subDomain = subDomainEnumeration.nextElement();
// }
for (ParticleProperties particleProperties : subDomain.getParticleProperties()) {
try {
Expression newExp = new Expression(particleProperties.getDiffusion());
newExp.bindExpression(simSymbolTable);
newExp = simSymbolTable.substituteFunctions(newExp).flatten();
try {
double diffConstant = newExp.evaluateConstant();
Dmax = Math.max(Dmax, diffConstant);
} catch (ExpressionException ex) {
throw new ExpressionException("diffusion coefficient for variable " + particleProperties.getVariable().getQualifiedName() + " is not a constant. Constants are required for all diffusion coefficients");
}
} catch (Exception ex) {
}
}
}
double s = sim.getMeshSpecification().getDx(sim.hasCellCenteredMesh());
double dt = sim.getSolverTaskDescription().getTimeStep().getDefaultTimeStep();
if (dt >= s * s / (2 * Dmax)) {
smoldynTimestepVars = new SmoldynTimeStepVars(s, Dmax);
return false;
}
}
return true;
}
use of cbit.vcell.math.MathDescription in project vcell by virtualcell.
the class SetMathDescription method run.
/**
* Insert the method's description here.
* Creation date: (5/31/2004 6:04:14 PM)
* @param hashTable java.util.Hashtable
* @param clientWorker cbit.vcell.desktop.controls.ClientWorker
*/
public void run(Hashtable<String, Object> hashTable) throws java.lang.Exception {
DocumentWindowManager documentWindowManager = (DocumentWindowManager) hashTable.get(CommonTask.DOCUMENT_WINDOW_MANAGER.name);
if (documentWindowManager.getVCDocument() instanceof BioModel) {
// try to successfully generate math and geometry region info
BioModel bioModel = (BioModel) documentWindowManager.getVCDocument();
SimulationContext[] scArray = bioModel.getSimulationContexts();
MathDescription[] mathDescArray = (MathDescription[]) hashTable.get("mathDescArray");
if (scArray != null && mathDescArray != null) {
for (int i = 0; i < scArray.length; i++) {
scArray[i].setMathDescription(mathDescArray[i]);
}
}
}
}
use of cbit.vcell.math.MathDescription in project vcell by virtualcell.
the class VCellBasicCellRenderer method getTreeCellRendererComponent.
/**
* Insert the method's description here.
* Creation date: (7/27/2000 6:41:57 PM)
* @return java.awt.Component
*/
public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
JLabel component = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
//
if (!leaf && expanded) {
setIcon(fieldFolderOpenIcon);
} else if (!leaf && !expanded) {
setIcon(fieldFolderClosedIcon);
}
try {
if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
boolean bLoaded = false;
//
// Check if node is a SolverResultSetInfo
//
Object userObject = node.getUserObject();
if (userObject instanceof SimulationInfo) {
//
// Check if node is a SimulationInfo
//
setComponentProperties(component, (SimulationInfo) userObject);
int maxErrorLevel = getMaxErrorLevel(node);
if (maxErrorLevel == BioModelNode.ERROR_POSSIBLE) {
setIcon(fieldSimulationWarningIcon);
component.setToolTipText("Simulation contains possibly invalid results");
} else if (maxErrorLevel == BioModelNode.ERROR_CONFIRMED) {
setIcon(fieldSimulationErrorIcon);
component.setToolTipText("Simulation contains invalid results");
}
} else if (userObject instanceof String && node.getChildCount() == 0) {
component.setToolTipText(null);
component.setText((String) userObject);
} else if (userObject instanceof BioModelInfo) {
//
// Check if node is a BioModelInfo
//
setComponentProperties(component, (BioModelInfo) userObject);
bLoaded = isLoaded((BioModelInfo) userObject);
int maxErrorLevel = getMaxErrorLevel(node);
if (maxErrorLevel == BioModelNode.ERROR_POSSIBLE) {
setIcon(fieldBioModelWarningIcon);
component.setToolTipText("BioModel version: Has possibly invalid simulation results");
} else if (maxErrorLevel == BioModelNode.ERROR_CONFIRMED) {
setIcon(fieldBioModelErrorIcon);
component.setToolTipText("BioModel version: Has invalid simulation results");
}
} else if (userObject instanceof String && node.getChildCount() > 0 && ((BioModelNode) node.getChildAt(0)).getUserObject() instanceof BioModelInfo) {
//
// Check if node is a BioModelName (String), with children (at least one version of biomodel), and if the child is a
// BioModelInfo node
//
String label = (String) userObject;
component.setToolTipText("BioModel");
component.setText(label);
//
// check if child is loaded
//
int maxErrorLevel = BioModelNode.ERROR_NONE;
for (int i = 0; i < node.getChildCount(); i++) {
maxErrorLevel = Math.max(maxErrorLevel, getMaxErrorLevel((BioModelNode) node.getChildAt(i)));
}
if (maxErrorLevel == BioModelNode.ERROR_POSSIBLE) {
if (!leaf && expanded) {
setIcon(fieldFolderOpenWarningIcon);
} else if (!leaf && !expanded) {
setIcon(fieldFolderClosedWarningIcon);
}
component.setToolTipText("BioModel: one or more versions may have invalid simulation results");
} else if (maxErrorLevel == BioModelNode.ERROR_CONFIRMED) {
if (!leaf && expanded) {
setIcon(fieldFolderOpenErrorIcon);
} else if (!leaf && !expanded) {
setIcon(fieldFolderClosedErrorIcon);
}
component.setToolTipText("BioModel: one or more versions have invalid simulation results");
}
//
for (int i = 0; i < node.getChildCount(); i++) {
BioModelInfo bioModelInfo = (BioModelInfo) ((BioModelNode) node.getChildAt(i)).getUserObject();
if (isLoaded(bioModelInfo)) {
bLoaded = true;
}
}
} else if (userObject instanceof User && node.getChildCount() > 0 && (((BioModelNode) node.getChildAt(0)).getUserObject() instanceof String) && ((BioModelNode) (node.getChildAt(0).getChildAt(0))).getUserObject() instanceof BioModelInfo) {
//
// Check if node is a User, with at least one child which is a string (BioModel name)
// and if the child's child is a BioModelInfo node
//
String label = ((User) userObject).getName();
component.setToolTipText("User Name");
component.setText(label);
if (isLoaded((User) userObject)) {
bLoaded = true;
}
} else if (userObject instanceof MathModelInfo) {
//
// Check if node is a MathModelInfo node
//
setComponentProperties(component, (MathModelInfo) userObject);
bLoaded = isLoaded((MathModelInfo) userObject);
} else if (userObject instanceof String && node.getChildCount() > 0 && ((BioModelNode) node.getChildAt(0)).getUserObject() instanceof MathModelInfo) {
//
// Check if node is a MathModel name (String), with children (at least one version of mathmodel), and
// if the child is a MathModelInfo node
//
String label = (String) userObject;
component.setToolTipText("Mathematical Model");
component.setText(label);
//
for (int i = 0; i < node.getChildCount(); i++) {
MathModelInfo mathModelInfo = (MathModelInfo) ((BioModelNode) node.getChildAt(i)).getUserObject();
if (isLoaded(mathModelInfo)) {
bLoaded = true;
}
}
} else if (userObject instanceof User && node.getChildCount() > 0 && (((BioModelNode) node.getChildAt(0)).getUserObject() instanceof String) && ((BioModelNode) (node.getChildAt(0).getChildAt(0))).getUserObject() instanceof MathModelInfo) {
//
// Check if node is a User, with at least one child which is a string (Mathmodel name)
// and if the child's child is a MathModelInfo node
//
String label = ((User) userObject).getName();
component.setToolTipText("User Name");
component.setText(label);
if (isLoaded((User) userObject)) {
bLoaded = true;
}
} else if (userObject instanceof cbit.vcell.geometry.GeometryInfo) {
//
// Check if node is a GeometryInfo
//
setComponentProperties(component, (GeometryInfo) userObject);
bLoaded = isLoaded((GeometryInfo) userObject);
} else if (userObject instanceof String && node.getChildCount() > 0 && ((BioModelNode) node.getChildAt(0)).getUserObject() instanceof GeometryInfo) {
//
// Check if node is a Geometry name (String), with children (at least one version of Geometry), and
// if the child is a GeometryInfo node
//
String label = (String) userObject;
component.setToolTipText("Geometry");
component.setText(label);
//
for (int i = 0; i < node.getChildCount(); i++) {
GeometryInfo geometryInfo = (GeometryInfo) ((BioModelNode) node.getChildAt(i)).getUserObject();
if (isLoaded(geometryInfo)) {
bLoaded = true;
}
}
} else if (userObject instanceof User && node.getChildCount() > 0 && (((BioModelNode) node.getChildAt(0)).getUserObject() instanceof String) && ((BioModelNode) (node.getChildAt(0).getChildAt(0))).getUserObject() instanceof GeometryInfo) {
//
// Check if node is a User, with at least one child which is a string (Geometry name)
// and if the child's child is a GeometryInfo node
//
String label = ((User) userObject).getName();
component.setToolTipText("User Name");
component.setText(label);
if (isLoaded((User) userObject)) {
bLoaded = true;
}
} else if (userObject instanceof String && node.getChildCount() > 0) {
component.setToolTipText(null);
component.setText((String) userObject);
// }else if (node.getUserObject() instanceof MathInfo) {
// setComponentProperties(component,(MathInfo)node.getUserObject());
} else if (userObject instanceof VCImageInfo) {
setComponentProperties(component, (VCImageInfo) userObject);
} else if (userObject instanceof Extent) {
setComponentProperties(component, (Extent) userObject);
} else if (userObject instanceof Annotation) {
setComponentProperties(component, (Annotation) userObject);
} else if (userObject instanceof MathModel) {
setComponentProperties(component, (MathModel) userObject);
} else if (userObject instanceof BioModel) {
setComponentProperties(component, (BioModel) userObject);
} else if (userObject instanceof SimulationContext) {
setComponentProperties(component, (SimulationContext) userObject);
bLoaded = isLoaded((SimulationContext) userObject);
} else if (userObject instanceof Simulation) {
setComponentProperties(component, (Simulation) userObject);
} else if (userObject instanceof MathDescription) {
setComponentProperties(component, (MathDescription) userObject);
} else if (userObject instanceof Geometry) {
setComponentProperties(component, (Geometry) userObject);
} else if (userObject instanceof User) {
setComponentProperties(component, (User) userObject);
} else {
setComponentProperties(component, userObject);
}
if (selectedFont == null && component.getFont() != null) {
selectedFont = component.getFont().deriveFont(Font.BOLD);
}
if (unselectedFont == null && component.getFont() != null) {
unselectedFont = component.getFont().deriveFont(Font.PLAIN);
}
if (bLoaded) {
component.setFont(selectedFont);
} else {
component.setFont(unselectedFont);
}
}
} catch (Throwable e) {
e.printStackTrace(System.out);
}
//
return component;
}
Aggregations