From 784bfcd96dcd93f350c5ff9a43234e73b4af00db Mon Sep 17 00:00:00 2001 From: "joon.c.baek" Date: Tue, 26 Apr 2016 15:04:08 +0900 Subject: [PATCH] [SRADA-400] Add new feature dialog Add new feature dialog, This feature will co-exist new feature dialog and old setting dialog at same time. New feature dialog executed after old setting dialog. It's aim to implementing feature dialog doen't prevent working old setting dialog. If new feature dialog implementation finished, Old setting dialog will be removed. Change-Id: I2076dfe21dab698b8a5a93b41ba1150f3eba36ff Signed-off-by: joon.c.baek --- .../common/PostWindowOpenCallback.java | 3 + .../tizen/dynamicanalyzer/nl/ConfigureLabels.java | 2 + .../dynamicanalyzer/nl/ConfigureLabels.properties | 6 +- .../tizen/dynamicanalyzer/setting/TargetData.java | 13 + .../shortcut/ShortCutKeyBindingHandler.java | 3 + .../tizen/dynamicanalyzer/ui/page/BaseView.java | 3 + .../tizen/dynamicanalyzer/ui/toolbar/Toolbar.java | 3 + .../ui/toolbar/setting/FlatFeatureDialog.java | 267 ++++++++ .../ui/toolbar/setting/FlatFeatureDialogPage.java | 698 +++++++++++++++++++++ .../ui/toolbar/setting/SettingDialog.java | 1 - .../toolbar/setting/SettingDialogTemplatePage.java | 42 +- 11 files changed, 1017 insertions(+), 24 deletions(-) create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialog.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialogPage.java diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PostWindowOpenCallback.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PostWindowOpenCallback.java index d9793ce..bec7a26 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PostWindowOpenCallback.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PostWindowOpenCallback.java @@ -28,6 +28,7 @@ package org.tizen.dynamicanalyzer.common; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.callback.IExecutionCallback; +import org.tizen.dynamicanalyzer.ui.toolbar.setting.FlatFeatureDialog; import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog; import org.tizen.dynamicanalyzer.util.WorkbenchUtil; @@ -42,6 +43,8 @@ public class PostWindowOpenCallback implements IExecutionCallback { final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell(); SettingDialog dialog = new SettingDialog(shell); dialog.open(); + FlatFeatureDialog featureDialog = new FlatFeatureDialog(shell); //FIXME + featureDialog.open(); } }); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java index be4910f..000e678 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java @@ -49,6 +49,8 @@ public class ConfigureLabels extends NLS { public static String SETTING_DIALOG_DESCRIPTION; public static String SETTING_DIALOG_TARGET_TITLE; public static String SETTING_DIALOG_TEMPLATE_TITLE; + public static String SETTING_DIALOG_FEATURELIST_TITLE; + public static String SETTING_DIALOG_SELECTED_TITLE; public static String SETTING_DIALOG_OVERHEAD; public static String SETTING_DIALOG_OVERHEAD_DESCRIPTION; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties index f563713..7919f37 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties @@ -22,8 +22,10 @@ AUTO=auto : SAMPLING=sampling rate : SETTING_DIALOG_DESCRIPTION=Choose a target and template -SETTING_DIALOG_TARGET_TITLE=Targets +SETTING_DIALOG_TARGET_TITLE=Target SETTING_DIALOG_TEMPLATE_TITLE=Template +SETTING_DIALOG_FEATURELIST_TITLE=Feature List +SETTING_DIALOG_SELECTED_TITLE=Selected Features SETTING_DIALOG_OVERHEAD=Overhead : SETTING_DIALOG_OVERHEAD_DESCRIPTION=The overhead is the estimation of runtime overhead. FEATURE_DIALOG_FEATURE_TABLE_COLUMN_NAME=Features @@ -112,4 +114,4 @@ SETTING_OPTION_AUTO_STOP=Auto-stop while replaying FEATURE_OVERHEAD_RANKING_NORMAL=This feature can cause normal overhead FEATURE_OVERHEAD_RANKING_MIDDLE=This feature can cause middle overhead FEATURE_OVERHEAD_RANKING_HIGH=This feature can cause high overhead -FEATURE_OVERHEAD_RANKING_INPUT_VALUE=The feature overhead may occur depending on the input value \ No newline at end of file +FEATURE_OVERHEAD_RANKING_INPUT_VALUE=The feature overhead may occur depending on the input value diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java index 24512fa..7344e14 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java @@ -99,6 +99,19 @@ public class TargetData { this.selectedFeatureList.addAll(selectedFeatureList); } + public void addSelectedFeature(String featureName) { + FeatureValueData featureValue = new FeatureValueData(Feature.getFeature(featureName)); + this.selectedFeatureList.add(featureValue); + } + + public void removeSelectedFeature(String featureName) { + + } + + public void clearSelectedFeature() { + this.selectedFeatureList.clear(); + } + public List getSelectedFeatureList() { return Collections.unmodifiableList(selectedFeatureList); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutKeyBindingHandler.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutKeyBindingHandler.java index 235eb7c..4b04288 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutKeyBindingHandler.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutKeyBindingHandler.java @@ -53,6 +53,7 @@ import org.tizen.dynamicanalyzer.ui.toolbar.SaveAsDialog; import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar; import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog; import org.tizen.dynamicanalyzer.ui.toolbar.replayEditor.ReplayEditDialog; +import org.tizen.dynamicanalyzer.ui.toolbar.setting.FlatFeatureDialog; import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog; import org.tizen.dynamicanalyzer.ui.userinterface.UIPage; import org.tizen.dynamicanalyzer.util.CommonUtil; @@ -97,6 +98,8 @@ public class ShortCutKeyBindingHandler extends AbstractHandler { Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell(); SettingDialog dialog = new SettingDialog(shell); dialog.open(); + FlatFeatureDialog featureDialog = new FlatFeatureDialog(shell); // FIXME + featureDialog.open(); } else if (e.keyCode == SWT.F3) { Logger.debug("view source toggle"); Toolbar.INSTANCE.toggleSourceView(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java index 4365edd..605a8d1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java @@ -65,6 +65,7 @@ import org.tizen.dynamicanalyzer.ui.summary.SummaryPage; import org.tizen.dynamicanalyzer.ui.thread.ThreadPage; 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.SettingDialog; import org.tizen.dynamicanalyzer.ui.userinterface.UIPage; import org.tizen.dynamicanalyzer.util.Logger; @@ -163,6 +164,8 @@ public class BaseView extends ViewPart { final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell(); SettingDialog dialog = new SettingDialog(shell); dialog.open(); + FlatFeatureDialog featureDialog = new FlatFeatureDialog(shell); // FIXME + featureDialog.open(); } }); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java index 038d760..4c70c3b 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java @@ -78,6 +78,7 @@ import org.tizen.dynamicanalyzer.ui.common.explorer.DeviceExplorerDialog; import org.tizen.dynamicanalyzer.ui.page.BaseView; import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog; import org.tizen.dynamicanalyzer.ui.toolbar.replayEditor.ReplayEditDialog; +import org.tizen.dynamicanalyzer.ui.toolbar.setting.FlatFeatureDialog; import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog; import org.tizen.dynamicanalyzer.util.Logger; import org.tizen.dynamicanalyzer.util.WorkbenchUtil; @@ -432,6 +433,8 @@ public enum Toolbar { Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell(); SettingDialog dialog = new SettingDialog(shell); // FIXME dialog.open(); + FlatFeatureDialog featureDialog = new FlatFeatureDialog(shell); // FIXME + featureDialog.open(); } }); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialog.java new file mode 100644 index 0000000..5178cf4 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialog.java @@ -0,0 +1,267 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Heeyoung Hwang + * Juyoung Kim + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + * + */ +package org.tizen.dynamicanalyzer.ui.toolbar.setting; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.events.ShellListener; +import org.eclipse.swt.graphics.Rectangle; +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.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.DAState; +import org.tizen.dynamicanalyzer.communicator.IDECommunicator; +import org.tizen.dynamicanalyzer.handlers.CommonAction; +import org.tizen.dynamicanalyzer.handlers.UIAction; +import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; +import org.tizen.dynamicanalyzer.nl.ConfigureLabels; +import org.tizen.dynamicanalyzer.nl.WidgetLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.setting.SettingDataManager; +import org.tizen.dynamicanalyzer.shortcut.ShortCutManager; +import org.tizen.dynamicanalyzer.util.Logger; +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; +import org.tizen.dynamicanalyzer.widgets.da.view.DABaseComposite; +import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite; +import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite; + +public class FlatFeatureDialog extends DAMessageBox { + private static boolean opened = false; + private DACustomButton cancelButton = null; + private DACustomButton okButton = null; + private boolean isApply = false; + + private FlatFeatureDialogPage featurePage = null; + + private Composite buttonContentsComp = null; + + public FlatFeatureDialog(Shell parentShell) { + super(parentShell); + } + + private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + /* + isApply = true; + doApply(); + doRun(); + */ + shell.close(); // close dialog + } + }; + + private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + /* + isApply = true; + doRevert(); + doRun(); + */ + shell.close(); // close dialog + } + }; + + private void doApply() { + if (DAState.isStartable()) { + // add & remove tab view page + UIAction.setPageBySetting(); + + // add & remove (timeline) chart + UIAction.setChartBySetting(); + + // write setting data + SettingDataManager.INSTANCE.applySettingData(); + } + } + + private void doRevert() { + // rollback setting data + SettingDataManager.INSTANCE.revertSettingData(); + } + + private void doRun() { + if (DAState.isStartable()) { + CommonAction.configure(); + } + } + + private void doWarningMessage() { + UIAction.showWarning(ConfigureLabels.SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE, + 550, 153); + } + + protected boolean run() { + if (opened) { + return false; + } + IDECommunicator.setOpenWelcomeDlg(true); + shell.setSize(900, 500); + shell.setLayout(new FormLayout()); + shell.setText(AnalyzerLabels.SETTING_TITLE); + shell.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + + + // content composite + Composite contentsComp = new Composite(shell, SWT.NONE); + FormLayout compLayout = new FormLayout(); + contentsComp.setLayout(compLayout); + contentsComp.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + + 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, -49); + contentsComp.setLayoutData(compData); + + featurePage = new FlatFeatureDialogPage(contentsComp, SWT.NONE); + + // button composite + buttonContentsComp = new Composite(shell, SWT.NONE); + compLayout = new FormLayout(); + buttonContentsComp.setLayout(compLayout); + buttonContentsComp + .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR); + compData = new FormData(); + compData.top = new FormAttachment(contentsComp, 0); + compData.left = new FormAttachment(0, 0); + compData.right = new FormAttachment(100, 0); + compData.bottom = new FormAttachment(100, 0); + buttonContentsComp.setLayoutData(compData); + buttonContentsComp.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + Composite comp = (Composite) e.widget; + Rectangle rect = comp.getClientArea(); + e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_1); + e.gc.drawLine(0, 0, rect.width - 1, 0); + e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_2); + e.gc.drawLine(0, 1, rect.width - 1, 1); + } + }); + + okButton = new DAButton(buttonContentsComp, SWT.NONE); + okButton.addClickListener(okButtonListener); + okButton.setText(WidgetLabels.OK); + okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT); + FormData buttonData = new FormData(); + buttonData.right = new FormAttachment(100, -9); + buttonData.top = new FormAttachment(0, 11); + buttonData.width = 100; + buttonData.height = 28; + okButton.setLayoutData(buttonData); + + cancelButton = new DAButton(buttonContentsComp, SWT.NONE); + cancelButton.addClickListener(cancelButtonListener); + cancelButton.setText(WidgetLabels.CANCEL); + cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT); + buttonData = new FormData(); + buttonData.right = new FormAttachment(okButton, -8); + buttonData.top = new FormAttachment(0, 11); + buttonData.width = 100; + buttonData.height = 28; + cancelButton.setLayoutData(buttonData); + + shell.addDisposeListener(new DisposeListener() { + + @Override + public void widgetDisposed(DisposeEvent e) { + opened = false; + ShortCutManager.getInstance().setEnabled(!opened); + } + + }); + + opened = true; + ShortCutManager.getInstance().setEnabled(!opened); + + shell.addShellListener(shellListener); + shell.open(); + return true; + } + + private void notifyAutoRun() { + synchronized (IDECommunicator.getWaitingWelcomeDlg()) { + IDECommunicator.setOpenWelcomeDlg(false); + IDECommunicator.getWaitingWelcomeDlg().notifyAll(); + } + } + + private ShellListener shellListener = new ShellListener() { + + @Override + public void shellActivated(ShellEvent e) { + // TODO Auto-generated method stub + } + + @Override + public void shellClosed(ShellEvent e) { + // TODO Auto-generated method stub + /* + if (!isApply) { + doRevert(); + doRun(); + } + notifyAutoRun(); + */ + } + + @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 + } + + }; +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialogPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialogPage.java new file mode 100644 index 0000000..e8aacea --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialogPage.java @@ -0,0 +1,698 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Heeyoung Hwang + * Juyoung Kim + * + * 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. + * + * Contributors: + * - S-Core Co., Ltd + * + */ +package org.tizen.dynamicanalyzer.ui.toolbar.setting; + +import java.util.List; +import java.util.Map; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +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.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.tizen.dynamicanalyzer.common.DAState; +import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; +import org.tizen.dynamicanalyzer.nl.ConfigureLabels; +import org.tizen.dynamicanalyzer.nl.WidgetLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.resources.ImageResources; +import org.tizen.dynamicanalyzer.setting.Feature; +import org.tizen.dynamicanalyzer.setting.FeatureData; +import org.tizen.dynamicanalyzer.setting.FeatureValueData; +import org.tizen.dynamicanalyzer.setting.SettingDataManager; +import org.tizen.dynamicanalyzer.setting.TargetData; +import org.tizen.dynamicanalyzer.setting.Template; +import org.tizen.dynamicanalyzer.setting.TemplateData; +import org.tizen.dynamicanalyzer.util.CommonUtil; +import org.tizen.dynamicanalyzer.util.WorkbenchUtil; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButton; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener; +import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton; +import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButtonGroup; +import org.tizen.dynamicanalyzer.widgets.da.base.DAButton; +import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite; + +public class FlatFeatureDialogPage extends DAPageComposite { + private enum ProfileDisplayInfo { + PROFILE_NAME_MOBILE(0, ConfigureLabels.TARGET_NAME_MOBILE, + ImageResources.TARGET_NAME_MOBILE), + PROFILE_NAME_TV(1, ConfigureLabels.TARGET_NAME_TV, ImageResources.TARGET_NAME_TV), + PROFILE_NAME_WEARABLE(2, ConfigureLabels.TARGET_NAME_WEARABLE, + ImageResources.TARGET_NAME_WEARABLE); + + private int id = -1; + private String displayName = null; + private Image image = null; + + private ProfileDisplayInfo(int id, String displayName, Image image) { + this.id = id; + this.displayName = displayName; + this.image = image; + } + + public static Image getImage(String displayName) { + ProfileDisplayInfo[] profiles = ProfileDisplayInfo.values(); + for (ProfileDisplayInfo profile : profiles) { + if (profile.displayName.equals(displayName)) { + return profile.image; + } + } + return null; + } + }; + + private enum FeatureDisplayInfo { + TEMPLATE_NAME_BOTTLENECK(0, ConfigureLabels.TEMPLATE_NAME_BOTTLENECK, + ImageResources.TEMPLATE_BOTTLENECK_ANALYSIS), + TEMPLATE_NAME_MEMORY_LEAKS(1, ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS, + ImageResources.TEMPLATE_MEMORY_LEAK), + TEMPLATE_NAME_PROCESS_ACTIVITY(2, ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY, + ImageResources.TEMPLATE_PROCESS_ACTIVITY), + TEMPLATE_NAME_FILE(3, ConfigureLabels.TEMPLATE_NAME_FILE, + ImageResources.TEMPLATE_FILE_ANALYSIS), + TEMPLATE_NAME_THREAD_ACTIVITY(4, ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY, + ImageResources.TEMPLATE_THREAD_ACTIVITY_ANALYSIS), + TEMPLATE_NAME_WAIT_STATUS(5, ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS, + ImageResources.TEMPLATE_WAIT_STATUS_ANALYSIS), + TEMPLATE_NAME_NETWORK(6, ConfigureLabels.TEMPLATE_NAME_NETWORK, + ImageResources.TEMPLATE_NETWORK_ANALYSIS), + TEMPLATE_NAME_OPEN_GL(7, ConfigureLabels.TEMPLATE_NAME_OPEN_GL, + ImageResources.TEMPLATE_OPEN_GL_ANALYSIS), + TEMPLATE_NAME_ENERGY(8, ConfigureLabels.TEMPLATE_NAME_ENERGY, + ImageResources.TEMPLATE_ENERGY), + TEMPLATE_NAME_HIERARCHY_VIEWER(9, ConfigureLabels.TEMPLATE_NAME_UI_HIERARCHY, + ImageResources.TEMPLATE_UI_HIERARCHY_ANALYSIS), + TEMPLATE_NAME_CUSTOM(10, ConfigureLabels.TEMPLATE_NAME_CUSTOM, + ImageResources.TEMPLATE_CUSTOM); + + private int id = -1; + private String displayName = null; + private Image image = null; + + private FeatureDisplayInfo(int id, String displayName, Image image) { + this.id = id; + this.displayName = displayName; + this.image = image; + } + + public static Image getImage(String displayName) { + FeatureDisplayInfo[] templates = FeatureDisplayInfo.values(); + for (FeatureDisplayInfo template : templates) { + if (template.displayName.equals(displayName)) { + return template.image; + } + } + return null; + } + }; + + // target widget + private Composite targetComp = null; + private Label targetLabel = null; + private ScrolledComposite targetScrolledComposite = null; + private Composite targetInputComposite = null; + + // feature list widget + private Composite featureListComp = null; + private Label featureListTitleLabel = null; + private Label featureIcon = null; + private Label featureNameLabel = null; + private Label featureDescriptionLabel = null; + private ScrolledComposite featureListScrolledComposite = null; + private Composite featureListInputComposite = null; + + // selected feature widget + private Composite selectedFeatureComp = null; + private Label selectedFeatureLabel = null; + private ScrolledComposite selectionScrolledComposite = null; + private Composite inputComposite = null; + + private DACustomButton detailButton = null; + + private DACustomButtonClickEventListener detailButtonListener = new DACustomButtonClickEventListener() { + + @Override + public void handleClickEvent(DACustomButton button) { + // show feature dialog + Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell(); + FeatureDialog dialog = new FeatureDialog(shell); + Object result = dialog.open(); + if (result != null) { + // update template page view + createFeatureListComposite(); + createFeatureSelectionComposite(); + } + } + }; + + public FlatFeatureDialogPage(Composite parent, int style) { + super(parent, style); + this.setLayout(new FormLayout()); + this.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + + createTargetComposite(); + createFeatureSelectionComposite(); + createFeatureListComposite(); + } + + private void initTargetCompositeWidget() { + if (null != targetLabel) { + targetLabel.dispose(); + targetLabel = null; + } + + if (null != targetScrolledComposite) { + targetScrolledComposite.dispose(); + targetScrolledComposite = null; + } + + if (null != targetInputComposite) { + targetInputComposite.dispose(); + targetInputComposite = null; + } + } + + private void initFeatureListWidget() { + if (null != featureListTitleLabel) { + featureListTitleLabel.dispose(); + featureListTitleLabel = null; + } + + if (null != featureIcon) { + featureIcon.dispose(); + featureIcon = null; + } + + if (null != featureNameLabel) { + featureNameLabel.dispose(); + featureNameLabel = null; + } + + if (null != featureDescriptionLabel) { + featureDescriptionLabel.dispose(); + featureDescriptionLabel = null; + } + + if (null != featureListScrolledComposite) { + featureListScrolledComposite.dispose(); + featureListScrolledComposite = null; + } + + if (null != featureListInputComposite) { + featureListInputComposite.dispose(); + featureListInputComposite = null; + } + } + + private void initFeatureSelectionWidget() { + if (null != selectedFeatureLabel) { + selectedFeatureLabel.dispose(); + selectedFeatureLabel = null; + } + + if (null != selectionScrolledComposite) { + selectionScrolledComposite.dispose(); + selectionScrolledComposite = null; + } + + if (null != inputComposite) { + inputComposite.dispose(); + inputComposite = null; + } + } + + private DACustomToggleButton createToggleButton(Composite composit, Image image, + Point imagePoint, String title, Point fontPoint, int width, int height, + int topPosition, int leftPosition) { + + DACustomToggleButton toggle = new DACustomToggleButton(composit, SWT.NONE); + + // color and image + if (image != null) { + toggle.setColors(ColorResources.SETTING_BUTTON_NORMAL_COLOR, + ColorResources.SETTING_BUTTON_PUSH_COLOR, + ColorResources.SETTING_BUTTON_HOVER_COLOR, + ColorResources.SETTING_BUTTON_DISABLE_COLOR, + ColorResources.SETTING_BUTTON_TOGGLE_NORMAL_COLOR, + ColorResources.SETTING_BUTTON_TOGGLE_HOVER_COLOR, + ColorResources.SETTING_BUTTON_TOGGLE_PUSH_COLOR); + toggle.setButtonImages(image, image, image, image, image, image, image); + } + toggle.setButtonImagePoint(imagePoint); + + // font + if (title != null) { + toggle.setTitle(title); + toggle.setFontPoint(fontPoint); + toggle.setFontColors(ColorResources.SETTING_COLOR, ColorResources.SETTING_COLOR, + ColorResources.SETTING_COLOR, ColorResources.SETTING_COLOR); + toggle.setButtonFont(FontResources.SETTING_BUTTON_FONT); + } + + // layout + FormData data = new FormData(); + data.top = new FormAttachment(0, topPosition); + data.left = new FormAttachment(0, leftPosition); + data.width = width; + data.height = height; + toggle.setLayoutData(data); + + return toggle; + } + + public void createTargetComposite() { + initTargetCompositeWidget(); + + // Composite + if (null == targetComp) { + targetComp = new Composite(this, SWT.NONE); + targetComp.setLayout(new FormLayout()); + FormData compData = new FormData(); + compData.top = new FormAttachment(0, 0); + compData.left = new FormAttachment(0, 0); + compData.width = 300; + compData.height = 500; + targetComp.setLayoutData(compData); + targetComp.setBackground(ColorResources.WHITE); + + targetComp.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + Composite comp = (Composite) e.widget; + Rectangle rect = comp.getClientArea(); + Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1); + e.gc.setForeground(ColorResources.SETTING_STROKE); + e.gc.drawRectangle(r); + e.gc.drawLine(0, 22, rect.width, 22); + /* + e.gc.setBackground(ColorResources.SETTING_TITLE_BACKGROUND); + e.gc.fillRectangle(1, 1, 100, 40); + */ + } + }); + } + + // label + targetLabel = new Label(targetComp, SWT.TRANSPARENT); + FormData data = new FormData(); + data.top = new FormAttachment(0, 4); + data.left = new FormAttachment(0, 1); + data.height = 18; + data.width = 84; + targetLabel.setLayoutData(data); + targetLabel.setText(ConfigureLabels.SETTING_DIALOG_TARGET_TITLE); + targetLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND); + targetLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR); + targetLabel.setFont(FontResources.SETTING_TITLE_FONT); + targetLabel.setAlignment(SWT.CENTER); + + // scrolledComposite + targetScrolledComposite = new ScrolledComposite(targetComp, SWT.BORDER | SWT.V_SCROLL + | SWT.H_SCROLL); + targetScrolledComposite.setLayout(new FormLayout()); + data = new FormData(); + data.top = new FormAttachment(targetLabel, 1); + data.left = new FormAttachment(0, 1); + data.right = new FormAttachment(100, -1); + data.bottom = new FormAttachment(100, -1); + targetScrolledComposite.setLayoutData(data); + targetScrolledComposite.setExpandHorizontal(true); + targetScrolledComposite.setExpandVertical(true); + targetScrolledComposite.setBackground(ColorResources.WHITE); + + // composite : input + targetInputComposite = new Composite(targetScrolledComposite, SWT.NONE); + targetScrolledComposite.setContent(targetInputComposite); + targetScrolledComposite.setMinSize(targetInputComposite.computeSize(SWT.DEFAULT, + SWT.DEFAULT)); + targetScrolledComposite.setShowFocusedControl(true); + targetInputComposite.setLayout(new FormLayout()); + data = new FormData(); + data.top = new FormAttachment(0, 1); + data.left = new FormAttachment(0, 1); + data.right = new FormAttachment(100, -1); + data.bottom = new FormAttachment(100, -1); + targetInputComposite.setLayoutData(data); + targetInputComposite.setBackground(ColorResources.WHITE); + + // ToogleButtonGroup + Map targetList = SettingDataManager.INSTANCE.getTargetListMap(); + String selectedTarget = SettingDataManager.INSTANCE.getConnectedTarget().getTargetName(); + SettingDataManager.INSTANCE.setSelectedTarget(selectedTarget); + DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup(); + Point imagePoint = new Point(18, 8); + Point fontPoint = new Point(-1, 60); + int topPosition = 4; + int leftPosition = 3; + + for (Map.Entry entry : targetList.entrySet()) { + TargetData target = entry.getValue(); + + DACustomToggleButton toggle = createToggleButton(targetInputComposite, + ProfileDisplayInfo.getImage(target.getTargetName()), imagePoint, + target.getTargetName(), fontPoint, 76, 76, topPosition, leftPosition); + targetGroup.addToggleButton(toggle); + + // listener + toggle.addListener(SWT.MouseUp, new Listener() { + + @Override + public void handleEvent(Event event) { + DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget; + if (toggleButton.isToggled()) { + + // set selected target + SettingDataManager.INSTANCE.setSelectedTarget(toggleButton.getText()); + + // update template view + createFeatureListComposite(); + createFeatureSelectionComposite(); + } + } + }); + + // set next position + topPosition += 80; + + // set selection target + if (selectedTarget.equals(entry.getKey()) == true) { + targetGroup.setSelection(toggle); + } + } + targetComp.layout(true); + targetInputComposite.layout(); + targetScrolledComposite.setMinSize(targetInputComposite.computeSize(SWT.DEFAULT, + SWT.DEFAULT)); + + if (!DAState.isStartable()) { + targetComp.setEnabled(false); + } + } + + public void createFeatureListComposite() { + initFeatureListWidget(); + + if (null == featureListComp) { + + // Composite + featureListComp = new Composite(this, SWT.NONE); + featureListComp.setLayout(new FormLayout()); + FormData compData = new FormData(); + compData.top = new FormAttachment(0, 0); + compData.left = new FormAttachment(0, 300); + compData.width = 300; + compData.height = 500; + featureListComp.setLayoutData(compData); + featureListComp.setBackground(ColorResources.WHITE); + + featureListComp.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + Composite comp = (Composite) e.widget; + Rectangle rect = comp.getClientArea(); + Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1); + e.gc.setForeground(ColorResources.SETTING_STROKE); + e.gc.drawRectangle(r); + e.gc.drawLine(0, 22, rect.width, 22); + } + }); + } + + // label + featureListTitleLabel = new Label(featureListComp, SWT.TRANSPARENT); + FormData data = new FormData(); + data.top = new FormAttachment(0, 4); + data.left = new FormAttachment(0, 1); + data.height = 18; + data.width = 300; + featureListTitleLabel.setLayoutData(data); + featureListTitleLabel.setText(ConfigureLabels.SETTING_DIALOG_FEATURELIST_TITLE); + featureListTitleLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND); + featureListTitleLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR); + featureListTitleLabel.setFont(FontResources.SETTING_TITLE_FONT); + featureListTitleLabel.setAlignment(SWT.CENTER); + + // featureListScrolledComposite + featureListScrolledComposite = new ScrolledComposite(featureListComp, SWT.BORDER | SWT.V_SCROLL + | SWT.H_SCROLL); + featureListScrolledComposite.setLayout(new FormLayout()); + data = new FormData(); + data.top = new FormAttachment(featureListTitleLabel, 1); + data.left = new FormAttachment(0, 1); + data.right = new FormAttachment(100, -1); + data.bottom = new FormAttachment(100, -1); + featureListScrolledComposite.setLayoutData(data); + featureListScrolledComposite.setExpandHorizontal(true); + featureListScrolledComposite.setExpandVertical(true); + featureListScrolledComposite.setBackground(ColorResources.WHITE); + + // composite : input + featureListInputComposite = new Composite(featureListScrolledComposite, SWT.NONE); + featureListScrolledComposite.setContent(featureListInputComposite); + featureListScrolledComposite.setMinSize(featureListInputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + featureListScrolledComposite.setShowFocusedControl(true); + featureListInputComposite.setLayout(new FormLayout()); + data = new FormData(); + data.top = new FormAttachment(0, 1); + data.left = new FormAttachment(0, 1); + data.right = new FormAttachment(100, -1); + data.bottom = new FormAttachment(100, -1); + featureListInputComposite.setLayoutData(data); + featureListInputComposite.setBackground(ColorResources.WHITE); + + // ToogleButtonGroup + String selectedTarget = SettingDataManager.INSTANCE.getSelectedTarget(); + DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup(); + Point imagePoint = new Point(23, 8); + Point fontPoint = new Point(-1, 60); + int defaultLeftPosition = 21; // linux, mac + if (CommonUtil.isWin()) { + defaultLeftPosition = 13; + } + + int topPosition = 4; + int leftPosition = defaultLeftPosition; + + TargetData target = SettingDataManager.INSTANCE.getTarget(selectedTarget); + //Template featureListTemplate = target.getSelectedTemplate(); + List featureList = target.getAvailableFeatureList(); + target.clearSelectedFeature(); + for (int i = 0; i < featureList.size(); i++) { + FeatureData feature = featureList.get(i).getData(); + // todo: FeatureDisplayInfo organise + // todo: FeatureList needs multiple selection, replace toggle buttons. + DACustomToggleButton toggle = createToggleButton(featureListInputComposite, + FeatureDisplayInfo.getImage(feature.getFeatureName()), imagePoint, + feature.getFeatureName(), fontPoint, 92, 76, topPosition, leftPosition); + targetGroup.addToggleButton(toggle); + + // listener + toggle.addListener(SWT.MouseUp, new Listener() { + + @Override + public void handleEvent(Event event) { + DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget; + if (toggleButton.isToggled()) { + // set select feature + // todo: add/remove selectedfeature as button status + TargetData target = SettingDataManager.INSTANCE.getTarget(null); + target.addSelectedFeature(toggleButton.getText()); + + createFeatureSelectionComposite(); + } + } + }); + + // set next position + if (leftPosition + 96 < 480) { + leftPosition += 96; + } else { + leftPosition = defaultLeftPosition; + topPosition += 79; + } + + // set selection template + //if (templateList.get(i).equals(featureListTemplate)) { + // targetGroup.setSelection(toggle); + //} + } + + featureListComp.layout(true); + } + + public void createFeatureSelectionComposite() { + initFeatureSelectionWidget(); + + // Composite + if (null == selectedFeatureComp) { + selectedFeatureComp = new Composite(this, SWT.NONE); + selectedFeatureComp.setLayout(new FormLayout()); + FormData compData = new FormData(); + compData.top = new FormAttachment(0, 0); + compData.left = new FormAttachment(0, 600); + compData.width = 300; + compData.height = 500; + selectedFeatureComp.setLayoutData(compData); + selectedFeatureComp.setBackground(ColorResources.WHITE); + + selectedFeatureComp.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + Composite comp = (Composite) e.widget; + Rectangle rect = comp.getClientArea(); + Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1); + e.gc.setForeground(ColorResources.SETTING_STROKE); + e.gc.drawRectangle(r); + e.gc.drawLine(0, 22, rect.width, 22); + + e.gc.setBackground(ColorResources.SETTING_TITLE_BACKGROUND); + e.gc.fillRectangle(1, 1, 522, 21); + + } + }); + } + + // label : selected feature + selectedFeatureLabel = new Label(selectedFeatureComp, SWT.TRANSPARENT); + FormData data = new FormData(); + data.top = new FormAttachment(0, 4); + data.left = new FormAttachment(0, 1); + data.height = 18; + data.width = 300; + selectedFeatureLabel.setLayoutData(data); + selectedFeatureLabel.setText(ConfigureLabels.SETTING_DIALOG_SELECTED_TITLE); + selectedFeatureLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND); + selectedFeatureLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR); + selectedFeatureLabel.setFont(FontResources.SETTING_TITLE_FONT); + selectedFeatureLabel.setAlignment(SWT.CENTER); + + // selectionScrolledComposite + selectionScrolledComposite = new ScrolledComposite(selectedFeatureComp, SWT.BORDER | SWT.V_SCROLL + | SWT.H_SCROLL); + selectionScrolledComposite.setLayout(new FormLayout()); + data = new FormData(); + data.top = new FormAttachment(selectedFeatureLabel, 1); + data.left = new FormAttachment(0, 1); + data.right = new FormAttachment(100, -1); + data.bottom = new FormAttachment(100, -1); + selectionScrolledComposite.setLayoutData(data); + selectionScrolledComposite.setExpandHorizontal(true); + selectionScrolledComposite.setExpandVertical(true); + selectionScrolledComposite.setBackground(ColorResources.WHITE); + + // composite : input + inputComposite = new Composite(selectionScrolledComposite, SWT.NONE); + selectionScrolledComposite.setContent(inputComposite); + selectionScrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + selectionScrolledComposite.setShowFocusedControl(true); + inputComposite.setLayout(new FormLayout()); + data = new FormData(); + data.top = new FormAttachment(0, 1); + data.left = new FormAttachment(0, 1); + data.right = new FormAttachment(100, -1); + data.bottom = new FormAttachment(100, -1); + inputComposite.setLayoutData(data); + inputComposite.setBackground(ColorResources.WHITE); + + // ToogleButtonGroup + DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup(); + + Point imagePoint = new Point(23, 8); + Point fontPoint = new Point(-1, 60); + int defaultLeftPosition = 21; // linux, mac + if (CommonUtil.isWin()) { + defaultLeftPosition = 13; + } + int topPosition = 4; + int leftPosition = defaultLeftPosition; + + String selectedTarget = SettingDataManager.INSTANCE.getSelectedTarget(); + TargetData target = SettingDataManager.INSTANCE.getTarget(selectedTarget); + //Template featureListTemplate = target.getSelectedTemplate(); + List featureList = target.getSelectedFeatureList(); + for (int i = 0; i < featureList.size(); i++) { + Feature feature = featureList.get(i).getKey(); + // todo: FeatureDisplayInfo organise + // todo: selectedFeature needs cancel button, replace toggle + DACustomToggleButton toggle = createToggleButton(inputComposite, + FeatureDisplayInfo.getImage(feature.getName()), imagePoint, + feature.getName(), fontPoint, 92, 76, topPosition, leftPosition); + targetGroup.addToggleButton(toggle); + + // listener + toggle.addListener(SWT.MouseUp, new Listener() { + + @Override + public void handleEvent(Event event) { + DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget; + if (toggleButton.isToggled()) { + // set select feature + // todo: add/remove selectedfeature as button status + TargetData target = SettingDataManager.INSTANCE.getTarget(null); + target.addSelectedFeature(toggleButton.getText()); + + createFeatureSelectionComposite(); + } + } + }); + + // set next position + if (leftPosition + 96 < 480) { + leftPosition += 96; + } else { + leftPosition = defaultLeftPosition; + topPosition += 79; + } + + // set selection template + //if (templateList.get(i).equals(featureListTemplate)) { + // targetGroup.setSelection(toggle); + //} + } + + selectedFeatureComp.layout(true); + inputComposite.layout(); + selectionScrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + if (!DAState.isStartable()) { + selectedFeatureComp.setEnabled(false); + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java index b8d4016..c2af27e 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java @@ -207,7 +207,6 @@ public class SettingDialog extends DAMessageBox { templatesPage = new SettingDialogTemplatePage(tabView.getContentComposite(), SWT.NONE); tabView.addView(templatesPage, false); - optionPage = new SettingDialogOptionPage(tabView.getContentComposite(), SWT.NONE); tabView.addView(optionPage, false); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java index f0b5608..c8dd432 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java @@ -63,24 +63,24 @@ import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButtonGroup import org.tizen.dynamicanalyzer.widgets.da.base.DAButton; import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite; -public class SettingDialogTemplatePage extends DAPageComposite { +public class SettingDialogTemplatePage extends DAPageComposite { private enum ProfileDisplayInfo { PROFILE_NAME_MOBILE(0, ConfigureLabels.TARGET_NAME_MOBILE, ImageResources.TARGET_NAME_MOBILE), PROFILE_NAME_TV(1, ConfigureLabels.TARGET_NAME_TV, ImageResources.TARGET_NAME_TV), PROFILE_NAME_WEARABLE(2, ConfigureLabels.TARGET_NAME_WEARABLE, ImageResources.TARGET_NAME_WEARABLE); - + private int id = -1; private String displayName = null; private Image image = null; - + private ProfileDisplayInfo(int id, String displayName, Image image) { this.id = id; this.displayName = displayName; this.image = image; } - + public static Image getImage(String displayName) { ProfileDisplayInfo[] profiles = ProfileDisplayInfo.values(); for (ProfileDisplayInfo profile : profiles) { @@ -91,41 +91,41 @@ public class SettingDialogTemplatePage extends DAPageComposite { return null; } }; - + private enum TemplateDisplayInfo { - TEMPLATE_NAME_BOTTLENECK(0, ConfigureLabels.TEMPLATE_NAME_BOTTLENECK, + TEMPLATE_NAME_BOTTLENECK(0, ConfigureLabels.TEMPLATE_NAME_BOTTLENECK, ImageResources.TEMPLATE_BOTTLENECK_ANALYSIS), - TEMPLATE_NAME_MEMORY_LEAKS(1, ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS, + TEMPLATE_NAME_MEMORY_LEAKS(1, ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS, ImageResources.TEMPLATE_MEMORY_LEAK), - TEMPLATE_NAME_PROCESS_ACTIVITY(2, ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY, + TEMPLATE_NAME_PROCESS_ACTIVITY(2, ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY, ImageResources.TEMPLATE_PROCESS_ACTIVITY), - TEMPLATE_NAME_FILE(3, ConfigureLabels.TEMPLATE_NAME_FILE, + TEMPLATE_NAME_FILE(3, ConfigureLabels.TEMPLATE_NAME_FILE, ImageResources.TEMPLATE_FILE_ANALYSIS), - TEMPLATE_NAME_THREAD_ACTIVITY(4, ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY, + TEMPLATE_NAME_THREAD_ACTIVITY(4, ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY, ImageResources.TEMPLATE_THREAD_ACTIVITY_ANALYSIS), - TEMPLATE_NAME_WAIT_STATUS(5, ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS, + TEMPLATE_NAME_WAIT_STATUS(5, ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS, ImageResources.TEMPLATE_WAIT_STATUS_ANALYSIS), - TEMPLATE_NAME_NETWORK(6, ConfigureLabels.TEMPLATE_NAME_NETWORK, + TEMPLATE_NAME_NETWORK(6, ConfigureLabels.TEMPLATE_NAME_NETWORK, ImageResources.TEMPLATE_NETWORK_ANALYSIS), - TEMPLATE_NAME_OPEN_GL(7, ConfigureLabels.TEMPLATE_NAME_OPEN_GL, + TEMPLATE_NAME_OPEN_GL(7, ConfigureLabels.TEMPLATE_NAME_OPEN_GL, ImageResources.TEMPLATE_OPEN_GL_ANALYSIS), - TEMPLATE_NAME_ENERGY(8, ConfigureLabels.TEMPLATE_NAME_ENERGY, + TEMPLATE_NAME_ENERGY(8, ConfigureLabels.TEMPLATE_NAME_ENERGY, ImageResources.TEMPLATE_ENERGY), TEMPLATE_NAME_HIERARCHY_VIEWER(9, ConfigureLabels.TEMPLATE_NAME_UI_HIERARCHY, ImageResources.TEMPLATE_UI_HIERARCHY_ANALYSIS), TEMPLATE_NAME_CUSTOM(10, ConfigureLabels.TEMPLATE_NAME_CUSTOM, ImageResources.TEMPLATE_CUSTOM); - + private int id = -1; private String displayName = null; private Image image = null; - + private TemplateDisplayInfo(int id, String displayName, Image image) { this.id = id; this.displayName = displayName; this.image = image; } - + public static Image getImage(String displayName) { TemplateDisplayInfo[] templates = TemplateDisplayInfo.values(); for (TemplateDisplayInfo template : templates) { @@ -162,6 +162,8 @@ public class SettingDialogTemplatePage extends DAPageComposite { private DACustomButton detailButton = null; + private SettingDialogTemplatePage me = null; + private DACustomButtonClickEventListener detailButtonListener = new DACustomButtonClickEventListener() { @Override @@ -171,7 +173,6 @@ public class SettingDialogTemplatePage extends DAPageComposite { FeatureDialog dialog = new FeatureDialog(shell); Object result = dialog.open(); if (result != null) { - // update template page view createTemplateTitleComposite(); createTemplateDescriptionComposite(); } @@ -395,7 +396,7 @@ public class SettingDialogTemplatePage extends DAPageComposite { TargetData target = entry.getValue(); DACustomToggleButton toggle = createToggleButton(targetInputComposite, - ProfileDisplayInfo.getImage(target.getTargetName()), imagePoint, + ProfileDisplayInfo.getImage(target.getTargetName()), imagePoint, target.getTargetName(), fontPoint, 76, 76, topPosition, leftPosition); targetGroup.addToggleButton(toggle); @@ -661,7 +662,6 @@ public class SettingDialogTemplatePage extends DAPageComposite { if (CommonUtil.isWin()) { defaultLeftPosition = 13; } - int topPosition = 4; int leftPosition = defaultLeftPosition; @@ -686,7 +686,7 @@ public class SettingDialogTemplatePage extends DAPageComposite { TargetData target = SettingDataManager.INSTANCE.getTarget(null); String preSelectedTemplate = target.getSelectedTemplate().getName(); - // template change + // TODO : redefine custom template usage if (!preSelectedTemplate.equals(toggleButton.getText())) { Template template = Template.getTemplate(toggleButton.getText()); target.setSelectedTemplate(template); -- 2.7.4