[Title] modify 'About' dialog
authorjihye kim <jihye1128.kim@samsung.com>
Wed, 5 Sep 2012 08:18:13 +0000 (17:18 +0900)
committerjihye kim <jihye1128.kim@samsung.com>
Wed, 5 Sep 2012 08:20:03 +0000 (17:20 +0900)
[Type] work
[Module] emulator manager
[Priority] major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

build.xml
resource/res/aboutSDK.png [new file with mode: 0755]
src/org/tizen/emulator/manager/tool/About.java
src/org/tizen/emulator/manager/ui/AboutDialog.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/MainDialog.java
src/org/tizen/emulator/manager/ui/ResourceRegistry.java

index 43ab24a..a6e7d83 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -19,7 +19,7 @@
        <target name="make-properties">
                <echo message="make properties..." />
                <tstamp>
-                       <format property="build_time" pattern="MM/dd/yyyy hh:mm aa" timezone="GMT" locale="en" />
+                       <format property="build_time" pattern="yyyyMMDD-hhmm" timezone="GMT" locale="en" />
                </tstamp>
         <exec executable="cat" outputproperty="version">
             <arg value="VERSION" />
diff --git a/resource/res/aboutSDK.png b/resource/res/aboutSDK.png
new file mode 100755 (executable)
index 0000000..b276703
Binary files /dev/null and b/resource/res/aboutSDK.png differ
index d6670e1..9770c00 100644 (file)
@@ -38,7 +38,7 @@ import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.vms.EmulatorVMs;
 
 public class About {
-       private static About about = new About();
+       private static About about = null;
        private String version = "";
        private String about_version = "";
        private String time = "";
@@ -46,7 +46,19 @@ public class About {
        private String workspace = "";
        private String contents = "";
 
+       // called from AboutDialog();
+       public static void initAboutContents() {
+               if (about != null) {
+                       return;
+               }
+
+               about = new About();
+       }
+
        public static About getInstance() {
+               if (about == null) {
+                       about = new About();
+               }
                return about;
        }
 
@@ -104,8 +116,16 @@ public class About {
        public String getContents() {
                return contents;
        }
-       
+
        public String getVersion() {
                return version;
        }
+
+       public String getBuildTime() {
+               return time;
+       }
+
+       public String getAboutVersion() {
+               return about_version;
+       }
 }
diff --git a/src/org/tizen/emulator/manager/ui/AboutDialog.java b/src/org/tizen/emulator/manager/ui/AboutDialog.java
new file mode 100644 (file)
index 0000000..956e8d3
--- /dev/null
@@ -0,0 +1,142 @@
+package org.tizen.emulator.manager.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.tool.About;
+import org.tizen.emulator.manager.tool.StringResource;
+import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName;
+import org.tizen.emulator.manager.vms.EmulatorVMs;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+
+public class AboutDialog {
+       private static Shell dialog = null;
+       private static String textContents = "";
+       private static int width = 436; //149 + 287
+       private static int height = 290; // 180 + 110
+       static {
+               About.initAboutContents();
+               textContents = "\n" +
+                                "Tizen SDK" +
+                                "\n\n" +
+                                "Version : " + About.getInstance().getAboutVersion() +
+                                "\n" +
+                                "Build id : " + About.getInstance().getBuildTime();
+
+       }
+
+       public static void open() {
+               makeDialog();
+               dialog.open();
+       }
+
+       private static void makeDialog() {
+               dialog = new Shell(EmulatorManager.getInstance().getMainDialog().getShell(), SWT.DIALOG_TRIM);
+               dialog.setText("About Emulator Manager");
+               dialog.setSize(width, height);
+               dialog.setLayout(getGridLayout(1, false));
+
+               Composite upperComposite = new Composite(dialog, SWT.NONE);
+               upperComposite.setLayout(getGridLayout(2, false));
+               upperComposite.setSize(width, 180);
+               upperComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+               upperComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+
+               // About icon
+               Label label = new Label(upperComposite, SWT.NONE);
+               label.setImage(ResourceRegistry.getImage(ImageName.ABOUTSDK));
+
+               // About Contents
+               makeTextContents(upperComposite);
+
+               Composite lowerComposite = new Composite(dialog, SWT.NONE);
+               GridLayout layout = getGridLayout(1, true);
+               layout.marginRight = 10;
+               lowerComposite.setLayout(layout);
+               // TODO
+               lowerComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE, false, false));
+
+               Label dummy = new Label(lowerComposite, SWT.NONE);
+               dummy.setLayoutData(new GridData(110, 40));
+
+               Button okButton = new Button(lowerComposite, SWT.PUSH);
+               okButton.setLayoutData(new GridData(110, SWT.DEFAULT));
+               okButton.setText(StringResource.OK);
+               okButton.setFocus();
+               okButton.addSelectionListener(new SelectionListener() {
+                       public void widgetSelected(SelectionEvent e) {
+                               dialog.close();
+                       }
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+               });
+       }
+
+       private static void makeTextContents(Composite upperComposite) {
+               Composite textComposite = new Composite(upperComposite, SWT.NONE);
+               GridLayout layout = getGridLayout(1, true);
+               layout.marginLeft  = 5;
+               layout.marginRight = 5;
+               textComposite.setLayout(layout);
+               textComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+               textComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+
+               // basic info - version , build time
+               Label contents = new Label(textComposite, SWT.NONE);
+               contents.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
+               contents.setText(textContents);
+               contents.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+
+               // workspace path
+               Link workspace = new Link(textComposite, SWT.NONE);
+               workspace.setLayoutData(new GridData(287, SWT.DEFAULT));
+               workspace.setText("Workspace Path : " +
+                                               "<a>" + EmulatorVMs.getInstance().getVMsBaseDirectory() + "</a>");
+               workspace.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+               workspace.addSelectionListener(new SelectionListener(){
+                       public void widgetDefaultSelected(SelectionEvent arg0) {
+                       }
+                       public void widgetSelected(SelectionEvent arg0) {
+                               org.eclipse.swt.program.Program.launch(EmulatorVMs.getInstance().getVMsBaseDirectory());
+                       }
+               });
+
+               // link to tizen site
+               Link visit = new Link(textComposite, SWT.NONE);
+               visit.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false));
+               visit.setText("\n\n" +
+                                         "Visit <a>https://developer.tizen.org</a>");
+               visit.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+               visit.addSelectionListener(new SelectionListener(){
+                       public void widgetDefaultSelected(SelectionEvent arg0) {
+                       }
+                       public void widgetSelected(SelectionEvent arg0) {
+                               org.eclipse.swt.program.Program.launch("https://developer.tizen.org");
+                       }
+                       
+               });
+       }
+
+       private static GridLayout getGridLayout(int numColumns, boolean makeColumnEqualWidth) {
+               GridLayout layout = new GridLayout(numColumns, makeColumnEqualWidth);
+               layout.horizontalSpacing = 0;
+               layout.verticalSpacing = 0;
+               layout.marginBottom = 0;
+               layout.marginHeight = 0;
+               layout.marginLeft = 0;
+               layout.marginRight = 0;
+               layout.marginTop = 0;
+               layout.marginWidth = 0;
+
+               return layout;
+       }
+}
+
index 690918b..039bd21 100644 (file)
@@ -49,7 +49,6 @@ import org.eclipse.swt.widgets.ToolItem;
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
 import org.tizen.emulator.manager.image.BaseImage;
-import org.tizen.emulator.manager.tool.About;
 import org.tizen.emulator.manager.tool.StringResource;
 import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName;
 import org.tizen.emulator.manager.ui.detail.DetailTableView;
@@ -440,8 +439,11 @@ enum State {
                aboutItem.addSelectionListener(new SelectionListener() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
+                               /*
                                new MessageDialog().openInfoDialog("About Emulator Manager",
                                                                        About.getInstance().getContents());
+                                                                       */
+                               AboutDialog.open();
                        }
                        @Override
                        public void widgetDefaultSelected(SelectionEvent e) {}
index 7215efe..178af74 100644 (file)
@@ -42,7 +42,7 @@ public class ResourceRegistry {
        public enum ImageName {
                CANCEL("cancel"), CONFIRM("confirm"), CREATE("create"), DELETE("delete"), DETAILS("details"),
                FOLDER("folder"), MODIFY("modify"), REFRESH("refresh"), RESET("reset"), LAUNCH("launch"), CREATEIMAGE("createimage"),
-               ABOUT("about"), CLONE("clone"), ARM("arm"), X86("x86");
+               ABOUT("about"), CLONE("clone"), ARM("arm"), X86("x86"), ABOUTSDK("aboutSDK");
 
                String name;