< prev index next >

src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m

Print this page

        

*** 98,107 **** --- 98,108 ---- @implementation ApplicationDelegate @synthesize fPreferencesMenu; @synthesize fAboutMenu; + @synthesize fProgressIndicator; @synthesize fDockMenu; @synthesize fDefaultMenuBar;
*** 199,208 **** --- 200,221 ---- NSMenu *appMenu = [[menuBar itemAtIndex:0] submenu]; self.fPreferencesMenu = (NSMenuItem*)[appMenu itemWithTag:PREFERENCES_TAG]; self.fAboutMenu = (NSMenuItem*)[appMenu itemAtIndex:0]; + NSDockTile *dockTile = [NSApp dockTile]; + self.fProgressIndicator = [[NSProgressIndicator alloc] + initWithFrame:NSMakeRect(3.f, 0.f, dockTile.size.width - 6.f, 20.f)]; + + [fProgressIndicator setStyle:NSProgressIndicatorBarStyle]; + [fProgressIndicator setIndeterminate:NO]; + [[dockTile contentView] addSubview:fProgressIndicator]; + [fProgressIndicator setMinValue:0]; + [fProgressIndicator setMaxValue:100]; + [fProgressIndicator setHidden:YES]; + [fProgressIndicator release]; + // If the java application has a bundle with an Info.plist file with // a CFBundleDocumentTypes entry, then it is set up to handle Open Doc // and Print Doc commands for these files. Therefore java AWT will // cache Open Doc and Print Doc events that are sent prior to a // listener being installed by the client java application.
*** 250,259 **** --- 263,273 ---- - (void)dealloc { self.fPreferencesMenu = nil; self.fAboutMenu = nil; self.fDockMenu = nil; self.fDefaultMenuBar = nil; + self.fProgressIndicator = nil; [super dealloc]; } #pragma mark Callbacks from AppKit
*** 466,482 **** --- 480,513 ---- NSRect frame = NSMakeRect(0, 0, dockTile.size.width, dockTile.size.height); NSImageView *dockImageView = [[NSImageView alloc] initWithFrame: frame]; [dockImageView setImageScaling:NSImageScaleProportionallyUpOrDown]; [dockImageView setImage:image]; + [[ApplicationDelegate sharedDelegate].fProgressIndicator removeFromSuperview]; + [dockImageView addSubview:[ApplicationDelegate sharedDelegate].fProgressIndicator]; + // add it to the NSDockTile [dockTile setContentView: dockImageView]; [dockTile display]; [dockImageView release]; } + + (void)_setDockIconProgress:(NSNumber *)value { + AWT_ASSERT_APPKIT_THREAD; + + ApplicationDelegate *delegate = [ApplicationDelegate sharedDelegate]; + if ([value doubleValue] >= 0 && [value doubleValue] <=100) { + [delegate.fProgressIndicator setDoubleValue:[value doubleValue]]; + [delegate.fProgressIndicator setHidden:NO]; + } else { + [delegate.fProgressIndicator setHidden:YES]; + } + + [[NSApp dockTile] display]; + } + // Obtains the image of the Dock icon, either manually set, a drawn copy, or the default NSApplicationIcon + (NSImage *)_dockIconImage { AWT_ASSERT_APPKIT_THREAD; NSDockTile *dockTile = [NSApp dockTile];
*** 608,617 **** --- 639,666 ---- JNF_COCOA_EXIT(env); } /* * Class: com_apple_eawt__AppDockIconHandler + * Method: nativeSetDockIconProgress + * Signature: (I)V + */ + JNIEXPORT void JNICALL Java_com_apple_eawt__1AppDockIconHandler_nativeSetDockIconProgress + (JNIEnv *env, jclass clz, jint value) + { + JNF_COCOA_ENTER(env); + + [ThreadUtilities performOnMainThread:@selector(_setDockIconProgress:) + on:[ApplicationDelegate class] + withObject:[NSNumber numberWithInt:value] + waitUntilDone:NO]; + + JNF_COCOA_EXIT(env); + } + + /* + * Class: com_apple_eawt__AppDockIconHandler * Method: nativeGetDockIconImage * Signature: ()J */ JNIEXPORT jlong JNICALL Java_com_apple_eawt__1AppDockIconHandler_nativeGetDockIconImage (JNIEnv *env, jclass clz)
< prev index next >