private static final Element getParent(Object node) { if (node instanceof Element) return((Element) node).getParent(); else if (node instanceof Attribute) return((Attribute) node).getParent(); else if (node instanceof Text) return((Text) node).getParent(); else if (node instanceof ProcessingInstruction) return((ProcessingInstruction) node).getParent(); else if (node instanceof Comment) return((Comment) node).getParent(); else if (node instanceof EntityRef) return((EntityRef) node).getParent(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_parent can not be applied on " + node.getClass()); }
@Override Object getParent(Object node) { if (node instanceof Element) { return((Element) node).getParent(); } if (node instanceof Attribute) { return((Attribute) node).getParent(); } if (node instanceof Text) { return((Text) node).getParent(); } if (node instanceof ProcessingInstruction) { return((ProcessingInstruction) node).getParent(); } if (node instanceof Comment) { return((Comment) node).getParent(); } if (node instanceof EntityRef) { return((EntityRef) node).getParent(); } return null; }
public List operate(Object node) { Document doc = null; if (node instanceof Element) doc = ((Element) node).getDocument(); else if (node instanceof Attribute) { Element parent = ((Attribute) node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text) node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Document) doc = (Document) node; else if (node instanceof ProcessingInstruction) doc = ((ProcessingInstruction) node).getDocument(); else if (node instanceof EntityRef) doc = ((EntityRef) node).getDocument(); else if (node instanceof Comment) doc = ((Comment) node).getDocument(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_document can not be applied on " + node.getClass()); return doc == null ? Collections.EMPTY_LIST : Collections.singletonList(doc); } }
@Override Object getDocument(Object node) { if (node instanceof Element) { return ((Element) node).getDocument(); } else if (node instanceof Attribute) { Element parent = ((Attribute) node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text) node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Document) return node; else if (node instanceof ProcessingInstruction) { return ((ProcessingInstruction) node).getDocument(); } else if (node instanceof EntityRef) { return ((EntityRef) node).getDocument(); } else if (node instanceof Comment) { return ((Comment) node).getDocument(); } return null; }
element = (Element)((Text)context).getParent();
parent = ((Text)contextNode).getParent();
Text text = new Text(label.getParent(), SWT.BORDER); text.moveAbove(label); label.dispose(); text.getParent().layout();
/** * Get the parent of the specified node. * @param node to check * @return parent Element */ private static Element nodeParent(Object node) { if (node instanceof Element) { Object parent = ((Element) node).getParent(); return parent instanceof Element ? (Element) parent : null; } if (node instanceof Text) { return (Element) ((Text) node).getParent(); } if (node instanceof CDATA) { return (Element) ((CDATA) node).getParent(); } if (node instanceof ProcessingInstruction) { return (Element) ((ProcessingInstruction) node).getParent(); } if (node instanceof Comment) { return (Element) ((Comment) node).getParent(); } return null; }
private static final Element getParent(Object node) { if (node instanceof Element) return((Element) node).getParent(); else if (node instanceof Attribute) return((Attribute) node).getParent(); else if (node instanceof Text) return((Text) node).getParent(); else if (node instanceof ProcessingInstruction) return((ProcessingInstruction) node).getParent(); else if (node instanceof Comment) return((Comment) node).getParent(); else if (node instanceof EntityRef) return((EntityRef) node).getParent(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_parent can not be applied on " + node.getClass()); }
private static final Element getParent(Object node) { if (node instanceof Element) return((Element)node).getParent(); else if (node instanceof Attribute) return((Attribute)node).getParent(); else if (node instanceof Text) return((Text)node).getParent(); else if (node instanceof ProcessingInstruction) return((ProcessingInstruction)node).getParent(); else if (node instanceof Comment) return((Comment)node).getParent(); else if (node instanceof EntityRef) return((EntityRef)node).getParent(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_parent can not be applied on " + node.getClass()); }
public List operate(Object node) { Document doc = null; if (node instanceof Element) doc = ((Element) node).getDocument(); else if (node instanceof Attribute) { Element parent = ((Attribute) node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text) node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Document) doc = (Document) node; else if (node instanceof ProcessingInstruction) doc = ((ProcessingInstruction) node).getDocument(); else if (node instanceof EntityRef) doc = ((EntityRef) node).getDocument(); else if (node instanceof Comment) doc = ((Comment) node).getDocument(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_document can not be applied on " + node.getClass()); return doc == null ? Collections.EMPTY_LIST : Collections.singletonList(doc); } }
private static final Element getParent(Object node) { if (node instanceof Element) return((Element) node).getParent(); else if (node instanceof Attribute) return((Attribute) node).getParent(); else if (node instanceof Text) return((Text) node).getParent(); else if (node instanceof ProcessingInstruction) return((ProcessingInstruction) node).getParent(); else if (node instanceof Comment) return((Comment) node).getParent(); else if (node instanceof EntityRef) return((EntityRef) node).getParent(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_parent can not be applied on " + node.getClass()); }
Object getParent(Object node) { if (node instanceof Element) { return((Element)node).getParent(); } if (node instanceof Attribute) { return((Attribute)node).getParent(); } if (node instanceof Text) { return((Text)node).getParent(); } if (node instanceof ProcessingInstruction) { return((ProcessingInstruction)node).getParent(); } if (node instanceof Comment) { return((Comment)node).getParent(); } if (node instanceof EntityRef) { return((EntityRef)node).getParent(); } return null; }
@Override Object getParent(Object node) { if (node instanceof Element) { return((Element) node).getParent(); } if (node instanceof Attribute) { return((Attribute) node).getParent(); } if (node instanceof Text) { return((Text) node).getParent(); } if (node instanceof ProcessingInstruction) { return((ProcessingInstruction) node).getParent(); } if (node instanceof Comment) { return((Comment) node).getParent(); } if (node instanceof EntityRef) { return((EntityRef) node).getParent(); } return null; }
@Override Object getParent(Object node) { if (node instanceof Element) { return((Element) node).getParent(); } if (node instanceof Attribute) { return((Attribute) node).getParent(); } if (node instanceof Text) { return((Text) node).getParent(); } if (node instanceof ProcessingInstruction) { return((ProcessingInstruction) node).getParent(); } if (node instanceof Comment) { return((Comment) node).getParent(); } if (node instanceof EntityRef) { return((EntityRef) node).getParent(); } return null; }
public List operate(Object node) { Document doc = null; if (node instanceof Element) doc = ((Element) node).getDocument(); else if (node instanceof Attribute) { Element parent = ((Attribute) node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text) node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Document) doc = (Document) node; else if (node instanceof ProcessingInstruction) doc = ((ProcessingInstruction) node).getDocument(); else if (node instanceof EntityRef) doc = ((EntityRef) node).getDocument(); else if (node instanceof Comment) doc = ((Comment) node).getDocument(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_document can not be applied on " + node.getClass()); return doc == null ? Collections.EMPTY_LIST : Collections.singletonList(doc); } }
@Override Object getDocument(Object node) { if (node instanceof Element) { return ((Element) node).getDocument(); } else if (node instanceof Attribute) { Element parent = ((Attribute) node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text) node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Document) return node; else if (node instanceof ProcessingInstruction) { return ((ProcessingInstruction) node).getDocument(); } else if (node instanceof EntityRef) { return ((EntityRef) node).getDocument(); } else if (node instanceof Comment) { return ((Comment) node).getDocument(); } return null; }
@Override Object getDocument(Object node) { if (node instanceof Element) { return ((Element) node).getDocument(); } else if (node instanceof Attribute) { Element parent = ((Attribute) node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text) node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Document) return node; else if (node instanceof ProcessingInstruction) { return ((ProcessingInstruction) node).getDocument(); } else if (node instanceof EntityRef) { return ((EntityRef) node).getDocument(); } else if (node instanceof Comment) { return ((Comment) node).getDocument(); } return null; }
Object getDocument(Object node) { if (node instanceof Element) { return ((Element)node).getDocument(); } else if (node instanceof Attribute) { Element parent = ((Attribute)node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text)node).getParent(); return parent == null ? null : parent.getDocument(); } else if (node instanceof Document) return node; else if (node instanceof ProcessingInstruction) { return ((ProcessingInstruction)node).getDocument(); } else if (node instanceof EntityRef) { return ((EntityRef)node).getDocument(); } else if (node instanceof Comment) { return ((Comment)node).getDocument(); } return null; }
public List operate(Object node) { Document doc = null; if (node instanceof Element) doc = ((Element)node).getDocument(); else if (node instanceof Attribute) { Element parent = ((Attribute)node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Text) { Element parent = ((Text)node).getParent(); doc = parent == null ? null : parent.getDocument(); } else if (node instanceof Document) doc = (Document)node; else if (node instanceof ProcessingInstruction) doc = ((ProcessingInstruction)node).getDocument(); else if (node instanceof EntityRef) doc = ((EntityRef)node).getDocument(); else if (node instanceof Comment) doc = ((Comment)node).getDocument(); else // With 2.1 semantics it makes more sense to just return a null and let the core // throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR) return null; // throw new TemplateModelException("_document can not be applied on " + node.getClass()); return doc == null ? Collections.EMPTY_LIST : Collections12.singletonList(doc); } }