MenuBarShadow.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
/*
* Copyright (C) 1996 Active Software, Inc.
* All rights reserved.
*
* @(#) MenuBarShadow.java 1.43 - last change made 07/28/97
*/
/**
* Wraps an AWT widget. The attributes available for this
* class are listed below. In the type column, type names beginning
* with "sunsoft.jws.visual.rt" have been abbreviated to begin with "rt".
*
* <pre>
name type default value
-----------------------------------------------------------------------
helpMenu rt.type.AMRef null
* < /pre>
*
* Check the super class for additional attributes.
*
* @see MenuBar
*/
private boolean fHelpMenu = false;
private boolean fCreate = false;
public MenuBarShadow() {
/* NOI18N */"sunsoft.jws.visual.rt.type.AMRef",
null, 0);
}
// a menu shadow ref is returned
else
}
public void create()
{
fCreate = true;
super.create();
fCreate = false;
}
// Check to make sure value is set yet
// a reference to the help menu shadow is what is
// stored as attribute
// Create the body if it does not yet exist
ms.createBody();
{
{
if (fCreate) // from create Menubar
{
fHelpMenu = true;
// no create just setting the help menu...
} else
/* JSTYLED */
}
else
{
/* JSTYLED */
}
}
else
/* JSTYLED */
System.out.println(Global.fmtMsg("sunsoft.jws.visual.rt.awt.java.awt.MenuBarShadow.CantResolveHelpMenu",
getName(),
}
}
else
}
public void createBody() {
}
protected void postCreate() {
/*
* note that the sethelpMenu call in the jdk creates and adds
* it if the menu does not exists.
* so during the setOnBody the help menu is created first.
* and since on windows the menu appear as they are added we
* see the help menu first. I believe it is
* a bug in the windows peer. This is a workaround for that..
* we remove and add the help menu again..
* after all the menus are created.. bug id 4033014....-kp
*/
Menu m;
int i;
{
if (fHelpMenu) // help menu present so add it..
{
}
}
super.postCreate();
}
// AMContainer interfaces
}
}
}
}
}
// Menus could have a layout constraint specifying their position
// in the menubar. This is not yet implemented.
}
}
}
public void createChildren() {
}
public void reparentChildren() {
}
public void destroyChildren() {
}
}
public Enumeration getChildList() {
return (helper.getChildList());
}
public int getChildCount() {
return (helper.getChildCount());
}
/**
* replicate is used by Visual Java for cut and paste.
*/
//
// Normally this method resides in AttributeManager (super-duper class).
// We override it here to put in special handling for the helpMenu --
// fix for Sun Bug # 4043169: help menu getting duplicated on
//
public AttributeManager replicate() {
// System.out.println("MenuBarShadow.replicate: ");
// System.out.println(" this: "+this);
// Create a new instance of the AttributeManager
try {
}
catch (InstantiationException ex) {
}
catch (IllegalAccessException ex) {
}
return null;
// Copy the attribute list
// System.out.println(" ----- attribute list: ");
// printAttList(list);
while (e.hasMoreElements()) {
//
// Find the name of the helpMenu, don't set it until
// we replicate the help menu. Then set it to the name of the
// newly replicated helpMenu.
// Fix for Sun Bug # 4043169: help menu getting duplicated on
//
if (helpMenuRef != null) {
}
// System.out.println("FOund help menu
// attribute. *NOT* setting it in new mgr. (yet)");
}
}
// Replicate the children
if (this instanceof AMContainer) {
e = ((AMContainer)this).getChildList();
// System.out.print(" childList: (isMenuBar: "+isMenuBar+")");
// printChildList(this);
while (e.hasMoreElements()) {
// Check for helpmenu
//
// System.out.println(); System.out.println("IS
// MENUBAR: child name="+child.getName());
// System.out.println(" looking for: "+helpMenuName);
// Is the name test going to be sufficient for finding
// the help menu? It seems that if we're restricted
// to doing the test only if isMenuBar, then we're
// OK. How unique do names have to be?
// System.out.println(" replicating
// (helpMenu)child: "+child);
new AMRef(replicantChild));
} else {
// System.out.println(" replicating (normal) child
// of MenuBar: "+child);
}
}
}
return newMgr;
}
while (e.hasMoreElements()) {
// System.out.println(" name: "+attr.getName()+"; value:
// "+(String)attr.getValue());
: /* NOI18N */"<null value>"));
: /* NOI18N */"<null value>"));
}
}
}
int i = 0;
/* JSTYLED */
e.hasMoreElements();) {
+ /* NOI18N */"");
i++;
}
}
}