add client project
authorSon Hyunjun <hj79.son@samsung.com>
Thu, 15 Mar 2012 04:14:13 +0000 (13:14 +0900)
committerSon Hyunjun <hj79.son@samsung.com>
Thu, 15 Mar 2012 04:14:13 +0000 (13:14 +0900)
52 files changed:
tizen/src/skin/client/build.xml [new file with mode: 0644]
tizen/src/skin/client/dev/dbi-sample.xml [new file with mode: 0644]
tizen/src/skin/client/dev/emul-skin.properties [new file with mode: 0644]
tizen/src/skin/client/emulator-skin.jar [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default.dbi [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_0.png [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_0_p.png [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_180.png [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_180_p.png [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_L90.png [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_L90_p.png [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_R90.png [new file with mode: 0644]
tizen/src/skin/client/skins/emul_480x800/default_R90_p.png [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorConstants.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShutdownhook.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/AbstractSendData.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/BooleanData.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/ISendData.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/KeyEventData.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/LcdStateData.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/MouseEventData.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/StartData.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ColorsType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/EmulatorUI.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/EventInfoType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ImageListType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/KeyMapListType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/KeyMapType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/LcdType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ObjectFactory.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RegionType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RgbType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationNameType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationsType.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/package-info.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/exception/EmulatorException.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/exception/JaxbException.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/IOUtil.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/JaxbUtil.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRegion.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/StringUtil.java [new file with mode: 0644]
tizen/src/skin/client/xsd/dbi.xsd [new file with mode: 0644]

diff --git a/tizen/src/skin/client/build.xml b/tizen/src/skin/client/build.xml
new file mode 100644 (file)
index 0000000..750aee4
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone="yes"?>
+<project name="emulator-skin" basedir="." default="jar">
+    <path id="classpath">
+        <fileset dir="lib/swt/gtk-linux" includes="swt.jar" />
+    </path>
+    
+    <target name="compile">
+        <echo message="compiling..." />
+        <!-- remove hidden .xxx -->
+        <delete dir="bin" excludes=".*"/>
+        <mkdir dir="bin" />
+        <javac fork="true" srcdir="src" destdir="bin" debug="on" memorymaximumsize="128m">
+            <classpath refid="classpath" />
+        </javac>
+    </target>
+    
+    <target name="jar" depends="compile">
+        <echo message="creating emulator-skin.jar..." />
+        <jar jarfile="emulator-skin.jar" basedir="bin" duplicate="add">
+               <manifest>
+                       <attribute name="Main-Class" value="org.tizen.emulator.skin.EmulatorSkinMain"/>
+                <attribute name="Class-path" value="swt.jar"/>
+               </manifest>
+<!--            <fileset dir="src" includes="**/*.properties"/> -->
+        </jar>
+    </target>
+
+<!--
+    <target name="dist" depends="jar">
+        <copy file="./emulator-skin.jar" tofile="../dist/emulator-skin.jar"/>
+    </target>
+-->
+
+</project>
\ No newline at end of file
diff --git a/tizen/src/skin/client/dev/dbi-sample.xml b/tizen/src/skin/client/dev/dbi-sample.xml
new file mode 100644 (file)
index 0000000..9e1beef
--- /dev/null
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<EmulatorUI xmlns="http://www.tizen.org/dbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.tizen.org/dbi dbi.xsd ">
+    <rotations>
+        <rotation id="0" name="Portrait">
+            <lcd id="0">
+                <region height="800" left="35" top="86" width="480"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_0.png</mainImage>
+                <keyPressedImage>default_0_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region height="74" left="238" top="887" width="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="74" left="541" top="819" width="20"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="74" left="541" top="81" width="20"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="74" left="541" top="167" width="20"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation id="1" name="Landscape">
+            <lcd id="0">
+                <region height="480" left="86" top="46" width="800"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_L90.png</mainImage>
+                <keyPressedImage>default_L90_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region height="74" left="887" top="249" width="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="20" left="818" top="2" width="74"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="20" left="80" top="2" width="74"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="20" left="165" top="2" width="74"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation id="2" name="Reverse Portrait">
+            <lcd id="0">
+                <region left="46" top="89" width="480" height="800"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_180.png</mainImage>
+                <keyPressedImage>default_180_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="249" top="14" width="74" height="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="2" top="84" width="20" height="74"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="2" top="821" width="20" height="74"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="2" top="735" width="20" height="74"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation id="3" name="Reverse Landscape">
+            <lcd id="0">
+                <region left="90" top="35" width="800" height="480"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_R90.png</mainImage>
+                <keyPressedImage>default_R90_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="15" top="239" width="74" height="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="84" top="539" width="74" height="20"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="822" top="539" width="74" height="20"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="735" top="539" width="74" height="20"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+    </rotations>
+    <colors>
+        <hoverColor B="255" G="255" R="255" />
+    </colors>
+</EmulatorUI>
diff --git a/tizen/src/skin/client/dev/emul-skin.properties b/tizen/src/skin/client/dev/emul-skin.properties
new file mode 100644 (file)
index 0000000..95bc735
--- /dev/null
@@ -0,0 +1,7 @@
+#Generated automatically by emulator.
+#Fri Mar 09 13:40:09 KST 2012
+window.y=54
+window.x=780
+window.scale=1
+window.rotate=0
+window.direction=0
diff --git a/tizen/src/skin/client/emulator-skin.jar b/tizen/src/skin/client/emulator-skin.jar
new file mode 100644 (file)
index 0000000..461dcf0
Binary files /dev/null and b/tizen/src/skin/client/emulator-skin.jar differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default.dbi b/tizen/src/skin/client/skins/emul_480x800/default.dbi
new file mode 100644 (file)
index 0000000..9e1beef
--- /dev/null
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<EmulatorUI xmlns="http://www.tizen.org/dbi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.tizen.org/dbi dbi.xsd ">
+    <rotations>
+        <rotation id="0" name="Portrait">
+            <lcd id="0">
+                <region height="800" left="35" top="86" width="480"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_0.png</mainImage>
+                <keyPressedImage>default_0_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region height="74" left="238" top="887" width="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="74" left="541" top="819" width="20"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="74" left="541" top="81" width="20"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="74" left="541" top="167" width="20"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation id="1" name="Landscape">
+            <lcd id="0">
+                <region height="480" left="86" top="46" width="800"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_L90.png</mainImage>
+                <keyPressedImage>default_L90_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region height="74" left="887" top="249" width="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="20" left="818" top="2" width="74"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="20" left="80" top="2" width="74"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region height="20" left="165" top="2" width="74"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation id="2" name="Reverse Portrait">
+            <lcd id="0">
+                <region left="46" top="89" width="480" height="800"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_180.png</mainImage>
+                <keyPressedImage>default_180_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="249" top="14" width="74" height="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="2" top="84" width="20" height="74"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="2" top="821" width="20" height="74"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="2" top="735" width="20" height="74"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+        <rotation id="3" name="Reverse Landscape">
+            <lcd id="0">
+                <region left="90" top="35" width="800" height="480"/>
+            </lcd>
+            <imageList>
+                <mainImage>default_R90.png</mainImage>
+                <keyPressedImage>default_R90_p.png</keyPressedImage>
+            </imageList>
+            <keyMapList>
+                <keyMap>
+                    <region left="15" top="239" width="74" height="74"/>
+                    <eventInfo>
+                        <keyCode>101</keyCode>
+                        <keyName>HOME</keyName>
+                    </eventInfo>
+                    <tooltip>Home</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="84" top="539" width="74" height="20"/>
+                    <eventInfo>
+                        <keyCode>103</keyCode>
+                        <keyName>POWER</keyName>
+                    </eventInfo>
+                    <tooltip>Power</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="822" top="539" width="74" height="20"/>
+                    <eventInfo>
+                        <keyCode>115</keyCode>
+                        <keyName>VOLUME_UP</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-up</tooltip>
+                </keyMap>
+                <keyMap>
+                    <region left="735" top="539" width="74" height="20"/>
+                    <eventInfo>
+                        <keyCode>114</keyCode>
+                        <keyName>VOLUME_DOWN</keyName>
+                    </eventInfo>
+                    <tooltip>Volume-down</tooltip>
+                </keyMap>
+            </keyMapList>
+        </rotation>
+    </rotations>
+    <colors>
+        <hoverColor B="255" G="255" R="255" />
+    </colors>
+</EmulatorUI>
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_0.png b/tizen/src/skin/client/skins/emul_480x800/default_0.png
new file mode 100644 (file)
index 0000000..6d33f38
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_0.png differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_0_p.png b/tizen/src/skin/client/skins/emul_480x800/default_0_p.png
new file mode 100644 (file)
index 0000000..2f1da59
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_0_p.png differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_180.png b/tizen/src/skin/client/skins/emul_480x800/default_180.png
new file mode 100644 (file)
index 0000000..5e8d276
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_180.png differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_180_p.png b/tizen/src/skin/client/skins/emul_480x800/default_180_p.png
new file mode 100644 (file)
index 0000000..8b50699
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_180_p.png differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_L90.png b/tizen/src/skin/client/skins/emul_480x800/default_L90.png
new file mode 100644 (file)
index 0000000..76d008f
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_L90.png differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_L90_p.png b/tizen/src/skin/client/skins/emul_480x800/default_L90_p.png
new file mode 100644 (file)
index 0000000..ca23955
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_L90_p.png differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_R90.png b/tizen/src/skin/client/skins/emul_480x800/default_R90.png
new file mode 100644 (file)
index 0000000..7be72f7
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_R90.png differ
diff --git a/tizen/src/skin/client/skins/emul_480x800/default_R90_p.png b/tizen/src/skin/client/skins/emul_480x800/default_R90_p.png
new file mode 100644 (file)
index 0000000..98de699
Binary files /dev/null and b/tizen/src/skin/client/skins/emul_480x800/default_R90_p.png differ
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorConstants.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorConstants.java
new file mode 100644 (file)
index 0000000..9aa85b9
--- /dev/null
@@ -0,0 +1,45 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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;
+
+/**
+ * 
+ *
+ */
+public interface EmulatorConstants {
+
+       //TODO move to config
+       public static final int HEART_BEAT_INTERVAL = 2; //second
+       public static final int HEART_BEAT_EXPIRE = 5;
+       /////////////////////////////
+       
+       public static final int UNKNOWN_KEYCODE = -1;
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShutdownhook.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShutdownhook.java
new file mode 100644 (file)
index 0000000..d961f27
--- /dev/null
@@ -0,0 +1,54 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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;
+
+import org.tizen.emulator.skin.comm.ICommunicator;
+
+/**
+ * 
+ *
+ */
+public class EmulatorShutdownhook extends Thread {
+
+       private ICommunicator communicator;
+       private EmulatorSkin skin;
+       
+       public EmulatorShutdownhook( ICommunicator communicator, EmulatorSkin skin ) {
+               this.communicator = communicator;
+               this.skin = skin;
+       }
+
+       @Override
+       public void run() {
+               communicator.terminate();
+               skin.shutdown();
+       }
+       
+}
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
new file mode 100644 (file)
index 0000000..17deca6
--- /dev/null
@@ -0,0 +1,1156 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DragDetectEvent;
+import org.eclipse.swt.events.DragDetectListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MenuDetectEvent;
+import org.eclipse.swt.events.MenuDetectListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.graphics.Transform;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.skin.comm.ICommunicator.KeyEventType;
+import org.tizen.emulator.skin.comm.ICommunicator.MouseEventType;
+import org.tizen.emulator.skin.comm.ICommunicator.Scale;
+import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
+import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
+import org.tizen.emulator.skin.comm.sock.data.BooleanData;
+import org.tizen.emulator.skin.comm.sock.data.KeyEventData;
+import org.tizen.emulator.skin.comm.sock.data.LcdStateData;
+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.PropertiesConstants;
+import org.tizen.emulator.skin.dbi.ColorsType;
+import org.tizen.emulator.skin.dbi.EventInfoType;
+import org.tizen.emulator.skin.dbi.KeyMapType;
+import org.tizen.emulator.skin.dbi.LcdType;
+import org.tizen.emulator.skin.dbi.RegionType;
+import org.tizen.emulator.skin.dbi.RgbType;
+import org.tizen.emulator.skin.dbi.RotationType;
+import org.tizen.emulator.skin.image.ImageRegistry;
+import org.tizen.emulator.skin.image.ImageRegistry.ImageType;
+import org.tizen.emulator.skin.util.SkinRegion;
+import org.tizen.emulator.skin.util.SkinRotation;
+import org.tizen.emulator.skin.util.SkinRotation.RotationInfo;
+
+/**
+ * 
+ *
+ */
+public class EmulatorSkin {
+
+       private static final int GHOST_SHELL_MARGIN = 10000;
+
+       private EmulatorConfig config;
+       private Shell shell;
+       private Shell ghostShell;
+       private ImageRegistry imageRegistry;
+       private Canvas lcdCanvas;
+       private Image currentImage;
+       private Image currentKeyPressedImage;
+       private Color hoverColor;
+       private boolean isDefaultHoverColor;
+       
+       private Scale currentScale;
+       private short currentRotationId;
+       private int currentAngle;
+       private int currentLcdWidth;
+       private int currentLcdHeight;
+
+       private int pressedMouseX;
+       private int pressedMouseY;
+       private boolean isMousePressed;
+       private boolean isDragStartedInLCD;
+       private boolean isHoverState;
+       private boolean isShutdownRequested;
+       
+       private SocketCommunicator communicator;
+       private int windowHandleId;
+
+       private ScheduledExecutorService canvasExecutor = Executors.newSingleThreadScheduledExecutor();
+
+       protected EmulatorSkin( EmulatorConfig config ) {
+               this.config = config;
+               this.shell = new Shell( new Display(), SWT.NO_TRIM );
+               this.isDefaultHoverColor = true;
+       }
+
+       public void setCommunicator( SocketCommunicator communicator ) {
+               this.communicator = communicator;
+       }
+
+       public int compose() {
+
+               //TODO resolution
+               imageRegistry = new ImageRegistry( shell.getDisplay(), config );
+
+               shell.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
+
+               int x = config.getPropertyInt( PropertiesConstants.WINDOW_X, 50 );
+               int y = config.getPropertyInt( PropertiesConstants.WINDOW_Y, 50 );
+               shell.setLocation( x, y );
+
+               String emulatorName = config.getArg( ArgsConstants.EMULATOR_NAME );
+               shell.setText( emulatorName );
+
+               this.lcdCanvas = new Canvas( shell, SWT.NONE );
+               lcdCanvas.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
+
+               int lcdWidth = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_WIDTH ) );
+               int lcdHeight = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_HEIGHT ) );
+
+               short scale = config.getPropertyShort( PropertiesConstants.WINDOW_SCALE, Scale.HALF.value() );
+               short rotationId = config.getPropertyShort( PropertiesConstants.WINDOW_DIRECTION, (short) 0 );
+
+               arrangeSkin( lcdWidth, lcdHeight, Scale.getValue( scale ), (short) rotationId );
+
+               Menu menu = new Menu( shell );
+               addMenuItems( menu );
+               shell.setMenu( menu );
+               
+               ColorsType colors = config.getDbiContents().getColors();
+               if ( null != colors ) {
+                       RgbType hoverRgb = colors.getHoverColor();
+                       if ( null != hoverRgb ) {
+                               Long r = hoverRgb.getR();
+                               Long g = hoverRgb.getG();
+                               Long b = hoverRgb.getB();
+                               if ( null != r && null != g && null != b ) {
+                                       hoverColor = new Color( shell.getDisplay(), new RGB( r.intValue(), g.intValue(), b.intValue() ) );
+                                       isDefaultHoverColor = false;
+                               }
+                       }
+               }
+
+               if( isDefaultHoverColor ) {
+                       hoverColor = shell.getDisplay().getSystemColor( SWT.COLOR_WHITE );                      
+               }
+               
+               ghostShell = new Shell( shell, SWT.NO_TRIM );
+
+               final Canvas ghostCanvas = new Canvas( ghostShell, SWT.EMBEDDED );
+               ghostShell.setAlpha( 255 );
+               ghostCanvas.setBounds( 0, 0, lcdWidth, lcdHeight );
+               ghostShell.pack();
+
+               ghostShell.open();
+
+               setGhostShellLocation();
+               
+               ghostShell.addListener( SWT.Activate, new Listener() {
+                       @Override
+                       public void handleEvent( Event event ) {
+                               setGhostShellLocation();
+                       }
+               } );
+
+               // sdl uses this handle id.
+               String platform = SWT.getPlatform();
+               if( "gtk".equalsIgnoreCase( platform ) ) {
+                       System.out.println( "lcdCanvas.embeddedHandle:" + ghostCanvas.embeddedHandle );
+                       windowHandleId = ghostCanvas.embeddedHandle;
+               }else if( "win32".equalsIgnoreCase( platform ) ) {
+                       System.out.println( "lcdCanvas.handle:" + ghostCanvas.handle );
+                       windowHandleId = ghostCanvas.handle;
+               }else if( "cocoa".equalsIgnoreCase( platform ) ) {
+                       //TODO
+               }else {
+                       System.out.println( "Not Supported OS platform:" + platform );
+                       System.exit( -1 );
+               }
+
+               addLCDListener( lcdCanvas );
+               addShellListener( shell );
+
+               final Runnable ghostExec = new Runnable() {
+
+                       @Override
+                       public void run() {
+
+                               Image image = new Image( shell.getDisplay(), ghostCanvas.getBounds() );
+                               GC ghostCanvasGC = new GC( ghostCanvas );
+                               ghostCanvasGC.copyArea( image, 0, 0 );
+                               ghostCanvasGC.dispose();
+
+                               GC lcdCanvasGC = new GC( lcdCanvas );
+
+                               float ratio = currentScale.ratio();
+
+                               if ( 1.0 == ratio && 0 == currentAngle ) {
+
+                                       lcdCanvasGC.drawImage( image, 0, 0 );
+                                       image.dispose();
+
+                               } else {
+
+                                       Transform transform = new Transform( shell.getDisplay() );
+                                       transform.scale( currentScale.ratio(), currentScale.ratio() );
+                                       transform.rotate( currentAngle );
+
+                                       if ( RotationInfo.LANDSCAPE.angle() == currentAngle ) {
+                                               transform.translate( -currentLcdWidth, 0 );
+                                       } else if ( RotationInfo.REVERSE_PORTRAIT.angle() == currentAngle ) {
+                                               transform.translate( -currentLcdWidth, -currentLcdHeight );
+                                       } else if ( RotationInfo.REVERSE_LANDSCAPE.angle() == currentAngle ) {
+                                               transform.translate( 0, -currentLcdHeight );
+                                       }
+
+                                       lcdCanvasGC.setTransform( transform );
+                                       lcdCanvasGC.drawImage( image, 0, 0 );
+                                       transform.dispose();
+
+                               }
+
+                               image.dispose();
+                               lcdCanvasGC.dispose();
+
+                       }
+               };
+
+               canvasExecutor.scheduleAtFixedRate( new Runnable() {
+                       @Override
+                       public void run() {
+                               shell.getDisplay().syncExec( ghostExec );
+                       }
+               }, 0, 30, TimeUnit.MILLISECONDS );
+
+               return windowHandleId;
+
+       }
+
+       public void open() {
+
+               if ( null == this.communicator ) {
+                       System.out.println( "communicator is null." );
+                       shell.close();
+                       return;
+               }
+
+               Display display = this.shell.getDisplay();
+
+               this.shell.open();
+
+               while ( !shell.isDisposed() ) {
+                       if ( !display.readAndDispatch() ) {
+                               display.sleep();
+                       }
+               }
+
+               display.dispose();
+
+       }
+
+       private void arrangeSkin( int lcdWidth, int lcdHeight, Scale scale, short rotationId ) {
+
+               this.currentLcdWidth = lcdWidth;
+               this.currentLcdHeight = lcdHeight;
+               this.currentScale = scale;
+               this.currentRotationId = rotationId;
+               this.currentAngle = SkinRotation.getAngle( rotationId );
+
+               if ( null != currentImage ) {
+                       currentImage.dispose();
+               }
+               if ( null != currentKeyPressedImage ) {
+                       currentKeyPressedImage.dispose();
+               }
+
+               currentImage = createScaledImage( rotationId, scale, ImageType.IMG_TYPE_MAIN );
+               currentKeyPressedImage = createScaledImage( rotationId, scale, ImageType.IMG_TYPE_PRESSED );
+
+               trimSkin( currentImage );
+               adjustLcdGeometry( lcdCanvas, scale, rotationId );
+
+               ImageData imageData = currentImage.getImageData();
+               shell.setMinimumSize( imageData.width, imageData.height );
+               shell.setSize( imageData.width, imageData.height );
+
+       }
+
+       private Image createScaledImage( short rotationId, Scale scale, ImageType type ) {
+
+               ImageData originalImageData = imageRegistry.getImageData( rotationId, type );
+
+               ImageData imageData = (ImageData) originalImageData.clone();
+               int width = (int) ( originalImageData.width * scale.ratio() );
+               int height = (int) ( originalImageData.height * scale.ratio() );
+               imageData = imageData.scaledTo( width, height );
+
+               Image image = new Image( shell.getDisplay(), imageData );
+               return image;
+
+       }
+
+       private void trimSkin( Image image ) {
+
+               // trim transparent pixels in image. especially, corner round areas.
+
+               ImageData imageData = image.getImageData();
+
+               int width = imageData.width;
+               int height = imageData.height;
+
+               Region region = new Region();
+               region.add( new Rectangle( 0, 0, width, height ) );
+
+               for ( int i = 0; i < width; i++ ) {
+                       for ( int j = 0; j < height; j++ ) {
+                               int alpha = imageData.getAlpha( i, j );
+                               if ( 0 == alpha ) {
+                                       region.subtract( i, j, 1, 1 );
+                               }
+                       }
+               }
+
+               shell.setRegion( region );
+
+       }
+
+       private void adjustLcdGeometry( Canvas lcdCanvas, Scale scale, short rotationId ) {
+
+               RotationType rotation = SkinRotation.getRotation( rotationId );
+
+               LcdType lcd = rotation.getLcd();
+               RegionType region = lcd.getRegion();
+
+               Integer left = region.getLeft();
+               Integer top = region.getTop();
+               Integer width = region.getWidth();
+               Integer height = region.getHeight();
+
+               int l = (int) ( left * scale.ratio() );
+               int t = (int) ( top * scale.ratio() );
+               int w = (int) ( width * scale.ratio() );
+               int h = (int) ( height * scale.ratio() );
+
+               lcdCanvas.setBounds( l, t, w, h );
+
+       }
+
+       private SkinRegion getHardKeyArea( int currentX, int currentY ) {
+
+               RotationType rotation = SkinRotation.getRotation( currentRotationId );
+
+               List<KeyMapType> keyMapList = rotation.getKeyMapList().getKeyMap();
+
+               for ( KeyMapType keyMap : keyMapList ) {
+
+                       RegionType region = keyMap.getRegion();
+
+                       int scaledX = (int) ( region.getLeft() * currentScale.ratio() );
+                       int scaledY = (int) ( region.getTop() * currentScale.ratio() );
+                       int scaledWidth = (int) ( region.getWidth() * currentScale.ratio() );
+                       int scaledHeight = (int) ( region.getHeight() * currentScale.ratio() );
+
+                       if ( isInGeometry( currentX, currentY, scaledX, scaledY, scaledWidth, scaledHeight ) ) {
+                               return new SkinRegion( scaledX, scaledY, scaledWidth, scaledHeight );
+                       }
+
+               }
+
+               return null;
+
+       }
+
+       private int getHardKeyCode( int currentX, int currentY ) {
+
+               RotationType rotation = SkinRotation.getRotation( currentRotationId );
+
+               List<KeyMapType> keyMapList = rotation.getKeyMapList().getKeyMap();
+
+               for ( KeyMapType keyMap : keyMapList ) {
+                       RegionType region = keyMap.getRegion();
+
+                       int scaledX = (int) ( region.getLeft() * currentScale.ratio() );
+                       int scaledY = (int) ( region.getTop() * currentScale.ratio() );
+                       int scaledWidth = (int) ( region.getWidth() * currentScale.ratio() );
+                       int scaledHeight = (int) ( region.getHeight() * currentScale.ratio() );
+
+                       if ( isInGeometry( currentX, currentY, scaledX, scaledY, scaledWidth, scaledHeight ) ) {
+                               EventInfoType eventInfo = keyMap.getEventInfo();
+                               return eventInfo.getKeyCode();
+                       }
+               }
+
+               return EmulatorConstants.UNKNOWN_KEYCODE;
+
+       }
+
+       private boolean isInGeometry( int currentX, int currentY, int targetX, int targetY, int targetWidth,
+                       int targetHeight ) {
+
+               if ( ( currentX >= targetX ) && ( currentY >= targetY ) ) {
+                       if ( ( currentX <= ( targetX + targetWidth ) ) && ( currentY <= ( targetY + targetHeight ) ) ) {
+                               return true;
+                       }
+               }
+
+               return false;
+
+       }
+
+       private int[] convertMouseGeometry( int originalX, int originalY ) {
+
+               int x = (int) ( originalX * ( 1 / currentScale.ratio() ) );
+               int y = (int) ( originalY * ( 1 / currentScale.ratio() ) );
+
+               int rotatedX = x;
+               int rotatedY = y;
+
+               if ( RotationInfo.LANDSCAPE.angle() == currentAngle ) {
+                       rotatedX = currentLcdWidth - y;
+                       rotatedY = x;
+               }else if ( RotationInfo.REVERSE_PORTRAIT.angle() == currentAngle ) {
+                       rotatedX = currentLcdWidth - x;
+                       rotatedY = currentLcdHeight - y;
+               }else if ( RotationInfo.REVERSE_LANDSCAPE.angle() == currentAngle ) {
+                       rotatedX = y;
+                       rotatedY = currentLcdHeight - x;
+               }
+
+               return new int[] { rotatedX, rotatedY };
+
+       }
+
+       private void setGhostShellLocation() {
+               Rectangle clientArea = Display.getCurrent().getClientArea();
+               int monitorWidth = clientArea.width;
+               int monitorHeight = clientArea.height;
+               ghostShell.setLocation( monitorWidth + GHOST_SHELL_MARGIN, monitorHeight + GHOST_SHELL_MARGIN );
+       }
+
+       private void addShellListener( final Shell shell ) {
+               
+               shell.addListener( SWT.Close, new Listener() {
+                       @Override
+                       public void handleEvent( Event event ) {
+
+                               if ( isShutdownRequested ) {
+
+                                       config.setProperty( PropertiesConstants.WINDOW_X, shell.getLocation().x );
+                                       config.setProperty( PropertiesConstants.WINDOW_Y, shell.getLocation().y );
+                                       config.setProperty( PropertiesConstants.WINDOW_SCALE, currentScale.value() );
+                                       config.setProperty( PropertiesConstants.WINDOW_DIRECTION, currentRotationId );
+
+                                       config.saveProperties();
+
+                                       if ( null != currentImage ) {
+                                               currentImage.dispose();
+                                       }
+
+                                       imageRegistry.dispose();
+                                       
+                                       if( !isDefaultHoverColor ) {
+                                               hoverColor.dispose();
+                                       }
+
+                               } else {
+
+                                       // Skin have to be alive until receiving shutdown request from qemu.
+                                       event.doit = false;
+                                       if ( null != communicator ) {
+                                               communicator.sendToQEMU( SendCommand.CLOSE, null );
+                                       }
+
+                               }
+
+                       }
+               } );
+
+               shell.addListener( SWT.Activate, new Listener() {
+                       @Override
+                       public void handleEvent( Event event ) {
+                               // ghostShell show at main shell loction suddenly in activate main shell. Relocate the ghostShell.
+                               setGhostShellLocation();
+                       }
+               } );
+
+               shell.addListener( SWT.Deactivate, new Listener() {
+                       @Override
+                       public void handleEvent( Event event ) {
+                               // ghostShell show at main shell loction suddenly in deactivate main shell. Relocate the ghostShell.
+                               setGhostShellLocation();
+                       }
+               } );
+
+               shell.addPaintListener( new PaintListener() {
+
+                       @Override
+                       public void paintControl( final PaintEvent e ) {
+
+                               // general shell does not support native transparency, so draw image with GC.
+                               if ( null != currentImage ) {
+                                       e.gc.drawImage( currentImage, 0, 0 );
+                               }
+
+                       }
+               } );
+
+               shell.addMouseTrackListener( new MouseTrackAdapter() {
+                       @Override
+                       public void mouseExit( MouseEvent e ) {
+                               // MouseMoveListener of shell does not receive event only with MouseMoveListener
+                               // in case that : hover hardkey -> mouse move into LCD area
+                               if( isHoverState ) {
+                                       shell.redraw();
+                                       isHoverState = false;
+                               }
+                       }
+                       
+               } );
+               
+               shell.addMouseMoveListener( new MouseMoveListener() {
+
+                       @Override
+                       public void mouseMove( MouseEvent e ) {
+                               if ( EmulatorSkin.this.isMousePressed ) {
+                                       if ( 0 == e.button ) { // left button
+
+                                               SkinRegion hardkeyRegion = getHardKeyArea( e.x, e.y );
+
+                                               if ( null == hardkeyRegion ) {
+                                                       Point previouseLocation = shell.getLocation();
+                                                       int x = previouseLocation.x + ( e.x - EmulatorSkin.this.pressedMouseX );
+                                                       int y = previouseLocation.y + ( e.y - EmulatorSkin.this.pressedMouseY );
+
+                                                       shell.setLocation( x, y );
+                                               }
+
+                                       }
+                               } else {
+
+                                       SkinRegion region = getHardKeyArea( e.x, e.y );
+
+                                       if ( null == region ) {
+                                               if( isHoverState ) {
+                                                       shell.redraw();
+                                                       isHoverState = false;
+                                               }
+                                       } else {
+                                               isHoverState = true;
+                                               GC gc = new GC( shell );
+                                               gc.setLineWidth( 1 );
+                                               gc.setForeground( hoverColor );
+                                               gc.drawRectangle( region.x, region.y, region.width, region.height );
+                                               gc.dispose();
+                                       }
+
+                               }
+
+                       }
+               } );
+
+               shell.addMouseListener( new MouseListener() {
+
+                       @Override
+                       public void mouseUp( MouseEvent e ) {
+                               if ( 1 == e.button ) { // left button
+                                       System.out.println( "mouseUp in Skin" );
+                                       EmulatorSkin.this.pressedMouseX = 0;
+                                       EmulatorSkin.this.pressedMouseY = 0;
+                                       EmulatorSkin.this.isMousePressed = false;
+
+                                       int keyCode = getHardKeyCode( e.x, e.y );
+
+                                       if ( EmulatorConstants.UNKNOWN_KEYCODE != keyCode ) {
+                                               shell.redraw();
+                                               KeyEventData keyEventData = new KeyEventData( KeyEventType.RELEASED.value(), keyCode );
+                                               communicator.sendToQEMU( SendCommand.SEND_HARD_KEY_EVENT, keyEventData );
+                                       }
+                                       
+                               }
+                       }
+
+                       @Override
+                       public void mouseDown( MouseEvent e ) {
+                               if ( 1 == e.button ) { // left button
+                                       System.out.println( "mouseDown in Skin" );
+                                       EmulatorSkin.this.pressedMouseX = e.x;
+                                       EmulatorSkin.this.pressedMouseY = e.y;
+
+                                       EmulatorSkin.this.isMousePressed = true;
+
+                                       int keyCode = getHardKeyCode( e.x, e.y );
+
+                                       if ( EmulatorConstants.UNKNOWN_KEYCODE != keyCode ) {
+                                               // draw the button region as the cropped keyPressed image area
+                                               SkinRegion region = getHardKeyArea( e.x, e.y );
+
+                                               if ( null != currentKeyPressedImage ) {
+                                                       GC gc = new GC( shell );
+                                                       gc.drawImage( currentKeyPressedImage,
+                                                                       region.x + 1, region.y + 1, region.width - 1, region.height - 1, //src
+                                                                       region.x + 1, region.y + 1, region.width - 1, region.height - 1 ); //dst
+                                                       gc.dispose();
+                                               }
+
+                                               KeyEventData keyEventData = new KeyEventData( KeyEventType.PRESSED.value(), keyCode );
+                                               communicator.sendToQEMU( SendCommand.SEND_HARD_KEY_EVENT, keyEventData );
+                                       }
+                               }
+                       }
+
+                       @Override
+                       public void mouseDoubleClick( MouseEvent e ) {
+                       }
+               } );
+
+       }
+
+       private void addLCDListener( final Canvas canvas ) {
+
+               // remove 'input method' menu item 
+               canvas.addMenuDetectListener( new MenuDetectListener() {
+                       @Override
+                       public void menuDetected( MenuDetectEvent e ) {
+                               Menu menu = shell.getMenu();
+                               lcdCanvas.setMenu( menu );
+                               menu.setVisible( true );
+                               e.doit = false;
+                       }
+               } );
+
+               canvas.addDragDetectListener( new DragDetectListener() {
+
+                       @Override
+                       public void dragDetected( DragDetectEvent e ) {
+                               System.out.println( "dragDetected e.button:" + e.button );
+                               if ( 1 == e.button && // left button
+                                               e.x > 0 && e.x < canvas.getSize().x && e.y > 0 && e.y < canvas.getSize().y ) {
+
+                                       System.out.println( "dragDetected in LCD" );
+                                       EmulatorSkin.this.isDragStartedInLCD = true;
+
+                               }
+                       }
+               } );
+
+               canvas.addMouseMoveListener( new MouseMoveListener() {
+
+                       @Override
+                       public void mouseMove( MouseEvent e ) {
+                               if ( true == EmulatorSkin.this.isDragStartedInLCD ) {
+                                       int eventType = MouseEventType.DRAG.value();
+                                       Point canvasSize = canvas.getSize();
+
+                                       if ( e.x <= 0 ) {
+                                               e.x = 1;
+                                               eventType = MouseEventType.UP.value();
+                                               EmulatorSkin.this.isDragStartedInLCD = false;
+                                       } else if ( e.x >= canvasSize.x ) {
+                                               e.x = canvasSize.x - 1;
+                                               eventType = MouseEventType.UP.value();
+                                               EmulatorSkin.this.isDragStartedInLCD = false;
+                                       }
+
+                                       if ( e.y <= 0 ) {
+                                               e.y = 1;
+                                               eventType = MouseEventType.UP.value();
+                                               EmulatorSkin.this.isDragStartedInLCD = false;
+                                       } else if ( e.y >= canvasSize.y ) {
+                                               e.y = canvasSize.y - 1;
+                                               eventType = MouseEventType.UP.value();
+                                               EmulatorSkin.this.isDragStartedInLCD = false;
+                                       }
+
+                                       int[] geometry = convertMouseGeometry( e.x, e.y );
+                                       MouseEventData mouseEventData = new MouseEventData( eventType, geometry[0], geometry[1], 0 );
+                                       communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData );
+                               }
+                       }
+               } );
+
+               canvas.addMouseListener( new MouseListener() {
+
+                       @Override
+                       public void mouseUp( MouseEvent e ) {
+                               if ( 1 == e.button ) { // left button
+
+                                       int[] geometry = convertMouseGeometry( e.x, e.y );
+                                       System.out.println( "mouseUp in LCD" + " x:" + geometry[0] + " y:" + geometry[1] );
+                                       MouseEventData mouseEventData = new MouseEventData( MouseEventType.UP.value(), geometry[0],
+                                                       geometry[1], 0 );
+                                       communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData );
+                                       if ( true == EmulatorSkin.this.isDragStartedInLCD ) {
+                                               EmulatorSkin.this.isDragStartedInLCD = false;
+                                       }
+                               }
+                       }
+
+                       @Override
+                       public void mouseDown( MouseEvent e ) {
+                               if ( 1 == e.button ) { // left button
+                                       int[] geometry = convertMouseGeometry( e.x, e.y );
+                                       System.out.println( "mouseDown in LCD" + " x:" + geometry[0] + " y:" + geometry[1] );
+                                       MouseEventData mouseEventData = new MouseEventData( MouseEventType.DOWN.value(), geometry[0],
+                                                       geometry[1], 0 );
+                                       communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData );
+                               }
+                       }
+
+                       @Override
+                       public void mouseDoubleClick( MouseEvent e ) {
+                       }
+               } );
+
+               canvas.addKeyListener( new KeyListener() {
+
+                       @Override
+                       public void keyReleased( KeyEvent e ) {
+                               System.out.println( "key released. key event:" + e );
+                               int keyCode = e.keyCode;
+
+                               KeyEventData keyEventData = new KeyEventData( KeyEventType.PRESSED.value(), keyCode );
+                               communicator.sendToQEMU( SendCommand.SEND_KEY_EVENT, keyEventData );
+                       }
+
+                       @Override
+                       public void keyPressed( KeyEvent e ) {
+                               System.out.println( "key pressed. key event:" + e );
+                               int keyCode = e.keyCode;
+                               KeyEventData keyEventData = new KeyEventData( KeyEventType.RELEASED.value(), keyCode );
+                               communicator.sendToQEMU( SendCommand.SEND_KEY_EVENT, keyEventData );
+                       }
+
+               } );
+
+       }
+
+       private void addMenuItems( final Menu menu ) {
+
+               final MenuItem infoItem = new MenuItem( menu, SWT.PUSH );
+
+               String emulatorName = config.getArg( ArgsConstants.EMULATOR_NAME );
+               infoItem.setText( emulatorName );
+               infoItem.addSelectionListener( new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+                               System.out.println( "Selected Info." );
+                               //TODO
+                               MessageBox messageBox = new MessageBox( shell, SWT.OK | SWT.APPLICATION_MODAL );
+                               messageBox.setMessage( "Under construction..." );
+                               messageBox.open();
+                       }
+               } );
+
+               new MenuItem( menu, SWT.SEPARATOR );
+
+               final MenuItem aotItem = new MenuItem( menu, SWT.CHECK );
+               aotItem.setText( "Always On Top" );
+               aotItem.addSelectionListener( new SelectionAdapter() {
+                       private boolean isTop;
+
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+                               System.out.println( "Selected Always On Top." );
+                               isTop = !isTop;
+                               
+                               //TODO
+                               MessageBox messageBox = new MessageBox( shell, SWT.OK | SWT.APPLICATION_MODAL );
+                               messageBox.setMessage( "Under construction..." );
+                               messageBox.open();
+
+                       }
+               } );
+
+               final MenuItem rotateItem = new MenuItem( menu, SWT.CASCADE );
+               rotateItem.setText( "Rotate" );
+
+               Menu rotateMenu = createRotateMenu( menu.getShell() );
+               rotateItem.setMenu( rotateMenu );
+
+               final MenuItem scaleItem = new MenuItem( menu, SWT.CASCADE );
+               scaleItem.setText( "Scale" );
+               Menu scaleMenu = createScaleMenu( menu.getShell() );
+               scaleItem.setMenu( scaleMenu );
+
+               new MenuItem( menu, SWT.SEPARATOR );
+
+               final MenuItem advancedItem = new MenuItem( menu, SWT.CASCADE );
+               advancedItem.setText( "Advanced" );
+               Menu advancedMenu = createAdvancedMenu( menu.getShell() );
+               advancedItem.setMenu( advancedMenu );
+
+               final MenuItem shellItem = new MenuItem( menu, SWT.PUSH );
+               shellItem.setText( "Shell" );
+               shellItem.addSelectionListener( new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+                               try {
+                                       //TODO
+                                       new ProcessBuilder("/usr/bin/gnome-terminal", "--disable-factory", "-x",
+                                                       "ssh", "-p", "1202", "root@localhost").start();
+                                       /*new ProcessBuilder("/usr/bin/gnome-terminal", "--disable-factory", "-x",
+                                                       "sdb", "shell").start();*/
+                               } catch (Exception e2) {
+                                       //TODO
+                               }
+
+                               communicator.sendToQEMU( SendCommand.OPEN_SHELL, null );
+                       }
+               } );
+
+               new MenuItem( menu, SWT.SEPARATOR );
+
+               MenuItem closeItem = new MenuItem( menu, SWT.PUSH );
+               closeItem.setText( "Close" );
+               closeItem.addSelectionListener( new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+                               communicator.sendToQEMU( SendCommand.CLOSE, null );
+                       }
+               } );
+
+       }
+
+       private Menu createRotateMenu( final Shell shell ) {
+
+               Menu menu = new Menu( shell, SWT.DROP_DOWN );
+
+               final List<MenuItem> rotationList = new ArrayList<MenuItem>();
+
+               final short storedDirectionId = config.getPropertyShort( PropertiesConstants.WINDOW_DIRECTION, (short) 0 );
+
+               Iterator<Entry<Short, RotationType>> iterator = SkinRotation.getRotationIterator();
+
+               while ( iterator.hasNext() ) {
+
+                       Entry<Short, RotationType> entry = iterator.next();
+                       Short rotationId = entry.getKey();
+                       RotationType section = entry.getValue();
+
+                       final MenuItem menuItem = new MenuItem( menu, SWT.RADIO );
+                       menuItem.setText( section.getName().value() );
+                       menuItem.setData( rotationId );
+                       if ( storedDirectionId == rotationId ) {
+                               menuItem.setSelection( true );
+                       }
+
+                       rotationList.add( menuItem );
+
+               }
+
+               SelectionAdapter selectionAdapter = new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+
+                               MenuItem item = (MenuItem) e.getSource();
+
+                               boolean selection = item.getSelection();
+
+                               if ( !selection ) {
+                                       return;
+                               }
+
+                               if ( !communicator.isSensorDaemonStarted() ) {
+
+                                       // reset selection.
+                                       item.setSelection( false );
+
+                                       for ( MenuItem m : rotationList ) {
+                                               short rotationId = (Short) m.getData();
+                                               if ( rotationId == currentRotationId ) {
+                                                       m.setSelection( true );
+                                                       break;
+                                               }
+                                       }
+                                       // ////////
+
+                                       MessageBox messageBox = new MessageBox( shell );
+                                       messageBox.setMessage( "Rotation is not ready." );
+                                       messageBox.open();
+
+                                       return;
+
+                               }
+
+                               short rotationId = ( (Short) item.getData() );
+
+                               arrangeSkin( currentLcdWidth, currentLcdHeight, currentScale, rotationId );
+                               LcdStateData lcdStateData = new LcdStateData( currentScale.value(), rotationId );
+                               communicator.sendToQEMU( SendCommand.CHANGE_LCD_STATE, lcdStateData );
+
+                       }
+               };
+
+               for ( MenuItem menuItem : rotationList ) {
+                       menuItem.addSelectionListener( selectionAdapter );
+               }
+
+               return menu;
+       }
+
+       private Menu createScaleMenu( Shell shell ) {
+
+               Menu menu = new Menu( shell, SWT.DROP_DOWN );
+
+               final List<MenuItem> scaleList = new ArrayList<MenuItem>();
+
+               final MenuItem scaleOneItem = new MenuItem( menu, SWT.RADIO );
+               scaleOneItem.setText( "1x" );
+               scaleOneItem.setData( Scale.ONE );
+               scaleList.add( scaleOneItem );
+
+               final MenuItem scaleThreeQtrItem = new MenuItem( menu, SWT.RADIO );
+               scaleThreeQtrItem.setText( "3/4x" );
+               scaleThreeQtrItem.setData( Scale.THREE_QUARTERS );
+               scaleList.add( scaleThreeQtrItem );
+
+               final MenuItem scalehalfItem = new MenuItem( menu, SWT.RADIO );
+               scalehalfItem.setText( "1/2x" );
+               scalehalfItem.setData( Scale.HALF );
+               scaleList.add( scalehalfItem );
+
+               final MenuItem scaleOneQtrItem = new MenuItem( menu, SWT.RADIO );
+               scaleOneQtrItem.setText( "1/4x" );
+               scaleOneQtrItem.setData( Scale.ONE_QUARTER );
+               scaleList.add( scaleOneQtrItem );
+
+               final short storedScale = config.getPropertyShort( PropertiesConstants.WINDOW_SCALE, Scale.HALF.value() );
+
+               SelectionAdapter selectionAdapter = new SelectionAdapter() {
+
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+
+                               MenuItem item = (MenuItem) e.getSource();
+
+                               boolean selection = item.getSelection();
+
+                               if ( !selection ) {
+                                       return;
+                               }
+
+                               Scale scale = (Scale) item.getData();
+
+                               arrangeSkin( currentLcdWidth, currentLcdHeight, scale, currentRotationId );
+
+                       }
+               };
+
+               for ( MenuItem menuItem : scaleList ) {
+
+                       Scale scale = (Scale) menuItem.getData();
+                       if ( scale.value() == storedScale ) {
+                               menuItem.setSelection( true );
+                       }
+
+                       menuItem.addSelectionListener( selectionAdapter );
+
+               }
+
+               return menu;
+
+       }
+
+       private Menu createAdvancedMenu( final Shell shell ) {
+
+               Menu menu = new Menu( shell, SWT.DROP_DOWN );
+
+               final MenuItem screenshotItem = new MenuItem( menu, SWT.PUSH );
+               screenshotItem.setText( "Screen Shot" );
+
+               screenshotItem.addSelectionListener( new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+
+                               //TODO
+                               MessageBox messageBox = new MessageBox( shell, SWT.OK | SWT.APPLICATION_MODAL );
+                               messageBox.setMessage( "Under construction..." );
+                               messageBox.open();
+                               
+//                             Display display = shell.getDisplay();
+//                             final Image image = new Image( display, lcdCanvas.getBounds() );
+//
+//                             GC gc = null;
+//
+//                             try {
+//                                     gc = new GC( lcdCanvas );
+//                                     gc.copyArea( image, 0, 0 );
+//                             } finally {
+//                                     if ( null != gc ) {
+//                                             gc.dispose();
+//                                     }
+//                             }
+//
+//                             Shell popup = new Shell( shell, SWT.DIALOG_TRIM );
+//                             popup.setLayout( new FillLayout() );
+//                             popup.setText( "Screen Shot" );
+//                             popup.setBounds( 0, 0, lcdCanvas.getSize().x + 50, lcdCanvas.getSize().y + 50 );
+//
+//                             popup.addListener( SWT.Close, new Listener() {
+//                                     @Override
+//                                     public void handleEvent( Event event ) {
+//                                             image.dispose();
+//                                     }
+//                             } );
+//
+//                             ScrolledComposite composite = new ScrolledComposite( popup, SWT.V_SCROLL | SWT.H_SCROLL );
+//
+//                             Canvas canvas = new Canvas( composite, SWT.NONE );
+//                             composite.setContent( canvas );
+//                             canvas.setBounds( popup.getBounds() );
+//
+//                             canvas.addPaintListener( new PaintListener() {
+//                                     public void paintControl( PaintEvent e ) {
+//                                             e.gc.drawImage( image, 0, 0 );
+//                                     }
+//                             } );
+//
+//                             // FileOutputStream fos = null;
+//                             //
+//                             // try {
+//                             //
+//                             // fos = new FileOutputStream( "./screenshot-" + System.currentTimeMillis() + ".png", false );
+//                             //
+//                             // ImageLoader loader = new ImageLoader();
+//                             // loader.data = new ImageData[] { image.getImageData() };
+//                             // loader.save( fos, SWT.IMAGE_PNG );
+//                             //
+//                             // } catch ( IOException ex ) {
+//                             // ex.printStackTrace();
+//                             // } finally {
+//                             // IOUtil.close( fos );
+//                             // }
+//
+//                             popup.open();
+
+                       }
+               } );
+
+               final MenuItem usbKeyboardItem = new MenuItem( menu, SWT.CASCADE );
+               usbKeyboardItem.setText( "USB Keyboard" );
+
+               Menu usbKeyBoardMenu = new Menu( shell, SWT.DROP_DOWN );
+
+               final MenuItem usbOnItem = new MenuItem( usbKeyBoardMenu, SWT.RADIO );
+               usbOnItem.setText( "On" );
+               usbOnItem.setSelection( true );
+               // TODO enable use keyboard
+
+               final MenuItem usbOffItem = new MenuItem( usbKeyBoardMenu, SWT.RADIO );
+               usbOffItem.setText( "Off" );
+
+               SelectionAdapter usbSelectionAdaptor = new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+                               MenuItem item = (MenuItem) e.getSource();
+                               if ( item.getSelection() ) {
+                                       boolean on = item.equals( usbOnItem );
+                                       communicator
+                                                       .sendToQEMU( SendCommand.USB_KBD, new BooleanData( on, SendCommand.USB_KBD.toString() ) );
+                                       
+                                       //TODO
+                                       MessageBox messageBox = new MessageBox( shell, SWT.OK | SWT.APPLICATION_MODAL );
+                                       messageBox.setMessage( "Under construction..." );
+                                       messageBox.open();
+
+                               }
+
+                       }
+               };
+
+               usbOnItem.addSelectionListener( usbSelectionAdaptor );
+               usbOffItem.addSelectionListener( usbSelectionAdaptor );
+
+               usbKeyboardItem.setMenu( usbKeyBoardMenu );
+
+               final MenuItem aboutItem = new MenuItem( menu, SWT.PUSH );
+               aboutItem.setText( "About" );
+               aboutItem.addSelectionListener( new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected( SelectionEvent e ) {
+                               // TODO
+                               MessageBox messageBox = new MessageBox( shell, SWT.OK | SWT.APPLICATION_MODAL );
+                               messageBox.setText( "About" );
+                               messageBox.setMessage( "Under construction..." );
+                               messageBox.open();
+                       }
+               } );
+
+               return menu;
+
+       }
+
+       public void shutdown() {
+
+               isShutdownRequested = true;
+
+               canvasExecutor.shutdownNow();
+
+               if ( !this.shell.isDisposed() && !this.ghostShell.isDisposed() ) {
+                       this.shell.getDisplay().asyncExec( new Runnable() {
+                               @Override
+                               public void run() {
+                                       if ( !shell.isDisposed() ) {
+                                               EmulatorSkin.this.ghostShell.close();
+                                               EmulatorSkin.this.shell.close();
+                                       }
+                               }
+                       } );
+               }
+
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java
new file mode 100644 (file)
index 0000000..b31b1fa
--- /dev/null
@@ -0,0 +1,203 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
+import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
+import org.tizen.emulator.skin.dbi.EmulatorUI;
+import org.tizen.emulator.skin.exception.JaxbException;
+import org.tizen.emulator.skin.image.ImageRegistry;
+import org.tizen.emulator.skin.util.IOUtil;
+import org.tizen.emulator.skin.util.JaxbUtil;
+
+
+
+/**
+ * 
+ *
+ */
+public class EmulatorSkinMain {
+       
+       public static final String PROPERTIES_FILE_NAME = ".skin.properties";
+       public static final String DBI_FILE_NAME = "default.dbi";
+       
+       /**
+        * @param args
+        */
+       public static void main( String[] args ) {
+
+               Map<String, String> argsMap = parsArgs( args );
+
+               int lcdWidth = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_WIDTH ) );
+               int lcdHeight = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_HEIGHT ) );
+               EmulatorUI dbiContents = loadDbi( lcdWidth, lcdHeight );
+               if ( null == dbiContents ) {
+                       System.out.println( "Fail to load dbi file." );
+                       return;
+               }
+
+               String vmPath = (String) argsMap.get( ArgsConstants.VM_PATH );
+               String propFilePath = vmPath + File.separator + PROPERTIES_FILE_NAME;
+               Properties properties = loadProperties( propFilePath );
+               if ( null == properties ) {
+                       System.out.println( "Fail to load properties file." );
+                       return;
+               }
+
+               EmulatorConfig config = new EmulatorConfig( argsMap, dbiContents, properties, propFilePath );
+
+               EmulatorSkin skin = new EmulatorSkin( config );
+               int windowHandleId = skin.compose();
+
+               int pid = Integer.parseInt( config.getArg( ArgsConstants.UID ) );
+               SocketCommunicator communicator = new SocketCommunicator( config, pid, windowHandleId, skin );
+
+               skin.setCommunicator( communicator );
+
+               Socket commSocket = communicator.getSocket();
+
+               if ( null != commSocket ) {
+
+                       Runtime.getRuntime().addShutdownHook( new EmulatorShutdownhook( communicator, skin ) );
+
+                       Thread communicatorThread = new Thread( communicator );
+                       communicatorThread.start();
+
+                       skin.open();
+
+               } else {
+                       System.out.println( "CommSocket is null." );
+               }
+
+       }
+
+       private static Map<String, String> parsArgs( String[] args ) {
+
+               Map<String, String> map = new HashMap<String, String>();
+
+               // TODO parse
+               for ( int i = 0; i < args.length; i++ ) {
+                       String arg = args[i];
+                       System.out.println( "arg[" + i + "] " + arg );
+                       String[] split = arg.split( "=" );
+
+                       if ( 1 < split.length ) {
+
+                               String argKey = split[0];
+                               String argValue = split[1];
+                               System.out.println( "argKey:" + argKey + "  argValue:" + argValue );
+                               map.put( argKey, argValue );
+
+                       } else {
+                               System.out.println( "one argv:" + arg );
+                       }
+               }
+
+               map.put( ArgsConstants.EMULATOR_NAME, "emulator-26100" );
+               
+               System.out.println( "========================================");
+               System.out.println( "args:" + map );
+               System.out.println( "========================================");
+               
+               return map;
+
+       }
+
+       private static EmulatorUI loadDbi( int lcdWidth, int lcdHeight ) {
+
+               String skinPath = ImageRegistry.getSkinPath( lcdWidth, lcdHeight ) + File.separator + DBI_FILE_NAME;
+               
+               FileInputStream fis = null;
+               EmulatorUI emulatorUI = null;
+
+               try {
+
+                       fis = new FileInputStream( skinPath );
+
+                       emulatorUI = JaxbUtil.unmarshal( fis, EmulatorUI.class );
+
+                       // XXX
+                       fis = new FileInputStream( skinPath );
+                       System.out.println( "============ dbi contents ============" );
+                       byte[] bytes = IOUtil.getBytes( fis );
+                       System.out.println( new String( bytes, "UTF-8" ) );
+                       System.out.println( "=======================================" );
+
+               } catch ( IOException e ) {
+                       e.printStackTrace();
+               } catch ( JaxbException e ) {
+                       e.printStackTrace();
+               } finally {
+                       IOUtil.close( fis );
+               }
+
+               return emulatorUI;
+
+       }
+
+       private static Properties loadProperties( String filePath ) {
+
+               FileInputStream fis = null;
+               Properties properties = null;
+
+               try {
+
+                       File file = new File( filePath );
+                       if ( !file.exists() ) {
+                               if ( !file.createNewFile() ) {
+                                       System.out.println( "Fail to create new " + filePath + " property file." );
+                                       return null;
+                               }
+                       }
+
+                       fis = new FileInputStream( filePath );
+                       properties = new Properties();
+                       properties.load( fis );
+
+               } catch ( IOException e ) {
+                       e.printStackTrace();
+               } finally {
+                       IOUtil.close( fis );
+               }
+
+               return properties;
+
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/ICommunicator.java
new file mode 100644 (file)
index 0000000..995e4d3
--- /dev/null
@@ -0,0 +1,223 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm;
+
+import org.tizen.emulator.skin.comm.sock.data.ISendData;
+
+/**
+ * 
+ *
+ */
+public interface ICommunicator extends Runnable {
+
+       public enum Scale {
+               ONE( (short)1, (float)1.0 ),
+               THREE_QUARTERS( (short)2, (float)0.75 ),
+               HALF( (short)3, (float)0.5 ),
+               ONE_QUARTER( (short)4, (float)0.25 );
+               
+               private short value;
+               private float ratio;
+               Scale( short value, float ratio ) {
+                       this.value = value;
+                       this.ratio = ratio;
+               }
+               public short value() {
+                       return this.value;
+               }
+               public float ratio() {
+                       return this.ratio;
+               }
+               public static Scale getValue( String val ) {
+                       Scale[] values = Scale.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == Integer.parseInt( val ) ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( val );
+               }
+               public static Scale getValue( short val ) {
+                       Scale[] values = Scale.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == val ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( Integer.toString(val) );
+               }
+
+       }
+
+       public enum MouseEventType {
+               DOWN( (short)1 ),
+               UP( (short)2 ),
+               DRAG( (short)3 );
+               
+               private short value;
+               MouseEventType( short value ) {
+                       this.value = value;
+               }
+               public short value() {
+                       return this.value;
+               }
+               public static MouseEventType getValue( String val ) {
+                       MouseEventType[] values = MouseEventType.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == Integer.parseInt( val ) ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( val );
+               }
+               public static MouseEventType getValue( short val ) {
+                       MouseEventType[] values = MouseEventType.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == val ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( Integer.toString(val) );
+               }
+
+       }
+
+       public enum KeyEventType {
+               PRESSED( (short)1 ),
+               RELEASED( (short)2 );
+               
+               private short value;
+               KeyEventType( short value ) {
+                       this.value = value;
+               }
+               public short value() {
+                       return this.value;
+               }
+               public static KeyEventType getValue( String val ) {
+                       KeyEventType[] values = KeyEventType.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == Integer.parseInt( val ) ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( val );
+               }
+               public static KeyEventType getValue( short val ) {
+                       KeyEventType[] values = KeyEventType.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == val ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( Integer.toString(val) );
+               }
+
+       }
+
+       public enum SendCommand {
+               
+               SEND_START( (short)1 ),
+               
+               SEND_MOUSE_EVENT( (short)10 ),
+               SEND_KEY_EVENT( (short)11 ),
+               SEND_HARD_KEY_EVENT( (short)12 ),
+               CHANGE_LCD_STATE( (short)13 ),
+               OPEN_SHELL( (short)14 ),
+               USB_KBD( (short)15 ),
+               
+               RESPONSE_HEART_BEAT( (short)900 ),
+               CLOSE( (short)998 ),
+               RESPONSE_SHUTDOWN( (short)999 );
+               
+               private short value;
+               SendCommand( short value ) {
+                       this.value = value;
+               }
+               public short value() {
+                       return this.value;
+               }
+               public static SendCommand getValue( String val ) {
+                       SendCommand[] values = SendCommand.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == Short.parseShort( val ) ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( val );
+               }
+               public static SendCommand getValue( short val ) {
+                       SendCommand[] values = SendCommand.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == val ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( Integer.toString(val) );
+               }
+       }
+
+       public enum ReceiveCommand {
+               
+               HEART_BEAT( (short)1 ),
+               SENSOR_DAEMON_START( (short)800 ),
+               SHUTDOWN( (short)999 );
+               
+               private short value;
+               ReceiveCommand( short value ) {
+                       this.value = value;
+               }
+               public short value() {
+                       return this.value;
+               }
+               public static ReceiveCommand getValue( String val ) {
+                       ReceiveCommand[] values = ReceiveCommand.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == Short.parseShort( val ) ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( val );
+               }
+               public static ReceiveCommand getValue( short val ) {
+                       ReceiveCommand[] values = ReceiveCommand.values();
+                       for (int i = 0; i < values.length; i++) {
+                               if( values[i].value == val ) {
+                                       return values[i];
+                               }
+                       }
+                       throw new IllegalArgumentException( Integer.toString(val) );
+               }
+       }
+
+       public void sendToQEMU( SendCommand command, ISendData data );
+       
+       public void terminate();
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/SocketCommunicator.java
new file mode 100644 (file)
index 0000000..53e7cf6
--- /dev/null
@@ -0,0 +1,273 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.UUID;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.tizen.emulator.skin.EmulatorConstants;
+import org.tizen.emulator.skin.EmulatorSkin;
+import org.tizen.emulator.skin.comm.ICommunicator;
+import org.tizen.emulator.skin.comm.sock.data.ISendData;
+import org.tizen.emulator.skin.comm.sock.data.StartData;
+import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
+import org.tizen.emulator.skin.config.EmulatorConfig.PropertiesConstants;
+import org.tizen.emulator.skin.util.IOUtil;
+
+
+/**
+ * 
+ * 
+ */
+public class SocketCommunicator implements ICommunicator {
+
+       private EmulatorConfig config;
+       private int uId;
+       private int windowHandleId;
+       private EmulatorSkin skin;
+
+       private Socket socket;
+       private DataInputStream dis;
+       private DataOutputStream dos;
+
+       private AtomicInteger heartbeatCount;
+
+       private boolean isTerminated;
+       private ScheduledExecutorService heartbeatExecutor;
+       
+       private boolean isSensorDaemonStarted;
+
+       public SocketCommunicator(EmulatorConfig config, int uId, int windowHandleId, EmulatorSkin skin) {
+
+               this.config = config;
+               this.uId = uId;
+               this.windowHandleId = windowHandleId;
+               this.skin = skin;
+
+               this.heartbeatCount = new AtomicInteger(0);
+               this.heartbeatExecutor = Executors.newSingleThreadScheduledExecutor();
+
+               try {
+
+                       String portString = config.getArg(ArgsConstants.SERVER_PORT);
+                       int port = Integer.parseInt(portString);
+                       socket = new Socket("127.0.0.1", port);
+                       System.out.println("socket.isConnected():" + socket.isConnected());
+
+               } catch (UnknownHostException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+
+       }
+
+       @Override
+       public void run() {
+
+               try {
+
+                       dis = new DataInputStream(socket.getInputStream());
+                       dos = new DataOutputStream(socket.getOutputStream());
+                       
+                       short scale = config.getPropertyShort(PropertiesConstants.WINDOW_SCALE, Scale.HALF.value() );
+                       short rotation = config.getPropertyShort( PropertiesConstants.WINDOW_DIRECTION, (short) 0 );
+                       
+                       sendToQEMU(SendCommand.SEND_START, new StartData(windowHandleId, scale, rotation));
+
+               } catch (IOException e) {
+                       e.printStackTrace();
+                       terminate();
+                       return;
+               }
+               
+               String ignoreHeartbeatString = config.getArg( ArgsConstants.TEST_HEART_BEAT_IGNORE, Boolean.FALSE.toString() );
+               Boolean ignoreHeartbeat = Boolean.parseBoolean( ignoreHeartbeatString );
+               
+               if( ignoreHeartbeat ) {
+                       System.out.println( "Ignore Skin heartbeat." );
+               }else {
+                       
+                       heartbeatExecutor.scheduleAtFixedRate(new Runnable() {
+                               
+                               @Override
+                               public void run() {
+                                       
+                                       increaseHeartbeatCount();
+                                       
+                                       if (isHeartbeatExpired()) {
+                                               terminate();
+                                       }
+                                       
+                               }
+                               
+                       }, 0, EmulatorConstants.HEART_BEAT_INTERVAL, TimeUnit.SECONDS);
+                       
+               }
+
+               while ( true ) {
+
+                       if ( isTerminated ) {
+                               break;
+                       }
+
+                       try {
+
+                               int reqId = dis.readInt();
+                               short cmd = dis.readShort();
+
+                               System.out.print( "= Socket read - reqId:" + reqId + ", command:" + cmd + ", " );
+
+                               ReceiveCommand command = null;
+                               
+                               try {
+                                       command = ReceiveCommand.getValue( cmd );
+                               } catch ( IllegalArgumentException e ) {
+                                       System.out.println( "unknown command:" + cmd );
+                                       continue;
+                               }
+
+                               switch ( command ) {
+                               case HEART_BEAT:
+                                       resetHeartbeatCount();
+                                       System.out.println( "received HEAR_BEAT from QEMU." );
+                                       sendToQEMU( SendCommand.RESPONSE_HEART_BEAT, null );
+                                       break;
+                               case SENSOR_DAEMON_START:
+                                       System.out.println( "received SENSOR_DAEMON_START from QEMU." );
+                                       synchronized ( this ) {
+                                               isSensorDaemonStarted = true;
+                                       }
+                                       break;
+                               case SHUTDOWN:
+                                       sendToQEMU( SendCommand.RESPONSE_SHUTDOWN, null );
+                                       isTerminated = true;
+                                       terminate();
+                                       break;
+                               default:
+                                       break;
+                               }
+
+                       } catch ( IOException e ) {
+                               e.printStackTrace();
+                               break;
+                       }
+
+               }
+               
+       }
+
+       @Override
+       public void sendToQEMU(SendCommand command, ISendData data) {
+
+               try {
+
+                       //anyway down casting
+                       int reqId = (int) UUID.randomUUID().getMostSignificantBits();
+                       
+                       ByteArrayOutputStream bao = new ByteArrayOutputStream();
+                       DataOutputStream dataOutputStream = new DataOutputStream(bao);
+                       
+                       dataOutputStream.writeInt(uId);
+                       dataOutputStream.writeInt(reqId);
+                       dataOutputStream.writeShort(command.value());
+                       
+                       short length = 0;
+                       if( null == data ) {
+                               length = 0;
+                               dataOutputStream.writeShort(length);
+                       }else {
+                               byte[] byteData = data.serialize();
+                               length = (short) byteData.length;
+                               dataOutputStream.writeShort(length);
+                               dataOutputStream.write(byteData);
+                       }
+
+                       dataOutputStream.flush();
+                       
+                       dos.write(bao.toByteArray());
+                       dos.flush();
+
+                       System.out.println("= Socket write - uid:" + uId + ", reqId:" + reqId +
+                                       ", command:" + command.value() + " - " + command.toString() + ", length:" + length );
+
+                       if (0 < length) {
+                               System.out.println("== data ==");
+                               System.out.println(data);
+                       }
+
+               } catch (IOException e) {
+                       System.err.println("Fail to write socket.");
+                       e.printStackTrace();
+               }
+
+       }
+
+       public Socket getSocket() {
+               return socket;
+       }
+
+       public synchronized boolean isSensorDaemonStarted() {
+               return isSensorDaemonStarted;
+       }
+
+       private void increaseHeartbeatCount() {
+               int count = heartbeatCount.incrementAndGet();
+               System.out.println("HB count : " + count);
+       }
+
+       private boolean isHeartbeatExpired() {
+               return EmulatorConstants.HEART_BEAT_EXPIRE < heartbeatCount.get();
+       }
+
+       private void resetHeartbeatCount() {
+               heartbeatCount.set(0);
+       }
+
+       @Override
+       public void terminate() {
+               if (null != heartbeatExecutor) {
+                       heartbeatExecutor.shutdownNow();
+               }
+               IOUtil.closeSocket(socket);
+               skin.shutdown();
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/AbstractSendData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/AbstractSendData.java
new file mode 100644 (file)
index 0000000..dfe4b28
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock.data;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * 
+ *
+ */
+public abstract class AbstractSendData implements ISendData {
+       
+       private DataOutputStream dos;
+       private ByteArrayOutputStream bao;
+       
+       public AbstractSendData() {
+               bao = new ByteArrayOutputStream();
+               dos = new DataOutputStream( bao );
+       }
+       
+       protected abstract void write() throws IOException ;
+       
+       @Override
+       public byte[] serialize() throws IOException {
+               write();
+               return bao.toByteArray();
+       }
+
+       protected void writeShort ( int val ) throws IOException {
+               dos.writeShort( val );
+       }
+
+       protected void writeInt ( int val ) throws IOException {
+               dos.writeInt( val );
+       }
+
+       protected void writeLong ( int val ) throws IOException {
+               dos.writeLong( val );
+       }
+
+       protected void writeBoolean ( boolean val ) throws IOException {
+               dos.writeBoolean( val );
+       }
+
+       protected void writeChar ( char val ) throws IOException {
+               dos.writeChar( val );
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/BooleanData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/BooleanData.java
new file mode 100644 (file)
index 0000000..f5dcef4
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock.data;
+
+import java.io.IOException;
+
+/**
+ * 
+ *
+ */
+public class BooleanData extends AbstractSendData {
+
+       private boolean booleanValue;
+       private String dataName;
+       
+       public BooleanData( boolean booleanValue ) {
+               this.booleanValue = booleanValue;
+       }
+
+       public BooleanData( boolean booleanValue, String dataName) {
+               this.booleanValue = booleanValue;
+               this.dataName = dataName;
+       }
+       
+       /* (non-Javadoc)
+        * @see org.tizen.emulator.skin.comm.sock.data.AbstractSendData#write()
+        */
+       @Override
+       protected void write() throws IOException {
+               writeBoolean( booleanValue );
+       }
+
+       @Override
+       public String toString() {
+               StringBuilder builder = new StringBuilder();
+               builder.append( "BooleanData [booleanValue=" );
+               builder.append( booleanValue );
+               builder.append( ", dataName=" );
+               builder.append( dataName );
+               builder.append( "]" );
+               return builder.toString();
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/ISendData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/ISendData.java
new file mode 100644 (file)
index 0000000..859d96e
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock.data;
+
+import java.io.IOException;
+
+/**
+ * 
+ *
+ */
+public interface ISendData {
+       
+       public byte[] serialize() throws IOException;
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/KeyEventData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/KeyEventData.java
new file mode 100644 (file)
index 0000000..fda5a86
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock.data;
+
+import java.io.IOException;
+
+/**
+ * 
+ *
+ */
+public class KeyEventData extends AbstractSendData {
+
+       int eventType;
+       int keycode;
+
+       public KeyEventData(int eventType, int keycode) {
+               this.eventType = eventType;
+               this.keycode = keycode;
+       }
+       
+       @Override
+       protected void write() throws IOException {
+               writeInt(eventType);
+               writeInt(keycode);
+       }
+       
+       @Override
+       public String toString() {
+               StringBuilder builder = new StringBuilder();
+               builder.append("KeyEventData [eventType=");
+               builder.append(eventType);
+               builder.append(", keycode=");
+               builder.append(keycode);
+               builder.append("]");
+               return builder.toString();
+       }
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/LcdStateData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/LcdStateData.java
new file mode 100644 (file)
index 0000000..d88cdca
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock.data;
+
+import java.io.IOException;
+
+/**
+ * 
+ *
+ */
+public class LcdStateData extends AbstractSendData {
+       
+       short scale;
+       short rotation;
+       
+       public LcdStateData(short scale, short rotation) {
+               this.scale = scale;
+               this.rotation = rotation;
+       }
+
+       @Override
+       protected void write() throws IOException {
+               writeShort(scale);
+               writeShort(rotation);
+       }
+
+       @Override
+       public String toString() {
+               StringBuilder builder = new StringBuilder();
+               builder.append("LcdStateData [scale=");
+               builder.append(scale);
+               builder.append(", rotation=");
+               builder.append(rotation);
+               builder.append("]");
+               return builder.toString();
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/MouseEventData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/MouseEventData.java
new file mode 100644 (file)
index 0000000..b5a8fa0
--- /dev/null
@@ -0,0 +1,75 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock.data;
+
+import java.io.IOException;
+
+/**
+ * 
+ *
+ */
+public class MouseEventData extends AbstractSendData {
+
+       int eventType;
+       int x;
+       int y;
+       int z;
+
+       public MouseEventData(int eventType, int x, int y, int z) {
+               this.eventType = eventType;
+               this.x = x;
+               this.y = y;
+               this.z = z;
+       }
+
+       @Override
+       protected void write() throws IOException {
+               writeInt(eventType);
+               writeInt(x);
+               writeInt(y);
+               writeInt(z);
+       }
+
+       @Override
+       public String toString() {
+               StringBuilder builder = new StringBuilder();
+               builder.append("MouseEventData [eventType=");
+               builder.append(eventType);
+               builder.append(", x=");
+               builder.append(x);
+               builder.append(", y=");
+               builder.append(y);
+               builder.append(", z=");
+               builder.append(z);
+               builder.append("]");
+               return builder.toString();
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/StartData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/StartData.java
new file mode 100644 (file)
index 0000000..b990a40
--- /dev/null
@@ -0,0 +1,70 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.comm.sock.data;
+
+import java.io.IOException;
+
+/**
+ * 
+ *
+ */
+public class StartData extends AbstractSendData {
+
+       private int windowHandleId;
+       private short scale;
+       private short rotation;
+       
+       public StartData(int windowHandleId, short scale, short rotation ) {
+               this.windowHandleId = windowHandleId;
+               this.scale = scale;
+               this.rotation = rotation;
+       }
+
+       @Override
+       protected void write() throws IOException {
+               writeInt( windowHandleId );
+               writeShort( scale );
+               writeShort( rotation );
+       }
+
+       @Override
+       public String toString() {
+               StringBuilder builder = new StringBuilder();
+               builder.append("StartData [windowHandleId=");
+               builder.append(windowHandleId);
+               builder.append(", scale=");
+               builder.append(scale);
+               builder.append(", rotation=");
+               builder.append(rotation);
+               builder.append("]");
+               return builder.toString();
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java
new file mode 100644 (file)
index 0000000..4e904f8
--- /dev/null
@@ -0,0 +1,156 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.config;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+
+import org.tizen.emulator.skin.dbi.EmulatorUI;
+import org.tizen.emulator.skin.util.IOUtil;
+import org.tizen.emulator.skin.util.StringUtil;
+
+
+/**
+ * 
+ *
+ */
+public class EmulatorConfig {
+       
+       public interface ArgsConstants {
+               //TODO change as input args
+               public static final String UID = "uid";
+               public static final String SERVER_PORT = "svr.port";
+               public static final String RESOLUTION_WIDTH = "width";
+               public static final String RESOLUTION_HEIGHT = "height";
+               public static final String EMULATOR_NAME = "emulname";
+               public static final String TEST_HEART_BEAT_IGNORE = "test.hb.ignore";
+               public static final String VM_PATH = "vm.path";
+       }
+       
+       public interface PropertiesConstants {
+               public static final String WINDOW_X = "window.x";
+               public static final String WINDOW_Y = "window.y";
+               public static final String WINDOW_DIRECTION = "window.rotate";
+               public static final String WINDOW_SCALE = "window.scale";
+       }
+       
+       private Map<String,String> args;
+       private EmulatorUI dbiContents;
+       private Properties properties;
+       private String propertiesFilePath;
+       
+       public EmulatorConfig( Map<String,String> args, EmulatorUI dbiContents, Properties properties, String propertiesFilePath ) {
+               this.args = args;
+               this.dbiContents = dbiContents;
+               this.properties = properties;
+               this.propertiesFilePath = propertiesFilePath;
+       }
+       
+       public void saveProperties() {
+               
+               FileOutputStream fos = null;
+               
+               try {
+                       
+                       fos = new FileOutputStream( propertiesFilePath );
+                       properties.store( fos, "Generated automatically by emulator." );
+                       
+               } catch ( IOException e ) {
+                       e.printStackTrace();
+               } finally {
+                       IOUtil.close( fos );
+               }
+               
+       }
+
+       public EmulatorUI getDbiContents() {
+               return dbiContents;
+       }
+
+       public String getArg( String argKey ) {
+               return args.get(argKey);
+       }
+
+       public String getArg( String argKey, String defaultValue ) {
+               String arg = args.get( argKey );
+               if ( StringUtil.isEmpty( arg ) ) {
+                       return defaultValue;
+               } else {
+                       return arg;
+               }
+       }
+
+       public String getProperty( String key ) {
+               return properties.getProperty( key );
+       }
+
+       public String getProperty( String key, String defaultValue ) {
+               String property = properties.getProperty( key );
+               if( StringUtil.isEmpty( property ) ) {
+                       return defaultValue;
+               }
+               return property;
+       }
+
+       public int getPropertyInt( String key ) {
+               return Integer.parseInt( properties.getProperty( key ) );
+       }
+
+       public int getPropertyInt( String key, int defaultValue ) {
+               String property = properties.getProperty( key );
+               if( StringUtil.isEmpty( property ) ) {
+                       return defaultValue;
+               }
+               return Integer.parseInt( property );
+       }
+
+       public short getPropertyShort( String key ) {
+               return Short.parseShort( properties.getProperty( key ) );
+       }
+
+       public short getPropertyShort( String key, short defaultValue ) {
+               String property = properties.getProperty( key );
+               if( StringUtil.isEmpty( property ) ) {
+                       return defaultValue;
+               }
+               return Short.parseShort( property );
+       }
+
+       public void setProperty( String key, String value ) {
+               properties.put( key, value );
+       }
+       
+       public void setProperty( String key, int value ) {
+               properties.put( key, Integer.toString( value ) );
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ColorsType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ColorsType.java
new file mode 100644 (file)
index 0000000..1d99ad3
--- /dev/null
@@ -0,0 +1,67 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for colorsType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="colorsType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;all>
+ *         &lt;element name="hoverColor" type="{http://www.tizen.org/dbi}rgbType" minOccurs="0"/>
+ *       &lt;/all>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "colorsType", propOrder = {
+
+})
+public class ColorsType {
+
+    protected RgbType hoverColor;
+
+    /**
+     * Gets the value of the hoverColor property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link RgbType }
+     *     
+     */
+    public RgbType getHoverColor() {
+        return hoverColor;
+    }
+
+    /**
+     * Sets the value of the hoverColor property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link RgbType }
+     *     
+     */
+    public void setHoverColor(RgbType value) {
+        this.hoverColor = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/EmulatorUI.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/EmulatorUI.java
new file mode 100644 (file)
index 0000000..eb05e2f
--- /dev/null
@@ -0,0 +1,97 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;all>
+ *         &lt;element name="rotations" type="{http://www.tizen.org/dbi}rotationsType"/>
+ *         &lt;element name="colors" type="{http://www.tizen.org/dbi}colorsType" minOccurs="0"/>
+ *       &lt;/all>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+
+})
+@XmlRootElement(name = "EmulatorUI")
+public class EmulatorUI {
+
+    @XmlElement(required = true)
+    protected RotationsType rotations;
+    protected ColorsType colors;
+
+    /**
+     * Gets the value of the rotations property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link RotationsType }
+     *     
+     */
+    public RotationsType getRotations() {
+        return rotations;
+    }
+
+    /**
+     * Sets the value of the rotations property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link RotationsType }
+     *     
+     */
+    public void setRotations(RotationsType value) {
+        this.rotations = value;
+    }
+
+    /**
+     * Gets the value of the colors property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link ColorsType }
+     *     
+     */
+    public ColorsType getColors() {
+        return colors;
+    }
+
+    /**
+     * Sets the value of the colors property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link ColorsType }
+     *     
+     */
+    public void setColors(ColorsType value) {
+        this.colors = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/EventInfoType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/EventInfoType.java
new file mode 100644 (file)
index 0000000..0d59f1a
--- /dev/null
@@ -0,0 +1,87 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for eventInfoType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="eventInfoType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;all>
+ *         &lt;element name="keyCode" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         &lt;element name="keyName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/all>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "eventInfoType", propOrder = {
+
+})
+public class EventInfoType {
+
+    protected int keyCode;
+    @XmlElement(required = true)
+    protected String keyName;
+
+    /**
+     * Gets the value of the keyCode property.
+     * 
+     */
+    public int getKeyCode() {
+        return keyCode;
+    }
+
+    /**
+     * Sets the value of the keyCode property.
+     * 
+     */
+    public void setKeyCode(int value) {
+        this.keyCode = value;
+    }
+
+    /**
+     * Gets the value of the keyName property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getKeyName() {
+        return keyName;
+    }
+
+    /**
+     * Sets the value of the keyName property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setKeyName(String value) {
+        this.keyName = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ImageListType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ImageListType.java
new file mode 100644 (file)
index 0000000..abb0919
--- /dev/null
@@ -0,0 +1,95 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for imageListType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="imageListType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;all>
+ *         &lt;element name="mainImage" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         &lt;element name="keyPressedImage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       &lt;/all>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "imageListType", propOrder = {
+
+})
+public class ImageListType {
+
+    @XmlElement(required = true)
+    protected String mainImage;
+    protected String keyPressedImage;
+
+    /**
+     * Gets the value of the mainImage property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getMainImage() {
+        return mainImage;
+    }
+
+    /**
+     * Sets the value of the mainImage property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setMainImage(String value) {
+        this.mainImage = value;
+    }
+
+    /**
+     * Gets the value of the keyPressedImage property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getKeyPressedImage() {
+        return keyPressedImage;
+    }
+
+    /**
+     * Sets the value of the keyPressedImage property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setKeyPressedImage(String value) {
+        this.keyPressedImage = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/KeyMapListType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/KeyMapListType.java
new file mode 100644 (file)
index 0000000..46f6e67
--- /dev/null
@@ -0,0 +1,74 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for keyMapListType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="keyMapListType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="keyMap" type="{http://www.tizen.org/dbi}keyMapType" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "keyMapListType", propOrder = {
+    "keyMap"
+})
+public class KeyMapListType {
+
+    protected List<KeyMapType> keyMap;
+
+    /**
+     * Gets the value of the keyMap property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the keyMap property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getKeyMap().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link KeyMapType }
+     * 
+     * 
+     */
+    public List<KeyMapType> getKeyMap() {
+        if (keyMap == null) {
+            keyMap = new ArrayList<KeyMapType>();
+        }
+        return this.keyMap;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/KeyMapType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/KeyMapType.java
new file mode 100644 (file)
index 0000000..78eb2ba
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for keyMapType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="keyMapType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="region" type="{http://www.tizen.org/dbi}regionType"/>
+ *         &lt;element name="eventInfo" type="{http://www.tizen.org/dbi}eventInfoType" minOccurs="0"/>
+ *         &lt;element name="tooltip" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "keyMapType", propOrder = {
+    "region",
+    "eventInfo",
+    "tooltip"
+})
+public class KeyMapType {
+
+    @XmlElement(required = true)
+    protected RegionType region;
+    protected EventInfoType eventInfo;
+    protected String tooltip;
+
+    /**
+     * Gets the value of the region property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link RegionType }
+     *     
+     */
+    public RegionType getRegion() {
+        return region;
+    }
+
+    /**
+     * Sets the value of the region property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link RegionType }
+     *     
+     */
+    public void setRegion(RegionType value) {
+        this.region = value;
+    }
+
+    /**
+     * Gets the value of the eventInfo property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link EventInfoType }
+     *     
+     */
+    public EventInfoType getEventInfo() {
+        return eventInfo;
+    }
+
+    /**
+     * Sets the value of the eventInfo property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link EventInfoType }
+     *     
+     */
+    public void setEventInfo(EventInfoType value) {
+        this.eventInfo = value;
+    }
+
+    /**
+     * Gets the value of the tooltip property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTooltip() {
+        return tooltip;
+    }
+
+    /**
+     * Sets the value of the tooltip property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTooltip(String value) {
+        this.tooltip = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/LcdType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/LcdType.java
new file mode 100644 (file)
index 0000000..45183d6
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for lcdType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="lcdType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;all>
+ *         &lt;element name="region" type="{http://www.tizen.org/dbi}regionType"/>
+ *       &lt;/all>
+ *       &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "lcdType", propOrder = {
+
+})
+public class LcdType {
+
+    @XmlElement(required = true)
+    protected RegionType region;
+    @XmlAttribute(required = true)
+    protected int id;
+
+    /**
+     * Gets the value of the region property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link RegionType }
+     *     
+     */
+    public RegionType getRegion() {
+        return region;
+    }
+
+    /**
+     * Sets the value of the region property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link RegionType }
+     *     
+     */
+    public void setRegion(RegionType value) {
+        this.region = value;
+    }
+
+    /**
+     * Gets the value of the id property.
+     * 
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     */
+    public void setId(int value) {
+        this.id = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ObjectFactory.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/ObjectFactory.java
new file mode 100644 (file)
index 0000000..05ef9b3
--- /dev/null
@@ -0,0 +1,127 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each 
+ * Java content interface and Java element interface 
+ * generated in the org.tizen.emulator.skin.dbi package. 
+ * <p>An ObjectFactory allows you to programatically 
+ * construct new instances of the Java representation 
+ * for XML content. The Java representation of XML 
+ * content can consist of schema derived interfaces 
+ * and classes representing the binding of schema 
+ * type definitions, element declarations and model 
+ * groups.  Factory methods for each of these are 
+ * provided in this class.
+ * 
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.tizen.emulator.skin.dbi
+     * 
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link ImageListType }
+     * 
+     */
+    public ImageListType createImageListType() {
+        return new ImageListType();
+    }
+
+    /**
+     * Create an instance of {@link RotationType }
+     * 
+     */
+    public RotationType createRotationType() {
+        return new RotationType();
+    }
+
+    /**
+     * Create an instance of {@link LcdType }
+     * 
+     */
+    public LcdType createLcdType() {
+        return new LcdType();
+    }
+
+    /**
+     * Create an instance of {@link KeyMapType }
+     * 
+     */
+    public KeyMapType createKeyMapType() {
+        return new KeyMapType();
+    }
+
+    /**
+     * Create an instance of {@link EmulatorUI }
+     * 
+     */
+    public EmulatorUI createEmulatorUI() {
+        return new EmulatorUI();
+    }
+
+    /**
+     * Create an instance of {@link RotationsType }
+     * 
+     */
+    public RotationsType createRotationsType() {
+        return new RotationsType();
+    }
+
+    /**
+     * Create an instance of {@link ColorsType }
+     * 
+     */
+    public ColorsType createColorsType() {
+        return new ColorsType();
+    }
+
+    /**
+     * Create an instance of {@link EventInfoType }
+     * 
+     */
+    public EventInfoType createEventInfoType() {
+        return new EventInfoType();
+    }
+
+    /**
+     * Create an instance of {@link RegionType }
+     * 
+     */
+    public RegionType createRegionType() {
+        return new RegionType();
+    }
+
+    /**
+     * Create an instance of {@link KeyMapListType }
+     * 
+     */
+    public KeyMapListType createKeyMapListType() {
+        return new KeyMapListType();
+    }
+
+    /**
+     * Create an instance of {@link RgbType }
+     * 
+     */
+    public RgbType createRgbType() {
+        return new RgbType();
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RegionType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RegionType.java
new file mode 100644 (file)
index 0000000..0d9178b
--- /dev/null
@@ -0,0 +1,146 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for regionType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="regionType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;attribute name="left" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       &lt;attribute name="top" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       &lt;attribute name="width" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       &lt;attribute name="height" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "regionType")
+public class RegionType {
+
+    @XmlAttribute
+    protected Integer left;
+    @XmlAttribute
+    protected Integer top;
+    @XmlAttribute
+    protected Integer width;
+    @XmlAttribute
+    protected Integer height;
+
+    /**
+     * Gets the value of the left property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Integer }
+     *     
+     */
+    public Integer getLeft() {
+        return left;
+    }
+
+    /**
+     * Sets the value of the left property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Integer }
+     *     
+     */
+    public void setLeft(Integer value) {
+        this.left = value;
+    }
+
+    /**
+     * Gets the value of the top property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Integer }
+     *     
+     */
+    public Integer getTop() {
+        return top;
+    }
+
+    /**
+     * Sets the value of the top property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Integer }
+     *     
+     */
+    public void setTop(Integer value) {
+        this.top = value;
+    }
+
+    /**
+     * Gets the value of the width property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Integer }
+     *     
+     */
+    public Integer getWidth() {
+        return width;
+    }
+
+    /**
+     * Sets the value of the width property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Integer }
+     *     
+     */
+    public void setWidth(Integer value) {
+        this.width = value;
+    }
+
+    /**
+     * Gets the value of the height property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Integer }
+     *     
+     */
+    public Integer getHeight() {
+        return height;
+    }
+
+    /**
+     * Sets the value of the height property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Integer }
+     *     
+     */
+    public void setHeight(Integer value) {
+        this.height = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RgbType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RgbType.java
new file mode 100644 (file)
index 0000000..4796eed
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for rgbType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="rgbType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;attribute name="R" type="{http://www.w3.org/2001/XMLSchema}unsignedInt" />
+ *       &lt;attribute name="G" type="{http://www.w3.org/2001/XMLSchema}unsignedInt" />
+ *       &lt;attribute name="B" type="{http://www.w3.org/2001/XMLSchema}unsignedInt" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "rgbType")
+public class RgbType {
+
+    @XmlAttribute(name = "R")
+    @XmlSchemaType(name = "unsignedInt")
+    protected Long r;
+    @XmlAttribute(name = "G")
+    @XmlSchemaType(name = "unsignedInt")
+    protected Long g;
+    @XmlAttribute(name = "B")
+    @XmlSchemaType(name = "unsignedInt")
+    protected Long b;
+
+    /**
+     * Gets the value of the r property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Long }
+     *     
+     */
+    public Long getR() {
+        return r;
+    }
+
+    /**
+     * Sets the value of the r property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Long }
+     *     
+     */
+    public void setR(Long value) {
+        this.r = value;
+    }
+
+    /**
+     * Gets the value of the g property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Long }
+     *     
+     */
+    public Long getG() {
+        return g;
+    }
+
+    /**
+     * Sets the value of the g property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Long }
+     *     
+     */
+    public void setG(Long value) {
+        this.g = value;
+    }
+
+    /**
+     * Gets the value of the b property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Long }
+     *     
+     */
+    public Long getB() {
+        return b;
+    }
+
+    /**
+     * Sets the value of the b property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Long }
+     *     
+     */
+    public void setB(Long value) {
+        this.b = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationNameType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationNameType.java
new file mode 100644 (file)
index 0000000..2c6b183
--- /dev/null
@@ -0,0 +1,64 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for rotationNameType.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="rotationNameType">
+ *   &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     &lt;enumeration value="Portrait"/>
+ *     &lt;enumeration value="Landscape"/>
+ *     &lt;enumeration value="Reverse Portrait"/>
+ *     &lt;enumeration value="Reverse Landscape"/>
+ *   &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ * 
+ */
+@XmlType(name = "rotationNameType")
+@XmlEnum
+public enum RotationNameType {
+
+    @XmlEnumValue("Portrait")
+    PORTRAIT("Portrait"),
+    @XmlEnumValue("Landscape")
+    LANDSCAPE("Landscape"),
+    @XmlEnumValue("Reverse Portrait")
+    REVERSE_PORTRAIT("Reverse Portrait"),
+    @XmlEnumValue("Reverse Landscape")
+    REVERSE_LANDSCAPE("Reverse Landscape");
+    private final String value;
+
+    RotationNameType(String v) {
+        value = v;
+    }
+
+    public String value() {
+        return value;
+    }
+
+    public static RotationNameType fromValue(String v) {
+        for (RotationNameType c: RotationNameType.values()) {
+            if (c.value.equals(v)) {
+                return c;
+            }
+        }
+        throw new IllegalArgumentException(v);
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationType.java
new file mode 100644 (file)
index 0000000..3df6f78
--- /dev/null
@@ -0,0 +1,172 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for rotationType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="rotationType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="lcd" type="{http://www.tizen.org/dbi}lcdType"/>
+ *         &lt;element name="imageList" type="{http://www.tizen.org/dbi}imageListType"/>
+ *         &lt;element name="keyMapList" type="{http://www.tizen.org/dbi}keyMapListType"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
+ *       &lt;attribute name="name" use="required" type="{http://www.tizen.org/dbi}rotationNameType" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "rotationType", propOrder = {
+    "lcd",
+    "imageList",
+    "keyMapList"
+})
+public class RotationType {
+
+    @XmlElement(required = true)
+    protected LcdType lcd;
+    @XmlElement(required = true)
+    protected ImageListType imageList;
+    @XmlElement(required = true)
+    protected KeyMapListType keyMapList;
+    @XmlAttribute(required = true)
+    protected int id;
+    @XmlAttribute(required = true)
+    protected RotationNameType name;
+
+    /**
+     * Gets the value of the lcd property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link LcdType }
+     *     
+     */
+    public LcdType getLcd() {
+        return lcd;
+    }
+
+    /**
+     * Sets the value of the lcd property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link LcdType }
+     *     
+     */
+    public void setLcd(LcdType value) {
+        this.lcd = value;
+    }
+
+    /**
+     * Gets the value of the imageList property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link ImageListType }
+     *     
+     */
+    public ImageListType getImageList() {
+        return imageList;
+    }
+
+    /**
+     * Sets the value of the imageList property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link ImageListType }
+     *     
+     */
+    public void setImageList(ImageListType value) {
+        this.imageList = value;
+    }
+
+    /**
+     * Gets the value of the keyMapList property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link KeyMapListType }
+     *     
+     */
+    public KeyMapListType getKeyMapList() {
+        return keyMapList;
+    }
+
+    /**
+     * Sets the value of the keyMapList property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link KeyMapListType }
+     *     
+     */
+    public void setKeyMapList(KeyMapListType value) {
+        this.keyMapList = value;
+    }
+
+    /**
+     * Gets the value of the id property.
+     * 
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * Sets the value of the id property.
+     * 
+     */
+    public void setId(int value) {
+        this.id = value;
+    }
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link RotationNameType }
+     *     
+     */
+    public RotationNameType getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link RotationNameType }
+     *     
+     */
+    public void setName(RotationNameType value) {
+        this.name = value;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationsType.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/RotationsType.java
new file mode 100644 (file)
index 0000000..636693d
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+
+package org.tizen.emulator.skin.dbi;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for rotationsType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="rotationsType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="rotation" type="{http://www.tizen.org/dbi}rotationType" maxOccurs="unbounded"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "rotationsType", propOrder = {
+    "rotation"
+})
+public class RotationsType {
+
+    @XmlElement(required = true)
+    protected List<RotationType> rotation;
+
+    /**
+     * Gets the value of the rotation property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the rotation property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getRotation().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link RotationType }
+     * 
+     * 
+     */
+    public List<RotationType> getRotation() {
+        if (rotation == null) {
+            rotation = new ArrayList<RotationType>();
+        }
+        return this.rotation;
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/package-info.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/dbi/package-info.java
new file mode 100644 (file)
index 0000000..68bab07
--- /dev/null
@@ -0,0 +1,9 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.03.13 at 01:56:12 ì˜¤í›„ KST 
+//
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.tizen.org/dbi", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.tizen.emulator.skin.dbi;
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/exception/EmulatorException.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/exception/EmulatorException.java
new file mode 100644 (file)
index 0000000..7444f1d
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.exception;
+
+/**
+ * 
+ *
+ */
+public class EmulatorException extends Exception {
+
+       private static final long serialVersionUID = 7942446691090874775L;
+
+       public EmulatorException() {
+               super();
+       }
+
+       public EmulatorException( Throwable cause ) {
+               super( cause );
+       }
+
+    public EmulatorException( String message ) {
+        super( message );
+    }
+
+    public EmulatorException( String message, Throwable cause ) {
+        super( message, cause );
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/exception/JaxbException.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/exception/JaxbException.java
new file mode 100644 (file)
index 0000000..3a576f2
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.exception;
+
+/**
+ * 
+ *
+ */
+public class JaxbException extends EmulatorException {
+
+       private static final long serialVersionUID = -8268951410660907299L;
+
+       public JaxbException() {
+               super();
+       }
+
+       public JaxbException( Throwable cause ) {
+               super( cause );
+       }
+
+    public JaxbException( String message ) {
+        super( message );
+    }
+
+    public JaxbException( String message, Throwable cause ) {
+        super( message, cause );
+    }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java
new file mode 100644 (file)
index 0000000..fb6545f
--- /dev/null
@@ -0,0 +1,168 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.Map.Entry;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.config.EmulatorConfig.ArgsConstants;
+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.util.SkinRotation;
+
+
+/**
+ * 
+ *
+ */
+public class ImageRegistry {
+
+       public static final String SKIN_FOLDER = "skins";
+       public static final String IMAGE_FOLDER_PREFIX = "emul_";
+       public static final String ICON_FOLDER = "icons";
+       
+       public enum ImageType {
+               IMG_TYPE_MAIN,
+               IMG_TYPE_PRESSED
+       }
+       
+       public enum IconName {
+               
+       }
+       
+       private Display display;
+       private int resolutionWidth;
+       private int resolutionHeight;
+       private EmulatorUI dbiContents;
+       
+       private Map<String, Image> imageMap;
+       
+       public ImageRegistry(Display display, EmulatorConfig config ) {
+               
+               this.display = display;
+               
+               int lcdWidth = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_WIDTH ) );
+               int lcdHeight = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_HEIGHT ) );
+
+               this.resolutionWidth = lcdWidth;
+               this.resolutionHeight = lcdHeight;
+               this.dbiContents = config.getDbiContents();
+               this.imageMap = new HashMap<String, Image>();
+               
+               init();
+               
+       }
+       
+       public static String getSkinPath( int lcdWidth, int lcdHeight ) {
+               String skinPath = ".." + File.separator + SKIN_FOLDER + File.separator + IMAGE_FOLDER_PREFIX + lcdWidth + "x" + lcdHeight;
+               return skinPath;
+       }
+       
+       private void init() {
+
+               String skinPath = getSkinPath( resolutionWidth, resolutionHeight );
+               
+               RotationsType rotations = dbiContents.getRotations();
+               List<RotationType> rotationList = rotations.getRotation();
+
+               for ( RotationType rotation : rotationList ) {
+                       SkinRotation.put( rotation );
+               }
+
+               for ( RotationType rotation : rotationList ) {
+
+                       ImageListType imageList = rotation.getImageList();
+                       String mainImage = imageList.getMainImage();
+                       String keyPressedImage = imageList.getKeyPressedImage();
+
+                       Iterator<Entry<Short, RotationType>> rotationIterator = SkinRotation.getRotationIterator();
+
+                       while ( rotationIterator.hasNext() ) {
+
+                               Entry<Short, RotationType> entry = rotationIterator.next();
+
+                               if ( entry.getValue().getName().value().equals( rotation.getName().value() ) ) {
+
+                                       String mainKey = makeKey( entry.getKey(), ImageType.IMG_TYPE_MAIN );
+                                       imageMap.put( mainKey, new Image( display, skinPath + File.separator + mainImage ) );
+
+                                       String pressedKey = makeKey( entry.getKey(), ImageType.IMG_TYPE_PRESSED );
+                                       imageMap.put( pressedKey, new Image( display, skinPath + File.separator + keyPressedImage ) );
+
+                               }
+                       }
+
+               }
+
+       }
+       
+//     public Image getImage( Short id, ImageType imageType ) {
+//             Image image = imageMap.get( makeKey(id, imageType) );
+//             return image;
+//     }
+       
+       public ImageData getImageData( Short id, ImageType imageType ) {
+               Image image = imageMap.get( makeKey(id, imageType) );
+               if( null != image ) {
+                       return image.getImageData();
+               }else {
+                       return null;
+               }
+       }
+       
+       private String makeKey( Short id, ImageType imageType ) {
+               return id + ":" + imageType.ordinal();
+       }
+       
+       public void dispose() {
+               
+               Collection<Image> images = imageMap.values();
+               
+               Iterator<Image> iterator = images.iterator();
+               
+               while(iterator.hasNext()) {
+                       Image image = iterator.next();
+                       image.dispose();
+               }
+               
+       }
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/screenshot/ScreenShotDialog.java
new file mode 100644 (file)
index 0000000..1f57acf
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.screenshot;
+
+/**
+ * 
+ *
+ */
+public class ScreenShotDialog {
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/IOUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/IOUtil.java
new file mode 100644 (file)
index 0000000..e87df47
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Socket;
+
+/**
+ * 
+ *
+ */
+public class IOUtil {
+
+       private IOUtil(){}
+
+       public static void closeSocket( Socket socket ) {
+               try {
+                       if ( null != socket ) {
+                               socket.close();
+                       }
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static void close( Closeable closeable ) {
+               try {
+                       if ( null != closeable ) {
+                               closeable.close();
+                       }
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public static byte[] getBytes( InputStream is ) throws IOException {
+               
+               ByteArrayOutputStream bao = new ByteArrayOutputStream();
+               byte[] buffer = new byte[1024];
+               
+               int read = 0;
+               while( 0 < ( read = is.read( buffer ) ) ) {
+                       bao.write( buffer, 0, read );
+               }
+               
+               return bao.toByteArray();
+               
+       }
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/JaxbUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/JaxbUtil.java
new file mode 100644 (file)
index 0000000..bdf8a45
--- /dev/null
@@ -0,0 +1,107 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.util;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+
+import org.tizen.emulator.skin.exception.JaxbException;
+
+
+/**
+ * 
+ *
+ */
+public class JaxbUtil {
+       
+       private JaxbUtil(){}
+       
+       public static <T> T unmarshal( InputStream in, Class<T> clazz ) throws JaxbException {
+               
+               try{
+                       
+                       Unmarshaller u = getContext(clazz).createUnmarshaller();
+                       JAXBElement<T> element = u.unmarshal( new StreamSource(in), clazz );
+                       
+                       return element.getValue();
+                       
+               } catch (JAXBException e) {
+                       throw new JaxbException(e);
+               } catch (Throwable e) {
+                       throw new JaxbException(e);
+               }
+               
+       }
+       
+       public static void marshal( Object object, OutputStream out ) throws JaxbException {
+               
+               try{
+                       
+                       Marshaller m = getContext(object.getClass()).createMarshaller();
+                       
+                       m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
+                       m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+                       
+                       m.marshal(object, out);
+                       
+               } catch (JAXBException e) {
+                       throw new JaxbException(e);
+               } catch (Throwable e) {
+                       throw new JaxbException(e);
+               }
+               
+       }
+       
+       private static JAXBContext getContext(Class<?> clazz) throws JaxbException {
+               
+               try{
+                       
+                       String qualifier = clazz.getCanonicalName();
+                       int index = qualifier.lastIndexOf('.');
+                       if ( - 1!= index) {
+                               qualifier = qualifier.substring( 0, index );
+                       }
+                       
+                       return JAXBContext.newInstance( qualifier, clazz.getClassLoader() );
+                       
+               } catch (JAXBException e) {
+                       throw new JaxbException(e);
+               }
+               
+       }
+
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRegion.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRegion.java
new file mode 100644 (file)
index 0000000..7feec92
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.util;
+
+/**
+ * 
+ *
+ */
+public class SkinRegion {
+       public int x;
+       public int y;
+       public int width;
+       public int height;
+       
+       public SkinRegion( int x, int y, int width, int height ) {
+               this.x = x;
+               this.y = y;
+               this.width = width;
+               this.height = height;
+       }
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java
new file mode 100644 (file)
index 0000000..c7e9919
--- /dev/null
@@ -0,0 +1,120 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.tizen.emulator.skin.dbi.RotationNameType;
+import org.tizen.emulator.skin.dbi.RotationType;
+
+
+/**
+ * 
+ *
+ */
+public class SkinRotation {
+
+       public enum RotationInfo {
+
+               PORTRAIT( RotationNameType.PORTRAIT.value(), (short)0, 0 ),
+               REVERSE_PORTRAIT( RotationNameType.REVERSE_PORTRAIT.value(), (short)1, 180 ),
+               LANDSCAPE( RotationNameType.LANDSCAPE.value(), (short)2, -90 ),
+               REVERSE_LANDSCAPE( RotationNameType.REVERSE_LANDSCAPE.value(), (short)3, 90 );
+               
+               private String value;
+               private short id;
+               private int angle;
+               
+               RotationInfo( String value, short id, int ratio ) {
+                       this.value = value;
+                       this.id = id;
+                       this.angle = ratio;
+               }
+               public String value() {
+                       return this.value;
+               }
+               public int angle() {
+                       return this.angle;
+               }
+               public short id() {
+                       return this.id;
+               }
+       }
+       
+       private static Map<Short, RotationType> rotationMap;
+       private static Map<Short, RotationInfo> angleMap;
+       
+       private SkinRotation(){}
+       
+       static {
+               rotationMap = new LinkedHashMap<Short, RotationType>();
+               angleMap = new HashMap<Short, RotationInfo>();
+       }
+       
+       public static void put(RotationType rotation ) {
+
+               if ( RotationInfo.PORTRAIT.value().equalsIgnoreCase( rotation.getName().value() ) ) {
+                       rotationMap.put( RotationInfo.PORTRAIT.id(), rotation );
+                       angleMap.put( RotationInfo.PORTRAIT.id(), RotationInfo.PORTRAIT );
+               } else if ( RotationInfo.LANDSCAPE.value().equalsIgnoreCase( rotation.getName().value() ) ) {
+                       rotationMap.put( RotationInfo.LANDSCAPE.id(), rotation );
+                       angleMap.put( RotationInfo.LANDSCAPE.id(), RotationInfo.LANDSCAPE );
+               } else if ( RotationInfo.REVERSE_PORTRAIT.value().equalsIgnoreCase( rotation.getName().value() ) ) {
+                       rotationMap.put( RotationInfo.REVERSE_PORTRAIT.id(), rotation );
+                       angleMap.put( RotationInfo.REVERSE_PORTRAIT.id(), RotationInfo.REVERSE_PORTRAIT );
+               } else if ( RotationInfo.REVERSE_LANDSCAPE.value().equalsIgnoreCase( rotation.getName().value() ) ) {
+                       rotationMap.put( RotationInfo.REVERSE_LANDSCAPE.id(), rotation );
+                       angleMap.put( RotationInfo.REVERSE_LANDSCAPE.id(), RotationInfo.REVERSE_LANDSCAPE );
+               }
+
+       }
+
+       public static int getAngle( Short rotationId ) {
+               RotationInfo rotationInfo = angleMap.get(rotationId);
+               if( null != rotationInfo ) {
+                       return rotationInfo.angle();
+               }else {
+                       return 0;
+               }
+       }
+
+       public static RotationType getRotation( Short rotationId ) {
+               return rotationMap.get(rotationId);
+       }
+
+       public static Iterator<Entry<Short, RotationType>>getRotationIterator() {
+               return rotationMap.entrySet().iterator();
+       }
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java
new file mode 100644 (file)
index 0000000..78dacdc
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.util;
+
+
+/**
+ * 
+ *
+ */
+public class SkinUtil {
+
+       private SkinUtil() {
+       }
+       
+}
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/StringUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/StringUtil.java
new file mode 100644 (file)
index 0000000..e42eb10
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+ * 
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjun Son <hj79.son@samsung.com>
+ * 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.util;
+
+/**
+ * 
+ *
+ */
+public class StringUtil {
+       
+       private StringUtil(){}
+       
+       public static boolean isEmpty( String value ) {
+               return ( null == value ) || ( 0 == value.length() );
+       }
+
+       public static String nvl( String value ) {
+               return ( null == value ) ? "" : value;
+       }
+
+}
diff --git a/tizen/src/skin/client/xsd/dbi.xsd b/tizen/src/skin/client/xsd/dbi.xsd
new file mode 100644 (file)
index 0000000..9040fee
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.tizen.org/dbi"
+xmlns:dbi="http://www.tizen.org/dbi" elementFormDefault="qualified">
+
+       <element name="EmulatorUI" >
+               <complexType>
+                       <all>
+                               <element name = "rotations" type="dbi:rotationsType" minOccurs="1" maxOccurs="1"></element>
+                               <element name = "colors" type="dbi:colorsType" minOccurs="0" maxOccurs="1"></element>
+                       </all>
+               </complexType>
+       </element>
+
+       <complexType name="rotationsType">
+               <sequence>
+                       <element name="rotation" type="dbi:rotationType" minOccurs="1" maxOccurs="unbounded" ></element>
+               </sequence>
+       </complexType>
+
+       <complexType name="rotationType">
+               <sequence>
+                       <element name="lcd" type="dbi:lcdType" minOccurs="1" maxOccurs="1"></element>
+                       <element name="imageList" type="dbi:imageListType" minOccurs="1" maxOccurs="1" ></element>
+                       <element name="keyMapList" type="dbi:keyMapListType" minOccurs="1" maxOccurs="1" ></element>
+               </sequence>
+               <attribute name="id" type="int" use="required"></attribute>
+               <attribute name="name" type="dbi:rotationNameType" use="required"></attribute>
+       </complexType>
+
+    <simpleType name="rotationNameType">
+        <restriction base="string">
+            <enumeration value="Portrait"></enumeration>
+            <enumeration value="Landscape"></enumeration>
+            <enumeration value="Reverse Portrait"></enumeration>
+            <enumeration value="Reverse Landscape"></enumeration>
+        </restriction>
+    </simpleType>
+
+       <complexType name="imageListType">
+               <all>
+                       <element name="mainImage" type="string" minOccurs="1" maxOccurs="1"></element>
+                       <element name="keyPressedImage" type="string" minOccurs="0" maxOccurs="1"></element>
+               </all>
+       </complexType>
+
+       <complexType name="lcdType">
+               <all>
+                       <element name="region" type="dbi:regionType" minOccurs="1" maxOccurs="1"></element>
+               </all>
+               <attribute name="id" type="int" use="required"></attribute>
+       </complexType>
+
+       <complexType name="keyMapListType">
+               <sequence>
+                       <element name="keyMap" type="dbi:keyMapType" minOccurs="0" maxOccurs="unbounded"></element>
+               </sequence>
+       </complexType>
+
+       <complexType name="keyMapType">
+               <sequence>
+                       <element name="region" type="dbi:regionType" minOccurs="1" maxOccurs="1"></element>
+                       <element name="eventInfo" type="dbi:eventInfoType" minOccurs="0" maxOccurs="1"></element>
+                       <element name="tooltip" type="string" minOccurs="0" maxOccurs="1"></element>
+               </sequence>
+       </complexType>
+
+       <complexType name="eventInfoType">
+               <all>
+            <element name="keyCode" type="int" minOccurs="1" maxOccurs="1"></element>
+            <element name="keyName" type="string" minOccurs="1" maxOccurs="1"></element>
+               </all>
+       </complexType>
+
+       <complexType name="regionType">
+               <attribute name="left" type="int" ></attribute>
+               <attribute name="top" type="int" ></attribute>
+               <attribute name="width" type="int" ></attribute>
+               <attribute name="height" type="int" ></attribute>
+       </complexType>
+
+       <complexType name="colorsType">
+               <all>
+                       <element name="hoverColor" type="dbi:rgbType" minOccurs="0" maxOccurs="1"></element>
+               </all>
+       </complexType>
+
+       <complexType name="rgbType" >
+               <attribute name="R" type="unsignedInt"></attribute>
+               <attribute name="G" type="unsignedInt"></attribute>
+               <attribute name="B" type="unsignedInt"></attribute>
+       </complexType>
+
+</schema>
\ No newline at end of file