From 7cfe53eea092ca2ace4e157ba6fbc6ae68fde69d Mon Sep 17 00:00:00 2001 From: "Hyunjong,park" Date: Tue, 21 Jan 2014 15:34:40 +0900 Subject: [PATCH] [Title] bug fix. configuration dlg. [Desc.] apply change featureas value when check parent features [Issue] - --- .../ApplicationWorkbenchWindowAdvisor.java | 4 +- .../tizen/dynamicanalyzer/nl/ConfigureLabels.java | 5 + .../dynamicanalyzer/nl/ConfigureLabels.properties | 6 +- .../dynamicanalyzer/ui/file/FileDataMaker.java | 2 +- .../ui/network/NetworkDataMaker.java | 2 +- .../summary/profiling/FunctionUsageProfiler.java | 2 +- .../toolbar/configuration/ConfigurationDialog.java | 4 +- .../configuration/ConfigurationDialogData.java | 1 - .../ConfigurationDialogDataManager.java | 216 +++++++++++---------- .../ConfigurationDialogFeaturesPage.java | 55 +++--- .../ConfigurationDialogFeaturesTable.java | 66 +------ ...ationDialogFeaturesTreeTableToggleRenderer.java | 6 +- .../ConfigurationDialogSettingPage.java | 16 +- .../ui/toolbar/configuration/WelcomeDialog.java | 12 +- 14 files changed, 186 insertions(+), 211 deletions(-) diff --git a/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java b/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java index a6c17c7..082c7ee 100755 --- a/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java +++ b/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java @@ -103,8 +103,8 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { PathManager.pathCheck(); DASingletonFocusManager.setSaveFocusDAPid(); IDECommunicator.startIDECommunicatorThread(); - ConfigurationDialogDataManager.getInstance().setSettingValueFromConfigureManager(); - if (!ConfigurationDialogDataManager.getInstance().isShowInitia()) { + ConfigurationDialogDataManager.getInstance().updateFeaturesValueFromConfigureManager(); + if (!ConfigurationDialogDataManager.getInstance().isShowInital()) { final Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell(); WelcomeDialog dialog = new WelcomeDialog(shell); // FIXME dialog.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 3711041..01d406b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java @@ -121,6 +121,11 @@ public class ConfigureLabels extends NLS { public static String INTERNAL_LOG_LEVEL; public static String THEME; + + public static String VALUE_IS_EMPTY; + public static String YOU_HAVE_TO_SET_CHARACTER; + public static String VALUE_SHOULD_BE_IN_RANGE_FROM_1_TO_100; + public static String YOU_HAVE_TO_SET_MULTIPLE_OF_10MS; static { NLS.initializeMessages(BUNDLE_NAME, ConfigureLabels.class); 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 f66d9b6..3e73ef6 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties @@ -85,4 +85,8 @@ MS=ms SECOND=s AUTO=auto SAMPLING=sampling period : -PERIODIC=period \ No newline at end of file +PERIODIC=period +VALUE_IS_EMPTY=value is empty +YOU_HAVE_TO_SET_CHARACTER=you have to set character +VALUE_SHOULD_BE_IN_RANGE_FROM_1_TO_100=value should be in range from 1 to 100 +YOU_HAVE_TO_SET_MULTIPLE_OF_10MS=you have to set multiple of 10ms \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java index 71d8578..c9d1ad0 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java @@ -130,7 +130,7 @@ public class FileDataMaker { FileData input = (FileData) inputs.get(i); if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue( + .getfeatureValue( ConfigureLabels.INCLUDE_INSIDE_CALL_FILE) == 0) { if (input.isInternal()) { continue; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java index f1cecc2..fa54efe 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java @@ -130,7 +130,7 @@ public class NetworkDataMaker { NetworkData input = (NetworkData) inputs.get(i); if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue( + .getfeatureValue( ConfigureLabels.INCLUDE_INSIDE_CALL_NETWORK) == 0) { if (input.isInternal()) { continue; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfiler.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfiler.java index ea02b4c..fad9371 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfiler.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfiler.java @@ -87,7 +87,7 @@ public class FunctionUsageProfiler implements Runnable { public static synchronized FunctionUsageProfiler getInstance() { if (null == instance) { SAMPLE_TIME = ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(ConfigureLabels + .getfeatureValue(ConfigureLabels .FUNCTION_PROFILING_SAMPLING_PERIODIC); instance = new FunctionUsageProfiler(); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java index be4bd16..3acd5ad 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialog.java @@ -64,7 +64,7 @@ public class ConfigurationDialog extends DAMessageBox { public ConfigurationDialog(Shell parent) { super(parent); ConfigurationDialogDataManager.getInstance() - .setSettingValueFromConfigureManager(); + .updateFeaturesValueFromConfigureManager(); } private DACustomButtonClickEventListener applyButtonListener = new DACustomButtonClickEventListener() { @@ -108,7 +108,7 @@ public class ConfigurationDialog extends DAMessageBox { Composite selectedComposite = tabView.getTopComposite(); if (!(selectedComposite instanceof BinarySettingsPage)) { ConfigurationDialogDataManager.getInstance() - .setSettingValueFromConfigureManager(); + .updateFeaturesValueFromConfigureManager(); } else { BinarySettingsPage page = (BinarySettingsPage) selectedComposite; page.doClose(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogData.java index 9d489d8..0811948 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogData.java @@ -34,7 +34,6 @@ public class ConfigurationDialogData { public long swapValue = 0; public boolean hasParrentFeature = false; public String optionFeaturesName = CommonConstants.EMPTY; - public int optionfeaturesSwapValue = 0; public ConfigurationDialogData(String featuresName, long swapValue) { this.featuresName = featuresName; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java index 675d3d3..5841209 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import org.eclipse.nebula.widgets.grid.Grid; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.common.HostResult; @@ -48,11 +49,11 @@ public class ConfigurationDialogDataManager { private DAMessageBox configDlg = null; private static String[] tableFeaturesName = null; - private static String[] optionSettingName = null; - HashMap featuresStatusHashMap = new HashMap(); - HashMap savedFeaturesStatusHashMap = new HashMap(); + private static String[] optionalSettingName = null; private static ConfigureManager mConfig; + private HashMap initFeaturesValueHashMap = new HashMap(); + private HashMap featuresValueHashMap = new HashMap(); public synchronized static ConfigurationDialogDataManager getInstance() { if (null == instance) { @@ -93,7 +94,7 @@ public class ConfigurationDialogDataManager { ConfigureLabels.INCLUDE_INSIDE_CALL_UI, ConfigureLabels.INCLUDE_INSIDE_OPENGL, }; - optionSettingName = new String[] { ConfigureLabels.SHOW_INITIAL, + optionalSettingName = new String[] { ConfigureLabels.SHOW_INITIAL, ConfigureLabels.AUTO_STOP, ConfigureLabels.SNAPSHOT_PERIODIC, ConfigureLabels.SNAPSHOT_PERIODIC_AUTO, @@ -104,26 +105,54 @@ public class ConfigurationDialogDataManager { return instance; } + public DAMessageBox getConfigDlg() { + return configDlg; + } + + public void setConfigDlg(DAMessageBox configDlg) { + this.configDlg = configDlg; + } + + public boolean isShowInital() { + if (featuresValueHashMap.get(ConfigureLabels.SHOW_INITIAL).swapValue > 0) { + return true; + } else { + return false; + } + } + + public boolean isAutoStop() { + if (featuresValueHashMap.get(ConfigureLabels.AUTO_STOP).swapValue > 0) { + return true; + } else { + return false; + } + } + + public ConfigureManager getConfigureManager() { + return mConfig; + } + public String[] getTableFeature() { return tableFeaturesName; } public String[] getOptionFeature() { - return optionSettingName; + return optionalSettingName; } - public long getfeatureSwapValue(String featues) { - long swapValue = featuresStatusHashMap.get(featues).swapValue; + public long getfeatureValue(String featues) { + long swapValue = featuresValueHashMap.get(featues).swapValue; return swapValue; } - public void setfeatureSwapValue(String featureName, int value) { - featuresStatusHashMap.put(featureName, new ConfigurationDialogData( + public void setfeatureValue(String featureName, int value) { + featuresValueHashMap.put(featureName, new ConfigurationDialogData( featureName, value)); } - public boolean HasParentfeature(String featues) { - Boolean hasParrent = featuresStatusHashMap.get(featues).hasParrentFeature; + public boolean hasParentfeature(String featuresName) { + Boolean hasParrent = featuresValueHashMap.get(featuresName).hasParrentFeature; return hasParrent; } @@ -285,17 +314,15 @@ public class ConfigurationDialogDataManager { } else if (featureName .equals(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC)) { value = AnalyzerConstants.SYSTEM_INFOMATION_SAMPLING_PERIODIC; - } - - else { - System.out.println("failed set feature : " + featureName); + } else { + System.out.println("undefine feature : " + featureName); } } - featuresStatusHashMap.put(featureName, new ConfigurationDialogData( + featuresValueHashMap.put(featureName, new ConfigurationDialogData( featureName, value)); } - public void setSettingValueFromConfigureManager() { + public void updateFeaturesValueFromConfigureManager() { // Table Feature for (String featureName : getTableFeature()) { try { @@ -311,66 +338,63 @@ public class ConfigurationDialogDataManager { if (optionFeatureName.equals(CommonConstants.EMPTY)) { data.optionFeaturesName = optionFeatureName; } - featuresStatusHashMap.put(featureName, data); + featuresValueHashMap.put(featureName, data); } catch (NumberFormatException e) { e.printStackTrace(); } } + // optional Setting for (String featureName : getOptionFeature()) { try { ConfigurationDialogData data = new ConfigurationDialogData( featureName, mConfig.getValueLong(featureName)); - featuresStatusHashMap.put(featureName, data); + featuresValueHashMap.put(featureName, data); } catch (NumberFormatException e) { e.printStackTrace(); } } - savedSettingValueToConfigureManager(); + saveInitFeaturesValue(); } - private void setConfig(long featureStatus, String featureName) { - mConfig.setValue(featureName, Long.toString(featureStatus)); - System.out.println("featureName : " + featureName + " : " - + Long.toString(featureStatus)); - } - - public void applySettingValueToConfigureManager() { - changedFeatures(true); + public void saveInitFeaturesValue() { + initFeaturesValueHashMap.clear(); // Table Feature for (String featureName : getTableFeature()) { - setConfig(featuresStatusHashMap.get(featureName).swapValue, - featureName); + initFeaturesValueHashMap.put(featureName, + featuresValueHashMap.get(featureName).swapValue); } - // Setting + // optional Setting for (String featureName : getOptionFeature()) { - setConfig(featuresStatusHashMap.get(featureName).swapValue, - featureName); + initFeaturesValueHashMap.put(featureName, + featuresValueHashMap.get(featureName).swapValue); } } - public void savedSettingValueToConfigureManager() { - savedFeaturesStatusHashMap.clear(); + public void rollbackSettingValueToConfigureManager() { // Table Feature for (String featureName : getTableFeature()) { - savedFeaturesStatusHashMap.put(featureName, - featuresStatusHashMap.get(featureName).swapValue); + mConfig.setValue(featureName, + Long.toString(initFeaturesValueHashMap.get(featureName))); } - // Setting + // optional Setting for (String featureName : getOptionFeature()) { - savedFeaturesStatusHashMap.put(featureName, - featuresStatusHashMap.get(featureName).swapValue); + mConfig.setValue(featureName, + Long.toString(initFeaturesValueHashMap.get(featureName))); } } - public void rollbackSettingValueToConfigureManager() { + public void applySettingValueToConfigureManager() { + changedFeatures(true); // Table Feature for (String featureName : getTableFeature()) { - setConfig(savedFeaturesStatusHashMap.get(featureName), featureName); + mConfig.setValue(featureName, Long.toString(featuresValueHashMap + .get(featureName).swapValue)); } - // Setting + // optional Setting for (String featureName : getOptionFeature()) { - setConfig(savedFeaturesStatusHashMap.get(featureName), featureName); + mConfig.setValue(featureName, Long.toString(featuresValueHashMap + .get(featureName).swapValue)); } } @@ -411,26 +435,17 @@ public class ConfigurationDialogDataManager { } } } - - } - - public DAMessageBox getConfigDlg() { - return configDlg; - } - - public void setConfigDlg(DAMessageBox configDlg) { - this.configDlg = configDlg; } public boolean changedFeatures(boolean apply) { boolean isChangeValue = false; // Table Feature for (String featureName : getTableFeature()) { - long featuresStatus = featuresStatusHashMap.get(featureName).swapValue; + long featuresStatus = featuresValueHashMap.get(featureName).swapValue; long configFileStatus = mConfig.getValueLong(featureName); if (featuresStatus != configFileStatus) { if (apply) { - System.out.println("change values : " + featureName); + System.out.println("change values : " + featureName); } isChangeValue = true; } @@ -478,11 +493,11 @@ public class ConfigurationDialogDataManager { } for (String featureName : getOptionFeature()) { - long featuresStatus = featuresStatusHashMap.get(featureName).swapValue; + long featuresStatus = featuresValueHashMap.get(featureName).swapValue; long configFileStatus = mConfig.getValueLong(featureName); if (featuresStatus != configFileStatus) { if (apply) { - System.out.println("change values : " + featureName); + System.out.println("change values : " + featureName); } isChangeValue = true; } @@ -490,10 +505,46 @@ public class ConfigurationDialogDataManager { return isChangeValue; } - public void setFeaturesStatusFromTableItemsList(DATableComposite featureComp) { - for (int i = 0; i < featureComp.getTable().getItemCount(); i++) { - String featureName = featureComp.getTable().getItem(i).getText(0); - String optionText = featureComp.getTable().getItem(i).getText(1); + public String isCheckFeatue(String featueName) { + if (AnalyzerConstants.FEATURE_OFF != getfeatureValue(featueName)) { + return ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED; + } else { + return CommonConstants.EMPTY; + } + } + + public String getOptionText(String featureName) { + long optionFeatureValue = getfeatureValue(featureName); + if (optionFeatureValue == AnalyzerConstants.FEATURE_OFF) { + return CommonConstants.EMPTY; + } + + StringBuffer optionValue = new StringBuffer(); + optionValue.append(CommonConstants.SPACE).append( + CommonConstants.OPEN_BRACKET); + + if (featureName.equals(ConfigureLabels.SNAPSHOT_PERIODIC)) { + if (getfeatureValue(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) != AnalyzerConstants.FEATURE_OFF) { + optionValue.append(ConfigureLabels.AUTO); + } else { + optionValue.append(ConfigureLabels.SAMPLING + + Long.toString(optionFeatureValue)); + } + } else if (featureName + .equals(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC) + || featureName + .equals(ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC)) { + optionValue.append(ConfigureLabels.SAMPLING + + Long.toString(optionFeatureValue)); + } + optionValue.append(CommonConstants.CLOSE_BRACKET); + return optionValue.toString(); + } + + public void setFeaturesValueFromTableItemsList(Grid table) { + for (int i = 0; i < table.getItemCount(); i++) { + String featureName = table.getItem(i).getText(0); + String optionText = table.getItem(i).getText(1); boolean isChecked = false; if (optionText .contains(ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED)) { @@ -501,31 +552,13 @@ public class ConfigurationDialogDataManager { } else { isChecked = false; } - - ConfigurationDialogDataManager.getInstance().setFeaturesSwapValue( - featureName, isChecked); - - } - } - - public boolean isShowInitia() { - if (featuresStatusHashMap.get(ConfigureLabels.SHOW_INITIAL).swapValue > 0) { - return true; - } else { - return false; - } - } - - public boolean isAutoStop() { - if (featuresStatusHashMap.get(ConfigureLabels.AUTO_STOP).swapValue > 0) { - return true; - } else { - return false; + setFeaturesSwapValue(featureName, isChecked); } } public void applySwapValue(DATableComposite featuresTable) { - preSwapValue(featuresTable); + setFeaturesValueFromTableItemsList(featuresTable.getTable()); + applySettingValueToConfigureManager(); if (null != DACommunicator.getSelectedDevice()) { HostResult result = DACommunicator.sendRuntimeMessage( DACommunicator.MSG_TYPE_CONFIG, null); @@ -535,28 +568,15 @@ public class ConfigurationDialogDataManager { DACommunicator.getSelectedDevice().setConfigSuccess(true); ToolbarArea.getInstance().setStartButtonEnablement(true); } else { - applySuccessSwapValue(featuresTable); + updateFeaturesValueFromConfigureManager(); + featuresTable.updateTable(); } } } - public void preSwapValue(DATableComposite featuresTable) { - setFeaturesStatusFromTableItemsList(featuresTable); - applySettingValueToConfigureManager(); - } - - public void applySuccessSwapValue(DATableComposite featuresTable) { - setSettingValueFromConfigureManager(); - featuresTable.updateTable(); - } - public void applyFailedSwapValue(DATableComposite featuresTable) { rollbackSettingValueToConfigureManager(); - setSettingValueFromConfigureManager(); + updateFeaturesValueFromConfigureManager(); featuresTable.updateTable(); } - - public ConfigureManager getConfigureManager() { - return mConfig; - } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java index 46db070..e86cadb 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java @@ -160,7 +160,7 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { } }); - // Details Title + // Detail Title Label detailLabel = new Label(this, SWT.TRANSPARENT); detailLabel.setText(ConfigureLabels.FEATURE_DETAIL_SETTING_TITLE); detailLabel @@ -172,7 +172,6 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { data.left = new FormAttachment(0, 8); detailLabel.setLayoutData(data); - // Setting detailSettingComp = new Composite(this, SWT.NONE); FormLayout compLayout = new FormLayout(); detailSettingComp.setLayout(compLayout); @@ -299,7 +298,7 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { String optionFeatusName = ConfigurationDialogDataManager .getInstance().getOptionFeatureName(featureName); long savedValue = ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(optionFeatusName); + .getfeatureValue(optionFeatusName); textBox.setText(Long.toString(savedValue)); textBoxLabel = new Label(detailSettingComp, SWT.TRANSPARENT); @@ -324,16 +323,15 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { info.setForeground(ColorResources.RED); info.setFont(FontResources.COMBO); - if (ConfigurationDialogDataManager - .getInstance() - .getfeatureSwapValue(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) == AnalyzerConstants.FEATURE_OFF) { + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( + ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) == AnalyzerConstants.FEATURE_OFF) { detailSettingCheckBox.setChecked(false); } else { detailSettingCheckBox.setChecked(true); } - if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(featureName) == AnalyzerConstants.FEATURE_OFF) { + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( + featureName) == AnalyzerConstants.FEATURE_OFF) { detailSettingCheckBox.setEnabled(false); textBox.getControl().setEnabled(false); } else { @@ -341,10 +339,10 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { textBox.getControl().setEnabled(true); } - if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(featureName) != AnalyzerConstants.FEATURE_OFF + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( + featureName) != AnalyzerConstants.FEATURE_OFF && ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue( + .getfeatureValue( ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) == AnalyzerConstants.FEATURE_OFF) { textBox.getControl().setEnabled(true); } else { @@ -391,7 +389,7 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { String optionFeatusName = ConfigurationDialogDataManager .getInstance().getOptionFeatureName(featureName); long savedValue = ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(optionFeatusName); + .getfeatureValue(optionFeatusName); textBox.setText(Long.toString(savedValue)); textBoxLabel = new Label(detailSettingComp, SWT.TRANSPARENT); @@ -416,8 +414,8 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { info.setForeground(ColorResources.RED); info.setFont(FontResources.COMBO); - if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(featureName) == AnalyzerConstants.FEATURE_OFF) { + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( + featureName) == AnalyzerConstants.FEATURE_OFF) { textBox.getControl().setEnabled(false); } else { textBox.getControl().setEnabled(true); @@ -467,8 +465,6 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { } detailSettingComp.layout(true); - } else { - } } @@ -488,18 +484,15 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { if (items.length == 0) { return; } - if (ConfigurationDialogDataManager - .getInstance() - .getfeatureSwapValue(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) == AnalyzerConstants.FEATURE_OFF) { - ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue( - ConfigureLabels.SNAPSHOT_PERIODIC_AUTO, 1); + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( + ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) == AnalyzerConstants.FEATURE_OFF) { + ConfigurationDialogDataManager.getInstance().setfeatureValue( + ConfigureLabels.SNAPSHOT_PERIODIC_AUTO, 1); detailSettingCheckBox.setChecked(true); } else { - ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue( - ConfigureLabels.SNAPSHOT_PERIODIC_AUTO, 0); + ConfigurationDialogDataManager.getInstance().setfeatureValue( + ConfigureLabels.SNAPSHOT_PERIODIC_AUTO, 0); detailSettingCheckBox.setChecked(false); } updateDetails(); @@ -519,7 +512,7 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { if (checkValidInputText(featureName, textBox.getText())) { int textBoxData = Integer.parseInt(textBox.getText()); ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue( + .setfeatureValue( ConfigurationDialogDataManager.getInstance() .getOptionFeatureName(featureName), textBoxData); @@ -545,19 +538,19 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { private boolean checkValidInputText(String featuresName, String inputText) { if (inputText.isEmpty()) { - info.setText("value is empty");//$NON-NLS-1$ + info.setText(ConfigureLabels.VALUE_IS_EMPTY); ConfigurationDialogDataManager.getInstance() .updateSaveButtonStatus(false); return false; } else if (!isInteger(textBox.getText())) { - info.setText("you have to set character");//$NON-NLS-1$ + info.setText(ConfigureLabels.YOU_HAVE_TO_SET_CHARACTER); removeInputValue(); return false; } int value = Integer.parseInt(textBox.getText()); if (featuresName.equals(ConfigureLabels.FEATURE_FUNCTION_PROFILING)) { if (value < 0 || 100 < value) { - info.setText("value should be in range from 1 to 100");//$NON-NLS-1$ + info.setText(ConfigureLabels.VALUE_SHOULD_BE_IN_RANGE_FROM_1_TO_100); return false; } } @@ -575,7 +568,7 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { ) { if (value < 0 || 1000 < value) { - info.setText("value should be in range from 1 to 1000");//$NON-NLS-1$ + info.setText(ConfigureLabels.VALUE_SHOULD_BE_IN_RANGE_FROM_1_TO_100); return false; } } @@ -590,7 +583,7 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_DEVICE) || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_ENERGY)) { if (value % 10 != 0) { - info.setText("you have to set multiple of 10ms");//$NON-NLS-1$ + info.setText(ConfigureLabels.YOU_HAVE_TO_SET_MULTIPLE_OF_10MS); ConfigurationDialogDataManager.getInstance() .updateSaveButtonStatus(false); return false; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTable.java index 23ee725..9752693 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTable.java @@ -35,7 +35,6 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.model.TreeInput; import org.tizen.dynamicanalyzer.nl.ConfigureLabels; @@ -75,21 +74,13 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite { } } - private String isCheckFeatue(String featueName) { - if (AnalyzerConstants.FEATURE_OFF != ConfigurationDialogDataManager - .getInstance().getfeatureSwapValue(featueName)) { - return ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED; - } else { - return CommonConstants.EMPTY; - } - } - private TreeInput makeInput(String featueName) { DATableDataFormat tableData = new DATableDataFormat(0); List text = new ArrayList(); text.add(featueName); - String optionColumn = isCheckFeatue(featueName); + String optionColumn = ConfigurationDialogDataManager.getInstance() + .isCheckFeatue(featueName); String parentFeatureName = ConfigurationDialogDataManager.getInstance() .getParentFeatureName(featueName); if (!parentFeatureName.equals(CommonConstants.EMPTY)) { @@ -102,7 +93,8 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite { && ConfigurationDialogDataManager.getInstance() .getParentFeatureName(featueName) .equals(CommonConstants.EMPTY)) { - optionColumn += (ConfigurationDialogFeaturesPage.FEATURE_OPTION_VALUE + getOptionText(optionFeatureName)); + optionColumn += (ConfigurationDialogFeaturesPage.FEATURE_OPTION_VALUE + ConfigurationDialogDataManager + .getInstance().getOptionText(optionFeatureName)); } text.add(optionColumn); @@ -120,7 +112,7 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite { for (int i = 0; i < featuresList.length; i++) { String featuresName = featuresList[i]; TreeInput currentNode = makeInput(featuresName); - if (!ConfigurationDialogDataManager.getInstance().HasParentfeature( + if (!ConfigurationDialogDataManager.getInstance().hasParentfeature( featuresName)) { output.add(currentNode); } else { @@ -147,7 +139,8 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite { if (!optionFeatureName.equals(CommonConstants.EMPTY)) { text.add(ConfigurationDialogFeaturesPage.FEATURE_OPTION_VALUE - + getOptionText(optionFeatureName)); + + ConfigurationDialogDataManager.getInstance() + .getOptionText(optionFeatureName)); } else { text.add(ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED); } @@ -172,7 +165,6 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite { final int MOUSE_LEFT = 1; final int MOUSE_RIGHT = 3; GridItem item = table.getItem(new Point(event.x, event.y)); - if (null == item) { return; } @@ -268,38 +260,6 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite { } } - private String getOptionText(String featureName) { - - long optionFeatureValue = ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(featureName); - if (optionFeatureValue == AnalyzerConstants.FEATURE_OFF) { - return CommonConstants.EMPTY; - } - - StringBuffer optionValue = new StringBuffer(); - optionValue.append(CommonConstants.SPACE).append( - CommonConstants.OPEN_BRACKET); - - if (featureName.equals(ConfigureLabels.SNAPSHOT_PERIODIC)) { - if (ConfigurationDialogDataManager - .getInstance() - .getfeatureSwapValue(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) != AnalyzerConstants.FEATURE_OFF) { - optionValue.append(ConfigureLabels.AUTO); - } else { - optionValue.append(ConfigureLabels.SAMPLING - + Long.toString(optionFeatureValue)); - } - } else if (featureName - .equals(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC) - || featureName - .equals(ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC)) { - optionValue.append(ConfigureLabels.SAMPLING - + Long.toString(optionFeatureValue)); - } - optionValue.append(CommonConstants.CLOSE_BRACKET); - return optionValue.toString(); - } - private boolean isClickCheckBox(GridItem item, Event event) { String optionText = item.getText(tableTextOptionColumnIndex); int checkImgX = 0; @@ -337,16 +297,8 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite { } private void setConfigurationDialogDataManager(GridItem item, Event event) { - String featureName = item.getText(0); - String optionText = item.getText(tableTextOptionColumnIndex); - if (optionText - .contains(ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED)) { - ConfigurationDialogDataManager.getInstance().setFeaturesSwapValue( - featureName, true); - } else { - ConfigurationDialogDataManager.getInstance().setFeaturesSwapValue( - featureName, false); - } + ConfigurationDialogDataManager.getInstance() + .setFeaturesValueFromTableItemsList(table); } private void updateChildCheckBoxByParent(GridItem item, Event event) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTreeTableToggleRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTreeTableToggleRenderer.java index 33d15bb..c0db2c0 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTreeTableToggleRenderer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTreeTableToggleRenderer.java @@ -33,6 +33,7 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; +import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.resources.FontResources; import org.tizen.dynamicanalyzer.resources.ImageResources; @@ -120,8 +121,9 @@ public class ConfigurationDialogFeaturesTreeTableToggleRenderer extends String[] optionList = item.getText(1).split( ConfigurationDialogFeaturesPage.FEATURE_OPTION_VALUE); if (optionList.length > 1) { - if (optionList[1].contains(",")) { - String[] optionList2 = optionList[1].split(","); + if (optionList[1].contains(CommonConstants.COMMA)) { + String[] optionList2 = optionList[1] + .split(CommonConstants.COMMA); printText += optionList2[0]; } else { printText += optionList[1]; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogSettingPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogSettingPage.java index 7d482ee..4ef2886 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogSettingPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogSettingPage.java @@ -78,7 +78,7 @@ public class ConfigurationDialogSettingPage extends DAPageComposite { showInitialCheckBox.setBackground(ColorResources.DIALOG_BG_UPPER); showInitialCheckBox.setText(ConfigureLabels.SHOW_INITIAL); showInitialCheckBox.addSelectionListener(showInitiaRadioButtonListener); - if (ConfigurationDialogDataManager.getInstance().getfeatureSwapValue( + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( ConfigureLabels.SHOW_INITIAL) > 0) { showInitialCheckBox.setChecked(true); } else { @@ -106,7 +106,7 @@ public class ConfigurationDialogSettingPage extends DAPageComposite { autoStopCheckBox.setBackground(ColorResources.DIALOG_BG_UPPER); autoStopCheckBox.setText(ConfigureLabels.AUTO_STOP); autoStopCheckBox.addSelectionListener(autoStopRadioButtonListener); - if (ConfigurationDialogDataManager.getInstance().getfeatureSwapValue( + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( ConfigureLabels.AUTO_STOP) > 0) { autoStopCheckBox.setChecked(true); } else { @@ -127,13 +127,13 @@ public class ConfigurationDialogSettingPage extends DAPageComposite { @Override public void handleSelectionEvent(DACheckBox checkbox) { if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(ConfigureLabels.SHOW_INITIAL) > 0) { + .getfeatureValue(ConfigureLabels.SHOW_INITIAL) > 0) { ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue(ConfigureLabels.SHOW_INITIAL, 0); + .setfeatureValue(ConfigureLabels.SHOW_INITIAL, 0); showInitialCheckBox.setChecked(false); } else { ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue(ConfigureLabels.SHOW_INITIAL, 1); + .setfeatureValue(ConfigureLabels.SHOW_INITIAL, 1); showInitialCheckBox.setChecked(true); } ConfigurationDialogDataManager.getInstance() @@ -145,13 +145,13 @@ public class ConfigurationDialogSettingPage extends DAPageComposite { @Override public void handleSelectionEvent(DACheckBox checkbox) { if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(ConfigureLabels.AUTO_STOP) > 0) { + .getfeatureValue(ConfigureLabels.AUTO_STOP) > 0) { ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue(ConfigureLabels.AUTO_STOP, 0); + .setfeatureValue(ConfigureLabels.AUTO_STOP, 0); autoStopCheckBox.setChecked(false); } else { ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue(ConfigureLabels.AUTO_STOP, 1); + .setfeatureValue(ConfigureLabels.AUTO_STOP, 1); autoStopCheckBox.setChecked(true); } ConfigurationDialogDataManager.getInstance() diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/WelcomeDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/WelcomeDialog.java index 7832817..9421d72 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/WelcomeDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/WelcomeDialog.java @@ -61,7 +61,7 @@ public class WelcomeDialog extends DAMessageBox { public WelcomeDialog(Shell parent) { super(parent); ConfigurationDialogDataManager.getInstance() - .setSettingValueFromConfigureManager(); + .updateFeaturesValueFromConfigureManager(); } private DACustomButtonClickEventListener applyButtonListener = new DACustomButtonClickEventListener() { @@ -97,7 +97,7 @@ public class WelcomeDialog extends DAMessageBox { private void doBack() { ConfigurationDialogDataManager.getInstance() - .setSettingValueFromConfigureManager(); + .updateFeaturesValueFromConfigureManager(); notifyAutoRun(); } @@ -190,7 +190,7 @@ public class WelcomeDialog extends DAMessageBox { .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR); useAgainCheckButton.setText(ConfigureLabels.WELCONE_ASK_USE_AGAIN); useAgainCheckButton.addSelectionListener(useAgainCheckbuttonListener); - if (ConfigurationDialogDataManager.getInstance().getfeatureSwapValue( + if (ConfigurationDialogDataManager.getInstance().getfeatureValue( ConfigureLabels.SHOW_INITIAL) > 0) { useAgainCheckButton.setChecked(true); } else { @@ -239,13 +239,13 @@ public class WelcomeDialog extends DAMessageBox { @Override public void handleSelectionEvent(DACheckBox checkbox) { if (ConfigurationDialogDataManager.getInstance() - .getfeatureSwapValue(ConfigureLabels.SHOW_INITIAL) > 0) { + .getfeatureValue(ConfigureLabels.SHOW_INITIAL) > 0) { ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue(ConfigureLabels.SHOW_INITIAL, 0); + .setfeatureValue(ConfigureLabels.SHOW_INITIAL, 0); useAgainCheckButton.setChecked(false); } else { ConfigurationDialogDataManager.getInstance() - .setfeatureSwapValue(ConfigureLabels.SHOW_INITIAL, 1); + .setfeatureValue(ConfigureLabels.SHOW_INITIAL, 1); useAgainCheckButton.setChecked(true); } ConfigurationDialogDataManager.getInstance().updateSaveButtonStatus(null); -- 2.7.4