use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class MolecularTypeTableModel method computeData.
@Override
protected List<MolecularType> computeData() {
if (getModel() == null) {
return new ArrayList<MolecularType>();
}
List<MolecularType> mtList;
if (searchText == null || searchText.length() == 0) {
mtList = new ArrayList<MolecularType>(getModel().getRbmModelContainer().getMolecularTypeList());
} else {
mtList = new ArrayList<MolecularType>();
String lowerCaseSearchText = searchText.toLowerCase();
for (MolecularType mt : getModel().getRbmModelContainer().getMolecularTypeList()) {
boolean bMatchRelationshipObj = false;
HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(mt);
for (RelationshipObject relObj : relObjsHash) {
if (relObj.getBioPaxObject() instanceof Entity) {
if (((Entity) relObj.getBioPaxObject()).getName().get(0).toLowerCase().contains(lowerCaseSearchText)) {
bMatchRelationshipObj = true;
break;
}
}
}
String expression = pattern(mt);
if (expression != null && expression.toLowerCase().contains(lowerCaseSearchText)) {
mtList.add(mt);
}
}
}
return mtList;
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class PhysiologyRelationshipTableModel method setValueAt.
public void setValueAt(Object valueNew, int iRow, int iCol) {
try {
if (valueNew instanceof Boolean && iCol == iColSelected) {
PhysiologyRelationshipTableRow entitySelectionTableRow = getValueAt(iRow);
if ((Boolean) valueNew) {
// if the row is checked, then add the link to relationshipModel
RelationshipObject reObject = new RelationshipObject(bioModelEntityObject, entitySelectionTableRow.getBioPaxObject());
bioModel.getRelationshipModel().addRelationshipObject(reObject);
} else {
// if the row is unchecked and the link is in the relationshipModel,
// then remove the link from the relationshipModel
ArrayList<RelationshipObject> relationshipObjectsToRemove = new ArrayList<RelationshipObject>();
for (RelationshipObject re : bioModel.getRelationshipModel().getRelationshipObjects()) {
if (re.getBioModelEntityObject() == bioModelEntityObject && re.getBioPaxObject() == (entitySelectionTableRow.getBioPaxObject())) {
relationshipObjectsToRemove.add(re);
}
}
for (RelationshipObject re : relationshipObjectsToRemove) {
bioModel.getRelationshipModel().removeRelationshipObject(re);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class PhysiologyRelationshipTableModel method refreshData.
private void refreshData() {
ArrayList<PhysiologyRelationshipTableRow> pathwayObjectList = new ArrayList<PhysiologyRelationshipTableRow>();
if (bioModel != null) {
HashSet<RelationshipObject> relationshipObjects = null;
if (bioModelEntityObject != null) {
relationshipObjects = bioModel.getRelationshipModel().getRelationshipObjects(bioModelEntityObject);
}
List<PhysiologyRelationshipTableRow> allPathwayObjectList = new ArrayList<PhysiologyRelationshipTableRow>();
for (BioPaxObject bpObject1 : bioModel.getPathwayModel().getBiopaxObjects()) {
if ((bpObject1 instanceof PhysicalEntity && (bioModelEntityObject == null || bioModelEntityObject instanceof SpeciesContext)) || (bpObject1 instanceof Conversion && (bioModelEntityObject == null || bioModelEntityObject instanceof ModelProcess)) || (bpObject1 instanceof PhysicalEntity && (bioModelEntityObject == null || bioModelEntityObject instanceof MolecularType))) {
PhysiologyRelationshipTableRow entityRow = new PhysiologyRelationshipTableRow(bpObject1);
if (relationshipObjects != null) {
for (RelationshipObject ro : relationshipObjects) {
if (ro.getBioPaxObject() == entityRow.getBioPaxObject()) {
entityRow.setSelected(true);
break;
}
}
}
if (!bShowLinkOnly || entityRow.selected) {
allPathwayObjectList.add(entityRow);
}
}
}
if (searchText == null || searchText.length() == 0) {
pathwayObjectList.addAll(allPathwayObjectList);
} else {
for (PhysiologyRelationshipTableRow rs : allPathwayObjectList) {
BioPaxObject bpObject = rs.getBioPaxObject();
String lowerCaseSearchText = searchText.toLowerCase();
if (getLabel(bpObject).toLowerCase().contains(lowerCaseSearchText) || getType(bpObject).toLowerCase().contains(lowerCaseSearchText)) {
pathwayObjectList.add(rs);
}
}
}
}
setData(pathwayObjectList);
GuiUtils.flexResizeTableColumns(ownerTable);
}
use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.
the class RelationshipProducer method getXML.
public void getXML(RelationshipModel relationshipModel, Element rootElement, IdentifiableProvider provider) {
relationshipElement = rootElement;
relationshipObjects = (HashSet<RelationshipObject>) (relationshipModel.getRelationshipObjects());
for (RelationshipObject relationshipObject : relationshipObjects) {
if (relationshipObject == null) {
System.out.println("null object!");
break;
}
String className = relationshipObject.getClass().getName().substring(1 + relationshipObject.getClass().getName().lastIndexOf('.'));
if (className.equals(XMLTags.relationshipObjectTag)) {
relationshipElement.addContent(addObjectRelationshipObject(relationshipObject, className, provider));
} else {
showUnexpected(relationshipObject);
}
}
return;
}
Aggregations