skin: dispose the ProgressBar when progress is completed
authorgiwoong.kim <giwoong.kim@samsung.com>
Wed, 12 Dec 2012 06:50:44 +0000 (15:50 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Wed, 12 Dec 2012 06:50:44 +0000 (15:50 +0900)
Dispose the ProgressBar when booting is completed.

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/PhoneShapeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/window/CustomProgressBar.java

index 2e93863ece524d27a363603888b6d846d1036f8a..7a7f906c8031cceefa576206d7e4e3e1092bdf7a 100644 (file)
@@ -48,6 +48,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.eclipse.swt.widgets.Display;
 import org.tizen.emulator.skin.EmulatorSkin;
 import org.tizen.emulator.skin.comm.ICommunicator;
 import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
@@ -328,9 +329,18 @@ public class SocketCommunicator implements ICommunicator {
                                                /* draw progress bar */
                                                if (skin.bootingProgress != null) {
                                                        skin.bootingProgress.setSelection(value);
+
+                                                       if (value == 100 | value == 0) {
+                                                               /* this means progressbar will be
+                                                               dispose soon */
+                                                               if (skin.bootingProgress != null) {
+                                                                       skin.bootingProgress = null;
+                                                               }
+                                                       }
                                                }
                                        }
-                                       //TODO: resetDataTransfer(progressDataTransfer)
+
+                                       resetDataTransfer(progressDataTransfer);
 
                                        break;
                                }
index 48280b8aad37726f88803a790414bda535c6ccf9..897cb1e6c685311d6c1308e8b70bff5079b30f72 100644 (file)
@@ -265,7 +265,8 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        skin.bootingProgress.setBounds(lcdBounds.x,
                                        lcdBounds.y + lcdBounds.height + 1, lcdBounds.width, 2);
 
-                       skin.bootingProgress.dispose(); //TODO
+                       //TODO : delete this line
+                       skin.bootingProgress.setSelection(0); /* dispose */
                        skin.bootingProgress = null;
                }
 
index 3f7b708a264f5fd6a932cc30d7123c934f96901c..2ed182d2ce46d0b4608a082a44af4482fa401e1f 100644 (file)
@@ -212,7 +212,8 @@ public class PhoneShapeSkinComposer implements ISkinComposer {
                        skin.bootingProgress.setBounds(lcdBounds.x,
                                        lcdBounds.y + lcdBounds.height + 1, lcdBounds.width, 2);
 
-                       skin.bootingProgress.dispose(); //TODO:
+                       //TODO : delete this line
+                       skin.bootingProgress.setSelection(0); /* dispose */
                        skin.bootingProgress = null;
                }
 
index e9f04ff336587f63dc9eeacdbeb024b1c7e38e1c..7880cb9d1095efb904584fbfd0c7ca952866461d 100644 (file)
@@ -37,7 +37,6 @@ import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
-import org.tizen.emulator.skin.dialog.DetailInfoDialog;
 import org.tizen.emulator.skin.log.SkinLogger;
 
 public class CustomProgressBar extends Canvas {
@@ -45,12 +44,13 @@ public class CustomProgressBar extends Canvas {
                        SkinLogger.getSkinLogger(CustomProgressBar.class).getLogger();
 
        private Composite parent;
-       private int selection = 0;
+       private int selection;
 
        public CustomProgressBar(final Composite parent, int style) {
                super(parent, style);
 
                this.parent = parent;
+               this.selection = 1;
 
                this.addPaintListener(new PaintListener() {
                        @Override
@@ -61,6 +61,17 @@ public class CustomProgressBar extends Canvas {
                                Rectangle bounds = getBounds();
                                int width = (bounds.width * selection) / 100; 
                                e.gc.fillRectangle(0, 0, width, bounds.height);
+
+                               if (selection == 0) {
+                                       logger.info("progress : complete!");
+
+                                       parent.getDisplay().asyncExec(new Runnable() {
+                                               @Override
+                                               public void run() {
+                                                       dispose();
+                                               }
+                                       });
+                               }
                        }
                });
        }
@@ -79,6 +90,10 @@ public class CustomProgressBar extends Canvas {
                        @Override
                        public void run() {
                                redraw();
+
+                               if (selection == 100) {
+                                       selection = 0;
+                               }
                        }
                });
        }