From: GiWoong Kim Date: Tue, 1 Oct 2013 02:37:37 +0000 (+0900) Subject: skin: modified class name X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~709^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F10641%2F1;p=sdk%2Femulator%2Fqemu.git skin: modified class name KeyWindowImageRegistry -> SpecialKeyWindowImageRegistry Change-Id: I43a8f738bb2284f6958d92f6d671d8b3ffe362e3 Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/GeneralKeyWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/GeneralKeyWindow.java index 5a1084e98e..a9c196a8b4 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/GeneralKeyWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/GeneralKeyWindow.java @@ -108,7 +108,7 @@ public class GeneralKeyWindow extends SkinWindow { SWT.NO_TRIM | SWT.RESIZE | SWT.TOOL); } - this.imageRegistry = new GeneralKeyWindowImageRegistry(); + this.imageRegistry = new GeneralKeyWindowImageRegistry(shell.getDisplay()); this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH); this.keyMapList = keyMapList; //TODO: null diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SpecialKeyWindow.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SpecialKeyWindow.java index 0663f8c08c..88db58851f 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SpecialKeyWindow.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SpecialKeyWindow.java @@ -59,8 +59,8 @@ import org.tizen.emulator.skin.comm.sock.data.MouseEventData; import org.tizen.emulator.skin.config.EmulatorConfig; import org.tizen.emulator.skin.dbi.EmulatorUI; import org.tizen.emulator.skin.exception.JaxbException; -import org.tizen.emulator.skin.image.KeyWindowImageRegistry; -import org.tizen.emulator.skin.image.KeyWindowImageRegistry.SpecailKeyWindowImageType; +import org.tizen.emulator.skin.image.SpecialKeyWindowImageRegistry; +import org.tizen.emulator.skin.image.SpecialKeyWindowImageRegistry.SpecailKeyWindowImageType; import org.tizen.emulator.skin.layout.HWKey; import org.tizen.emulator.skin.util.IOUtil; import org.tizen.emulator.skin.util.JaxbUtil; @@ -82,7 +82,7 @@ public class SpecialKeyWindow extends SkinWindow { private Image keyWindowPressedImage; private Color colorFrame; - private KeyWindowImageRegistry imageRegistry; + private SpecialKeyWindowImageRegistry imageRegistry; private SocketCommunicator communicator; private ShellListener shellListener; @@ -120,7 +120,7 @@ public class SpecialKeyWindow extends SkinWindow { EmulatorUI dbiContents = loadXMLForKeyWindow(specialKeyWindowPath); /* image init */ - this.imageRegistry = new KeyWindowImageRegistry(shell.getDisplay(), dbiContents, specialKeyWindowPath); + this.imageRegistry = new SpecialKeyWindowImageRegistry(shell.getDisplay(), dbiContents, specialKeyWindowPath); /* get keywindow image */ keyWindowImage = imageRegistry.getSpecialKeyWindowImage(EmulatorConfig.DEFAULT_WINDOW_ROTATION, SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/GeneralKeyWindowImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/GeneralKeyWindowImageRegistry.java index 4505d3a27d..e1c841c01a 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/GeneralKeyWindowImageRegistry.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/GeneralKeyWindowImageRegistry.java @@ -77,8 +77,8 @@ public class GeneralKeyWindowImageRegistry { /** * Constructor */ - public GeneralKeyWindowImageRegistry() { - this.display = Display.getDefault(); + public GeneralKeyWindowImageRegistry(Display display) { + this.display = display; this.keyWindowImageMap = new HashMap(); } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/KeyWindowImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/KeyWindowImageRegistry.java deleted file mode 100644 index 2b0d9dd78d..0000000000 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/KeyWindowImageRegistry.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Image Resource Management For Special Key Window - * - * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * GiWoong Kim - * YeongKyoon Lee - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.emulator.skin.image; - -import java.io.File; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.tizen.emulator.skin.dbi.EmulatorUI; -import org.tizen.emulator.skin.dbi.ImageListType; -import org.tizen.emulator.skin.dbi.RotationType; -import org.tizen.emulator.skin.dbi.RotationsType; -import org.tizen.emulator.skin.log.SkinLogger; -import org.tizen.emulator.skin.util.KeyWindowRotation; -import org.tizen.emulator.skin.util.SkinRotation; - - -/** - * - * - */ -public class KeyWindowImageRegistry { - private static Logger logger = - SkinLogger.getSkinLogger(KeyWindowImageRegistry.class).getLogger(); - - public enum SpecailKeyWindowImageType { - SPECIAL_IMAGE_TYPE_NORMAL, - SPECIAL_IMAGE_TYPE_PRESSED - } - - private Display display; - private String skinPath; - private EmulatorUI dbiContents; - private Map keyWindowImageMap; - - /** - * Constructor - */ - public KeyWindowImageRegistry( - Display display, EmulatorUI dbiContents, String skinPath) { - this.display = display; - this.skinPath = skinPath; - this.dbiContents = dbiContents; - this.keyWindowImageMap = new HashMap(); - - initialize(skinPath); - } - - private void initialize(String argSkinPath) { - RotationsType rotations = dbiContents.getRotations(); - - if (null == rotations) { - logger.severe("Fail to loading rotations element from XML"); - return; - } - - List rotationList = rotations.getRotation(); - - for (RotationType rotation : rotationList) { - KeyWindowRotation.put(rotation); - } - } - - private String makeKey(Short id, SpecailKeyWindowImageType imageType) { - return id + ":" + imageType.ordinal(); - } - - public Image getSpecialKeyWindowImage(Short id, SpecailKeyWindowImageType imageType) { - Image image = keyWindowImageMap.get(makeKey(id, imageType)); - - if (image == null) { - RotationsType rotations = dbiContents.getRotations(); - - if (null == rotations) { - logger.severe("Fail to loading rotations element from XML"); - return null; - } - - logger.info("get skin image from " + skinPath); - - RotationType targetRotation = SkinRotation.getRotation(id); - List rotationList = rotations.getRotation(); - - for (RotationType rotation : rotationList) { - ImageListType imageList = rotation.getImageList(); - if (imageList == null) { - continue; - } - - String mainImage = imageList.getMainImage(); - String keyPressedImage = imageList.getKeyPressedImage(); - - if (targetRotation.getName().value().equals(rotation.getName().value())) { - String mainKey = makeKey(id, - SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL); - keyWindowImageMap.put(mainKey, - new Image(display, skinPath + File.separator + mainImage)); - - String pressedKey = makeKey(id, - SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_PRESSED); - keyWindowImageMap.put(pressedKey, - new Image(display, skinPath + File.separator + keyPressedImage)); - - break; - } - } - - image = keyWindowImageMap.get(makeKey(id, imageType)); - } - - return image; - } - - public void dispose() { - if (null != keyWindowImageMap) { - Image image = null; - - Collection images = keyWindowImageMap.values(); - Iterator imageIterator = images.iterator(); - - while (imageIterator.hasNext()) { - image = imageIterator.next(); - image.dispose(); - } - } - } -} diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/SpecialKeyWindowImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/SpecialKeyWindowImageRegistry.java new file mode 100644 index 0000000000..9e413c3d4d --- /dev/null +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/SpecialKeyWindowImageRegistry.java @@ -0,0 +1,159 @@ +/** + * Image Resource Management For Special Key Window + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim + * YeongKyoon Lee + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.skin.image; + +import java.io.File; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.tizen.emulator.skin.dbi.EmulatorUI; +import org.tizen.emulator.skin.dbi.ImageListType; +import org.tizen.emulator.skin.dbi.RotationType; +import org.tizen.emulator.skin.dbi.RotationsType; +import org.tizen.emulator.skin.log.SkinLogger; +import org.tizen.emulator.skin.util.KeyWindowRotation; +import org.tizen.emulator.skin.util.SkinRotation; + + +/** + * + * + */ +public class SpecialKeyWindowImageRegistry { + private static Logger logger = + SkinLogger.getSkinLogger(SpecialKeyWindowImageRegistry.class).getLogger(); + + public enum SpecailKeyWindowImageType { + SPECIAL_IMAGE_TYPE_NORMAL, + SPECIAL_IMAGE_TYPE_PRESSED + } + + private Display display; + private String skinPath; + private EmulatorUI dbiContents; + private Map keyWindowImageMap; + + /** + * Constructor + */ + public SpecialKeyWindowImageRegistry( + Display display, EmulatorUI dbiContents, String skinPath) { + this.display = display; + this.skinPath = skinPath; + this.dbiContents = dbiContents; + this.keyWindowImageMap = new HashMap(); + + initialize(skinPath); + } + + private void initialize(String argSkinPath) { + RotationsType rotations = dbiContents.getRotations(); + + if (null == rotations) { + logger.severe("Fail to loading rotations element from XML"); + return; + } + + List rotationList = rotations.getRotation(); + + for (RotationType rotation : rotationList) { + KeyWindowRotation.put(rotation); + } + } + + private String makeKey(Short id, SpecailKeyWindowImageType imageType) { + return id + ":" + imageType.ordinal(); + } + + public Image getSpecialKeyWindowImage(Short id, SpecailKeyWindowImageType imageType) { + Image image = keyWindowImageMap.get(makeKey(id, imageType)); + + if (image == null) { + RotationsType rotations = dbiContents.getRotations(); + + if (null == rotations) { + logger.severe("Fail to loading rotations element from XML"); + return null; + } + + logger.info("get skin image from " + skinPath); + + RotationType targetRotation = SkinRotation.getRotation(id); + List rotationList = rotations.getRotation(); + + for (RotationType rotation : rotationList) { + ImageListType imageList = rotation.getImageList(); + if (imageList == null) { + continue; + } + + String mainImage = imageList.getMainImage(); + String keyPressedImage = imageList.getKeyPressedImage(); + + if (targetRotation.getName().value().equals(rotation.getName().value())) { + String mainKey = makeKey(id, + SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL); + keyWindowImageMap.put(mainKey, + new Image(display, skinPath + File.separator + mainImage)); + + String pressedKey = makeKey(id, + SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_PRESSED); + keyWindowImageMap.put(pressedKey, + new Image(display, skinPath + File.separator + keyPressedImage)); + + break; + } + } + + image = keyWindowImageMap.get(makeKey(id, imageType)); + } + + return image; + } + + public void dispose() { + if (null != keyWindowImageMap) { + Image image = null; + + Collection images = keyWindowImageMap.values(); + Iterator imageIterator = images.iterator(); + + while (imageIterator.hasNext()) { + image = imageIterator.next(); + image.dispose(); + } + } + } +}