< prev index next >
src/java.desktop/share/classes/java/awt/Taskbar.java
Print this page
*** 177,193 ****
}
}
/**
* Calls to the security manager's {@code checkPermission} method with
! * an {@code AWTPermission("showWindowWithoutWarningBanner")}
! * permission.
*/
! private void checkAWTPermission(){
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new AWTPermission(
"showWindowWithoutWarningBanner"));
}
}
private Taskbar() {
--- 177,196 ----
}
}
/**
* Calls to the security manager's {@code checkPermission} method with
! * an {@code AWTPermission("showWindowWithoutWarningBanner")} and an
! * {@code AWTPermission("canProcessApplicationEvents")}
! * permissions.
*/
! private void checkPermissions(){
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new AWTPermission(
+ "canProcessApplicationEvents"));
+ sm.checkPermission(new AWTPermission(
"showWindowWithoutWarningBanner"));
}
}
private Taskbar() {
*** 260,275 ****
* with {@code enabled} parameter set to false.
*
* @param enabled disables this request if false
* @param critical if this is an important request
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#USER_ATTENTION} feature
*/
public void requestUserAttention(final boolean enabled, final boolean critical) {
! checkAWTPermission();
checkFeatureSupport(Feature.USER_ATTENTION);
peer.requestUserAttention(enabled, critical);
}
/**
--- 263,279 ----
* with {@code enabled} parameter set to false.
*
* @param enabled disables this request if false
* @param critical if this is an important request
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#USER_ATTENTION} feature
*/
public void requestUserAttention(final boolean enabled, final boolean critical) {
! checkPermissions();
checkFeatureSupport(Feature.USER_ATTENTION);
peer.requestUserAttention(enabled, critical);
}
/**
*** 277,353 ****
*
* On an already active window requesting attention does nothing.
*
* @param w window
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#USER_ATTENTION_WINDOW} feature
*/
public void requestWindowUserAttention(Window w) {
! checkAWTPermission();
checkFeatureSupport(Feature.USER_ATTENTION_WINDOW);
peer.requestWindowUserAttention(w);
}
/**
* Attaches the contents of the provided PopupMenu to the application icon
* in the task area.
*
* @param menu the PopupMenu to attach to this application
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#MENU} feature
*/
public void setMenu(final PopupMenu menu) {
! checkAWTPermission();
checkFeatureSupport(Feature.MENU);
peer.setMenu(menu);
}
/**
* Gets PopupMenu used to add items to this application's icon in system task area.
*
* @return the PopupMenu
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#MENU} feature
*/
public PopupMenu getMenu() {
! checkAWTPermission();
checkFeatureSupport(Feature.MENU);
return peer.getMenu();
}
/**
* Changes this application's icon to the provided image.
*
* @param image to change
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
*/
public void setIconImage(final Image image) {
! checkAWTPermission();
checkFeatureSupport(Feature.ICON_IMAGE);
peer.setIconImage(image);
}
/**
* Obtains an image of this application's icon.
*
* @return an image of this application's icon
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
*/
public Image getIconImage() {
! checkAWTPermission();
checkFeatureSupport(Feature.ICON_IMAGE);
return peer.getIconImage();
}
/**
--- 281,362 ----
*
* On an already active window requesting attention does nothing.
*
* @param w window
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#USER_ATTENTION_WINDOW} feature
*/
public void requestWindowUserAttention(Window w) {
! checkPermissions();
checkFeatureSupport(Feature.USER_ATTENTION_WINDOW);
peer.requestWindowUserAttention(w);
}
/**
* Attaches the contents of the provided PopupMenu to the application icon
* in the task area.
*
* @param menu the PopupMenu to attach to this application
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#MENU} feature
*/
public void setMenu(final PopupMenu menu) {
! checkPermissions();
checkFeatureSupport(Feature.MENU);
peer.setMenu(menu);
}
/**
* Gets PopupMenu used to add items to this application's icon in system task area.
*
* @return the PopupMenu
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#MENU} feature
*/
public PopupMenu getMenu() {
! checkPermissions();
checkFeatureSupport(Feature.MENU);
return peer.getMenu();
}
/**
* Changes this application's icon to the provided image.
*
* @param image to change
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
*/
public void setIconImage(final Image image) {
! checkPermissions();
checkFeatureSupport(Feature.ICON_IMAGE);
peer.setIconImage(image);
}
/**
* Obtains an image of this application's icon.
*
* @return an image of this application's icon
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_IMAGE} feature
*/
public Image getIconImage() {
! checkPermissions();
checkFeatureSupport(Feature.ICON_IMAGE);
return peer.getIconImage();
}
/**
*** 360,376 ****
* {@code Feature.ICON_BADGE_NUMBER}.
*
* Passing {@code null} as parameter hides the badge.
* @param badge label to affix to the icon
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER}
* or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature
*/
public void setIconBadge(final String badge) {
! checkAWTPermission();
checkFeatureSupport(Feature.ICON_BADGE_NUMBER);
peer.setIconBadge(badge);
}
/**
--- 369,386 ----
* {@code Feature.ICON_BADGE_NUMBER}.
*
* Passing {@code null} as parameter hides the badge.
* @param badge label to affix to the icon
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_BADGE_NUMBER}
* or {@link Taskbar.Feature#ICON_BADGE_TEXT} feature
*/
public void setIconBadge(final String badge) {
! checkPermissions();
checkFeatureSupport(Feature.ICON_BADGE_NUMBER);
peer.setIconBadge(badge);
}
/**
*** 379,394 ****
* It may be disabled by system settings.
*
* @param w window to update
* @param badge image to affix to the icon
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_BADGE_IMAGE_WINDOW} feature
*/
public void setWindowIconBadge(Window w, final Image badge) {
! checkAWTPermission();
checkFeatureSupport(Feature.ICON_BADGE_IMAGE_WINDOW);
if (w != null) {
peer.setWindowIconBadge(w, badge);
}
}
--- 389,405 ----
* It may be disabled by system settings.
*
* @param w window to update
* @param badge image to affix to the icon
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#ICON_BADGE_IMAGE_WINDOW} feature
*/
public void setWindowIconBadge(Window w, final Image badge) {
! checkPermissions();
checkFeatureSupport(Feature.ICON_BADGE_IMAGE_WINDOW);
if (w != null) {
peer.setWindowIconBadge(w, badge);
}
}
*** 396,426 ****
/**
* Affixes a small system-provided progress bar to this application's icon.
*
* @param value from 0 to 100, other to disable progress indication
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#PROGRESS_VALUE} feature
*/
public void setProgressValue(int value) {
! checkAWTPermission();
checkFeatureSupport(Feature.PROGRESS_VALUE);
peer.setProgressValue(value);
}
/**
* Displays progress for specified window.
*
* @param w window to update
* @param value from 0 to 100, other to disable progress indication
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#PROGRESS_VALUE_WINDOW} feature
*/
public void setWindowProgressValue(Window w, int value) {
! checkAWTPermission();
checkFeatureSupport(Feature.PROGRESS_VALUE_WINDOW);
if (w != null) {
peer.setWindowProgressValue(w, value);
}
}
--- 407,441 ----
/**
* Affixes a small system-provided progress bar to this application's icon.
*
* @param value from 0 to 100, other to disable progress indication
+ * @throws SecurityException if a security manager exists and it denies the
+ * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
+ * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#PROGRESS_VALUE} feature
*/
public void setProgressValue(int value) {
! checkPermissions();
checkFeatureSupport(Feature.PROGRESS_VALUE);
peer.setProgressValue(value);
}
/**
* Displays progress for specified window.
*
* @param w window to update
* @param value from 0 to 100, other to disable progress indication
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#PROGRESS_VALUE_WINDOW} feature
*/
public void setWindowProgressValue(Window w, int value) {
! checkPermissions();
checkFeatureSupport(Feature.PROGRESS_VALUE_WINDOW);
if (w != null) {
peer.setWindowProgressValue(w, value);
}
}
*** 434,449 ****
* @see State#NORMAL
* @see State#PAUSED
* @see State#INDETERMINATE
* @see State#ERROR
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#PROGRESS_STATE_WINDOW} feature
*/
public void setWindowProgressState(Window w, State state) {
! checkAWTPermission();
checkFeatureSupport(Feature.PROGRESS_STATE_WINDOW);
if (w != null) {
peer.setWindowProgressState(w, state);
}
}
--- 449,465 ----
* @see State#NORMAL
* @see State#PAUSED
* @see State#INDETERMINATE
* @see State#ERROR
* @throws SecurityException if a security manager exists and it denies the
! * {@code AWTPermission("showWindowWithoutWarningBanner")} or the
! * {@code RuntimePermission("canProcessApplicationEvents")} permission.
* @throws UnsupportedOperationException if the current platform
* does not support the {@link Taskbar.Feature#PROGRESS_STATE_WINDOW} feature
*/
public void setWindowProgressState(Window w, State state) {
! checkPermissions();
checkFeatureSupport(Feature.PROGRESS_STATE_WINDOW);
if (w != null) {
peer.setWindowProgressState(w, state);
}
}
< prev index next >