private int getAnnotationPropertyDifference(OWLAnnotationProperty property1, OWLAnnotationProperty property2) { OWLRendererPreferences preferences = OWLRendererPreferences.getInstance(); List<IRI> annotationIRIs = preferences.getAnnotationIRIs(); int index1 = annotationIRIs.indexOf(property1.getIRI()); int index2 = annotationIRIs.indexOf(property2.getIRI()); int diff = 0; if (index1 != -1 && index2 != -1) { diff = index1 - index2; } if (diff != 0) { return diff; } AnnotationPropertyComparator comparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); return comparator.compare(property1, property2); }
private int getAnnotationPropertyDifference(OWLAnnotationProperty property1, OWLAnnotationProperty property2) { OWLRendererPreferences preferences = OWLRendererPreferences.getInstance(); List<IRI> annotationIRIs = preferences.getAnnotationIRIs(); int index1 = annotationIRIs.indexOf(property1.getIRI()); int index2 = annotationIRIs.indexOf(property2.getIRI()); int diff = 0; if (index1 != -1 && index2 != -1) { diff = index1 - index2; } if (diff != 0) { return diff; } AnnotationPropertyComparator comparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); return comparator.compare(property1, property2); }
protected void refill(O root) { List<Object> data = new ArrayList<>(); data.add(header); if (root != null){ List<OWLAnnotation> annotations = new ArrayList<>(root.getAnnotations()); Comparator<OWLObject> owlObjectComparator = editorKit.getOWLModelManager().getOWLObjectComparator(); AnnotationPropertyComparator annotationPropertyComparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); annotations.sort((a1, a2) -> { int propComp = annotationPropertyComparator.compare(a1.getProperty(), a2.getProperty()); if(propComp != 0) { return propComp; } return owlObjectComparator.compare(a1.getValue(), a2.getValue()); }); for (OWLAnnotation annot : annotations){ data.add(new AnnotationsListItem(annot)); } } setListData(data.toArray()); revalidate(); }
protected void refill(O root) { List<Object> data = new ArrayList<>(); data.add(header); if (root != null){ List<OWLAnnotation> annotations = new ArrayList<>(root.getAnnotations()); Comparator<OWLObject> owlObjectComparator = editorKit.getOWLModelManager().getOWLObjectComparator(); AnnotationPropertyComparator annotationPropertyComparator = AnnotationPropertyComparator.withDefaultOrdering(owlObjectComparator); annotations.sort((a1, a2) -> { int propComp = annotationPropertyComparator.compare(a1.getProperty(), a2.getProperty()); if(propComp != 0) { return propComp; } return owlObjectComparator.compare(a1.getValue(), a2.getValue()); }); for (OWLAnnotation annot : annotations){ data.add(new AnnotationsListItem(annot)); } } setListData(data.toArray()); revalidate(); }