/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
public class ScreenMenuBar extends MenuBar implements ContainerListener, ScreenMenuPropertyHandler, ComponentListener {
}
public void addNotify() {
super.addNotify();
fSwingBar.addContainerListener(this);
fPropertyListener = new ScreenMenuPropertyListener(this);
fAccessibleListener = new ScreenMenuPropertyListener(this);
// We disable component events when the menu bar is not parented. So now we need to
// sync back up with the current state of the JMenuBar. We first add the menus we
// don't have and then remove the items that are no longer on the JMenuBar.
for(int i = 0; i < count ; i++) {
if (m != null) {
addSubmenu(m);
}
}
while (e.hasMoreElements()) {
final JMenu m = e.nextElement();
removeSubmenu(m);
}
}
}
public void removeNotify() {
// KCH - 3974930 - We do null checks for fSwingBar and fSubmenus because some people are using
// reflection to muck about with our ivars
fSwingBar.removeContainerListener(this);
}
// We don't listen to events when the menu bar is not parented.
// Remove all the component listeners.
while (e.hasMoreElements()) {
final JMenu m = e.nextElement();
m.removeComponentListener(this);
}
}
super.removeNotify();
}
/**
* Invoked when a component has been added to the container.
*/
}
/**
* Invoked when a component has been removed from the container.
*/
}
/**
* Invoked when the component's size changes.
*/
/**
* Invoked when the component's position changes.
*/
/**
* Invoked when the component has been made visible.
* See componentHidden - we should still have a MenuItem
* it just isn't inserted
*/
}
/**
* Invoked when the component has been made invisible.
* MenuComponent.setVisible does nothing,
* so we remove the ScreenMenuItem from the ScreenMenu
* but leave it in fItems
*/
}
/*
* MenuComponent.setVisible does nothing,
* so we just add or remove the child from the ScreenMenuBar
* but leave it in the list
*/
if (b) {
} else {
}
}
}
public void removeAll() {
synchronized (getTreeLock()) {
final int nitems = getMenuCount();
remove(i);
}
}
}
public void setEnabled(final boolean b) {
for (int i = 0; i < count; i++) {
}
}
// only check and radio items can be indeterminate
sm = new ScreenMenu(m);
m.addComponentListener(this);
}
// MenuComponents don't support setVisible, so we just don't add it to the menubar
for (int i = 0; i < menuCount; i++) {
if (menu == m) {
break;
}
}
}
}
return sm;
}
/**
* Remove the screen menu associated with the specifiec menu. This
* also removes any associated component listener on the screen menu
*
* @param menu The swing menu we want to remove the screen menu for.
*/
if (screenMenu == null) return;
menu.removeComponentListener(this);
}
static {
try {
return localFields;
} catch (final NoSuchFieldException nsf) {
// If this happens, Sun changed the definition of MenuBar and MenuComponent!
return null;
}
}
});
};
synchronized (getTreeLock()) {
}
// Use nasty reflection to get at the menus array and parent fields.
try {
if (stolenFields == null) return m;
m.addNotify();
}
} catch (final IllegalAccessException iae) {
}
return m;
}
}
}