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


Java ID.create方法代码示例

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


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

示例1: getTopic

import javax.help.Map.ID; //导入方法依赖的package包/类
@Override
public HelpTopic getTopic(String topicId) {
    HelpTopic topic = (HelpTopic) helpSet.getKeyData("topics", topicId);
    
    if (topic != null) {
        return topic;
    }
    
    ID id = ID.create(topicId, helpSet);
    
    try {
        URL url = helpSet.getCombinedMap().getURLFromID(id);
        return new HelpTopic(url, topicId, helpSet.getTitle());
    } catch (Exception e) {
        return null;
    }
}
 
开发者ID:carewebframework,项目名称:carewebframework-core,代码行数:18,代码来源:HelpSet_JavaHelp.java

示例2: getURLFromID

import javax.help.Map.ID; //导入方法依赖的package包/类
public static URL getURLFromID(String id) throws BadIDException,
		MalformedURLException {
	initialize();
	logger.trace("Looking for id: " + id);
	ID theId = ID.create(id, hs);
	if (theId == null)
		return null;
	return hs.getCombinedMap().getURLFromID(theId);
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:10,代码来源:HelpCollator.java

示例3: createMyItem

import javax.help.Map.ID; //导入方法依赖的package包/类
/**
    * Create an TOCItem with the given data.
    * 
    * @param tagName
    *            The TOC type to create. Valid types are "tocitem". Null or
    *            invalid types will throw an IllegalArgumentException
    * @param atts
    *            Attributes of the Item. Valid attributes are "target",
    *            "image", and "text". A null atts is valid and means no
    *            attributes
    * @param hs
    *            HelpSet this item was created under.
    * @param locale
    *            Locale of this item. A null locale is valid.
    * @returns A fully constructed TreeItem.
    * @throws IllegalArgumentExcetpion
    *             if tagname is null or invalid.
    */
   public TreeItem createMyItem(String target) {

String line, title = "Test";
try {
    InputStream test = jarFile.getInputStream(jarFile.getEntry(target));
    BufferedReader in = new BufferedReader(new InputStreamReader(test));

    if (!in.ready())
	throw new IOException();

    while ((line = in.readLine()) != null) {
	if (line.toLowerCase().contains("title")) {
	    int beginIndex = line.toLowerCase().indexOf("title") + 6;
	    int endIndex = line.toLowerCase().indexOf("</title>");
	    title = line.substring(beginIndex, endIndex);
	    break;
	}
    }

    in.close();
} catch (IOException e) {
}

Map.ID mapID = null;
try {
    mapID = ID.create(target, hs);
} catch (BadIDException bex1) {
}

Map.ID imageMapID = null;
String imageID = "topic.png";
try {
    imageMapID = ID.create(imageID, hs);
} catch (BadIDException bex2) {
}

TOCItem item = new TOCItem(mapID, imageMapID, hs, Locale.getDefault());
item.setName(title);
item.setMergeType("javax.help.AppendMerge");
item.setExpansionType(TreeItem.COLLAPSE);

return item;
   }
 
开发者ID:mzmine,项目名称:mzmine2,代码行数:62,代码来源:MZmineTOCView.java


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