use of elemental.util.Mappable in project che by eclipse.
the class AnnotationGroupImpl method getMessages.
@Override
public List<String> getMessages() {
final List<String> result = new ArrayList<>();
final HTMLCollection children = asElemental().getChildren();
for (int i = 0; i < children.length(); i++) {
final Node child = (Node) children.at(i);
if (child instanceof elemental.dom.Element) {
final elemental.dom.Element element = (elemental.dom.Element) child;
final Mappable dataset = element.getDataset();
final String message = getMessage(dataset);
if (message != null) {
result.add(message);
}
}
}
return result;
}
use of elemental.util.Mappable in project che by eclipse.
the class AnnotationGroupImpl method removeAnnotation.
@Override
public final void removeAnnotation(final Annotation annotation, int offset) {
final HTMLCollection children = asElemental().getChildren();
for (int i = 0; i < children.length(); i++) {
final Node child = (Node) children.at(i);
if (child instanceof elemental.dom.Element) {
final elemental.dom.Element element = (elemental.dom.Element) child;
final Mappable dataset = element.getDataset();
if (compareStrings(getMessage(dataset), annotation.getText()) && getOffset(dataset) == offset && getLayer(dataset) == annotation.getLayer() && compareStrings(getType(dataset), annotation.getType())) {
// we may not strictly be on the same annotation instance, but it is not discernible
asElemental().removeChild(element);
updateIconVisibility();
break;
}
}
}
}
use of elemental.util.Mappable in project che by eclipse.
the class AnnotationGroupImpl method updateIconVisibility.
private void updateIconVisibility() {
int maxLayer = 0;
final HTMLCollection children = asElemental().getChildren();
for (int i = 0; i < children.length(); i++) {
final Node child = (Node) children.at(i);
if (child instanceof elemental.dom.Element) {
final elemental.dom.Element element = (elemental.dom.Element) child;
final Mappable dataset = element.getDataset();
final int layer = getLayer(dataset);
if (maxLayer < layer) {
maxLayer = layer;
}
}
}
for (int i = 0; i < children.length(); i++) {
final Node child = (Node) children.at(i);
if (child instanceof elemental.dom.Element) {
final elemental.dom.Element element = (elemental.dom.Element) child;
final Mappable dataset = element.getDataset();
final int layer = getLayer(dataset);
if (layer >= maxLayer) {
element.getStyle().removeProperty("display");
} else {
element.getStyle().setDisplay("none");
}
}
}
}
Aggregations