From 709d5093c7ca648b82fd420ef9743c1c01ad2363 Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Wed, 13 Nov 2013 19:09:24 +0900 Subject: [PATCH] skin: modified indenting 1. modified indenting 2. added boilerplate title Change-Id: Ibe9fa409dfd39c56dc558ba25374221dce432dec Signed-off-by: GiWoong Kim --- .../emulator/skin/EmulatorShutdownhook.java | 5 +- .../skin/comm/sock/data/AbstractSendData.java | 32 +++++----- .../skin/comm/sock/data/BooleanData.java | 23 ++++--- .../skin/comm/sock/data/DisplayStateData.java | 9 ++- .../skin/comm/sock/data/KeyEventData.java | 11 ++-- .../skin/comm/sock/data/MouseEventData.java | 7 +-- .../skin/comm/sock/data/StartData.java | 4 +- .../emulator/skin/config/EmulatorConfig.java | 2 +- .../tizen/emulator/skin/util/JaxbUtil.java | 59 ++++++++--------- .../emulator/skin/util/SkinRotation.java | 63 +++++++++++-------- .../tizen/emulator/skin/util/StringUtil.java | 4 +- .../org/tizen/emulator/skin/util/SwtUtil.java | 11 ++-- 12 files changed, 112 insertions(+), 118 deletions(-) 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 index 787e7e4b83..fd5814d331 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShutdownhook.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorShutdownhook.java @@ -1,7 +1,7 @@ /** - * + * Shutdown Hook * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -53,5 +53,4 @@ public class EmulatorShutdownhook extends Thread { logger.info("EmulatorShutdownhook run by a signal."); communicator.terminate(); } - } 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 index 896bf47a12..4388165dd8 100644 --- 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 @@ -1,7 +1,7 @@ /** - * + * Abstract Data * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -38,41 +38,39 @@ 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 ); + 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 writeShort(int val) throws IOException { + dos.writeShort(val); } - protected void writeInt ( int val ) throws IOException { - dos.writeInt( val ); + protected void writeInt(int val) throws IOException { + dos.writeInt(val); } - protected void writeLong ( long val ) throws IOException { - dos.writeLong( val ); + protected void writeLong(long val) throws IOException { + dos.writeLong(val); } - protected void writeBoolean ( boolean val ) throws IOException { - dos.writeBoolean( val ); + protected void writeBoolean(boolean val) throws IOException { + dos.writeBoolean(val); } - protected void writeChar ( char val ) throws IOException { - dos.writeChar( 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 index 1a48af1b9b..bb2773ae5f 100644 --- 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 @@ -1,7 +1,7 @@ /** - * + * Boolean Data * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -36,15 +36,14 @@ import java.io.IOException; * */ public class BooleanData extends AbstractSendData { - private boolean booleanValue; private String dataName; - public BooleanData( boolean booleanValue ) { + public BooleanData(boolean booleanValue) { this.booleanValue = booleanValue; } - public BooleanData( boolean booleanValue, String dataName) { + public BooleanData(boolean booleanValue, String dataName) { this.booleanValue = booleanValue; this.dataName = dataName; } @@ -54,18 +53,18 @@ public class BooleanData extends AbstractSendData { */ @Override protected void write() throws IOException { - writeBoolean( booleanValue ); + 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( "]" ); + 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/DisplayStateData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/DisplayStateData.java index a22ef4d64a..447e2afa13 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/DisplayStateData.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/DisplayStateData.java @@ -1,7 +1,7 @@ /** - * + * Display State Data * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -36,10 +36,9 @@ import java.io.IOException; * */ public class DisplayStateData extends AbstractSendData { - int scale; short rotation; - + public DisplayStateData(int scale, short rotation) { this.scale = scale; this.rotation = rotation; @@ -59,7 +58,7 @@ public class DisplayStateData extends AbstractSendData { 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/KeyEventData.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/comm/sock/data/KeyEventData.java index a6656e7901..e3b284cb2b 100644 --- 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 @@ -1,7 +1,7 @@ /** - * + * Key Event Data * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -36,7 +36,6 @@ import java.io.IOException; * */ public class KeyEventData extends AbstractSendData { - public int eventType; public int keycode; public int stateMask; @@ -48,7 +47,7 @@ public class KeyEventData extends AbstractSendData { this.stateMask = stateMask; this.keyLocation = keyLocation; } - + @Override protected void write() throws IOException { writeInt(eventType); @@ -56,7 +55,7 @@ public class KeyEventData extends AbstractSendData { writeInt(stateMask); writeInt(keyLocation); } - + @Override public String toString() { StringBuilder builder = new StringBuilder(); @@ -69,7 +68,7 @@ public class KeyEventData extends AbstractSendData { builder.append(", keyLocation="); builder.append(keyLocation); 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 index 268f6068e1..055bdd750b 100644 --- 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 @@ -1,7 +1,7 @@ /** - * + * Mouse Event Data * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -36,7 +36,6 @@ import java.io.IOException; * */ public class MouseEventData extends AbstractSendData { - int mouseButton; int eventType; int hostX; @@ -85,7 +84,7 @@ public class MouseEventData extends AbstractSendData { builder.append(", id="); 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 index b87becb9c0..3a270b3c4a 100644 --- 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 @@ -1,5 +1,5 @@ /** - * initial data for Qemu + * Initial Data From Skin * * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * @@ -82,7 +82,7 @@ public class StartData extends AbstractSendData { builder.append(", blank guide="); builder.append(isBlankGuide); 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 index c6ae1bd2e2..cd36ab6d2b 100644 --- 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 @@ -275,7 +275,7 @@ public class EmulatorConfig { } if (skinProperties.containsKey( - SkinPropertiesConstants.WINDOW_Y ) == true) { + SkinPropertiesConstants.WINDOW_Y) == true) { String y = skinProperties.getProperty(SkinPropertiesConstants.WINDOW_Y); int yy = 0; 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 index 25616927c7..8be268c203 100644 --- 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 @@ -1,7 +1,7 @@ /** - * + * JAXB Utilities * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -48,65 +48,56 @@ import org.tizen.emulator.skin.exception.JaxbException; * */ public class JaxbUtil { - - private JaxbUtil(){} + private JaxbUtil() { + /* do nothing */ + } - public static T unmarshal( byte[] inputBytes, Class clazz ) throws JaxbException { - return unmarshal( new ByteArrayInputStream( inputBytes ), clazz ); + public static T unmarshal( + byte[] inputBytes, Class clazz) throws JaxbException { + return unmarshal(new ByteArrayInputStream(inputBytes), clazz); } - public static T unmarshal( InputStream in, Class clazz ) throws JaxbException { - - try{ - + public static T unmarshal( + InputStream in, Class clazz) throws JaxbException { + try { Unmarshaller u = getContext(clazz).createUnmarshaller(); - JAXBElement element = u.unmarshal( new StreamSource(in), clazz ); - + JAXBElement 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{ - + + 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{ - + try { String qualifier = clazz.getCanonicalName(); int index = qualifier.lastIndexOf('.'); - if ( - 1!= index) { - qualifier = qualifier.substring( 0, index ); + if (-1 != index) { + qualifier = qualifier.substring(0, index); } - - return JAXBContext.newInstance( qualifier, clazz.getClassLoader() ); - + + 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/SkinRotation.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinRotation.java index be2f4b2aa8..845581fe8d 100644 --- 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 @@ -1,7 +1,7 @@ /** - * + * Rotation Utilities * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -44,50 +44,59 @@ import org.tizen.emulator.skin.dbi.RotationType; * */ public class SkinRotation { - private static Map rotationMap; private static Map angleMap; - - private SkinRotation(){} - + + private SkinRotation() { + /* do nothing */ + } + static { rotationMap = new LinkedHashMap(); angleMap = new HashMap(); } - - 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 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 ) { + public static int getAngle(Short rotationId) { RotationInfo rotationInfo = angleMap.get(rotationId); - if( null != rotationInfo ) { + if (null != rotationInfo) { return rotationInfo.angle(); - }else { + } else { return 0; } } - public static RotationType getRotation( Short rotationId ) { + public static RotationType getRotation(Short rotationId) { return rotationMap.get(rotationId); } - public static Iterator>getRotationIterator() { + public static Iterator> getRotationIterator() { return rotationMap.entrySet().iterator(); } - } 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 index 38566fe3f2..d4e4c774f0 100644 --- 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 @@ -1,7 +1,7 @@ /** - * + * String Utilities * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SwtUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SwtUtil.java index 0435f30f57..2b3e9aac7b 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SwtUtil.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SwtUtil.java @@ -1,7 +1,7 @@ /** - * + * SWT Utilities * - * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim @@ -37,17 +37,18 @@ import org.eclipse.swt.SWT; */ public class SwtUtil { private SwtUtil() { + /* do nothing */ } public static boolean isLinuxPlatform() { - return "gtk".equalsIgnoreCase( SWT.getPlatform() ); + return "gtk".equalsIgnoreCase(SWT.getPlatform()); } public static boolean isWindowsPlatform() { - return "win32".equalsIgnoreCase( SWT.getPlatform() ); //win32-win32-x86_64 + return "win32".equalsIgnoreCase(SWT.getPlatform()); /* win32-win32-x86_64 */ } public static boolean isMacPlatform() { - return "cocoa".equalsIgnoreCase( SWT.getPlatform() ); + return "cocoa".equalsIgnoreCase(SWT.getPlatform()); } } -- 2.34.1