org.tizen.dynamicanalyzer.widgets.button,
org.tizen.dynamicanalyzer.widgets.button.toggle,
org.tizen.dynamicanalyzer.widgets.combo,
+ org.tizen.dynamicanalyzer.widgets.graph.bar,
+ org.tizen.dynamicanalyzer.widgets.graph.circular,
org.tizen.dynamicanalyzer.widgets.helper
--- /dev/null
+package org.tizen.dynamicanalyzer.widgets.graph.bar;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+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.widgets.helper.ColorResources;
+
+public class FourBarGraph extends Composite {
+
+ private final int INNER_MARGIN = 3;
+ private final int LABEL_MARGIN = 15;
+ private int graphCount = 4;
+ private List<SingleBar> graphs;
+ private Label label;
+ private Font labelFont;
+ private Color fontColor = ColorResources.WHITE;
+ private FourBarGraph me;
+ private Color bgColor = ColorResources.BLACK;
+
+ public FourBarGraph(Composite parent, int style) {
+ super(parent, style);
+ me = this;
+ graphs = new ArrayList<SingleBar>();
+ labelFont = new Font(getDisplay(), new FontData[] { new FontData(
+ "Arial", 10, SWT.NORMAL) });
+ this.setLayout(new FormLayout());
+ this.setBackground(bgColor);
+ this.addControlListener(controlListener);
+
+ for (int i = 0; i < graphCount; i++) {
+ SingleBar bar = new SingleBar(me, SWT.NONE);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ if (i == 0) {
+ data.left = new FormAttachment(0, INNER_MARGIN);
+ } else {
+ data.left = new FormAttachment(graphs.get(i - 1), INNER_MARGIN);
+ }
+ data.bottom = new FormAttachment(100, -LABEL_MARGIN);
+ bar.setLayoutData(data);
+ graphs.add(bar);
+ }
+
+ label = new Label(me, SWT.TRANSPARENT);
+ FormData data = new FormData();
+ data.top = new FormAttachment(graphs.get(0), 0);
+ data.height = 15;
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ label.setLayoutData(data);
+ label.setFont(labelFont);
+ label.setAlignment(SWT.CENTER);
+ label.setForeground(fontColor);
+ label.setBackground(bgColor);
+ }
+
+ public void setGraphColor(Color graph, Color gray, Color font) {
+ for (int i = 0; i < graphs.size(); i++) {
+ graphs.get(i).setColors(graph, bgColor, gray, font);
+ }
+ }
+
+ public void setGraphBgColor(Color bg) {
+ for (int i = 0; i < graphs.size(); i++) {
+ graphs.get(i).setBgColor(bg);
+ }
+ }
+
+ public void setMaxSize(long max) {
+ for (int i = 0; i < graphs.size(); i++) {
+ graphs.get(i).setMaxSize(max);
+ }
+ }
+
+ public void setMaxSize(List<Long> maxSizes) {
+ for (int i = 0; i < maxSizes.size() && i < graphCount; i++) {
+ graphs.get(i).setMaxSize(maxSizes.get(i));
+ }
+ }
+
+ public void setCurrentValue(List<Long> currentValues) {
+ for (int i = 0; i < currentValues.size() && i < graphCount; i++) {
+ graphs.get(i).setCurrentSize(currentValues.get(i));
+ graphs.get(i).redraw();
+ }
+ }
+
+ public void setText(String text) {
+ label.setForeground(fontColor);
+ label.setText(text);
+ }
+
+ public void setTextColor(Color color) {
+ label.setForeground(color);
+ fontColor = color;
+ }
+
+ public void setTextBgColor(Color color) {
+ label.setBackground(color);
+ }
+
+ public void setBgColor(Color color) {
+ bgColor = color;
+ this.setBackground(bgColor);
+ setGraphBgColor(bgColor);
+ }
+
+ ControlListener controlListener = new ControlListener() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ // TODO Auto-generated method stub
+ Rectangle r = me.getClientArea();
+ int width = (r.width - (graphCount + 1) * INNER_MARGIN)
+ / graphCount;
+
+ for (int i = 0; i < graphCount; i++) {
+ SingleBar bar = graphs.get(i);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ if (i == 0) {
+ data.left = new FormAttachment(0, INNER_MARGIN);
+ } else {
+ data.left = new FormAttachment(graphs.get(i - 1),
+ INNER_MARGIN);
+ }
+ data.width = width;
+ data.bottom = new FormAttachment(100, -LABEL_MARGIN);
+ bar.setLayoutData(data);
+ graphs.add(bar);
+ }
+
+ // label = new Label(me, SWT.TRANSPARENT);
+ FormData data = new FormData();
+ data.top = new FormAttachment(graphs.get(0), 0);
+ data.height = 15;
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ label.setLayoutData(data);
+ }
+
+ @Override
+ public void controlMoved(ControlEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ };
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.widgets.graph.bar;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+
+public class SingleBar extends Canvas {
+
+ private final int TOP_MARGIN = 5;
+ private final int BOTTOM_MARGIN = 4;
+ private final int BOTTOM_FULL_MARGIN = 15;
+
+ private long maxSize;
+ private long currentSize;
+ private Color graphColor;
+ private Color fontColor;
+ private Color bgColor;
+ private Color grayColor;
+ private Font font;
+
+ public SingleBar(Composite parent, int style) {
+ super(parent, style);
+ maxSize = currentSize = 0;
+ this.addPaintListener(barPaintListener);
+
+ graphColor = ColorResources.BLUE;
+ fontColor = ColorResources.RED;
+ bgColor = ColorResources.BLACK;
+ grayColor = ColorResources.BAR_GRAY1;
+ font = new Font(getDisplay(), new FontData[] { new FontData("Arial", 6,
+ SWT.NORMAL) });
+ }
+
+ private PaintListener barPaintListener = new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Canvas canvas = (Canvas) e.widget;
+ canvas.setBackground(bgColor);
+ Rectangle rect = canvas.getClientArea();
+ int graphHeight = rect.height - TOP_MARGIN - BOTTOM_FULL_MARGIN;
+
+ int maxDrawCount = graphHeight / 2;
+ maxDrawCount = (graphHeight % 2 > 0) ? maxDrawCount + 1
+ : maxDrawCount;
+
+ int drawCount = 0;
+ if (maxSize > 0) {
+ drawCount = (int) ((maxDrawCount * currentSize) / maxSize);
+ }
+
+ int startY = rect.y + TOP_MARGIN;
+ int endY = startY + graphHeight;
+
+ int y = endY;
+ for (int i = 0; i <= maxDrawCount; i++) {
+
+ if (i > drawCount || (i == 0 && currentSize == 0)) {
+ e.gc.setForeground(grayColor);
+ } else {
+ e.gc.setForeground(graphColor);
+ }
+ e.gc.drawLine(rect.x, y, rect.x + rect.width, y);
+ e.gc.setForeground(bgColor);
+ y -= 1;
+ e.gc.drawLine(rect.x, y, rect.x + rect.width, y);
+ y -= 1;
+ }
+
+ int textY = endY + BOTTOM_MARGIN;
+ e.gc.setForeground(fontColor);
+ e.gc.setFont(font);
+ e.gc.drawText(Long.toString(currentSize), rect.x + 1, textY);
+ }
+ };
+
+ public void setMaxSize(long max) {
+ maxSize = max;
+ }
+
+ public void setCurrentSize(long current) {
+ currentSize = current;
+ }
+
+ public void setColors(Color graph, Color bg, Color gray, Color font) {
+ graphColor = graph;
+ bgColor = bg;
+ grayColor = gray;
+ fontColor = font;
+ }
+
+ public void setBgColor(Color bg) {
+ bgColor = bg;
+ }
+
+}
public static final Font SCORE_TITLE_FONT = getFont(\r
"score_title_font", setSystemFont(SWT.BOLD,12));//$NON-NLS-1$\r
\r
- private static Font getFont(String fontName, FontData[] fontData) {\r
+ public static Font getFont(String fontName, FontData[] fontData) {\r
if (!fontRegistry.hasValueFor(fontName)) {\r
fontRegistry.put(fontName, fontData);\r
}\r
package test;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener;
+import org.tizen.dynamicanalyzer.widgets.graph.bar.FourBarGraph;
+import org.tizen.dynamicanalyzer.widgets.graph.bar.SingleBar;
import org.tizen.dynamicanalyzer.widgets.graph.circular.CircularGraph;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
circle.update(50);
circle.setTextColor(ColorResources.BLACK);
circle.setText("circlular graph test");
+
+ SingleBar bar = new SingleBar(shell, SWT.NONE);
+ data = new FormData();
+ data.top = new FormAttachment(circle, 10);
+ data.left = new FormAttachment(10, 0);
+ data.width = 20;
+ data.height = 80;
+ bar.setLayoutData(data);
+
+ bar.setMaxSize(100);
+ bar.setCurrentSize(45);
+ FourBarGraph fbar = new FourBarGraph(shell, SWT.NONE);
+ data = new FormData();
+ data.top = new FormAttachment(bar, 10);
+ data.left = new FormAttachment(10, 0);
+ data.width = 100;
+ data.height = 100;
+ fbar.setLayoutData(data);
+
+ fbar.setMaxSize(100);
+ fbar.setText("CALL");
+ List<Long> testdata = new ArrayList<Long>();
+ testdata.add((long) 55);
+ testdata.add((long) 72);
+ testdata.add((long) 41);
+ testdata.add((long) 87);
+ fbar.setCurrentValue(testdata);
+ fbar.setTextColor(ColorResources.RED);
+ fbar.setBgColor(ColorResources.WHITE);
+
DACustomComboSelectionListener comboSelectionListener = new DACustomComboSelectionListener() {
@Override
public void selectionEvent(DACustomCombo combo) {
public static Color TAB_NORMAL_COLOR = getColor("tab_selected_end_color"); //$NON-NLS-1$\r
public static Color TAB_HOVER_COLOR = getColor("tab_selected_end_color"); //$NON-NLS-1$\r
public static Color TAB_PUSH_COLOR = getColor("tab_selected_end_color"); //$NON-NLS-1$\r
+ public static Color TAB_OUTLINE_COLOR = getColor("tab_outline_color"); //$NON-NLS-1$\r
+ \r
\r
public static Color TAB_NORMAL_FONT_COLOR = getColor("tab_normal_font_color"); //$NON-NLS-1$\r
public static Color TAB_OTHER_FONT_COLOR = getColor("tab_other_font_color"); //$NON-NLS-1$\r
public static Color DEFAULT_RED = getColor("defaultRed"); //$NON-NLS-1$\r
\r
// circular graph\r
- public static Color CPU_CIRCULAR_GRAPH_COLOR = getColor("cpu_circular_graph_color"); //$NON-NLS-1$\r
- public static Color PROCESS_CIRCULAR_GRAPH_COLOR = getColor("process_circular_graph_color"); //$NON-NLS-1$\r
+ public static Color CPU_BAR_GRAPH_COLOR = getColor("cpu_bar_graph_color"); //$NON-NLS-1$\r
+ public static Color CPU_BAR_GRAPH_GRAY_COLOR = getColor("cpu_bar_graph_gray_color"); //$NON-NLS-1$\r
+ public static Color CPU_BAR_GRAPH_BG_COLOR = getColor("cpu_bar_graph_bg_color"); //$NON-NLS-1$\r
+ \r
+ public static Color PROCESS_BAR_GRAPH_COLOR = getColor("process_bar_graph_color"); //$NON-NLS-1$\r
+ public static Color PROCESS_BAR_GRAPH_GRAY_COLOR = getColor("process_bar_graph_gray_color"); //$NON-NLS-1$\r
+ public static Color PROCESS_BAR_GRAPH_BG_COLOR = getColor("process_bar_graph_bg_color"); //$NON-NLS-1$\r
\r
public static Color PROFILING_GRAPH_COLOR_START = getColor("profiling_graph_color_start"); //$NON-NLS-1$\r
public static Color PROFILING_GRAPH_COLOR_END = getColor("profiling_graph_color_end"); //$NON-NLS-1$\r
DEFAULT_RED = getColor("defaultRed"); //$NON-NLS-1$\r
\r
// circular graph\r
- CPU_CIRCULAR_GRAPH_COLOR = getColor("cpu_circular_graph_color"); //$NON-NLS-1$\r
- PROCESS_CIRCULAR_GRAPH_COLOR = getColor("process_circular_graph_color"); //$NON-NLS-1$\r
+ CPU_BAR_GRAPH_COLOR = getColor("cpu_circular_graph_color"); //$NON-NLS-1$\r
+ PROCESS_BAR_GRAPH_COLOR = getColor("process_circular_graph_color"); //$NON-NLS-1$\r
\r
PROFILING_GRAPH_COLOR_START = getColor("profiling_graph_color_start"); //$NON-NLS-1$\r
PROFILING_GRAPH_COLOR_END = getColor("profiling_graph_color_end"); //$NON-NLS-1$\r
setColor("tab_normal_color", new RGB(51, 52, 53));
setColor("tab_hover_color", new RGB(63, 72, 78));
setColor("tab_push_color", new RGB(36, 41, 45));
+ setColor("tab_outline_color", new RGB(104, 104, 104));
setColor("tab_normal_font_color", new RGB(140, 140, 140));
setColor("tab_other_font_color", new RGB(255, 255, 255));
setColor("defaultRed", new RGB(173, 13, 1)); //$NON-NLS-1$
// circular graph
- setColor("cpu_circular_graph_color", new RGB(2, 171, 208)); //$NON-NLS-1$
- setColor("process_circular_graph_color", new RGB(114, 203, 8)); //$NON-NLS-1$
+ setColor("cpu_bar_graph_color", new RGB(2, 171, 208)); //$NON-NLS-1$
+ setColor("cpu_bar_graph_gray_color", new RGB(79, 79, 81));
+ setColor("cpu_bar_graph_bg_color", new RGB(43, 44, 45));
+
+ setColor("process_bar_graph_color", new RGB(114, 203, 8)); //$NON-NLS-1$
+ setColor("process_bar_graph_gray_color", new RGB(79, 79, 81)); //$NON-NLS-1$
+ setColor("process_bar_graph_bg_color", new RGB(43, 44, 45)); //$NON-NLS-1$
setColor("profiling_graph_color_start", new RGB(145, 190, 3)); //$NON-NLS-1$
setColor("profiling_graph_color_end", new RGB(114, 149, 1)); //$NON-NLS-1$
setColor("tab_normal_color", new RGB(51, 52, 53));
setColor("tab_hover_color", new RGB(63, 72, 78));
setColor("tab_push_color", new RGB(36, 41, 45));
+ setColor("tab_outline_color", new RGB(104, 104, 104));
setColor("tab_normal_font_color", new RGB(140, 140, 140));
setColor("tab_other_font_color", new RGB(255, 255, 255));
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.renderers;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+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.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonDefaultRenderer;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomWidgetAttribute;
+
+public class TabButtonRenderer extends DACustomButtonDefaultRenderer {
+
+ @Override
+ public void draw(GC gc, Canvas canvas, int state,
+ DACustomWidgetAttribute attr) {
+ Rectangle rect = canvas.getClientArea();
+
+ if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
+ Image image = attr.getImage(state);
+ if (null == image) {
+ return;
+ }
+
+ gc.drawImage(image, rect.x, rect.y);
+ drawButtonText(gc, rect, state, attr);
+ } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
+ || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
+ drawButton(gc, rect, state, attr);
+ }
+ drawButtonImage(gc, rect, attr);
+ }
+
+ public int computeFontSize(Rectangle rect) {
+ if (rect.height > 20)
+ return 10;
+ else
+ return 8;
+ }
+
+ public void drawButton(GC gc, Rectangle rect, int state,
+ DACustomWidgetAttribute attr) {
+ if (attr.getDrawType() == DACustomButton.TYPE_COLOR) {
+ gc.setBackground(attr.getColor(state));
+ gc.fillRectangle(rect);
+ } else {
+ int index = state * 2;
+ gc.setForeground(attr.getColor(index));
+ gc.setBackground(attr.getColor(index + 1));
+ gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height,
+ true);
+ }
+
+ Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+ if (attr.getButtonImage() == null) {
+ drawButtonText(gc, r, state, attr);
+ }
+ Color c = gc.getForeground();
+ gc.setForeground(ColorResources.TAB_OUTLINE_COLOR);
+ gc.drawRectangle(r);
+ gc.setForeground(c);
+ }
+
+ protected void drawButtonImage(GC gc, Rectangle rect,
+ DACustomWidgetAttribute attr) {
+ if (attr != null && attr.getButtonImage() != null) {
+ Image img = attr.getButtonImage();
+ Rectangle imgRect = img.getBounds();
+ int width = rect.width - imgRect.width;
+ int height = rect.height - imgRect.height;
+ int x = 0, y = 0;
+ if (width > 0) {
+ x = width / 2;
+ }
+
+ if (height > 0) {
+ y = height / 2;
+ }
+ gc.drawImage(img, x, y);
+ }
+ }
+
+ protected void drawButtonText(GC gc, Rectangle rect, int state,
+ DACustomWidgetAttribute attr) {
+ String s = null;
+ Font f = null;
+ Point p = null;
+ if (null != (s = attr.getText())) {
+ if (null == (f = attr.getFont())) {
+ f = new Font(Display.getCurrent(), "Arial",
+ computeFontSize(rect), SWT.BOLD);
+ attr.setFont(f);
+ }
+ gc.setFont(f);
+
+ int x = 0, y = 0;
+ int offset = 0;
+ if (null == (p = attr.getFontPoint())) {
+ p = gc.textExtent(s, SWT.DRAW_MNEMONIC);
+ x = (rect.width - p.x) / 2;
+ y = (rect.height - p.y) / 2;
+ x = (x < 0) ? 0 : x;
+ // rect size < text length -> insert offset
+ offset = ((x - rect.x) < 4) ? 4 : 0;
+ } else {
+ x = p.x;
+ y = p.y;
+ }
+ Color fontColor = attr.getFontColor(state);
+ if (fontColor == null) {
+ fontColor = ColorResources.WHITE;
+ }
+ gc.setForeground(fontColor);
+ gc.drawString(s, x + offset, y, true);
+ }
+ }
+}
import org.tizen.dynamicanalyzer.model.Logs;
import org.tizen.dynamicanalyzer.nl.InformationViewLables;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
-import org.tizen.dynamicanalyzer.ui.widgets.CircularGraph;
import org.tizen.dynamicanalyzer.ui.widgets.CurrentTable;
import org.tizen.dynamicanalyzer.ui.widgets.IconView;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.ui.widgets.imageViewer.ImageViewer;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.graph.bar.FourBarGraph;
public class SnapshotView extends DAView {
Composite iconComp;
ImageViewer snapshot;
- CircularGraph cpuGrp;
- CircularGraph processGraph;
+ // CircularGraph cpuGrp;
+ // CircularGraph processGraph;
+ FourBarGraph cpuGrp;
+ FourBarGraph processGraph;
CurrentTable table;
boolean test = true;
- private String[] gpsTooltip = { InformationViewLables.SNAPSHOT_VIEW_GPS_OFF, InformationViewLables.SNAPSHOT_VIEW_GPS_SEARCHING, InformationViewLables.SNAPSHOT_VIEW_GPS_CONNECTED };
- private String[] wifiTooltip = { InformationViewLables.SNAPSHOT_VIEW_WIFI_OFF, InformationViewLables.SNAPSHOT_VIEW_WIFI_UNCONNECTED,
- InformationViewLables.SNAPSHOT_VIEW_WIFI_CONNECTED, InformationViewLables.SNAPSHOT_VIEW_WIFI_TRANSFER };
- private String[] blueToothTooltip = { InformationViewLables.SNAPSHOT_VIEW_BLUETOOTH_OFF,
- InformationViewLables.SNAPSHOT_VIEW_BLUETOOTH_TRANSFER, InformationViewLables.SNAPSHOT_VIEW_BLUETOOTH_ELSE };
+ private String[] gpsTooltip = {
+ InformationViewLables.SNAPSHOT_VIEW_GPS_OFF,
+ InformationViewLables.SNAPSHOT_VIEW_GPS_SEARCHING,
+ InformationViewLables.SNAPSHOT_VIEW_GPS_CONNECTED };
+ private String[] wifiTooltip = {
+ InformationViewLables.SNAPSHOT_VIEW_WIFI_OFF,
+ InformationViewLables.SNAPSHOT_VIEW_WIFI_UNCONNECTED,
+ InformationViewLables.SNAPSHOT_VIEW_WIFI_CONNECTED,
+ InformationViewLables.SNAPSHOT_VIEW_WIFI_TRANSFER };
+ private String[] blueToothTooltip = {
+ InformationViewLables.SNAPSHOT_VIEW_BLUETOOTH_OFF,
+ InformationViewLables.SNAPSHOT_VIEW_BLUETOOTH_TRANSFER,
+ InformationViewLables.SNAPSHOT_VIEW_BLUETOOTH_ELSE };
private static String threadCount = "0"; //$NON-NLS-1$
private static String brightness = "0"; //$NON-NLS-1$
private static String virtualMem = "0"; //$NON-NLS-1$
private static String time = "0"; //$NON-NLS-1$
- private static long cpuUsage = 0;
+ private static List<Long> cpuUsage;
private static long maxCpuUsage = 100;
private static long maxMem = 100;
- private static long processMem = 0;
+ // private static long processMem = 0;
+ private static List<Long> processMem;
private long startTime = 0;
// private long endTime = 0;
this.setLayout(new FillLayout());
ViewContainer viewContainer = new ViewContainer(this, title);
- viewContainer.setTitleText(InformationViewLables.SNAPSHOT_VIEW_CURRENT_VIEW);
+ viewContainer
+ .setTitleText(InformationViewLables.SNAPSHOT_VIEW_CURRENT_VIEW);
Composite contents = viewContainer.getContentArea();
contents.setBackground(ColorResources.VIEW_BG_COLOR);
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(snapshotComp, 6);
data.right = new FormAttachment(100, 0);
- data.height = 33;
+ data.height = 25;
iconComp.setLayoutData(data);
gps = new IconView(iconComp, SWT.NONE);
graphComp.setLayoutData(data);
// cpu graph
- cpuGrp = new CircularGraph(graphComp, SWT.NONE,
- CircularGraph.TYPE_PERCENT);
+ // cpuGrp = new CircularGraph(graphComp, SWT.NONE,
+ // CircularGraph.TYPE_PERCENT);
+ cpuGrp = new FourBarGraph(graphComp, SWT.NONE);
data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
data.width = 76;
- data.height = 101;
+ data.height = 95;
cpuGrp.setLayoutData(data);
- cpuGrp.setGraphColor(ColorResources.CPU_CIRCULAR_GRAPH_COLOR);
- cpuGrp.update(maxCpuUsage, cpuUsage);
+ cpuGrp.setBgColor(ColorResources.CPU_BAR_GRAPH_BG_COLOR);
+ cpuGrp.setTextBgColor(ColorResources.VIEW_BG_COLOR);
+ cpuGrp.setGraphColor(ColorResources.CPU_BAR_GRAPH_COLOR,
+ ColorResources.CPU_BAR_GRAPH_GRAY_COLOR,
+ ColorResources.CPU_BAR_GRAPH_COLOR);
+ // cpuGrp.setGraphColor(ColorResources.CPU_CIRCULAR_GRAPH_COLOR);
+ // cpuGrp.update(maxCpuUsage, cpuUsage);
+ cpuGrp.setTextColor(ColorResources.CPU_BAR_GRAPH_COLOR);
cpuGrp.setText(InformationViewLables.SNAPSHOT_VIEW_CPU);
+ cpuUsage = new ArrayList<Long>();
// process graph
- processGraph = new CircularGraph(graphComp, SWT.NONE,
- CircularGraph.TYPE_CUSTOM);
+ // processGraph = new CircularGraph(graphComp, SWT.NONE,
+ // CircularGraph.TYPE_CUSTOM);
+ processGraph = new FourBarGraph(graphComp, SWT.NONE);
data = new FormData();
- data.top = new FormAttachment(cpuGrp, 2);
+ data.top = new FormAttachment(cpuGrp, 15);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
- data.bottom = new FormAttachment(100, 0);
+ // data.bottom = new FormAttachment(100, 0);
+ data.height = 95;
processGraph.setLayoutData(data);
- processGraph.setMeasure(InformationViewLables.SNAPSHOT_VIEW_BYTE);
- processGraph.setGraphColor(ColorResources.PROCESS_CIRCULAR_GRAPH_COLOR);
- processGraph.update(maxMem, processMem);
+ processGraph.setBgColor(ColorResources.PROCESS_BAR_GRAPH_BG_COLOR);
+ processGraph.setTextBgColor(ColorResources.VIEW_BG_COLOR);
+ processGraph.setGraphColor(ColorResources.PROCESS_BAR_GRAPH_COLOR,
+ ColorResources.PROCESS_BAR_GRAPH_GRAY_COLOR,
+ ColorResources.PROCESS_BAR_GRAPH_COLOR);
+ // processGraph.setMeasure(InformationViewLables.SNAPSHOT_VIEW_BYTE);
+ // processGraph.setGraphColor(ColorResources.PROCESS_CIRCULAR_GRAPH_COLOR);
+ // processGraph.update(maxMem, processMem);
+ processGraph.setTextColor(ColorResources.PROCESS_BAR_GRAPH_COLOR);
processGraph.setText(InformationViewLables.SNAPSHOT_VIEW_PROCESS);
+ processMem = new ArrayList<Long>();
// table
Composite tableComp = new Composite(innerComp, SWT.NONE);
table = new CurrentTable(tableComp, SWT.NONE);
String heap = availableMemory;
- heap = Formatter.toByteToMbNumberFormat2(heap) + InformationViewLables.SNAPSHOT_VIEW_MB;
+ heap = Formatter.toByteToMbNumberFormat2(heap)
+ + InformationViewLables.SNAPSHOT_VIEW_MB;
table.update(heap, threadCount, brightness);
data = new FormData();
data.top = new FormAttachment(0, 0);
}
private void computeData() {
-
- if(startTime % 1000000 != 0)
+
+ if (startTime % 1000000 != 0)
startTime += 1000000;
String query = "select * from system where time = (select max(time) from system where time < " //$NON-NLS-1$
+ startTime + ");"; //$NON-NLS-1$
return;
}
}
- String[] cpuRates = input.get(LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX + 1).split(",");
- String cpu = cpuRates[cpuRates.length-1].trim();
+ String[] cpuRates = input.get(
+ LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX + 1)
+ .split(",");
+ cpuUsage.clear();
+ for (int i = 0; i < cpuRates.length; i++) {
+ String cpu = cpuRates[i].trim();
+ long value = (long) Float.parseFloat(cpu);
+ cpuUsage.add(value);
+ }
virtualMem = input.get(LogCenterConstants.DEVICE_VSS_MEMORY_INDEX + 1);
brightness += AnalyzerConstants.SLASH
+ AnalyzerManager.getProject().getMaxBrightness();
time = input.get(LogCenterConstants.TIME_INDEX + 1);
- cpuUsage = (long) Float.parseFloat(cpu);
+ // cpuUsage = cpus;
maxMem = totalMem;
- processMem = Long.parseLong(virtualMem);
+ processMem.clear();
+ processMem.add(Long.parseLong(virtualMem));
gpsState = Integer.parseInt(input
.get(LogCenterConstants.DEVICE_GPS_INDEX + 1));
@Override
public void run() {
String heap = availableMemory;
- heap = Formatter.toByteToMbNumberFormat2(heap) + InformationViewLables.SNAPSHOT_VIEW_MB;
+ heap = Formatter.toByteToMbNumberFormat2(heap)
+ + InformationViewLables.SNAPSHOT_VIEW_MB;
table.update(heap, threadCount, brightness);
- cpuGrp.update(100, cpuUsage);
- processGraph.update(maxMem, processMem);
+ // cpuGrp.update(100, cpuUsage);
+ // processGraph.update(maxMem, processMem);
+ cpuGrp.setMaxSize(maxCpuUsage);
+ cpuGrp.setCurrentValue(cpuUsage);
+ processGraph.setMaxSize(maxMem);
+ processGraph.setCurrentValue(processMem);
snapshot.drawSnapshot(time);
updateIcon();
}
List<List<String>> inputs = logs.getLogs();
int lastIndex = inputs.size() - 1;
List<String> input = inputs.get(lastIndex);
-
- String[] cpuRates = input.get(LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX).split(",");
- String cpu = cpuRates[cpuRates.length-1].trim();
+
+ String[] cpuRates = input.get(
+ LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX).split(",");
+// String cpu = cpuRates[cpuRates.length - 1].trim();
+ cpuUsage.clear();
+ for (int i = 0; i < cpuRates.length; i++) {
+ String cpu = cpuRates[i].trim();
+ long value = (long) Float.parseFloat(cpu);
+ cpuUsage.add(value);
+ }
virtualMem = input.get(LogCenterConstants.DEVICE_VSS_MEMORY_INDEX);
{
brightness += AnalyzerConstants.SLASH
+ AnalyzerManager.getProject().getMaxBrightness();
time = input.get(LogCenterConstants.TIME_INDEX);
- cpuUsage = (long) Float.parseFloat(cpu);
+// cpuUsage = (long) Float.parseFloat(cpu);
maxMem = totalMem;
- processMem = Long.parseLong(virtualMem);
+// processMem = Long.parseLong(virtualMem);
+ processMem.clear();
+ processMem.add(Long.parseLong(virtualMem));
gpsState = Integer.parseInt(input
.get(LogCenterConstants.DEVICE_GPS_INDEX));
virtualMem = "0"; //$NON-NLS-1$
time = "0"; //$NON-NLS-1$
- cpuUsage = 0;
+ // cpuUsage = 0;
+ cpuUsage.clear();
maxCpuUsage = 100;
maxMem = 100;
- processMem = 0;
+ // processMem = 0;
+ processMem.clear();
gpsState = 0;
wifiState = 0;
bluetoothState = 0;
import org.tizen.dynamicanalyzer.model.DASelectionData;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.model.LogPackage;
-import org.tizen.dynamicanalyzer.ui.renderers.ComboButtonRenderer;
+import org.tizen.dynamicanalyzer.ui.renderers.TabButtonRenderer;
import org.tizen.dynamicanalyzer.ui.views.base.ViewAction;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
if (!(child instanceof ViewAction)) {
return;
}
- // final DAButton tabButton = new DAButton(tabComposite,
- // ImageResources.TAB, ImageResources.TAB_PUSH,
- // ImageResources.TAB_HOVER, ImageResources.TAB_DISABLE);
- // final DACustomButton tabButton = new DACustomButton(tabComposite,
- // SWT.NONE);
final DACustomButton tabButton = new DACustomButton(
tabComposite,
ColorResources.TAB_NORMAL_COLOR,
ColorResources.TAB_OTHER_FONT_COLOR,
ColorResources.TAB_OTHER_FONT_COLOR,
ColorResources.TAB_OTHER_FONT_COLOR);
- tabButton.setRenderer(new ComboButtonRenderer());
+ tabButton.setRenderer(new TabButtonRenderer());
tabButton.setEnabled(true);
tabButton.setFont(FontResources.TAB_BUTTON_FONT);
- tabButton.setForeground(ColorResources.WHITE);
tabButton.setText(title);
tabButton.setToolTipText(title);
if (getTabChildren().size() == 1) {
stackLayout.topControl = child;
contentsComposite.layout();
- // tabButton.setColor(DACustomButton.STATE_DISABLE,
- // ColorResources.CPU_CIRCULAR_GRAPH_COLOR);
tabButton.setGradationColor(DACustomButton.STATE_DISABLE,
ColorResources.TAB_SELECTED_START_COLOR,
ColorResources.TAB_SELECTED_END_COLOR);
- // tabButton.setDisableColor(ColorResources.CPU_CIRCULAR_GRAPH_COLOR);
tabButton.setEnabled(false);
+ tabButton.setRenderer(new TabButtonRenderer());
}
}