// check selected feature : , item_all_checked
if (target.isSelectedFeature(featureName) == true) {
optionColumn.append(FeatureDialog.ITEM_ALL_CHECKED);
- } else if (ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION.equals(featureName)) {
- if (target.isSelectedFeature(ConfigureLabels.FEATURE_NAME_SCREENSHOT)) {
- optionColumn.append(FeatureDialog.ITEM_ALL_CHECKED);
- }
} else {
optionColumn.append(CommonConstants.EMPTY);
}
TargetData target = SettingDataManager.getInstance().getTarget(null);
Map<String, FeatureData> map = target.getAvailableFeatureListMap();
- for (Map.Entry<String, FeatureData> entry : map.entrySet()) {
-
+ for (Map.Entry<String, FeatureData> entry : map.entrySet()) {
FeatureData feature = entry.getValue();
- if (feature.getFeatureName().equals(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY)) {
- continue;
- }
// check exist current feature node
if (existTreeInput(output, feature.getFeatureName()) == false) {
}
private String getDetailFeatureOptionText(String featureName) {
- if (featureName.equals(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION)) {
- return getScreenShotOptionText(featureName);
- } else if (featureName.equals(ConfigureLabels.FEATURE_DETAIL_VALUE_SYSTEM_SAMPLING_RATE)
+ if (featureName.equals(ConfigureLabels.FEATURE_DETAIL_VALUE_SYSTEM_SAMPLING_RATE)
|| featureName.equals(ConfigureLabels.FEATURE_DETAIL_VALUE_FUNCTION_PROFILING_SAMPLING_RATE)) {
return getSystemOptionText(featureName);
} else {
return optionValue.toString();
}
- private String getScreenShotOptionText(String featureName) {
- StringBuffer optionValue = new StringBuffer();
- TargetData target = SettingDataManager.getInstance().getTarget(null);
- boolean auto = target.isSelectedFeature(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION);
- boolean period = target.isSelectedFeature(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY);
-
- if (auto) { // select : auto radio button
- FeatureData periodFeature = target.getAvailableFeature(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY);
- optionValue.append(ConfigureLabels.AUTO + "1,");
- optionValue.append(ConfigureLabels.SAMPLING + periodFeature.getDefaultValue());
- } else if (auto == false) { // select : periodic radio button
- if (period) {
- optionValue.append(ConfigureLabels.AUTO + "0,");
- optionValue.append(ConfigureLabels.SAMPLING + target.getSelectedFeatureValue(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY));
- } else {
- FeatureData autoFeature = target.getAvailableFeature(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION);
- FeatureData periodFeature = target.getAvailableFeature(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY);
- optionValue.append(ConfigureLabels.AUTO + autoFeature.getDefaultValue() + ",");
- optionValue.append(ConfigureLabels.SAMPLING + periodFeature.getDefaultValue());
- }
- }
- return optionValue.toString();
- }
-
private Listener tableMouseListener = new Listener() {
@Override
public void handleEvent(Event event) {
return true;
}
return false;
- }
-
+ }
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioButton;
-import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioGroup;
-import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioSelectionListener;
import org.tizen.dynamicanalyzer.widgets.da.base.DAText;
public class FeatureDialogFeaturesTreeTableToggleRenderer extends AbstractRenderer {
private Label samplingInfo = null;
private GridEditor samplingEditor = null;
- // ScreenShot detail widget
- private Composite detailScreenShotComposit = null;
- private DARadioGroup radioGroup = null;
- private DARadioButton auto = null;
- private DARadioButton period = null;
- private DAText screenShotTextBox = null;
- private Label screenShotTextBoxLabel = null;
- private Label screenShotInfo = null;
- private GridEditor screenShotEditor = null;
-
public FeatureDialogFeaturesTreeTableToggleRenderer(Grid table) {
super();
setSize(11, 9);
// init widget
initSystemDetailWidget();
initSamplingDetailWidget();
- initSnapshotDetailWidget();
}
// TODO:refactoring about the legacy code.
updateSystemDetails(item);
} else if (ConfigureLabels.FEATURE_DETAIL_VALUE_FUNCTION_PROFILING_SAMPLING_RATE.equals(item.getText())) {
updateSamplingDetails(item);
- } else if (ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION.equals(item.getText())) {
- updateScreenShotDetails(item);
}
// check is running
}
- private void initSnapshotDetailWidget() {
- detailScreenShotComposit = new Composite(table, SWT.NONE);
- detailScreenShotComposit.setLayout(new FormLayout());
- detailScreenShotComposit.setBackground(ColorResources.SETTING_TABLE_CONTENTS_CHILD);
-
- radioGroup = new DARadioGroup();
- auto = new DARadioButton(detailScreenShotComposit, SWT.NONE);
- FormData data = new FormData();
- data.top = new FormAttachment(0, 3);
- data.left = new FormAttachment(0, 0);
- data.width = 135;
- data.height = 16;
- auto.setLayoutData(data);
- auto.setForeground(ColorResources.SETTING_COLOR);
- auto.setBackground(ColorResources.DIALOG_BG_UPPER);
- auto.setFont(FontResources.SETTING_DESCRIPTION_FONT);
- auto.setText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION);
- auto.addSelectionListener(autoScreenShotButtonListener);
- radioGroup.addChild(auto);
- auto.setBackground(ColorResources.SETTING_TABLE_CONTENTS_CHILD);
-
- period = new DARadioButton(detailScreenShotComposit, SWT.NONE);
- data = new FormData();
- data.top = new FormAttachment(0, 3);
- data.left = new FormAttachment(auto, 1);
- data.width = 90;
- data.height = 16;
- period.setLayoutData(data);
- period.setForeground(ColorResources.SETTING_COLOR);
- period.setBackground(ColorResources.DIALOG_BG_UPPER);
- period.setFont(FontResources.SETTING_DESCRIPTION_FONT);
- period.setText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY);
- period.addSelectionListener(periodScreenShotButtonListener);
- radioGroup.addChild(period);
- period.setBackground(ColorResources.SETTING_TABLE_CONTENTS_CHILD);
-
- // text box
- screenShotTextBox = new DAText(detailScreenShotComposit, SWT.SINGLE);
- data = new FormData();
- data.top = new FormAttachment(0, 4);
- data.left = new FormAttachment(period, 5);
- data.width = 50;
- data.height = 13;
- screenShotTextBox.setLayoutData(data);
-
- screenShotTextBox.setForeground(ColorResources.SETTING_COLOR);
- screenShotTextBox.setFont(FontResources.SETTING_DESCRIPTION_FONT);
- screenShotTextBox.getControl().addKeyListener(screenShotKeyListener);
-
- // label
- screenShotTextBoxLabel = new Label(detailScreenShotComposit, SWT.TRANSPARENT);
- screenShotTextBoxLabel.setText(ConfigureLabels.SECOND);
- data = new FormData();
- data.top = new FormAttachment(0, 5);
- data.left = new FormAttachment(screenShotTextBox.getControl(), 5);
- data.width = 15;
- data.height = 16;
- screenShotTextBoxLabel.setLayoutData(data);
- screenShotTextBoxLabel.setForeground(ColorResources.SETTING_COLOR);
- screenShotTextBoxLabel.setFont(FontResources.SETTING_DESCRIPTION_FONT);
- screenShotTextBoxLabel.setBackground(ColorResources.SETTING_TABLE_CONTENTS_CHILD);
-
- // waring label
- screenShotInfo = new Label(detailScreenShotComposit, SWT.TRANSPARENT);
- data = new FormData();
- data.top = new FormAttachment(0, 5);
- data.left = new FormAttachment(screenShotTextBoxLabel, 5);
- data.width = 250;
- data.height = 16;
- screenShotInfo.setLayoutData(data);
- screenShotInfo.setForeground(ColorResources.RED);
- screenShotInfo.setFont(FontResources.SETTING_DESCRIPTION_FONT);
- screenShotInfo.setBackground(ColorResources.SETTING_TABLE_CONTENTS_CHILD);
- }
-
private void updateSystemDetails(GridItem item) {
// text box
String text = getOptionText(item, ConfigureLabels.SAMPLING);
detailSamplingComposit.layout(true);
}
- private void updateScreenShotDetails(GridItem item) {
- // radio group
- boolean value = (getOptionText(item, ConfigureLabels.AUTO).equals("1")? true : false);
- if (value == true) {
- radioGroup.setSelection(auto);
- } else {
- radioGroup.setSelection(period);
- }
-
- // text box
- String text = getOptionText(item, ConfigureLabels.SAMPLING);
- if (text.equals(screenShotTextBox.getText()) == false) {
- screenShotTextBox.setText(text);
- }
-
- // check radio button
- if (period.isSelected() == true) {
- screenShotTextBox.getControl().setEnabled(true);
- checkValidInputText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY,
- screenShotTextBox, screenShotInfo);
- } else {
- screenShotTextBox.getControl().setEnabled(false);
- screenShotInfo.setText(CommonConstants.EMPTY);
- }
-
- // check parent feature
- if (isTableSelectedFeature(item.getParentItem().getText()) == true) {
- detailScreenShotComposit.setEnabled(true);
- } else {
- detailScreenShotComposit.setEnabled(false);
- screenShotTextBox.getControl().setEnabled(false);
- screenShotInfo.setText(CommonConstants.EMPTY);
- }
-
- screenShotEditor = new GridEditor(table);
- screenShotEditor.horizontalAlignment = SWT.LEFT;
- screenShotEditor.grabHorizontal = true;
- screenShotEditor.setEditor(detailScreenShotComposit, item, 0);
- detailScreenShotComposit.layout(true);
- }
-
private void checkRunningState() {
if (DACommunicator.isRunning()) {
if (null != systemTextBox) {
if (null != samplingTextBox) {
samplingTextBox.getControl().setEnabled(false);
}
-
- if (null != auto) {
- auto.setEnabled(false);
- }
-
- if (null != period) {
- period.setEnabled(false);
- }
-
- if (null != screenShotTextBox) {
- screenShotTextBox.getControl().setEnabled(false);
- }
}
}
item.setText(1, optionText);
}
- private DARadioSelectionListener autoScreenShotButtonListener = new DARadioSelectionListener() {
-
- @Override
- public void handleSelectionEvent(DARadioButton radio) {
- if (auto.isSelected()) {
- screenShotTextBox.getControl().setEnabled(false);
- setOptionText(getGridItem(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION),
- ConfigureLabels.AUTO, "1");
- }
- SettingDialogManager.getInstance().updateFeatureButtonStatus(table);
- }
- };
-
- private DARadioSelectionListener periodScreenShotButtonListener = new DARadioSelectionListener() {
-
- @Override
- public void handleSelectionEvent(DARadioButton radio) {
- if (period.isSelected()) {
- screenShotTextBox.getControl().setEnabled(true);
- setOptionText(getGridItem(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION),
- ConfigureLabels.AUTO, "0");
- }
- SettingDialogManager.getInstance().updateFeatureButtonStatus(table);
- }
- };
-
private KeyListener systemKeyListener = new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
}
};
-
- private KeyListener screenShotKeyListener = new KeyListener() {
-
- @Override
- public void keyReleased(KeyEvent e) {
- // check validation input text
- boolean valid = checkValidInputText(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY,
- screenShotTextBox, screenShotInfo);
- if (valid) {
- screenShotInfo.setText(CommonConstants.EMPTY);
- }
-
- // update button state
- setOptionText(getGridItem(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION),
- ConfigureLabels.SAMPLING, screenShotTextBox.getText());
- updateInputText(getGridItem(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION), valid);
-
- SettingDialogManager.getInstance().updateFeatureButtonStatus(table);
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- }
- };
/**
* {@inheritDoc}
public boolean validInputText(Grid table) {
for (int i = 0; i < table.getItemCount(); i++) {
- String featureName = table.getItem(i).getText(0);
String optionText = table.getItem(i).getText(1);
if ((optionText.contains(FeatureDialog.ITEM_ALL_CHECKED))
- || (optionText.contains(FeatureDialog.ITEM_PART_CHECKED))) {
-
- if (featureName.equals(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION)) {
- boolean value = (getOptionText(table.getItem(i), ConfigureLabels.AUTO).equals("1")? true : false);
- if (value == false && optionText.contains(FeatureDialog.FEATURE_INVALID_VALUE)) {
- return false;
- }
- } else if (optionText.contains(FeatureDialog.FEATURE_INVALID_VALUE)) {
+ || (optionText.contains(FeatureDialog.ITEM_PART_CHECKED))) {
+ if (optionText.contains(FeatureDialog.FEATURE_INVALID_VALUE)) {
return false;
}
}
featureValue = new FeatureValueData();
featureValue.setFeatureName(featureName);
featureValue.setValue(tableValue);
- } else if (ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION.equals(featureName)) {
- int tableAutoValue = Integer.parseInt(getOptionText(item, ConfigureLabels.AUTO));
- if (tableAutoValue == 1) {
- featureValue = new FeatureValueData();
- featureValue.setFeatureName(featureName);
- featureValue.setValue(1);
- } else {
- int tableValue = Integer.parseInt(getOptionText(item, ConfigureLabels.SAMPLING));
- featureValue = new FeatureValueData();
- featureValue.setFeatureName(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY);
- featureValue.setValue(tableValue);
- }
}
return featureValue;
}
if (value != tableValue) {
return true;
}
- } else if (ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION.equals(featureName)) {
- int tableAutoValue = Integer.parseInt(getOptionText(item, ConfigureLabels.AUTO));
- if (tableAutoValue == 1) {
- if (target.isSelectedFeature(
- ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_ON_SCENE_TRANSITION) == false) {
- return true;
- }
- } else {
- if (target.isSelectedFeature(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY) == false) {
- return true;
- } else {
- int value = target.getSelectedFeatureValue(ConfigureLabels.FEATURE_DETAIL_VALUE_SCREENSHOT_PERIODICALLY);
- int tableSamplingValue = Integer.parseInt(getOptionText(item, ConfigureLabels.SAMPLING));
- if (value != tableSamplingValue) {
- return true;
- }
- }
- }
}
return false;
}