mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-15 16:09:44 +00:00
8358468: Enhance code consistency: java.desktop/macos
Reviewed-by: prr, azvegint
This commit is contained in:
parent
eefbfdce31
commit
6fc032de2c
@ -39,7 +39,7 @@ public final class JRSUIConstants {
|
||||
|
||||
private static native long getPtrForConstant(final int constant);
|
||||
|
||||
static class Key {
|
||||
static final class Key {
|
||||
@Native protected static final int _value = 20;
|
||||
public static final Key VALUE = new Key(_value);
|
||||
|
||||
@ -84,12 +84,13 @@ public final class JRSUIConstants {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getConstantName(this) + (ptr == 0 ? "(unlinked)" : "");
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValue {
|
||||
static final class DoubleValue {
|
||||
@Native protected static final byte TYPE_CODE = 1;
|
||||
|
||||
final double doubleValue;
|
||||
@ -106,21 +107,24 @@ public final class JRSUIConstants {
|
||||
buffer.putDouble(doubleValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
return (obj instanceof DoubleValue) && (((DoubleValue)obj).doubleValue == doubleValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Double.hashCode(doubleValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Double.toString(doubleValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static class PropertyEncoding {
|
||||
static final class PropertyEncoding {
|
||||
final long mask;
|
||||
final byte shift;
|
||||
|
||||
@ -150,12 +154,13 @@ public final class JRSUIConstants {
|
||||
return (encodedState & ~encoding.mask) | value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Size extends Property {
|
||||
public static final class Size extends Property {
|
||||
@Native private static final byte SHIFT = 0;
|
||||
@Native private static final byte SIZE = 3;
|
||||
@Native private static final long MASK = (long)0x7 << SHIFT;
|
||||
@ -175,7 +180,7 @@ public final class JRSUIConstants {
|
||||
public static final Size LARGE = new Size(_large);
|
||||
}
|
||||
|
||||
public static class State extends Property {
|
||||
public static final class State extends Property {
|
||||
@Native private static final byte SHIFT = Size.SHIFT + Size.SIZE;
|
||||
@Native private static final byte SIZE = 4;
|
||||
@Native private static final long MASK = (long)0xF << SHIFT;
|
||||
@ -209,7 +214,7 @@ public final class JRSUIConstants {
|
||||
public static final State DRAG = new State(_drag);
|
||||
}
|
||||
|
||||
public static class Direction extends Property {
|
||||
public static final class Direction extends Property {
|
||||
@Native private static final byte SHIFT = State.SHIFT + State.SIZE;
|
||||
@Native private static final byte SIZE = 4;
|
||||
@Native private static final long MASK = (long)0xF << SHIFT;
|
||||
@ -239,7 +244,7 @@ public final class JRSUIConstants {
|
||||
public static final Direction WEST = new Direction(_west);
|
||||
}
|
||||
|
||||
public static class Orientation extends Property {
|
||||
public static final class Orientation extends Property {
|
||||
@Native private static final byte SHIFT = Direction.SHIFT + Direction.SIZE;
|
||||
@Native private static final byte SIZE = 2;
|
||||
@Native private static final long MASK = (long)0x3 << SHIFT;
|
||||
@ -255,7 +260,7 @@ public final class JRSUIConstants {
|
||||
public static final Orientation VERTICAL = new Orientation(_vertical);
|
||||
}
|
||||
|
||||
public static class AlignmentVertical extends Property {
|
||||
public static final class AlignmentVertical extends Property {
|
||||
@Native private static final byte SHIFT = Orientation.SHIFT + Orientation.SIZE;
|
||||
@Native private static final byte SIZE = 2;
|
||||
@Native private static final long MASK = (long)0x3 << SHIFT;
|
||||
@ -273,7 +278,7 @@ public final class JRSUIConstants {
|
||||
public static final AlignmentVertical BOTTOM = new AlignmentVertical(_bottom);
|
||||
}
|
||||
|
||||
public static class AlignmentHorizontal extends Property {
|
||||
public static final class AlignmentHorizontal extends Property {
|
||||
@Native private static final byte SHIFT = AlignmentVertical.SHIFT + AlignmentVertical.SIZE;
|
||||
@Native private static final byte SIZE = 2;
|
||||
@Native private static final long MASK = (long)0x3 << SHIFT;
|
||||
@ -291,7 +296,7 @@ public final class JRSUIConstants {
|
||||
public static final AlignmentHorizontal RIGHT = new AlignmentHorizontal(_right);
|
||||
}
|
||||
|
||||
public static class SegmentPosition extends Property {
|
||||
public static final class SegmentPosition extends Property {
|
||||
@Native private static final byte SHIFT = AlignmentHorizontal.SHIFT + AlignmentHorizontal.SIZE;
|
||||
@Native private static final byte SIZE = 3;
|
||||
@Native private static final long MASK = (long)0x7 << SHIFT;
|
||||
@ -311,7 +316,7 @@ public final class JRSUIConstants {
|
||||
public static final SegmentPosition ONLY = new SegmentPosition(_only);
|
||||
}
|
||||
|
||||
public static class ScrollBarPart extends Property {
|
||||
public static final class ScrollBarPart extends Property {
|
||||
@Native private static final byte SHIFT = SegmentPosition.SHIFT + SegmentPosition.SIZE;
|
||||
@Native private static final byte SIZE = 4;
|
||||
@Native private static final long MASK = (long)0xF << SHIFT;
|
||||
@ -339,7 +344,7 @@ public final class JRSUIConstants {
|
||||
public static final ScrollBarPart TRACK_MAX = new ScrollBarPart(_trackMax);
|
||||
}
|
||||
|
||||
public static class Variant extends Property {
|
||||
public static final class Variant extends Property {
|
||||
@Native private static final byte SHIFT = ScrollBarPart.SHIFT + ScrollBarPart.SIZE;
|
||||
@Native private static final byte SIZE = 4;
|
||||
@Native private static final long MASK = (long)0xF << SHIFT;
|
||||
@ -370,7 +375,7 @@ public final class JRSUIConstants {
|
||||
public static final Variant GRADIENT_SIDE_BAR_FOCUSED_SELECTION = new Variant(_gradientSideBarFocusedSelection);
|
||||
}
|
||||
|
||||
public static class WindowType extends Property {
|
||||
public static final class WindowType extends Property {
|
||||
@Native private static final byte SHIFT = Variant.SHIFT + Variant.SIZE;
|
||||
@Native private static final byte SIZE = 2;
|
||||
@Native private static final long MASK = (long)0x3 << SHIFT;
|
||||
@ -388,7 +393,7 @@ public final class JRSUIConstants {
|
||||
public static final WindowType TITLELESS_UTILITY = new WindowType(_titlelessUtility);
|
||||
}
|
||||
|
||||
public static class Focused extends Property {
|
||||
public static final class Focused extends Property {
|
||||
@Native private static final byte SHIFT = WindowType.SHIFT + WindowType.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -404,7 +409,7 @@ public final class JRSUIConstants {
|
||||
public static final Focused YES = new Focused(_yes);
|
||||
}
|
||||
|
||||
public static class IndicatorOnly extends Property {
|
||||
public static final class IndicatorOnly extends Property {
|
||||
@Native private static final byte SHIFT = Focused.SHIFT + Focused.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -420,7 +425,7 @@ public final class JRSUIConstants {
|
||||
public static final IndicatorOnly YES = new IndicatorOnly(_yes);
|
||||
}
|
||||
|
||||
public static class NoIndicator extends Property {
|
||||
public static final class NoIndicator extends Property {
|
||||
@Native private static final byte SHIFT = IndicatorOnly.SHIFT + IndicatorOnly.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -436,7 +441,7 @@ public final class JRSUIConstants {
|
||||
public static final NoIndicator YES = new NoIndicator(_yes);
|
||||
}
|
||||
|
||||
public static class ArrowsOnly extends Property {
|
||||
public static final class ArrowsOnly extends Property {
|
||||
@Native private static final byte SHIFT = NoIndicator.SHIFT + NoIndicator.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -452,7 +457,7 @@ public final class JRSUIConstants {
|
||||
public static final ArrowsOnly YES = new ArrowsOnly(_yes);
|
||||
}
|
||||
|
||||
public static class FrameOnly extends Property {
|
||||
public static final class FrameOnly extends Property {
|
||||
@Native private static final byte SHIFT = ArrowsOnly.SHIFT + ArrowsOnly.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -468,7 +473,7 @@ public final class JRSUIConstants {
|
||||
public static final FrameOnly YES = new FrameOnly(_yes);
|
||||
}
|
||||
|
||||
public static class SegmentTrailingSeparator extends Property {
|
||||
public static final class SegmentTrailingSeparator extends Property {
|
||||
@Native private static final byte SHIFT = FrameOnly.SHIFT + FrameOnly.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -484,7 +489,7 @@ public final class JRSUIConstants {
|
||||
public static final SegmentTrailingSeparator YES = new SegmentTrailingSeparator(_yes);
|
||||
}
|
||||
|
||||
public static class SegmentLeadingSeparator extends Property {
|
||||
public static final class SegmentLeadingSeparator extends Property {
|
||||
@Native private static final byte SHIFT = SegmentTrailingSeparator.SHIFT + SegmentTrailingSeparator.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -500,7 +505,7 @@ public final class JRSUIConstants {
|
||||
public static final SegmentLeadingSeparator YES = new SegmentLeadingSeparator(_yes);
|
||||
}
|
||||
|
||||
public static class NothingToScroll extends Property {
|
||||
public static final class NothingToScroll extends Property {
|
||||
@Native private static final byte SHIFT = SegmentLeadingSeparator.SHIFT + SegmentLeadingSeparator.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -516,7 +521,7 @@ public final class JRSUIConstants {
|
||||
public static final NothingToScroll YES = new NothingToScroll(_yes);
|
||||
}
|
||||
|
||||
public static class WindowTitleBarSeparator extends Property {
|
||||
public static final class WindowTitleBarSeparator extends Property {
|
||||
@Native private static final byte SHIFT = NothingToScroll.SHIFT + NothingToScroll.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -532,7 +537,7 @@ public final class JRSUIConstants {
|
||||
public static final WindowTitleBarSeparator YES = new WindowTitleBarSeparator(_yes);
|
||||
}
|
||||
|
||||
public static class WindowClipCorners extends Property {
|
||||
public static final class WindowClipCorners extends Property {
|
||||
@Native private static final byte SHIFT = WindowTitleBarSeparator.SHIFT + WindowTitleBarSeparator.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -548,7 +553,7 @@ public final class JRSUIConstants {
|
||||
public static final WindowClipCorners YES = new WindowClipCorners(_yes);
|
||||
}
|
||||
|
||||
public static class ShowArrows extends Property {
|
||||
public static final class ShowArrows extends Property {
|
||||
@Native private static final byte SHIFT = WindowClipCorners.SHIFT + WindowClipCorners.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -564,7 +569,7 @@ public final class JRSUIConstants {
|
||||
public static final ShowArrows YES = new ShowArrows(_yes);
|
||||
}
|
||||
|
||||
public static class BooleanValue extends Property {
|
||||
public static final class BooleanValue extends Property {
|
||||
@Native private static final byte SHIFT = ShowArrows.SHIFT + ShowArrows.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -580,7 +585,7 @@ public final class JRSUIConstants {
|
||||
public static final BooleanValue YES = new BooleanValue(_yes);
|
||||
}
|
||||
|
||||
public static class Animating extends Property {
|
||||
public static final class Animating extends Property {
|
||||
@Native private static final byte SHIFT = BooleanValue.SHIFT + BooleanValue.SIZE;
|
||||
@Native private static final byte SIZE = 1;
|
||||
@Native private static final long MASK = (long)0x1 << SHIFT;
|
||||
@ -596,7 +601,7 @@ public final class JRSUIConstants {
|
||||
public static final Animating YES = new Animating(_yes);
|
||||
}
|
||||
|
||||
public static class Widget extends Property {
|
||||
public static final class Widget extends Property {
|
||||
@Native private static final byte SHIFT = Animating.SHIFT + Animating.SIZE;
|
||||
@Native private static final byte SIZE = 7;
|
||||
@Native private static final long MASK = (long)0x7F << SHIFT;
|
||||
@ -811,12 +816,13 @@ public final class JRSUIConstants {
|
||||
return getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getConstantName(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ScrollBarHit extends Hit {
|
||||
public static final class ScrollBarHit extends Hit {
|
||||
@Native private static final int _thumb = 2;
|
||||
public static final ScrollBarHit THUMB = new ScrollBarHit(_thumb);
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ public final class JRSUIControl {
|
||||
}
|
||||
|
||||
private static final int NIO_BUFFER_SIZE = 128;
|
||||
private static class ThreadLocalByteBuffer {
|
||||
private static final class ThreadLocalByteBuffer {
|
||||
final ByteBuffer buffer;
|
||||
final long ptr;
|
||||
|
||||
@ -114,6 +114,7 @@ public final class JRSUIControl {
|
||||
changes.putAll(other.changes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
protected synchronized void finalize() throws Throwable {
|
||||
if (cfDictionaryPtr == 0) return;
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
package apple.laf;
|
||||
|
||||
public class JRSUIFocus {
|
||||
public final class JRSUIFocus {
|
||||
private static final int SUCCESS = 0;
|
||||
private static final int NULL_PTR = -1;
|
||||
private static final int NULL_CG_REF = -2;
|
||||
|
||||
@ -93,7 +93,7 @@ public class JRSUIState {
|
||||
return Long.hashCode(encodedState) ^ getClass().hashCode();
|
||||
}
|
||||
|
||||
public static class AnimationFrameState extends JRSUIState {
|
||||
public static final class AnimationFrameState extends JRSUIState {
|
||||
final int animationFrame;
|
||||
int derivedAnimationFrame;
|
||||
|
||||
@ -187,7 +187,7 @@ public class JRSUIState {
|
||||
}
|
||||
}
|
||||
|
||||
public static class TitleBarHeightState extends ValueState {
|
||||
public static final class TitleBarHeightState extends ValueState {
|
||||
TitleBarHeightState(final long encodedState, final double value) {
|
||||
super(encodedState, value);
|
||||
}
|
||||
@ -204,7 +204,7 @@ public class JRSUIState {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ScrollBarState extends ValueState {
|
||||
public static final class ScrollBarState extends ValueState {
|
||||
final double thumbProportion;
|
||||
double derivedThumbProportion;
|
||||
final double thumbStart;
|
||||
|
||||
@ -28,7 +28,7 @@ package apple.laf;
|
||||
import apple.laf.JRSUIConstants.*;
|
||||
import apple.laf.JRSUIState.*;
|
||||
|
||||
public class JRSUIStateFactory {
|
||||
public final class JRSUIStateFactory {
|
||||
public static JRSUIState getSliderTrack() {
|
||||
return new JRSUIState(Widget.SLIDER.apply(NoIndicator.YES.apply(0)));
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public final class JRSUIUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class TabbedPane {
|
||||
public static final class TabbedPane {
|
||||
public static boolean useLegacyTabs() {
|
||||
return isLeopard;
|
||||
}
|
||||
@ -99,19 +99,19 @@ public final class JRSUIUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static class InternalFrame {
|
||||
public static final class InternalFrame {
|
||||
public static boolean shouldUseLegacyBorderMetrics() {
|
||||
return isSnowLeopardOrBelow;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Tree {
|
||||
public static final class Tree {
|
||||
public static boolean useLegacyTreeKnobs() {
|
||||
return isLeopard;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ScrollBar {
|
||||
public static final class ScrollBar {
|
||||
private static native boolean shouldUseScrollToClick();
|
||||
|
||||
public static boolean useScrollToClick() {
|
||||
@ -137,13 +137,13 @@ public final class JRSUIUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Images {
|
||||
public static final class Images {
|
||||
public static boolean shouldUseLegacySecurityUIPath() {
|
||||
return isSnowLeopardOrBelow;
|
||||
}
|
||||
}
|
||||
|
||||
public static class HitDetection {
|
||||
public static final class HitDetection {
|
||||
public static Hit getHitForPoint(final JRSUIControl control,
|
||||
final int x, final int y, final int w,
|
||||
final int h, final int hitX,
|
||||
|
||||
@ -73,7 +73,7 @@ import sun.lwawt.macosx.CPlatformWindow;
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public class Application {
|
||||
public final class Application {
|
||||
private static native void nativeInitializeApplicationDelegate();
|
||||
|
||||
static Application sApplication = null;
|
||||
|
||||
@ -31,7 +31,8 @@ import java.beans.SimpleBeanInfo;
|
||||
/**
|
||||
* This class is used by JavaBeans tools and should not be used directly by applications.
|
||||
*/
|
||||
public class ApplicationBeanInfo extends SimpleBeanInfo {
|
||||
public final class ApplicationBeanInfo extends SimpleBeanInfo {
|
||||
@Override
|
||||
public Image getIcon(final int iconKind) {
|
||||
return Toolkit.getDefaultToolkit().getImage("NSImage://NSGenericApplication");
|
||||
}
|
||||
|
||||
@ -41,8 +41,12 @@ import com.apple.eawt.event.FullScreenEvent;
|
||||
* @since Java for Mac OS X 10.7 Update 1
|
||||
*/
|
||||
public abstract class FullScreenAdapter implements FullScreenListener {
|
||||
@Override
|
||||
public void windowEnteringFullScreen(final FullScreenEvent e) {}
|
||||
@Override
|
||||
public void windowEnteredFullScreen(final FullScreenEvent e) {}
|
||||
@Override
|
||||
public void windowExitingFullScreen(final FullScreenEvent e) {}
|
||||
@Override
|
||||
public void windowExitedFullScreen(final FullScreenEvent e) {}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ import java.awt.desktop.QuitStrategy;
|
||||
* @since Java for Mac OS X 10.6 Update 3
|
||||
* @since Java for Mac OS X 10.5 Update 8
|
||||
*/
|
||||
public class MacQuitResponse implements QuitResponse {
|
||||
public final class MacQuitResponse implements QuitResponse {
|
||||
final _AppEventHandler appEventHandler;
|
||||
|
||||
MacQuitResponse(final _AppEventHandler appEventHandler) {
|
||||
|
||||
@ -32,7 +32,7 @@ import sun.awt.AWTAccessor;
|
||||
import sun.lwawt.macosx.*;
|
||||
import sun.lwawt.macosx.CImage.Creator;
|
||||
|
||||
class _AppDockIconHandler {
|
||||
final class _AppDockIconHandler {
|
||||
private static native void nativeSetDockMenu(final long cmenu);
|
||||
private static native void nativeSetDockIconImage(final long image);
|
||||
private static native void nativeSetDockIconProgress(final int value);
|
||||
|
||||
@ -66,7 +66,7 @@ import java.util.Map;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.SunToolkit;
|
||||
|
||||
class _AppEventHandler {
|
||||
final class _AppEventHandler {
|
||||
private static final int NOTIFY_ABOUT = 1;
|
||||
private static final int NOTIFY_PREFS = 2;
|
||||
private static final int NOTIFY_OPEN_APP = 3;
|
||||
@ -271,17 +271,20 @@ class _AppEventHandler {
|
||||
}
|
||||
|
||||
|
||||
class _AboutDispatcher extends _AppEventDispatcher<AboutHandler> {
|
||||
final class _AboutDispatcher extends _AppEventDispatcher<AboutHandler> {
|
||||
@Override
|
||||
void performDefaultAction(final _NativeEvent event) {
|
||||
openCocoaAboutWindow(); // if the handler is null, fall back to showing the Cocoa default
|
||||
}
|
||||
|
||||
@Override
|
||||
void performUsing(final AboutHandler handler, final _NativeEvent event) {
|
||||
handler.handleAbout(new AboutEvent());
|
||||
}
|
||||
}
|
||||
|
||||
static class _PreferencesDispatcher extends _AppEventDispatcher<PreferencesHandler> {
|
||||
static final class _PreferencesDispatcher extends _AppEventDispatcher<PreferencesHandler> {
|
||||
@Override
|
||||
synchronized void setHandler(final PreferencesHandler handler) {
|
||||
super.setHandler(handler);
|
||||
|
||||
@ -289,99 +292,121 @@ class _AppEventHandler {
|
||||
_AppMenuBarHandler.getInstance().setPreferencesMenuItemEnabled(handler != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
void performUsing(final PreferencesHandler handler, final _NativeEvent event) {
|
||||
handler.handlePreferences(new PreferencesEvent());
|
||||
}
|
||||
}
|
||||
|
||||
static class _OpenAppDispatcher extends _QueuingAppEventDispatcher<com.apple.eawt._OpenAppHandler> {
|
||||
static final class _OpenAppDispatcher extends _QueuingAppEventDispatcher<com.apple.eawt._OpenAppHandler> {
|
||||
@Override
|
||||
void performUsing(com.apple.eawt._OpenAppHandler handler, _NativeEvent event) {
|
||||
handler.handleOpenApp();
|
||||
}
|
||||
}
|
||||
|
||||
static class _AppReOpenedDispatcher extends _AppEventMultiplexor<AppReopenedListener> {
|
||||
static final class _AppReOpenedDispatcher extends _AppEventMultiplexor<AppReopenedListener> {
|
||||
@Override
|
||||
void performOnListener(AppReopenedListener listener, final _NativeEvent event) {
|
||||
final AppReopenedEvent e = new AppReopenedEvent();
|
||||
listener.appReopened(e);
|
||||
}
|
||||
}
|
||||
|
||||
static class _AppForegroundDispatcher extends _BooleanAppEventMultiplexor<AppForegroundListener, AppForegroundEvent> {
|
||||
static final class _AppForegroundDispatcher extends _BooleanAppEventMultiplexor<AppForegroundListener, AppForegroundEvent> {
|
||||
@Override
|
||||
AppForegroundEvent createEvent(final boolean isTrue) { return new AppForegroundEvent(); }
|
||||
|
||||
@Override
|
||||
void performFalseEventOn(final AppForegroundListener listener, final AppForegroundEvent e) {
|
||||
listener.appMovedToBackground(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void performTrueEventOn(final AppForegroundListener listener, final AppForegroundEvent e) {
|
||||
listener.appRaisedToForeground(e);
|
||||
}
|
||||
}
|
||||
|
||||
static class _HiddenAppDispatcher extends _BooleanAppEventMultiplexor<AppHiddenListener, AppHiddenEvent> {
|
||||
static final class _HiddenAppDispatcher extends _BooleanAppEventMultiplexor<AppHiddenListener, AppHiddenEvent> {
|
||||
@Override
|
||||
AppHiddenEvent createEvent(final boolean isTrue) { return new AppHiddenEvent(); }
|
||||
|
||||
@Override
|
||||
void performFalseEventOn(final AppHiddenListener listener, final AppHiddenEvent e) {
|
||||
listener.appUnhidden(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void performTrueEventOn(final AppHiddenListener listener, final AppHiddenEvent e) {
|
||||
listener.appHidden(e);
|
||||
}
|
||||
}
|
||||
|
||||
static class _UserSessionDispatcher extends _BooleanAppEventMultiplexor<UserSessionListener, UserSessionEvent> {
|
||||
static final class _UserSessionDispatcher extends _BooleanAppEventMultiplexor<UserSessionListener, UserSessionEvent> {
|
||||
@Override
|
||||
UserSessionEvent createEvent(final boolean isTrue) {
|
||||
return new UserSessionEvent(Reason.UNSPECIFIED);
|
||||
}
|
||||
|
||||
@Override
|
||||
void performFalseEventOn(final UserSessionListener listener, final UserSessionEvent e) {
|
||||
listener.userSessionDeactivated(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void performTrueEventOn(final UserSessionListener listener, final UserSessionEvent e) {
|
||||
listener.userSessionActivated(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void registerNativeListener() {
|
||||
nativeRegisterForNotification(REGISTER_USER_SESSION);
|
||||
}
|
||||
}
|
||||
|
||||
static class _ScreenSleepDispatcher extends _BooleanAppEventMultiplexor<ScreenSleepListener, ScreenSleepEvent> {
|
||||
static final class _ScreenSleepDispatcher extends _BooleanAppEventMultiplexor<ScreenSleepListener, ScreenSleepEvent> {
|
||||
@Override
|
||||
ScreenSleepEvent createEvent(final boolean isTrue) { return new ScreenSleepEvent(); }
|
||||
|
||||
@Override
|
||||
void performFalseEventOn(final ScreenSleepListener listener, final ScreenSleepEvent e) {
|
||||
listener.screenAwoke(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void performTrueEventOn(final ScreenSleepListener listener, final ScreenSleepEvent e) {
|
||||
listener.screenAboutToSleep(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void registerNativeListener() {
|
||||
nativeRegisterForNotification(REGISTER_SCREEN_SLEEP);
|
||||
}
|
||||
}
|
||||
|
||||
static class _SystemSleepDispatcher extends _BooleanAppEventMultiplexor<SystemSleepListener, SystemSleepEvent> {
|
||||
static final class _SystemSleepDispatcher extends _BooleanAppEventMultiplexor<SystemSleepListener, SystemSleepEvent> {
|
||||
@Override
|
||||
SystemSleepEvent createEvent(final boolean isTrue) { return new SystemSleepEvent(); }
|
||||
|
||||
@Override
|
||||
void performFalseEventOn(final SystemSleepListener listener, final SystemSleepEvent e) {
|
||||
listener.systemAwoke(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void performTrueEventOn(final SystemSleepListener listener, final SystemSleepEvent e) {
|
||||
listener.systemAboutToSleep(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
void registerNativeListener() {
|
||||
nativeRegisterForNotification(REGISTER_SYSTEM_SLEEP);
|
||||
}
|
||||
}
|
||||
|
||||
static class _OpenFileDispatcher extends _QueuingAppEventDispatcher<OpenFilesHandler> {
|
||||
static final class _OpenFileDispatcher extends _QueuingAppEventDispatcher<OpenFilesHandler> {
|
||||
@Override
|
||||
void performUsing(final OpenFilesHandler handler, final _NativeEvent event) {
|
||||
// create file list from fileNames
|
||||
final List<String> fileNameList = event.get(0);
|
||||
@ -394,7 +419,8 @@ class _AppEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
static class _PrintFileDispatcher extends _QueuingAppEventDispatcher<PrintFilesHandler> {
|
||||
static final class _PrintFileDispatcher extends _QueuingAppEventDispatcher<PrintFilesHandler> {
|
||||
@Override
|
||||
void performUsing(final PrintFilesHandler handler, final _NativeEvent event) {
|
||||
// create file list from fileNames
|
||||
final List<String> fileNameList = event.get(0);
|
||||
@ -406,7 +432,8 @@ class _AppEventHandler {
|
||||
}
|
||||
|
||||
// Java URLs can't handle unknown protocol types, which is why we use URIs
|
||||
static class _OpenURIDispatcher extends _QueuingAppEventDispatcher<OpenURIHandler> {
|
||||
static final class _OpenURIDispatcher extends _QueuingAppEventDispatcher<OpenURIHandler> {
|
||||
@Override
|
||||
void performUsing(final OpenURIHandler handler, final _NativeEvent event) {
|
||||
final String urlString = event.get(0);
|
||||
try {
|
||||
@ -417,11 +444,13 @@ class _AppEventHandler {
|
||||
}
|
||||
}
|
||||
|
||||
class _QuitDispatcher extends _AppEventDispatcher<QuitHandler> {
|
||||
final class _QuitDispatcher extends _AppEventDispatcher<QuitHandler> {
|
||||
@Override
|
||||
void performDefaultAction(final _NativeEvent event) {
|
||||
obtainQuitResponse().performQuit();
|
||||
}
|
||||
|
||||
@Override
|
||||
void performUsing(final QuitHandler handler, final _NativeEvent event) {
|
||||
if (_AppMiscHandlers.isSuddenTerminationEnbaled()) {
|
||||
performDefaultAction(event);
|
||||
@ -436,7 +465,7 @@ class _AppEventHandler {
|
||||
// -- ABSTRACT QUEUE/EVENT/LISTENER HELPERS --
|
||||
|
||||
// generic little "raw event" that's constructed easily from the native callbacks
|
||||
static class _NativeEvent {
|
||||
static final class _NativeEvent {
|
||||
Object[] args;
|
||||
|
||||
public _NativeEvent(final Object... args) {
|
||||
@ -591,6 +620,7 @@ class _AppEventHandler {
|
||||
super.dispatch(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized void setHandler(final H handler) {
|
||||
this._handler = handler;
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ import sun.lwawt.macosx.CMenuBar;
|
||||
|
||||
import com.apple.laf.AquaMenuBarUI;
|
||||
|
||||
class _AppMenuBarHandler {
|
||||
final class _AppMenuBarHandler {
|
||||
private static final int MENU_ABOUT = 1;
|
||||
private static final int MENU_PREFS = 2;
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
package com.apple.eawt;
|
||||
|
||||
class _AppMiscHandlers {
|
||||
final class _AppMiscHandlers {
|
||||
private static boolean isSuddenTerminationEnabled;
|
||||
|
||||
private static native void nativeOpenHelpViewer();
|
||||
|
||||
@ -30,7 +30,7 @@ import java.awt.Window;
|
||||
import java.util.EventObject;
|
||||
|
||||
@SuppressWarnings("serial") // JDK implementation class
|
||||
public class FullScreenEvent extends EventObject {
|
||||
public final class FullScreenEvent extends EventObject {
|
||||
|
||||
final Window window;
|
||||
|
||||
|
||||
@ -37,12 +37,20 @@ package com.apple.eawt.event;
|
||||
* @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
|
||||
*/
|
||||
public abstract class GestureAdapter implements GesturePhaseListener, MagnificationListener, RotationListener, SwipeListener {
|
||||
@Override
|
||||
public void gestureBegan(final GesturePhaseEvent e) { }
|
||||
@Override
|
||||
public void gestureEnded(final GesturePhaseEvent e) { }
|
||||
@Override
|
||||
public void magnify(final MagnificationEvent e) { }
|
||||
@Override
|
||||
public void rotate(final RotationEvent e) { }
|
||||
@Override
|
||||
public void swipedDown(final SwipeEvent e) { }
|
||||
@Override
|
||||
public void swipedLeft(final SwipeEvent e) { }
|
||||
@Override
|
||||
public void swipedRight(final SwipeEvent e) { }
|
||||
@Override
|
||||
public void swipedUp(final SwipeEvent e) { }
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ final class GestureHandler {
|
||||
|
||||
// notifies all listeners in a particular component/handler pair
|
||||
// and recursively notifies up the component hierarchy
|
||||
static class PerComponentNotifier {
|
||||
static final class PerComponentNotifier {
|
||||
final Component component;
|
||||
final GestureHandler handler;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ package com.apple.eawt.event;
|
||||
*
|
||||
* @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
|
||||
*/
|
||||
public class GesturePhaseEvent extends GestureEvent {
|
||||
public final class GesturePhaseEvent extends GestureEvent {
|
||||
GesturePhaseEvent() {
|
||||
// package private
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ package com.apple.eawt.event;
|
||||
*
|
||||
* @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
|
||||
*/
|
||||
public class MagnificationEvent extends GestureEvent {
|
||||
public final class MagnificationEvent extends GestureEvent {
|
||||
final double magnification;
|
||||
|
||||
MagnificationEvent(final double magnification) {
|
||||
|
||||
@ -32,7 +32,7 @@ package com.apple.eawt.event;
|
||||
*
|
||||
* @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
|
||||
*/
|
||||
public class RotationEvent extends GestureEvent {
|
||||
public final class RotationEvent extends GestureEvent {
|
||||
final double rotation;
|
||||
|
||||
RotationEvent(final double rotation) {
|
||||
|
||||
@ -32,7 +32,7 @@ package com.apple.eawt.event;
|
||||
*
|
||||
* @since Java for Mac OS X 10.5 Update 7, Java for Mac OS X 10.6 Update 2
|
||||
*/
|
||||
public class SwipeEvent extends GestureEvent {
|
||||
public final class SwipeEvent extends GestureEvent {
|
||||
SwipeEvent() {
|
||||
// package private
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ import java.io.*;
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public class FileManager {
|
||||
public final class FileManager {
|
||||
static {
|
||||
loadOSXLibrary();
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
super(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
// for now we don't paint a border. We let the button paint it since there
|
||||
// needs to be a strict ordering for aqua components.
|
||||
@ -144,6 +145,7 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
* Returns the insets of the border.
|
||||
* @param c the component for which this border insets value applies
|
||||
*/
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
if (!(c instanceof AbstractButton button)) return new Insets(0, 0, 0, 0);
|
||||
|
||||
@ -172,18 +174,19 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
* is opaque, it is responsible for filling in it's own
|
||||
* background when painting.
|
||||
*/
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return false;
|
||||
}
|
||||
|
||||
static class SizeConstants {
|
||||
static final class SizeConstants {
|
||||
protected static final int fNormalButtonHeight = 29;
|
||||
protected static final int fNormalMinButtonWidth = 40;
|
||||
protected static final int fSquareButtonHeightThreshold = 23;
|
||||
protected static final int fSquareButtonWidthThreshold = 16;
|
||||
}
|
||||
|
||||
public static class Dynamic extends AquaButtonBorder {
|
||||
public static final class Dynamic extends AquaButtonBorder {
|
||||
final Insets ALTERNATE_PUSH_INSETS = new Insets(3, 12, 5, 12);
|
||||
final Insets ALTERNATE_BEVEL_INSETS = new Insets(0, 5, 0, 5);
|
||||
final Insets ALTERNATE_SQUARE_INSETS = new Insets(0, 2, 0, 2);
|
||||
@ -202,6 +205,7 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
super(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getContentInsets(final AbstractButton b, final int width, final int height) {
|
||||
final Size size = AquaUtilControlSize.getUserSizeFrom(b);
|
||||
final Widget style = getStyleForSize(b, size, width, height);
|
||||
@ -219,6 +223,7 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, int x, int y, int width, int height) {
|
||||
final Size size = AquaUtilControlSize.getUserSizeFrom(b);
|
||||
painter.state.set(size);
|
||||
@ -256,7 +261,7 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
}
|
||||
}
|
||||
|
||||
public static class Toggle extends AquaButtonBorder {
|
||||
public static final class Toggle extends AquaButtonBorder {
|
||||
public Toggle() {
|
||||
super(new SizeDescriptor(new SizeVariant().alterMargins(6, 6, 6, 6)));
|
||||
}
|
||||
@ -265,6 +270,7 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
super(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
if (height < SizeConstants.fSquareButtonHeightThreshold || width < SizeConstants.fSquareButtonWidthThreshold) {
|
||||
painter.state.set(Widget.BUTTON_BEVEL);
|
||||
@ -288,13 +294,14 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
super(sizeDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
painter.state.set(model.isSelected() ? BooleanValue.YES : BooleanValue.NO);
|
||||
super.doButtonPaint(b, model, g, x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Toolbar extends AquaButtonBorder {
|
||||
public static final class Toolbar extends AquaButtonBorder {
|
||||
public Toolbar() {
|
||||
super(new SizeDescriptor(new SizeVariant().alterMargins(5, 5, 5, 5)));
|
||||
painter.state.set(Widget.TOOLBAR_ITEM_WELL);
|
||||
@ -304,6 +311,7 @@ public abstract class AquaButtonBorder extends AquaBorder implements Border, UIR
|
||||
super(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int w, final int h) {
|
||||
if (!model.isSelected()) return; // only paint when the toolbar button is selected
|
||||
super.doButtonPaint(b, model, g, x, y, w, h);
|
||||
|
||||
@ -33,7 +33,7 @@ import apple.laf.JRSUIConstants.*;
|
||||
import com.apple.laf.AquaUtilControlSize.*;
|
||||
import com.apple.laf.AquaUtils.*;
|
||||
|
||||
public class AquaButtonCheckBoxUI extends AquaButtonLabeledUI {
|
||||
public final class AquaButtonCheckBoxUI extends AquaButtonLabeledUI {
|
||||
private static final RecyclableSingleton<AquaButtonCheckBoxUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaButtonCheckBoxUI>(AquaButtonCheckBoxUI.class);
|
||||
private static final RecyclableSingleton<ImageIcon> sizingIcon = new RecyclableSingleton<ImageIcon>() {
|
||||
protected ImageIcon getInstance() {
|
||||
@ -49,15 +49,17 @@ public class AquaButtonCheckBoxUI extends AquaButtonLabeledUI {
|
||||
return sizingIcon.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyPrefix() {
|
||||
return "CheckBox" + ".";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AquaButtonBorder getPainter() {
|
||||
return new CheckBoxButtonBorder();
|
||||
}
|
||||
|
||||
public static class CheckBoxButtonBorder extends LabeledButtonBorder {
|
||||
public static final class CheckBoxButtonBorder extends LabeledButtonBorder {
|
||||
public CheckBoxButtonBorder() {
|
||||
super(new SizeDescriptor(new SizeVariant().replaceMargins("CheckBox.margin")));
|
||||
painter.state.set(Widget.BUTTON_CHECK_BOX);
|
||||
|
||||
@ -43,7 +43,7 @@ import static apple.laf.JRSUIConstants.FOCUS_SIZE;
|
||||
* <rdar://problem/4613866> "default font" and sizes for controls in Java Aqua Look and Feel
|
||||
* has been addressed, and we can cull widget metrics from the native system.
|
||||
*/
|
||||
public class AquaButtonExtendedTypes {
|
||||
public final class AquaButtonExtendedTypes {
|
||||
protected static Border getBorderForPosition(final AbstractButton c, final Object type, final Object logicalPosition) {
|
||||
final String name = (logicalPosition == null ? (String)type : type + "-" + getRealPositionForLogicalPosition((String)logicalPosition, c.getComponentOrientation().isLeftToRight()));
|
||||
final TypeSpecifier specifier = getSpecifierByName(name);
|
||||
@ -96,6 +96,7 @@ public class AquaButtonExtendedTypes {
|
||||
patchUp(border.sizeDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
Border getBorder() { return border; }
|
||||
void patchUp(final SizeDescriptor descriptor) {}
|
||||
|
||||
@ -104,7 +105,7 @@ public class AquaButtonExtendedTypes {
|
||||
}
|
||||
}
|
||||
|
||||
static class SegmentedBorderDefinedTypeSpecifier extends BorderDefinedTypeSpecifier {
|
||||
static final class SegmentedBorderDefinedTypeSpecifier extends BorderDefinedTypeSpecifier {
|
||||
public SegmentedBorderDefinedTypeSpecifier(final String name, final Widget widget, final SegmentPosition position, final SizeVariant variant) {
|
||||
this(name, widget, position, variant, 0, 0, 0, 0);
|
||||
}
|
||||
@ -115,12 +116,13 @@ public class AquaButtonExtendedTypes {
|
||||
border.painter.state.set(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
AquaBorder initBorder(final Widget widget, final SizeDescriptor desc) {
|
||||
return new SegmentedNamedBorder(widget, desc);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SegmentedNamedBorder extends AquaButtonBorder.Named {
|
||||
public static final class SegmentedNamedBorder extends AquaButtonBorder.Named {
|
||||
public SegmentedNamedBorder(final SegmentedNamedBorder sizeDescriptor) {
|
||||
super(sizeDescriptor);
|
||||
}
|
||||
@ -129,6 +131,7 @@ public class AquaButtonExtendedTypes {
|
||||
super(widget, sizeDescriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSelectionPressing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -46,10 +46,11 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements
|
||||
private static final RecyclableSizingIcon smallIcon = new RecyclableSizingIcon(16);
|
||||
private static final RecyclableSizingIcon miniIcon = new RecyclableSizingIcon(14);
|
||||
|
||||
protected static class RecyclableSizingIcon extends RecyclableSingleton<Icon> {
|
||||
protected static final class RecyclableSizingIcon extends RecyclableSingleton<Icon> {
|
||||
final int iconSize;
|
||||
public RecyclableSizingIcon(final int iconSize) { this.iconSize = iconSize; }
|
||||
|
||||
@Override
|
||||
protected Icon getInstance() {
|
||||
return new ImageIcon(new BufferedImage(iconSize, iconSize, BufferedImage.TYPE_INT_ARGB_PRE));
|
||||
}
|
||||
@ -61,6 +62,7 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements
|
||||
widgetBorder = getPainter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySizeFor(final JComponent c, final Size newSize) {
|
||||
super.applySizeFor(c, newSize);
|
||||
widgetBorder = (AquaButtonBorder)widgetBorder.deriveBorderForSize(newSize);
|
||||
@ -74,6 +76,7 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements
|
||||
return regularIcon.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setThemeBorder(final AbstractButton b) {
|
||||
super.setThemeBorder(b);
|
||||
|
||||
@ -86,6 +89,7 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements
|
||||
|
||||
protected abstract AquaButtonBorder getPainter();
|
||||
|
||||
@Override
|
||||
public synchronized void paint(final Graphics g, final JComponent c) {
|
||||
final AbstractButton b = (AbstractButton)c;
|
||||
final ButtonModel model = b.getModel();
|
||||
@ -192,6 +196,7 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements
|
||||
/**
|
||||
* The preferred size of the button
|
||||
*/
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
if (c.getComponentCount() > 0) { return null; }
|
||||
|
||||
@ -244,12 +249,14 @@ public abstract class AquaButtonLabeledUI extends AquaButtonToggleUI implements
|
||||
return painter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doButtonPaint(final AbstractButton b, final ButtonModel model, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
painter.state.set(AquaUtilControlSize.getUserSizeFrom(b));
|
||||
((ValueState)painter.state).setValue(model.isSelected() ? isIndeterminate(b) ? 2 : 1 : 0); // 2=mixed, 1=on, 0=off
|
||||
super.doButtonPaint(b, model, g, x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State getButtonState(final AbstractButton b, final ButtonModel model) {
|
||||
final State state = super.getButtonState(b, model);
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Enumeration;
|
||||
|
||||
public class AquaButtonRadioUI extends AquaButtonLabeledUI {
|
||||
public final class AquaButtonRadioUI extends AquaButtonLabeledUI {
|
||||
|
||||
private static final RecyclableSingleton<AquaButtonRadioUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaButtonRadioUI>(AquaButtonRadioUI.class);
|
||||
private static final RecyclableSingleton<ImageIcon> sizingIcon = new RecyclableSingleton<ImageIcon>() {
|
||||
@ -72,15 +72,17 @@ public class AquaButtonRadioUI extends AquaButtonLabeledUI {
|
||||
return sizingIcon.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPropertyPrefix() {
|
||||
return "RadioButton" + ".";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AquaButtonBorder getPainter() {
|
||||
return new RadioButtonBorder();
|
||||
}
|
||||
|
||||
public static class RadioButtonBorder extends LabeledButtonBorder {
|
||||
public static final class RadioButtonBorder extends LabeledButtonBorder {
|
||||
public RadioButtonBorder() {
|
||||
super(new SizeDescriptor(new SizeVariant().replaceMargins("RadioButton.margin")));
|
||||
painter.state.set(Widget.BUTTON_RADIO);
|
||||
|
||||
@ -37,6 +37,7 @@ public class AquaButtonToggleUI extends AquaButtonUI {
|
||||
return aquaToggleButtonUI.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPropertyPrefix() {
|
||||
return "ToggleButton" + ".";
|
||||
}
|
||||
|
||||
@ -89,6 +89,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
private boolean defaults_initialized = false;
|
||||
private Color defaultDisabledTextColor = null;
|
||||
|
||||
@Override
|
||||
protected void installDefaults(final AbstractButton b) {
|
||||
// load shared instance defaults
|
||||
final String pp = getPropertyPrefix();
|
||||
@ -120,6 +121,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySizeFor(final JComponent c, final Size size) {
|
||||
// this space intentionally left blank
|
||||
// (subclasses need to do work here)
|
||||
@ -216,6 +218,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners(final AbstractButton b) {
|
||||
super.installListeners(b);
|
||||
AquaButtonListener listener = getAquaButtonListener(b);
|
||||
@ -228,12 +231,14 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
AquaUtilControlSize.addSizePropertyListener(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installKeyboardActions(final AbstractButton b) {
|
||||
final BasicButtonListener listener = (BasicButtonListener)b.getClientProperty(this);
|
||||
if (listener != null) listener.installKeyboardActions(b);
|
||||
}
|
||||
|
||||
// Uninstall PLAF
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
uninstallKeyboardActions((AbstractButton)c);
|
||||
uninstallListeners((AbstractButton)c);
|
||||
@ -241,11 +246,13 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
//BasicHTML.updateRenderer(c, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallKeyboardActions(final AbstractButton b) {
|
||||
final BasicButtonListener listener = (BasicButtonListener)b.getClientProperty(this);
|
||||
if (listener != null) listener.uninstallKeyboardActions(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners(final AbstractButton b) {
|
||||
super.uninstallListeners(b);
|
||||
b.putClientProperty(this, null);
|
||||
@ -253,12 +260,14 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
AquaUtilControlSize.removeSizePropertyListener(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults(final AbstractButton b) {
|
||||
LookAndFeel.uninstallBorder(b);
|
||||
defaults_initialized = false;
|
||||
}
|
||||
|
||||
// Create Listeners
|
||||
@Override
|
||||
protected AquaButtonListener createButtonListener(final AbstractButton b) {
|
||||
return new AquaButtonListener(b);
|
||||
}
|
||||
@ -281,6 +290,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
}
|
||||
|
||||
// Paint Methods
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
final AbstractButton b = (AbstractButton)c;
|
||||
final ButtonModel model = b.getModel();
|
||||
@ -352,6 +362,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintFocus(Graphics g, AbstractButton b,
|
||||
Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
|
||||
Graphics2D g2d = null;
|
||||
@ -479,6 +490,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
* As of Java 2 platform v 1.4 this method should not be used or overridden.
|
||||
* Use the paintText method which takes the AbstractButton argument.
|
||||
*/
|
||||
@Override
|
||||
protected void paintText(final Graphics g, final JComponent c, final Rectangle localTextRect, final String text) {
|
||||
final AbstractButton b = (AbstractButton)c;
|
||||
final ButtonModel model = b.getModel();
|
||||
@ -496,15 +508,18 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemonicIndex, localTextRect.x, localTextRect.y + fm.getAscent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintText(final Graphics g, final AbstractButton b, final Rectangle localTextRect, final String text) {
|
||||
paintText(g, (JComponent)b, localTextRect, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintButtonPressed(final Graphics g, final AbstractButton b) {
|
||||
paint(g, b);
|
||||
}
|
||||
|
||||
// Layout Methods
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
final Dimension d = getPreferredSize(c);
|
||||
final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
|
||||
@ -514,6 +529,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
final AbstractButton b = (AbstractButton)c;
|
||||
|
||||
@ -529,6 +545,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(final JComponent c) {
|
||||
final Dimension d = getPreferredSize(c);
|
||||
|
||||
@ -565,9 +582,10 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
}
|
||||
}
|
||||
|
||||
static class AquaHierarchyButtonListener implements HierarchyListener {
|
||||
static final class AquaHierarchyButtonListener implements HierarchyListener {
|
||||
// Every time a hierarchy is changed we need to check if the button is moved on or from
|
||||
// the toolbar. If that is the case, we need to re-set the border of the button.
|
||||
@Override
|
||||
public void hierarchyChanged(final HierarchyEvent e) {
|
||||
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) == 0) return;
|
||||
|
||||
@ -583,7 +601,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
}
|
||||
}
|
||||
|
||||
class AquaButtonListener extends BasicButtonListener {
|
||||
final class AquaButtonListener extends BasicButtonListener {
|
||||
protected final AbstractButton b;
|
||||
|
||||
public AquaButtonListener(final AbstractButton b) {
|
||||
@ -591,10 +609,12 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
((Component)e.getSource()).repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
// 10-06-03 VL: [Radar 3187049]
|
||||
// If focusLost arrives while the button has been left-clicked this would disarm the button,
|
||||
@ -604,6 +624,7 @@ public class AquaButtonUI extends BasicButtonUI implements Sizeable {
|
||||
((Component)e.getSource()).repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
super.propertyChange(e);
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ import javax.swing.text.JTextComponent;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public class AquaCaret extends DefaultCaret
|
||||
public final class AquaCaret extends DefaultCaret
|
||||
implements UIResource, PropertyChangeListener {
|
||||
|
||||
private boolean isMultiLineEditor;
|
||||
|
||||
@ -53,7 +53,7 @@ import apple.laf.JRSUIConstants.Widget;
|
||||
import apple.laf.JRSUIState;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaComboBoxButton extends JButton {
|
||||
final class AquaComboBoxButton extends JButton {
|
||||
protected final JComboBox<Object> comboBox;
|
||||
protected final JList<?> list;
|
||||
protected final CellRendererPane rendererPane;
|
||||
|
||||
@ -29,7 +29,7 @@ import javax.swing.*;
|
||||
import javax.swing.plaf.UIResource;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaComboBoxRenderer extends AquaComboBoxRendererInternal<Object> implements UIResource {
|
||||
final class AquaComboBoxRenderer extends AquaComboBoxRendererInternal<Object> implements UIResource {
|
||||
public AquaComboBoxRenderer(final JComboBox<?> comboBox) {
|
||||
super(comboBox);
|
||||
}
|
||||
|
||||
@ -47,6 +47,7 @@ class AquaComboBoxRendererInternal<E> extends JLabel implements ListCellRenderer
|
||||
|
||||
// Don't include checkIcon space, because this is also used for button size calculations
|
||||
// - the popup-size calc will get checkIcon space from getInsets
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
// From BasicComboBoxRenderer - trick to avoid zero-height items
|
||||
final Dimension size;
|
||||
@ -63,15 +64,18 @@ class AquaComboBoxRendererInternal<E> extends JLabel implements ListCellRenderer
|
||||
}
|
||||
|
||||
// Don't paint the border here, it gets painted by the UI
|
||||
@Override
|
||||
protected void paintBorder(final Graphics g) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBaseline(int width, int height) {
|
||||
return super.getBaseline(width, height) - 1;
|
||||
}
|
||||
|
||||
// Really means is the one with the mouse over it
|
||||
@Override
|
||||
public Component getListCellRendererComponent(final JList<? extends E> list,
|
||||
final E value, int index,
|
||||
final boolean isSelected,
|
||||
@ -127,6 +131,7 @@ class AquaComboBoxRendererInternal<E> extends JLabel implements ListCellRenderer
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getInsets(Insets insets) {
|
||||
if (insets == null) insets = new Insets(0, 0, 0, 0);
|
||||
insets.top = 1;
|
||||
@ -141,6 +146,7 @@ class AquaComboBoxRendererInternal<E> extends JLabel implements ListCellRenderer
|
||||
}
|
||||
|
||||
// Paint this component, and a checkbox if it's the selected item and not in the button
|
||||
@Override
|
||||
protected void paintComponent(final Graphics g) {
|
||||
if (fInList) {
|
||||
if (fSelected && !fEditable) {
|
||||
|
||||
@ -76,7 +76,7 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.ClientPropertyApplicator.Property;
|
||||
|
||||
// Inspired by MetalComboBoxUI, which also has a combined text-and-arrow button for noneditables
|
||||
public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
public final class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
static final String POPDOWN_CLIENT_PROPERTY_KEY = "JComboBox.isPopDown";
|
||||
static final String ISSQUARE_CLIENT_PROPERTY_KEY = "JComboBox.isSquare";
|
||||
|
||||
@ -85,6 +85,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
}
|
||||
|
||||
private boolean wasOpaque;
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
super.installUI(c);
|
||||
|
||||
@ -96,21 +97,25 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
c.setOpaque(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
c.setOpaque(wasOpaque);
|
||||
super.uninstallUI(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
AquaUtilControlSize.addSizePropertyListener(comboBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
AquaUtilControlSize.removeSizePropertyListener(comboBox);
|
||||
super.uninstallListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installComponents() {
|
||||
super.installComponents();
|
||||
|
||||
@ -119,6 +124,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
getApplicator().attachAndApplyClientProperties(comboBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallComponents() {
|
||||
getApplicator().removeFrom(comboBox);
|
||||
// AquaButtonUI install some listeners to all parents, which means that
|
||||
@ -129,6 +135,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
super.uninstallComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemListener createItemListener() {
|
||||
return new ItemListener() {
|
||||
long lastBlink = 0L;
|
||||
@ -161,22 +168,27 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
// this space intentionally left blank
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListCellRenderer<Object> createRenderer() {
|
||||
return new AquaComboBoxRenderer(comboBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ComboPopup createPopup() {
|
||||
return new AquaComboBoxPopup(comboBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JButton createArrowButton() {
|
||||
return new AquaComboBoxButton(this, comboBox, currentValuePane, listBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ComboBoxEditor createEditor() {
|
||||
return new AquaComboBoxEditor();
|
||||
}
|
||||
@ -229,7 +241,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaCustomComboTextField extends JTextField {
|
||||
final class AquaCustomComboTextField extends JTextField {
|
||||
public AquaCustomComboTextField() {
|
||||
final InputMap inputMap = getInputMap();
|
||||
inputMap.put(KeyStroke.getKeyStroke("DOWN"), highlightNextAction);
|
||||
@ -258,6 +270,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
}
|
||||
|
||||
// workaround for 4530952
|
||||
@Override
|
||||
public void setText(final String s) {
|
||||
if (getText().equals(s)) {
|
||||
return;
|
||||
@ -274,6 +287,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
* around a Solaris-only bug that we don't have on Mac OS X. So, remove the lightweight
|
||||
* popup check here. rdar://Problem/3518582
|
||||
*/
|
||||
@Override
|
||||
protected FocusListener createFocusListener() {
|
||||
return new BasicComboBoxUI.FocusHandler() {
|
||||
@Override
|
||||
@ -306,6 +320,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installKeyboardActions() {
|
||||
super.installKeyboardActions();
|
||||
|
||||
@ -330,6 +345,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private abstract class ComboBoxAction extends AbstractAction {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (!comboBox.isEnabled() || !comboBox.isShowing()) {
|
||||
return;
|
||||
@ -443,11 +459,12 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
return popup;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayoutManager createLayoutManager() {
|
||||
return new AquaComboBoxLayoutManager();
|
||||
}
|
||||
|
||||
class AquaComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
|
||||
final class AquaComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
|
||||
protected Rectangle rectangleForCurrentValue() {
|
||||
int width = comboBox.getWidth();
|
||||
int height = comboBox.getBorder() == null ? 22 : comboBox.getHeight();
|
||||
@ -473,6 +490,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutContainer(final Container parent) {
|
||||
if (arrowButton != null && !comboBox.isEditable()) {
|
||||
final Insets insets = comboBox.getInsets();
|
||||
@ -615,6 +633,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void applySizeFor(final JComponent c, final Size size) {
|
||||
if (arrowButton == null) return;
|
||||
final Border border = arrowButton.getBorder();
|
||||
@ -623,6 +642,7 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
|
||||
arrowButton.setBorder(aquaBorder.deriveBorderForSize(size));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
if (!isMinimumSizeDirty) {
|
||||
return new Dimension(cachedMinimumSize);
|
||||
|
||||
@ -33,7 +33,7 @@ import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicEditorPaneUI;
|
||||
import javax.swing.text.*;
|
||||
|
||||
public class AquaEditorPaneUI extends BasicEditorPaneUI {
|
||||
public final class AquaEditorPaneUI extends BasicEditorPaneUI {
|
||||
public static ComponentUI createUI(final JComponent c){
|
||||
return new AquaEditorPaneUI();
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ import javax.swing.table.TableColumnModel;
|
||||
|
||||
import sun.swing.SwingUtilities2;
|
||||
|
||||
public class AquaFileChooserUI extends FileChooserUI {
|
||||
public final class AquaFileChooserUI extends FileChooserUI {
|
||||
/* FileView icons */
|
||||
protected Icon directoryIcon = null;
|
||||
protected Icon fileIcon = null;
|
||||
@ -204,6 +204,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
accessoryPanel = new JPanel(new BorderLayout());
|
||||
filechooser = (JFileChooser)c;
|
||||
@ -217,6 +218,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
AquaUtils.enforceComponentOrientation(filechooser, ComponentOrientation.getOrientation(Locale.getDefault()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
uninstallListeners(filechooser);
|
||||
uninstallComponents(filechooser);
|
||||
@ -564,11 +566,13 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// PENDING(jeff) - set the name in the directory combobox
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rescanCurrentDirectory(final JFileChooser fc) {
|
||||
getModel().invalidateFileCache();
|
||||
getModel().validateFileCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ensureFileIsVisible(final JFileChooser fc, final File f) {
|
||||
if (f == null) {
|
||||
fFileList.requestFocusInWindow();
|
||||
@ -609,6 +613,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return fSubPanel.getApproveButtonToolTipText(fc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getApproveButtonText(final JFileChooser fc) {
|
||||
return fSubPanel.getApproveButtonText(fc);
|
||||
}
|
||||
@ -642,7 +647,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return new SelectionListener();
|
||||
}
|
||||
|
||||
protected class SelectionListener implements ListSelectionListener {
|
||||
protected final class SelectionListener implements ListSelectionListener {
|
||||
@Override
|
||||
public void valueChanged(final ListSelectionEvent e) {
|
||||
if (e.getValueIsAdjusting()) return;
|
||||
|
||||
@ -689,12 +695,14 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
// When the Save textfield has the focus, the button should say "Save"
|
||||
// Otherwise, it depends on the list selection
|
||||
protected class SaveTextFocusListener implements FocusListener {
|
||||
protected final class SaveTextFocusListener implements FocusListener {
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
updateButtonState(getFileChooser());
|
||||
}
|
||||
|
||||
// Do nothing, we might be losing focus due to window deactivation
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
|
||||
}
|
||||
@ -702,15 +710,18 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
// When the Save textfield is empty and the button says "Save", it should be disabled
|
||||
// Otherwise, it depends on the list selection
|
||||
protected class SaveTextDocumentListener implements DocumentListener {
|
||||
protected final class SaveTextDocumentListener implements DocumentListener {
|
||||
@Override
|
||||
public void insertUpdate(final DocumentEvent e) {
|
||||
textChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(final DocumentEvent e) {
|
||||
textChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(final DocumentEvent e) {
|
||||
|
||||
}
|
||||
@ -734,13 +745,14 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// From Basic
|
||||
protected class DoubleClickListener extends MouseAdapter {
|
||||
protected final class DoubleClickListener extends MouseAdapter {
|
||||
JTableExtension list;
|
||||
|
||||
public DoubleClickListener(final JTableExtension list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
if (e.getClickCount() != 2) return;
|
||||
|
||||
@ -764,19 +776,23 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// listens for drag events onto the JFileChooser and sets the selected file or directory
|
||||
class DnDHandler extends DropTargetAdapter {
|
||||
final class DnDHandler extends DropTargetAdapter {
|
||||
@Override
|
||||
public void dragEnter(final DropTargetDragEvent dtde) {
|
||||
tryToAcceptDrag(dtde);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dragOver(final DropTargetDragEvent dtde) {
|
||||
tryToAcceptDrag(dtde);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropActionChanged(final DropTargetDragEvent dtde) {
|
||||
tryToAcceptDrag(dtde);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drop(final DropTargetDropEvent dtde) {
|
||||
if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
|
||||
handleFileDropEvent(dtde);
|
||||
@ -884,10 +900,12 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
/**
|
||||
* Returns the default accept all file filter
|
||||
*/
|
||||
@Override
|
||||
public FileFilter getAcceptAllFileFilter(final JFileChooser fc) {
|
||||
return acceptAllFileFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileView getFileView(final JFileChooser fc) {
|
||||
return fileView;
|
||||
}
|
||||
@ -895,6 +913,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
/**
|
||||
* Returns the title of this dialog
|
||||
*/
|
||||
@Override
|
||||
public String getDialogTitle(final JFileChooser fc) {
|
||||
if (fc.getDialogTitle() == null) {
|
||||
if (getFileChooser().getDialogType() == JFileChooser.OPEN_DIALOG) {
|
||||
@ -938,7 +957,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// Action to attach to the file list so we can override the default action
|
||||
// of the table for the return key, which is to select the next line.
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class DefaultButtonAction extends AbstractAction {
|
||||
protected final class DefaultButtonAction extends AbstractAction {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JRootPane root = AquaFileChooserUI.this.getFileChooser().getRootPane();
|
||||
final JFileChooser fc = AquaFileChooserUI.this.getFileChooser();
|
||||
@ -956,6 +976,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
@ -965,7 +986,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Creates a new folder.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class NewFolderAction extends AbstractAction {
|
||||
protected final class NewFolderAction extends AbstractAction {
|
||||
protected NewFolderAction() {
|
||||
super(newFolderAccessibleName);
|
||||
}
|
||||
@ -992,6 +1013,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return pane.getInputValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JFileChooser fc = getFileChooser();
|
||||
final File currentDirectory = fc.getCurrentDirectory();
|
||||
@ -1028,7 +1050,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Responds to an Open, Save, or Choose request
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class ApproveSelectionAction extends AbstractAction {
|
||||
protected final class ApproveSelectionAction extends AbstractAction {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
fSubPanel.approveSelection(getFileChooser());
|
||||
}
|
||||
@ -1038,7 +1061,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Responds to an OpenDirectory request
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class OpenSelectionAction extends AbstractAction {
|
||||
protected final class OpenSelectionAction extends AbstractAction {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final int index = fFileList.getSelectedRow();
|
||||
if (index >= 0) {
|
||||
@ -1052,11 +1076,13 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Responds to a cancel request.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class CancelSelectionAction extends AbstractAction {
|
||||
protected final class CancelSelectionAction extends AbstractAction {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
getFileChooser().cancelSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return getFileChooser().isEnabled();
|
||||
}
|
||||
@ -1066,7 +1092,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Rescans the files in the current directory
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class UpdateAction extends AbstractAction {
|
||||
protected final class UpdateAction extends AbstractAction {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JFileChooser fc = getFileChooser();
|
||||
fc.setCurrentDirectory(fc.getFileSystemView().createFileObject(getDirectoryName()));
|
||||
@ -1077,14 +1104,16 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// *****************************************
|
||||
// ***** default AcceptAll file filter *****
|
||||
// *****************************************
|
||||
private static class AcceptAllFileFilter extends FileFilter {
|
||||
private static final class AcceptAllFileFilter extends FileFilter {
|
||||
public AcceptAllFileFilter() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(final File f) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return UIManager.getString("FileChooser.acceptAllFileFilterText");
|
||||
}
|
||||
@ -1101,6 +1130,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
setIconTextGap(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(final JTable list, final Object value, final boolean isSelected, final boolean cellHasFocus, final int index, final int col) {
|
||||
super.getTableCellRendererComponent(list, value, isSelected, false, index, col); // No focus border, thanks
|
||||
fIsSelected = isSelected;
|
||||
@ -1115,6 +1145,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return SwingUtilities.layoutCompoundLabel(label, fontMetrics, text, icon, label.getVerticalAlignment(), label.getHorizontalAlignment(), label.getVerticalTextPosition(), label.getHorizontalTextPosition(), viewR, iconR, textR, label.getIconTextGap());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(final Graphics g) {
|
||||
final String text = getText();
|
||||
Icon icon = getIcon();
|
||||
@ -1173,11 +1204,12 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class FileRenderer extends MacFCTableCellRenderer {
|
||||
protected final class FileRenderer extends MacFCTableCellRenderer {
|
||||
public FileRenderer(final Font f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(final JTable list,
|
||||
final Object value,
|
||||
final boolean isSelected,
|
||||
@ -1200,11 +1232,12 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class DateRenderer extends MacFCTableCellRenderer {
|
||||
protected final class DateRenderer extends MacFCTableCellRenderer {
|
||||
public DateRenderer(final Font f) {
|
||||
super(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(final JTable list,
|
||||
final Object value,
|
||||
final boolean isSelected,
|
||||
@ -1278,7 +1311,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Data model for a type-face selection combo-box.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
|
||||
protected final class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
|
||||
Vector<File> fDirectories = new Vector<File>();
|
||||
int topIndex = -1;
|
||||
int fPathCount = 0;
|
||||
@ -1340,19 +1373,23 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// dump();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(final Object selectedDirectory) {
|
||||
this.fSelectedDirectory = (File)selectedDirectory;
|
||||
fireContentsChanged(this, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSelectedItem() {
|
||||
return fSelectedDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return fDirectories.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getElementAt(final int index) {
|
||||
return fDirectories.elementAt(index);
|
||||
}
|
||||
@ -1386,7 +1423,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Data model for a type-face selection combo-box.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
|
||||
protected final class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
|
||||
PropertyChangeListener {
|
||||
protected FileFilter[] filters;
|
||||
Object oldFileFilter = getFileChooser().getFileFilter();
|
||||
@ -1396,6 +1433,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
filters = getFileChooser().getChoosableFileFilters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
String prop = e.getPropertyName();
|
||||
if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
|
||||
@ -1406,6 +1444,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object filter) {
|
||||
if (filter != null && !isSelectedFileFilterInModel(filter)) {
|
||||
oldFileFilter = filter;
|
||||
@ -1418,6 +1457,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return Objects.equals(filter, oldFileFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSelectedItem() {
|
||||
// Ensure that the current filter is in the list.
|
||||
// NOTE: we shouldn't have to do this, since JFileChooser adds
|
||||
@ -1439,6 +1479,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return getFileChooser().getFileFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if(filters != null) {
|
||||
return filters.length;
|
||||
@ -1447,6 +1488,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileFilter getElementAt(int index) {
|
||||
if(index > getSize() - 1) {
|
||||
// This shouldn't happen. Try to recover gracefully.
|
||||
@ -1468,11 +1510,12 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Acts when FilterComboBox has changed the selected item.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class FilterComboBoxAction extends AbstractAction {
|
||||
protected final class FilterComboBoxAction extends AbstractAction {
|
||||
protected FilterComboBoxAction() {
|
||||
super("FilterComboBoxAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
Object selectedFilter = filterComboBox.getSelectedItem();
|
||||
if (!containsFileFilter(selectedFilter)) {
|
||||
@ -1485,11 +1528,12 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
* Acts when DirectoryComboBox has changed the selected item.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class DirectoryComboBoxAction extends AbstractAction {
|
||||
protected final class DirectoryComboBoxAction extends AbstractAction {
|
||||
protected DirectoryComboBoxAction() {
|
||||
super("DirectoryComboBoxAction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
getFileChooser().setCurrentDirectory((File)directoryComboBox.getSelectedItem());
|
||||
}
|
||||
@ -1497,7 +1541,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
// Sorting Table operations
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class JSortingTableHeader extends JTableHeader {
|
||||
final class JSortingTableHeader extends JTableHeader {
|
||||
public JSortingTableHeader(final TableColumnModel cm) {
|
||||
super(cm);
|
||||
setReorderingAllowed(true); // This causes mousePress to call setDraggedColumn
|
||||
@ -1507,6 +1551,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
final boolean[] fSortAscending = {true, true};
|
||||
|
||||
// Instead of dragging, it selects which one to sort by
|
||||
@Override
|
||||
public void setDraggedColumn(final TableColumn aColumn) {
|
||||
if (!getFileChooser().isEnabled()) {
|
||||
return;
|
||||
@ -1526,10 +1571,12 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// This stops mouseDrags from moving the column
|
||||
@Override
|
||||
public TableColumn getDraggedColumn() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TableCellRenderer createDefaultRenderer() {
|
||||
final DefaultTableCellRenderer label = new AquaTableCellRenderer();
|
||||
label.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
@ -1537,7 +1584,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaTableCellRenderer extends DefaultTableCellRenderer implements UIResource {
|
||||
final class AquaTableCellRenderer extends DefaultTableCellRenderer implements UIResource {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(final JTable localTable, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
|
||||
if (localTable != null) {
|
||||
final JTableHeader header = localTable.getTableHeader();
|
||||
@ -1841,7 +1889,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
// Consistent with the AppKit NSSavePanel, clicks on a file (not a directory) should populate the text field
|
||||
// with that file's display name.
|
||||
protected class FileListMouseListener extends MouseAdapter {
|
||||
protected final class FileListMouseListener extends MouseAdapter {
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
final Point p = e.getPoint();
|
||||
final int row = fFileList.rowAtPoint(p);
|
||||
@ -1917,9 +1966,10 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
protected class ScrollPaneCornerPanel extends JPanel {
|
||||
protected final class ScrollPaneCornerPanel extends JPanel {
|
||||
final Border border = UIManager.getBorder("TableHeader.cellBorder");
|
||||
|
||||
@Override
|
||||
protected void paintComponent(final Graphics g) {
|
||||
border.paintBorder(this, g, 0, 0, getWidth() + 1, getHeight());
|
||||
}
|
||||
@ -2095,6 +2145,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
List - everything is enabled
|
||||
*/
|
||||
class CustomFilePanel extends FCSubpanel {
|
||||
@Override
|
||||
void installPanel(final JFileChooser fc, final boolean controlButtonsAreShown) {
|
||||
fTextfieldPanel.setVisible(true); // do we really want one in multi-select? It's confusing
|
||||
fOpenButton.setVisible(false);
|
||||
@ -2113,6 +2164,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// The approve button is overloaded to mean OpenDirectory or Save
|
||||
@Override
|
||||
void approveSelection(final JFileChooser fc) {
|
||||
File f = getFirstSelectedItem();
|
||||
if (inOpenDirectoryMode(fc, f)) {
|
||||
@ -2131,6 +2183,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// The approve button should be enabled
|
||||
// - if something in the list can be opened
|
||||
// - if the textfield has something in it
|
||||
@Override
|
||||
void updateButtonState(final JFileChooser fc, final File f) {
|
||||
boolean enabled = true;
|
||||
if (!inOpenDirectoryMode(fc, f)) {
|
||||
@ -2146,11 +2199,13 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// everything's enabled, because we don't know what they're doing with them
|
||||
@Override
|
||||
boolean isSelectableInList(final JFileChooser fc, final File f) {
|
||||
if (f == null) return false;
|
||||
return fc.accept(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getApproveButtonToolTipText(final JFileChooser fc) {
|
||||
// The approve Button should have openDirectoryButtonToolTipText when the selection is a folder...
|
||||
if (inOpenDirectoryMode(fc, getFirstSelectedItem())) return openDirectoryButtonToolTipText;
|
||||
@ -2170,7 +2225,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
List is always SINGLE_SELECT
|
||||
*/
|
||||
// Subclasses CustomFilePanel because they look alike and have some common behavior
|
||||
class SaveFilePanel extends CustomFilePanel {
|
||||
final class SaveFilePanel extends CustomFilePanel {
|
||||
@Override
|
||||
void installPanel(final JFileChooser fc, final boolean controlButtonsAreShown) {
|
||||
fTextfieldPanel.setVisible(true);
|
||||
fOpenButton.setVisible(false);
|
||||
@ -2179,11 +2235,13 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
// only traversables are enabled, regardless of mode
|
||||
// because all you can do is select the next folder to open
|
||||
@Override
|
||||
boolean isSelectableInList(final JFileChooser fc, final File f) {
|
||||
return fc.accept(f) && fc.isTraversable(f);
|
||||
}
|
||||
|
||||
// The approve button means 'approve the file name in the text field.'
|
||||
@Override
|
||||
void approveSelection(final JFileChooser fc) {
|
||||
final File f = makeFile(fc, getFileName());
|
||||
if (f != null) {
|
||||
@ -2195,26 +2253,31 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// The approve button should be enabled if the textfield has something in it
|
||||
@Override
|
||||
void updateButtonState(final JFileChooser fc, final File f) {
|
||||
final boolean enabled = textfieldIsValid();
|
||||
getApproveButton(fc).setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getApproveButtonText(final JFileChooser fc) {
|
||||
// Get the custom text, or fallback to "Save"
|
||||
return this.getApproveButtonText(fc, saveButtonText);
|
||||
}
|
||||
|
||||
@Override
|
||||
int getApproveButtonMnemonic(final JFileChooser fc) {
|
||||
return saveButtonMnemonic;
|
||||
}
|
||||
|
||||
@Override
|
||||
String getApproveButtonToolTipText(final JFileChooser fc) {
|
||||
// The approve Button should have openDirectoryButtonToolTipText when the selection is a folder...
|
||||
if (inOpenDirectoryMode(fc, getFirstSelectedItem())) return openDirectoryButtonToolTipText;
|
||||
return this.getApproveButtonToolTipText(fc, saveButtonToolTipText);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getCancelButtonToolTipText(final JFileChooser fc) {
|
||||
return cancelSaveButtonToolTipText;
|
||||
}
|
||||
@ -2229,7 +2292,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
No NewFolder button
|
||||
List - all items are enabled
|
||||
*/
|
||||
class OpenFilePanel extends FCSubpanel {
|
||||
final class OpenFilePanel extends FCSubpanel {
|
||||
@Override
|
||||
void installPanel(final JFileChooser fc, final boolean controlButtonsAreShown) {
|
||||
fTextfieldPanel.setVisible(false);
|
||||
fOpenButton.setVisible(false);
|
||||
@ -2242,10 +2306,12 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// Default to the list
|
||||
@Override
|
||||
JComponent getFocusComponent(final JFileChooser fc) {
|
||||
return fFileList;
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateButtonState(final JFileChooser fc, final File f) {
|
||||
// Button is disabled if there's nothing selected
|
||||
final boolean enabled = (f != null) && !fc.isTraversable(f);
|
||||
@ -2253,23 +2319,28 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// all items are enabled
|
||||
@Override
|
||||
boolean isSelectableInList(final JFileChooser fc, final File f) {
|
||||
return f != null && fc.accept(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getApproveButtonText(final JFileChooser fc) {
|
||||
// Get the custom text, or fallback to "Open"
|
||||
return this.getApproveButtonText(fc, openButtonText);
|
||||
}
|
||||
|
||||
@Override
|
||||
int getApproveButtonMnemonic(final JFileChooser fc) {
|
||||
return openButtonMnemonic;
|
||||
}
|
||||
|
||||
@Override
|
||||
String getApproveButtonToolTipText(final JFileChooser fc) {
|
||||
return this.getApproveButtonToolTipText(fc, openButtonToolTipText);
|
||||
}
|
||||
|
||||
@Override
|
||||
String getCancelButtonToolTipText(final JFileChooser fc) {
|
||||
return cancelOpenButtonToolTipText;
|
||||
}
|
||||
@ -2277,14 +2348,17 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
// used by open and custom panels for Directory only or files and directories
|
||||
abstract class DirOrAnyPanel extends FCSubpanel {
|
||||
@Override
|
||||
void installPanel(final JFileChooser fc, final boolean controlButtonsAreShown) {
|
||||
fOpenButton.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
JButton getDefaultButton(final JFileChooser fc) {
|
||||
return getApproveButton(fc);
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateButtonState(final JFileChooser fc, final File f) {
|
||||
// Button is disabled if there's nothing selected
|
||||
// Approve button is handled by the subclasses
|
||||
@ -2307,7 +2381,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
No text field
|
||||
List - files are disabled in DIRECTORIES_ONLY
|
||||
*/
|
||||
class OpenDirOrAnyPanel extends DirOrAnyPanel {
|
||||
final class OpenDirOrAnyPanel extends DirOrAnyPanel {
|
||||
@Override
|
||||
void installPanel(final JFileChooser fc, final boolean controlButtonsAreShown) {
|
||||
super.installPanel(fc, controlButtonsAreShown);
|
||||
fTextfieldPanel.setVisible(false);
|
||||
@ -2315,14 +2390,17 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// Default to the list
|
||||
@Override
|
||||
JComponent getFocusComponent(final JFileChooser fc) {
|
||||
return fFileList;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getApproveButtonMnemonic(final JFileChooser fc) {
|
||||
return chooseButtonMnemonic;
|
||||
}
|
||||
|
||||
@Override
|
||||
String getApproveButtonToolTipText(final JFileChooser fc) {
|
||||
String fallbackText;
|
||||
if (fc.getFileSelectionMode() == JFileChooser.DIRECTORIES_ONLY) fallbackText = chooseFolderButtonToolTipText;
|
||||
@ -2330,6 +2408,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
return this.getApproveButtonToolTipText(fc, fallbackText);
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateButtonState(final JFileChooser fc, final File f) {
|
||||
// Button is disabled if there's nothing selected
|
||||
getApproveButton(fc).setEnabled(f != null);
|
||||
@ -2347,7 +2426,8 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
Has NewFolder button (by text field)
|
||||
List - files are disabled in DIRECTORIES_ONLY
|
||||
*/
|
||||
class CustomDirOrAnyPanel extends DirOrAnyPanel {
|
||||
final class CustomDirOrAnyPanel extends DirOrAnyPanel {
|
||||
@Override
|
||||
void installPanel(final JFileChooser fc, final boolean controlButtonsAreShown) {
|
||||
super.installPanel(fc, controlButtonsAreShown);
|
||||
fTextfieldPanel.setVisible(true);
|
||||
@ -2355,6 +2435,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
|
||||
// If there's text, make a file and select it
|
||||
@Override
|
||||
void approveSelection(final JFileChooser fc) {
|
||||
final File f = makeFile(fc, getFileName());
|
||||
if (f != null) {
|
||||
@ -2365,6 +2446,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
getFileChooser().approveSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateButtonState(final JFileChooser fc, final File f) {
|
||||
// Button is disabled if there's nothing selected
|
||||
getApproveButton(fc).setEnabled(f != null || textfieldIsValid());
|
||||
@ -2374,7 +2456,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
|
||||
// See FileRenderer - documents in Save dialogs draw disabled, so they shouldn't be selected
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class MacListSelectionModel extends DefaultListSelectionModel {
|
||||
final class MacListSelectionModel extends DefaultListSelectionModel {
|
||||
AquaFileSystemModel fModel;
|
||||
|
||||
MacListSelectionModel(final AquaFileSystemModel model) {
|
||||
@ -2427,14 +2509,17 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
} while (start <= index1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnchorSelectionIndex(final int anchorIndex) {
|
||||
if (isSelectableInListIndex(anchorIndex)) super.setAnchorSelectionIndex(anchorIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLeadSelectionIndex(final int leadIndex) {
|
||||
if (isSelectableInListIndex(leadIndex)) super.setLeadSelectionIndex(leadIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectionInterval(final int index0, final int index1) {
|
||||
if (index0 == -1 || index1 == -1) { return; }
|
||||
|
||||
@ -2445,6 +2530,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectionInterval(final int index0, final int index1) {
|
||||
if (index0 == -1 || index1 == -1) { return; }
|
||||
|
||||
@ -2465,7 +2551,7 @@ public class AquaFileChooserUI extends FileChooserUI {
|
||||
// Convenience, to translate from the JList directory view to the Mac-style JTable
|
||||
// & minimize diffs between this and BasicFileChooserUI
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class JTableExtension extends JTable {
|
||||
static final class JTableExtension extends JTable {
|
||||
public void setSelectedIndex(final int index) {
|
||||
getSelectionModel().setSelectionInterval(index, index);
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ import javax.swing.table.AbstractTableModel;
|
||||
* Some of it came from BasicDirectoryModel
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeListener {
|
||||
final class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeListener {
|
||||
private final JTable fFileList;
|
||||
private FilesLoader filesLoader = null;
|
||||
private Vector<File> files = null;
|
||||
@ -75,6 +75,7 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
fFileList.setSelectionMode(b ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String prop = e.getPropertyName();
|
||||
if (prop == JFileChooser.DIRECTORY_CHANGED_PROPERTY || prop == JFileChooser.FILE_VIEW_CHANGED_PROPERTY || prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY || prop == JFileChooser.FILE_HIDING_CHANGED_PROPERTY) {
|
||||
@ -186,19 +187,23 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
filesLoader = new FilesLoader(currentDirectory, fetchID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(final int col) {
|
||||
return fColumnNames[col];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Object> getColumnClass(final int col) {
|
||||
if (col == 0) return File.class;
|
||||
return Date.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
synchronized(fileCacheLock) {
|
||||
if (fileCache != null) {
|
||||
@ -238,6 +243,7 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
|
||||
// AbstractTableModel interface
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int row, final int col) {
|
||||
if (row < 0 || col < 0) return null;
|
||||
final boolean isAscending = fSortNames ? fSortAscending[0] : fSortAscending[1];
|
||||
@ -338,7 +344,8 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
protected abstract boolean lt(SortableFile a, SortableFile b);
|
||||
}
|
||||
|
||||
static class QuickSortNames extends QuickSort {
|
||||
static final class QuickSortNames extends QuickSort {
|
||||
@Override
|
||||
protected boolean lt(final SortableFile a, final SortableFile b) {
|
||||
final String aLower = a.fName.toLowerCase();
|
||||
final String bLower = b.fName.toLowerCase();
|
||||
@ -346,14 +353,15 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
}
|
||||
}
|
||||
|
||||
static class QuickSortDates extends QuickSort {
|
||||
static final class QuickSortDates extends QuickSort {
|
||||
@Override
|
||||
protected boolean lt(final SortableFile a, final SortableFile b) {
|
||||
return a.fDateValue < b.fDateValue;
|
||||
}
|
||||
}
|
||||
|
||||
// for speed in sorting, displaying
|
||||
static class SortableFile /* extends FileView */{
|
||||
static final class SortableFile /* extends FileView */{
|
||||
File fFile;
|
||||
String fName;
|
||||
long fDateValue;
|
||||
@ -371,6 +379,7 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
return fDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
final SortableFile otherFile = (SortableFile)other;
|
||||
return otherFile.fFile.equals(fFile);
|
||||
@ -382,7 +391,7 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
}
|
||||
}
|
||||
|
||||
class FilesLoader implements Runnable {
|
||||
final class FilesLoader implements Runnable {
|
||||
ArrayList<Runnable> queuedTasks = new ArrayList<>();
|
||||
File currentDirectory = null;
|
||||
int fid;
|
||||
@ -449,7 +458,7 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
}
|
||||
}
|
||||
|
||||
class DoChangeContents implements Runnable {
|
||||
final class DoChangeContents implements Runnable {
|
||||
private Vector<SortableFile> contentFiles;
|
||||
private boolean doFire = true;
|
||||
private final Object lock = new Object();
|
||||
@ -466,6 +475,7 @@ class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeLi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (fetchID == fid) {
|
||||
synchronized(lock) {
|
||||
|
||||
@ -39,7 +39,7 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
class AquaFileView extends FileView {
|
||||
final class AquaFileView extends FileView {
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static final int UNINITALIZED_LS_INFO = -1;
|
||||
@ -97,7 +97,7 @@ class AquaFileView extends FileView {
|
||||
return getNativePathToSharedJDKBundle();
|
||||
}
|
||||
|
||||
static class FileInfo {
|
||||
static final class FileInfo {
|
||||
final boolean isDirectory;
|
||||
final String absolutePath;
|
||||
byte[] pathBytes;
|
||||
@ -150,6 +150,7 @@ class AquaFileView extends FileView {
|
||||
return fFileChooserUI.fApplicationIsTraversable == AquaFileChooserUI.kOpenAlways;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(final File f) {
|
||||
final FileInfo info = getFileInfoFor(f);
|
||||
if (info.displayName != null) return info.displayName;
|
||||
@ -171,15 +172,18 @@ class AquaFileView extends FileView {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(final File f) {
|
||||
return f.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDescription(final File f) {
|
||||
if (f.isDirectory()) return _directoryDescriptionText();
|
||||
return _fileDescriptionText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(final File f) {
|
||||
final FileInfo info = getFileInfoFor(f);
|
||||
if (info.icon != null) return info.icon;
|
||||
@ -210,6 +214,7 @@ class AquaFileView extends FileView {
|
||||
}
|
||||
|
||||
// aliases are traversable though they aren't directories
|
||||
@Override
|
||||
public Boolean isTraversable(final File f) {
|
||||
if (f.isDirectory()) {
|
||||
// Doesn't matter if it's a package or app, because they're traversable
|
||||
|
||||
@ -39,7 +39,7 @@ import apple.laf.JRSUIFocus;
|
||||
|
||||
import com.apple.laf.AquaUtils.Painter;
|
||||
|
||||
public class AquaFocus {
|
||||
public final class AquaFocus {
|
||||
interface Drawable {
|
||||
public void draw(final Graphics2D sg2d);
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class AquaFocus {
|
||||
}
|
||||
*/
|
||||
|
||||
static class FocusedIcon extends AquaUtils.ShadowBorder implements Icon {
|
||||
static final class FocusedIcon extends AquaUtils.ShadowBorder implements Icon {
|
||||
final Icon icon;
|
||||
final int slack;
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener {
|
||||
|
||||
protected static final String FRAME_ACTIVE_PROPERTY = "Frame.active";
|
||||
|
||||
@Override
|
||||
public void focusGained(final FocusEvent ev) {
|
||||
// If we gained focus and it wasn't due to a previous temporary focus loss
|
||||
// or the frame became active again, then repaint the border on the component.
|
||||
@ -65,6 +66,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener {
|
||||
wasTemporary = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent ev) {
|
||||
wasTemporary = ev.isTemporary();
|
||||
|
||||
@ -74,6 +76,7 @@ public class AquaFocusHandler implements FocusListener, PropertyChangeListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent ev) {
|
||||
if (!FRAME_ACTIVE_PROPERTY.equals(ev.getPropertyName())) return;
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ import javax.swing.plaf.*;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
@SuppressWarnings("serial") // JDK implementation class
|
||||
public class AquaFonts {
|
||||
public final class AquaFonts {
|
||||
private static final String MAC_DEFAULT_FONT_NAME = "Lucida Grande";
|
||||
|
||||
private static final RecyclableSingleton<FontUIResource> lucida9Pt = new RecyclableSingleton<FontUIResource>() {
|
||||
@ -131,26 +131,32 @@ public class AquaFonts {
|
||||
super(name, style, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font deriveFont(final AffineTransform trans) {
|
||||
return new DerivedUIResourceFont(super.deriveFont(trans));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font deriveFont(final float derivedSize) {
|
||||
return new DerivedUIResourceFont(super.deriveFont(derivedSize));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font deriveFont(final int derivedStyle) {
|
||||
return new DerivedUIResourceFont(super.deriveFont(derivedStyle));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font deriveFont(final int derivedStyle, final AffineTransform trans) {
|
||||
return new DerivedUIResourceFont(super.deriveFont(derivedStyle, trans));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font deriveFont(final int derivedStyle, final float derivedSize) {
|
||||
return new DerivedUIResourceFont(super.deriveFont(derivedStyle, derivedSize));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font deriveFont(final Map<? extends Attribute, ?> attributes) {
|
||||
return new DerivedUIResourceFont(super.deriveFont(attributes));
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ public abstract class AquaGroupBorder extends AquaBorder {
|
||||
painter.state.set(Widget.FRAME_GROUP_BOX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, int x, int y, int width, int height) {
|
||||
// sg2d.setColor(Color.MAGENTA);
|
||||
// sg2d.drawRect(x, y, width - 1, height - 1);
|
||||
@ -70,19 +71,19 @@ public abstract class AquaGroupBorder extends AquaBorder {
|
||||
// sg2d.drawRect(x, y, width, height);
|
||||
}
|
||||
|
||||
protected static class TabbedPane extends AquaGroupBorder {
|
||||
protected static final class TabbedPane extends AquaGroupBorder {
|
||||
public TabbedPane() {
|
||||
super(new SizeVariant().alterMargins(8, 12, 8, 12).alterInsets(5, 5, 7, 5));
|
||||
}
|
||||
}
|
||||
|
||||
protected static class Titled extends AquaGroupBorder {
|
||||
protected static final class Titled extends AquaGroupBorder {
|
||||
public Titled() {
|
||||
super(new SizeVariant().alterMargins(16, 20, 16, 20).alterInsets(16, 5, 4, 5));
|
||||
}
|
||||
}
|
||||
|
||||
protected static class Titleless extends AquaGroupBorder {
|
||||
protected static final class Titleless extends AquaGroupBorder {
|
||||
public Titleless() {
|
||||
super(new SizeVariant().alterMargins(8, 12, 8, 12).alterInsets(3, 5, 1, 5));
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ import javax.swing.text.*;
|
||||
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
public class AquaHighlighter extends DefaultHighlighter implements UIResource {
|
||||
public final class AquaHighlighter extends DefaultHighlighter implements UIResource {
|
||||
private static final RecyclableSingleton<LayerPainter> instance = new RecyclableSingleton<LayerPainter>() {
|
||||
protected LayerPainter getInstance() {
|
||||
return new AquaHighlightPainter(null);
|
||||
@ -47,7 +47,7 @@ public class AquaHighlighter extends DefaultHighlighter implements UIResource {
|
||||
return instance.get();
|
||||
}
|
||||
|
||||
public static class AquaHighlightPainter extends DefaultHighlightPainter {
|
||||
public static final class AquaHighlightPainter extends DefaultHighlightPainter {
|
||||
Color selectionColor;
|
||||
Color disabledSelectionColor;
|
||||
|
||||
@ -55,6 +55,7 @@ public class AquaHighlighter extends DefaultHighlighter implements UIResource {
|
||||
super(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor() {
|
||||
return selectionColor == null ? super.getColor() : selectionColor;
|
||||
}
|
||||
@ -82,11 +83,13 @@ public class AquaHighlighter extends DefaultHighlighter implements UIResource {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final int offs0, final int offs1, final Shape bounds, final JTextComponent c) {
|
||||
setColor(c);
|
||||
super.paint(g, offs0, offs1, bounds, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Shape paintLayer(final Graphics g, final int offs0, final int offs1, final Shape bounds, final JTextComponent c, final View view) {
|
||||
setColor(c);
|
||||
return super.paintLayer(g, offs0, offs1, bounds, c, view);
|
||||
|
||||
@ -39,7 +39,7 @@ import com.apple.laf.AquaUtilControlSize.*;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import sun.lwawt.macosx.CImage;
|
||||
|
||||
public class AquaIcon {
|
||||
public final class AquaIcon {
|
||||
interface InvertableIcon extends Icon {
|
||||
public Icon getInvertedIcon();
|
||||
}
|
||||
@ -77,6 +77,7 @@ public class AquaIcon {
|
||||
abstract static class JRSUIIcon implements Icon, UIResource {
|
||||
protected final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIState.getInstance());
|
||||
|
||||
@Override
|
||||
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
|
||||
painter.paint(g, c, x, y, getIconWidth(), getIconHeight());
|
||||
}
|
||||
@ -94,14 +95,17 @@ public class AquaIcon {
|
||||
|
||||
public abstract void initJRSUIState();
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return sizeVariant == null ? 0 : sizeVariant.h;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return sizeVariant == null ? 0 : sizeVariant.w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
|
||||
final Size size = c instanceof JComponent ? AquaUtilControlSize.getUserSizeFrom((JComponent)c) : Size.REGULAR;
|
||||
sizeVariant = sizeDescriptor.get(size);
|
||||
@ -142,6 +146,7 @@ public class AquaIcon {
|
||||
return getImage() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(final Component c, Graphics g, final int x, final int y) {
|
||||
g = g.create();
|
||||
|
||||
@ -158,10 +163,12 @@ public class AquaIcon {
|
||||
g.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return height;
|
||||
}
|
||||
@ -214,7 +221,7 @@ public class AquaIcon {
|
||||
}
|
||||
}
|
||||
|
||||
static class FileIcon extends CachingScalingIcon {
|
||||
static final class FileIcon extends CachingScalingIcon {
|
||||
final File file;
|
||||
|
||||
public FileIcon(final File file, final int width, final int height) {
|
||||
@ -226,12 +233,13 @@ public class AquaIcon {
|
||||
this(file, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
Image createImage() {
|
||||
return CImage.createImageOfFile(file.getAbsolutePath(), getIconWidth(), getIconHeight());
|
||||
}
|
||||
}
|
||||
|
||||
static class SystemIconSingleton extends RecyclableSingleton<SystemIcon> {
|
||||
static final class SystemIconSingleton extends RecyclableSingleton<SystemIcon> {
|
||||
final String selector;
|
||||
|
||||
public SystemIconSingleton(String selector) {
|
||||
@ -244,7 +252,7 @@ public class AquaIcon {
|
||||
}
|
||||
}
|
||||
|
||||
static class SystemIconUIResourceSingleton extends RecyclableSingleton<IconUIResource> {
|
||||
static final class SystemIconUIResourceSingleton extends RecyclableSingleton<IconUIResource> {
|
||||
final String selector;
|
||||
|
||||
public SystemIconUIResourceSingleton(String selector) {
|
||||
@ -257,7 +265,7 @@ public class AquaIcon {
|
||||
}
|
||||
}
|
||||
|
||||
static class SystemIcon extends CachingScalingIcon {
|
||||
static final class SystemIcon extends CachingScalingIcon {
|
||||
private static final SystemIconUIResourceSingleton folderIcon = new SystemIconUIResourceSingleton("fldr");
|
||||
static IconUIResource getFolderIconUIResource() { return folderIcon.get(); }
|
||||
|
||||
@ -299,6 +307,7 @@ public class AquaIcon {
|
||||
this(iconSelector, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
Image createImage() {
|
||||
return CImage.createSystemImageFromSelector(
|
||||
selector, getIconWidth(), getIconHeight());
|
||||
|
||||
@ -50,7 +50,7 @@ import sun.awt.image.MultiResolutionCachedImage;
|
||||
import sun.lwawt.macosx.CImage;
|
||||
import sun.swing.ImageIconUIResource;
|
||||
|
||||
public class AquaImageFactory {
|
||||
public final class AquaImageFactory {
|
||||
public static IconUIResource getConfirmImageIcon() {
|
||||
// public, because UIDefaults.ProxyLazyValue uses reflection to get this value
|
||||
|
||||
@ -193,7 +193,7 @@ public class AquaImageFactory {
|
||||
}, 20, 20);
|
||||
}
|
||||
|
||||
static class NamedImageSingleton extends RecyclableSingleton<Image> {
|
||||
static final class NamedImageSingleton extends RecyclableSingleton<Image> {
|
||||
final String namedImage;
|
||||
|
||||
NamedImageSingleton(final String namedImage) {
|
||||
@ -206,7 +206,7 @@ public class AquaImageFactory {
|
||||
}
|
||||
}
|
||||
|
||||
static class IconUIResourceSingleton extends RecyclableSingleton<IconUIResource> {
|
||||
static final class IconUIResourceSingleton extends RecyclableSingleton<IconUIResource> {
|
||||
final NamedImageSingleton holder;
|
||||
|
||||
public IconUIResourceSingleton(final NamedImageSingleton holder) {
|
||||
@ -220,7 +220,7 @@ public class AquaImageFactory {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class InvertableImageIcon extends ImageIcon implements InvertableIcon, UIResource {
|
||||
static final class InvertableImageIcon extends ImageIcon implements InvertableIcon, UIResource {
|
||||
Icon invertedImage;
|
||||
private Icon disabledIcon;
|
||||
public InvertableImageIcon(final Image image) {
|
||||
@ -296,7 +296,7 @@ public class AquaImageFactory {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public static class NineSliceMetrics {
|
||||
public static final class NineSliceMetrics {
|
||||
public final int wCut, eCut, nCut, sCut;
|
||||
public final int minW, minH;
|
||||
public final boolean showMiddle, stretchH, stretchV;
|
||||
@ -320,7 +320,7 @@ public class AquaImageFactory {
|
||||
* A "paintable" which holds nine images, which represent a sliced up initial
|
||||
* image that can be stretched from its middles.
|
||||
*/
|
||||
public static class SlicedImageControl {
|
||||
public static final class SlicedImageControl {
|
||||
final BufferedImage NW, N, NE;
|
||||
final BufferedImage W, C, E;
|
||||
final BufferedImage SW, S, SE;
|
||||
@ -466,6 +466,7 @@ public class AquaImageFactory {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRGB() {
|
||||
return color.getRGB();
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaInternalFrameBorderMetrics;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
public class AquaInternalFrameBorder implements Border, UIResource {
|
||||
public final class AquaInternalFrameBorder implements Border, UIResource {
|
||||
private static final int kCloseButton = 0;
|
||||
private static final int kIconButton = 1;
|
||||
private static final int kGrowButton = 2;
|
||||
@ -142,11 +142,13 @@ public class AquaInternalFrameBorder implements Border, UIResource {
|
||||
}
|
||||
|
||||
// Border interface
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Border interface
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
|
||||
// For expanded InternalFrames, the frame & component are the same object
|
||||
paintBorder((JInternalFrame)c, c, g, x, y, w, h);
|
||||
@ -412,6 +414,7 @@ public class AquaInternalFrameBorder implements Border, UIResource {
|
||||
}
|
||||
|
||||
// Border interface
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
if (fBorderInsets == null) fBorderInsets = new Insets(0, 0, 0, 0);
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager {
|
||||
*/
|
||||
Vector<JInternalFrame> fChildFrames = new Vector<JInternalFrame>(1);
|
||||
|
||||
@Override
|
||||
public void closeFrame(final JInternalFrame f) {
|
||||
if (f == fCurrentFrame) {
|
||||
activateNextFrame();
|
||||
@ -81,6 +82,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager {
|
||||
super.closeFrame(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deiconifyFrame(final JInternalFrame f) {
|
||||
JInternalFrame.JDesktopIcon desktopIcon;
|
||||
|
||||
@ -96,6 +98,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager {
|
||||
}
|
||||
|
||||
/** Removes the frame from its parent and adds its desktopIcon to the parent. */
|
||||
@Override
|
||||
public void iconifyFrame(final JInternalFrame f) {
|
||||
// Same as super except doesn't deactivate it
|
||||
JInternalFrame.JDesktopIcon desktopIcon;
|
||||
@ -117,6 +120,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager {
|
||||
}
|
||||
|
||||
// WindowsDesktopManager code
|
||||
@Override
|
||||
public void activateFrame(final JInternalFrame f) {
|
||||
try {
|
||||
if (f != null) super.activateFrame(f);
|
||||
|
||||
@ -34,7 +34,7 @@ import javax.swing.border.Border;
|
||||
import javax.swing.plaf.*;
|
||||
import javax.swing.plaf.basic.BasicDesktopPaneUI;
|
||||
|
||||
public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements MouseListener {
|
||||
public final class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements MouseListener {
|
||||
|
||||
JComponent fDock;
|
||||
DockLayoutManager fLayoutMgr;
|
||||
@ -43,6 +43,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
return new AquaInternalFramePaneUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final Graphics g, final JComponent c) {
|
||||
if (c.isOpaque()) {
|
||||
super.update(g, c);
|
||||
@ -51,6 +52,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
paint(g, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
super.installUI(c);
|
||||
fLayoutMgr = new DockLayoutManager();
|
||||
@ -59,6 +61,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
c.addMouseListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
c.removeMouseListener(this);
|
||||
|
||||
@ -74,6 +77,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
}
|
||||
|
||||
// Our superclass hardcodes DefaultDesktopManager - how rude!
|
||||
@Override
|
||||
protected void installDesktopManager() {
|
||||
if (desktop.getDesktopManager() == null) {
|
||||
desktopManager = new AquaDockingDesktopManager();
|
||||
@ -81,6 +85,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDesktopManager() {
|
||||
final DesktopManager manager = desktop.getDesktopManager();
|
||||
if (manager instanceof AquaDockingDesktopManager) {
|
||||
@ -96,28 +101,33 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
return fDock;
|
||||
}
|
||||
|
||||
class DockLayoutManager implements LayoutManager {
|
||||
final class DockLayoutManager implements LayoutManager {
|
||||
@Override
|
||||
public void addLayoutComponent(final String name, final Component comp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLayoutComponent(final Component comp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(final Container parent) {
|
||||
return parent.getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(final Container parent) {
|
||||
return parent.getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutContainer(final Container parent) {
|
||||
if (fDock != null) ((Dock)fDock).updateSize();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class Dock extends JComponent implements Border {
|
||||
final class Dock extends JComponent implements Border {
|
||||
static final int DOCK_EDGE_SLACK = 8;
|
||||
|
||||
Dock(final JComponent parent) {
|
||||
@ -126,6 +136,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNotify() {
|
||||
fDock = null;
|
||||
super.removeNotify();
|
||||
@ -136,6 +147,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
setBounds((getParent().getWidth() - d.width) / 2, getParent().getHeight() - d.height, d.width, d.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(final Component c) {
|
||||
super.add(c);
|
||||
if (!isVisible()) {
|
||||
@ -147,6 +159,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(final Component c) {
|
||||
super.remove(c);
|
||||
if (getComponentCount() == 0) {
|
||||
@ -157,14 +170,17 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
return new Insets(DOCK_EDGE_SLACK / 4, DOCK_EDGE_SLACK, 0, DOCK_EDGE_SLACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
|
||||
if (!(g instanceof Graphics2D)) return;
|
||||
final Graphics2D g2d = (Graphics2D)g;
|
||||
@ -187,7 +203,8 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // JDK implementation class
|
||||
static class AquaDockingDesktopManager extends AquaInternalFrameManager {
|
||||
static final class AquaDockingDesktopManager extends AquaInternalFrameManager {
|
||||
@Override
|
||||
public void openFrame(final JInternalFrame f) {
|
||||
final JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
|
||||
final Container dock = desktopIcon.getParent();
|
||||
@ -197,6 +214,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
removeIconFor(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deiconifyFrame(final JInternalFrame f) {
|
||||
final JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
|
||||
final Container dock = desktopIcon.getParent();
|
||||
@ -213,6 +231,7 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
} catch(final PropertyVetoException pve) { /* do nothing */ }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iconifyFrame(final JInternalFrame f) {
|
||||
final JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon();
|
||||
// paint the frame onto the icon before hiding the frame, else the contents won't show
|
||||
@ -220,12 +239,14 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
super.iconifyFrame(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
void addIcon(final Container c, final JInternalFrame.JDesktopIcon desktopIcon) {
|
||||
final DesktopPaneUI ui = ((JDesktopPane)c).getUI();
|
||||
((AquaInternalFramePaneUI)ui).getDock().add(desktopIcon);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
JInternalFrame selectedFrame = desktop.getSelectedFrame();
|
||||
if (selectedFrame != null) {
|
||||
@ -236,8 +257,12 @@ public class AquaInternalFramePaneUI extends BasicDesktopPaneUI implements Mouse
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) { }
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ import sun.lwawt.macosx.CPlatformWindow;
|
||||
* so be very careful about subclassing so you know you get what you want
|
||||
*
|
||||
*/
|
||||
public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingConstants {
|
||||
public final class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingConstants {
|
||||
protected static final String IS_PALETTE_PROPERTY = "JInternalFrame.isPalette";
|
||||
private static final String FRAME_TYPE = "JInternalFrame.frameType";
|
||||
private static final String NORMAL_FRAME = "normal";
|
||||
@ -177,7 +177,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
|
||||
return zoomIcon.get();
|
||||
}
|
||||
|
||||
static class AquaInternalFrameButtonIcon extends AquaIcon.JRSUIIcon {
|
||||
static final class AquaInternalFrameButtonIcon extends AquaIcon.JRSUIIcon {
|
||||
public AquaInternalFrameButtonIcon(final Widget widget) {
|
||||
painter.state.set(widget);
|
||||
}
|
||||
@ -385,7 +385,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
|
||||
/**
|
||||
* Listens for border adjustments.
|
||||
*/
|
||||
protected class AquaBorderListener extends MouseInputAdapter {
|
||||
protected final class AquaBorderListener extends MouseInputAdapter {
|
||||
// _x & _y are the mousePressed location in absolute coordinate system
|
||||
int _x, _y;
|
||||
// __x & __y are the mousePressed location in source view's coordinate system
|
||||
@ -697,7 +697,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
|
||||
}
|
||||
}
|
||||
|
||||
class PropertyListener implements PropertyChangeListener {
|
||||
final class PropertyListener implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String name = e.getPropertyName();
|
||||
@ -794,7 +794,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
|
||||
};
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class CompoundUIBorder extends CompoundBorder implements UIResource {
|
||||
static final class CompoundUIBorder extends CompoundBorder implements UIResource {
|
||||
public CompoundUIBorder(final Border inside, final Border outside) { super(inside, outside); }
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ import javax.swing.text.DefaultEditorKit.DefaultKeyTypedAction;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
public class AquaKeyBindings {
|
||||
public final class AquaKeyBindings {
|
||||
private static final RecyclableSingleton<AquaKeyBindings> instance = new RecyclableSingletonFromDefaultConstructor<AquaKeyBindings>(AquaKeyBindings.class);
|
||||
static AquaKeyBindings instance() {
|
||||
return instance.get();
|
||||
@ -475,14 +475,15 @@ public class AquaKeyBindings {
|
||||
}
|
||||
|
||||
// wraps basic string arrays
|
||||
static class SimpleBinding implements BindingsProvider {
|
||||
static final class SimpleBinding implements BindingsProvider {
|
||||
final String[] bindings;
|
||||
public SimpleBinding(final String[] bindings) { this.bindings = bindings; }
|
||||
@Override
|
||||
public String[] getBindings() { return bindings; }
|
||||
}
|
||||
|
||||
// patches all providers together at the moment the UIManager needs the real InputMap
|
||||
static class LateBoundInputMap implements LazyValue, BindingsProvider {
|
||||
static final class LateBoundInputMap implements LazyValue, BindingsProvider {
|
||||
private final BindingsProvider[] providerList;
|
||||
private String[] mergedBindings;
|
||||
|
||||
@ -490,10 +491,12 @@ public class AquaKeyBindings {
|
||||
this.providerList = providerList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object createValue(final UIDefaults table) {
|
||||
return LookAndFeel.makeInputMap(getBindings());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBindings() {
|
||||
if (mergedBindings != null) return mergedBindings;
|
||||
|
||||
@ -548,6 +551,7 @@ public class AquaKeyBindings {
|
||||
abstract static class DeleteWordAction extends TextAction {
|
||||
public DeleteWordAction(final String name) { super(name); }
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (e == null) return;
|
||||
|
||||
@ -583,7 +587,7 @@ public class AquaKeyBindings {
|
||||
final TextAction pageDownMultilineAction = new AquaMultilineAction(pageDownMultiline, DefaultEditorKit.pageDownAction, DefaultEditorKit.endAction);
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class AquaMultilineAction extends TextAction {
|
||||
static final class AquaMultilineAction extends TextAction {
|
||||
final String targetActionName;
|
||||
final String proxyActionName;
|
||||
|
||||
@ -593,6 +597,7 @@ public class AquaKeyBindings {
|
||||
this.proxyActionName = proxyActionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JTextComponent c = getTextComponent(e);
|
||||
final ActionMap actionMap = c.getActionMap();
|
||||
|
||||
@ -39,23 +39,26 @@ import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
import sun.swing.MnemonicHandler;
|
||||
import sun.swing.SwingUtilities2;
|
||||
|
||||
public class AquaLabelUI extends BasicLabelUI {
|
||||
public final class AquaLabelUI extends BasicLabelUI {
|
||||
private static final RecyclableSingleton<AquaLabelUI> aquaLabelUI = new RecyclableSingletonFromDefaultConstructor<AquaLabelUI>(AquaLabelUI.class);
|
||||
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return aquaLabelUI.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners(final JLabel c) {
|
||||
super.installListeners(c);
|
||||
AquaUtilControlSize.addSizePropertyListener(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners(final JLabel c) {
|
||||
AquaUtilControlSize.removeSizePropertyListener(c);
|
||||
super.uninstallListeners(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintEnabledText(final JLabel l, final Graphics g, final String s, final int textX, final int textY) {
|
||||
int mnemIndex = l.getDisplayedMnemonicIndex();
|
||||
if (MnemonicHandler.isMnemonicHidden()) {
|
||||
@ -73,6 +76,7 @@ public class AquaLabelUI extends BasicLabelUI {
|
||||
* @see #paint
|
||||
* @see #paintEnabledText
|
||||
*/
|
||||
@Override
|
||||
protected void paintDisabledText(final JLabel l, final Graphics g, final String s, final int textX, final int textY) {
|
||||
int accChar = l.getDisplayedMnemonicIndex();
|
||||
if (MnemonicHandler.isMnemonicHidden()) {
|
||||
|
||||
@ -42,7 +42,7 @@ import apple.laf.JRSUIConstants.*;
|
||||
*
|
||||
* All this does is look for a ThemeBorder and invalidate it when the focus changes
|
||||
*/
|
||||
public class AquaListUI extends BasicListUI {
|
||||
public final class AquaListUI extends BasicListUI {
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return new AquaListUI();
|
||||
}
|
||||
@ -50,6 +50,7 @@ public class AquaListUI extends BasicListUI {
|
||||
/**
|
||||
* Creates the focus listener to repaint the focus ring
|
||||
*/
|
||||
@Override
|
||||
protected FocusListener createFocusListener() {
|
||||
return new AquaListUI.FocusHandler();
|
||||
}
|
||||
@ -57,10 +58,12 @@ public class AquaListUI extends BasicListUI {
|
||||
/**
|
||||
* Creates a delegate that implements MouseInputListener.
|
||||
*/
|
||||
@Override
|
||||
protected MouseInputListener createMouseInputListener() {
|
||||
return new AquaListUI.MouseInputHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installKeyboardActions() {
|
||||
super.installKeyboardActions();
|
||||
list.getActionMap().put("aquaHome", new AquaHomeEndAction(true));
|
||||
@ -68,7 +71,7 @@ public class AquaListUI extends BasicListUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class AquaHomeEndAction extends AbstractAction {
|
||||
static final class AquaHomeEndAction extends AbstractAction {
|
||||
private boolean fHomeAction = false;
|
||||
|
||||
protected AquaHomeEndAction(final boolean isHomeAction) {
|
||||
@ -78,6 +81,7 @@ public class AquaListUI extends BasicListUI {
|
||||
/**
|
||||
* For a Home action, scrolls to the top. Otherwise, scroll to the end.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final JList<?> list = (JList<?>)e.getSource();
|
||||
|
||||
@ -94,23 +98,27 @@ public class AquaListUI extends BasicListUI {
|
||||
* This inner class is marked "public" due to a compiler bug. This class should be treated as a
|
||||
* "protected" inner class. Instantiate it only within subclasses of BasicListUI.
|
||||
*/
|
||||
class FocusHandler extends BasicListUI.FocusHandler {
|
||||
final class FocusHandler extends BasicListUI.FocusHandler {
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
super.focusGained(e);
|
||||
AquaBorder.repaintBorder(getComponent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
super.focusLost(e);
|
||||
AquaBorder.repaintBorder(getComponent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyChangeListener createPropertyChangeListener() {
|
||||
return new AquaPropertyChangeHandler();
|
||||
}
|
||||
|
||||
class AquaPropertyChangeHandler extends PropertyChangeHandler {
|
||||
final class AquaPropertyChangeHandler extends PropertyChangeHandler {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String prop = e.getPropertyName();
|
||||
if (AquaFocusHandler.FRAME_ACTIVE_PROPERTY.equals(prop)) {
|
||||
@ -126,7 +134,7 @@ public class AquaListUI extends BasicListUI {
|
||||
|
||||
// Replace the mouse event with one that returns the cmd-key state when asked
|
||||
// for the control-key state, which super assumes is what everyone does to discontiguously extend selections
|
||||
class MouseInputHandler extends BasicListUI.MouseInputHandler {
|
||||
final class MouseInputHandler extends BasicListUI.MouseInputHandler {
|
||||
/*public void mousePressed(final MouseEvent e) {
|
||||
super.mousePressed(new SelectionMouseEvent(e));
|
||||
}
|
||||
@ -194,7 +202,8 @@ public class AquaListUI extends BasicListUI {
|
||||
return border;
|
||||
}
|
||||
|
||||
static class ComponentPainter extends AquaBorder.Default {
|
||||
static final class ComponentPainter extends AquaBorder.Default {
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int w, final int h) {
|
||||
final JComponent jc = c instanceof JComponent ? (JComponent)c : null;
|
||||
if (jc != null && !AquaFocusHandler.isActive(jc)) {
|
||||
|
||||
@ -62,7 +62,7 @@ import sun.swing.SwingUtilities2;
|
||||
import static javax.swing.UIDefaults.LazyValue;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
public final class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
static final String sPropertyPrefix = "apple.laf."; // new prefix for things like 'useScreenMenuBar'
|
||||
|
||||
// for lazy initalizers. Following the pattern from metal.
|
||||
@ -77,6 +77,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* that would be useful to a user trying to select a L&F from a list
|
||||
* of names.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Mac OS X";
|
||||
}
|
||||
@ -90,6 +91,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* that doesn't make any fundamental changes to the look or feel
|
||||
* shouldn't override this method.
|
||||
*/
|
||||
@Override
|
||||
public String getID() {
|
||||
return "Aqua";
|
||||
}
|
||||
@ -99,6 +101,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* e.g. "The CDE/Motif Look and Feel". This string is intended for
|
||||
* the user, e.g. in the title of a window or in a ToolTip message.
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Aqua Look and Feel for Mac OS X";
|
||||
}
|
||||
@ -118,6 +121,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* @see JRootPane#setWindowDecorationStyle
|
||||
* @since 1.4
|
||||
*/
|
||||
@Override
|
||||
public boolean getSupportsWindowDecorations() {
|
||||
return false;
|
||||
}
|
||||
@ -126,6 +130,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* If the underlying platform has a "native" look and feel, and this
|
||||
* is an implementation of it, return true.
|
||||
*/
|
||||
@Override
|
||||
public boolean isNativeLookAndFeel() {
|
||||
return true;
|
||||
}
|
||||
@ -138,6 +143,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
*
|
||||
* @see UIManager#setLookAndFeel
|
||||
*/
|
||||
@Override
|
||||
public boolean isSupportedLookAndFeel() {
|
||||
return true;
|
||||
}
|
||||
@ -153,6 +159,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* @see #uninitialize
|
||||
* @see UIManager#setLookAndFeel
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("restricted")
|
||||
public void initialize() {
|
||||
System.loadLibrary("osxui");
|
||||
@ -175,6 +182,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
*
|
||||
* @see #initialize
|
||||
*/
|
||||
@Override
|
||||
public void uninitialize() {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager()
|
||||
.removeKeyEventPostProcessor(AltProcessor.getInstance());
|
||||
@ -209,6 +217,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* @see #playSound(Action)
|
||||
* @since 1.4
|
||||
*/
|
||||
@Override
|
||||
protected ActionMap getAudioActionMap() {
|
||||
ActionMap audioActionMap = (ActionMap)UIManager.get("AuditoryCues.actionMap");
|
||||
if (audioActionMap != null) return audioActionMap;
|
||||
@ -229,6 +238,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* We override getDefaults() so we can install our own debug defaults
|
||||
* if needed for testing
|
||||
*/
|
||||
@Override
|
||||
public UIDefaults getDefaults() {
|
||||
final UIDefaults table = new UIDefaults();
|
||||
// use debug defaults if you want to see every query into the defaults object.
|
||||
@ -279,6 +289,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
/**
|
||||
* This is the last step in the getDefaults routine usually called from our superclass
|
||||
*/
|
||||
@Override
|
||||
protected void initComponentDefaults(final UIDefaults table) {
|
||||
initResourceBundle(table);
|
||||
|
||||
@ -1017,6 +1028,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
SwingUtilities2.putAATextInfo(true, table);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initSystemColorDefaults(final UIDefaults table) {
|
||||
// String[] defaultSystemColors = {
|
||||
// "desktop", "#005C5C", /* Color of the desktop background */
|
||||
@ -1059,6 +1071,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
*
|
||||
* @see #getDefaults
|
||||
*/
|
||||
@Override
|
||||
protected void initClassDefaults(final UIDefaults table) {
|
||||
final String basicPackageName = "javax.swing.plaf.basic.";
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ import sun.swing.SwingUtilities2;
|
||||
/**
|
||||
* The class represents the border of a {@code JMenuBar}.
|
||||
*/
|
||||
public class AquaMenuBarBorder implements Border, UIResource {
|
||||
public final class AquaMenuBarBorder implements Border, UIResource {
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x,
|
||||
|
||||
@ -40,13 +40,14 @@ import sun.lwawt.macosx.LWCToolkit;
|
||||
|
||||
// MenuBar implementation for Mac L&F
|
||||
@SuppressWarnings("restricted")
|
||||
public class AquaMenuBarUI extends BasicMenuBarUI implements ScreenMenuBarProvider {
|
||||
public final class AquaMenuBarUI extends BasicMenuBarUI implements ScreenMenuBarProvider {
|
||||
|
||||
static {
|
||||
System.loadLibrary("osxui");
|
||||
}
|
||||
|
||||
// Utilities
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
if (fScreenMenuBar != null) {
|
||||
final JFrame frame = (JFrame)(c.getTopLevelAncestor());
|
||||
@ -65,12 +66,14 @@ public class AquaMenuBarUI extends BasicMenuBarUI implements ScreenMenuBarProvid
|
||||
|
||||
// [3320390] -- If the screen menu bar is in use, don't register keyboard actions that
|
||||
// show the menus when F10 is pressed.
|
||||
@Override
|
||||
protected void installKeyboardActions() {
|
||||
if (!useScreenMenuBar) {
|
||||
super.installKeyboardActions();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallKeyboardActions() {
|
||||
if (!useScreenMenuBar) {
|
||||
super.uninstallKeyboardActions();
|
||||
@ -78,10 +81,12 @@ public class AquaMenuBarUI extends BasicMenuBarUI implements ScreenMenuBarProvid
|
||||
}
|
||||
|
||||
// Paint Methods
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
AquaMenuPainter.instance().paintMenuBarBackground(g, c.getWidth(), c.getHeight(), c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
if (isScreenMenuBar((JMenuBar)c)) {
|
||||
if (setScreenMenuBar((JFrame)(c.getTopLevelAncestor()))) {
|
||||
@ -111,6 +116,7 @@ public class AquaMenuBarUI extends BasicMenuBarUI implements ScreenMenuBarProvid
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScreenMenuBar getScreenMenuBar() {
|
||||
// Lazy init of member variables means we should use a synchronized block.
|
||||
synchronized(this) {
|
||||
|
||||
@ -31,7 +31,7 @@ import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.plaf.UIResource;
|
||||
|
||||
public class AquaMenuBorder implements Border, UIResource {
|
||||
public final class AquaMenuBorder implements Border, UIResource {
|
||||
public AquaMenuBorder() { }
|
||||
|
||||
/**
|
||||
@ -44,6 +44,7 @@ public class AquaMenuBorder implements Border, UIResource {
|
||||
* @param width the width of the painted border
|
||||
* @param height the height of the painted border
|
||||
*/
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
// for now we don't paint a border. We let the button paint it since there
|
||||
// needs to be a strict ordering for aqua components.
|
||||
@ -59,6 +60,7 @@ public class AquaMenuBorder implements Border, UIResource {
|
||||
* is opaque, it is responsible for filling in it's own
|
||||
* background when painting.
|
||||
*/
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return false;
|
||||
}
|
||||
@ -79,6 +81,7 @@ public class AquaMenuBorder implements Border, UIResource {
|
||||
* Returns the insets of the border.
|
||||
* @param c the component for which this border insets value applies
|
||||
*/
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
if (!(c instanceof JPopupMenu)) {
|
||||
return getItemInsets();
|
||||
|
||||
@ -35,7 +35,7 @@ import javax.swing.plaf.basic.BasicMenuItemUI;
|
||||
import apple.laf.JRSUIConstants.Size;
|
||||
|
||||
// TODO: no screen menu bar for now
|
||||
public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.Client/*, ScreenMenuItemUI*/ {
|
||||
public final class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.Client/*, ScreenMenuItemUI*/ {
|
||||
static final int kPlain = 0, kCheckBox = 1, kRadioButton = 2;
|
||||
static final String[] sPropertyPrefixes = { "MenuItem", "CheckBoxMenuItem", "RadioButtonMenuItem" };
|
||||
|
||||
@ -57,6 +57,7 @@ public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.C
|
||||
|
||||
// The only real difference between the three is which property prefix it returns
|
||||
// and therefore which icons!
|
||||
@Override
|
||||
protected String getPropertyPrefix() {
|
||||
return sPropertyPrefixes[fType];
|
||||
}
|
||||
@ -99,14 +100,17 @@ public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.C
|
||||
menuItem.addMenuDragMouseListener(menuDragMouseListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintMenuItem(final Graphics g, final JComponent c, final Icon localCheckIcon, final Icon localArrowIcon, final Color background, final Color foreground, final int localDefaultTextIconGap) {
|
||||
AquaMenuPainter.instance().paintMenuItem(this, g, c, localCheckIcon, localArrowIcon, background, foreground, disabledForeground, selectionForeground, localDefaultTextIconGap, acceleratorFont);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dimension getPreferredMenuItemSize(final JComponent c, final Icon localCheckIcon, final Icon localArrowIcon, final int localDefaultTextIconGap) {
|
||||
return AquaMenuPainter.instance().getPreferredMenuItemSize(c, localCheckIcon, localArrowIcon, localDefaultTextIconGap, acceleratorFont);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final Graphics g, final JComponent c) {
|
||||
if (c.isOpaque()) {
|
||||
// sja fix ((PenGraphics)g).alphaClearRect(0,0,c.getWidth(),c.getHeight());
|
||||
@ -119,6 +123,7 @@ public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.C
|
||||
paint(g, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBackground(final Graphics g, final JComponent c, final int menuWidth, final int menuHeight) {
|
||||
if ((c.getParent() instanceof JMenuBar)) return;
|
||||
final Color oldColor = g.getColor();
|
||||
@ -146,6 +151,7 @@ public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.C
|
||||
g.setColor(oldColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doClick(final MenuSelectionManager msm) {
|
||||
final Dimension size = menuItem.getSize();
|
||||
AquaUtils.blinkMenu(new AquaUtils.Selectable() {
|
||||
@ -158,7 +164,7 @@ public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.C
|
||||
}
|
||||
|
||||
static final IndeterminateListener INDETERMINATE_LISTENER = new IndeterminateListener();
|
||||
static class IndeterminateListener implements PropertyChangeListener {
|
||||
static final class IndeterminateListener implements PropertyChangeListener {
|
||||
static final String CLIENT_PROPERTY_KEY = "JMenuItem.selectedState";
|
||||
|
||||
static void install(final JMenuItem menuItem) {
|
||||
@ -170,6 +176,7 @@ public class AquaMenuItemUI extends BasicMenuItemUI implements AquaMenuPainter.C
|
||||
menuItem.removePropertyChangeListener(CLIENT_PROPERTY_KEY, INDETERMINATE_LISTENER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent evt) {
|
||||
final String key = evt.getPropertyName();
|
||||
if (!CLIENT_PROPERTY_KEY.equalsIgnoreCase(key)) return;
|
||||
|
||||
@ -68,7 +68,7 @@ import sun.swing.SwingUtilities2;
|
||||
* that allows them to paint their own backgrounds
|
||||
*/
|
||||
|
||||
public class AquaMenuPainter {
|
||||
public final class AquaMenuPainter {
|
||||
// Glyph statics:
|
||||
// ASCII character codes
|
||||
static final byte
|
||||
@ -151,9 +151,10 @@ public class AquaMenuPainter {
|
||||
static final int defaultMenuItemGap = 2;
|
||||
static final int kAcceleratorArrowSpace = 16; // Accel space doesn't overlap arrow space, even though items can't have both
|
||||
|
||||
static class RecyclableBorder extends RecyclableSingleton<Border> {
|
||||
static final class RecyclableBorder extends RecyclableSingleton<Border> {
|
||||
final String borderName;
|
||||
RecyclableBorder(final String borderName) { this.borderName = borderName; }
|
||||
@Override
|
||||
protected Border getInstance() { return UIManager.getBorder(borderName); }
|
||||
}
|
||||
|
||||
|
||||
@ -33,15 +33,17 @@ import javax.swing.event.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicMenuUI;
|
||||
|
||||
public class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
|
||||
public final class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
|
||||
public static ComponentUI createUI(final JComponent x) {
|
||||
return new AquaMenuUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChangeListener createChangeListener(final JComponent c) {
|
||||
return new ChangeHandler((JMenu)c, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
@ -51,16 +53,19 @@ public class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
|
||||
((JMenu)menuItem).setDelay(8 * 1000 / 60);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintMenuItem(final Graphics g, final JComponent c, final Icon localCheckIcon, final Icon localArrowIcon, final Color background, final Color foreground, final int localDefaultTextIconGap) {
|
||||
AquaMenuPainter.instance().paintMenuItem(this, g, c, localCheckIcon, localArrowIcon, background, foreground, disabledForeground, selectionForeground, localDefaultTextIconGap, acceleratorFont);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dimension getPreferredMenuItemSize(final JComponent c, final Icon localCheckIcon, final Icon localArrowIcon, final int localDefaultTextIconGap) {
|
||||
final Dimension d = AquaMenuPainter.instance().getPreferredMenuItemSize(c, localCheckIcon, localArrowIcon, localDefaultTextIconGap, acceleratorFont);
|
||||
if (c.getParent() instanceof JMenuBar) d.height = Math.max(d.height, 21);
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBackground(final Graphics g, final JComponent c, final int menuWidth, final int menuHeight) {
|
||||
final Container parent = c.getParent();
|
||||
final boolean parentIsMenuBar = parent instanceof JMenuBar;
|
||||
@ -82,16 +87,19 @@ public class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseInputListener createMouseInputListener(final JComponent c) {
|
||||
return new AquaMouseInputHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MenuDragMouseListener createMenuDragMouseListener(final JComponent c) {
|
||||
//return super.createMenuDragMouseListener(c);
|
||||
return new MenuDragMouseHandler();
|
||||
}
|
||||
|
||||
class MenuDragMouseHandler implements MenuDragMouseListener {
|
||||
final class MenuDragMouseHandler implements MenuDragMouseListener {
|
||||
@Override
|
||||
public void menuDragMouseDragged(final MenuDragMouseEvent e) {
|
||||
if (menuItem.isEnabled() == false) return;
|
||||
|
||||
@ -118,8 +126,11 @@ public class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void menuDragMouseEntered(final MenuDragMouseEvent e) { }
|
||||
@Override
|
||||
public void menuDragMouseExited(final MenuDragMouseEvent e) { }
|
||||
@Override
|
||||
public void menuDragMouseReleased(final MenuDragMouseEvent e) { }
|
||||
}
|
||||
|
||||
@ -130,7 +141,7 @@ public class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
|
||||
MenuSelectionManager.defaultManager().setSelectedPath(newPath);
|
||||
}
|
||||
|
||||
protected class AquaMouseInputHandler extends MouseInputHandler {
|
||||
protected final class AquaMouseInputHandler extends MouseInputHandler {
|
||||
/**
|
||||
* Invoked when the cursor enters the menu. This method sets the selected
|
||||
* path for the MenuSelectionManager and handles the case
|
||||
@ -139,6 +150,7 @@ public class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
|
||||
*
|
||||
* @param e the mouse event; not used
|
||||
*/
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
final JMenu menu = (JMenu)menuItem;
|
||||
if (!menu.isEnabled()) return;
|
||||
|
||||
@ -33,14 +33,14 @@ import javax.swing.plaf.UIResource;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
@SuppressWarnings("restricted")
|
||||
public class AquaNativeResources {
|
||||
public final class AquaNativeResources {
|
||||
static {
|
||||
System.loadLibrary("osxui");
|
||||
}
|
||||
|
||||
// TODO: removing CColorPaint for now
|
||||
@SuppressWarnings("serial") // JDK implementation class
|
||||
static class CColorPaintUIResource extends Color/*CColorPaint*/ implements UIResource {
|
||||
static final class CColorPaintUIResource extends Color/*CColorPaint*/ implements UIResource {
|
||||
// The color passed to this MUST be a retained NSColor, and the CColorPaintUIResource
|
||||
// takes ownership of that retain.
|
||||
public CColorPaintUIResource(long color, int r, int g, int b, int a) {
|
||||
|
||||
@ -31,7 +31,7 @@ import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicOptionPaneUI;
|
||||
|
||||
public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
public final class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
private static final int kOKCancelButtonWidth = 79;
|
||||
private static final int kButtonHeight = 23;
|
||||
|
||||
@ -49,6 +49,7 @@ public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
* Creates and returns a Container containin the buttons. The buttons
|
||||
* are created by calling {@code getButtons}.
|
||||
*/
|
||||
@Override
|
||||
protected Container createButtonArea() {
|
||||
final Container bottom = super.createButtonArea();
|
||||
// Now replace the Layout
|
||||
@ -61,6 +62,7 @@ public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
* body of the message.
|
||||
* The icon and body should be aligned on their top edges
|
||||
*/
|
||||
@Override
|
||||
protected Container createMessageArea() {
|
||||
final JPanel top = new JPanel();
|
||||
top.setBorder(UIManager.getBorder("OptionPane.messageAreaBorder"));
|
||||
@ -111,11 +113,12 @@ public class AquaOptionPaneUI extends BasicOptionPaneUI {
|
||||
* BasicOptionPaneUI expects that its buttons are laid out with
|
||||
* a subclass of ButtonAreaLayout
|
||||
*/
|
||||
public static class AquaButtonAreaLayout extends ButtonAreaLayout {
|
||||
public static final class AquaButtonAreaLayout extends ButtonAreaLayout {
|
||||
public AquaButtonAreaLayout(final boolean syncAllWidths, final int padding) {
|
||||
super(true, padding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutContainer(final Container container) {
|
||||
final Component[] children = container.getComponents();
|
||||
if (children == null || 0 >= children.length) return;
|
||||
|
||||
@ -91,7 +91,7 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
state = nextState;
|
||||
}
|
||||
|
||||
private static class AquaNineSlicingImagePainter<T extends JRSUIState>
|
||||
private static final class AquaNineSlicingImagePainter<T extends JRSUIState>
|
||||
extends AquaPainter<T> {
|
||||
|
||||
private final HashMap<T, RecyclableJRSUISlicedImageControl> slicedControlImages;
|
||||
@ -205,7 +205,7 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
}
|
||||
}
|
||||
|
||||
private static class AquaPixelsKey implements ImageCache.PixelsKey {
|
||||
private static final class AquaPixelsKey implements ImageCache.PixelsKey {
|
||||
|
||||
private final int pixelCount;
|
||||
private final int hash;
|
||||
@ -259,7 +259,7 @@ abstract class AquaPainter <T extends JRSUIState> {
|
||||
}
|
||||
}
|
||||
|
||||
private static class RecyclableJRSUISlicedImageControl
|
||||
private static final class RecyclableJRSUISlicedImageControl
|
||||
extends RecyclableSlicedImageControl {
|
||||
|
||||
private final JRSUIControl control;
|
||||
|
||||
@ -34,7 +34,7 @@ import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class AquaPanelUI extends BasicPanelUI {
|
||||
public final class AquaPanelUI extends BasicPanelUI {
|
||||
private static final RecyclableSingleton<AquaPanelUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPanelUI>(AquaPanelUI.class);
|
||||
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
|
||||
@ -33,17 +33,19 @@ import javax.swing.plaf.basic.BasicSeparatorUI;
|
||||
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
public class AquaPopupMenuSeparatorUI extends BasicSeparatorUI {
|
||||
public final class AquaPopupMenuSeparatorUI extends BasicSeparatorUI {
|
||||
private static final RecyclableSingletonFromDefaultConstructor<AquaPopupMenuSeparatorUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaPopupMenuSeparatorUI>(AquaPopupMenuSeparatorUI.class);
|
||||
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return instance.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final Graphics g, final JComponent c) {
|
||||
paint(g, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
final Dimension s = c.getSize();
|
||||
|
||||
@ -62,6 +64,7 @@ public class AquaPopupMenuSeparatorUI extends BasicSeparatorUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
if (((JSeparator)c).getOrientation() == SwingConstants.VERTICAL) {
|
||||
return new Dimension(12, 0);
|
||||
|
||||
@ -32,11 +32,12 @@ import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicPopupMenuUI;
|
||||
|
||||
public class AquaPopupMenuUI extends BasicPopupMenuUI {
|
||||
public final class AquaPopupMenuUI extends BasicPopupMenuUI {
|
||||
public static ComponentUI createUI(final JComponent x) {
|
||||
return new AquaPopupMenuUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPopupTrigger(final MouseEvent e) {
|
||||
// Use the awt popup trigger code since this only runs on our OS!
|
||||
return e.isPopupTrigger();
|
||||
|
||||
@ -43,7 +43,7 @@ import apple.laf.JRSUIState.ValueState;
|
||||
import com.apple.laf.AquaUtilControlSize.*;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener, PropertyChangeListener, AncestorListener, Sizeable {
|
||||
public final class AquaProgressBarUI extends ProgressBarUI implements ChangeListener, PropertyChangeListener, AncestorListener, Sizeable {
|
||||
private static final boolean ADJUSTTIMER = true;
|
||||
|
||||
private static final RecyclableSingleton<SizeDescriptor> sizeDescriptor = new RecyclableSingleton<SizeDescriptor>() {
|
||||
@ -76,12 +76,14 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
|
||||
protected AquaProgressBarUI() { }
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
progressBar = (JProgressBar)c;
|
||||
installDefaults();
|
||||
installListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
uninstallDefaults();
|
||||
uninstallListeners();
|
||||
@ -114,10 +116,12 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
progressBar.removeChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
progressBar.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String prop = e.getPropertyName();
|
||||
if ("indeterminate".equals(prop)) {
|
||||
@ -137,10 +141,12 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
|
||||
// listen for Ancestor events to stop our timer when we are no longer visible
|
||||
// <rdar://problem/5405035> JProgressBar: UI in Aqua look and feel causes memory leaks
|
||||
@Override
|
||||
public void ancestorRemoved(final AncestorEvent e) {
|
||||
stopAnimationTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorAdded(final AncestorEvent e) {
|
||||
if (!progressBar.isIndeterminate()) return;
|
||||
if (progressBar.isDisplayable()) {
|
||||
@ -148,8 +154,10 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorMoved(final AncestorEvent e) { }
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
revalidateAnimationTimers(); // revalidate to turn on/off timers when values change
|
||||
|
||||
@ -263,6 +271,7 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
return new Dimension(20, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
if (isCircular) {
|
||||
return getCircularPreferredSize();
|
||||
@ -322,6 +331,7 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
if (isCircular) {
|
||||
return getCircularPreferredSize();
|
||||
@ -340,6 +350,7 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
return pref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(final JComponent c) {
|
||||
if (isCircular) {
|
||||
return getCircularPreferredSize();
|
||||
@ -356,6 +367,7 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
return pref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySizeFor(final JComponent c, final Size size) {
|
||||
painter.state.set(sizeVariant = size == Size.MINI ? Size.SMALL : sizeVariant); // CUI doesn't support mini progress bars right now
|
||||
}
|
||||
@ -440,7 +452,7 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
progressBar.repaint(repaintRect);
|
||||
}
|
||||
|
||||
protected class Animator implements ActionListener {
|
||||
protected final class Animator implements ActionListener {
|
||||
private static final int MINIMUM_DELAY = 5;
|
||||
private Timer timer;
|
||||
private long previousDelay; // used to tune the repaint interval
|
||||
@ -476,6 +488,7 @@ public class AquaProgressBarUI extends ProgressBarUI implements ChangeListener,
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (!ADJUSTTIMER) {
|
||||
repaint();
|
||||
|
||||
@ -42,7 +42,7 @@ import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
*
|
||||
* AquaRootPaneUI is a singleton object
|
||||
*/
|
||||
public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener, WindowListener, ContainerListener {
|
||||
public final class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener, WindowListener, ContainerListener {
|
||||
private static final RecyclableSingleton<AquaRootPaneUI> sRootPaneUI = new RecyclableSingletonFromDefaultConstructor<AquaRootPaneUI>(AquaRootPaneUI.class);
|
||||
static final boolean sUseScreenMenuBar = AquaMenuBarUI.getScreenMenuBarProperty();
|
||||
|
||||
@ -50,6 +50,7 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
return sRootPaneUI.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
super.installUI(c);
|
||||
c.addAncestorListener(this);
|
||||
@ -80,6 +81,7 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
c.removeAncestorListener(this);
|
||||
|
||||
@ -97,6 +99,7 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
* because it holds the JMenuBar. So, if a new layered pane was added, listen to it.
|
||||
* If a new JMenuBar was added, tell the menu bar UI, because it will need to update the menu bar.
|
||||
*/
|
||||
@Override
|
||||
public void componentAdded(final ContainerEvent e) {
|
||||
if (e.getContainer() instanceof JRootPane) {
|
||||
final JRootPane root = (JRootPane)e.getContainer();
|
||||
@ -125,6 +128,7 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
* Likewise, when the layered pane is removed from the root pane, stop listening to it.
|
||||
* If the JMenuBar is removed, tell the menu bar UI to clear the menu bar.
|
||||
*/
|
||||
@Override
|
||||
public void componentRemoved(final ContainerEvent e) {
|
||||
if (e.getContainer() instanceof JRootPane) {
|
||||
final JRootPane root = (JRootPane)e.getContainer();
|
||||
@ -156,6 +160,7 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
* And, if a JMenuBar was added before the root pane was added to the window, we now need
|
||||
* to notify the menu bar UI.
|
||||
*/
|
||||
@Override
|
||||
public void ancestorAdded(final AncestorEvent event) {
|
||||
// this is so we can handle window activated and deactivated events so
|
||||
// our swing controls can color/enable/disable/focus draw correctly
|
||||
@ -178,27 +183,36 @@ public class AquaRootPaneUI extends BasicRootPaneUI implements AncestorListener,
|
||||
* before it was removed. By the time ancestorRemoved was called, the JRootPane has already been removed
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void ancestorRemoved(final AncestorEvent event) { }
|
||||
@Override
|
||||
public void ancestorMoved(final AncestorEvent event) { }
|
||||
|
||||
@Override
|
||||
public void windowActivated(final WindowEvent e) {
|
||||
updateComponentTreeUIActivation((Component)e.getSource(), Boolean.TRUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDeactivated(final WindowEvent e) {
|
||||
updateComponentTreeUIActivation((Component)e.getSource(), Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowOpened(final WindowEvent e) { }
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent e) { }
|
||||
|
||||
@Override
|
||||
public void windowClosed(final WindowEvent e) {
|
||||
// We know the window is closed so remove the listener.
|
||||
final Window w = e.getWindow();
|
||||
w.removeWindowListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowIconified(final WindowEvent e) { }
|
||||
@Override
|
||||
public void windowDeiconified(final WindowEvent e) { }
|
||||
public void windowStateChanged(final WindowEvent e) { }
|
||||
public void windowGainedFocus(final WindowEvent e) { }
|
||||
|
||||
@ -68,7 +68,7 @@ import apple.laf.JRSUIUtils;
|
||||
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
public class AquaScrollBarUI extends ScrollBarUI {
|
||||
public final class AquaScrollBarUI extends ScrollBarUI {
|
||||
private static final int kInitialDelay = 300;
|
||||
private static final int kNormalDelay = 100;
|
||||
|
||||
@ -96,12 +96,14 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
|
||||
public AquaScrollBarUI() { }
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
fScrollBar = (JScrollBar)c;
|
||||
installListeners();
|
||||
configureScrollBarColors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
uninstallListeners();
|
||||
fScrollBar = null;
|
||||
@ -169,6 +171,7 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
scrollBarState.set(shouldShowArrows() ? ShowArrows.YES : ShowArrows.NO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
syncState(c);
|
||||
Rectangle trackBounds = getTrackBounds();
|
||||
@ -268,7 +271,8 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
fScrollBar.getHeight() - (insets.top + insets.bottom), x, y);
|
||||
}
|
||||
|
||||
protected class PropertyChangeHandler implements PropertyChangeListener {
|
||||
protected final class PropertyChangeHandler implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String propertyName = e.getPropertyName();
|
||||
|
||||
@ -285,20 +289,22 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
}
|
||||
}
|
||||
|
||||
protected class ModelListener implements ChangeListener {
|
||||
protected final class ModelListener implements ChangeListener {
|
||||
@Override
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
layoutContainer(fScrollBar);
|
||||
}
|
||||
}
|
||||
|
||||
// Track mouse drags.
|
||||
protected class TrackListener extends MouseAdapter implements MouseMotionListener {
|
||||
protected final class TrackListener extends MouseAdapter implements MouseMotionListener {
|
||||
protected transient int fCurrentMouseX, fCurrentMouseY;
|
||||
protected transient boolean fInArrows; // are we currently tracking arrows?
|
||||
protected transient boolean fStillInArrow = false; // Whether mouse is in an arrow during arrow tracking
|
||||
protected transient boolean fStillInTrack = false; // Whether mouse is in the track during pageup/down tracking
|
||||
protected transient int fFirstMouseX, fFirstMouseY, fFirstValue; // Values for getValueFromOffset
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) {
|
||||
if (!fScrollBar.isEnabled()) return;
|
||||
if (fInArrows) {
|
||||
@ -315,6 +321,7 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
fScrollBar.revalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
if (!fScrollBar.isEnabled()) return;
|
||||
|
||||
@ -331,6 +338,7 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(final MouseEvent e) {
|
||||
if (!fScrollBar.isEnabled()) return;
|
||||
|
||||
@ -541,7 +549,7 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
/**
|
||||
* Listener for scrolling events initiated in the ScrollPane.
|
||||
*/
|
||||
protected class ScrollListener implements ActionListener {
|
||||
protected final class ScrollListener implements ActionListener {
|
||||
boolean fUseBlockIncrement;
|
||||
int fDirection = 1;
|
||||
|
||||
@ -553,6 +561,7 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
this.fUseBlockIncrement = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
Component parent = fScrollBar.getParent();
|
||||
do {
|
||||
@ -625,14 +634,17 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
* @see #getMaximumSize
|
||||
* @see #getMinimumSize
|
||||
*/
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
return isHorizontal() ? new Dimension(96, 15) : new Dimension(15, 96);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
return isHorizontal() ? new Dimension(54, 15) : new Dimension(15, 54);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(final JComponent c) {
|
||||
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
@ -699,7 +711,7 @@ public class AquaScrollBarUI extends ScrollBarUI {
|
||||
return startPoint;
|
||||
}
|
||||
|
||||
static class HitUtil {
|
||||
static final class HitUtil {
|
||||
static boolean isIncrement(final Hit hit) {
|
||||
return (hit == ScrollBarHit.ARROW_MAX) || (hit == ScrollBarHit.ARROW_MAX_INSIDE);
|
||||
}
|
||||
|
||||
@ -31,16 +31,18 @@ import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicScrollPaneUI;
|
||||
|
||||
public class AquaScrollPaneUI extends javax.swing.plaf.basic.BasicScrollPaneUI {
|
||||
public final class AquaScrollPaneUI extends javax.swing.plaf.basic.BasicScrollPaneUI {
|
||||
public static ComponentUI createUI(final JComponent x) {
|
||||
return new AquaScrollPaneUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseWheelListener createMouseWheelListener() {
|
||||
return new XYMouseWheelHandler();
|
||||
}
|
||||
|
||||
protected class XYMouseWheelHandler extends BasicScrollPaneUI.MouseWheelHandler {
|
||||
protected final class XYMouseWheelHandler extends BasicScrollPaneUI.MouseWheelHandler {
|
||||
@Override
|
||||
public void mouseWheelMoved(final MouseWheelEvent e) {
|
||||
super.mouseWheelMoved(e);
|
||||
// Consume the event even when the scrollBar is invisible
|
||||
|
||||
@ -39,7 +39,7 @@ import com.apple.laf.AquaUtilControlSize.SizeDescriptor;
|
||||
import com.apple.laf.AquaUtilControlSize.SizeVariant;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
public class AquaScrollRegionBorder extends AquaBorder {
|
||||
public final class AquaScrollRegionBorder extends AquaBorder {
|
||||
private static final RecyclableSingletonFromDefaultConstructor<AquaScrollRegionBorder> instance = new RecyclableSingletonFromDefaultConstructor<AquaScrollRegionBorder>(AquaScrollRegionBorder.class);
|
||||
|
||||
public static AquaScrollRegionBorder getScrollRegionBorder() {
|
||||
@ -57,6 +57,7 @@ public class AquaScrollRegionBorder extends AquaBorder {
|
||||
return AquaPainter.<JRSUIState>create(state, 7, 7, 3, 3, 3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
final State state = getState((JComponent)c);
|
||||
painter.state.set(state);
|
||||
|
||||
@ -42,7 +42,7 @@ import com.apple.laf.AquaUtilControlSize.*;
|
||||
import com.apple.laf.AquaImageFactory.NineSliceMetrics;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
public final class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
// static final Dimension roundThumbSize = new Dimension(21 + 4, 21 + 4); // +2px on both sides for focus fuzz
|
||||
// static final Dimension pointingThumbSize = new Dimension(19 + 4, 22 + 4);
|
||||
|
||||
@ -100,6 +100,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
super(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
super.installUI(c);
|
||||
|
||||
@ -107,28 +108,33 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
tickColor = UIManager.getColor("Slider.tickColor");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BasicSliderUI.TrackListener createTrackListener(final JSlider s) {
|
||||
return new TrackListener();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners(final JSlider s) {
|
||||
super.installListeners(s);
|
||||
AquaFocusHandler.install(s);
|
||||
AquaUtilControlSize.addSizePropertyListener(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners(final JSlider s) {
|
||||
AquaUtilControlSize.removeSizePropertyListener(s);
|
||||
AquaFocusHandler.uninstall(s);
|
||||
super.uninstallListeners(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySizeFor(final JComponent c, final Size size) {
|
||||
thumbPainter.state.set(size);
|
||||
trackPainter.state.set(size);
|
||||
}
|
||||
|
||||
// Paint Methods
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
// We have to override paint of BasicSliderUI because we need slight differences.
|
||||
// We don't paint focus the same way - it is part of the thumb.
|
||||
@ -214,6 +220,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
return State.ACTIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintTicks(final Graphics g) {
|
||||
if (slider.isEnabled()) {
|
||||
g.setColor(tickColor);
|
||||
@ -230,6 +237,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
// Layout Methods
|
||||
|
||||
// Used lots
|
||||
@Override
|
||||
protected void calculateThumbLocation() {
|
||||
super.calculateThumbLocation();
|
||||
|
||||
@ -252,6 +260,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
}
|
||||
|
||||
// Only called from calculateGeometry
|
||||
@Override
|
||||
protected void calculateThumbSize() {
|
||||
final SizeDescriptor descriptor = shouldUseArrowThumb() ? pointingThumbDescriptor.get() : roundThumbDescriptor.get();
|
||||
final SizeVariant variant = descriptor.get(slider);
|
||||
@ -274,6 +283,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void calculateTickRect() {
|
||||
// super assumes tickRect ends align with trackRect ends.
|
||||
// Ours need to inset by trackBuffer
|
||||
@ -293,14 +303,17 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
}
|
||||
|
||||
// Basic's preferred size doesn't allow for our focus ring, throwing off things like SwingSet2
|
||||
@Override
|
||||
public Dimension getPreferredHorizontalSize() {
|
||||
return new Dimension(190, 21);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredVerticalSize() {
|
||||
return new Dimension(21, 190);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChangeListener createChangeListener(final JSlider s) {
|
||||
return new ChangeListener() {
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
@ -313,10 +326,11 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
|
||||
// This is copied almost verbatim from superclass, except we changed things to use fIsDragging
|
||||
// instead of isDragging since isDragging was a private member.
|
||||
class TrackListener extends javax.swing.plaf.basic.BasicSliderUI.TrackListener {
|
||||
final class TrackListener extends javax.swing.plaf.basic.BasicSliderUI.TrackListener {
|
||||
protected transient int offset;
|
||||
protected transient int currentMouseX = -1, currentMouseY = -1;
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) {
|
||||
if (!slider.isEnabled()) return;
|
||||
|
||||
@ -342,6 +356,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
slider.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
if (!slider.isEnabled()) return;
|
||||
|
||||
@ -398,6 +413,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
fIsDragging = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldScroll(final int direction) {
|
||||
final Rectangle r = thumbRect;
|
||||
if (slider.getOrientation() == SwingConstants.VERTICAL) {
|
||||
@ -429,6 +445,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
* Set the models value to the position of the top/left
|
||||
* of the thumb relative to the origin of the track.
|
||||
*/
|
||||
@Override
|
||||
public void mouseDragged(final MouseEvent e) {
|
||||
int thumbMiddle = 0;
|
||||
|
||||
@ -493,6 +510,7 @@ public class AquaSliderUI extends BasicSliderUI implements Sizeable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(final MouseEvent e) { }
|
||||
}
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
* This is originally derived from BasicSpinnerUI, but they made everything
|
||||
* private so we can't subclass!
|
||||
*/
|
||||
public class AquaSpinnerUI extends SpinnerUI {
|
||||
public final class AquaSpinnerUI extends SpinnerUI {
|
||||
|
||||
private static final RecyclableSingleton<? extends PropertyChangeListener> propertyChangeListener
|
||||
= new RecyclableSingletonFromDefaultConstructor<>(PropertyChangeHandler.class);
|
||||
@ -270,7 +270,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class TransparentButton extends JButton implements SwingConstants {
|
||||
final class TransparentButton extends JButton implements SwingConstants {
|
||||
|
||||
boolean interceptRepaints = false;
|
||||
|
||||
@ -386,7 +386,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private static class ArrowButtonHandler extends AbstractAction implements FocusListener, MouseListener {
|
||||
private static final class ArrowButtonHandler extends AbstractAction implements FocusListener, MouseListener {
|
||||
|
||||
final javax.swing.Timer autoRepeatTimer;
|
||||
final boolean isNext;
|
||||
@ -607,9 +607,11 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
if (spinner == eventToSpinner(e)) {
|
||||
if (autoRepeatTimer.isRunning()) {
|
||||
@ -626,7 +628,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class SpinPainter extends JComponent {
|
||||
final class SpinPainter extends JComponent {
|
||||
|
||||
final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIStateFactory.getSpinnerArrows());
|
||||
|
||||
@ -693,7 +695,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
* the AquaSpinnerUI javadoc for more information about exactly how the
|
||||
* components are arranged.
|
||||
*/
|
||||
static class SpinnerLayout implements LayoutManager {
|
||||
static final class SpinnerLayout implements LayoutManager {
|
||||
|
||||
private Component nextButton = null;
|
||||
private Component previousButton = null;
|
||||
@ -800,7 +802,7 @@ public class AquaSpinnerUI extends SpinnerUI {
|
||||
* (although they can by overriding createPropertyChangeListener) since all
|
||||
* of the interesting property changes are delegated to protected methods.
|
||||
*/
|
||||
static class PropertyChangeHandler implements PropertyChangeListener {
|
||||
static final class PropertyChangeHandler implements PropertyChangeListener {
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
|
||||
@ -40,7 +40,7 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
public final class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIStateFactory.getSplitPaneDivider());
|
||||
|
||||
public AquaSplitPaneDividerUI(final AquaSplitPaneUI ui) {
|
||||
@ -52,6 +52,7 @@ public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
* Property change event, presumably from the JSplitPane, will message
|
||||
* updateOrientation if necessary.
|
||||
*/
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
if (e.getSource() == splitPane) {
|
||||
final String propName = e.getPropertyName();
|
||||
@ -80,6 +81,7 @@ public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
/**
|
||||
* Paints the divider.
|
||||
*/
|
||||
@Override
|
||||
public void paint(final Graphics g) {
|
||||
final Dimension size = getSize();
|
||||
int x = 0;
|
||||
@ -118,10 +120,12 @@ public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
return splitPane.isEnabled() ? State.ACTIVE : State.DISABLED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JButton createLeftOneTouchButton() {
|
||||
return createButtonForDirection(getDirection(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JButton createRightOneTouchButton() {
|
||||
return createButtonForDirection(getDirection(false));
|
||||
}
|
||||
@ -156,7 +160,8 @@ public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
}
|
||||
|
||||
static final int kMaxPopupArrowSize = 9;
|
||||
protected class DividerLayout extends BasicSplitPaneDivider.DividerLayout {
|
||||
protected final class DividerLayout extends BasicSplitPaneDivider.DividerLayout {
|
||||
@Override
|
||||
public void layoutContainer(final Container c) {
|
||||
final int maxSize = getMaxDividerSize();
|
||||
final Dimension size = getSize();
|
||||
@ -204,7 +209,7 @@ public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
return HorizontalSplitDividerGradientPainter.instance();
|
||||
}
|
||||
|
||||
static class HorizontalSplitDividerGradientPainter implements Border {
|
||||
static final class HorizontalSplitDividerGradientPainter implements Border {
|
||||
private static final RecyclableSingleton<HorizontalSplitDividerGradientPainter> instance = new RecyclableSingletonFromDefaultConstructor<HorizontalSplitDividerGradientPainter>(HorizontalSplitDividerGradientPainter.class);
|
||||
static HorizontalSplitDividerGradientPainter instance() {
|
||||
return instance.get();
|
||||
@ -214,14 +219,17 @@ public class AquaSplitPaneDividerUI extends BasicSplitPaneDivider {
|
||||
final Color endColor = new Color(217, 217, 217);
|
||||
final Color borderLines = Color.lightGray;
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
return new Insets(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
if (!(g instanceof Graphics2D)) return;
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ import javax.swing.border.Border;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.*;
|
||||
|
||||
public class AquaSplitPaneUI extends BasicSplitPaneUI implements MouseListener, PropertyChangeListener {
|
||||
public final class AquaSplitPaneUI extends BasicSplitPaneUI implements MouseListener, PropertyChangeListener {
|
||||
static final String DIVIDER_PAINTER_KEY = "JSplitPane.dividerPainter";
|
||||
|
||||
public AquaSplitPaneUI() {
|
||||
@ -44,22 +44,26 @@ public class AquaSplitPaneUI extends BasicSplitPaneUI implements MouseListener,
|
||||
return new AquaSplitPaneUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicSplitPaneDivider createDefaultDivider() {
|
||||
return new AquaSplitPaneDividerUI(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
splitPane.addPropertyChangeListener(DIVIDER_PAINTER_KEY, this);
|
||||
divider.addMouseListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
divider.removeMouseListener(this);
|
||||
splitPane.removePropertyChangeListener(DIVIDER_PAINTER_KEY, this);
|
||||
super.uninstallListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
if (e.getClickCount() < 2) return;
|
||||
if (!splitPane.isOneTouchExpandable()) return;
|
||||
@ -90,11 +94,16 @@ public class AquaSplitPaneUI extends BasicSplitPaneUI implements MouseListener,
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) { }
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent evt) {
|
||||
if (!DIVIDER_PAINTER_KEY.equals(evt.getPropertyName())) return;
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ import sun.swing.SwingUtilities2;
|
||||
import apple.laf.JRSUIUtils;
|
||||
import apple.laf.JRSUIConstants.*;
|
||||
|
||||
public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
|
||||
public final class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
|
||||
private static boolean isFrameActive = false;
|
||||
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
@ -50,6 +50,7 @@ public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
|
||||
|
||||
public AquaTabbedPaneContrastUI() { }
|
||||
|
||||
@Override
|
||||
protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetrics metrics, final Rectangle textRect, final int tabIndex, final String title) {
|
||||
final View v = getTextViewForTab(tabIndex);
|
||||
if (v != null) {
|
||||
@ -101,10 +102,12 @@ public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
|
||||
return ((MouseHandler)mouseListener).trackingTab == index;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldRepaintSelectedTabOnMouseDown() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State getState(final int index, final boolean frameActive, final boolean isSelected) {
|
||||
isFrameActive = frameActive;
|
||||
if (!frameActive) return State.INACTIVE;
|
||||
@ -113,11 +116,13 @@ public class AquaTabbedPaneContrastUI extends AquaTabbedPaneUI {
|
||||
return State.ACTIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SegmentTrailingSeparator getSegmentTrailingSeparator(final int index, final int selectedIndex, final boolean isLeftToRight) {
|
||||
if (isTabBeforeSelectedTab(index, selectedIndex, isLeftToRight)) return SegmentTrailingSeparator.NO;
|
||||
return SegmentTrailingSeparator.YES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SegmentLeadingSeparator getSegmentLeadingSeparator(final int index, final int selectedIndex, final boolean isLeftToRight) {
|
||||
if (index == selectedIndex) return SegmentLeadingSeparator.YES;
|
||||
return SegmentLeadingSeparator.NO;
|
||||
|
||||
@ -211,6 +211,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
// UI Installation/De-installation
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
this.tabPane = (JTabbedPane)c;
|
||||
|
||||
@ -224,6 +225,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
installKeyboardActions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
uninstallKeyboardActions();
|
||||
uninstallListeners();
|
||||
@ -572,11 +574,13 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
return rolloverTabIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
// Default to LayoutManager's minimumLayoutSize
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(final JComponent c) {
|
||||
// Default to LayoutManager's maximumLayoutSize
|
||||
return null;
|
||||
@ -590,6 +594,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* @see javax.swing.JComponent#getBaseline(int, int)
|
||||
* @since 1.6
|
||||
*/
|
||||
@Override
|
||||
public int getBaseline(final JComponent c, final int width, final int height) {
|
||||
super.getBaseline(c, width, height);
|
||||
int baseline = calculateBaselineIfNecessary();
|
||||
@ -621,6 +626,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* @see javax.swing.JComponent#getBaseline(int, int)
|
||||
* @since 1.6
|
||||
*/
|
||||
@Override
|
||||
public Component.BaselineResizeBehavior getBaselineResizeBehavior(final JComponent c) {
|
||||
super.getBaselineResizeBehavior(c);
|
||||
switch (tabPane.getTabPlacement()) {
|
||||
@ -742,6 +748,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
// UI Rendering
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
final int selectedIndex = tabPane.getSelectedIndex();
|
||||
final int tabPlacement = tabPane.getTabPlacement();
|
||||
@ -1349,12 +1356,14 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* Returns the bounds of the specified tab index. The bounds are
|
||||
* with respect to the JTabbedPane's coordinate space.
|
||||
*/
|
||||
@Override
|
||||
public Rectangle getTabBounds(final JTabbedPane pane, final int i) {
|
||||
ensureCurrentLayout();
|
||||
final Rectangle tabRect = new Rectangle();
|
||||
return getTabBounds(i, tabRect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTabRunCount(final JTabbedPane pane) {
|
||||
ensureCurrentLayout();
|
||||
return runCount;
|
||||
@ -1364,6 +1373,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* Returns the tab index which intersects the specified point
|
||||
* in the JTabbedPane's coordinate space.
|
||||
*/
|
||||
@Override
|
||||
public int tabForCoordinate(final JTabbedPane pane, final int x, final int y) {
|
||||
return tabForCoordinate(pane, x, y, true);
|
||||
}
|
||||
@ -2010,7 +2020,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
return SwingUtilities2.tabbedPaneChangeFocusTo(getVisibleComponent());
|
||||
}
|
||||
|
||||
private static class Actions extends UIAction {
|
||||
private static final class Actions extends UIAction {
|
||||
static final String NEXT = "navigateNext";
|
||||
static final String PREVIOUS = "navigatePrevious";
|
||||
static final String RIGHT = "navigateRight";
|
||||
@ -2037,6 +2047,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final String key = getName();
|
||||
final JTabbedPane pane = (JTabbedPane)e.getSource();
|
||||
@ -2117,14 +2128,18 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
// END MACOSX
|
||||
|
||||
@Override
|
||||
public void addLayoutComponent(final String name, final Component comp) {}
|
||||
|
||||
@Override
|
||||
public void removeLayoutComponent(final Component comp) {}
|
||||
|
||||
@Override
|
||||
public Dimension preferredLayoutSize(final Container parent) {
|
||||
return calculateSize(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension minimumLayoutSize(final Container parent) {
|
||||
return calculateSize(true);
|
||||
}
|
||||
@ -2202,6 +2217,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
return total;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void layoutContainer(final Container parent) {
|
||||
/* Some of the code in this method deals with changing the
|
||||
@ -2687,16 +2703,19 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
}
|
||||
|
||||
class TabbedPaneScrollLayout extends TabbedPaneLayout {
|
||||
final class TabbedPaneScrollLayout extends TabbedPaneLayout {
|
||||
|
||||
@Override
|
||||
protected int preferredTabAreaHeight(final int tabPlacement, final int width) {
|
||||
return calculateMaxTabHeight(tabPlacement);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int preferredTabAreaWidth(final int tabPlacement, final int height) {
|
||||
return calculateMaxTabWidth(tabPlacement);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void layoutContainer(final Container parent) {
|
||||
/* Some of the code in this method deals with changing the
|
||||
@ -2931,6 +2950,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void calculateTabRects(final int tabPlacement, final int tabCount) {
|
||||
final FontMetrics metrics = getFontMetrics();
|
||||
final Dimension size = tabPane.getSize();
|
||||
@ -3029,7 +3049,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
}
|
||||
|
||||
private class ScrollableTabSupport implements ActionListener, ChangeListener {
|
||||
private final class ScrollableTabSupport implements ActionListener, ChangeListener {
|
||||
public ScrollableTabViewport viewport;
|
||||
public ScrollableTabPanel tabPanel;
|
||||
public JButton scrollForwardButton;
|
||||
@ -3127,6 +3147,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
viewport.setViewPosition(tabViewPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
updateView();
|
||||
}
|
||||
@ -3185,6 +3206,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
/**
|
||||
* ActionListener for the scroll buttons.
|
||||
*/
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
final ActionMap map = tabPane.getActionMap();
|
||||
|
||||
@ -3204,6 +3226,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "viewport.viewSize=" + viewport.getViewSize() + "\n"
|
||||
+ "viewport.viewRectangle=" + viewport.getViewRect() + "\n"
|
||||
@ -3214,7 +3237,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private class ScrollableTabViewport extends JViewport implements UIResource {
|
||||
private final class ScrollableTabViewport extends JViewport implements UIResource {
|
||||
public ScrollableTabViewport() {
|
||||
super();
|
||||
setName("TabbedPane.scrollableViewport");
|
||||
@ -3229,7 +3252,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private class ScrollableTabPanel extends JPanel implements UIResource {
|
||||
private final class ScrollableTabPanel extends JPanel implements UIResource {
|
||||
public ScrollableTabPanel() {
|
||||
super(null);
|
||||
setOpaque(tabPane.isOpaque());
|
||||
@ -3240,6 +3263,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
setBackground(bgColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(final Graphics g) {
|
||||
super.paintComponent(g);
|
||||
AquaTabbedPaneCopyFromBasicUI.this.paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex());
|
||||
@ -3251,6 +3275,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doLayout() {
|
||||
if (getComponentCount() > 0) {
|
||||
final Component child = getComponent(0);
|
||||
@ -3260,7 +3285,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private static class ScrollableTabButton extends javax.swing.plaf.basic.BasicArrowButton implements UIResource, SwingConstants {
|
||||
private static final class ScrollableTabButton extends javax.swing.plaf.basic.BasicArrowButton implements UIResource, SwingConstants {
|
||||
public ScrollableTabButton(final int direction) {
|
||||
super(direction, UIManager.getColor("TabbedPane.selected"), UIManager.getColor("TabbedPane.shadow"), UIManager.getColor("TabbedPane.darkShadow"), UIManager.getColor("TabbedPane.highlight"));
|
||||
}
|
||||
@ -3268,10 +3293,11 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
|
||||
// Controller: event listeners
|
||||
|
||||
private class Handler implements ChangeListener, ContainerListener, FocusListener, MouseListener, MouseMotionListener, PropertyChangeListener {
|
||||
private final class Handler implements ChangeListener, ContainerListener, FocusListener, MouseListener, MouseMotionListener, PropertyChangeListener {
|
||||
//
|
||||
// PropertyChangeListener
|
||||
//
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final JTabbedPane pane = (JTabbedPane)e.getSource();
|
||||
final String name = e.getPropertyName();
|
||||
@ -3330,6 +3356,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
//
|
||||
// ChangeListener
|
||||
//
|
||||
@Override
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
final JTabbedPane tabPane = (JTabbedPane)e.getSource();
|
||||
tabPane.revalidate();
|
||||
@ -3348,18 +3375,23 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
//
|
||||
// MouseListener
|
||||
//
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent e) {}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) {}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) {
|
||||
setRolloverTab(e.getX(), e.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) {
|
||||
setRolloverTab(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
if (!tabPane.isEnabled()) {
|
||||
return;
|
||||
@ -3383,8 +3415,10 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
//
|
||||
// MouseMotionListener
|
||||
//
|
||||
@Override
|
||||
public void mouseDragged(final MouseEvent e) {}
|
||||
|
||||
@Override
|
||||
public void mouseMoved(final MouseEvent e) {
|
||||
setRolloverTab(e.getX(), e.getY());
|
||||
}
|
||||
@ -3392,10 +3426,12 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
//
|
||||
// FocusListener
|
||||
//
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
setFocusIndex(tabPane.getSelectedIndex(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
repaintTab(focusIndex);
|
||||
}
|
||||
@ -3433,6 +3469,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
changes to tab text, this code should be removed and
|
||||
replaced by something which uses that. */
|
||||
|
||||
@Override
|
||||
public void componentAdded(final ContainerEvent e) {
|
||||
final JTabbedPane tp = (JTabbedPane)e.getContainer();
|
||||
final Component child = e.getChild();
|
||||
@ -3469,6 +3506,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRemoved(final ContainerEvent e) {
|
||||
final JTabbedPane tp = (JTabbedPane)e.getContainer();
|
||||
final Component child = e.getChild();
|
||||
@ -3505,6 +3543,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
// its functionality has been moved into Handler. If you need to add
|
||||
// new functionality add it to the Handler, but make sure this
|
||||
// class calls into the Handler.
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
getHandler().propertyChange(e);
|
||||
}
|
||||
@ -3514,11 +3553,12 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* This class should be treated as a "protected" inner class.
|
||||
* Instantiate it only within subclasses of BasicTabbedPaneUI.
|
||||
*/
|
||||
public class TabSelectionHandler implements ChangeListener {
|
||||
public final class TabSelectionHandler implements ChangeListener {
|
||||
// NOTE: This class exists only for backward compatibility. All
|
||||
// its functionality has been moved into Handler. If you need to add
|
||||
// new functionality add it to the Handler, but make sure this
|
||||
// class calls into the Handler.
|
||||
@Override
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
getHandler().stateChanged(e);
|
||||
}
|
||||
@ -3528,11 +3568,12 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* This class should be treated as a "protected" inner class.
|
||||
* Instantiate it only within subclasses of BasicTabbedPaneUI.
|
||||
*/
|
||||
public class MouseHandler extends MouseAdapter {
|
||||
public final class MouseHandler extends MouseAdapter {
|
||||
// NOTE: This class exists only for backward compatibility. All
|
||||
// its functionality has been moved into Handler. If you need to add
|
||||
// new functionality add it to the Handler, but make sure this
|
||||
// class calls into the Handler.
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
getHandler().mousePressed(e);
|
||||
}
|
||||
@ -3542,15 +3583,17 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* This class should be treated as a "protected" inner class.
|
||||
* Instantiate it only within subclasses of BasicTabbedPaneUI.
|
||||
*/
|
||||
public class FocusHandler extends FocusAdapter {
|
||||
public final class FocusHandler extends FocusAdapter {
|
||||
// NOTE: This class exists only for backward compatibility. All
|
||||
// its functionality has been moved into Handler. If you need to add
|
||||
// new functionality add it to the Handler, but make sure this
|
||||
// class calls into the Handler.
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
getHandler().focusGained(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
getHandler().focusLost(e);
|
||||
}
|
||||
@ -3573,7 +3616,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private class TabContainer extends JPanel implements UIResource {
|
||||
private final class TabContainer extends JPanel implements UIResource {
|
||||
private boolean notifyTabbedPane = true;
|
||||
|
||||
public TabContainer() {
|
||||
@ -3581,6 +3624,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
setOpaque(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(final Component comp) {
|
||||
final int index = tabPane.indexOfTabComponent(comp);
|
||||
super.remove(comp);
|
||||
@ -3600,10 +3644,12 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptimizedDrawingEnabled() {
|
||||
return tabScroller != null && !tabScroller.croppedEdge.isParamsSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doLayout() {
|
||||
// We layout tabComponents in JTabbedPane's layout manager
|
||||
// and use this method as a hook for repainting tabs
|
||||
@ -3618,7 +3664,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
private class CroppedEdge extends JPanel implements UIResource {
|
||||
private final class CroppedEdge extends JPanel implements UIResource {
|
||||
private Shape shape;
|
||||
private int tabIndex;
|
||||
private int cropline;
|
||||
@ -3675,6 +3721,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
return UIManager.getColor("control");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(final Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (isParamsSet() && g instanceof Graphics2D) {
|
||||
@ -3698,7 +3745,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
* @author Scott Violet
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class LazyActionMap extends ActionMapUIResource {
|
||||
static final class LazyActionMap extends ActionMapUIResource {
|
||||
/**
|
||||
* Object to invoke {@code loadActionMap} on. This may be
|
||||
* a Class object.
|
||||
@ -3756,41 +3803,49 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
|
||||
put(action.getValue(Action.NAME), action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(final Object key, final Action action) {
|
||||
loadIfNecessary();
|
||||
super.put(key, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action get(final Object key) {
|
||||
loadIfNecessary();
|
||||
return super.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(final Object key) {
|
||||
loadIfNecessary();
|
||||
super.remove(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
loadIfNecessary();
|
||||
super.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] keys() {
|
||||
loadIfNecessary();
|
||||
return super.keys();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
loadIfNecessary();
|
||||
return super.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] allKeys() {
|
||||
loadIfNecessary();
|
||||
return super.allKeys();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(final ActionMap map) {
|
||||
loadIfNecessary();
|
||||
super.setParent(map);
|
||||
|
||||
@ -29,7 +29,7 @@ import java.awt.*;
|
||||
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
class AquaTabbedPaneTabState {
|
||||
final class AquaTabbedPaneTabState {
|
||||
static final int FIXED_SCROLL_TAB_LENGTH = 27;
|
||||
|
||||
protected final Rectangle leftScrollTabRect = new Rectangle();
|
||||
|
||||
@ -66,6 +66,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
|
||||
public AquaTabbedPaneUI() { }
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
|
||||
@ -75,6 +76,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
@ -90,6 +92,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
tabPane.setOpaque(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void assureRectsCreated(final int tabCount) {
|
||||
visibleTabState.init(tabCount);
|
||||
super.assureRectsCreated(tabCount);
|
||||
@ -106,22 +109,27 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
super.uninstallListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallDefaults() {
|
||||
contentDrawingInsets.set(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseListener createMouseListener() {
|
||||
return new MouseHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FocusListener createFocusListener() {
|
||||
return new FocusHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyChangeListener createPropertyChangeListener() {
|
||||
return new TabbedPanePropertyChangeHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LayoutManager createLayoutManager() {
|
||||
return new AquaTruncatingTabbedPaneLayout();
|
||||
}
|
||||
@ -137,6 +145,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
final Rectangle fTextRect = new Rectangle();
|
||||
|
||||
// UI Rendering
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
painter.state.set(getDirection());
|
||||
|
||||
@ -229,6 +238,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
r.height = temp;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTabLabelShiftX(final int tabPlacement, final int tabIndex, final boolean isSelected) {
|
||||
final Rectangle tabRect = (tabIndex >= 0 ? rects[tabIndex] : visibleTabState.getRightScrollTabRect());
|
||||
int nudge = 0;
|
||||
@ -245,6 +255,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
return nudge;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTabLabelShiftY(final int tabPlacement, final int tabIndex, final boolean isSelected) {
|
||||
switch (tabPlacement) {
|
||||
case RIGHT:
|
||||
@ -546,7 +557,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
* whether we're talking about a first tab or last tab. NOTE that this code is very much
|
||||
* Aqua 2 dependent!
|
||||
*/
|
||||
static class AlterRects {
|
||||
static final class AlterRects {
|
||||
Rectangle standard, first, last;
|
||||
AlterRects(final int x, final int y, final int w, final int h) { standard = new Rectangle(x, y, w, h); }
|
||||
AlterRects start(final int x, final int y, final int w, final int h) { first = new Rectangle(x, y, w, h); return this; }
|
||||
@ -588,6 +599,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
g.fillRoundRect(fillRect.x, fillRect.y, fillRect.width, fillRect.height, 3, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Insets getContentBorderInsets(final int tabPlacement) {
|
||||
final Insets draw = getContentDrawingInsets(tabPlacement); // will be rotated
|
||||
|
||||
@ -635,6 +647,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
return currentContentDrawingInsets;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Icon getIconForTab(final int tabIndex) {
|
||||
final Icon mainIcon = super.getIconForTab(tabIndex);
|
||||
if (mainIcon == null) return null;
|
||||
@ -652,6 +665,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
}
|
||||
|
||||
private static final int TAB_BORDER_INSET = 9;
|
||||
@Override
|
||||
protected void paintContentBorder(final Graphics g, final int tabPlacement, final int selectedIndex) {
|
||||
final int width = tabPane.getWidth();
|
||||
final int height = tabPane.getHeight();
|
||||
@ -745,6 +759,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
* Returns the tab index which intersects the specified point
|
||||
* in the JTabbedPane's coordinate space.
|
||||
*/
|
||||
@Override
|
||||
public int tabForCoordinate(final JTabbedPane pane, final int x, final int y) {
|
||||
ensureCurrentLayout();
|
||||
final Point p = new Point(x, y);
|
||||
@ -764,6 +779,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Insets getTabInsets(final int tabPlacement, final int tabIndex) {
|
||||
switch (tabPlacement) {
|
||||
case LEFT: return UIManager.getInsets("TabbedPane.leftTabInsets");
|
||||
@ -773,6 +789,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
}
|
||||
|
||||
// This is the preferred size - the layout manager will ignore if it has to
|
||||
@Override
|
||||
protected int calculateTabHeight(final int tabPlacement, final int tabIndex, final int fontHeight) {
|
||||
// Constrain to what the Mac allows
|
||||
final int result = super.calculateTabHeight(tabPlacement, tabIndex, fontHeight);
|
||||
@ -783,11 +800,13 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
}
|
||||
|
||||
// JBuilder requested this - it's against HI, but then so are multiple rows
|
||||
@Override
|
||||
protected boolean shouldRotateTabRuns(final int tabPlacement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected class TabbedPanePropertyChangeHandler extends PropertyChangeHandler {
|
||||
protected final class TabbedPanePropertyChangeHandler extends PropertyChangeHandler {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String prop = e.getPropertyName();
|
||||
|
||||
@ -807,6 +826,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ChangeListener createChangeListener() {
|
||||
return new ChangeListener() {
|
||||
public void stateChanged(final ChangeEvent e) {
|
||||
@ -818,9 +838,10 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
};
|
||||
}
|
||||
|
||||
protected class FocusHandler extends FocusAdapter {
|
||||
protected final class FocusHandler extends FocusAdapter {
|
||||
Rectangle sWorkingRect = new Rectangle();
|
||||
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
if (isDefaultFocusReceiver(tabPane) && !hasAvoidedFirstFocus) {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent();
|
||||
@ -829,6 +850,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
adjustPaintingRectForFocusRing(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
adjustPaintingRectForFocusRing(e);
|
||||
}
|
||||
@ -862,7 +884,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
}
|
||||
}
|
||||
|
||||
class MouseHandler extends MouseInputAdapter implements ActionListener {
|
||||
final class MouseHandler extends MouseInputAdapter implements ActionListener {
|
||||
|
||||
int trackingTab = -3;
|
||||
private final Timer popupTimer = new Timer(500, this);
|
||||
@ -876,6 +898,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
popupTimer.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) {
|
||||
final JTabbedPane pane = (JTabbedPane)e.getSource();
|
||||
if (!pane.isEnabled()) {
|
||||
@ -898,6 +921,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
repaint(pane, pressedTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(final MouseEvent e) {
|
||||
if (trackingTab < -2) return;
|
||||
|
||||
@ -917,6 +941,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
repaint(pane, trackingTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) {
|
||||
if (trackingTab < -2) return;
|
||||
|
||||
@ -944,6 +969,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
trackingTab = -3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (trackingTab != pressedTab) {
|
||||
return;
|
||||
@ -1063,8 +1089,9 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
}
|
||||
}
|
||||
|
||||
protected class AquaTruncatingTabbedPaneLayout extends AquaTabbedPaneCopyFromBasicUI.TabbedPaneLayout {
|
||||
protected final class AquaTruncatingTabbedPaneLayout extends AquaTabbedPaneCopyFromBasicUI.TabbedPaneLayout {
|
||||
// fix for Radar #3346131
|
||||
@Override
|
||||
protected int preferredTabAreaWidth(final int tabPlacement, final int height) {
|
||||
// Our superclass wants to stack tabs, but we rotate them,
|
||||
// so when tabs are on the left or right we know that
|
||||
@ -1077,6 +1104,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
return super.preferredTabAreaWidth(tabPlacement, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int preferredTabAreaHeight(final int tabPlacement, final int width) {
|
||||
if (tabPlacement == SwingConstants.LEFT || tabPlacement == SwingConstants.RIGHT) {
|
||||
return super.preferredTabAreaWidth(tabPlacement, width);
|
||||
@ -1085,6 +1113,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
return super.preferredTabAreaHeight(tabPlacement, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void calculateTabRects(final int tabPlacement, final int tabCount) {
|
||||
if (tabCount <= 0) return;
|
||||
|
||||
@ -1096,6 +1125,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
visibleTabState.alignRectsRunFor(rects, tabPane.getSize(), tabPlacement, AquaUtils.isLeftToRight(tabPane));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void padTabRun(final int tabPlacement, final int start, final int end, final int max) {
|
||||
if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) {
|
||||
super.padTabRun(tabPlacement, start, end, max);
|
||||
@ -1247,6 +1277,7 @@ public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
|
||||
rect.width = maxTabWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void layoutTabComponents() {
|
||||
final Container tabContainer = getTabContainer();
|
||||
if (tabContainer == null) return;
|
||||
|
||||
@ -37,7 +37,7 @@ import apple.laf.JRSUIConstants.*;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public class AquaTableHeaderBorder extends AbstractBorder {
|
||||
public final class AquaTableHeaderBorder extends AbstractBorder {
|
||||
protected static final int SORT_NONE = 0;
|
||||
protected static final int SORT_ASCENDING = 1;
|
||||
protected static final int SORT_DECENDING = -1;
|
||||
@ -67,6 +67,7 @@ public class AquaTableHeaderBorder extends AbstractBorder {
|
||||
* @param height the height of the painted border
|
||||
*/
|
||||
protected boolean doPaint = true;
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
if (!doPaint) return;
|
||||
final JComponent jc = (JComponent)c;
|
||||
@ -140,11 +141,13 @@ public class AquaTableHeaderBorder extends AbstractBorder {
|
||||
* Returns the insets of the border.
|
||||
* @param c the component for which this border insets value applies
|
||||
*/
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
// bad to create new one each time. For debugging only.
|
||||
return editorBorderInsets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c, final Insets insets) {
|
||||
insets.left = editorBorderInsets.left;
|
||||
insets.top = editorBorderInsets.top;
|
||||
@ -158,6 +161,7 @@ public class AquaTableHeaderBorder extends AbstractBorder {
|
||||
* is opaque, it is responsible for filling in it's own
|
||||
* background when painting.
|
||||
*/
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ import com.apple.laf.ClientPropertyApplicator;
|
||||
import com.apple.laf.ClientPropertyApplicator.Property;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
public final class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
private int originalHeaderAlignment;
|
||||
protected int sortColumn;
|
||||
protected int sortOrder;
|
||||
@ -46,6 +46,7 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
return new AquaTableHeaderUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
@ -57,6 +58,7 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallDefaults() {
|
||||
final TableCellRenderer renderer = header.getDefaultRenderer();
|
||||
if (renderer instanceof UIResource && renderer instanceof DefaultTableCellRenderer) {
|
||||
@ -112,7 +114,8 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class AquaTableCellRenderer extends DefaultTableCellRenderer implements UIResource {
|
||||
final class AquaTableCellRenderer extends DefaultTableCellRenderer implements UIResource {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(final JTable localTable, final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) {
|
||||
if (localTable != null) {
|
||||
if (header != null) {
|
||||
@ -165,11 +168,13 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
return (AquaTableHeaderBorder)border;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
getTableHeaderApplicators().attachAndApplyClientProperties(header);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
getTableHeaderApplicators().removeFrom(header);
|
||||
super.uninstallListeners();
|
||||
@ -232,6 +237,7 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
* Return the minimum size of the header. The minimum width is the sum of the minimum widths of each column (plus
|
||||
* inter-cell spacing).
|
||||
*/
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
long width = 0;
|
||||
final Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
|
||||
@ -247,6 +253,7 @@ public class AquaTableHeaderUI extends BasicTableHeaderUI {
|
||||
* the components provided by the header renderers. The preferred width is the sum of the preferred widths of each
|
||||
* column (plus inter-cell spacing).
|
||||
*/
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
long width = 0;
|
||||
final Enumeration<TableColumn> enumeration = header.getColumnModel().getColumns();
|
||||
|
||||
@ -38,7 +38,7 @@ import javax.swing.plaf.basic.BasicTableUI;
|
||||
*
|
||||
* All this does is look for a ThemeBorder and invalidate it when the focus changes
|
||||
*/
|
||||
public class AquaTableUI extends BasicTableUI {
|
||||
public final class AquaTableUI extends BasicTableUI {
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return new AquaTableUI();
|
||||
}
|
||||
@ -46,6 +46,7 @@ public class AquaTableUI extends BasicTableUI {
|
||||
/**
|
||||
* Creates the focus listener to repaint the focus ring
|
||||
*/
|
||||
@Override
|
||||
protected FocusListener createFocusListener() {
|
||||
return new AquaTableUI.FocusHandler();
|
||||
}
|
||||
@ -53,6 +54,7 @@ public class AquaTableUI extends BasicTableUI {
|
||||
/**
|
||||
* Creates the mouse listener for the JTable.
|
||||
*/
|
||||
@Override
|
||||
protected MouseInputListener createMouseInputListener() {
|
||||
return new AquaTableUI.MouseInputHandler();
|
||||
}
|
||||
@ -62,12 +64,14 @@ public class AquaTableUI extends BasicTableUI {
|
||||
* This class should be treated as a "protected" inner class.
|
||||
* Instantiate it only within subclasses of BasicTableUI.
|
||||
*/
|
||||
public class FocusHandler extends BasicTableUI.FocusHandler {
|
||||
public final class FocusHandler extends BasicTableUI.FocusHandler {
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
super.focusGained(e);
|
||||
AquaBorder.repaintBorder(getComponent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
super.focusLost(e);
|
||||
AquaBorder.repaintBorder(getComponent());
|
||||
@ -81,12 +85,14 @@ public class AquaTableUI extends BasicTableUI {
|
||||
AquaFocusHandler.swapSelectionColors("Table", getComponent(), ev.getNewValue());
|
||||
}
|
||||
};
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
table.addFocusListener(focusHandler);
|
||||
table.addPropertyChangeListener(focusHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
table.removePropertyChangeListener(focusHandler);
|
||||
table.removeFocusListener(focusHandler);
|
||||
@ -97,7 +103,7 @@ public class AquaTableUI extends BasicTableUI {
|
||||
|
||||
// Replace the mouse event with one that returns the cmd-key state when asked
|
||||
// for the control-key state, which super assumes is what everyone does to discontiguously extend selections
|
||||
public class MouseInputHandler extends BasicTableUI.MouseInputHandler {
|
||||
public final class MouseInputHandler extends BasicTableUI.MouseInputHandler {
|
||||
/*public void mousePressed(final MouseEvent e) {
|
||||
super.mousePressed(new SelectionMouseEvent(e));
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicTextAreaUI;
|
||||
import javax.swing.text.*;
|
||||
|
||||
public class AquaTextAreaUI extends BasicTextAreaUI {
|
||||
public final class AquaTextAreaUI extends BasicTextAreaUI {
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return new AquaTextAreaUI();
|
||||
}
|
||||
|
||||
@ -56,11 +56,13 @@ public class AquaTextFieldBorder extends AquaBorder {
|
||||
super(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setSize(final Size size) {
|
||||
super.setSize(size);
|
||||
painter.state.set(Size.LARGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, int x, int y, int width, int height) {
|
||||
// g.setColor(Color.MAGENTA);
|
||||
// g.drawRect(x, y, width - 1, height - 1);
|
||||
@ -122,6 +124,7 @@ public class AquaTextFieldBorder extends AquaBorder {
|
||||
return insets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
if (!(c instanceof JTextComponent) || c.isOpaque()) return new InsetsUIResource(3, 7, 3, 7);
|
||||
return new InsetsUIResource(5, 5, 5, 5);
|
||||
|
||||
@ -35,7 +35,7 @@ import javax.swing.text.JTextComponent;
|
||||
* This class exists only as a hack to work around a Sun bug which parks the
|
||||
* insertion caret at the beginning of a text field when it gets clicked on.
|
||||
*/
|
||||
public class AquaTextFieldFormattedUI extends AquaTextFieldUI implements MouseListener {
|
||||
public final class AquaTextFieldFormattedUI extends AquaTextFieldUI implements MouseListener {
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return new AquaTextFieldFormattedUI();
|
||||
}
|
||||
@ -45,16 +45,19 @@ public class AquaTextFieldFormattedUI extends AquaTextFieldUI implements MouseLi
|
||||
return "FormattedTextField";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
getComponent().addMouseListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
getComponent().removeMouseListener(this);
|
||||
super.uninstallListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void mouseClicked(final MouseEvent e) {
|
||||
if (e.getClickCount() != 1) return;
|
||||
@ -66,8 +69,12 @@ public class AquaTextFieldFormattedUI extends AquaTextFieldUI implements MouseLi
|
||||
c.setCaretPosition(viewToModel(c, e.getPoint()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mouseExited(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mousePressed(final MouseEvent e) { }
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) { }
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ import com.apple.laf.AquaIcon.DynamicallySizingJRSUIIcon;
|
||||
import com.apple.laf.AquaUtilControlSize.*;
|
||||
import com.apple.laf.AquaUtils.*;
|
||||
|
||||
public class AquaTextFieldSearch {
|
||||
public final class AquaTextFieldSearch {
|
||||
private static final String VARIANT_KEY = "JTextField.variant";
|
||||
private static final String SEARCH_VARIANT_VALUE = "search";
|
||||
|
||||
@ -58,7 +58,8 @@ public class AquaTextFieldSearch {
|
||||
c.removePropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
|
||||
}
|
||||
|
||||
static class SearchFieldPropertyListener implements PropertyChangeListener {
|
||||
static final class SearchFieldPropertyListener implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent evt) {
|
||||
final Object source = evt.getSource();
|
||||
if (!(source instanceof JTextComponent)) return;
|
||||
@ -290,7 +291,7 @@ public class AquaTextFieldSearch {
|
||||
}
|
||||
|
||||
// subclass of normal text border, because we still want all the normal text field behaviors
|
||||
static class SearchFieldBorder extends AquaTextFieldBorder implements JComponentPainter {
|
||||
static final class SearchFieldBorder extends AquaTextFieldBorder implements JComponentPainter {
|
||||
protected boolean reallyPaintBorder;
|
||||
|
||||
public SearchFieldBorder() {
|
||||
@ -302,6 +303,7 @@ public class AquaTextFieldSearch {
|
||||
super(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final JComponent c, final Graphics g, final int x, final int y, final int w, final int h) {
|
||||
reallyPaintBorder = true;
|
||||
paintBorder(c, g, x, y, w, h);
|
||||
@ -309,11 +311,13 @@ public class AquaTextFieldSearch {
|
||||
}
|
||||
|
||||
// apparently without adjusting for odd height pixels, the search field "wobbles" relative to it's contents
|
||||
@Override
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
if (!reallyPaintBorder) return;
|
||||
super.paintBorder(c, g, x, y - (height % 2), width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final Component c) {
|
||||
if (doingLayout) return new Insets(0, 0, 0, 0);
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ import javax.swing.plaf.basic.BasicTextPaneUI;
|
||||
import javax.swing.text.*;
|
||||
|
||||
//[3663467] moved it to sublcass from BasicEditorPaneUI to BasicTextPaneUI. (vm)
|
||||
public class AquaTextPaneUI extends BasicTextPaneUI {
|
||||
public final class AquaTextPaneUI extends BasicTextPaneUI {
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
return new AquaTextPaneUI();
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ import javax.swing.text.*;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
public class AquaTextPasswordFieldUI extends AquaTextFieldUI {
|
||||
public final class AquaTextPasswordFieldUI extends AquaTextFieldUI {
|
||||
private static final RecyclableSingleton<CapsLockSymbolPainter> capsLockPainter = new RecyclableSingletonFromDefaultConstructor<CapsLockSymbolPainter>(CapsLockSymbolPainter.class);
|
||||
static CapsLockSymbolPainter getCapsLockPainter() {
|
||||
return capsLockPainter.get();
|
||||
@ -84,7 +84,7 @@ public class AquaTextPasswordFieldUI extends AquaTextFieldUI {
|
||||
getCapsLockPainter().paintBorder(component, g, bounds.x, bounds.y, bounds.width, bounds.height);
|
||||
}
|
||||
|
||||
protected class AquaPasswordView extends PasswordView {
|
||||
protected final class AquaPasswordView extends PasswordView {
|
||||
public AquaPasswordView(final Element elem) {
|
||||
super(elem);
|
||||
setupDefaultEchoCharacter();
|
||||
@ -99,7 +99,7 @@ public class AquaTextPasswordFieldUI extends AquaTextFieldUI {
|
||||
}
|
||||
}
|
||||
|
||||
static class CapsLockSymbolPainter extends KeyAdapter implements Border, UIResource {
|
||||
static final class CapsLockSymbolPainter extends KeyAdapter implements Border, UIResource {
|
||||
protected Shape capsLockShape;
|
||||
protected Shape getCapsLockShape() {
|
||||
if (capsLockShape != null) return capsLockShape;
|
||||
|
||||
@ -33,7 +33,7 @@ import javax.swing.plaf.basic.BasicToolBarSeparatorUI;
|
||||
|
||||
import com.apple.laf.AquaUtils.*;
|
||||
|
||||
public class AquaToolBarSeparatorUI extends BasicToolBarSeparatorUI {
|
||||
public final class AquaToolBarSeparatorUI extends BasicToolBarSeparatorUI {
|
||||
private static final RecyclableSingleton<AquaToolBarSeparatorUI> instance = new RecyclableSingletonFromDefaultConstructor<AquaToolBarSeparatorUI>(AquaToolBarSeparatorUI.class);
|
||||
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
@ -46,6 +46,7 @@ public class AquaToolBarSeparatorUI extends BasicToolBarSeparatorUI {
|
||||
|
||||
BasicStroke dashedStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.0f, new float[] { 1.0f, 2.0f }, 0.0f);
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
g.setColor(c.getForeground());
|
||||
((Graphics2D)g).setStroke(dashedStroke);
|
||||
@ -59,6 +60,7 @@ public class AquaToolBarSeparatorUI extends BasicToolBarSeparatorUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize(final JComponent c) {
|
||||
final JToolBar.Separator sep = (JToolBar.Separator)c;
|
||||
if (sep.getOrientation() == SwingConstants.HORIZONTAL) {
|
||||
@ -67,6 +69,7 @@ public class AquaToolBarSeparatorUI extends BasicToolBarSeparatorUI {
|
||||
return new Dimension(11, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize(final JComponent c) {
|
||||
final JToolBar.Separator sep = (JToolBar.Separator)c;
|
||||
if (sep.getOrientation() == SwingConstants.HORIZONTAL) {
|
||||
@ -75,6 +78,7 @@ public class AquaToolBarSeparatorUI extends BasicToolBarSeparatorUI {
|
||||
return new Dimension(11, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getMaximumSize(final JComponent c) {
|
||||
final JToolBar.Separator sep = (JToolBar.Separator)c;
|
||||
if (sep.getOrientation() == SwingConstants.HORIZONTAL) {
|
||||
|
||||
@ -34,7 +34,7 @@ import javax.swing.plaf.basic.BasicToolBarUI;
|
||||
|
||||
import com.apple.laf.AquaUtils.*;
|
||||
|
||||
public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
public final class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
private static final RecyclableSingleton<ToolBarBorder> toolBarBorder = new RecyclableSingletonFromDefaultConstructor<ToolBarBorder>(ToolBarBorder.class);
|
||||
public static Border getToolBarBorder() {
|
||||
return toolBarBorder.get();
|
||||
@ -44,10 +44,14 @@ public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
return new AquaToolBarUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setBorderToNonRollover(final Component c) { }
|
||||
@Override
|
||||
protected void setBorderToNormal(final Component c) { }
|
||||
@Override
|
||||
protected void setBorderToRollover(final Component c) { }
|
||||
|
||||
@Override
|
||||
protected RootPaneContainer createFloatingWindow(final JToolBar toolbar) {
|
||||
final RootPaneContainer window = super.createFloatingWindow(toolbar);
|
||||
window.getRootPane().putClientProperty("Window.style", "small");
|
||||
@ -56,7 +60,7 @@ public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
|
||||
/* ToolBarBorder and drag-off handle, based loosely on MetalBumps */
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
static class ToolBarBorder extends AbstractBorder implements UIResource, javax.swing.SwingConstants {
|
||||
static final class ToolBarBorder extends AbstractBorder implements UIResource, javax.swing.SwingConstants {
|
||||
protected void fillHandle(final Graphics g, final int x1, final int y1, final int x2, final int y2, final boolean horizontal) {
|
||||
g.setColor(UIManager.getColor("ToolBar.borderHandleColor"));
|
||||
if (horizontal) {
|
||||
@ -70,6 +74,7 @@ public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintBorder(final java.awt.Component c, final Graphics g, int x, int y, final int w, final int h) {
|
||||
g.translate(x, y);
|
||||
|
||||
@ -100,11 +105,13 @@ public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
g.translate(-x, -y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final java.awt.Component c) {
|
||||
final Insets borderInsets = new Insets(5, 5, 5, 5);
|
||||
return getBorderInsets(c, borderInsets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Insets getBorderInsets(final java.awt.Component c, final Insets borderInsets) {
|
||||
borderInsets.left = 4;
|
||||
borderInsets.right = 4;
|
||||
@ -132,6 +139,7 @@ public class AquaToolBarUI extends BasicToolBarUI implements SwingConstants {
|
||||
return borderInsets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBorderOpaque() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ import javax.swing.plaf.basic.BasicToolTipUI;
|
||||
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
public class AquaToolTipUI extends BasicToolTipUI {
|
||||
public final class AquaToolTipUI extends BasicToolTipUI {
|
||||
private static final RecyclableSingletonFromDefaultConstructor<AquaToolTipUI> sharedAquaInstance = new RecyclableSingletonFromDefaultConstructor<AquaToolTipUI>(AquaToolTipUI.class);
|
||||
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
|
||||
@ -45,7 +45,7 @@ import apple.laf.JRSUIState.AnimationFrameState;
|
||||
* AquaTreeUI supports the client property "value-add" system of customization See MetalTreeUI
|
||||
* This is heavily based on the 1.3.1 AquaTreeUI implementation.
|
||||
*/
|
||||
public class AquaTreeUI extends BasicTreeUI {
|
||||
public final class AquaTreeUI extends BasicTreeUI {
|
||||
|
||||
// Create PLAF
|
||||
public static ComponentUI createUI(final JComponent c) {
|
||||
@ -80,6 +80,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(final JComponent c) {
|
||||
super.installUI(c);
|
||||
|
||||
@ -88,6 +89,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
c.addPropertyChangeListener(lineStyleListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallUI(final JComponent c) {
|
||||
c.removePropertyChangeListener(lineStyleListener);
|
||||
super.uninstallUI(c);
|
||||
@ -96,6 +98,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
/**
|
||||
* Creates the focus listener to repaint the focus ring
|
||||
*/
|
||||
@Override
|
||||
protected FocusListener createFocusListener() {
|
||||
return new AquaTreeUI.FocusHandler();
|
||||
}
|
||||
@ -117,6 +120,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreePath getClosestPathForLocation(final JTree treeLocal, final int x, final int y) {
|
||||
if (treeLocal == null || treeState == null) return null;
|
||||
|
||||
@ -125,6 +129,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
return treeState.getPathClosestTo(x - i.left, y - i.top);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(final Graphics g, final JComponent c) {
|
||||
super.paint(g, c);
|
||||
|
||||
@ -156,12 +161,14 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintVerticalPartOfLeg(final Graphics g, final Rectangle clipBounds, final Insets insets, final TreePath path) {
|
||||
if (lineStyle == LEG_LINE_STYLE) {
|
||||
super.paintVerticalPartOfLeg(g, clipBounds, insets, path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintHorizontalPartOfLeg(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) {
|
||||
if (lineStyle == LEG_LINE_STYLE) {
|
||||
super.paintHorizontalPartOfLeg(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
|
||||
@ -169,7 +176,8 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
}
|
||||
|
||||
/** This class listens for changes in line style */
|
||||
class LineListener implements PropertyChangeListener {
|
||||
final class LineListener implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String name = e.getPropertyName();
|
||||
if (name.equals(LINE_STYLE)) {
|
||||
@ -182,6 +190,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
* Paints the expand (toggle) part of a row. The receiver should NOT modify {@code clipBounds}, or
|
||||
* {@code insets}.
|
||||
*/
|
||||
@Override
|
||||
protected void paintExpandControl(final Graphics g, final Rectangle clipBounds, final Insets insets, final Rectangle bounds, final TreePath path, final int row, final boolean isExpanded, final boolean hasBeenExpanded, final boolean isLeaf) {
|
||||
final Object value = path.getLastPathComponent();
|
||||
|
||||
@ -272,6 +281,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
* We install a motion handler that gets removed after.
|
||||
* See super.MouseInputHandler & super.startEditing for why
|
||||
*/
|
||||
@Override
|
||||
protected void handleExpandControlClick(final TreePath path, final int mouseX, final int mouseY) {
|
||||
fMouseHandler = new TreeArrowMouseInputHandler(path);
|
||||
}
|
||||
@ -279,27 +289,32 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
/**
|
||||
* Returning true signifies a mouse event on the node should toggle the selection of only the row under mouse.
|
||||
*/
|
||||
@Override
|
||||
protected boolean isToggleSelectionEvent(final MouseEvent event) {
|
||||
return SwingUtilities.isLeftMouseButton(event) && event.isMetaDown();
|
||||
}
|
||||
|
||||
class FocusHandler extends BasicTreeUI.FocusHandler {
|
||||
final class FocusHandler extends BasicTreeUI.FocusHandler {
|
||||
@Override
|
||||
public void focusGained(final FocusEvent e) {
|
||||
super.focusGained(e);
|
||||
AquaBorder.repaintBorder(tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(final FocusEvent e) {
|
||||
super.focusLost(e);
|
||||
AquaBorder.repaintBorder(tree);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyChangeListener createPropertyChangeListener() {
|
||||
return new MacPropertyChangeHandler();
|
||||
}
|
||||
|
||||
public class MacPropertyChangeHandler extends PropertyChangeHandler {
|
||||
public final class MacPropertyChangeHandler extends PropertyChangeHandler {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String prop = e.getPropertyName();
|
||||
if (prop.equals(AquaFocusHandler.FRAME_ACTIVE_PROPERTY)) {
|
||||
@ -318,7 +333,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
* Just like super.MouseInputHandler, this is removed once it's not needed, so they won't clash with each other
|
||||
*/
|
||||
// The Adapters take care of defining all the empties
|
||||
class TreeArrowMouseInputHandler extends MouseInputAdapter {
|
||||
final class TreeArrowMouseInputHandler extends MouseInputAdapter {
|
||||
protected Rectangle fPathBounds = new Rectangle();
|
||||
|
||||
// Values needed for paintOneControl
|
||||
@ -362,6 +377,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
paintOneControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(final MouseEvent e) {
|
||||
fIsInBounds = fPathBounds.contains(e.getX(), e.getY());
|
||||
paintOneControl();
|
||||
@ -373,6 +389,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
paintOneControl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(final MouseEvent e) {
|
||||
if (tree == null) return;
|
||||
|
||||
@ -485,6 +502,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
return bounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installKeyboardActions() {
|
||||
super.installKeyboardActions();
|
||||
tree.getActionMap().put("aquaExpandNode", new KeyboardExpandCollapseAction(true, false));
|
||||
@ -494,7 +512,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
class KeyboardExpandCollapseAction extends AbstractAction {
|
||||
final class KeyboardExpandCollapseAction extends AbstractAction {
|
||||
/**
|
||||
* Determines direction to traverse, 1 means expand, -1 means collapse.
|
||||
*/
|
||||
@ -509,6 +527,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
this.recursive = recursive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (tree == null || 0 > getRowCount(tree)) return;
|
||||
|
||||
@ -542,6 +561,7 @@ public class AquaTreeUI extends BasicTreeUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return (tree != null && tree.isEnabled());
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ import apple.laf.JRSUIConstants.*;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
import com.apple.laf.AquaUtils.RecyclableSingletonFromDefaultConstructor;
|
||||
|
||||
public class AquaUtilControlSize {
|
||||
public final class AquaUtilControlSize {
|
||||
protected static final String CLIENT_PROPERTY_KEY = "JComponent.sizeVariant";
|
||||
protected static final String SYSTEM_PROPERTY_KEY = "swing.component.sizevariant";
|
||||
|
||||
@ -127,7 +127,7 @@ public class AquaUtilControlSize {
|
||||
c.setBorder(derivedBorder);
|
||||
}
|
||||
|
||||
protected static class PropertySizeListener implements PropertyChangeListener {
|
||||
protected static final class PropertySizeListener implements PropertyChangeListener {
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent evt) {
|
||||
final String key = evt.getPropertyName();
|
||||
@ -204,7 +204,7 @@ public class AquaUtilControlSize {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SizeVariant {
|
||||
public static final class SizeVariant {
|
||||
Size size = Size.REGULAR;
|
||||
Insets insets = new InsetsUIResource(0, 0, 0, 0);
|
||||
Insets margins = new InsetsUIResource(0, 0, 0, 0);
|
||||
|
||||
@ -162,7 +162,7 @@ final class AquaUtils {
|
||||
abstract T getInstance();
|
||||
}
|
||||
|
||||
static class RecyclableSingletonFromDefaultConstructor<T> extends RecyclableSingleton<T> {
|
||||
static final class RecyclableSingletonFromDefaultConstructor<T> extends RecyclableSingleton<T> {
|
||||
private final Class<T> clazz;
|
||||
|
||||
RecyclableSingletonFromDefaultConstructor(final Class<T> clazz) {
|
||||
@ -308,7 +308,7 @@ final class AquaUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static class SlicedShadowBorder extends ShadowBorder {
|
||||
static final class SlicedShadowBorder extends ShadowBorder {
|
||||
private final SlicedImageControl slices;
|
||||
|
||||
SlicedShadowBorder(final Painter prePainter, final Painter postPainter, final int offsetX, final int offsetY, final float distance, final float intensity, final int blur, final int templateWidth, final int templateHeight, final int leftCut, final int topCut, final int rightCut, final int bottomCut) {
|
||||
|
||||
@ -36,7 +36,7 @@ import javax.swing.*;
|
||||
import static sun.awt.AWTAccessor.*;
|
||||
|
||||
@SuppressWarnings("serial") // JDK implementation class
|
||||
public class ScreenMenuBar extends MenuBar
|
||||
public final class ScreenMenuBar extends MenuBar
|
||||
implements ContainerListener, ScreenMenuPropertyHandler,
|
||||
ComponentListener {
|
||||
|
||||
@ -53,6 +53,7 @@ public class ScreenMenuBar extends MenuBar
|
||||
fSubmenus = new Hashtable<JMenu, ScreenMenu>(fSwingBar.getMenuCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNotify() {
|
||||
super.addNotify();
|
||||
|
||||
@ -82,6 +83,7 @@ public class ScreenMenuBar extends MenuBar
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -110,6 +112,7 @@ public class ScreenMenuBar extends MenuBar
|
||||
/**
|
||||
* Invoked when a component has been added to the container.
|
||||
*/
|
||||
@Override
|
||||
public void componentAdded(final ContainerEvent e) {
|
||||
final Component child = e.getChild();
|
||||
if (!(child instanceof JMenu)) return;
|
||||
@ -119,6 +122,7 @@ public class ScreenMenuBar extends MenuBar
|
||||
/**
|
||||
* Invoked when a component has been removed from the container.
|
||||
*/
|
||||
@Override
|
||||
public void componentRemoved(final ContainerEvent e) {
|
||||
final Component child = e.getChild();
|
||||
if (!(child instanceof JMenu)) return;
|
||||
@ -128,11 +132,13 @@ public class ScreenMenuBar extends MenuBar
|
||||
/**
|
||||
* Invoked when the component's size changes.
|
||||
*/
|
||||
@Override
|
||||
public void componentResized(final ComponentEvent e) {}
|
||||
|
||||
/**
|
||||
* Invoked when the component's position changes.
|
||||
*/
|
||||
@Override
|
||||
public void componentMoved(final ComponentEvent e) {}
|
||||
|
||||
/**
|
||||
@ -140,6 +146,7 @@ public class ScreenMenuBar extends MenuBar
|
||||
* See componentHidden - we should still have a MenuItem
|
||||
* it just isn't inserted
|
||||
*/
|
||||
@Override
|
||||
public void componentShown(final ComponentEvent e) {
|
||||
final Object source = e.getSource();
|
||||
if (!(source instanceof JMenuItem)) return;
|
||||
@ -152,6 +159,7 @@ public class ScreenMenuBar extends MenuBar
|
||||
* so we remove the ScreenMenuItem from the ScreenMenu
|
||||
* but leave it in fItems
|
||||
*/
|
||||
@Override
|
||||
public void componentHidden(final ComponentEvent e) {
|
||||
final Object source = e.getSource();
|
||||
if (!(source instanceof JMenuItem)) return;
|
||||
@ -163,6 +171,7 @@ public class ScreenMenuBar extends MenuBar
|
||||
* so we just add or remove the child from the ScreenMenuBar
|
||||
* but leave it in the list
|
||||
*/
|
||||
@Override
|
||||
public void setChildVisible(final JMenuItem child, final boolean b) {
|
||||
if (child instanceof JMenu) {
|
||||
if (b) {
|
||||
@ -184,9 +193,12 @@ public class ScreenMenuBar extends MenuBar
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(final Icon i) {}
|
||||
@Override
|
||||
public void setLabel(final String s) {}
|
||||
|
||||
@Override
|
||||
public void setEnabled(final boolean b) {
|
||||
final int count = fSwingBar.getMenuCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
@ -194,10 +206,13 @@ public class ScreenMenuBar extends MenuBar
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccelerator(final KeyStroke ks) {}
|
||||
@Override
|
||||
public void setToolTipText(final String tooltip) {}
|
||||
|
||||
// only check and radio items can be indeterminate
|
||||
@Override
|
||||
public void setIndeterminate(boolean indeterminate) { }
|
||||
|
||||
ScreenMenu addSubmenu(final JMenu m) {
|
||||
|
||||
@ -55,6 +55,7 @@ final class ScreenMenuItem extends MenuItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNotify() {
|
||||
super.addNotify();
|
||||
|
||||
@ -92,6 +93,7 @@ final class ScreenMenuItem extends MenuItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNotify() {
|
||||
super.removeNotify();
|
||||
removeActionListener(this);
|
||||
@ -125,6 +127,7 @@ final class ScreenMenuItem extends MenuItem
|
||||
syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
fMenuItem.doClick(0); // This takes care of all the different events
|
||||
}
|
||||
@ -132,11 +135,13 @@ final class ScreenMenuItem extends MenuItem
|
||||
/**
|
||||
* Invoked when the component's size changes.
|
||||
*/
|
||||
@Override
|
||||
public void componentResized(final ComponentEvent e) {}
|
||||
|
||||
/**
|
||||
* Invoked when the component's position changes.
|
||||
*/
|
||||
@Override
|
||||
public void componentMoved(final ComponentEvent e) {}
|
||||
|
||||
/**
|
||||
@ -144,6 +149,7 @@ final class ScreenMenuItem extends MenuItem
|
||||
* See componentHidden - we should still have a MenuItem
|
||||
* it just isn't inserted
|
||||
*/
|
||||
@Override
|
||||
public void componentShown(final ComponentEvent e) {
|
||||
setVisible(true);
|
||||
}
|
||||
@ -154,6 +160,7 @@ final class ScreenMenuItem extends MenuItem
|
||||
* so we remove the ScreenMenuItem from the ScreenMenu
|
||||
* but leave it in fItems
|
||||
*/
|
||||
@Override
|
||||
public void componentHidden(final ComponentEvent e) {
|
||||
setVisible(false);
|
||||
}
|
||||
@ -168,6 +175,7 @@ final class ScreenMenuItem extends MenuItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToolTipText(final String text) {
|
||||
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
|
||||
if (!(peer instanceof CMenuItem)) return;
|
||||
@ -176,6 +184,7 @@ final class ScreenMenuItem extends MenuItem
|
||||
cmi.setToolTipText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(final Icon i) {
|
||||
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
|
||||
if (!(peer instanceof CMenuItem)) return;
|
||||
@ -192,8 +201,10 @@ final class ScreenMenuItem extends MenuItem
|
||||
}
|
||||
|
||||
// we have no children
|
||||
@Override
|
||||
public void setChildVisible(final JMenuItem child, final boolean b) {}
|
||||
|
||||
// only check and radio items can be indeterminate
|
||||
@Override
|
||||
public void setIndeterminate(boolean indeterminate) { }
|
||||
}
|
||||
|
||||
@ -61,6 +61,7 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
|
||||
ScreenMenuPropertyListener fPropertyListener;
|
||||
|
||||
@Override
|
||||
public void addNotify() {
|
||||
super.addNotify();
|
||||
|
||||
@ -104,6 +105,7 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNotify() {
|
||||
fMenuItem.removeComponentListener(this);
|
||||
fMenuItem.removePropertyChangeListener(fPropertyListener);
|
||||
@ -125,6 +127,7 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
ScreenMenuItem.syncLabelAndKS(this, fMenuItem.getText(), ks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
fMenuItem.doClick(0); // This takes care of all the different events
|
||||
}
|
||||
@ -132,11 +135,13 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
/**
|
||||
* Invoked when the component's size changes.
|
||||
*/
|
||||
@Override
|
||||
public void componentResized(final ComponentEvent e) {}
|
||||
|
||||
/**
|
||||
* Invoked when the component's position changes.
|
||||
*/
|
||||
@Override
|
||||
public void componentMoved(final ComponentEvent e) {}
|
||||
|
||||
/**
|
||||
@ -144,6 +149,7 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
* See componentHidden - we should still have a MenuItem
|
||||
* it just isn't inserted
|
||||
*/
|
||||
@Override
|
||||
public void componentShown(final ComponentEvent e) {
|
||||
setVisible(true);
|
||||
}
|
||||
@ -154,10 +160,12 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
* so we remove the ScreenMenuItem from the ScreenMenu
|
||||
* but leave it in fItems
|
||||
*/
|
||||
@Override
|
||||
public void componentHidden(final ComponentEvent e) {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToolTipText(final String text) {
|
||||
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
|
||||
if (!(peer instanceof CMenuItem)) return;
|
||||
@ -165,6 +173,7 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
((CMenuItem)peer).setToolTipText(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(final Icon i) {
|
||||
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
|
||||
if (!(peer instanceof CMenuItem)) return;
|
||||
@ -188,11 +197,13 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
}
|
||||
|
||||
// we have no children
|
||||
@Override
|
||||
public void setChildVisible(final JMenuItem child, final boolean b) {}
|
||||
|
||||
/**
|
||||
* Invoked when an item's state has been changed.
|
||||
*/
|
||||
@Override
|
||||
public void itemStateChanged(final ItemEvent e) {
|
||||
if (e.getSource() == this) {
|
||||
fMenuItem.doClick(0);
|
||||
@ -209,6 +220,7 @@ final class ScreenMenuItemCheckbox extends CheckboxMenuItem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIndeterminate(final boolean indeterminate) {
|
||||
Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
|
||||
if (peer instanceof CCheckboxMenuItem) {
|
||||
|
||||
@ -30,7 +30,7 @@ import java.beans.*;
|
||||
import javax.accessibility.*;
|
||||
import javax.swing.*;
|
||||
|
||||
class ScreenMenuPropertyListener implements PropertyChangeListener {
|
||||
final class ScreenMenuPropertyListener implements PropertyChangeListener {
|
||||
ScreenMenuPropertyHandler fMenu;
|
||||
|
||||
ScreenMenuPropertyListener(final ScreenMenuPropertyHandler mc) {
|
||||
@ -42,6 +42,7 @@ class ScreenMenuPropertyListener implements PropertyChangeListener {
|
||||
* @param e A PropertyChangeEvent object describing the event source
|
||||
* and the property that has changed.
|
||||
*/
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent e) {
|
||||
final String propertyName = e.getPropertyName();
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ import javax.swing.*;
|
||||
import sun.lwawt.macosx.CPlatformWindow;
|
||||
import sun.swing.SwingAccessor;
|
||||
|
||||
class ScreenPopupFactory extends PopupFactory {
|
||||
final class ScreenPopupFactory extends PopupFactory {
|
||||
static final Float TRANSLUCENT = 248f/255f;
|
||||
static final Float OPAQUE = 1.0f;
|
||||
|
||||
@ -50,6 +50,7 @@ class ScreenPopupFactory extends PopupFactory {
|
||||
return (Window)w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Popup getPopup(final Component comp, final Component invoker, final int x, final int y) {
|
||||
if (invoker == null) throw new IllegalArgumentException("Popup.getPopup must be passed non-null contents");
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Toolkit;
|
||||
|
||||
@SuppressWarnings({"restricted"})
|
||||
public class PlatformGraphicsInfo {
|
||||
public final class PlatformGraphicsInfo {
|
||||
|
||||
static {
|
||||
System.loadLibrary("awt");
|
||||
|
||||
@ -30,7 +30,7 @@ import java.util.HashMap;
|
||||
import static sun.font.FontUtilities.isDefaultIgnorable;
|
||||
import static sun.font.FontUtilities.isIgnorableWhitespace;
|
||||
|
||||
public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
public final class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
private static native int countGlyphs(final long nativeFontPtr);
|
||||
|
||||
private Cache cache = new Cache();
|
||||
@ -42,6 +42,7 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
missingGlyph = 0; // for getMissingGlyphCode()
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumGlyphs() {
|
||||
if (numGlyphs == -1) {
|
||||
numGlyphs = countGlyphs(fFont.getNativeFontPtr());
|
||||
@ -49,16 +50,19 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
return numGlyphs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplay(char ch) {
|
||||
int glyph = charToGlyph(ch, false);
|
||||
return glyph != missingGlyph;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplay(int cp) {
|
||||
int glyph = charToGlyph(cp, false);
|
||||
return glyph != missingGlyph;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean charsToGlyphsNS(int count,
|
||||
char[] unicodes, int[] glyphs)
|
||||
{
|
||||
@ -91,6 +95,7 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int charToGlyph(char unicode) {
|
||||
return charToGlyph(unicode, false);
|
||||
}
|
||||
@ -109,10 +114,12 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
return glyph;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int charToGlyph(int unicode) {
|
||||
return charToGlyph(unicode, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int charToGlyphRaw(int unicode) {
|
||||
return charToGlyph(unicode, true);
|
||||
}
|
||||
@ -131,10 +138,12 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void charsToGlyphs(int count, char[] unicodes, int[] glyphs) {
|
||||
cache.get(count, unicodes, glyphs, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void charsToGlyphs(int count, int[] unicodes, int[] glyphs) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
glyphs[i] = charToGlyph(unicodes[i], false);
|
||||
@ -151,7 +160,7 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
int count, char[] unicodes,
|
||||
int[] glyphs);
|
||||
|
||||
private class Cache {
|
||||
private final class Cache {
|
||||
private static final int FIRST_LAYER_SIZE = 256;
|
||||
private static final int SECOND_LAYER_SIZE = 16384; // 16384 = 128x128
|
||||
|
||||
@ -209,7 +218,7 @@ public class CCharToGlyphMapper extends CharToGlyphMapper {
|
||||
generalCache.put(index, value);
|
||||
}
|
||||
|
||||
private class SparseBitShiftingTwoLayerArray {
|
||||
private final class SparseBitShiftingTwoLayerArray {
|
||||
final int[][] cache;
|
||||
final int shift;
|
||||
final int secondLayerLength;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user