javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt/InstallerUiEswt.java
branchRCL_3
changeset 83 26b2b12093af
parent 60 6c158198356e
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
   127         super.init(aMode, aListener);
   127         super.init(aMode, aListener);
   128         StartUpTrace.doTrace("InstallerUiEswt init");
   128         StartUpTrace.doTrace("InstallerUiEswt init");
   129         // Create a hashtable for icons.
   129         // Create a hashtable for icons.
   130         iImageTable = new Hashtable();
   130         iImageTable = new Hashtable();
   131         // Create a new thread to be the UI main thread.
   131         // Create a new thread to be the UI main thread.
       
   132         iUiThreadExists = true;
   132         UIThreadSupport.startInUIThread(new Runnable()
   133         UIThreadSupport.startInUIThread(new Runnable()
   133         {
   134         {
   134             public void run()
   135             public void run()
   135             {
   136             {
   136                 uiMain();
   137                 uiMain();
   145      * This method is executed in UI main thread.
   146      * This method is executed in UI main thread.
   146      */
   147      */
   147     private void uiMain()
   148     private void uiMain()
   148     {
   149     {
   149         log("uiMain: thread started");
   150         log("uiMain: thread started");
   150         iUiThreadExists = true;
       
   151         try
   151         try
   152         {
   152         {
   153             // Create the necessary views.
   153             // Create the necessary views.
   154             Display display = new Display();
   154             Display display = new Display();
   155             StartUpTrace.doTrace("InstallerUiEswt display created");
   155             StartUpTrace.doTrace("InstallerUiEswt display created");
   998         log("LaunchAppQuery returns " + result + " for " + aLaunchAppInfo);
   998         log("LaunchAppQuery returns " + result + " for " + aLaunchAppInfo);
   999         return result;
   999         return result;
  1000     }
  1000     }
  1001 
  1001 
  1002     /**
  1002     /**
  1003      * Executes given Runnable synchronously in the UI thread.
       
  1004      */
       
  1005     public void syncExec(Runnable aRunnable)
       
  1006     {
       
  1007         iParent.getDisplay().syncExec(aRunnable);
       
  1008     }
       
  1009 
       
  1010     /**
       
  1011      * Returns string title basing on mode of this InstallerUi.
  1003      * Returns string title basing on mode of this InstallerUi.
  1012      */
  1004      */
  1013     protected String getTitle()
  1005     protected String getTitle()
  1014     {
  1006     {
  1015         String result = null;
  1007         String result = null;
  1150         }
  1142         }
  1151         try
  1143         try
  1152         {
  1144         {
  1153             long startTime = System.currentTimeMillis();
  1145             long startTime = System.currentTimeMillis();
  1154             
  1146             
       
  1147             int maxWidth = DisplayExtension.getBestImageWidth(DisplayExtension.LIST_ELEMENT);
       
  1148             int maxHeight = DisplayExtension.getBestImageHeight(DisplayExtension.LIST_ELEMENT);
       
  1149             
       
  1150             aDisplay.setData("org.eclipse.swt.internal.image.loadSize", new Point(maxWidth, maxHeight));
  1155             Image image = new Image(aDisplay, aInputStream);
  1151             Image image = new Image(aDisplay, aInputStream);
       
  1152             
  1156             if (aScaleImage)
  1153             if (aScaleImage)
  1157             {
  1154             {
  1158                 int maxWidth = DisplayExtension.getBestImageWidth(DisplayExtension.LIST_ELEMENT);
       
  1159                 int maxHeight = DisplayExtension.getBestImageHeight(DisplayExtension.LIST_ELEMENT);
       
  1160                 Rectangle rect = image.getBounds();
  1155                 Rectangle rect = image.getBounds();
  1161                 if (maxWidth != rect.width || maxHeight != rect.height)
  1156                 if (maxWidth != rect.width || maxHeight != rect.height)
  1162                 {
  1157                 {
  1163                     // Copy and scale natively preserving the aspect ratio
  1158                     // Copy and scale natively preserving the aspect ratio
  1164                     result = ImageUtil.scaleImage(aDisplay, image, new Point(maxWidth, maxHeight), true);
  1159                     result = ImageUtil.scaleImage(aDisplay, image, new Point(maxWidth, maxHeight), true);