skin: added updateSkin interface 36/12436/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Fri, 15 Nov 2013 03:22:33 +0000 (12:22 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Fri, 15 Nov 2013 05:22:31 +0000 (14:22 +0900)
The each skin composer can update the skin(like
a ColorTag updating) itself by diffrent way
if it required.

Change-Id: I5e2dcc2a50d7de86d42ae43e6b4f8c1e18fece6a
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ISkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java
tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java
tizen/src/skin/client/src/org/tizen/emulator/skin/menu/SpecialKeyWindow.java

index 7b9688aebc83fd9bd575a64daa10752d509587cf..faee611288eaaec01a9ba91e70871e4fc4d5b40d 100755 (executable)
@@ -80,7 +80,6 @@ import org.tizen.emulator.skin.comm.sock.data.MouseEventData;
 import org.tizen.emulator.skin.config.EmulatorConfig;
 import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
 import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
-import org.tizen.emulator.skin.custom.ColorTag;
 import org.tizen.emulator.skin.custom.CustomProgressBar;
 import org.tizen.emulator.skin.custom.SkinWindow;
 import org.tizen.emulator.skin.dbi.HoverType;
@@ -158,7 +157,6 @@ public class EmulatorSkin {
 
        public Color colorVM;
        private KeyWindowKeeper keyWindowKeeper;
-       public ColorTag pairTag;
        public CustomProgressBar bootingProgress;
        public ScreenShotDialog screenShotDialog;
 
@@ -1212,6 +1210,10 @@ public class EmulatorSkin {
                lcdCanvas.setFocus();
        }
 
+       public void updateSkin() {
+               skinComposer.updateSkin();
+       }
+
        public void updateDisplay() {
                /* abstract */
        }
@@ -1867,12 +1869,12 @@ public class EmulatorSkin {
 
                isShutdownRequested = true;
 
-               if (!this.shell.isDisposed()) {
-                       this.shell.getDisplay().asyncExec(new Runnable() {
+               if (!shell.isDisposed()) {
+                       shell.getDisplay().asyncExec(new Runnable() {
                                @Override
                                public void run() {
                                        if (!shell.isDisposed()) {
-                                               EmulatorSkin.this.shell.close();
+                                               shell.close();
                                        }
                                }
                        });
index a5c11069cfb7e2abe4b6f96d38e7b57236098337..8c7da193992d235d3871b0994ad5daa9ab6477cd 100644 (file)
@@ -54,6 +54,7 @@ import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
 import org.tizen.emulator.skin.custom.ColorTag;
 import org.tizen.emulator.skin.custom.CustomButton;
 import org.tizen.emulator.skin.custom.CustomProgressBar;
+import org.tizen.emulator.skin.custom.SkinWindow;
 import org.tizen.emulator.skin.image.GeneralSkinImageRegistry;
 import org.tizen.emulator.skin.image.GeneralSkinImageRegistry.GeneralSkinImageName;
 import org.tizen.emulator.skin.image.ImageRegistry.IconName;
@@ -76,6 +77,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
        private Canvas displayCanvas;
        private Color backgroundColor;
        private CustomButton toggleButton;
+       private ColorTag pairTag;
        private EmulatorSkinState currentState;
 
        private SkinPatches frameMaker;
@@ -189,9 +191,8 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                });
 
                /* make a pair tag circle */
-               skin.pairTag =
-                               new ColorTag(shell, SWT.NO_FOCUS, skin.getColorVM());
-               skin.pairTag.setVisible(false);
+               pairTag = new ColorTag(shell, SWT.NO_FOCUS, skin.getColorVM());
+               pairTag.setVisible(false);
 
                /* create a progress bar for booting status */
                skin.bootingProgress = new CustomProgressBar(skin, SWT.NONE, true);
@@ -284,24 +285,24 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
 
                /* arrange the pair tag */
                if (rotationId == RotationInfo.PORTRAIT.id()) {
-                       skin.pairTag.setBounds(
+                       pairTag.setBounds(
                                        PAIR_TAG_POSITION_X, PAIR_TAG_POSITION_Y,
-                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+                                       pairTag.getWidth(), pairTag.getHeight());
                } else if (rotationId == RotationInfo.LANDSCAPE.id()) {
-                       skin.pairTag.setBounds(
+                       pairTag.setBounds(
                                        PAIR_TAG_POSITION_Y,
-                                       shell.getSize().y - PAIR_TAG_POSITION_X - skin.pairTag.getHeight(),
-                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+                                       shell.getSize().y - PAIR_TAG_POSITION_X - pairTag.getHeight(),
+                                       pairTag.getWidth(), pairTag.getHeight());
                } else if (rotationId == RotationInfo.REVERSE_PORTRAIT.id()) {
-                       skin.pairTag.setBounds(
-                                       shell.getSize().x - PAIR_TAG_POSITION_X - skin.pairTag.getWidth(),
-                                       shell.getSize().y - PAIR_TAG_POSITION_Y - skin.pairTag.getHeight(),
-                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+                       pairTag.setBounds(
+                                       shell.getSize().x - PAIR_TAG_POSITION_X - pairTag.getWidth(),
+                                       shell.getSize().y - PAIR_TAG_POSITION_Y - pairTag.getHeight(),
+                                       pairTag.getWidth(), pairTag.getHeight());
                } else if (rotationId == RotationInfo.REVERSE_LANDSCAPE.id()) {
-                       skin.pairTag.setBounds(
-                                       shell.getSize().x - PAIR_TAG_POSITION_Y - skin.pairTag.getWidth(),
+                       pairTag.setBounds(
+                                       shell.getSize().x - PAIR_TAG_POSITION_Y - pairTag.getWidth(),
                                        PAIR_TAG_POSITION_X,
-                                       skin.pairTag.getWidth(), skin.pairTag.getHeight());
+                                       pairTag.getWidth(), pairTag.getHeight());
                }
 
                /* custom window shape */
@@ -373,6 +374,27 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                return region;
        }
 
+       @Override
+       public void updateSkin() {
+               logger.info("update skin");
+
+               shell.getDisplay().asyncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               /* update pair tag */
+                               if (pairTag != null && pairTag.isDisposed() == false) {
+                                       SkinWindow keyWindow = skin.getKeyWindowKeeper().getKeyWindow();
+                                       if (keyWindow != null &&
+                                                       keyWindow.getShell().isVisible() == true) {
+                                               pairTag.setVisible(true);
+                                       } else {
+                                               pairTag.setVisible(false);
+                                       }
+                               }
+                       }
+               });
+       }
+
        public void addGeneralPurposeListener(final Shell shell) {
                shellPaintListener = new PaintListener() {
                        @Override
@@ -472,8 +494,9 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        toggleButton.dispose();
                }
 
-               if (skin.pairTag != null) {
-                       skin.pairTag.dispose();
+               if (pairTag != null) {
+                       pairTag.dispose();
+                       pairTag = null;
                }
 
                if (backgroundColor != null) {
index eed873e464c215626ed82937b55c903c87697393..478d334a855a9cfa61f22ae70a00616b68f14b43 100644 (file)
@@ -38,6 +38,7 @@ public interface ISkinComposer {
                        int x, int y, int scale, short rotationId);
 
        public abstract void arrangeSkin(int scale, short rotationId);
+       public abstract void updateSkin();
 
        public abstract Rectangle adjustDisplayGeometry(
                        Canvas displayCanvas, int resolutionW, int resolutionH,
index 9e15e4ee21585fe665b285682bb35ef2ede710e9..6ccaf700e9b359ab03b4981119d236fa40524206 100644 (file)
@@ -339,6 +339,13 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                currentHoveredHWKey = null;
        }
 
+       @Override
+       public void updateSkin() {
+               logger.info("update skin");
+
+               /* do nothing */
+       }
+
        public void addProfileSpecificListener(final Shell shell) {
                shellPaintListener = new PaintListener() {
                        @Override
index d29ac506df22d8627b19f8d488482c5213f25d43..672c4dabc593412ef88fbf925e85adac318836f6 100644 (file)
@@ -503,10 +503,6 @@ public class GeneralKeyWindow extends SkinWindow {
        }
 
        private void dispose() {
-               if (skin.pairTag != null) {
-                       skin.pairTag.setVisible(false);
-               }
-
                if (null != shellPaintListener) {
                        shell.removePaintListener(shellPaintListener);
                }
index 3ebcbd6aaa132420559eda0bd040034b9c8b0b0f..7e5e28b733bc364c86d6cc0bf880d7fa8952ef87 100644 (file)
@@ -67,13 +67,11 @@ public class KeyWindowKeeper {
                                /* show the Key Window */
                                selectKeyWindowMenu(skin.isKeyWindow = true);
 
-                               if (skin.pairTag != null) {
-                                       skin.pairTag.setVisible(true);
-                               }
-
                                keyWindow.getShell().setVisible(true);
                                SkinUtil.setTopMost(keyWindow.getShell(), skin.isOnTop);
 
+                               skin.updateSkin();
+
                                return;
                        } else {
                                logger.info("recreate a keywindow");
@@ -119,36 +117,30 @@ public class KeyWindowKeeper {
                selectKeyWindowMenu(skin.isKeyWindow = true);
                SkinUtil.setTopMost(keyWindow.getShell(), skin.isOnTop);
 
-               if (skin.pairTag != null) {
-                       skin.pairTag.setVisible(true);
-               }
-
                keyWindow.open(dockValue);
+
+               skin.updateSkin();
        }
 
        public void closeKeyWindow() {
                selectKeyWindowMenu(skin.isKeyWindow = false);
 
-               if (skin.pairTag != null) {
-                       skin.pairTag.setVisible(false);
-               }
-
                if (keyWindow != null) {
                        keyWindow.getShell().close();
                        keyWindow = null;
                }
+
+               skin.updateSkin();
        }
 
        public void hideKeyWindow() {
                selectKeyWindowMenu(skin.isKeyWindow = false);
 
-               if (skin.pairTag != null) {
-                       skin.pairTag.setVisible(false);
-               }
-
                if (keyWindow != null) {
                        keyWindow.getShell().setVisible(false);
                }
+
+               skin.updateSkin();
        }
 
        public SkinWindow getKeyWindow() {
index 0e0c3261cae93463c64ee3a63832dd2ec85f8857..0406969f92bcb4ed21528b7a192547ad82877ecc 100644 (file)
@@ -489,10 +489,6 @@ public class SpecialKeyWindow extends SkinWindow {
        }
 
        private void dispose() {
-               if (skin.pairTag != null) {
-                       skin.pairTag.setVisible(false);
-               }
-
                if (null != shellPaintListener) {
                        shell.removePaintListener(shellPaintListener);
                }