/*
* 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.
*/
/**
* A Metal Look and Feel implementation of ToolBarUI. This implementation
* is a "combined" view/controller.
* <p>
*
* @author Jeff Shapiro
*/
{
/**
* An array of WeakReferences that point to JComponents. This will contain
* instances of JToolBars and JMenuBars and is used to find
*/
private static List<WeakReference<JComponent>> components = new ArrayList<WeakReference<JComponent>>();
/**
* This protected field is implemenation specific. Do not access directly
* or override. Use the create method instead.
*
* @see #createContainerListener
*/
/**
* This protected field is implemenation specific. Do not access directly
* or override. Use the create method instead.
*
* @see #createRolloverListener
*/
/**
* Last menubar the toolbar touched. This is only useful for ocean.
*/
/**
* Registers the specified component.
*/
if (c == null) {
// Exception is thrown as convenience for callers that are
// typed to throw an NPE.
throw new NullPointerException("JComponent must be non-null");
}
}
/**
* Unregisters the specified component.
*/
// Search for the component, removing any flushed references
// along the way.
}
}
}
/**
* Finds a previously registered component of class <code>target</code>
* that shares the JRootPane ancestor of <code>from</code>.
*/
get();
// WeakReference has gone away, remove the WeakReference
}
return component;
}
}
}
return null;
}
/**
* Returns true if the passed in JMenuBar is above a horizontal
* JToolBar.
*/
findRegisteredComponentOfType(c, JToolBar.class);
}
return false;
}
{
return new MetalToolBarUI();
}
{
super.installUI( c );
register(c);
}
{
super.uninstallUI( c );
unregister(c);
}
protected void installListeners() {
super.installListeners();
if (contListener != null) {
}
if (rolloverListener != null) {
}
}
protected void uninstallListeners() {
super.uninstallListeners();
if (contListener != null) {
}
if (rolloverListener != null) {
}
}
return super.createRolloverBorder();
}
return super.createNonRolloverBorder();
}
/**
* Creates a non rollover border for Toggle buttons in the toolbar.
*/
return createNonRolloverBorder();
}
if (c instanceof JToggleButton && !(c instanceof JCheckBox)) {
// 4735514, 4886944: The method createNonRolloverToggleBorder() is
// private in BasicToolBarUI so we can't override it. We still need
// to call super from this method so that it can save away the
// original border and then we install ours.
// Before calling super we get a handle to the old border, because
// super will install a non-UIResource border that we can't
// distinguish from one provided by an application.
JToggleButton b = (JToggleButton)c;
super.setBorderToNonRollover(c);
if (border instanceof UIResource) {
if (nonRolloverBorder == null) {
}
}
} else {
super.setBorderToNonRollover(c);
}
}
/**
* Creates a container listener that will be added to the JToolBar.
* If this method returns null then it will not be added to the
* toolbar.
*
* @return an instance of a <code>ContainerListener</code> or null
*/
return null;
}
/**
* Creates a property change listener that will be added to the JToolBar.
* If this method returns null then it will not be added to the
* toolbar.
*
* @return an instance of a <code>PropertyChangeListener</code> or null
*/
return null;
}
{
return new MetalDockingListener( toolBar );
}
if (!GraphicsEnvironment.isHeadless()) {
if (dragWindow == null) {
}
dragWindow.setOffset(p);
}
}
/**
* If necessary paints the background of the component, then invokes
* <code>paint</code>.
*
* @param g Graphics to paint to
* @param c JComponent painting on
* @throws NullPointerException if <code>g</code> or <code>c</code> is
* null
* @see javax.swing.plaf.ComponentUI#update
* @see javax.swing.plaf.ComponentUI#paint
* @since 1.5
*/
if (g == null) {
throw new NullPointerException("graphics must be non-null");
}
((JToolBar)c).getOrientation() ==
"MenuBar.gradient") != null) {
c, JMenuBar.class);
int x = point.x;
int y = point.y;
paint(g, c);
return;
}
}
paint(g, c);
return;
}
}
super.update(g, c);
}
if (MetalLookAndFeel.usingOcean()) {
if (this.lastMenuBar != lastMenuBar) {
// The menubar we previously touched has changed, force it
// to repaint.
if (this.lastMenuBar != null) {
this.lastMenuBar.repaint();
}
if (lastMenuBar != null) {
}
this.lastMenuBar = lastMenuBar;
}
}
}
// No longer used. Cannot remove for compatibility reasons
protected class MetalContainerListener
extends BasicToolBarUI.ToolBarContListener {}
// No longer used. Cannot remove for compatibility reasons
protected class MetalRolloverListener
extends BasicToolBarUI.PropertyListener {}
private boolean pressedInBumps = false;
super(t);
}
super.mousePressed(e);
return;
}
pressedInBumps = false;
} else { // vertical
}
pressedInBumps = true;
}
}
}
if (pressedInBumps) {
super.mouseDragged(e);
}
}
} // end class MetalDockingListener
}