[SRADA-527] Implement empty PreferencesDialog
authordongkyu6 lee <dongkyu6.lee@samsung.com>
Wed, 11 May 2016 06:31:42 +0000 (15:31 +0900)
committerdongkyu6 lee <dongkyu6.lee@samsung.com>
Thu, 12 May 2016 04:46:51 +0000 (13:46 +0900)
Change-Id: Ic5e2d5b3f0c0b5972781d14d8d3f91e9b537a257

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/PreferencesDialogLabels.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/PreferencesDialogLabels.properties [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/MenuBar.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/PreferencesDialog.java [new file with mode: 0644]

diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/PreferencesDialogLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/PreferencesDialogLabels.java
new file mode 100644 (file)
index 0000000..7d8217e
--- /dev/null
@@ -0,0 +1,36 @@
+package org.tizen.dynamicanalyzer.nl;
+
+import org.eclipse.osgi.util.NLS;
+
+public class PreferencesDialogLabels extends NLS {
+       
+       private static final String BUNDLE_NAME = "org.tizen.dynamicanalyzer.nl.PreferencesDialogLabels";
+       
+       public static String TITLE;
+       
+       public static String GENERAL;
+       public static String SOURCE_VIEW;
+       public static String SYSTEM_SAMPLIING_RATE;
+       public static String FUNCION_SAMPLIING_RATE;
+       
+       public static String RECORDING;
+       public static String AUTOSTOP_WHILE_REPLAYING;
+       
+       public static String SCREENSHOT;
+       public static String ON_SCENE_TRANSITION;
+       public static String PERIODICALLY;
+       
+       public static String SET_AS_DEFAULT;
+       public static String TIME_UNIT_MS;
+       public static String TIME_UNIT_S;
+       
+       public static String ON;
+       public static String OFF;
+       
+       static {
+               NLS.initializeMessages(BUNDLE_NAME, PreferencesDialogLabels.class);
+       }
+
+       public PreferencesDialogLabels() {
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/PreferencesDialogLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/PreferencesDialogLabels.properties
new file mode 100644 (file)
index 0000000..6435a65
--- /dev/null
@@ -0,0 +1,24 @@
+#
+TITLE=Preferences
+       
+SET_AS_DEFAULT=Set as default
+TIME_UNIT_MS=ms
+TIME_UNIT_S=s
+       
+ON=ON
+OFF=OFF
+
+#GENERAL
+GENERAL=General
+SOURCE_VIEW=Source view
+SYSTEM_SAMPLIING_RATE=System sampling rate
+FUNCION_SAMPLIING_RATE=Function sampling rate
+
+#RECORING
+RECORDING=Recording
+AUTOSTOP_WHILE_REPLAYING=Auto-stop while replaying
+
+#SCREENSHOT
+SCREENSHOT=Screenshot
+ON_SCENE_TRANSITION=On scene transition
+PERIODICALLY=Periodically
index 6173922..d422536 100644 (file)
@@ -66,6 +66,7 @@ import org.tizen.dynamicanalyzer.ui.summary.profiling.WebProfilingDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.toolbar.setting.FlatFeatureDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.setting.PreferencesDialog;
 import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
@@ -262,7 +263,8 @@ public class MenuBar {
 
                        @Override
                        public void widgetSelected(SelectionEvent arg0) {
-                               
+                               PreferencesDialog preferencesDialog = new PreferencesDialog(currentShell);
+                               preferencesDialog.open();
                        }
                });
                
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/PreferencesDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/PreferencesDialog.java
new file mode 100644 (file)
index 0000000..fd6b67f
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Dongkye Lee <dongkyu6.lee@samsung.com>
+ * Jaeyong Lee <jae-yong.lee@@samsung.com>
+ * Gihun Chang <gihun.chang@@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.nl.PreferencesDialogLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
+
+public class PreferencesDialog extends DAMessageBox {
+       private static boolean opened = false;
+       
+       public PreferencesDialog(Shell parentShell) {
+               super(parentShell);
+       }
+       
+       protected boolean run() {
+               if (opened) {
+                       return false;
+               }
+               
+               shell.setSize(610, 620);
+               shell.setLayout(new FormLayout());
+               shell.setText(PreferencesDialogLabels.TITLE);
+               shell.setBackground(ColorResources.WHITE);
+
+               // base composite
+               Composite baseComp = new Composite(shell, SWT.NONE);
+               FormLayout compLayout = new FormLayout();
+               baseComp.setLayout(compLayout);
+       
+               FormData compData = new FormData();
+               compData.top = new FormAttachment(0, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, -60);
+               baseComp.setLayoutData(compData);
+               
+               ScrolledComposite scrolledComp = new ScrolledComposite(baseComp, SWT.BORDER | SWT.V_SCROLL);
+               scrolledComp.setLayout(new FormLayout());
+               FormData scrollCompData = new FormData();
+               scrollCompData.top = new FormAttachment(0, 0);
+               scrollCompData.left = new FormAttachment(0, 0);
+               scrollCompData.right = new FormAttachment(100, 0);
+               scrollCompData.bottom = new FormAttachment(100, 0);
+               scrolledComp.setLayoutData(scrollCompData);
+               scrolledComp.setExpandVertical(true);
+               scrolledComp.setBackground(ColorResources.WHITE);
+               
+               
+
+               // button composite
+               Composite buttonContentsComp = new Composite(shell, SWT.NONE);
+               compLayout = new FormLayout();
+               buttonContentsComp.setLayout(compLayout);
+               buttonContentsComp.setBackground(ColorResources.WHITE);
+               compData = new FormData();
+               compData.top = new FormAttachment(100, -60);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, 0);
+               buttonContentsComp.setLayoutData(compData);
+
+               DACustomButton okButton = new DAButton(buttonContentsComp, SWT.NONE);
+               okButton.addClickListener(okButtonListener);
+               okButton.setText(WidgetLabels.OK);
+               okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               FormData buttonData = new FormData();
+               buttonData.top = new FormAttachment(0, 15);
+               buttonData.right = new FormAttachment(100, -15);
+               buttonData.width = 100;
+               buttonData.height = 30;
+               okButton.setLayoutData(buttonData);
+
+               DACustomButton cancelButton = new DAButton(buttonContentsComp, SWT.NONE);
+               cancelButton.addClickListener(cancelButtonListener);
+               cancelButton.setText(WidgetLabels.CANCEL);
+               cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               buttonData = new FormData();
+               buttonData.top = new FormAttachment(0, 15);
+               buttonData.right = new FormAttachment(okButton, -8);
+               buttonData.width = 100;
+               buttonData.height = 30;
+               cancelButton.setLayoutData(buttonData);
+               
+               DACustomButton setAsDefaultButton = new DAButton(buttonContentsComp, SWT.NONE);
+               setAsDefaultButton.addClickListener(setAsDefaultButtonListener);
+               setAsDefaultButton.setText(PreferencesDialogLabels.SET_AS_DEFAULT);
+               setAsDefaultButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               buttonData = new FormData();
+               buttonData.top = new FormAttachment(0, 15);
+               buttonData.right = new FormAttachment(cancelButton, -8);
+               buttonData.width = 100;
+               buttonData.height = 30;
+               setAsDefaultButton.setLayoutData(buttonData);
+
+               opened = true;
+               ShortCutManager.getInstance().setEnabled(!opened);
+
+               shell.addShellListener(shellListener);
+               shell.open();
+               
+               return true;
+       }
+       
+       private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       shell.close();
+               }
+       };
+       
+       private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       shell.close();
+               }
+       };
+       
+       private DACustomButtonClickEventListener setAsDefaultButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       
+               }
+       };
+
+       private ShellListener shellListener = new ShellListener() {
+
+               @Override
+               public void shellActivated(ShellEvent e) {
+                       // TODO Auto-generated method stub
+               }
+
+               @Override
+               public void shellClosed(ShellEvent e) {
+                       opened = false;
+                       ShortCutManager.getInstance().setEnabled(!opened);
+               }
+
+               @Override
+               public void shellDeactivated(ShellEvent e) {
+                       // TODO Auto-generated method stub
+               }
+
+               @Override
+               public void shellDeiconified(ShellEvent e) {
+                       // TODO Auto-generated method stub
+               }
+
+               @Override
+               public void shellIconified(ShellEvent e) {
+                       // TODO Auto-generated method stub
+               }
+
+       };
+}