/** * getAttributes method * @return CMNamedNodeMap * * Returns CMNamedNodeMap of AttributeDeclaration */ public CMNamedNodeMap getAttributes() { return fElementDecl.getAttributes(); }
public CMNamedNodeMap getAttributes() { if (attributes != null) return attributes; CMElementDeclaration edecl = getSelf(); if (edecl == null) return null; CMElementDeclaration htmlDecl = getBuddy(); CMNamedNodeMap htmlAttrs = (htmlDecl == null) ? null : htmlDecl.getAttributes(); attributes = new Attrs(edecl.getAttributes(), htmlAttrs, isXHTML); return attributes; }
public CMAttributeDeclaration getCMAttributeDeclaration(Attr attr) { CMAttributeDeclaration result = null; Element element = attr.getOwnerElement(); if (element != null) { CMElementDeclaration ed = getCMElementDeclaration(element); if (ed != null) { result = (CMAttributeDeclaration)ed.getAttributes().getNamedItem(attr.getName()); } } return result; } }
/** * @param ele * @return */ public static boolean supportStyleAttribute(IDOMElement ele) { CMElementDeclaration decl = CMUtil.getElementDeclaration(ele); if (decl != null && decl.getAttributes().getNamedItem("style") != null) { return true; } return false; }
private static boolean hasStyleAttribute(IDOMElement ele) { CMElementDeclaration decl = CMUtil.getElementDeclaration(ele); if (decl == null) { return false; } if (decl.getAttributes().getNamedItem("style") != null) { return true; } return false; } }
private static boolean isAttributeAvailable(Element element, String attrName) { ModelQuery modelQuery = ModelQueryUtil.getModelQuery(element.getOwnerDocument()); if (modelQuery != null) { CMElementDeclaration decl = modelQuery.getCMElementDeclaration(element); if (decl != null) { CMNamedNodeMap map = decl.getAttributes(); if ((CMAttributeDeclaration) map.getNamedItem(attrName) != null) { return true; } } } return false; }
/** * Child class should override this method if they have different way for * resizing. e.g. DataWindow use "width/height" attribute, not "style". * Also, the default ResizeCommand will adjust "style", so if child class * override this method, they should also use different command. * * @see org.eclipse.jst.pagedesigner.editpolicies.ElementResizableEditPolicy#getResizeCommand(org.eclipse.gef.requests.ChangeBoundsRequest) */ public boolean isResizable(Element ele) { CMElementDeclaration decl = CMUtil.getElementDeclaration(ele); if (decl != null) { // XXX: default implementation, if this element support "style" // attribute, // then we think it support resize. return decl.getAttributes().getNamedItem("style") != null; } return true; }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
private List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; } }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
public static CMNamedNodeMap getElementDeclaredAttributes(Node fNode) { IStructuredModel structModel = null; if (fNode instanceof IDOMNode) { structModel = ((IDOMNode) fNode).getModel(); } if (null == structModel) { return null; } CMElementDeclaration cmde = null; CMNamedNodeMap cmnnm = null; if (fNode == null || fNode.getNodeType() != Node.ELEMENT_NODE) { cmde = null; } ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fNode .getOwnerDocument()); if (modelQuery != null) { cmde = modelQuery.getCMElementDeclaration((Element) fNode); } if (cmde != null) { cmnnm = cmde.getAttributes(); } return cmnnm; }
protected void generateAttributes(CMElementDeclaration elementDecl, StringBuffer buffer) { CMNamedNodeMap attributes = elementDecl.getAttributes(); if (attributes == null) { return; } for (int i = 0; i < attributes.getLength(); i++) { generateAttribute((CMAttributeDeclaration) attributes.item(i), buffer); } return; }
private boolean isUnknownAttr(IDOMAttr attr, Element target) { CMElementDeclaration dec = CMUtil.getDeclaration(target); if (dec == null) return true; // unknown. CMNamedNodeMap adecls = dec.getAttributes(); CMAttributeDeclaration adec = (CMAttributeDeclaration) adecls.getNamedItem(attr.getName()); return adec == null; }
protected boolean requiresAttributes(CMElementDeclaration ed) { CMNamedNodeMap attributes = ed.getAttributes(); if (attributes == null) { return false; } for (int i = 0; i < attributes.getLength(); i++) { if (((CMAttributeDeclaration) attributes.item(i)).getUsage() == CMAttributeDeclaration.REQUIRED) { return true; } } return false; } }
/** * Retreives CMAttributeDeclaration indicated by attribute name within * elementDecl */ protected CMAttributeDeclaration getCMAttributeDeclaration(CMElementDeclaration elementDecl, String attName) { CMAttributeDeclaration attrDecl = null; if (elementDecl != null) { CMNamedNodeMap attributes = elementDecl.getAttributes(); String noprefixName = DOMNamespaceHelper.getUnprefixedName(attName); if (attributes != null) { attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(noprefixName); if (attrDecl == null) { attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(attName); } } } return attrDecl; }
/** */ protected CMAttributeDeclaration getDeclaration() { ElementImpl element = (ElementImpl) getOwnerElement(); if (element == null) return null; CMElementDeclaration elementDecl = element.getDeclaration(); if (elementDecl == null) return null; CMNamedNodeMap attributes = elementDecl.getAttributes(); if (attributes == null) return null; return (CMAttributeDeclaration) attributes.getNamedItem(getName()); }
public boolean isResizable() { if (!_tagConverter.isVisualByHTML()) { return false; } IElementEdit edit = this.getElementEdit(); if (edit != null) { return edit.isResizable(this._elementNode); } CMElementDeclaration decl = CMUtil .getElementDeclaration(this._elementNode); if (decl != null) { // XXX: default implementation, if this element support "style" // attribute, // then we think it support resize. return decl.getAttributes().getNamedItem("style") != null; } return true; }
public void visitCMElementDeclaration(CMElementDeclaration ed) { CMNamedNodeMap nodeMap = ed.getAttributes(); int size = nodeMap.getLength(); for (int i = 0; i < size; i++) { visitCMNode(nodeMap.item(i)); } visitCMNode(ed.getContent()); visitCMDataType(ed.getDataType()); } }
private void processDirective(IReporter reporter, IFile file, IStructuredModel model, IStructuredDocumentRegion documentRegion) { IndexedRegion ir = model.getIndexedRegion(documentRegion.getStartOffset()); if (ir instanceof IDOMElement) { IDOMElement element = (IDOMElement) ir; ModelQuery query = ModelQueryUtil.getModelQuery(model); if (query != null) { CMElementDeclaration cmElement = query.getCMElementDeclaration(element); if (cmElement != null) { CMNamedNodeMap cmAttributes = cmElement.getAttributes(); boolean foundjspattribute = checkUnknownAttributes(element, cmAttributes, reporter, file, model.getStructuredDocument(), documentRegion); // required attributes could be hidden in jsp regions in // tags, so if jsp regions were detected, do not check for // missing required attributes if (!foundjspattribute) checkRequiredAttributes(element, cmAttributes, reporter, file, model.getStructuredDocument(), documentRegion); } } } }