/** * Remove the highlighting and visible annotations for all property-able objects. * * @param colors True if the highlight colors should be cleared. * @param text True if the ontology concept annotation text should be cleared. * @exception IllegalActionException If getting the resolved concept fails. */ public void clearDisplay(boolean colors, boolean text) throws IllegalActionException { if (colors || text) { // Get the OntologySolver. OntologySolver solver = (OntologySolver) getContainer(); for (Object propertyable : solver.getAllPropertyables()) { if (propertyable instanceof NamedObj) { Concept concept = solver.getConcept(propertyable); if (concept != null || ((NamedObj) propertyable).getAttribute("_showInfo") != null && colors || ((NamedObj) propertyable).getAttribute("_highlightColor") != null && text) { String request = "<group>"; if (((NamedObj) propertyable).getAttribute("_showInfo") != null && text) { request += "<deleteProperty name=\"_showInfo\"/>"; } if (((NamedObj) propertyable).getAttribute("_highlightColor") != null && colors) { request += "<deleteProperty name=\"_highlightColor\"/>"; } request += "</group>"; MoMLChangeRequest change = new MoMLChangeRequest(this, (NamedObj) propertyable, request, false); ((NamedObj) propertyable).requestChange(change); } } } // Force a single repaint after all the above requests have been processed. solver.requestChange(new MoMLChangeRequest(this, solver, "<group/>")); } }
/** * Show all concept values as text annotations on each model element. * * @exception IllegalActionException If getting the resolved concept fails. */ public void showConceptAnnotations() throws IllegalActionException { // Get the PropertySolver. OntologySolver solver = (OntologySolver) getContainer(); for (Object propertyable : solver.getAllPropertyables()) { if (propertyable instanceof NamedObj) { Concept concept = solver.getConcept(propertyable); if (concept != null) { String request = "<property name=\"_showInfo\" class=\"ptolemy.data.expr.StringParameter\" value=\"" + concept.toString() + "\"/>"; MoMLChangeRequest change = new MoMLChangeRequest(this, (NamedObj) propertyable, request, false); ((NamedObj) propertyable).requestChange(change); } } } // Force a single repaint after all the above requests have been processed. solver.requestChange(new MoMLChangeRequest(this, solver, "<group/>")); }
/** * Highlight all property-able objects with the specified colors for their property values. * * @exception IllegalActionException If getting the resolved concept fails. */ public void highlightConcepts() throws IllegalActionException { // Get the PropertySolver. OntologySolver solver = (OntologySolver) getContainer(); highlightConcepts(solver.getAllPropertyables()); }