From: heeyoung Date: Mon, 20 Oct 2014 08:44:11 +0000 (+0900) Subject: Setting : modify options tab in setting dialog X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4b760873b30146f893343b094c47aede32c5146;p=sdk%2Ftools%2Fdynamic-analyzer.git Setting : modify options tab in setting dialog Change-Id: Id1f8f3ef75b2fa53330195646711cb9740e00a26 Signed-off-by: heeyoung --- diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/feature b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/feature index a78aabf..4769943 100644 --- a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/feature +++ b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/feature @@ -14,11 +14,7 @@ mobile-2.3|File analysis|0||Description : File analysis|File|||||1040||1 mobile-2.3|Thread analysis|0||Description : Thread analysis|Thread|||||32|128|1 mobile-2.3|Network analysis|0||Description : Network analysis|Network|||||131072||1 mobile-2.3|OpenGL ES analysis|0||Description : OpenGL ES analysis|OpenGL|||||262144||1 -mobile-2.3|Screenshot|0||Description : Screenshot|Timeline|Screenshot||||128||1 -mobile-2.3|On scene transition|2|Screenshot|Description : On scene transition|||||1||| -mobile-2.3|periodically|2|Screenshot|Description : periodically|||1|100|10||| mobile-2.3|UI event|0||Description : UI event|Timeline|UI event||||256||1 -mobile-2.3|Recording|0||Description : Recording||||||512||1 mobile-2.3|Context switch|0||Description : Context switch|Kernel|||||65536||1 mobile-2.3|System call|0||Description : System call|||||||| mobile-2.3|System call file|1|System call|Description : System call file|Timeline|||||1024||1 @@ -49,11 +45,7 @@ wearable-2.3|File analysis|0||Description : File analysis|File|||||1040||1 wearable-2.3|Thread analysis|0||Description : Thread analysis|Thread|||||32|128|1 wearable-2.3|Network analysis|0||Description : Network analysis|Network|||||131072||1 wearable-2.3|OpenGL ES analysis|0||Description : OpenGL ES analysis|OpenGL|||||262144||1 -wearable-2.3|Screenshot|0||Description : Screenshot|Timeline|Screenshot||||128||1 -wearable-2.3|On scene transition|2|Screenshot|Description : On scene transition|||||1||| -wearable-2.3|periodically|2|Screenshot|Description : periodically|||1|100|10||| wearable-2.3|UI event|0||Description : UI event|Timeline|UI event||||256||1 -wearable-2.3|Recording|0||Description : Recording||||||512||1 wearable-2.3|Context switch|0||Description : Context switch|Kernel|||||65536||1 wearable-2.3|System call|0||Description : System call|||||||| wearable-2.3|System call file|1|System call|Description : System call file|Timeline|||||1024||1 @@ -84,11 +76,7 @@ tv-1.0|File analysis|0||Description : File analysis|File|||||1040||1 tv-1.0|Thread analysis|0||Description : Thread analysis|Thread|||||32|128|1 tv-1.0|Network analysis|0||Description : Network analysis|Network|||||131072||1 tv-1.0|OpenGL ES analysis|0||Description : OpenGL ES analysis|OpenGL|||||262144||1 -tv-1.0|Screenshot|0||Description : Screenshot|Timeline|Screenshot||||128||1 -tv-1.0|On scene transition|2|Screenshot|Description : On scene transition|||||1||| -tv-1.0|periodically|2|Screenshot|Description : periodically|||1|100|10||| tv-1.0|UI event|0||Description : UI event|Timeline|UI event||||256||1 -tv-1.0|Recording|0||Description : Recording||||||512||1 tv-1.0|Context switch|0||Description : Context switch|Kernel|||||65536||1 tv-1.0|System call|0||Description : System call|||||||| tv-1.0|System call file|1|System call|Description : System call file|Timeline|||||1024||1 @@ -102,4 +90,4 @@ tv-1.0|Inside the platform memory|1|Inside the platform|Description : Inside the tv-1.0|Inside the platform file|1|Inside the platform|Description : Inside the platform file|File|||||536870912||1 tv-1.0|Inside the platform thread|1|Inside the platform|Description : Inside the platform thread|Thread|||||1073741824||1 tv-1.0|Inside the platform network|1|Inside the platform|Description : Inside the platform network|Network||||||1|1 -tv-1.0|Inside the platform openGL|1|Inside the platform|Description : Inside the platform openGL|OpenGL||||||2|1 +tv-1.0|Inside the platform openGL|1|Inside the platform|Description : Inside the platform openGL|OpenGL||||||2|1 \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/setting b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/setting index 9424093..5a4f61f 100644 --- a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/setting +++ b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/setting @@ -1,11 +1,14 @@ Version|0.1 Target List|mobile-2.3|wearable-2.3|tv-1.0 Selected Target|mobile-2.3 -Selected Chart List|CPU|CPU core|CPU frequency +Selected Chart List|CPU frequency|CPU|CPU core Show Initial|false Auto Stop|false Default Chart List|CPU|CPU core|CPU frequency Default Swap Value|0|80 +Feature|Recording||0|0|0|512|0|1|true|0 +Feature|On scene transition|Screenshot|0|0|0|128|0|1|false|0 +Feature|periodically|Screenshot|1|100|1|0|0|1|false|0 Selected Template|mobile-2.3|Bottleneck Selected FeatureList|mobile-2.3|System|System processes|System information sampling periodic:1000|Function profiling|Function sampling|Function profiling sampling periodic:10 Available Chart List|mobile-2.3|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy @@ -14,4 +17,4 @@ Selected FeatureList|wearable-2.3|System|System processes|System information sam Available Chart List|wearable-2.3|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy Selected Template|tv-1.0|Bottleneck Selected FeatureList|tv-1.0|System|System processes|System information sampling periodic:1000|Function profiling|Function sampling|Function profiling sampling periodic:10 -Available Chart List|tv-1.0|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy +Available Chart List|tv-1.0|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/template b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/template index 5d396ab..b07f380 100644 --- a/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/template +++ b/org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/config/template @@ -5,7 +5,7 @@ mobile-2.3|File|This template shows the operations(open, close, read, write and mobile-2.3|Thread Activity|This template measures CPU usage of threads, visualizes life-cycle of each thread and relationship between threads. It also analyzes critical section duration and waiting time of synchronization objects.|System|System processes|System information sampling periodic:1000|Thread analysis mobile-2.3|Wait Status|This template shows various information that cause the process become wait status. With the CPU and process chart, you can distinguish the process is in busy status or wait status. If the process is waiting for the IO operation or lock, you can check it in the Network, File, and Thread analysis pages. |System|System processes|System network|System disk|System information sampling periodic:1000|Thread analysis|Network analysis|File analysis mobile-2.3|Network|This template shows the TCP/UDP network activity of the glibc socket. The Network chart shows each session information. And you can check which API has been called in each session and can see the transmitted data, too.|System|System network|System information sampling periodic:1000|Network analysis -mobile-2.3|OpenGL|This template shows a lot of detailed information of the openGL layer. It shows the FPS, render state, openGL calls, statistics and redundant usage of the API. These help you to optimize the performance of your application. We are supporting OpenGL ES 2.0 and EvasGL, now.|System|System processes|System information sampling periodic:1000|Function profiling|Screenshot|periodically:10|OpenGL ES analysis +mobile-2.3|OpenGL|This template shows a lot of detailed information of the openGL layer. It shows the FPS, render state, openGL calls, statistics and redundant usage of the API. These help you to optimize the performance of your application. We are supporting OpenGL ES 2.0 and EvasGL, now.|System|System processes|System information sampling periodic:1000|Function profiling|OpenGL ES analysis mobile-2.3|Energy|This template inform you of power consumption of target device. you can see this information from Energy chart in Timeline page. Energy chart shows usage of Flash memory, CPU, LCD.|System|System processes|System memory|System energy|System information sampling periodic:1000 mobile-2.3|Custom|This template can be configured by selecting the desired features. If you change the feature in the other template will change custom template. wearable-2.3|Bottleneck|This template shows where can be the most bottleneck point while you are using your program. With the CPU and process chart, you can easily find where the application uses the CPU a lot. And the function profiling and call trace information shows the bottleneck point with the view of function level.|System|System processes|System information sampling periodic:1000|Function profiling|Function sampling|Function profiling sampling periodic:10 @@ -15,7 +15,7 @@ wearable-2.3|File|This template shows the operations(open, close, read, write an wearable-2.3|Thread Activity|This template measures CPU usage of threads, visualizes life-cycle of each thread and relationship between threads. It also analyzes critical section duration and waiting time of synchronization objects.|System|System processes|System information sampling periodic:1000|Thread analysis wearable-2.3|Wait Status|This template shows various information that cause the process become wait status. With the CPU and process chart, you can distinguish the process is in busy status or wait status. If the process is waiting for the IO operation or lock, you can check it in the Network, File, and Thread analysis pages. |System|System processes|System network|System disk|System information sampling periodic:1000|Thread analysis|Network analysis|File analysis wearable-2.3|Network|This template shows the TCP/UDP network activity of the glibc socket. The Network chart shows each session information. And you can check which API has been called in each session and can see the transmitted data, too.|System|System network|System information sampling periodic:1000|Network analysis -wearable-2.3|OpenGL|This template shows a lot of detailed information of the openGL layer. It shows the FPS, render state, openGL calls, statistics and redundant usage of the API. These help you to optimize the performance of your application. We are supporting OpenGL ES 2.0 and EvasGL, now.|System|System processes|System information sampling periodic:1000|Function profiling|Screenshot|periodically:10|OpenGL ES analysis +wearable-2.3|OpenGL|This template shows a lot of detailed information of the openGL layer. It shows the FPS, render state, openGL calls, statistics and redundant usage of the API. These help you to optimize the performance of your application. We are supporting OpenGL ES 2.0 and EvasGL, now.|System|System processes|System information sampling periodic:1000|Function profiling|OpenGL ES analysis wearable-2.3|Energy|This template inform you of power consumption of target device. you can see this information from Energy chart in Timeline page. Energy chart shows usage of Flash memory, CPU, LCD.|System|System processes|System memory|System energy|System information sampling periodic:1000 wearable-2.3|Custom|This template can be configured by selecting the desired features. If you change the feature in the other template will change custom template. tv-1.0|Bottleneck|This template shows where can be the most bottleneck point while you are using your program. With the CPU and process chart, you can easily find where the application uses the CPU a lot. And the function profiling and call trace information shows the bottleneck point with the view of function level.|System|System processes|System information sampling periodic:1000|Function profiling|Function sampling|Function profiling sampling periodic:10 @@ -25,6 +25,6 @@ tv-1.0|File|This template shows the operations(open, close, read, write and lock tv-1.0|Thread Activity|This template measures CPU usage of threads, visualizes life-cycle of each thread and relationship between threads. It also analyzes critical section duration and waiting time of synchronization objects.|System|System processes|System information sampling periodic:1000|Thread analysis tv-1.0|Wait Status|This template shows various information that cause the process become wait status. With the CPU and process chart, you can distinguish the process is in busy status or wait status. If the process is waiting for the IO operation or lock, you can check it in the Network, File, and Thread analysis pages. |System|System processes|System network|System disk|System information sampling periodic:1000|Thread analysis|Network analysis|File analysis tv-1.0|Network|This template shows the TCP/UDP network activity of the glibc socket. The Network chart shows each session information. And you can check which API has been called in each session and can see the transmitted data, too.|System|System network|System information sampling periodic:1000|Network analysis -tv-1.0|OpenGL|This template shows a lot of detailed information of the openGL layer. It shows the FPS, render state, openGL calls, statistics and redundant usage of the API. These help you to optimize the performance of your application. We are supporting OpenGL ES 2.0 and EvasGL, now.|System|System processes|System information sampling periodic:1000|Function profiling|Screenshot|periodically:10|OpenGL ES analysis +tv-1.0|OpenGL|This template shows a lot of detailed information of the openGL layer. It shows the FPS, render state, openGL calls, statistics and redundant usage of the API. These help you to optimize the performance of your application. We are supporting OpenGL ES 2.0 and EvasGL, now.|System|System processes|System information sampling periodic:1000|Function profiling|OpenGL ES analysis tv-1.0|Energy|This template inform you of power consumption of target device. you can see this information from Energy chart in Timeline page. Energy chart shows usage of Flash memory, CPU, LCD.|System|System processes|System memory|System energy|System information sampling periodic:1000 tv-1.0|Custom|This template can be configured by selecting the desired features. If you change the feature in the other template will change custom template. 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 83a7d8c..30925ca 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PostWindowOpenCallback.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PostWindowOpenCallback.java @@ -27,9 +27,7 @@ package org.tizen.dynamicanalyzer.common; import org.eclipse.swt.widgets.Shell; import org.tizen.dynamicanalyzer.callback.IExecutionCallback; -import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDataManager; import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog; -import org.tizen.dynamicanalyzer.ui.toolbar.setting.WelcomeDialog; import org.tizen.dynamicanalyzer.util.Logger; import org.tizen.dynamicanalyzer.util.WorkbenchUtil; @@ -39,7 +37,7 @@ public class PostWindowOpenCallback implements IExecutionCallback { // HIDDEN SETTING WIDGET (CHECKBOX, BUTTON) // if (!SettingDataManager.getInstance().isShowInitial()) { final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell(); - SettingDialog dialog = new SettingDialog(shell); // FIXME + SettingDialog dialog = new SettingDialog(shell); Logger.performance("TEST", "DA Start", "Welcome Dialog"); dialog.open(); // } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties index bdb8f74..0d45be1 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties @@ -96,7 +96,7 @@ COOLBAR_AREA_KERNEL_TOOLTIP_MAC=Kernel [Command + 7] COOLBAR_AREA_CONFIGURATION_FEATURES=Features COOLBAR_AREA_CONFIGURATION_SETTING=Configuration -COOLBAR_AREA_CONFIGURATION_OPTION=Option +COOLBAR_AREA_CONFIGURATION_OPTION=Options LICENSE_DIALOG_NOT_FOUND=License file not found 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 c703a52..e929d1a 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java @@ -51,12 +51,16 @@ public class ConfigureLabels extends NLS { public static String SETTING_DIALOG_OVERHEAD_FIRST; public static String SETTING_DIALOG_OVERHEAD_LAST; + public static String SETTING_DIALOG_RECORDING_REPLAY; + public static String SETTING_DIALOG_SCREENSHOT; + public static String FEATURE_DIALOG_HEADER_TITLE; public static String FEATURE_DIALOG_DESCRIPTION; public static String FEATURE_DIALOG_FEATURE_TABLE_COLUMN_NAME; public static String SETTING_WARNING_MESSAGE_FILE_NOT_FOUND; public static String SETTING_WARNING_MESSAGE_SETTING_FAIL; + public static String SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE; public static String TARGET_NAME_MOBILE_2_3; public static String TARGET_NAME_TV_1_0; 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 bd3352f..42947a9 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties @@ -6,6 +6,7 @@ SETTING_OPTION_TAB_DESCRIPTION=Configuration settings SETTING_WARNING_MESSAGE_FILE_NOT_FOUND=Setting file not found SETTING_WARNING_MESSAGE_SETTING_FAIL=Start Trace Setting failed.. +SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE=You have entered an invalid value. FEATURE_FUNCTION_PROFILING=Function profiling FEATURE_FUNCTION_SAMPLING=Function sampling @@ -92,6 +93,8 @@ SETTING_DIALOG_TEMPLATE_TITLE=Template SETTING_DIALOG_OVERHEAD_FIRST=We expect X SETTING_DIALOG_OVERHEAD_LAST=overhead FEATURE_DIALOG_FEATURE_TABLE_COLUMN_NAME=Features +SETTING_DIALOG_RECORDING_REPLAY=Recording / Replay +SETTING_DIALOG_SCREENSHOT=Screenshot TARGET_NAME_MOBILE_2_3=mobile-2.3 TARGET_NAME_TV_1_0=tv-1.0 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureData.java index 5d24c38..f7fbf2a 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureData.java @@ -69,6 +69,10 @@ public class FeatureData { this.featureName = featureName; } + public FeatureData(String featureName) { + this.featureName = featureName; + } + public String getTargetName() { return targetName; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureValueData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureValueData.java index 173e1f3..c8feaee 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureValueData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureValueData.java @@ -30,6 +30,14 @@ public class FeatureValueData { private String featureName = null; private int value = 0; + public FeatureValueData() { + } + + public FeatureValueData(FeatureValueData featureValueData) { + this.featureName = featureValueData.getFeatureName(); + this.value = featureValueData.getValue(); + } + public String getFeatureName() { return featureName; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDataManager.java index 39fc62c..7aa5dc0 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDataManager.java @@ -34,6 +34,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -43,10 +44,8 @@ import java.util.Set; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.Global; import org.tizen.dynamicanalyzer.common.path.PathManager; -import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.model.DeviceInfo; -import org.tizen.dynamicanalyzer.nl.ConfigureLabels; import org.tizen.dynamicanalyzer.util.CommonUtil; import org.tizen.dynamicanalyzer.util.Logger; @@ -72,14 +71,28 @@ public class SettingDataManager { public static final String KEY_SELECTED_CHART_LIST = "Selected Chart List"; public static final String KEY_SHOW_INITIAL = "Show Initial"; public static final String KEY_AUTO_STOP = "Auto Stop"; - + public static final String KEY_FEATURE = "Feature"; + + // feature key index in setting file + public static final int FEATURE_KEY_FEATURE_NAME = 1; + public static final int FEATURE_KEY_CHART_LIST = 2; + public static final int FEATURE_KEY_MIN_VALUE = 3; + public static final int FEATURE_KEY_MAX_VALUE = 4; + public static final int FEATURE_KEY_DEFAULT_VALUE = 5; + public static final int FEATURE_KEY_SWAP_LOW_VALUE = 6; + public static final int FEATURE_KEY_SWAP_HIGH_VALUE = 7; + public static final int FEATURE_KEY_OVERHEAD_VALUE = 8; + public static final int FEATURE_KEY_SELECTED = 9; + public static final int FEATURE_KEY_SELECTED_VALUE= 10; + public boolean existSettingFile = true; // init selected information : for revert button private String initTarget = null; private boolean initShowInitial = false; private boolean initAutoStop = false; - + private List initFeatureList = null; + // setting information private double version = 0; private List defaultChartList = null; @@ -87,9 +100,11 @@ public class SettingDataManager { private long defaultHighSwapValue = AnalyzerConstants.FEATURE_OFF; private String selectedTarget = null; - private List selectedChartList = null; // TODO : remove? + private List selectedChartList = null; private boolean showInitial = false; private boolean autoStop = false; + private Map featureListMap = null; + private List selectedFeatureList = null; // available target list private Map targetListMap = null; @@ -98,6 +113,15 @@ public class SettingDataManager { parseSettingData(SETTING_FILE_NAME); parseSettingData(FEATUER_FILE_NAME); parseSettingData(TEMPLATE_FILE_NAME); + + // init feature list + if (initFeatureList == null) { + initFeatureList = new ArrayList(); + copyFeatureList(getSelectedFeatureList(), initFeatureList); + } + + // set chart list + getSelectedChartList().addAll(getSelectedFeatureChartList()); } public synchronized static SettingDataManager getInstance() { @@ -170,6 +194,8 @@ public class SettingDataManager { if ((list[2] != null) && (list[2].isEmpty() == false)) { defaultHighSwapValue = Long.parseLong(list[2]); } + } else if (list[0].equals(KEY_FEATURE)) { + makeFeatureListMap(list); } else { if (null != list[0]) { Logger.debug("unknown setting key : " + list[0]); @@ -220,6 +246,179 @@ public class SettingDataManager { } // else do nothing } + private void makeFeatureListMap(String list[]) { + Map map = getFeatureListMap(); + FeatureData feature = new FeatureData(list[FEATURE_KEY_FEATURE_NAME]); + feature.makeChartList(list[FEATURE_KEY_CHART_LIST]); + feature.setMinValue(list[FEATURE_KEY_MIN_VALUE]); + feature.setMaxValue(list[FEATURE_KEY_MAX_VALUE]); + feature.setDefaultValue(list[FEATURE_KEY_DEFAULT_VALUE]); + feature.setSwapLowValue(list[FEATURE_KEY_SWAP_LOW_VALUE]); + feature.setSwapHighValue(list[FEATURE_KEY_SWAP_HIGH_VALUE]);; + feature.setOverheadValue(list[FEATURE_KEY_OVERHEAD_VALUE]); + map.put(list[FEATURE_KEY_FEATURE_NAME], feature); + + // set selected + if (Boolean.parseBoolean(list[FEATURE_KEY_SELECTED])) { + int featureValue = 0; + if (!(list[FEATURE_KEY_SELECTED_VALUE].isEmpty())) { + featureValue = Integer.parseInt(list[FEATURE_KEY_SELECTED_VALUE]); + } + addSelectedFeature(list[FEATURE_KEY_FEATURE_NAME], featureValue); + } + } + + public void addSelectedFeature(String featureName, int featureValue) { + List featureList = getSelectedFeatureList(); + FeatureValueData feature = getFeatureValueData(featureList, featureName); + // create FeatureValueData + if (feature == null) { + feature = new FeatureValueData(); + feature.setFeatureName(featureName); + featureList.add(feature); + } // else : set value + + feature.setValue(featureValue); + } + + public void deleteSelectedFeature(String featureName) { + List featureList = getSelectedFeatureList(); + for (int i = 0; i < featureList.size(); i++) { + if (featureList.get(i).getFeatureName().equals(featureName) == true) { + featureList.remove(i); + } // else : do nothing + } + } + + private FeatureValueData getFeatureValueData(List featureList, String featureName) { + // null check + if ((featureList == null) || (featureName == null)) { + return null; + } // else : search FeatureValueData object + + for (int i = 0; i < featureList.size(); i++) { + if (featureList.get(i).getFeatureName().equals(featureName) == true) { + return featureList.get(i); + } // else : do nothing + } + return null; + } + + public boolean isSelectedFeature(String featureName) { + List selectedFeatures = getSelectedFeatureList(); + FeatureValueData feature = getFeatureValueData(selectedFeatures, featureName); + if (feature != null) { + return true; + } + return false; + } + + public int getFeatureValue(String featureName) { + int value = 0; + // check selected feature + if (isSelectedFeature(featureName)) { + FeatureValueData feature = getFeatureValueData(getSelectedFeatureList(), featureName); + value = feature.getValue(); + } else { + // get default value + FeatureData feature = getFeatureData(featureName); + value = feature.getDefaultValue(); + } + return value; + } + + public int getFeaturInitValue(String featureName) { + // get init value + int value = -1; + for (int i = 0; i < initFeatureList.size(); i++) { + if (initFeatureList.get(i).equals(featureName)) { + value = initFeatureList.get(i).getValue(); + } + } + + // get default value + if (value == -1) { + FeatureData feature = getFeatureData(featureName); + value = feature.getDefaultValue(); + } + + return value; + } + + public FeatureData getFeatureData(String featureName) { + Map map = getFeatureListMap(); + return map.get(featureName); + } + + private void copyFeatureList(List source, List dest) { + dest.clear(); + + if (source.isEmpty()) { + return; + } + + for (int i = 0; i < source.size(); i++) { + dest.add(new FeatureValueData(source.get(i))); + } + } + + private void writeFeatureData(PrintWriter writer) throws IOException { + Map map = getFeatureListMap(); + for (Map.Entry entry : map.entrySet()) { + FeatureData feature = entry.getValue(); + + StringBuffer buffer = new StringBuffer(); + buffer.append(KEY_FEATURE + WRITE_CSV_SEPARATOR); + buffer.append(feature.getFeatureName() + WRITE_CSV_SEPARATOR); + + String chartString = writeListData(feature.getChartList()); + if (chartString != null) { + buffer.append(chartString + WRITE_CSV_SEPARATOR); + } else { + buffer.append(WRITE_CSV_SEPARATOR); + } + + buffer.append(String.valueOf(feature.getMinValue()) + WRITE_CSV_SEPARATOR); + buffer.append(String.valueOf(feature.getMaxValue()) + WRITE_CSV_SEPARATOR); + buffer.append(String.valueOf(feature.getDefaultValue()) + WRITE_CSV_SEPARATOR); + buffer.append(String.valueOf(feature.getSwapLowValue()) + WRITE_CSV_SEPARATOR); + buffer.append(String.valueOf(feature.getSwapHighValue()) + WRITE_CSV_SEPARATOR); + buffer.append(String.valueOf(feature.getOverheadValue()) + WRITE_CSV_SEPARATOR); + + // selected feature + buffer.append(String.valueOf(isSelectedFeature(feature.getFeatureName())) + WRITE_CSV_SEPARATOR); + if (isSelectedFeature(feature.getFeatureName())) { + buffer.append(String.valueOf(getFeatureValue(feature.getFeatureName()))); + } + + writer.println(buffer.toString()); + } + } + + private String writeListData(List list) { + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < list.size(); i++) { + if (i < list.size() -1) { + buffer.append(list.get(i) + CommonConstants.DASH); + } else { + buffer.append(list.get(i)); + } + } + return buffer.toString(); + } + + public Set getSelectedFeatureChartList() { + Set selectedChartList = new HashSet(); + List featureList = getSelectedFeatureList(); + for (int i = 0; i < featureList.size(); i++) { + FeatureData feature = getFeatureData(featureList.get(i).getFeatureName()); + if (feature.getChartList().size() > 0) { + selectedChartList.addAll(feature.getChartList()); + } + } + return selectedChartList; + } + private void initFeatureData(String readData) { String list[] = readData.split(READ_CSV_SEPARATOR, -1); if (list != null) { @@ -263,6 +462,7 @@ public class SettingDataManager { printWriter.println(KEY_DEFAULT_SWAP_VALUE + WRITE_CSV_SEPARATOR + String.valueOf(defaultLowSwapValue) + WRITE_CSV_SEPARATOR + String.valueOf(defaultHighSwapValue)); + writeFeatureData(printWriter); // target : selected Template, selected feature, available chart list Map map = getTargetListMap(); @@ -351,6 +551,20 @@ public class SettingDataManager { this.selectedChartList = selectedChartList; } + public Map getFeatureListMap() { + if (featureListMap == null) { + featureListMap = new LinkedHashMap(); + } + return featureListMap; + } + + public List getSelectedFeatureList() { + if (selectedFeatureList == null) { + selectedFeatureList = new ArrayList(); + } + return selectedFeatureList; + } + public Map getTargetListMap() { if (targetListMap == null) { targetListMap = new LinkedHashMap(); @@ -394,19 +608,6 @@ public class SettingDataManager { return true; } - private TargetData getAndCreateTarget(String targetName) { - Map map = getTargetListMap(); - TargetData target = null; - - if (isTarget(targetName) == false) { - target = new TargetData(targetName); - map.put(targetName, target); - } else { - target = map.get(targetName); - } - return target; - } - /** * Get page information shown on the screen. * @@ -491,6 +692,9 @@ public class SettingDataManager { initShowInitial = showInitial; initAutoStop = autoStop; + // update option page feature + copyFeatureList(getSelectedFeatureList(), initFeatureList); + // update init template, feature Map map = getTargetListMap(); for (Map.Entry entry : map.entrySet()) { @@ -504,7 +708,10 @@ public class SettingDataManager { selectedTarget = initTarget; showInitial = initShowInitial; autoStop = initAutoStop; - + + // revert option page feature + copyFeatureList(initFeatureList, getSelectedFeatureList()); + // revert template, feature Map map = getTargetListMap(); for (Map.Entry entry : map.entrySet()) { @@ -540,14 +747,16 @@ public class SettingDataManager { // set selected swap value List featureList = target.getSelectedFeatureList(); - for (int i = 0; i < featureList.size(); i++) { - if (ConfigureLabels.FEATURE_NAME_SCREENSHOT.equals(featureList.get(i).getFeatureName()) - && target.isSelectedFeature(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY)) { - continue; - } else { - state |= target.getSelectedFeatureSwapValue(featureList.get(i).getFeatureName(), true); - } + for (int i = 0; i < featureList.size(); i++) { + state |= target.getSelectedFeatureSwapValue(featureList.get(i).getFeatureName(), true); } + + // option page feature : recording, screenshot + featureList = getSelectedFeatureList(); + for (int i = 0; i < featureList.size(); i++) { + state |= getFeatureData(featureList.get(i).getFeatureName()).getSwapLowValue(); + } + return state; } 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 f4a1c12..4578614 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 @@ -47,11 +47,14 @@ 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.shortcut.ShortCutManager; import org.tizen.dynamicanalyzer.util.Logger; +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.da.base.DAButton; +import org.tizen.dynamicanalyzer.widgets.da.base.DADialog; import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox; import org.tizen.dynamicanalyzer.widgets.da.view.DABaseComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite; @@ -68,6 +71,7 @@ public class SettingDialog extends DAMessageBox { // private DACustomButton closeButton = null; private SettingDialogTemplatePage templatesPage = null; + private SettingDialogOptionPage optionPage = null; private DATabComposite tabView = null; private Composite buttonContentsComp = null; @@ -81,10 +85,14 @@ public class SettingDialog extends DAMessageBox { @Override public void handleClickEvent(DACustomButton button) { - isApply = true; - doApply(); - doRun(); - shell.close(); // close dialog + if (optionPage.isValidInputValue()) { + isApply = true; + doApply(); + doRun(); + shell.close(); // close dialog + } else { + doWarningMessage(); + } } }; @@ -92,10 +100,15 @@ public class SettingDialog extends DAMessageBox { @Override public void handleClickEvent(DACustomButton button) { - isApply = true; - doRevert(); - doRun(); - shell.close(); // close dialog + if (optionPage.isValidInputValue()) { + isApply = true; + doRevert(); + doRun(); + shell.close(); // close dialog + } else { + doWarningMessage(); + } + } }; @@ -130,15 +143,15 @@ public class SettingDialog extends DAMessageBox { private void doApply() { Composite selectedComposite = tabView.getTopComposite(); if (!(selectedComposite instanceof SettingDialogBinarySettingsPage)) { - // write setting data - SettingDataManager.getInstance().applySettingData(); - if (DACommunicator.isRunning() == false) { // add & remove tab view page SettingDialogManager.getInstance().updateTabViewPage(); // add & remove (timeline) chart SettingDialogManager.getInstance().updateChartList(); + + // write setting data + SettingDataManager.getInstance().applySettingData(); } } else { // binary setting page @@ -167,6 +180,15 @@ public class SettingDialog extends DAMessageBox { } } } + + private void doWarningMessage() { + // fail message box + Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell(); + DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153); + dialog.setIcon(ImageResources.DIALOG_WARNING_ICON); + dialog.setMessage(ConfigureLabels.SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE); + dialog.open(); + } protected boolean run() { if (opened) { @@ -231,9 +253,9 @@ public class SettingDialog extends DAMessageBox { SettingDialogManager.getInstance().setConfigDlg(this); - SettingDialogOptionPage settingPage = new SettingDialogOptionPage( + optionPage = new SettingDialogOptionPage( tabView.getContentComposite(), SWT.NONE); - tabView.addView(settingPage, false); + tabView.addView(optionPage, false); DABaseComposite binarySettings = new SettingDialogBinarySettingsPage( tabView.getContentComposite(), SWT.NONE); @@ -293,6 +315,18 @@ public class SettingDialog extends DAMessageBox { // } // }); + optionPage.addListener(SWT.Hide, new Listener() { + + @Override + public void handleEvent(Event event) { + Logger.debug("options page hide"); + if (!optionPage.isValidInputValue()) { + doWarningMessage(); + optionPage.revertInputValue(); + } + } + }); + // binarySettings tab is selected, the close button will be shown. // ok and cancel button is hidden binarySettings.addListener(SWT.Show, new Listener() { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java index 077063c..2b039dc 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java @@ -336,6 +336,7 @@ public class SettingDialogManager { // set selected chart list TargetData target = SettingDataManager.getInstance().getConnectedTarget(); selectedChartList.addAll(target.getSelectedChartList()); + selectedChartList.addAll(SettingDataManager.getInstance().getSelectedFeatureChartList()); // update chart list in timeline page TimelineChartManager.getInstance().loadSelectedChartList(selectedChartList); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogOptionPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogOptionPage.java index de1987c..c92d981 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogOptionPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogOptionPage.java @@ -28,17 +28,25 @@ package org.tizen.dynamicanalyzer.ui.toolbar.setting; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +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.Label; +import org.tizen.dynamicanalyzer.communicator.DACommunicator; +import org.tizen.dynamicanalyzer.constant.CommonConstants; import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; import org.tizen.dynamicanalyzer.nl.ConfigureLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.FontResources; import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckBox; import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckboxSelectionListener; +import org.tizen.dynamicanalyzer.widgets.da.base.DAText; import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite; public class SettingDialogOptionPage extends DAPageComposite { @@ -48,6 +56,15 @@ public class SettingDialogOptionPage extends DAPageComposite { // HIDDEN SETTING WIDGET (CHECKBOX, BUTTON) // private DACheckBox showInitialCheckBox = null; private DACheckBox autoStopCheckBox = null; + private DACheckBox recordingCheckBox = null; + + private DACheckBox onSceneTransitionCheckBox = null; + private DACheckBox periodicallyCheckBox = null; + private DAText periodicallyTextBox = null; + private Label periodicallyTextBoxLabel = null; + private Label periodicallyInfo = null; + + private boolean isValidInputValue = true; public SettingDialogOptionPage(Composite parent, int style) { @@ -62,7 +79,7 @@ public class SettingDialogOptionPage extends DAPageComposite { settingLabel .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); settingLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR); - settingLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT); + settingLabel.setFont(FontResources.SETTING_TITLE_FONT); FormData data = new FormData(); data.top = new FormAttachment(0, 14); data.left = new FormAttachment(0, 8); @@ -91,13 +108,49 @@ public class SettingDialogOptionPage extends DAPageComposite { // data.top = new FormAttachment(settingLabel, 17); // data.left = new FormAttachment(0, 42); // showInitalLabel.setLayoutData(data); + + this.addPaintListener(new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + Composite comp = (Composite) e.widget; + Rectangle rect = comp.getClientArea(); + e.gc.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR); + e.gc.fillRectangle(10, 45, rect.width-20, 26); + e.gc.fillRectangle(10, 150, rect.width-20, 26); + } + }); + + createRcording(); + createScreenShot(); + + // check running state + if (DACommunicator.isRunning()) { + this.setEnabled(false); + } + } - // SHOW_INITIAL_FEATURE_SETTING + public void createRcording() { + // recording title label + Label recordingTitleLabel = new Label(this, SWT.TRANSPARENT); + FormData data = new FormData(); + data.top = new FormAttachment(0, 49); + data.left = new FormAttachment(0, 20); + data.height = 20; + data.width = 120; + recordingTitleLabel.setLayoutData(data); + recordingTitleLabel.setText(ConfigureLabels.SETTING_DIALOG_RECORDING_REPLAY); + recordingTitleLabel.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR); + recordingTitleLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR); + recordingTitleLabel.setFont(FontResources.SETTING_TITLE_FONT); + recordingTitleLabel.setAlignment(SWT.LEFT); + + // recording autoStop autoStopCheckBox = new DACheckBox(this, SWT.NONE); data = new FormData(); // HIDDEN SETTING WIDGET (CHECKBOX, BUTTON) // data.top = new FormAttachment(settingLabel, 42); - data.top = new FormAttachment(settingLabel, 15); + data.top = new FormAttachment(recordingTitleLabel, 10); data.left = new FormAttachment(0, 22); data.height = 20; data.width = 20; @@ -105,7 +158,7 @@ public class SettingDialogOptionPage extends DAPageComposite { autoStopCheckBox.setForeground(ColorResources.BLACK); autoStopCheckBox.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); autoStopCheckBox.setText(ConfigureLabels.SETTING_OPTION_AUTO_STOP); - autoStopCheckBox.addSelectionListener(autoStopRadioButtonListener); + autoStopCheckBox.addSelectionListener(autoStopCheckBoxListener); autoStopCheckBox.setChecked(SettingDataManager.getInstance().isAutoStop()); Label autoStopLabel = new Label(this, SWT.TRANSPARENT); @@ -116,11 +169,151 @@ public class SettingDialogOptionPage extends DAPageComposite { data = new FormData(); // HIDDEN SETTING WIDGET (CHECKBOX, BUTTON) // data.top = new FormAttachment(settingLabel, 44); - data.top = new FormAttachment(settingLabel, 15); + data.top = new FormAttachment(recordingTitleLabel, 11); data.left = new FormAttachment(0, 42); autoStopLabel.setLayoutData(data); + + // feature : recording + recordingCheckBox = new DACheckBox(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(autoStopCheckBox, 6); + data.left = new FormAttachment(0, 22); + data.height = 20; + data.width = 20; + recordingCheckBox.setLayoutData(data); + recordingCheckBox.setForeground(ColorResources.BLACK); + recordingCheckBox.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + recordingCheckBox.setText(ConfigureLabels.FEATURE_NAME_RECORDING); + recordingCheckBox.addSelectionListener(recordingCheckBoxListener); + recordingCheckBox.setChecked(SettingDataManager.getInstance().isSelectedFeature(ConfigureLabels.FEATURE_NAME_RECORDING)); + + Label recordingLabel = new Label(this, SWT.TRANSPARENT); + recordingLabel.setText(ConfigureLabels.FEATURE_NAME_RECORDING); + recordingLabel.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + recordingLabel.setForeground(ColorResources.BLACK); + recordingLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT); + data = new FormData(); + data.top = new FormAttachment(autoStopCheckBox, 7); + data.left = new FormAttachment(0, 42); + recordingLabel.setLayoutData(data); } + + public void createScreenShot() { + // screenshot title label + Label screenshotTitleLabel = new Label(this, SWT.TRANSPARENT); + FormData data = new FormData(); + data.top = new FormAttachment(0, 155); + data.left = new FormAttachment(0, 20); + data.height = 20; + data.width = 120; + screenshotTitleLabel.setLayoutData(data); + screenshotTitleLabel.setText(ConfigureLabels.SETTING_DIALOG_SCREENSHOT); + screenshotTitleLabel.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR); + screenshotTitleLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR); + screenshotTitleLabel.setFont(FontResources.SETTING_TITLE_FONT); + screenshotTitleLabel.setAlignment(SWT.LEFT); + + // on scene transition + onSceneTransitionCheckBox = new DACheckBox(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(screenshotTitleLabel, 10); + data.left = new FormAttachment(0, 22); + data.height = 20; + data.width = 20; + onSceneTransitionCheckBox.setLayoutData(data); + onSceneTransitionCheckBox.setForeground(ColorResources.BLACK); + onSceneTransitionCheckBox.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + onSceneTransitionCheckBox.setText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION); + onSceneTransitionCheckBox.addSelectionListener(onSceneTransitionCheckBoxListener); + onSceneTransitionCheckBox.setChecked(SettingDataManager.getInstance().isSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION)); + + Label onSceneTransitionLabel = new Label(this, SWT.TRANSPARENT); + onSceneTransitionLabel.setText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION); + onSceneTransitionLabel.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + onSceneTransitionLabel.setForeground(ColorResources.BLACK); + onSceneTransitionLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT); + data = new FormData(); + data.top = new FormAttachment(screenshotTitleLabel, 11); + data.left = new FormAttachment(0, 42); + onSceneTransitionLabel.setLayoutData(data); + + // periodically + periodicallyCheckBox = new DACheckBox(this, SWT.NONE); + data = new FormData(); + data.top = new FormAttachment(onSceneTransitionCheckBox, 6); + data.left = new FormAttachment(0, 22); + data.height = 20; + data.width = 20; + periodicallyCheckBox.setLayoutData(data); + periodicallyCheckBox.setForeground(ColorResources.BLACK); + periodicallyCheckBox.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + periodicallyCheckBox.setText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY); + periodicallyCheckBox.addSelectionListener(periodicallyCheckBoxListener); + boolean isSelectedFeature = SettingDataManager.getInstance().isSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY); + periodicallyCheckBox.setChecked(isSelectedFeature); + + Label periodicallyLabel = new Label(this, SWT.TRANSPARENT); + periodicallyLabel.setText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY); + periodicallyLabel.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + periodicallyLabel.setForeground(ColorResources.BLACK); + periodicallyLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT); + data = new FormData(); + data.top = new FormAttachment(onSceneTransitionCheckBox, 7); + data.left = new FormAttachment(0, 42); + periodicallyLabel.setLayoutData(data); + + // text box + periodicallyTextBox = new DAText(this, SWT.SINGLE); + data = new FormData(); + data.top = new FormAttachment(onSceneTransitionCheckBox, 7); + data.left = new FormAttachment(periodicallyLabel, 5); + data.width = 50; + data.height = 15; + periodicallyTextBox.setLayoutData(data); + periodicallyTextBox.setForeground(ColorResources.SETTING_COLOR); + periodicallyTextBox.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT); + periodicallyTextBox.setText(String.valueOf(SettingDataManager.getInstance().getFeatureValue( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY))); + periodicallyTextBox.getControl().addKeyListener(periodicallyTextBoxKeyListener); + + // label + periodicallyTextBoxLabel = new Label(this, SWT.TRANSPARENT); + periodicallyTextBoxLabel.setText(ConfigureLabels.SECOND); + data = new FormData(); + data.top = new FormAttachment(onSceneTransitionCheckBox, 7); + data.left = new FormAttachment(periodicallyTextBox.getControl(), 5); + data.width = 15; + data.height = 16; + periodicallyTextBoxLabel.setLayoutData(data); + periodicallyTextBoxLabel.setForeground(ColorResources.SETTING_COLOR); + periodicallyTextBoxLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT); + periodicallyTextBoxLabel.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + + // waring label + periodicallyInfo = new Label(this, SWT.TRANSPARENT); + data = new FormData(); + data.top = new FormAttachment(onSceneTransitionCheckBox, 7); + data.left = new FormAttachment(periodicallyTextBoxLabel, 5); + data.width = 250; + data.height = 16; + periodicallyInfo.setLayoutData(data); + periodicallyInfo.setForeground(ColorResources.RED); + periodicallyInfo.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT); + periodicallyInfo.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR); + // check status : periodicallyCheckBox + if (isSelectedFeature) { + periodicallyTextBox.getControl().setEnabled(true); + isValidInputValue = checkValidInputText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY, + periodicallyTextBox, periodicallyInfo); + } else { + periodicallyTextBox.getControl().setEnabled(false); + periodicallyInfo.setText(CommonConstants.EMPTY); + } + } + // HIDDEN SETTING WIDGET (CHECKBOX, BUTTON) // private DACheckboxSelectionListener showInitiaRadioButtonListener = new DACheckboxSelectionListener() { // @Override @@ -137,8 +330,8 @@ public class SettingDialogOptionPage extends DAPageComposite { // SettingDialogManager.getInstance().updateSaveButtonStatus(null); // } // }; - - private DACheckboxSelectionListener autoStopRadioButtonListener = new DACheckboxSelectionListener() { + + private DACheckboxSelectionListener autoStopCheckBoxListener = new DACheckboxSelectionListener() { @Override public void handleSelectionEvent(DACheckBox checkbox) { if (SettingDataManager.getInstance().isAutoStop()) { @@ -153,4 +346,109 @@ public class SettingDialogOptionPage extends DAPageComposite { // SettingDialogManager.getInstance().updateSaveButtonStatus(null); } }; + + private DACheckboxSelectionListener recordingCheckBoxListener = new DACheckboxSelectionListener() { + @Override + public void handleSelectionEvent(DACheckBox checkbox) { + if (SettingDataManager.getInstance().isSelectedFeature(ConfigureLabels.FEATURE_NAME_RECORDING)) { + SettingDataManager.getInstance().deleteSelectedFeature(ConfigureLabels.FEATURE_NAME_RECORDING); + recordingCheckBox.setChecked(false); + } else { + SettingDataManager.getInstance().addSelectedFeature(ConfigureLabels.FEATURE_NAME_RECORDING, 0); + recordingCheckBox.setChecked(true); + } + } + }; + + private DACheckboxSelectionListener onSceneTransitionCheckBoxListener = new DACheckboxSelectionListener() { + @Override + public void handleSelectionEvent(DACheckBox checkbox) { + if (SettingDataManager.getInstance().isSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION)) { + SettingDataManager.getInstance().deleteSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION); + onSceneTransitionCheckBox.setChecked(false); + } else { + SettingDataManager.getInstance().addSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION, 0); + onSceneTransitionCheckBox.setChecked(true); + } + } + }; + + private DACheckboxSelectionListener periodicallyCheckBoxListener = new DACheckboxSelectionListener() { + @Override + public void handleSelectionEvent(DACheckBox checkbox) { + if (SettingDataManager.getInstance().isSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY)) { + SettingDataManager.getInstance().deleteSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY); + periodicallyCheckBox.setChecked(false); + periodicallyTextBox.getControl().setEnabled(false); + periodicallyInfo.setText(CommonConstants.EMPTY); + isValidInputValue = true; + } else { + // set init Feature Value + int value = SettingDataManager.getInstance().getFeaturInitValue( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY); + SettingDataManager.getInstance().addSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY, value); + periodicallyCheckBox.setChecked(true); + periodicallyTextBox.getControl().setEnabled(true); + isValidInputValue = checkValidInputText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY, + periodicallyTextBox, periodicallyInfo); + } + } + }; + + private KeyListener periodicallyTextBoxKeyListener = new KeyListener() { + + @Override + public void keyReleased(KeyEvent e) { + // check validation input text + isValidInputValue = checkValidInputText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY, + periodicallyTextBox, periodicallyInfo); + if (isValidInputValue) { + periodicallyInfo.setText(CommonConstants.EMPTY); + + SettingDataManager.getInstance().addSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY, + Integer.parseInt(periodicallyTextBox.getText())); + } + } + + @Override + public void keyPressed(KeyEvent e) { + } + }; + + private boolean checkValidInputText(String featuresName, DAText textBox, Label info) { + FeatureData feature = SettingDataManager.getInstance().getFeatureData(featuresName); + int errorCode = feature.checkValidInputValue(textBox.getText()); + if (errorCode != FeatureData.FEATURE_VAILD_VALUE) { + info.setText(feature.getValueWarningMessage(errorCode)); + return false; + } else { + info.setText(CommonConstants.EMPTY); + return true; + } + } + + public boolean isValidInputValue() { + return isValidInputValue; + } + + public void revertInputValue() { + int value = SettingDataManager.getInstance().getFeaturInitValue( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY); + + periodicallyTextBox.setText(String.valueOf(value)); + periodicallyInfo.setText(CommonConstants.EMPTY); + isValidInputValue = true; + + SettingDataManager.getInstance().addSelectedFeature( + ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY, + Integer.parseInt(periodicallyTextBox.getText())); + + } } \ No newline at end of file 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 1182fdf..99b10f5 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 @@ -78,7 +78,7 @@ public class SettingDialogTemplatePage extends DAPageComposite { private Composite descriptionComp = null; private Label icon = null; private Label targetNameLabel = null; - private Text targetDescriptionText = null; + private Label targetDescriptionLabel = null; private Label overheadLabel = null; private DACustomButton detailButton = null; @@ -184,9 +184,9 @@ public class SettingDialogTemplatePage extends DAPageComposite { targetNameLabel = null; } - if (null != targetDescriptionText) { - targetDescriptionText.dispose(); - targetDescriptionText = null; + if (null != targetDescriptionLabel) { + targetDescriptionLabel.dispose(); + targetDescriptionLabel = null; } if (null != overheadLabel) { @@ -423,17 +423,17 @@ public class SettingDialogTemplatePage extends DAPageComposite { targetNameLabel.setFont(FontResources.SETTING_TITLE_FONT); // text : description - targetDescriptionText = new Text(descriptionComp, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); + targetDescriptionLabel = new Label(descriptionComp, SWT.WRAP | SWT.READ_ONLY); data = new FormData(); data.top = new FormAttachment(0, 40); data.left = new FormAttachment(0, 81); data.width = 401; data.height = 70; - targetDescriptionText.setLayoutData(data); - targetDescriptionText.setText(template.getDescription()); - targetDescriptionText.setBackground(ColorResources.WHITE); - targetDescriptionText.setForeground(ColorResources.SETTING_COLOR); - targetDescriptionText.setFont(FontResources.SETTING_DESCRIPTION_FONT); + targetDescriptionLabel.setLayoutData(data); + targetDescriptionLabel.setText(template.getDescription()); + targetDescriptionLabel.setBackground(ColorResources.WHITE); + targetDescriptionLabel.setForeground(ColorResources.SETTING_COLOR); + targetDescriptionLabel.setFont(FontResources.SETTING_DESCRIPTION_FONT); // label : overhead overheadLabel = new Label(descriptionComp, SWT.TRANSPARENT); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/TargetData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/TargetData.java index 0e7df56..bb9725b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/TargetData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/TargetData.java @@ -238,39 +238,6 @@ public class TargetData { } /** - * Add the selected feature. - * - * @param featureName featureName - * @param featureValue featureValue - */ - public void addSelectedFeature(String featureName, int featureValue) { - List featureList = getSelectedFeatureList(); - FeatureValueData feature = getFeatureValueData(featureList, featureName); - // create FeatureValueData - if (feature == null) { - feature = new FeatureValueData(); - feature.setFeatureName(featureName); - featureList.add(feature); - } // else : set value - - feature.setValue(featureValue); - } - - /** - * Delete from the list of features that have been deselected. - * - * @param featureName featureName - */ - public void deleteSelectedFeature(String featureName) { - List featureList = getSelectedFeatureList(); - for (int i = 0; i < featureList.size(); i++) { - if (featureList.get(i).getFeatureName().equals(featureName) == true) { - featureList.remove(i); - } // else : do nothing - } - } - - /** * Get the value of the selected feature. * * @param featureName featureName