本文整理汇总了Java中org.netbeans.spi.print.PrintProvider类的典型用法代码示例。如果您正苦于以下问题:Java PrintProvider类的具体用法?Java PrintProvider怎么用?Java PrintProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrintProvider类属于org.netbeans.spi.print包,在下文中一共展示了PrintProvider类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPrintProviders
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
private PrintProvider[] getPrintProviders() {
//out();
//out("GET PRINT PROVIDERS");
TopComponent top = getActiveTopComponent();
//out("Top: " + top);
PrintProvider[] providers = getComponentProviders(top);
//out("Component providers: " + providers);
if (providers != null) {
return providers;
}
providers = getLookupProviders(top);
//out("Lookup providers: " + providers);
if (providers != null) {
return providers;
}
return getCookieProviders(getSelectedNodes());
}
示例2: getCookieProviders
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
private PrintProvider[] getCookieProviders(Node[] nodes) {
//out();
//out("get cookie provider");
if (nodes == null) {
//out("NODES NULL");
return null;
}
List<PrintProvider> providers = new ArrayList<PrintProvider>();
for (Node node : nodes) {
//out(" see: " + node);
PrintProvider provider = getCookieProvider(node);
if (provider != null) {
providers.add(provider);
}
}
if (providers.size() == 0) {
//out("result null");
return null;
}
//out("result: " + providers);
return providers.toArray(new PrintProvider[providers.size()]);
}
示例3: getCookieProvider
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
private PrintProvider getCookieProvider(Node node) {
//out();
//out("GET input stream provider: " + node);
String text = getText(node.getLookup().lookup(InputStream.class));
if (text != null) {
//out("text: " + text);
return new TextProvider(text);
}
//out("get editor provider");
EditorCookie editor = node.getLookup().lookup(EditorCookie.class);
if (editor == null) {
//out("get editor provider.2");
return null;
}
if (editor.getDocument() == null) {
//out("get editor provider.3");
return null;
}
return new EditorProvider(editor, getDate(getDataObject(node)));
}
示例4: print
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
public void print(PrintProvider[] providers, boolean withPreview) {
assert providers != null : "Print providers cannot be null"; // NOI18N
assert providers.length > 0 : "Must be at least one provider"; // NOI18N
//out();
//out("Do action");
myPrintProviders = providers;
if (withPreview) {
show(true);
}
else {
print(true);
}
}
示例5: getComponentProviders
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
private PrintProvider[] getComponentProviders(JComponent top) {
if (top == null) {
return null;
}
List<JComponent> printable = new ArrayList<JComponent>();
findPrintable(top, printable);
if (printable.size() == 0) {
return null;
}
return getProviders(new ComponentProvider(printable, getName(printable, top), getDate(top)));
}
示例6: PrintAction
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
public PrintAction(PrintProvider[] providers) {
this(null, "ACT_Print_Action", "print", true, providers); // NOI18N
}
示例7: getLookupProviders
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
private PrintProvider[] getLookupProviders(TopComponent top) {
if (top == null) {
return null;
}
return getProviders((PrintProvider) top.getLookup().lookup(PrintProvider.class));
}
示例8: getProviders
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
private PrintProvider[] getProviders(PrintProvider provider) {
if (provider == null) {
return null;
}
return new PrintProvider[] { provider };
}
示例9: printAction
import org.netbeans.spi.print.PrintProvider; //导入依赖的package包/类
/**
* Returns the Print action for the given {@linkplain PrintProvider print providers}.
* All {@link org.netbeans.spi.print.PrintPage}s returned by the providers are
* shown in the Print Preview dialog.
*
* @param providers is the array of print providers
* @return the Print action
* @see PrintProvider
*/
public static Action printAction(PrintProvider[] providers) {
return new org.netbeans.modules.print.action.PrintAction(providers);
}