1 /* 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.awt.peer; 27 28 import java.awt.Image; 29 import java.awt.PopupMenu; 30 import java.awt.Taskbar; 31 import java.awt.Taskbar.Feature; 32 import java.awt.Window; 33 34 35 /** 36 * The {@code TaskbarPeer} interface provides methods for interacting with 37 * system task area. 38 */ 39 public interface TaskbarPeer { 40 41 /** 42 * Requests user attention to this application. 43 * 44 * @param enabled disables this request if false 45 * @param critical if this is an important request 46 * @see Taskbar#requestUserAttention 47 */ 48 default void requestUserAttention(boolean enabled, final boolean critical) {} 49 50 /** 51 * Requests user attention to the specified window until it is activated. 52 * 53 * On an already active window requesting attention does nothing. 54 * 55 * @param w window 56 */ 57 default void requestWindowUserAttention(Window w) {} 58 59 /** 60 * Attaches the contents of the provided PopupMenu to the application icon 61 * in system task area. 62 * 63 * @param menu the PopupMenu to attach to this application 64 */ 65 default void setMenu(final PopupMenu menu) {} 66 67 /** 68 * Gets PopupMenu used to add items to this application's icon in system task area. 69 * 70 * @return the PopupMenu 71 */ 72 default PopupMenu getMenu() { return null; } 73 74 /** 75 * Changes this application's icon to the provided image. 76 * 77 * @param image to change 78 */ 79 default void setIconImage(final Image image) {} 80 81 /** 82 * Obtains an image of this application's icon. 83 * 84 * @return an image of this application's icon 85 */ 86 default Image getIconImage() { return null; } 87 88 /** 89 * Affixes a small system-provided badge to this application's icon. 90 * Usually a number. 91 * 92 * @param badge label to affix to the icon 93 */ 94 default void setIconBadge(final String badge) {} 95 96 /** 97 * Affixes a small badge to this application's icon in task area 98 * for the specified window. 99 * 100 * @param w window to update 101 * @param badge image to affix to the icon 102 */ 103 default void setWindowIconBadge(Window w, final Image badge) {} 104 105 /** 106 * Displays progress for specified window. 107 * 108 * @param w window to update 109 * @param value from 0 to 100, other to disable progress indication 110 */ 111 default void setWindowProgressValue(Window w, int value) {} 112 113 /** 114 * Sets a progress state for a specified window. 115 * 116 * @param w window 117 * @param state to change to 118 * @see Taskbar#setWindowProgressState 119 */ 120 default void setWindowProgressState(Window w, int state) {} 121 122 /** 123 * Affixes a small system-provided progress bar to this application's icon. 124 * 125 * @param value from 0 to 100, other to disable progress indication 126 */ 127 default void setProgressValue(int value) {} 128 129 /** 130 * Tests support of {@code Feature} on current platform. 131 * @param f feature to test 132 * @return true if feature supported supported 133 */ 134 default public boolean isSupported(Feature f) { return false; } 135 }