jdk/src/solaris/classes/sun/awt/motif/MDialogPeer.java
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 129 f995b9c9c5fa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 129
diff changeset
     2
 * Copyright 1995-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package sun.awt.motif;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.peer.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import sun.awt.motif.MInputMethodControl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import sun.awt.im.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
class MDialogPeer extends MWindowPeer implements DialogPeer, MInputMethodControl {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    static Vector allDialogs = new Vector();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    MDialogPeer(Dialog target) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
        /* create MWindowPeer object */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        winAttr.nativeDecor = !target.isUndecorated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        winAttr.initialFocus = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
        winAttr.isResizable =  target.isResizable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        winAttr.initialState = MWindowAttributes.NORMAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        winAttr.title = target.getTitle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        winAttr.icon = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        if (winAttr.nativeDecor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
            winAttr.decorations = winAttr.AWT_DECOR_ALL |
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                                  winAttr.AWT_DECOR_MINIMIZE |
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
                                  winAttr.AWT_DECOR_MAXIMIZE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
            winAttr.decorations = winAttr.AWT_DECOR_NONE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        /* create and init native component */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        init(target);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        allDialogs.addElement(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public void setTitle(String title) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        pSetTitle(title);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    protected void disposeImpl() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        allDialogs.removeElement(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        super.disposeImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    // NOTE: This method is called by privileged threads.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public void handleMoved(int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    public void show() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        pShowModal( ((Dialog)target).isModal() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        updateAlwaysOnTop(alwaysOnTop);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    // NOTE: This method may be called by privileged threads.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public void handleIconify() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
// Note: These routines are necessary for Coaleseing of native implementations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
//       As Dialogs do not currently send Iconify/DeIconify messages but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
//       Windows/Frames do.  If this should be made consistent...to do so
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
//       uncomment the postEvent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
//       postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_ICONIFIED));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    // NOTE: This method may be called by privileged threads.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public void handleDeiconify() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
// Note: These routines are necessary for Coaleseing of native implementations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
//       As Dialogs do not currently send Iconify/DeIconify messages but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
//       Windows/Frames do. If this should be made consistent...to do so
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
//       uncomment the postEvent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
//       postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_DEICONIFIED));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    public void blockWindows(java.util.List<Window> toBlock) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        // do nothing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
129
f995b9c9c5fa 6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents: 2
diff changeset
   105
f995b9c9c5fa 6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents: 2
diff changeset
   106
    @Override
f995b9c9c5fa 6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents: 2
diff changeset
   107
    final boolean isTargetUndecorated() {
f995b9c9c5fa 6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents: 2
diff changeset
   108
        return ((Dialog)target).isUndecorated();
f995b9c9c5fa 6589527: Window and Frame instances can hide their "Applet Warning"
anthony
parents: 2
diff changeset
   109
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
}