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


Java Attribute.getIntValue方法代码示例

本文整理汇总了Java中org.jdom.Attribute.getIntValue方法的典型用法代码示例。如果您正苦于以下问题:Java Attribute.getIntValue方法的具体用法?Java Attribute.getIntValue怎么用?Java Attribute.getIntValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdom.Attribute的用法示例。


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

示例1: getColorDescriptor

import org.jdom.Attribute; //导入方法依赖的package包/类
public static ColorDescriptor getColorDescriptor(final Element element) throws Exception {
  Attribute attr = element.getAttribute(UIFormXmlConstants.ATTRIBUTE_COLOR);
  if (attr != null) {
    return new ColorDescriptor(new Color(attr.getIntValue()));
  }
  String swingColor = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_SWING_COLOR);
  if (swingColor != null) {
    return ColorDescriptor.fromSwingColor(swingColor);
  }
  String systemColor = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_SYSTEM_COLOR);
  if (systemColor != null) {
    return ColorDescriptor.fromSystemColor(systemColor);
  }
  String awtColor = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_AWT_COLOR);
  if (awtColor != null) {
    return ColorDescriptor.fromAWTColor(awtColor);
  }
  return new ColorDescriptor(null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:LwXmlReader.java

示例2: validateSection

import org.jdom.Attribute; //导入方法依赖的package包/类
private boolean validateSection(Element sectionElement, String expectedChildName, int attributes) {

        // Check that section exists
        if(sectionElement==null) return false;

        // Go through children
        Iterator iter = sectionElement.getChildren().iterator();
        while(iter.hasNext()) {
            Element e = (Element)iter.next();
            // Check that child is expected
            if(!e.getName().equals(expectedChildName)) return false;
            // Check id attribute for existence, isnumber and range (1-4095)
            if((attributes|ATTR_ID)!=0) {
                Attribute a = e.getAttribute("id");
                if(a==null) return false;
                try {
                    int value = a.getIntValue();
                    if(value<=0||value>=(1<<ID_BITSHIFT)) return false;
                } catch(DataConversionException ex) {
                    return false;
                }
            }
        }
        return true;
    }
 
开发者ID:lfv-mssm,项目名称:yada,代码行数:26,代码来源:LanziusServer.java

示例3: convertAttributeToInt

import org.jdom.Attribute; //导入方法依赖的package包/类
private static int convertAttributeToInt(final Attribute attribute) {
    if (attribute == null) {
        return 0;
    }

    try {
        return attribute.getIntValue();
    } catch (final Exception ignore) {
        return 0;
    }
}
 
开发者ID:Appendium,项目名称:flatpack,代码行数:12,代码来源:MapParser.java

示例4: isLeaf

import org.jdom.Attribute; //导入方法依赖的package包/类
public static boolean isLeaf(Element element){
	if (!isNode(element))
		return false;
	Attribute leafAttribute = element.getAttribute("LEAF");
	try { 
		return leafAttribute.getIntValue() == 1; 
	}
	catch (Exception e) {
		return false;
	}
}
 
开发者ID:MesquiteProject,项目名称:MesquiteArchive,代码行数:12,代码来源:ToLUtil.java

示例5: hasChildren

import org.jdom.Attribute; //导入方法依赖的package包/类
public static boolean hasChildren(Element element){
	if (!isNode(element))
		return false;
	Attribute childcountAttribute = element.getAttribute("CHILDCOUNT");
	try { 
		return childcountAttribute.getIntValue() > 0; 
	}
	catch (Exception e) {
		return false;
	}
}
 
开发者ID:MesquiteProject,项目名称:MesquiteArchive,代码行数:12,代码来源:ToLUtil.java

示例6: conv

import org.jdom.Attribute; //导入方法依赖的package包/类
/**
 * Converts String into java primitive type
 * @param type <code>Class</code> target type
 * @param attr <code>Attribute</code> value field needs to provide convertable String
 * @return <code>Object</code> primitive wrapped into wrapper object
 */
public static Object conv( final Class type, final Attribute attr,  final Localizer localizer ) throws Exception {
  Attribute a = (Attribute) attr.clone();
  Object obj = null;
  if ( Parser.LOCALIZED_ATTRIBUTES.contains( a.getName().toLowerCase() ))
    if (a.getAttributeType() == Attribute.CDATA_TYPE )
       a.setValue( localizer.getString( a.getValue() ));

  try {
    if (boolean.class.equals( type )) {
      obj = new Boolean( a.getBooleanValue() );
    } else if (int.class.equals( type )) {
      obj = new Integer( a.getIntValue() );
    } else if (long.class.equals( type )) {
      obj = new Long( a.getLongValue() );
    } else if (float.class.equals( type )) {
      obj = new Float( a.getFloatValue() );
    } else if (double.class.equals( type )) {
      obj = new Double( a.getDoubleValue() );
    }
  } catch (DataConversionException e) {
  } finally {
    if (obj==null) {
      try {
        String s = a.getValue();
        int k = s.indexOf( '.' ) - 1;
        Class pp = (Class) dictionaries.get( s.substring( 0, s.indexOf( '.' ) ) );
        obj = pp.getField( s.substring( k + 2 ) ).get( pp );
      } catch (Exception ex) {
        //
        //  Try to find the given value as a Constant in SwingConstants
        //
        obj = PrimitiveConverter.class.getField( a.getValue() ).get( PrimitiveConverter.class );
      }
    }
  }

  return obj;
}
 
开发者ID:dhmay,项目名称:msInspect,代码行数:45,代码来源:PrimitiveConverter.java


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