java.awt.desktop.PrintFilesHandler Java Examples

The following examples show how to use java.awt.desktop.PrintFilesHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: _AppEventHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void performUsing(final PrintFilesHandler handler, final _NativeEvent event) {
    // create file list from fileNames
    final List<String> fileNameList = event.get(0);
    final ArrayList<File> files = new ArrayList<File>(fileNameList.size());
    for (final String fileName : fileNameList) files.add(new File(fileName));

    handler.printFiles(new PrintFilesEvent(files));
}
 
Example #2
Source File: Desktop.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * print a list of files.
 *
 * @implNote Please note that for macOS, notifications
 * are only sent if the Java app is a bundled application,
 * with a {@code CFBundleDocumentTypes} array present in its
 * {@code Info.plist}. Check the
 * <a href="https://developer.apple.com/documentation">
 * Apple Developer Documentation</a> for more information about
 * {@code Info.plist}.
 *
 * @param printFileHandler handler
 * @throws SecurityException if a security manager exists and its
 * {@link java.lang.SecurityManager#checkPrintJobAccess()} method denies
 * the permission to print or it denies the
 * {@code RuntimePermission("canProcessApplicationEvents")} permission
 * @throws UnsupportedOperationException if the current platform
 * does not support the {@link Desktop.Action#APP_PRINT_FILE} action
 * @since 9
 */
public void setPrintFileHandler(final PrintFilesHandler printFileHandler) {
    checkEventsProcessingPermission();
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPrintJobAccess();
    }
    checkActionSupport(Action.APP_PRINT_FILE);
    peer.setPrintFileHandler(printFileHandler);
}
 
Example #3
Source File: Desktop.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * print a list of files.
 *
 * @implNote Please note that for Mac OS, notifications
 * are only sent if the Java app is a bundled application,
 * with a {@code CFBundleDocumentTypes} array present in its
 * Info.plist. See the
 * <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">
 * Info.plist Key Reference</a> for more information about adding a
 * {@code CFBundleDocumentTypes} key to your app's Info.plist.
 *
 * @param printFileHandler handler
 * @throws SecurityException if a security manager exists and its
 * {@link java.lang.SecurityManager#checkPrintJobAccess()} method denies
 * the permission to print or it denies the
 * {@code RuntimePermission("canProcessApplicationEvents")} permission
 * @throws UnsupportedOperationException if the current platform
 * does not support the {@link Desktop.Action#APP_PRINT_FILE} action
 * @since 9
 */
public void setPrintFileHandler(final PrintFilesHandler printFileHandler) {
    checkEventsProcessingPermission();
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPrintJobAccess();
    }
    checkActionSupport(Action.APP_PRINT_FILE);
    peer.setPrintFileHandler(printFileHandler);
}
 
Example #4
Source File: DesktopPeer.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * print a list of files.
 *
 * @param printFileHandler handler
 */
default void setPrintFileHandler(final PrintFilesHandler printFileHandler) {
}
 
Example #5
Source File: DesktopPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * print a list of files.
 *
 * @param printFileHandler handler
 */
default void setPrintFileHandler(final PrintFilesHandler printFileHandler) {
}
 
Example #6
Source File: Application.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to print a list of files.
 * The {@link PrintFilesHandler#printFiles(PrintFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
 * See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
 *
 * @param printFileHandler
 * @since Java for Mac OS X 10.6 Update 3
 * @since Java for Mac OS X 10.5 Update 8
 */
public void setPrintFileHandler(final PrintFilesHandler printFileHandler) {
    eventHandler.printFilesDispatcher.setHandler(printFileHandler);
}