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;
  27 
  28 import java.awt.Taskbar.Feature;
  29 
  30 
  31 /**
  32  * The {@code TaskbarPeer} interface provides methods for interacting with
  33  * system task area.
  34  */
  35 public interface TaskbarPeer {
  36     
  37     /**
  38      * Requests user attention to this application.
  39      * 
  40      * @param enabled disables this request if false
  41      * @param critical if this is an important request
  42      * @see Taskbar#requestUserAttention
  43      */
  44     default void requestUserAttention(boolean enabled, final boolean critical) {}
  45     
  46     /**
  47      * Requests user attention to the specified window until it is activated.
  48      * 
  49      * On an already active window requesting attention does nothing.
  50      * 
  51      * @param w window
  52      */
  53     default void requestWindowUserAttention(Window w) {}
  54     
  55     /**
  56      * Attaches the contents of the provided PopupMenu to the application icon
  57      * in system task area.
  58      *
  59      * @param menu the PopupMenu to attach to this application
  60      */
  61     default void setMenu(final PopupMenu menu) {}
  62 
  63     /**
  64      * Gets PopupMenu used to add items to this application's icon in system task area. 
  65      * 
  66      * @return the PopupMenu 
  67      */
  68     default PopupMenu getMenu() { return null; } 
  69 
  70     /**
  71      * Changes this application's icon to the provided image.
  72      *
  73      * @param image to change
  74      */
  75     default void setIconImage(final Image image) {}
  76 
  77     /**
  78      * Obtains an image of this application's icon.
  79      *
  80      * @return an image of this application's icon
  81      */
  82     default Image getIconImage() { return null; }
  83 
  84     /**
  85      * Affixes a small system provided badge to this application's icon.
  86      * Usually a number.
  87      *
  88      * @param badge label to affix to the icon
  89      */
  90     default void setIconBadge(final String badge) {}
  91 
  92     /**
  93      * Affixes a small badge to this application's icon in task area
  94      * for the specified window.
  95      *
  96      * @param w window to update 
  97      * @param badge image to affix to the icon
  98      */
  99     default void setWindowIconBadge(Window w, final Image badge) {}
 100 
 101     /**
 102      * Displays progress for specified window.
 103      *
 104      * @param w window to update
 105      * @param value from 0 to 100, other to disable progress indication
 106      */
 107     default void setWindowProgressValue(Window w, int value) {}
 108 
 109     /**
 110      * Sets a progress state for a specified window.
 111      *
 112      * @param w window
 113      * @param state to change to
 114      * @see Taskbar#setWindowProgressState
 115      */
 116     default void setWindowProgressState(Window w, int state) {}
 117 
 118     /**
 119      * Affixes a small system provided progress bar to this application's icon.
 120      *
 121      * @param value from 0 to 100, other to disable progress indication
 122      */
 123     default void setProgressValue(int value) {}
 124 
 125     /**
 126      * Tests support of {@code Feature} on current platform.
 127      * @param f feature to test
 128      * @return true if feature supported supported
 129      */
 130     default public boolean isSupported(Feature f) { return false; }
 131 }