--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
+import org.tizen.dynamicanalyzer.handlers.CommonAction;
+import org.tizen.dynamicanalyzer.handlers.UIAction;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.setting.SettingDataManager;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
+import org.tizen.dynamicanalyzer.widgets.da.view.DABaseComposite;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
+
+public class FlatFeatureDialog extends DAMessageBox {
+ private static boolean opened = false;
+ private DACustomButton cancelButton = null;
+ private DACustomButton okButton = null;
+ private boolean isApply = false;
+
+ private FlatFeatureDialogPage featurePage = null;
+
+ private Composite buttonContentsComp = null;
+
+ public FlatFeatureDialog(Shell parentShell) {
+ super(parentShell);
+ }
+
+ private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ /*
+ isApply = true;
+ doApply();
+ doRun();
+ */
+ shell.close(); // close dialog
+ }
+ };
+
+ private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ /*
+ isApply = true;
+ doRevert();
+ doRun();
+ */
+ shell.close(); // close dialog
+ }
+ };
+
+ private void doApply() {
+ if (DAState.isStartable()) {
+ // add & remove tab view page
+ UIAction.setPageBySetting();
+
+ // add & remove (timeline) chart
+ UIAction.setChartBySetting();
+
+ // write setting data
+ SettingDataManager.INSTANCE.applySettingData();
+ }
+ }
+
+ private void doRevert() {
+ // rollback setting data
+ SettingDataManager.INSTANCE.revertSettingData();
+ }
+
+ private void doRun() {
+ if (DAState.isStartable()) {
+ CommonAction.configure();
+ }
+ }
+
+ private void doWarningMessage() {
+ UIAction.showWarning(ConfigureLabels.SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE,
+ 550, 153);
+ }
+
+ protected boolean run() {
+ if (opened) {
+ return false;
+ }
+ IDECommunicator.setOpenWelcomeDlg(true);
+ shell.setSize(900, 500);
+ shell.setLayout(new FormLayout());
+ shell.setText(AnalyzerLabels.SETTING_TITLE);
+ shell.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+
+ // content composite
+ Composite contentsComp = new Composite(shell, SWT.NONE);
+ FormLayout compLayout = new FormLayout();
+ contentsComp.setLayout(compLayout);
+ contentsComp.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+ FormData compData = new FormData();
+ compData.top = new FormAttachment(0, 0);
+ compData.left = new FormAttachment(0, 0);
+ compData.right = new FormAttachment(100, 0);
+ compData.bottom = new FormAttachment(100, -49);
+ contentsComp.setLayoutData(compData);
+
+ featurePage = new FlatFeatureDialogPage(contentsComp, SWT.NONE);
+
+ // button composite
+ buttonContentsComp = new Composite(shell, SWT.NONE);
+ compLayout = new FormLayout();
+ buttonContentsComp.setLayout(compLayout);
+ buttonContentsComp
+ .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+ compData = new FormData();
+ compData.top = new FormAttachment(contentsComp, 0);
+ compData.left = new FormAttachment(0, 0);
+ compData.right = new FormAttachment(100, 0);
+ compData.bottom = new FormAttachment(100, 0);
+ buttonContentsComp.setLayoutData(compData);
+ buttonContentsComp.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_1);
+ e.gc.drawLine(0, 0, rect.width - 1, 0);
+ e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_2);
+ e.gc.drawLine(0, 1, rect.width - 1, 1);
+ }
+ });
+
+ okButton = new DAButton(buttonContentsComp, SWT.NONE);
+ okButton.addClickListener(okButtonListener);
+ okButton.setText(WidgetLabels.OK);
+ okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+ FormData buttonData = new FormData();
+ buttonData.right = new FormAttachment(100, -9);
+ buttonData.top = new FormAttachment(0, 11);
+ buttonData.width = 100;
+ buttonData.height = 28;
+ okButton.setLayoutData(buttonData);
+
+ cancelButton = new DAButton(buttonContentsComp, SWT.NONE);
+ cancelButton.addClickListener(cancelButtonListener);
+ cancelButton.setText(WidgetLabels.CANCEL);
+ cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+ buttonData = new FormData();
+ buttonData.right = new FormAttachment(okButton, -8);
+ buttonData.top = new FormAttachment(0, 11);
+ buttonData.width = 100;
+ buttonData.height = 28;
+ cancelButton.setLayoutData(buttonData);
+
+ shell.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ opened = false;
+ ShortCutManager.getInstance().setEnabled(!opened);
+ }
+
+ });
+
+ opened = true;
+ ShortCutManager.getInstance().setEnabled(!opened);
+
+ shell.addShellListener(shellListener);
+ shell.open();
+ return true;
+ }
+
+ private void notifyAutoRun() {
+ synchronized (IDECommunicator.getWaitingWelcomeDlg()) {
+ IDECommunicator.setOpenWelcomeDlg(false);
+ IDECommunicator.getWaitingWelcomeDlg().notifyAll();
+ }
+ }
+
+ private ShellListener shellListener = new ShellListener() {
+
+ @Override
+ public void shellActivated(ShellEvent e) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void shellClosed(ShellEvent e) {
+ // TODO Auto-generated method stub
+ /*
+ if (!isApply) {
+ doRevert();
+ doRun();
+ }
+ notifyAutoRun();
+ */
+ }
+
+ @Override
+ public void shellDeactivated(ShellEvent e) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void shellDeiconified(ShellEvent e) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void shellIconified(ShellEvent e) {
+ // TODO Auto-generated method stub
+ }
+
+ };
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.setting.Feature;
+import org.tizen.dynamicanalyzer.setting.FeatureData;
+import org.tizen.dynamicanalyzer.setting.FeatureValueData;
+import org.tizen.dynamicanalyzer.setting.SettingDataManager;
+import org.tizen.dynamicanalyzer.setting.TargetData;
+import org.tizen.dynamicanalyzer.setting.Template;
+import org.tizen.dynamicanalyzer.setting.TemplateData;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
+import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButtonGroup;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+
+public class FlatFeatureDialogPage extends DAPageComposite {
+ private enum ProfileDisplayInfo {
+ PROFILE_NAME_MOBILE(0, ConfigureLabels.TARGET_NAME_MOBILE,
+ ImageResources.TARGET_NAME_MOBILE),
+ PROFILE_NAME_TV(1, ConfigureLabels.TARGET_NAME_TV, ImageResources.TARGET_NAME_TV),
+ PROFILE_NAME_WEARABLE(2, ConfigureLabels.TARGET_NAME_WEARABLE,
+ ImageResources.TARGET_NAME_WEARABLE);
+
+ private int id = -1;
+ private String displayName = null;
+ private Image image = null;
+
+ private ProfileDisplayInfo(int id, String displayName, Image image) {
+ this.id = id;
+ this.displayName = displayName;
+ this.image = image;
+ }
+
+ public static Image getImage(String displayName) {
+ ProfileDisplayInfo[] profiles = ProfileDisplayInfo.values();
+ for (ProfileDisplayInfo profile : profiles) {
+ if (profile.displayName.equals(displayName)) {
+ return profile.image;
+ }
+ }
+ return null;
+ }
+ };
+
+ private enum FeatureDisplayInfo {
+ TEMPLATE_NAME_BOTTLENECK(0, ConfigureLabels.TEMPLATE_NAME_BOTTLENECK,
+ ImageResources.TEMPLATE_BOTTLENECK_ANALYSIS),
+ TEMPLATE_NAME_MEMORY_LEAKS(1, ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS,
+ ImageResources.TEMPLATE_MEMORY_LEAK),
+ TEMPLATE_NAME_PROCESS_ACTIVITY(2, ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY,
+ ImageResources.TEMPLATE_PROCESS_ACTIVITY),
+ TEMPLATE_NAME_FILE(3, ConfigureLabels.TEMPLATE_NAME_FILE,
+ ImageResources.TEMPLATE_FILE_ANALYSIS),
+ TEMPLATE_NAME_THREAD_ACTIVITY(4, ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY,
+ ImageResources.TEMPLATE_THREAD_ACTIVITY_ANALYSIS),
+ TEMPLATE_NAME_WAIT_STATUS(5, ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS,
+ ImageResources.TEMPLATE_WAIT_STATUS_ANALYSIS),
+ TEMPLATE_NAME_NETWORK(6, ConfigureLabels.TEMPLATE_NAME_NETWORK,
+ ImageResources.TEMPLATE_NETWORK_ANALYSIS),
+ TEMPLATE_NAME_OPEN_GL(7, ConfigureLabels.TEMPLATE_NAME_OPEN_GL,
+ ImageResources.TEMPLATE_OPEN_GL_ANALYSIS),
+ TEMPLATE_NAME_ENERGY(8, ConfigureLabels.TEMPLATE_NAME_ENERGY,
+ ImageResources.TEMPLATE_ENERGY),
+ TEMPLATE_NAME_HIERARCHY_VIEWER(9, ConfigureLabels.TEMPLATE_NAME_UI_HIERARCHY,
+ ImageResources.TEMPLATE_UI_HIERARCHY_ANALYSIS),
+ TEMPLATE_NAME_CUSTOM(10, ConfigureLabels.TEMPLATE_NAME_CUSTOM,
+ ImageResources.TEMPLATE_CUSTOM);
+
+ private int id = -1;
+ private String displayName = null;
+ private Image image = null;
+
+ private FeatureDisplayInfo(int id, String displayName, Image image) {
+ this.id = id;
+ this.displayName = displayName;
+ this.image = image;
+ }
+
+ public static Image getImage(String displayName) {
+ FeatureDisplayInfo[] templates = FeatureDisplayInfo.values();
+ for (FeatureDisplayInfo template : templates) {
+ if (template.displayName.equals(displayName)) {
+ return template.image;
+ }
+ }
+ return null;
+ }
+ };
+
+ // target widget
+ private Composite targetComp = null;
+ private Label targetLabel = null;
+ private ScrolledComposite targetScrolledComposite = null;
+ private Composite targetInputComposite = null;
+
+ // feature list widget
+ private Composite featureListComp = null;
+ private Label featureListTitleLabel = null;
+ private Label featureIcon = null;
+ private Label featureNameLabel = null;
+ private Label featureDescriptionLabel = null;
+ private ScrolledComposite featureListScrolledComposite = null;
+ private Composite featureListInputComposite = null;
+
+ // selected feature widget
+ private Composite selectedFeatureComp = null;
+ private Label selectedFeatureLabel = null;
+ private ScrolledComposite selectionScrolledComposite = null;
+ private Composite inputComposite = null;
+
+ private DACustomButton detailButton = null;
+
+ private DACustomButtonClickEventListener detailButtonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ // show feature dialog
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ FeatureDialog dialog = new FeatureDialog(shell);
+ Object result = dialog.open();
+ if (result != null) {
+ // update template page view
+ createFeatureListComposite();
+ createFeatureSelectionComposite();
+ }
+ }
+ };
+
+ public FlatFeatureDialogPage(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FormLayout());
+ this.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+ createTargetComposite();
+ createFeatureSelectionComposite();
+ createFeatureListComposite();
+ }
+
+ private void initTargetCompositeWidget() {
+ if (null != targetLabel) {
+ targetLabel.dispose();
+ targetLabel = null;
+ }
+
+ if (null != targetScrolledComposite) {
+ targetScrolledComposite.dispose();
+ targetScrolledComposite = null;
+ }
+
+ if (null != targetInputComposite) {
+ targetInputComposite.dispose();
+ targetInputComposite = null;
+ }
+ }
+
+ private void initFeatureListWidget() {
+ if (null != featureListTitleLabel) {
+ featureListTitleLabel.dispose();
+ featureListTitleLabel = null;
+ }
+
+ if (null != featureIcon) {
+ featureIcon.dispose();
+ featureIcon = null;
+ }
+
+ if (null != featureNameLabel) {
+ featureNameLabel.dispose();
+ featureNameLabel = null;
+ }
+
+ if (null != featureDescriptionLabel) {
+ featureDescriptionLabel.dispose();
+ featureDescriptionLabel = null;
+ }
+
+ if (null != featureListScrolledComposite) {
+ featureListScrolledComposite.dispose();
+ featureListScrolledComposite = null;
+ }
+
+ if (null != featureListInputComposite) {
+ featureListInputComposite.dispose();
+ featureListInputComposite = null;
+ }
+ }
+
+ private void initFeatureSelectionWidget() {
+ if (null != selectedFeatureLabel) {
+ selectedFeatureLabel.dispose();
+ selectedFeatureLabel = null;
+ }
+
+ if (null != selectionScrolledComposite) {
+ selectionScrolledComposite.dispose();
+ selectionScrolledComposite = null;
+ }
+
+ if (null != inputComposite) {
+ inputComposite.dispose();
+ inputComposite = null;
+ }
+ }
+
+ private DACustomToggleButton createToggleButton(Composite composit, Image image,
+ Point imagePoint, String title, Point fontPoint, int width, int height,
+ int topPosition, int leftPosition) {
+
+ DACustomToggleButton toggle = new DACustomToggleButton(composit, SWT.NONE);
+
+ // color and image
+ if (image != null) {
+ toggle.setColors(ColorResources.SETTING_BUTTON_NORMAL_COLOR,
+ ColorResources.SETTING_BUTTON_PUSH_COLOR,
+ ColorResources.SETTING_BUTTON_HOVER_COLOR,
+ ColorResources.SETTING_BUTTON_DISABLE_COLOR,
+ ColorResources.SETTING_BUTTON_TOGGLE_NORMAL_COLOR,
+ ColorResources.SETTING_BUTTON_TOGGLE_HOVER_COLOR,
+ ColorResources.SETTING_BUTTON_TOGGLE_PUSH_COLOR);
+ toggle.setButtonImages(image, image, image, image, image, image, image);
+ }
+ toggle.setButtonImagePoint(imagePoint);
+
+ // font
+ if (title != null) {
+ toggle.setTitle(title);
+ toggle.setFontPoint(fontPoint);
+ toggle.setFontColors(ColorResources.SETTING_COLOR, ColorResources.SETTING_COLOR,
+ ColorResources.SETTING_COLOR, ColorResources.SETTING_COLOR);
+ toggle.setButtonFont(FontResources.SETTING_BUTTON_FONT);
+ }
+
+ // layout
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, topPosition);
+ data.left = new FormAttachment(0, leftPosition);
+ data.width = width;
+ data.height = height;
+ toggle.setLayoutData(data);
+
+ return toggle;
+ }
+
+ public void createTargetComposite() {
+ initTargetCompositeWidget();
+
+ // Composite
+ if (null == targetComp) {
+ targetComp = new Composite(this, SWT.NONE);
+ targetComp.setLayout(new FormLayout());
+ FormData compData = new FormData();
+ compData.top = new FormAttachment(0, 0);
+ compData.left = new FormAttachment(0, 0);
+ compData.width = 300;
+ compData.height = 500;
+ targetComp.setLayoutData(compData);
+ targetComp.setBackground(ColorResources.WHITE);
+
+ targetComp.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+ e.gc.setForeground(ColorResources.SETTING_STROKE);
+ e.gc.drawRectangle(r);
+ e.gc.drawLine(0, 22, rect.width, 22);
+ /*
+ e.gc.setBackground(ColorResources.SETTING_TITLE_BACKGROUND);
+ e.gc.fillRectangle(1, 1, 100, 40);
+ */
+ }
+ });
+ }
+
+ // label
+ targetLabel = new Label(targetComp, SWT.TRANSPARENT);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 4);
+ data.left = new FormAttachment(0, 1);
+ data.height = 18;
+ data.width = 84;
+ targetLabel.setLayoutData(data);
+ targetLabel.setText(ConfigureLabels.SETTING_DIALOG_TARGET_TITLE);
+ targetLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND);
+ targetLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ targetLabel.setFont(FontResources.SETTING_TITLE_FONT);
+ targetLabel.setAlignment(SWT.CENTER);
+
+ // scrolledComposite
+ targetScrolledComposite = new ScrolledComposite(targetComp, SWT.BORDER | SWT.V_SCROLL
+ | SWT.H_SCROLL);
+ targetScrolledComposite.setLayout(new FormLayout());
+ data = new FormData();
+ data.top = new FormAttachment(targetLabel, 1);
+ data.left = new FormAttachment(0, 1);
+ data.right = new FormAttachment(100, -1);
+ data.bottom = new FormAttachment(100, -1);
+ targetScrolledComposite.setLayoutData(data);
+ targetScrolledComposite.setExpandHorizontal(true);
+ targetScrolledComposite.setExpandVertical(true);
+ targetScrolledComposite.setBackground(ColorResources.WHITE);
+
+ // composite : input
+ targetInputComposite = new Composite(targetScrolledComposite, SWT.NONE);
+ targetScrolledComposite.setContent(targetInputComposite);
+ targetScrolledComposite.setMinSize(targetInputComposite.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+ targetScrolledComposite.setShowFocusedControl(true);
+ targetInputComposite.setLayout(new FormLayout());
+ data = new FormData();
+ data.top = new FormAttachment(0, 1);
+ data.left = new FormAttachment(0, 1);
+ data.right = new FormAttachment(100, -1);
+ data.bottom = new FormAttachment(100, -1);
+ targetInputComposite.setLayoutData(data);
+ targetInputComposite.setBackground(ColorResources.WHITE);
+
+ // ToogleButtonGroup
+ Map<String, TargetData> targetList = SettingDataManager.INSTANCE.getTargetListMap();
+ String selectedTarget = SettingDataManager.INSTANCE.getConnectedTarget().getTargetName();
+ SettingDataManager.INSTANCE.setSelectedTarget(selectedTarget);
+ DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup();
+ Point imagePoint = new Point(18, 8);
+ Point fontPoint = new Point(-1, 60);
+ int topPosition = 4;
+ int leftPosition = 3;
+
+ for (Map.Entry<String, TargetData> entry : targetList.entrySet()) {
+ TargetData target = entry.getValue();
+
+ DACustomToggleButton toggle = createToggleButton(targetInputComposite,
+ ProfileDisplayInfo.getImage(target.getTargetName()), imagePoint,
+ target.getTargetName(), fontPoint, 76, 76, topPosition, leftPosition);
+ targetGroup.addToggleButton(toggle);
+
+ // listener
+ toggle.addListener(SWT.MouseUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget;
+ if (toggleButton.isToggled()) {
+
+ // set selected target
+ SettingDataManager.INSTANCE.setSelectedTarget(toggleButton.getText());
+
+ // update template view
+ createFeatureListComposite();
+ createFeatureSelectionComposite();
+ }
+ }
+ });
+
+ // set next position
+ topPosition += 80;
+
+ // set selection target
+ if (selectedTarget.equals(entry.getKey()) == true) {
+ targetGroup.setSelection(toggle);
+ }
+ }
+ targetComp.layout(true);
+ targetInputComposite.layout();
+ targetScrolledComposite.setMinSize(targetInputComposite.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+
+ if (!DAState.isStartable()) {
+ targetComp.setEnabled(false);
+ }
+ }
+
+ public void createFeatureListComposite() {
+ initFeatureListWidget();
+
+ if (null == featureListComp) {
+
+ // Composite
+ featureListComp = new Composite(this, SWT.NONE);
+ featureListComp.setLayout(new FormLayout());
+ FormData compData = new FormData();
+ compData.top = new FormAttachment(0, 0);
+ compData.left = new FormAttachment(0, 300);
+ compData.width = 300;
+ compData.height = 500;
+ featureListComp.setLayoutData(compData);
+ featureListComp.setBackground(ColorResources.WHITE);
+
+ featureListComp.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+ e.gc.setForeground(ColorResources.SETTING_STROKE);
+ e.gc.drawRectangle(r);
+ e.gc.drawLine(0, 22, rect.width, 22);
+ }
+ });
+ }
+
+ // label
+ featureListTitleLabel = new Label(featureListComp, SWT.TRANSPARENT);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 4);
+ data.left = new FormAttachment(0, 1);
+ data.height = 18;
+ data.width = 300;
+ featureListTitleLabel.setLayoutData(data);
+ featureListTitleLabel.setText(ConfigureLabels.SETTING_DIALOG_FEATURELIST_TITLE);
+ featureListTitleLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND);
+ featureListTitleLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ featureListTitleLabel.setFont(FontResources.SETTING_TITLE_FONT);
+ featureListTitleLabel.setAlignment(SWT.CENTER);
+
+ // featureListScrolledComposite
+ featureListScrolledComposite = new ScrolledComposite(featureListComp, SWT.BORDER | SWT.V_SCROLL
+ | SWT.H_SCROLL);
+ featureListScrolledComposite.setLayout(new FormLayout());
+ data = new FormData();
+ data.top = new FormAttachment(featureListTitleLabel, 1);
+ data.left = new FormAttachment(0, 1);
+ data.right = new FormAttachment(100, -1);
+ data.bottom = new FormAttachment(100, -1);
+ featureListScrolledComposite.setLayoutData(data);
+ featureListScrolledComposite.setExpandHorizontal(true);
+ featureListScrolledComposite.setExpandVertical(true);
+ featureListScrolledComposite.setBackground(ColorResources.WHITE);
+
+ // composite : input
+ featureListInputComposite = new Composite(featureListScrolledComposite, SWT.NONE);
+ featureListScrolledComposite.setContent(featureListInputComposite);
+ featureListScrolledComposite.setMinSize(featureListInputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ featureListScrolledComposite.setShowFocusedControl(true);
+ featureListInputComposite.setLayout(new FormLayout());
+ data = new FormData();
+ data.top = new FormAttachment(0, 1);
+ data.left = new FormAttachment(0, 1);
+ data.right = new FormAttachment(100, -1);
+ data.bottom = new FormAttachment(100, -1);
+ featureListInputComposite.setLayoutData(data);
+ featureListInputComposite.setBackground(ColorResources.WHITE);
+
+ // ToogleButtonGroup
+ String selectedTarget = SettingDataManager.INSTANCE.getSelectedTarget();
+ DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup();
+ Point imagePoint = new Point(23, 8);
+ Point fontPoint = new Point(-1, 60);
+ int defaultLeftPosition = 21; // linux, mac
+ if (CommonUtil.isWin()) {
+ defaultLeftPosition = 13;
+ }
+
+ int topPosition = 4;
+ int leftPosition = defaultLeftPosition;
+
+ TargetData target = SettingDataManager.INSTANCE.getTarget(selectedTarget);
+ //Template featureListTemplate = target.getSelectedTemplate();
+ List<Feature> featureList = target.getAvailableFeatureList();
+ target.clearSelectedFeature();
+ for (int i = 0; i < featureList.size(); i++) {
+ FeatureData feature = featureList.get(i).getData();
+ // todo: FeatureDisplayInfo organise
+ // todo: FeatureList needs multiple selection, replace toggle buttons.
+ DACustomToggleButton toggle = createToggleButton(featureListInputComposite,
+ FeatureDisplayInfo.getImage(feature.getFeatureName()), imagePoint,
+ feature.getFeatureName(), fontPoint, 92, 76, topPosition, leftPosition);
+ targetGroup.addToggleButton(toggle);
+
+ // listener
+ toggle.addListener(SWT.MouseUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget;
+ if (toggleButton.isToggled()) {
+ // set select feature
+ // todo: add/remove selectedfeature as button status
+ TargetData target = SettingDataManager.INSTANCE.getTarget(null);
+ target.addSelectedFeature(toggleButton.getText());
+
+ createFeatureSelectionComposite();
+ }
+ }
+ });
+
+ // set next position
+ if (leftPosition + 96 < 480) {
+ leftPosition += 96;
+ } else {
+ leftPosition = defaultLeftPosition;
+ topPosition += 79;
+ }
+
+ // set selection template
+ //if (templateList.get(i).equals(featureListTemplate)) {
+ // targetGroup.setSelection(toggle);
+ //}
+ }
+
+ featureListComp.layout(true);
+ }
+
+ public void createFeatureSelectionComposite() {
+ initFeatureSelectionWidget();
+
+ // Composite
+ if (null == selectedFeatureComp) {
+ selectedFeatureComp = new Composite(this, SWT.NONE);
+ selectedFeatureComp.setLayout(new FormLayout());
+ FormData compData = new FormData();
+ compData.top = new FormAttachment(0, 0);
+ compData.left = new FormAttachment(0, 600);
+ compData.width = 300;
+ compData.height = 500;
+ selectedFeatureComp.setLayoutData(compData);
+ selectedFeatureComp.setBackground(ColorResources.WHITE);
+
+ selectedFeatureComp.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+ e.gc.setForeground(ColorResources.SETTING_STROKE);
+ e.gc.drawRectangle(r);
+ e.gc.drawLine(0, 22, rect.width, 22);
+
+ e.gc.setBackground(ColorResources.SETTING_TITLE_BACKGROUND);
+ e.gc.fillRectangle(1, 1, 522, 21);
+
+ }
+ });
+ }
+
+ // label : selected feature
+ selectedFeatureLabel = new Label(selectedFeatureComp, SWT.TRANSPARENT);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 4);
+ data.left = new FormAttachment(0, 1);
+ data.height = 18;
+ data.width = 300;
+ selectedFeatureLabel.setLayoutData(data);
+ selectedFeatureLabel.setText(ConfigureLabels.SETTING_DIALOG_SELECTED_TITLE);
+ selectedFeatureLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND);
+ selectedFeatureLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ selectedFeatureLabel.setFont(FontResources.SETTING_TITLE_FONT);
+ selectedFeatureLabel.setAlignment(SWT.CENTER);
+
+ // selectionScrolledComposite
+ selectionScrolledComposite = new ScrolledComposite(selectedFeatureComp, SWT.BORDER | SWT.V_SCROLL
+ | SWT.H_SCROLL);
+ selectionScrolledComposite.setLayout(new FormLayout());
+ data = new FormData();
+ data.top = new FormAttachment(selectedFeatureLabel, 1);
+ data.left = new FormAttachment(0, 1);
+ data.right = new FormAttachment(100, -1);
+ data.bottom = new FormAttachment(100, -1);
+ selectionScrolledComposite.setLayoutData(data);
+ selectionScrolledComposite.setExpandHorizontal(true);
+ selectionScrolledComposite.setExpandVertical(true);
+ selectionScrolledComposite.setBackground(ColorResources.WHITE);
+
+ // composite : input
+ inputComposite = new Composite(selectionScrolledComposite, SWT.NONE);
+ selectionScrolledComposite.setContent(inputComposite);
+ selectionScrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ selectionScrolledComposite.setShowFocusedControl(true);
+ inputComposite.setLayout(new FormLayout());
+ data = new FormData();
+ data.top = new FormAttachment(0, 1);
+ data.left = new FormAttachment(0, 1);
+ data.right = new FormAttachment(100, -1);
+ data.bottom = new FormAttachment(100, -1);
+ inputComposite.setLayoutData(data);
+ inputComposite.setBackground(ColorResources.WHITE);
+
+ // ToogleButtonGroup
+ DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup();
+
+ Point imagePoint = new Point(23, 8);
+ Point fontPoint = new Point(-1, 60);
+ int defaultLeftPosition = 21; // linux, mac
+ if (CommonUtil.isWin()) {
+ defaultLeftPosition = 13;
+ }
+ int topPosition = 4;
+ int leftPosition = defaultLeftPosition;
+
+ String selectedTarget = SettingDataManager.INSTANCE.getSelectedTarget();
+ TargetData target = SettingDataManager.INSTANCE.getTarget(selectedTarget);
+ //Template featureListTemplate = target.getSelectedTemplate();
+ List<FeatureValueData> featureList = target.getSelectedFeatureList();
+ for (int i = 0; i < featureList.size(); i++) {
+ Feature feature = featureList.get(i).getKey();
+ // todo: FeatureDisplayInfo organise
+ // todo: selectedFeature needs cancel button, replace toggle
+ DACustomToggleButton toggle = createToggleButton(inputComposite,
+ FeatureDisplayInfo.getImage(feature.getName()), imagePoint,
+ feature.getName(), fontPoint, 92, 76, topPosition, leftPosition);
+ targetGroup.addToggleButton(toggle);
+
+ // listener
+ toggle.addListener(SWT.MouseUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget;
+ if (toggleButton.isToggled()) {
+ // set select feature
+ // todo: add/remove selectedfeature as button status
+ TargetData target = SettingDataManager.INSTANCE.getTarget(null);
+ target.addSelectedFeature(toggleButton.getText());
+
+ createFeatureSelectionComposite();
+ }
+ }
+ });
+
+ // set next position
+ if (leftPosition + 96 < 480) {
+ leftPosition += 96;
+ } else {
+ leftPosition = defaultLeftPosition;
+ topPosition += 79;
+ }
+
+ // set selection template
+ //if (templateList.get(i).equals(featureListTemplate)) {
+ // targetGroup.setSelection(toggle);
+ //}
+ }
+
+ selectedFeatureComp.layout(true);
+ inputComposite.layout();
+ selectionScrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
+ if (!DAState.isStartable()) {
+ selectedFeatureComp.setEnabled(false);
+ }
+ }
+}
import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
-public class SettingDialogTemplatePage extends DAPageComposite {
+public class SettingDialogTemplatePage extends DAPageComposite {
private enum ProfileDisplayInfo {
PROFILE_NAME_MOBILE(0, ConfigureLabels.TARGET_NAME_MOBILE,
ImageResources.TARGET_NAME_MOBILE),
PROFILE_NAME_TV(1, ConfigureLabels.TARGET_NAME_TV, ImageResources.TARGET_NAME_TV),
PROFILE_NAME_WEARABLE(2, ConfigureLabels.TARGET_NAME_WEARABLE,
ImageResources.TARGET_NAME_WEARABLE);
-
+
private int id = -1;
private String displayName = null;
private Image image = null;
-
+
private ProfileDisplayInfo(int id, String displayName, Image image) {
this.id = id;
this.displayName = displayName;
this.image = image;
}
-
+
public static Image getImage(String displayName) {
ProfileDisplayInfo[] profiles = ProfileDisplayInfo.values();
for (ProfileDisplayInfo profile : profiles) {
return null;
}
};
-
+
private enum TemplateDisplayInfo {
- TEMPLATE_NAME_BOTTLENECK(0, ConfigureLabels.TEMPLATE_NAME_BOTTLENECK,
+ TEMPLATE_NAME_BOTTLENECK(0, ConfigureLabels.TEMPLATE_NAME_BOTTLENECK,
ImageResources.TEMPLATE_BOTTLENECK_ANALYSIS),
- TEMPLATE_NAME_MEMORY_LEAKS(1, ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS,
+ TEMPLATE_NAME_MEMORY_LEAKS(1, ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS,
ImageResources.TEMPLATE_MEMORY_LEAK),
- TEMPLATE_NAME_PROCESS_ACTIVITY(2, ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY,
+ TEMPLATE_NAME_PROCESS_ACTIVITY(2, ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY,
ImageResources.TEMPLATE_PROCESS_ACTIVITY),
- TEMPLATE_NAME_FILE(3, ConfigureLabels.TEMPLATE_NAME_FILE,
+ TEMPLATE_NAME_FILE(3, ConfigureLabels.TEMPLATE_NAME_FILE,
ImageResources.TEMPLATE_FILE_ANALYSIS),
- TEMPLATE_NAME_THREAD_ACTIVITY(4, ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY,
+ TEMPLATE_NAME_THREAD_ACTIVITY(4, ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY,
ImageResources.TEMPLATE_THREAD_ACTIVITY_ANALYSIS),
- TEMPLATE_NAME_WAIT_STATUS(5, ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS,
+ TEMPLATE_NAME_WAIT_STATUS(5, ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS,
ImageResources.TEMPLATE_WAIT_STATUS_ANALYSIS),
- TEMPLATE_NAME_NETWORK(6, ConfigureLabels.TEMPLATE_NAME_NETWORK,
+ TEMPLATE_NAME_NETWORK(6, ConfigureLabels.TEMPLATE_NAME_NETWORK,
ImageResources.TEMPLATE_NETWORK_ANALYSIS),
- TEMPLATE_NAME_OPEN_GL(7, ConfigureLabels.TEMPLATE_NAME_OPEN_GL,
+ TEMPLATE_NAME_OPEN_GL(7, ConfigureLabels.TEMPLATE_NAME_OPEN_GL,
ImageResources.TEMPLATE_OPEN_GL_ANALYSIS),
- TEMPLATE_NAME_ENERGY(8, ConfigureLabels.TEMPLATE_NAME_ENERGY,
+ TEMPLATE_NAME_ENERGY(8, ConfigureLabels.TEMPLATE_NAME_ENERGY,
ImageResources.TEMPLATE_ENERGY),
TEMPLATE_NAME_HIERARCHY_VIEWER(9, ConfigureLabels.TEMPLATE_NAME_UI_HIERARCHY,
ImageResources.TEMPLATE_UI_HIERARCHY_ANALYSIS),
TEMPLATE_NAME_CUSTOM(10, ConfigureLabels.TEMPLATE_NAME_CUSTOM,
ImageResources.TEMPLATE_CUSTOM);
-
+
private int id = -1;
private String displayName = null;
private Image image = null;
-
+
private TemplateDisplayInfo(int id, String displayName, Image image) {
this.id = id;
this.displayName = displayName;
this.image = image;
}
-
+
public static Image getImage(String displayName) {
TemplateDisplayInfo[] templates = TemplateDisplayInfo.values();
for (TemplateDisplayInfo template : templates) {
private DACustomButton detailButton = null;
+ private SettingDialogTemplatePage me = null;
+
private DACustomButtonClickEventListener detailButtonListener = new DACustomButtonClickEventListener() {
@Override
FeatureDialog dialog = new FeatureDialog(shell);
Object result = dialog.open();
if (result != null) {
- // update template page view
createTemplateTitleComposite();
createTemplateDescriptionComposite();
}
TargetData target = entry.getValue();
DACustomToggleButton toggle = createToggleButton(targetInputComposite,
- ProfileDisplayInfo.getImage(target.getTargetName()), imagePoint,
+ ProfileDisplayInfo.getImage(target.getTargetName()), imagePoint,
target.getTargetName(), fontPoint, 76, 76, topPosition, leftPosition);
targetGroup.addToggleButton(toggle);
if (CommonUtil.isWin()) {
defaultLeftPosition = 13;
}
-
int topPosition = 4;
int leftPosition = defaultLeftPosition;
TargetData target = SettingDataManager.INSTANCE.getTarget(null);
String preSelectedTemplate = target.getSelectedTemplate().getName();
- // template change
+ // TODO : redefine custom template usage
if (!preSelectedTemplate.equals(toggleButton.getText())) {
Template template = Template.getTemplate(toggleButton.getText());
target.setSelectedTemplate(template);