/**
* @param args
*/
- public static void main( String[] args ) {
+ public static void main(String[] args) {
String simpleMsg = getSimpleMsg(args);
if (simpleMsg != null) {
try {
/* get vm path from startup argument */
- String vmPath = getVmPath( args );
- if ( StringUtil.isEmpty( vmPath ) ) {
- throw new IllegalArgumentException( ArgsConstants.VM_PATH + " in arguments is null." );
+ String vmPath = getVmPath(args);
+ if (StringUtil.isEmpty(vmPath)) {
+ throw new IllegalArgumentException(
+ ArgsConstants.VM_PATH + " in arguments is null.");
}
- SkinLogger.init( SkinLogLevel.DEBUG, vmPath );
+ SkinLogger.init(SkinLogLevel.DEBUG, vmPath);
- logger = SkinLogger.getSkinLogger( EmulatorSkinMain.class ).getLogger();
- logger.info( "!!! Start Emualtor Skin !!!" );
+ logger = SkinLogger.getSkinLogger(EmulatorSkinMain.class).getLogger();
+ logger.info("!!! Start Emualtor Skin !!!");
/* startup arguments parsing */
Map<String, String> argsMap = parsArgs(args);
String skinPath = ImageRegistry.getSkinPath(
(String) argsMap.get(ArgsConstants.SKIN_PATH));
-
/* get maxtouchpoint from startup argument */
int maxtouchpoint;
if(argsMap.containsKey(ArgsConstants.MAX_TOUCHPOINT)) {
logger.info(ArgsConstants.MAX_TOUCHPOINT +
" does not exist set maxtouchpoint info to " + maxtouchpoint);
}
+
/* set skin information */
String skinInfoFilePath = skinPath + File.separator + SKIN_INFO_FILE_NAME;
Properties skinInfoProperties = loadProperties(skinInfoFilePath, false);
/* load dbi file */
EmulatorUI dbiContents = loadDbi(skinPath);
- if ( null == dbiContents ) {
- logger.severe( "Fail to load dbi file." );
+ if (null == dbiContents) {
+ logger.severe("Fail to load dbi file.");
Shell temp = new Shell(Display.getDefault());
- MessageBox messageBox = new MessageBox( temp, SWT.ICON_ERROR );
- messageBox.setText( "Emulator" );
- messageBox.setMessage( "Fail to load \"" + DBI_FILE_NAME + "\" file\n" +
+ MessageBox messageBox = new MessageBox(temp, SWT.ICON_ERROR);
+ messageBox.setText("Emulator");
+ messageBox.setMessage("Fail to load \"" + DBI_FILE_NAME + "\" file\n" +
"Check if the file is corrupted or missing from the following path.\n" +
skinPath);
messageBox.open();
temp.dispose();
- System.exit( -1 );
+ System.exit(-1);
}
- EmulatorConfig config = new EmulatorConfig( argsMap, dbiContents, skinProperties, skinPropFilePath,
- configProperties );
+ EmulatorConfig config = new EmulatorConfig(argsMap,
+ dbiContents, skinProperties, skinPropFilePath, configProperties);
/* load image resource */
ImageRegistry.getInstance().initialize(config);
*/
public class EmulatorConfig {
- private static Logger logger = SkinLogger.getSkinLogger( EmulatorConfig.class ).getLogger();
+ private static Logger logger =
+ SkinLogger.getSkinLogger(EmulatorConfig.class).getLogger();
public static final int DEFAULT_WINDOW_SCALE = Scale.SCALE_50.value();
public static final short DEFAULT_WINDOW_ROTATION = RotationInfo.PORTRAIT.id();
properties.put( key, Integer.toString( value ) );
}
- // skin properties //
+ /* skin properties */
public String getSkinProperty( String key ) {
return getProperty( skinProperties, key );
setProperty( skinProperties, key, value );
}
- // config properties //
+ /* config properties */
public String getConfigProperty( String key ) {
return getProperty( configProperties, key );
*
*/
public class ImageRegistry {
-
- private Logger logger = SkinLogger.getSkinLogger( ImageRegistry.class ).getLogger();
+ private static Logger logger =
+ SkinLogger.getSkinLogger(ImageRegistry.class).getLogger();
public static final String SKINS_FOLDER = "skins";
public static final String GENERAL_FOLDER = "emul-general";
private static boolean isInitialized;
private ImageRegistry() {
+ /* do nothing */
}
public static ImageRegistry getInstance() {
- if ( null == instance ) {
+ if (null == instance) {
instance = new ImageRegistry();
}
+
return instance;
}
this.skinImageMap = new HashMap<String, Image>();
this.iconMap = new HashMap<String, Image>();
- init( this.argSkinPath );
+ init(this.argSkinPath);
}
public static String getSkinPath(String argSkinPath) {
- /* When emulator has a invalid skin path,
+ /* When emulator receive a invalid skin path,
emulator uses default skin path instead of it */
String defaultSkinPath = ".." + //TODO:
File.separator + SKINS_FOLDER + File.separator + GENERAL_FOLDER;
if (argSkinPath == null) {
+ logger.info("Emulator uses default skin path (" + defaultSkinPath +
+ ") instead of invalid skin path (null).");
+
return defaultSkinPath;
}
File f = new File(argSkinPath);
if (f.isDirectory() == false) {
+ logger.info("Emulator uses default skin path (" + defaultSkinPath +
+ ") instead of invalid skin path (" + argSkinPath + ").");
+
return defaultSkinPath;
}
return argSkinPath;
}
- private void init( String argSkinPath ) {
+ private void init(String argSkinPath) {
RotationsType rotations = dbiContents.getRotations();
- if ( null == rotations ) {
- logger.severe( "Fail to loading rotations element from dbi." );
+ if (null == rotations) {
+ logger.severe("Fail to loading rotations element from dbi.");
return;
}
List<RotationType> rotationList = rotations.getRotation();
- for ( RotationType rotation : rotationList ) {
- SkinRotation.put( rotation );
+ for (RotationType rotation : rotationList) {
+ SkinRotation.put(rotation);
}
}
}
}
- private String makeKey( Short id, ImageType imageType ) {
+ private String makeKey(Short id, ImageType imageType) {
return id + ":" + imageType.ordinal();
}