本文整理汇总了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;
}
}
示例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);
}
示例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;
}