diff -r f40128debb5d -r e0d6e9bd3ca7 javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java --- a/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Wed Jun 23 18:07:10 2010 +0300 +++ b/javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java Tue Jul 06 14:10:26 2010 +0300 @@ -27,7 +27,6 @@ import com.nokia.mj.impl.installer.ui.LaunchAppInfo; import com.nokia.mj.impl.installer.ui.PermissionInfo; import com.nokia.mj.impl.installer.ui.UninstallInfo; -import com.nokia.mj.impl.installer.ui.eswt.MinimalUi; import com.nokia.mj.impl.rt.ui.ConfirmData; import com.nokia.mj.impl.rt.ui.RuntimeUi; import com.nokia.mj.impl.rt.ui.RuntimeUiFactory; @@ -47,10 +46,10 @@ import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.ImageLoader; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.internal.extension.DisplayExtension; +import org.eclipse.swt.internal.qt.BaseCSSEngine; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Composite; @@ -63,11 +62,14 @@ public class InstallerUiEswt extends InstallerUi { /** Disable UI temporarily. */ - private static final boolean DISABLE_UI = true; + private static final boolean DISABLE_UI = + (System.getProperty("com.nokia.mj.impl.installer.ui.disableui") + == null? false: true); /** Default shell style. */ private static final int SHELL_STYLE = SWT.BORDER | SWT.APPLICATION_MODAL | SWT.ON_TOP; + private BaseCSSEngine iCssEngine = null; private Shell iParent = null; private Shell iDialog = null; private ProgressView iProgressView = null; @@ -100,8 +102,6 @@ private boolean iDisplayProgress = false; /** Flag telling if the first progress bar update has been traced. */ private boolean iProgressBarUpdateTraced = false; - /** Flag telling if MinimalUi should be used if UI creation fails. */ - private boolean iMinimalUiEnabled = true; /** Hashtable for storing the loaded icons. */ private static Hashtable iImageTable = null; @@ -162,6 +162,7 @@ DisplayExtension display = new DisplayExtension(); StartUpTrace.doTrace("InstallerUiEswt display created"); display.setAppName(""); // Remove display title. + iCssEngine = new BaseCSSEngine(display); iParent = new Shell(display); iDialog = new Shell(iParent, SHELL_STYLE); iDefaultShellBounds = iDialog.internal_getDefaultBounds(); @@ -184,10 +185,10 @@ }); // Initialize best icon size. - iBestIconSize = new Point( - display.getBestImageWidth(DisplayExtension.ALERT), - display.getBestImageHeight(DisplayExtension.ALERT)); - log("Best icon size: " + iBestIconSize); + //iBestIconSize = new Point( + // display.getBestImageWidth(DisplayExtension.ALERT), + // display.getBestImageHeight(DisplayExtension.ALERT)); + //log("Best icon size: " + iBestIconSize); synchronized (iInitWaitObject) { @@ -304,24 +305,14 @@ super.confirm(aInstallInfo); waitForUi(); - boolean result = true; if (!isUiReady()) { - result = false; - if (iMinimalUiEnabled) - { - result = MinimalUi.confirmStatic(aInstallInfo); - log("MinimalUi installation confirmation returns " + result); - return result; - } - else - { - // If UI is not ready by the time confirmation is requested, - // throw an exception. - throw new RuntimeException("JavaInstallerUi not ready"); - } + // If UI is not ready by the time confirmation is requested, + // throw an exception. + throw new RuntimeException("JavaInstallerUi not ready"); } + boolean result = true; if (result) { StartUpTrace.doTrace("InstallerUiEswt confirm"); @@ -476,6 +467,12 @@ // updating it. synchronized (iProgressSyncObject) { + if (iDlProgressView != null && iDlProgressView.isVisible()) + { + // If download progress is being displayed, + // do not display installation progress. + return; + } if (iDisplayProgress && !iProgressView.isVisible()) { // Re-create iProgressView here so that it gets @@ -1068,10 +1065,10 @@ { return iSecurityIcon; } - String iconFilename = ResourceUtil.UNTRUSTED_ICON_NAME; + String iconFilename = "java_3_untrusted.png"; if (aIdentified) { - iconFilename = ResourceUtil.TRUSTED_ICON_NAME; + iconFilename = "java_3_trusted.png"; } String resourceDir = ResourceUtil.getResourceDir(0); for (int i = 1; iSecurityIcon == null && resourceDir != null; i++) @@ -1168,19 +1165,21 @@ try { long startTime = System.currentTimeMillis(); - ImageData[] imageDatas = new ImageLoader().load(aInputStream); - ImageData imageData = imageDatas[0]; + Image image = new Image(aDisplay, aInputStream); + ImageData imageData = image.getImageData(); if (aScaleImage) { Point bestSize = getBestImageSize( - imageData.width, imageData.height); + imageData.width, imageData.height); if (bestSize.x != imageData.width || bestSize.y != imageData.height) { + Point oldSize = + new Point(imageData.width, imageData.height); imageData = imageData.scaledTo(bestSize.x, bestSize.y); log("Image " + aImageName + " scaled from " + - imageDatas[0].width + "x" + imageDatas[0].height + - " to " + bestSize.x + "x" + bestSize.y); + oldSize.x + "x" + oldSize.y + " to " + + bestSize.x + "x" + bestSize.y); } } result = new Image(aDisplay, imageData); @@ -1202,8 +1201,8 @@ */ private static Point getBestImageSize(int aWidth, int aHeight) { - final int MAX_WIDTH = iBestIconSize.x; - final int MAX_HEIGHT = iBestIconSize.y; + final int MAX_WIDTH = (iBestIconSize == null? 50: iBestIconSize.x); + final int MAX_HEIGHT = (iBestIconSize == null? 50: iBestIconSize.y); Point result = new Point(aWidth, aHeight); if (result.x > MAX_WIDTH || result.y > MAX_HEIGHT) { @@ -1331,4 +1330,37 @@ { return iActiveView; } + + /** + * Loads JavaInstaller UI stylesheet. + */ + void loadCss() + { + String cssFilename = "javaapplicationinstaller.css"; + String cssPath = null; + try + { + if (iCssEngine != null) + { + boolean loaded = false; + String resourceDir = ResourceUtil.getResourceDir(0); + for (int i = 1; !loaded && resourceDir != null; i++) + { + cssPath = resourceDir + cssFilename; + FileUtility cssFile = new FileUtility(cssPath); + if (cssFile.exists()) + { + iCssEngine.loadCSS(cssPath); + log("CSS loaded from " + cssPath); + break; + } + resourceDir = ResourceUtil.getResourceDir(i); + } + } + } + catch (Throwable t) + { + logError("Loading CSS from " + cssPath + " failed", t); + } + } }