skin: modified class name 41/10641/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 1 Oct 2013 02:37:37 +0000 (11:37 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Tue, 8 Oct 2013 06:13:17 +0000 (15:13 +0900)
KeyWindowImageRegistry -> SpecialKeyWindowImageRegistry

Change-Id: I43a8f738bb2284f6958d92f6d671d8b3ffe362e3
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/custom/GeneralKeyWindow.java
tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SpecialKeyWindow.java
tizen/src/skin/client/src/org/tizen/emulator/skin/image/GeneralKeyWindowImageRegistry.java
tizen/src/skin/client/src/org/tizen/emulator/skin/image/KeyWindowImageRegistry.java [deleted file]
tizen/src/skin/client/src/org/tizen/emulator/skin/image/SpecialKeyWindowImageRegistry.java [new file with mode: 0644]

index 5a1084e98ef8e68e7ba2690fad9685ca457b1651..a9c196a8b4bb2fa95cfbaf365b4780c593530f87 100644 (file)
@@ -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
index 0663f8c08c31ee8d7d840680776cc2b4ade31715..88db58851f1ef20f611f70213a369624edc2dd92 100644 (file)
@@ -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);           
index 4505d3a27db9e70154f1e0c0ac7d30968c2f4f68..e1c841c01ab2475afb93c5a5a31355d7d5d62e1d 100644 (file)
@@ -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<String, Image>();
        }
 
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 (file)
index 2b0d9dd..0000000
+++ /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 <giwoong.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * 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<String, Image> keyWindowImageMap;
-
-       /**
-        *  Constructor
-        */
-       public KeyWindowImageRegistry(
-                       Display display, EmulatorUI dbiContents, String skinPath) {
-               this.display = display;
-               this.skinPath = skinPath;
-               this.dbiContents = dbiContents;
-               this.keyWindowImageMap = new HashMap<String, Image>();
-
-               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<RotationType> 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<RotationType> 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<Image> images = keyWindowImageMap.values();
-                       Iterator<Image> 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 (file)
index 0000000..9e413c3
--- /dev/null
@@ -0,0 +1,159 @@
+/**
+ * Image Resource Management For Special Key Window
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * 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<String, Image> keyWindowImageMap;
+
+       /**
+        *  Constructor
+        */
+       public SpecialKeyWindowImageRegistry(
+                       Display display, EmulatorUI dbiContents, String skinPath) {
+               this.display = display;
+               this.skinPath = skinPath;
+               this.dbiContents = dbiContents;
+               this.keyWindowImageMap = new HashMap<String, Image>();
+
+               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<RotationType> 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<RotationType> 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<Image> images = keyWindowImageMap.values();
+                       Iterator<Image> imageIterator = images.iterator();
+
+                       while (imageIterator.hasNext()) {
+                               image = imageIterator.next();
+                               image.dispose();
+                       }
+               }
+       }
+}