import org.tizen.emulator.skin.util.SwtUtil;
public class AboutDialog extends SkinDialog {
+ public static final String ABOUT_DIALOG_TITLE = "About Tizen Emulator";
public static final String ABOUT_PROP_FILENAME = "about.properties";
public static final String PROP_KEY_VERSION = "version";
*/
public AboutDialog(Shell parent,
EmulatorConfig config, ImageRegistry imageRegistry) {
- super(parent, "About Tizen Emulator",
- SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL, ABOUT_DIALOG_TITLE);
this.config = config;
this.imageRegistry = imageRegistry;
}
- private GridLayout getNopaddedGridLayout(int numColumns, boolean makeColumnEqualWidth) {
+ private GridLayout getNopaddedGridLayout(
+ int numColumns, boolean makeColumnEqualWidth) {
GridLayout layout = new GridLayout(numColumns, makeColumnEqualWidth);
layout.marginLeft = layout.marginRight = 0;
layout.marginTop = layout.marginBottom = 0;
String property = properties.getProperty(key);
if (!StringUtil.isEmpty(property)) {
-
if (!property.contains(key)) {
return property;
} else {
package org.tizen.emulator.skin.dialog;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
*
*/
public class DetailInfoDialog extends SkinDialog {
+ public final static String DETAIL_INFO_DIALOG_TITLE = "Detail Info";
+
public final static String TABLE_COLUMN_NAME_0 = "Feature";
public final static String TABLE_COLUMN_NAME_1 = "Value";
*/
public DetailInfoDialog(Shell parent, SocketCommunicator communicator,
EmulatorConfig config, SkinInformation skinInfo) {
- super(parent, "Detail Info" + " - " + SkinUtil.makeEmulatorName(config),
- SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX);
+ super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX,
+ DETAIL_INFO_DIALOG_TITLE + " - " + SkinUtil.makeEmulatorName(config));
this.communicator = communicator;
this.config = config;
byte[] receivedData = communicator.getReceivedData(dataTranfer);
if (null != receivedData) {
- infoData = new String(receivedData);
+ try {
+ infoData = new String(receivedData, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ logger.warning("unsupported encoding exception");
+ infoData = new String(receivedData);
+ }
} else {
logger.severe("Fail to get detail info");
SkinUtil.openMessage(shell, null,
/**
- *
+ * License Dialog
*
- * 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 <giwoong.kim@samsung.com>
*
*/
public class LicenseDialog extends SkinDialog {
-
public static final String LICENSE_FILE_PATH = "../license/Open_Source_Announcement.txt";
- private Logger logger = SkinLogger.getSkinLogger( LicenseDialog.class ).getLogger();
+ private Logger logger =
+ SkinLogger.getSkinLogger(LicenseDialog.class).getLogger();
- public LicenseDialog( Shell parent, String title ) {
- super( parent, title, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX );
+ /**
+ * Constructor
+ */
+ public LicenseDialog(Shell parent, String title) {
+ super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX, title);
}
@Override
- protected Composite createArea( Composite parent ) {
-
- Composite composite = new Composite( parent, SWT.NONE );
- composite.setLayout( new GridLayout() );
+ protected Composite createArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
- final Text text = new Text( composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI );
- GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
- text.setLayoutData( gridData );
+ final Text text = new Text(composite,
+ SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ text.setLayoutData(gridData);
- text.setEditable( false );
- text.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_WHITE ) );
- String license = StringUtil.nvl( getLicense() );
- text.setText( license );
+ text.setEditable(false);
+ text.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ String license = StringUtil.nvl(getLicense());
+ text.setText(license);
return composite;
-
}
@Override
protected void setShellSize() {
- shell.setSize( (int) ( 400 * 1.618 ), 400 );
+ shell.setSize((int) (400 * 1.618/* golden ratio */), 400);
}
@Override
- protected void createButtons( Composite parent ) {
- super.createButtons( parent );
+ protected void createButtons(Composite parent) {
+ super.createButtons(parent);
- Button okButton = createButton( parent, OK );
+ Button okButton = createButton(parent, OK);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.RIGHT;
- okButton.setLayoutData( gd );
+ okButton.setLayoutData(gd);
okButton.setFocus();
- okButton.addSelectionListener( new SelectionAdapter() {
+ okButton.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected( SelectionEvent e ) {
- LicenseDialog.this.shell.close();
+ public void widgetSelected(SelectionEvent e) {
+ shell.close();
}
- } );
-
+ });
}
private String getLicense() {
-
FileInputStream fis = null;
String string = "";
try {
-
- fis = new FileInputStream( LICENSE_FILE_PATH );
+ fis = new FileInputStream(LICENSE_FILE_PATH);
try {
- byte[] bytes = IOUtil.getBytes( fis );
- string = new String( bytes, "UTF-8" );
- } catch ( IOException e ) {
- logger.log( Level.SEVERE, e.getMessage(), e );
+ byte[] bytes = IOUtil.getBytes(fis);
+ string = new String(bytes, "UTF-8");
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
string = "File control error.";
}
-
- } catch ( FileNotFoundException e ) {
+ } catch (FileNotFoundException e) {
string = "There is no license info.";
} finally {
- IOUtil.close( fis );
+ IOUtil.close(fis);
}
return string;
-
}
+ @Override
protected void close() {
logger.info("close the license dialog");
}
/**
- *
+ * Ramdump Dialog
*
* Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
import org.tizen.emulator.skin.util.SkinUtil;
public class RamdumpDialog extends SkinDialog {
- private SocketCommunicator communicator;
- private Composite compositeBase;
- private ImageData[] frames;
+ public static final String RAMDUMP_DIALOG_TITLE = "Ram Dump";
+ public static final String INDICATOR_IMAGE_PATH = "images/process.gif";
private Logger logger =
SkinLogger.getSkinLogger(RamdumpDialog.class).getLogger();
+ private SocketCommunicator communicator;
+ private Composite compositeBase;
+ private ImageData[] frames;
+
+ /**
+ * Constructor
+ */
public RamdumpDialog(Shell parent,
SocketCommunicator communicator, EmulatorConfig config) throws IOException {
- super(parent, SkinUtil.makeEmulatorName(config),
- SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
+ RAMDUMP_DIALOG_TITLE + " - " + SkinUtil.makeEmulatorName(config), false);
+
this.communicator = communicator;
}
return null;
}
- RamdumpDialog.this.shell.addListener(SWT.Close, new Listener() {
+ shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
if (communicator.getRamdumpFlag() == true) {
event.doit = false;
}
}
- } );
+ });
return composite;
}
try {
frames = loader.load(
- classLoader.getResourceAsStream("images/process.gif"));
+ classLoader.getResourceAsStream(INDICATOR_IMAGE_PATH));
} catch (Exception e) {
- // TODO: register a indicator file
frames = null;
}
display.syncExec(new Runnable() {
@Override
public void run() {
- logger.info("close the Ramdump dialog");
+ logger.info("ramdump complete");
if (labelImage.getImage() != null) {
labelImage.getImage().dispose();
}
shell.setCursor(null);
- RamdumpDialog.this.shell.close();
+ shell.close();
}
});
}
@Override
protected void setShellSize() {
- shell.setSize(280, 150);
+ shell.setSize(280, 140);
/* align */
Rectangle boundsClient = shell.getClientArea();
/**
- *
+ * Skin Dialog
*
* Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
protected Shell shell;
protected Composite buttonComposite;
private Shell parent;
- private String title;
private int style;
-
- public SkinDialog(Shell parent, String title, int style) {
+ private String title;
+ private boolean hasButton;
+
+ /**
+ * Constructor
+ */
+ public SkinDialog(Shell parent, int style, String title) {
super(parent, style);
+
this.parent = parent;
+ this.style = style;
this.title = title;
+ this.hasButton = true;
+ }
+
+ public SkinDialog(Shell parent, int style, String title, boolean hasButton) {
+ super(parent, style);
+
+ this.parent = parent;
this.style = style;
+ this.title = title;
+ this.hasButton = hasButton;
}
protected void createComposite() {
return;
}
+ if (hasButton == true) {
/* bottom side */
- buttonComposite = new Composite(parent, SWT.NONE);
- buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true));
- buttonComposite.setLayout(new GridLayout(1, false));
+ buttonComposite = new Composite(parent, SWT.NONE);
+ buttonComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true));
+ buttonComposite.setLayout(new GridLayout(1, false));
- createButtons(buttonComposite);
+ createButtons(buttonComposite);
+ }
}
public void open() {
}
protected void close() {
+ logger.info("closed");
+
/* do nothing */
}
protected void createButtons(Composite parent) {
if (null == parent) {
- throw new IllegalArgumentException("Buttons parent is null");
+ throw new IllegalArgumentException("button composite is null");
}
}
protected Button createButton(Composite parent, String text) {
-
if (null == parent) {
- throw new IllegalArgumentException("Button parent is null");
+ throw new IllegalArgumentException("button composite is null");
}
Composite composite = new Composite(parent, SWT.NONE);
}
return okButton;
-
}
-
}