本文整理汇总了Java中org.openide.loaders.DataObject.Container方法的典型用法代码示例。如果您正苦于以下问题:Java DataObject.Container方法的具体用法?Java DataObject.Container怎么用?Java DataObject.Container使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.loaders.DataObject
的用法示例。
在下文中一共展示了DataObject.Container方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAcceptedDataObjects
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
* Recursivelly get all accepted data objects starting from given folder.
*/
public static List<DataObject> getAcceptedDataObjects(DataObject.Container folder) {
List<DataObject> accepted = new ArrayList<DataObject>();
final VisibilityQuery visQuery = VisibilityQuery.getDefault();
DataObject[] children = folder.getChildren();
for (DataObject child : children) {
if (!visQuery.isVisible(child.getPrimaryFile())) {
continue;
}
if(child instanceof DataObject.Container) {
accepted.addAll(getAcceptedDataObjects((DataObject.Container)child));
} else {
if(FactoryRegistry.hasFactory(child.getClass()))
accepted.add(child);
}
}
return accepted;
}
示例2: createWizardSourceMap
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
/**
* Create settings based on selected nodes. Finds all accepted data objects.
* Used by actions to populate wizard.
* @param activatedNodes selected nodes
* @return map with accepted data objects as keys or empty map if no such
* data object were found.
*/
public static Map<DataObject,SourceData> createWizardSourceMap(Node[] activatedNodes) {
Map<DataObject,SourceData> sourceMap = createWizardSourceMap();
if (activatedNodes != null && activatedNodes.length > 0) {
final VisibilityQuery visQuery = VisibilityQuery.getDefault();
for (Node node : activatedNodes) {
DataObject dobj = node.getCookie(DataObject.class);
if (dobj != null && !visQuery.isVisible(dobj.getPrimaryFile())) {
continue;
}
DataObject.Container container = node.getCookie(DataObject.Container.class);
if (container != null) {
for (DataObject dataObj : I18nUtil.getAcceptedDataObjects(container)) {
addSource(sourceMap, dataObj);
}
}
if (dobj == null) {
continue;
}
if (FactoryRegistry.hasFactory(dobj.getClass())) {
addSource(sourceMap, dobj);
}
}
}
return sourceMap;
}
示例3: assertNodes
import org.openide.loaders.DataObject; //导入方法依赖的package包/类
private static void assertNodes( Children children, String[] nodeNames, int[] childCount, boolean optimalResult ) throws InterruptedException, InvocationTargetException {
waitForAWT();
Node[] nodes = children.getNodes (optimalResult);
String[] actualNodeNames = new String[nodes.length];
for (int i = 0; i < nodes.length; i++) {
actualNodeNames[i] = nodes[i].getDisplayName();
}
assertEquals("Wrong # or names of nodes", Arrays.asList(nodeNames), Arrays.asList(actualNodeNames));
for( int i = 0; i < nodeNames.length; i++ ) {
if ( childCount != null ) {
if ( childCount[i] == 0 ) {
assertEquals( "Node should be leaf", true, nodes[i].isLeaf() );
}
else {
assertEquals( "Node should not be leaf", false, nodes[i].isLeaf() );
}
assertEquals( "Wrong number of children. Node: " + nodeNames[i] +".", childCount[i], nodes[i].getChildren().getNodes( true ).length );
DataObject.Container cont = nodes[i].getLookup().lookup (DataObject.Container.class);
if (cont != null) {
Node[] arr = nodes[i].getChildren ().getNodes ( true );
DataObject[] child = cont.getChildren ();
for (int k = 0, l = 0; k < arr.length; k++) {
if ( !VisibilityQuery.getDefault().isVisible( child[k].getPrimaryFile() ) ) {
continue;
}
DataObject myObj = arr[l].getLookup().lookup(DataObject.class);
assertNotNull ("Data object should be found for " + arr[k], myObj);
if (child.length <= k) {
fail ("But there is no object for node: " + arr[k]);
} else {
assertEquals ("child objects are the same", child[k], myObj);
}
l++;
}
}
}
}
}