From: GiWoong Kim Date: Fri, 15 Nov 2013 03:22:33 +0000 (+0900) Subject: skin: added updateSkin interface X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~598 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=afa2e7f0b8ec8df34ab172c7ab3e834272384181;p=sdk%2Femulator%2Fqemu.git skin: added updateSkin interface 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 --- diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index 7b9688aebc..faee611288 100755 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -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(); } } }); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java index a5c11069cf..8c7da19399 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java @@ -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) { diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ISkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ISkinComposer.java index eed873e464..478d334a85 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ISkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ISkinComposer.java @@ -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, diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java index 9e15e4ee21..6ccaf700e9 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java @@ -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 diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java index d29ac506df..672c4dabc5 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/GeneralKeyWindow.java @@ -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); } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java index 3ebcbd6aaa..7e5e28b733 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java @@ -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() { diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/SpecialKeyWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/SpecialKeyWindow.java index 0e0c3261ca..0406969f92 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/SpecialKeyWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/menu/SpecialKeyWindow.java @@ -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); }