about: change to form layout from grid layout
authorjihye424.kim <jihye424.kim@samsung.com>
Tue, 1 Dec 2015 05:03:31 +0000 (14:03 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 2 Dec 2015 05:46:28 +0000 (14:46 +0900)
- bug: text box is cropped in windows
- fix: change to form layout and set proper width

Change-Id: I0728c56142ef0cd663b84b8bf1a7ef66fd744180
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/ui/dialog/AboutDialog.java

index b2e35f0..7ac1907 100644 (file)
@@ -32,6 +32,9 @@ package org.tizen.emulator.manager.ui.dialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -55,8 +58,8 @@ import org.tizen.emulator.manager.ui.Messages;
 public class AboutDialog {
        private static Shell dialog = null;
        private static String textContents = ""; //$NON-NLS-1$
-       private static int width  = 436; //149 + 287
-       private static int height = 290; // 180 + 110
+       private static int WIDTH  = 436; //149 + 287
+       private static int HEIGHT = 290; // 180 + 110
        static {
                About.initAboutContents();
                textContents = Messages.getString("AboutDialog.2") + About.getInstance().getAboutVersion() //$NON-NLS-1$
@@ -75,12 +78,12 @@ public class AboutDialog {
                dialog = new Shell(MainDialog.getShell(),
                                                SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
                dialog.setText(Messages.getString("AboutDialog.4")); //$NON-NLS-1$
-               dialog.setSize(width, height);
+               dialog.setSize(WIDTH, HEIGHT);
                dialog.setLayout(getGridLayout(1, false));
 
                Composite upperComposite = new Composite(dialog, SWT.NONE);
                upperComposite.setLayout(getGridLayout(2, false));
-               upperComposite.setSize(width, 181);
+               upperComposite.setSize(WIDTH, 181);
                upperComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
 
                if (!(EmulatorManager.isMac())) {
@@ -121,22 +124,28 @@ public class AboutDialog {
 
        private static void makeTextContents(Composite upperComposite) {
                Composite textComposite = new Composite(upperComposite, SWT.NONE);
-               GridLayout layout = getGridLayout(1, true);
-               layout.marginLeft  = 5;
-               layout.marginRight = 10;
-               textComposite.setLayout(layout);
-               textComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+               textComposite.setLayout(new FormLayout());
+               textComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                textComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
 
+               FormData data = null;
+               int spacing = 10;
                // basic info - version , build time
                Label contents = new Label(textComposite, SWT.NONE);
-               contents.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(0, spacing);
+               contents.setLayoutData(data);
                contents.setText(textContents);
                contents.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
 
                // workspace path
-               Link workspace = new Link(textComposite, SWT.NONE);
-               workspace.setLayoutData(new GridData(280, SWT.DEFAULT));
+               Link workspace = new Link(textComposite, SWT.WRAP);
+               data = new FormData();
+               data.top = new FormAttachment(contents, spacing);
+               data.left = new FormAttachment(0, spacing);
+               data.width = 280;
+               workspace.setLayoutData(data);
                workspace.setText(Messages.getString("AboutDialog.5") + //$NON-NLS-1$
                                                "<a>" + FilePathResources.getTizenVmsPath() + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
                workspace.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
@@ -156,10 +165,11 @@ public class AboutDialog {
 
                // link to tizen developer site
                Link visit = new Link(textComposite, SWT.NONE);
-               visit.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false));
-               visit.setText(StringResources.NEW_LINE +
-                                         Messages.getString("AboutDialog.8")
-                                         + StringResources.NEW_LINE);
+               data = new FormData();
+               data.top = new FormAttachment(workspace, spacing);
+               data.left = new FormAttachment(0, spacing);
+               visit.setLayoutData(data);
+               visit.setText(Messages.getString("AboutDialog.8"));
                visit.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
                visit.addSelectionListener(new SelectionListener(){
                        @Override
@@ -194,7 +204,12 @@ public class AboutDialog {
                        list = list + p.getPlatformName() + ": " + p.getPackageVersion();
                }
                plugin.setText(list);
-               plugin.setLayoutData(new GridData(270, 38));
+               data = new FormData();
+               data.top = new FormAttachment(visit, spacing);
+               data.left = new FormAttachment(0, spacing);
+               data.width = 240;
+               data.height = 40;
+               plugin.setLayoutData(data);
        }
 
        private static GridLayout getGridLayout(int numColumns, boolean makeColumnEqualWidth) {