当前位置: 首页>>代码示例>>Java>>正文


Java Element类代码示例

本文整理汇总了Java中org.dom4j.Element的典型用法代码示例。如果您正苦于以下问题:Java Element类的具体用法?Java Element怎么用?Java Element使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Element类属于org.dom4j包,在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMultiBoxLabel

import org.dom4j.Element; //导入依赖的package包/类
/**
 *  Create label for a mulitBoxLabel element that will collapse the mulitBox
 *  input.<P>
 *
 *  Based on getComplexTypeLabel, but will always display collapse widget,
 *  rather than first testing for nodeIsExpandable as getComplexTypeLabel does.
 *  <P>
 *
 *  Depends on the multibox input having an id and display style initialized to
 *  value of collapseBean.displayState.
 *
 * @param  xpath  NOT YET DOCUMENTED
 * @return        The multiBoxLabel value
 */
public Label getMultiBoxLabel(String xpath) {
	ComplexTypeLabel labelObj = getComplexTypeLabel(xpath);
	Element alwaysExpandable = df.createElement("c__if")
		.addAttribute("test", "${true}");
	Element labelLink = alwaysExpandable.addElement("a")
		.addAttribute("href", "javascript__toggleDisplayState(" + RendererHelper.jspQuotedString("${id}") + ");");

	Element notExpandableTest = df.createElement("c__if")
		.addAttribute("test", "${false}");

	labelObj.isExpandableTest = alwaysExpandable.createCopy();
	labelObj.notExpandableTest = notExpandableTest.createCopy();
	labelObj.collapseWidget = getCollapseWidget().createCopy();
	return labelObj;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:30,代码来源:EditorRenderer.java

示例2: getRequiredMultiSelectControl

import org.dom4j.Element; //导入依赖的package包/类
/**
 *  Create "choose" controller for the case where an empty requiredMultiSelect
 *  node is closed. Called from renderComplexTypeConcrete, this controller
 *  provides a prompt for user when the required multiselect boxes are empty
 *  and not visible
 *
 * @return    The requiredMultiSelectControl value
 */
public Element getRequiredMultiSelectControl() {

	Element actionElement = df.createElement("span")
		.addAttribute("class", "action-button");

	// test to see if child node (the multiSelect) is empty
	Element isEmptyTest = actionElement.addElement("logic__equal")
		.addAttribute("name", formBeanName)
		.addAttribute("property", "nodeIsEmpty(" + xpath + ")")
		.addAttribute("value", "true");

	// test to see if the node is closed
	Element isOpenTest = isEmptyTest.addElement("c__if")
		.addAttribute("test", "${not " + formBeanName + ".collapseBean.isOpen}");

	//  "choose" controller link that toogles DisplayState of node
	Element chooseController = isOpenTest.addElement("a")
		.addAttribute("href", "javascript__toggleDisplayState(" + RendererHelper.jspQuotedString("${id}") + ")");
	chooseController.setText("choose");

	return actionElement;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:31,代码来源:MdeComplexType.java

示例3: readXML

import org.dom4j.Element; //导入依赖的package包/类
/**
 * 摸查项目输出目录
 * <p>
 * @param projectPath
 * @param kind        output 或 src
 * @return
 */
public static String readXML(String projectPath, String kind) {
    try {
        SAXReader saxReader = new SAXReader();
        File classpath = new File(projectPath + "/.classpath");
        if (classpath.exists()) {
            Document document = saxReader.read(classpath);
            List<Element> out = (List<Element>) document.selectNodes("/classpath/classpathentry[@kind='" + kind + "']");
            String tmp = "";
            for (Element out1 : out) {
                String combineaccessrules = out1.attributeValue("combineaccessrules");
                if ("false".equals(combineaccessrules) && "src".equals(kind)) {
                    continue;
                }
                tmp += out1.attributeValue("path") + ",";
            }
            return tmp.isEmpty() ? tmp : tmp.substring(0, tmp.length() - 1);
        }
    } catch (DocumentException ex) {
        MainFrame.LOGGER.log(Level.SEVERE, null, ex);
        JOptionPane.showMessageDialog(null, ex.getLocalizedMessage());
    }
    return "";
}
 
开发者ID:ajtdnyy,项目名称:PackagePlugin,代码行数:31,代码来源:FileUtil.java

示例4: buildValidatorElement

import org.dom4j.Element; //导入依赖的package包/类
private Element buildValidatorElement(Validator validator){
	BaseElement element=new BaseElement("Validator");
	int pos=validator.getName().lastIndexOf("Validator");
	String validatorType=validator.getName().substring(0,pos);
	validatorType=validatorType.substring(0,1).toLowerCase()+validatorType.substring(1,validatorType.length());
	element.addAttribute("type",validatorType);
	if(validator.getProperties()!=null){
		for(ValidatorProperty vp:validator.getProperties()){
			if(StringHelper.isNotEmpty(vp.getName()) && StringHelper.isNotEmpty(vp.getValue())){
				Element propertyElement=createPropertyElement(vp.getName(),vp.getValue());
				element.add(propertyElement);					
			}
		}
	}
	return element;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:17,代码来源:ModelBuilder.java

示例5: getNamedStoredProcedureQueries

import org.dom4j.Element; //导入依赖的package包/类
private NamedStoredProcedureQueries getNamedStoredProcedureQueries(Element tree, XMLContext.Default defaults) {
	List<NamedStoredProcedureQuery> queries = buildNamedStoreProcedureQueries( tree, defaults );
	if ( defaults.canUseJavaAnnotations() ) {
		NamedStoredProcedureQuery annotation = getPhysicalAnnotation( NamedStoredProcedureQuery.class );
		addNamedStoredProcedureQueryIfNeeded( annotation, queries );
		NamedStoredProcedureQueries annotations = getPhysicalAnnotation( NamedStoredProcedureQueries.class );
		if ( annotations != null ) {
			for ( NamedStoredProcedureQuery current : annotations.value() ) {
				addNamedStoredProcedureQueryIfNeeded( current, queries );
			}
		}
	}
	if ( queries.size() > 0 ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( NamedStoredProcedureQueries.class );
		ad.setValue( "value", queries.toArray( new NamedStoredProcedureQuery[queries.size()] ) );
		return AnnotationFactory.create( ad );
	}
	else {
		return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:JPAOverriddenAnnotationReader.java

示例6: insertHtmlComment

import org.dom4j.Element; //导入依赖的package包/类
/**
 *  Insert an HTML comment into the html source.
 *
 * @param  e  NOT YET DOCUMENTED
 * @param  s  NOT YET DOCUMENTED
 */
protected void insertHtmlComment(Element e, String s) {
	prtln("\ninsertHtmlComment()");
	Element comment = df.createElement("st__htmlComment");
	comment.setText(s);
	Element parent = e.getParent();

	if (parent != null) {
		List children = parent.elements();
		int index = children.indexOf(e);
		children.add(index, comment);
	}
	else {
		// prtlnErr("PARENT NOT FOUND");
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:22,代码来源:MdeNode.java

示例7: fillDataSetAndDataPathProperty

import org.dom4j.Element; //导入依赖的package包/类
protected void fillDataSetAndDataPathProperty(Element element,ComponentInfo component,boolean isCollection){
	String[] dataSetDataPath=this.retriveDataSetAndDataPath(component);
	if(dataSetDataPath!=null){
		if(StringHelper.isNotEmpty(dataSetDataPath[0])){
			BaseElement dataSetElement=new BaseElement("Property");	
			dataSetElement.addAttribute("name", "dataSet");
			dataSetElement.setText(dataSetDataPath[0]);
			element.add(dataSetElement);
		}
		if(StringHelper.isNotEmpty(dataSetDataPath[1]) && !hasDataPath(component)){
			BaseElement dataPathElement=new BaseElement("Property");
			dataPathElement.addAttribute("name", "dataPath");
			String dataPath=dataSetDataPath[1];
			if(!isCollection){
				int pos=dataPath.lastIndexOf(".");
				if(pos>0){
					dataPath=dataPath.substring(0,pos)+".#"+dataPath.substring(pos+1,dataPath.length());
				}					
			}
			
			dataPathElement.setText(dataPath);
			element.add(dataPathElement);
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:26,代码来源:AbstractConverter.java

示例8: createReferencePropertyDef

import org.dom4j.Element; //导入依赖的package包/类
private Element createReferencePropertyDef(Entity entity,RuleSet ruleSet,boolean isSelf){
	String nodeName=Reference.class.getSimpleName();
	Rule rule=ruleSet.getRule(nodeName);
	Element referenceDefElement=new BaseElement(rule.getNodeName());
	referenceDefElement.addAttribute("name", entity.getName());
	//创建dataType与dataProvider属性
	Element dataTypeElement=createPropertyElement("dataType",null);
	if(isSelf){
		dataTypeElement.setText("[SELF]");			
	}else{
		dataTypeElement.setText("["+ entity.getName()+"]");						
	}
	referenceDefElement.add(dataTypeElement);
	String entityName=entity.getName();
	Element dataProviderElement=createPropertyElement("dataProvider","dataProvider"+entityName.substring(0,1).toUpperCase()+entityName.substring(1,entityName.length()));
	if(entity.getPageSize()>0){
		Element pageSizeElement=createPropertyElement("pageSize",String.valueOf(entity.getPageSize()));
		referenceDefElement.add(pageSizeElement);
	}
	referenceDefElement.add(dataProviderElement);
	referenceDefElement.add(createReferenceParameterElement(entity));
	return referenceDefElement;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:24,代码来源:ModelBuilder.java

示例9: parseFilterDef

import org.dom4j.Element; //导入依赖的package包/类
private static void parseFilterDef(Element element, Mappings mappings) {
	String name = element.attributeValue( "name" );
	LOG.debugf( "Parsing filter-def [%s]", name );
	String defaultCondition = element.getTextTrim();
	if ( StringHelper.isEmpty( defaultCondition ) ) {
		defaultCondition = element.attributeValue( "condition" );
	}
	HashMap paramMappings = new HashMap();
	Iterator params = element.elementIterator( "filter-param" );
	while ( params.hasNext() ) {
		final Element param = (Element) params.next();
		final String paramName = param.attributeValue( "name" );
		final String paramType = param.attributeValue( "type" );
		LOG.debugf( "Adding filter parameter : %s -> %s", paramName, paramType );
		final Type heuristicType = mappings.getTypeResolver().heuristicType( paramType );
		LOG.debugf( "Parameter heuristic type : %s", heuristicType );
		paramMappings.put( paramName, heuristicType );
	}
	LOG.debugf( "Parsed filter-def [%s]", name );
	FilterDefinition def = new FilterDefinition( name, defaultCondition, paramMappings );
	mappings.addFilterDefinition( def );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:HbmBinder.java

示例10: parse

import org.dom4j.Element; //导入依赖的package包/类
public Object parse(Element element, long processId, boolean parseChildren) {
	ForeachNode node=new ForeachNode();
	node.setProcessId(processId);
	parseNodeCommonInfo(element, node);
	node.setSequenceFlows(parseFlowElement(element,processId,parseChildren));
	String type=element.attributeValue("foreach-type");
	if(StringUtils.isNotEmpty(type)){
		node.setForeachType(ForeachType.valueOf(type));			
	}
	node.setVariable(unescape(element.attributeValue("var")));
	if(StringUtils.isNotBlank(element.attributeValue("process-variable"))){
		node.setProcessVariable(unescape(element.attributeValue("process-variable")));			
	}else{
		node.setProcessVariable(unescape(element.attributeValue("in")));						
	}
	node.setHandlerBean(unescape(element.attributeValue("handler-bean")));
	NodeDiagram diagram=parseDiagram(element);
	diagram.setIcon("/icons/foreach.svg");
	diagram.setShapeType(ShapeType.Circle);
	diagram.setBorderWidth(1);
	node.setDiagram(diagram);
	return node;
}
 
开发者ID:youseries,项目名称:uflo,代码行数:24,代码来源:ForeachParser.java

示例11: elementValue

import org.dom4j.Element; //导入依赖的package包/类
/**
 * 获取节点值
 * @param root
 * @param clazz
 * @param name
 * @return
 */
@SuppressWarnings("unchecked")
protected Optional<Object> elementValue(Element root, Class<?> clazz, String name) {
    Optional<String> elementTextOptional = elementText(root, name);
    if (elementTextOptional.isPresent()) {
        if (clazz == Integer.class) {
            return Optional.of(new Integer(elementTextOptional.get()));
        } else if (clazz == Long.class) {
            return Optional.of(new Long(elementTextOptional.get()));
        } else if (Enum.class.isAssignableFrom(clazz)) {
            try {
                Class enumClass = Class.forName(clazz.getName());
                return Optional.of(Enum.valueOf(enumClass, elementTextOptional.get()));
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                return Optional.empty();
            }
        } else {
            return Optional.of(elementTextOptional.get());
        }
    } else {
        return Optional.empty();
    }
}
 
开发者ID:minlia-projects,项目名称:minlia-iot,代码行数:31,代码来源:AbstractApiComponent.java

示例12: getAcceptableMembers

import org.dom4j.Element; //导入依赖的package包/类
/**
 * Returns the members that could be added to the specified instanceElement
 * according to schema constraints.
 */
public List getAcceptableMembers (Element instanceElement) { 
	prtln ("\ngetAcceptableMembers with instanceElement:");
	prtln (instanceElement.asXML());
	ChoiceGuard guard;
	try {
		guard = new ChoiceGuard (this, instanceElement);
	} catch (Exception e) {
		prtln ("ChoiceGard init error: " + e.getMessage());
		return new ArrayList();
	}
	prtln ("about to call ChoiceGuard getAcceptableMembers()");
	List members = guard.getAcceptableMembers();
	prtln ("acceptable members:");
	printMemberList (members);
	return members;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:21,代码来源:Choice.java

示例13: toJpdl

import org.dom4j.Element; //导入依赖的package包/类
public JpdlInfo toJpdl(Element element) {
	BaseElement targetElement=new BaseElement("decision");
	String name=this.buildCommonJpdlElement(element, targetElement);
	String decisionType=element.attributeValue("decisionType");
	String decisionValue=element.attributeValue("decisionValue");
	if(decisionType.equals("handler")){
		BaseElement handlerElement=new BaseElement("handler");
		handlerElement.addAttribute("class", decisionValue);
		targetElement.add(handlerElement);
	}else{
		targetElement.addAttribute("expr",decisionValue);
	}
	JpdlInfo info=new JpdlInfo();
	info.setName(name);
	info.setElement(targetElement);
	return info;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:18,代码来源:DecisionConverter.java

示例14: parse

import org.dom4j.Element; //导入依赖的package包/类
public Object parse(Element element,long processId,boolean parseChildren) {
	EndNode node=new EndNode();
	node.setProcessId(processId);
	parseNodeCommonInfo(element, node);
	String terminate=element.attributeValue("terminate");
	if(StringUtils.isNotEmpty(terminate)){
		node.setTerminate(Boolean.valueOf(terminate));
	}
	NodeDiagram diagram=parseDiagram(element);
	if(node.isTerminate()){
		diagram.setIcon("/icons/end-terminate.svg");
	}else{
		diagram.setIcon("/icons/end.svg");
	}
	diagram.setShapeType(ShapeType.Circle);
	diagram.setBorderWidth(1);
	node.setDiagram(diagram);
	return node;
}
 
开发者ID:youseries,项目名称:uflo,代码行数:20,代码来源:EndParser.java

示例15: toMap

import org.dom4j.Element; //导入依赖的package包/类
@Override
public Map toMap(Document document) {
  Map<String, String> m = new HashMap<String, String>();
  /**
   * <contentList> <content contentuid=
   * "h00007224gb454g4b8bgb762g7865d9ee3dbb">如果不是这样的话!哈,开玩笑啦,我们在一起很合适,就像面包上的果酱。你想和我组队吗?我敢说你们需要一点野兽风味!</content>
   * <content contentuid="h0001d8b9g13d6g4605g85e9g708fe1e537c8">定制</content> </contentList>
   */
  // 获取根节点元素对象
  Element root = document.getRootElement();
  // 子节点
  List<Element> list = root.elements();
  // 使用递归
  Iterator<Element> iterator = list.iterator();
  while (iterator.hasNext()) {
    Element e = iterator.next();
    Attribute attribute = e.attribute("contentuid");
    m.put(attribute.getValue(), e.getText());
  }
  return m;
}
 
开发者ID:SvenAugustus,项目名称:Divinity_Original_Sin_2_zhCN,代码行数:22,代码来源:DOS2ToMap.java


注:本文中的org.dom4j.Element类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。