public static Color TIME_TICK_BG = getColor("time_tick_bg"); //$NON-NLS-1$\r
public static Color TIME_TICK_LINE = getColor("time_tick_line"); //$NON-NLS-1$\r
\r
- public static Color LIFECYCLE_INITIALIZING_TOP = getColor("lifecycle_initializing_top");//$NON-NLS-1$\r
- public static Color LIFECYCLE_INITIALIZING_BOTTOM = getColor("lifecycle_initializing_bottom");//$NON-NLS-1$\r
- public static Color LIFECYCLE_RUNNING_TOP = getColor("lifecycle_running_top");//$NON-NLS-1$\r
- public static Color LIFECYCLE_RUNNING_BOTTOM = getColor("lifecycle_running_bottom");//$NON-NLS-1$\r
- public static Color LIFECYCLE_PAUSING_TOP = getColor("lifecycle_pausing_top");//$NON-NLS-1$\r
- public static Color LIFECYCLE_PAUSING_BOTTOM = getColor("lifecycle_pausing_bottom");//$NON-NLS-1$\r
- public static Color LIFECYCLE_TERMINATING_TOP = getColor("lifecycle_terminating_top");//$NON-NLS-1$\r
- public static Color LIFECYCLE_TERMINATING_BOTTOM = getColor("lifecycle_terminating_bottom");//$NON-NLS-1$\r
-\r
+ public static Color LIFECYCLE_INITIALIZING = getColor("lifecycle_initializing");//$NON-NLS-1$\r
+ public static Color LIFECYCLE_RUNNING = getColor("lifecycle_running");//$NON-NLS-1$\r
+ public static Color LIFECYCLE_PAUSING = getColor("lifecycle_pausing");//$NON-NLS-1$\r
+ public static Color LIFECYCLE_TERMINATING = getColor("lifecycle_terminating");//$NON-NLS-1$\r
+\r
+ public static Color ADD_CHART_NORMAL_STROKE = getColor("add_chart_normal_stroke");//$NON-NLS-1$\r
+ public static Color ADD_CHART_HOVER_STROKE = getColor("add_chart_hover_stroke");//$NON-NLS-1$\r
+ public static Color ADD_CHART_PUSH_STROKE = getColor("add_chart_push_stroke");//$NON-NLS-1$\r
+ \r
+ public static Color ADD_CHART_NORMAL_START = getColor("add_chart_normal_start");//$NON-NLS-1$\r
+ public static Color ADD_CHART_NORMAL_END = getColor("add_chart_normal_end");//$NON-NLS-1$\r
+ public static Color ADD_CHART_HOVER_START = getColor("add_chart_hover_start");//$NON-NLS-1$\r
+ public static Color ADD_CHART_HOVER_END = getColor("add_chart_hover_end");//$NON-NLS-1$\r
+ public static Color ADD_CHART_PUSH_START = getColor("add_chart_push_start");//$NON-NLS-1$\r
+ public static Color ADD_CHART_PUSH_END = getColor("add_chart_push_end");//$NON-NLS-1$\r
+ public static Color ADD_CHART_FONT_COLOR = getColor("add_chart_font_color");//$NON-NLS-1$\r
+ \r
// circular graph\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
"timeline_font", resizeDefaultFont(8, 3)); //$NON-NLS-1$\r
\r
public static final Font TIMELINE_TICK_FONT = getFont(\r
- "time_tick", resizeDefaultFont(6, 3));//$NON-NLS-1$\r
+ "time_tick", resizeDefaultFont(8, 3));//$NON-NLS-1$\r
public static final Font TIMELINE_BALLOON_FONT = getFont(\r
"time_balloon", resizeDefaultFont(8, 3));//$NON-NLS-1$\r
\r
public static final Image CONFIGURATION_BLACK_IMAGE = getPngImage("theme_black"); //$NON-NLS-1$\r
\r
/* Timeline */\r
+ public static final Image ADD_CHART_ICON = getPngImage("add_chart_icon"); //$NON-NLS-1$\r
public static final Image CHART_CPU = getPngImage("time_line_icon_cpu"); //$NON-NLS-1$\r
public static final Image CHART_CPU_CORE = getPngImage("time_line_icon_cpu_core"); //$NON-NLS-1$\r
public static final Image CHART_CPU_FREQUENCY = getPngImage("time_line_icon_cpu_frequency"); //$NON-NLS-1$\r
public static final Image CHART_HEAP = getPngImage("time_line_icon_memory_allocation"); //$NON-NLS-1$\r
+ public static final Image CHART_HEAP_SMALL = getPngImage("time_line_icon_memory_allocation_small"); //$NON-NLS-1$\r
public static final Image CHART_PROCESS_MEMORY = getPngImage("time_line_icon_memory_process"); //$NON-NLS-1$\r
+ public static final Image CHART_PROCESS_MEMORY_SMALL = getPngImage("time_line_icon_memory_process_small"); //$NON-NLS-1$\r
public static final Image CHART_SYSTEM_MEMORY = getPngImage("time_line_icon_memory_system"); //$NON-NLS-1$\r
public static final Image CHART_FILE = getPngImage("time_line_icon_read_write"); //$NON-NLS-1$\r
public static final Image CHART_SCREENSHOT = getPngImage("time_line_icon_snapshot"); //$NON-NLS-1$\r
public static final Image CHART_ENERGY = getPngImage("time_line_icon_energy"); //$NON-NLS-1$\r
public static final Image FD_USAGE = getPngImage("time_line_icon_fd_usage"); //$NON-NLS-1$\r
public static final Image MEMORY = getPngImage("time_line_icon_memory"); //$NON-NLS-1$\r
- public static final Image ADD_ITEMS_NORMAL = getPngImage("add_chart_nor"); //$NON-NLS-1$\r
- public static final Image ADD_ITEMS_PUSH = getPngImage("add_chart_push"); //$NON-NLS-1$\r
- public static final Image ADD_ITEMS_HOVER = getPngImage("add_chart_hover"); //$NON-NLS-1$\r
public static final Image ADD_ITEMS_BAR = getPngImage("AddItems"); //$NON-NLS-1$\r
public static final Image MIN_ITEMS = getPngImage("MinItems"); //$NON-NLS-1$\r
public static final Image BG_GRADIENT = getPngImage("timeline_right_bg_normal"); //$NON-NLS-1$\r
setColor("time_tick_bg", new RGB(247, 247, 247)); //$NON-NLS-1$
setColor("time_tick_line", new RGB(159, 159, 159)); //$NON-NLS-1$
- setColor("lifecycle_initializing_top", new RGB(123, 182, 240)); //$NON-NLS-1$
- setColor("lifecycle_initializing_bottom", new RGB(65, 141, 218)); //$NON-NLS-1$
- setColor("lifecycle_running_top", new RGB(194, 238, 131)); //$NON-NLS-1$
- setColor("lifecycle_running_bottom", new RGB(143, 198, 63)); //$NON-NLS-1$
- setColor("lifecycle_pausing_top", new RGB(170, 170, 170)); //$NON-NLS-1$
- setColor("lifecycle_pausing_bottom", new RGB(113, 113, 113)); //$NON-NLS-1$
- setColor("lifecycle_terminating_top", new RGB(223, 143, 140)); //$NON-NLS-1$
- setColor("lifecycle_terminating_bottom", new RGB(198, 82, 77)); //$NON-NLS-1$
-
- setColor("lifecycle_initializing_top", new RGB(123, 182, 240)); //$NON-NLS-1$
- setColor("lifecycle_initializing_bottom", new RGB(65, 141, 218)); //$NON-NLS-1$
- setColor("lifecycle_running_top", new RGB(194, 238, 131)); //$NON-NLS-1$
- setColor("lifecycle_running_bottom", new RGB(143, 198, 63)); //$NON-NLS-1$
- setColor("lifecycle_pausing_top", new RGB(170, 170, 170)); //$NON-NLS-1$
- setColor("lifecycle_pausing_bottom", new RGB(113, 113, 113)); //$NON-NLS-1$
- setColor("lifecycle_terminating_top", new RGB(223, 143, 140)); //$NON-NLS-1$
- setColor("lifecycle_terminating_bottom", new RGB(198, 82, 77)); //$NON-NLS-1$
-
+ setColor("lifecycle_initializing", new RGB(123, 182, 240)); //$NON-NLS-1$
+ setColor("lifecycle_running", new RGB(194, 238, 131)); //$NON-NLS-1$
+ setColor("lifecycle_pausing", new RGB(190, 190, 190)); //$NON-NLS-1$
+ setColor("lifecycle_terminating", new RGB(223, 143, 140)); //$NON-NLS-1$
+
+ setColor("add_chart_normal_stroke", new RGB(168, 168, 168)); //$NON-NLS-1$
+ setColor("add_chart_hover_stroke", new RGB(47, 85, 92)); //$NON-NLS-1$
+ setColor("add_chart_push_stroke", new RGB(168, 168, 168)); //$NON-NLS-1$
+
+ setColor("add_chart_normal_start", new RGB(251, 251, 251)); //$NON-NLS-1$
+ setColor("add_chart_normal_end", new RGB(207, 207, 207)); //$NON-NLS-1$
+ setColor("add_chart_hover_start", new RGB(251, 251, 251)); //$NON-NLS-1$
+ setColor("add_chart_hover_end", new RGB(207, 207, 207)); //$NON-NLS-1$
+ setColor("add_chart_push_start", new RGB(207, 207, 207)); //$NON-NLS-1$
+ setColor("add_chart_push_end", new RGB(251, 251, 251)); //$NON-NLS-1$
+ setColor("add_chart_font_color", new RGB(71, 71, 71)); //$NON-NLS-1$
+
// bar graph
setColor("cpu_bar_graph_color", new RGB(0, 122, 167)); //$NON-NLS-1$
setColor("cpu_bar_graph_gray_color", new RGB(222, 222, 222));
setColor("seriesColorUIEventOrientation", new RGB(177, 202, 229)); //$NON-NLS-1$
setColor("seriesColorUIEventFramework", new RGB(216, 160, 76)); //$NON-NLS-1$
- setColor("selectionRange", new RGB(23, 98, 132)); //$NON-NLS-1$
- setColor("selectionLine", new RGB(23, 98, 132)); //$NON-NLS-1$
+ setColor("selectionRange", new RGB(43, 80, 201)); //$NON-NLS-1$
+ setColor("selectionLine", new RGB(43, 80, 201)); //$NON-NLS-1$
/*** scale ***/
setColor("scale_outline_color", new RGB(150, 150, 150)); //$NON-NLS-1$
}
/**
+ * Sets the point that indicates the starting point of icon drawing.
+ *
+ * @param point
+ * start point of drawing icon.
+ */
+ public void setButtonImagePoint(Point point) {
+ attr.setButtonImagePoint(point);
+ }
+
+ /**
* Sets the user render of button. <br>
* this class has default renderer : DACustomButtonRenderer
*
public static final int TOOLTIP_HEIGHT = 18;
public static final int TOOLTIP_SERIES_RECT_LENGTH = 10;
public static final int TOOLTIP_SHOW_MIN = 50;
+ public static final int TOOLTIP_TEXT_HEIGHT = 10;
+ public static final int TOOLTIP_TEXT_MARGIN = 8;
+ public static final int TOOLTIP_BOTTOM_MARGIN = 5;
private boolean drawTooltip = false;
private double startVal;
private double yPosRatio;
// make text,time & draw auxiliary line
int textWidthMax = 0;
- int textHeightMax = 0;
double realXVal = tooltip.getStartVal();
int tooltipSize = 0;
for (int i = 0; i < seriesList.size(); i++) {
int textWidth = gc.textExtent(text).x
+ DAChartPlotTooltip.TOOLTIP_TIME_MARGIN
+ gc.textExtent(time).x;
- int textHeight = gc.textExtent(text).y;
if (textWidthMax < textWidth) {
textWidthMax = textWidth;
}
- if (textHeightMax < textHeight) {
- textHeightMax = textHeight;
- }
if (plot instanceof DAUIEventChartPlot) {
break;
int totalHeight;
if (plot instanceof DAUIEventChartPlot) {
- totalHeight = textHeightMax + DAChartPlotTooltip.TOOLTIP_MARGIN
+ totalHeight = DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT + DAChartPlotTooltip.TOOLTIP_MARGIN
+ DAChartPlotTooltip.TOOLTIP_MARGIN;
} else {
- totalHeight = tooltipSize * textHeightMax
+ totalHeight = tooltipSize * DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT
+ DAChartPlotTooltip.TOOLTIP_MARGIN
- + DAChartPlotTooltip.TOOLTIP_MARGIN;
+ + DAChartPlotTooltip.TOOLTIP_BOTTOM_MARGIN
+ + (tooltipSize - 1) * DAChartPlotTooltip.TOOLTIP_TEXT_MARGIN;
}
int startY;
}
}
- int y = startY + (textHeightMax * tooltipSize)
- + DAChartPlotTooltip.TOOLTIP_MARGIN;
+ int y = startY + (DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT * tooltipSize)
+ + DAChartPlotTooltip.TOOLTIP_MARGIN + i * DAChartPlotTooltip.TOOLTIP_TEXT_MARGIN;
Color col = tooltipColor.get(i);
if (col == null) {
gc.setBackground(series.getColor());
gc.setBackground(col);
}
gc.fillRectangle(startX + DAChartPlotTooltip.TOOLTIP_MARGIN, y
- + textHeightMax / 2
+ + DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT / 2
- DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH / 2,
DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH,
DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH);
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
protected DAChartBoardItem selectItem;
// private final static int DEFAULT_CHART_ZOOMOUT_HEIGHT = 50;
- public final static int DEFAULT_ITEM_HEIGHT = 80;
- private final static int DEFAULT_CHARTBOARD_HEADER_HEIGHT = 20;
- private final static int DEFAULT_CHARTBOARD_TITLE_BUTTON_WIDTH = 78;
- private final static int DEFAULT_CHARTBOARD_MINIMIZE_BUTTON_WIDTH = 21;
+ public final static int DEFAULT_ITEM_HEIGHT = 84;
+ private final static int DEFAULT_CHARTBOARD_HEADER_HEIGHT = 25;
+ private final static int DEFAULT_CHARTBOARD_TITLE_BUTTON_WIDTH = 80;
+ private final static int DEFAULT_CHARTBOARD_MINIMIZE_BUTTON_WIDTH = 22;
private final static int DEFAULT_CHARTBOARD_FOOTER_HEIGHT = 20;
- private final static int DEFAULT_CHARTBOARD_SCALE_WIDTH = 99;
+ private final static int DEFAULT_CHARTBOARD_SCALE_WIDTH = 102;
public static final double ITEM_HEIGHT_RATIO_SHORT = 0.5;
public static final double ITEM_HEIGHT_RATIO_NORMAL = 1;
titleComp.setLayout(new FillLayout());
itemMinimizeButton = new DACustomToggleButton(this,
- ImageResources.CHART_ALL_SIZE_MIN_NORMAL,
- ImageResources.CHART_ALL_SIZE_MIN_PUSH,
- ImageResources.CHART_ALL_SIZE_MIN_HOVER, null,
- ImageResources.CHART_ALL_SIZE_RESTORE_NORMAL,
- ImageResources.CHART_ALL_SIZE_RESTORE_HOVER);
+ ColorResources.CHART_SIZE_TOGGLE_NORMAL_START, ColorResources.CHART_SIZE_TOGGLE_NORMAL_END,
+ ColorResources.CHART_SIZE_TOGGLE_PUSH_START, ColorResources.CHART_SIZE_TOGGLE_PUSH_END,
+ ColorResources.CHART_SIZE_TOGGLE_HOVER_START, ColorResources.CHART_SIZE_TOGGLE_HOVER_END,
+ null, null,
+ ColorResources.CHART_SIZE_TOGGLE_NORMAL_START, ColorResources.CHART_SIZE_TOGGLE_NORMAL_END,
+ ColorResources.CHART_SIZE_TOGGLE_PUSH_START, ColorResources.CHART_SIZE_TOGGLE_PUSH_END,
+ ColorResources.CHART_SIZE_TOGGLE_HOVER_START, ColorResources.CHART_SIZE_TOGGLE_HOVER_END);
+
+ itemMinimizeButton.setOutlineColors(ColorResources.CHART_SIZE_TOGGLE_NORMAL_STROKE,
+ ColorResources.CHART_SIZE_TOGGLE_PUSH_STROKE,
+ ColorResources.CHART_SIZE_TOGGLE_HOVER_STROKE, null);
+
+ itemMinimizeButton.setButtonImage(DACustomToggleButton.STATE_NORMAL, ImageResources.CHART_ALL_SIZE_RESTORE);
+ itemMinimizeButton.setButtonImage(DACustomToggleButton.STATE_TOGGLE, ImageResources.CHART_ALL_SIZE_MIN);
+ itemMinimizeButton.setButtonImagePoint(new Point(3, 4));
+
itemMinimizeButton
.addClickListener(new DACustomButtonClickEventListener() {
@Override
protected boolean childFolded = true;
private boolean isHidden = false;
- private final static int DEFAULT_ITEM_HEIGHT = 80;
- public final static int DEFAULT_NAME_CELL_WIDTH = 99;
+ public final static int DEFAULT_NAME_CELL_WIDTH = 102;
private int depth = 0;
private void initWidget(String name, Image icon, int chartStyle) {
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
- data.height = (int) (heightRatio * DEFAULT_ITEM_HEIGHT);
+ data.height = (int) (heightRatio * DAChartBoard.DEFAULT_ITEM_HEIGHT);
itemCell.setLayoutData(data);
this.layout();
}
protected void refreshItemCellHeight() {
FormData data = (FormData) itemCell.getLayoutData();
- data.height = (int) (heightRatio * DEFAULT_ITEM_HEIGHT);
+ data.height = (int) (heightRatio * DAChartBoard.DEFAULT_ITEM_HEIGHT);
itemCell.setLayoutData(data);
}
if (isHidden) {
return 0;
} else if (childFolded) {
- return (int) (heightRatio * DEFAULT_ITEM_HEIGHT);
+ return (int) (heightRatio * DAChartBoard.DEFAULT_ITEM_HEIGHT);
} else {
if (childItemList != null) {
- return (int) (heightRatio * DEFAULT_ITEM_HEIGHT + childItemList
+ return (int) (heightRatio * DAChartBoard.DEFAULT_ITEM_HEIGHT + childItemList
.getListHeight());
} else {
return 0;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
public class DAChartBoardItemCell extends Composite {
+ private final static int DEFAULT_FOLD_TOGGLE_BUTTON_SIZE = 10;
+ private final static int DEFAULT_EXPAND_TOGGLE_BUTTON_SIZE = 16;
+ private final static int DEFAULT_TOGGLE_BUTTON_MARGIN = 4;
+ private final static int DEFAULT_TOGGLE_BUTTON_TOP_MARGIN = 3;
+ private final static int DEFAULT_TOGGLE_BUTTON_RIGHT_MARGIN = 2;
+ private final static int DEFAULT_FOLD_TOGGLE_BUTTON_MARGIN = 23;
+ private final static int NAME_ICON_X = 31;
+ private final static int NAME_ICON_Y = 13;
+ private final static int NAME_ICON_MIN_X = 37;
+ private final static int NAME_ICON_MIN_Y = 7;
+ private final static int NAME_CELL_DEFAULT_MARGIN = 5;
+ private final static int NAME_CELL_IMAGE_NAME_MARGIN = 50;
+ private final static int NAME_CELL_IMAGE_NAME_MIN_MARGIN = 30;
+ private final static int NAME_CELL_NAME_ADD_MARGIN = 5;
+
private DAChartBoardItem parentItem;
private Canvas nameCell;
private DAChart chartCell;
private DACustomToggleButton childFoldButton;
private DACustomToggleButton expandButton;
- private final static int DEFAULT_FOLD_TOGGLE_BUTTON_SIZE = 10;
- private final static int DEFAULT_EXPAND_TOGGLE_BUTTON_SIZE = 16;
- private final static int DEFAULT_TOGGLE_BUTTON_MARGIN = 5;
- private final static int DEFAULT_NAME_ICON_MARGIN = 5;
+
private int nameCellWidth = DAChartBoardItem.DEFAULT_NAME_CELL_WIDTH;
- private Image nameCellNormalBGImage;
- private Image nameCellSelectBGImage;
- private Image nameCellCurrentBGImage;
+ private Color nameCellNormalBGColorStart;
+ private Color nameCellNormalBGColorEnd;
+ private Color nameCellSelectBGColorStart;
+ private Color nameCellSelectBGColorEnd;
+ private Color nameCellCurrentBGColorStart;
+ private Color nameCellCurrentBGColorEnd;
private String itemName;
private Image itemIcon;
private Image foldBackBuffer;
private PaintListener nameCellPaintListener;
+ private boolean hasAdditionalInfo = false;
//FIXME for debugging
public String getItemName() {
nameCell = new Canvas(this, SWT.NONE);
if (parent.getDepth() == 0) {
- nameCellNormalBGImage = ImageResources.CHART_NAME_BG_NORMAL;
- nameCellSelectBGImage = ImageResources.CHART_NAME_BG_SELECT;
+ nameCellNormalBGColorStart = ColorResources.CHART_NAME_PARENT_NORMAL_START;
+ nameCellNormalBGColorEnd = ColorResources.CHART_NAME_PARENT_NORMAL_END;
+ nameCellSelectBGColorStart = ColorResources.CHART_NAME_PARENT_SELECT_START;
+ nameCellSelectBGColorEnd = ColorResources.CHART_NAME_PARENT_SELECT_END;
} else {
- nameCellNormalBGImage = ImageResources.CHART_NAME_CHILD_BG_NORMAL;
- nameCellSelectBGImage = ImageResources.CHART_NAME_CHILD_BG_SELECT;
+ nameCellNormalBGColorStart = ColorResources.CHART_NAME_CHILD_NORMAL_START;
+ nameCellNormalBGColorEnd = ColorResources.CHART_NAME_CHILD_NORMAL_END;
+ nameCellSelectBGColorStart = ColorResources.CHART_NAME_CHILD_SELECT_START;
+ nameCellSelectBGColorEnd = ColorResources.CHART_NAME_CHILD_SELECT_END;
}
- nameCellCurrentBGImage = nameCellNormalBGImage;
+ nameCellCurrentBGColorStart = nameCellNormalBGColorStart;
+ nameCellCurrentBGColorEnd = nameCellNormalBGColorEnd;
redrawFoldBackground();
nameCellPaintListener = (new PaintListener() {
@Override
- public void paintControl(PaintEvent e) {
+ public void paintControl(PaintEvent e) { // draw name cell without additional info. (normal case)
Rectangle rect = ((Canvas) (e.widget)).getClientArea();
- if (nameCellCurrentBGImage != null) {
- Rectangle imageRect = nameCellCurrentBGImage.getBounds();
- e.gc.drawImage(nameCellCurrentBGImage, imageRect.x,
- imageRect.y, imageRect.width, imageRect.height,
- rect.x, rect.y, rect.width, rect.height);
+ drawNameCellBackGround(e.gc, rect);
+ int startY = rect.height / 2;
+ if (rect.height > NAME_CELL_IMAGE_NAME_MARGIN) {
+ drawNameImage(e.gc, itemIcon, rect, NAME_ICON_X, NAME_ICON_Y);
+ startY = NAME_ICON_Y + NAME_CELL_IMAGE_NAME_MARGIN;
+ }
+ if (itemIcon == null) {
+ Point allNamep = e.gc.textExtent(itemName, SWT.DRAW_DELIMITER);
+ startY = rect.height / 2 - allNamep.y / 2 + NAME_CELL_DEFAULT_MARGIN;
}
e.gc.setForeground(ColorResources.BLACK);
e.gc.setFont(parent.getNameFont());
- drawNameIcon(e.gc, rect);
+ drawText(e.gc, itemName, rect, startY);
}
});
nameCell.addPaintListener(nameCellPaintListener);
nameCell.redraw();
}
});
-
+
FormData data = new FormData();
- data.top = new FormAttachment(50,
- -(DEFAULT_FOLD_TOGGLE_BUTTON_SIZE / 2));
+ if (hasAdditionalInfo == false) {
+ data.top = new FormAttachment(50,
+ -(DEFAULT_FOLD_TOGGLE_BUTTON_SIZE / 2));
+ } else {
+ data.top = new FormAttachment(0, DEFAULT_FOLD_TOGGLE_BUTTON_MARGIN);
+ }
data.left = new FormAttachment(0, DEFAULT_TOGGLE_BUTTON_MARGIN);
data.width = DEFAULT_FOLD_TOGGLE_BUTTON_SIZE;
data.height = DEFAULT_FOLD_TOGGLE_BUTTON_SIZE;
+
childFoldButton.setLayoutData(data);
childFoldButton.setVisible(true);
nameCell.layout();
ImageResources.CHART_FULL_PUSH,
ImageResources.CHART_FULL_HOVER, null,
ImageResources.CHART_RESTORE_NORMAL,
- ImageResources.CHART_RESTORE_HOVER);
+ ImageResources.CHART_RESTORE_HOVER,
+ ImageResources.CHART_RESTORE_PUSH);
expandButton.addClickListener(new DACustomButtonClickEventListener() {
@Override
});
FormData data = new FormData();
- data.top = new FormAttachment(0, DEFAULT_TOGGLE_BUTTON_MARGIN);
- data.right = new FormAttachment(100, -DEFAULT_TOGGLE_BUTTON_MARGIN);
+ data.top = new FormAttachment(0, DEFAULT_TOGGLE_BUTTON_TOP_MARGIN);
+ data.right = new FormAttachment(100, -DEFAULT_TOGGLE_BUTTON_RIGHT_MARGIN);
data.width = DEFAULT_EXPAND_TOGGLE_BUTTON_SIZE;
data.height = DEFAULT_EXPAND_TOGGLE_BUTTON_SIZE;
expandButton.setLayoutData(data);
return chartCell;
}
- private void drawNameIcon(GC gc, Rectangle nameCellRect) {
- if (itemName == null) {
- return;
- }
- Point allNamep = gc.textExtent(itemName, SWT.DRAW_DELIMITER);
- Rectangle iconRect;
-
- int startY = nameCellRect.height / 2 - allNamep.y / 2;
-
- // drawIcon
- if (itemIcon != null) {
- iconRect = itemIcon.getBounds();
- int NameIconHeight = allNamep.y + iconRect.height
- + DEFAULT_NAME_ICON_MARGIN;
- if (NameIconHeight < nameCellRect.height) {
- startY = nameCellRect.height / 2 - NameIconHeight / 2;
- gc.drawImage(itemIcon, nameCellRect.width / 2 - iconRect.width
- / 2, startY);
- startY += iconRect.height;
- } else {
- //FIXME temporary
- startY += 10;
- }
- }
-
- // drawName
- String[] temp = itemName.split("\n");
- int lineLength = temp.length;
- Point[] p = new Point[lineLength];
- int middleX = nameCellRect.width / 2;
-
- for (int i = 0; i < lineLength; i++) {
- p[i] = gc.textExtent(temp[i]);
- gc.drawText(temp[i], middleX - p[i].x / 2, startY, true);
- startY += p[i].y;
- }
- }
-
void setSelectCell(boolean selectCell) {
if (selectCell == true) {
- nameCellCurrentBGImage = nameCellSelectBGImage;
+ nameCellCurrentBGColorStart = nameCellSelectBGColorStart;
+ nameCellCurrentBGColorEnd = nameCellSelectBGColorEnd;
} else {
- nameCellCurrentBGImage = nameCellNormalBGImage;
+ nameCellCurrentBGColorStart = nameCellNormalBGColorStart;
+ nameCellCurrentBGColorEnd = nameCellNormalBGColorEnd;
}
redrawFoldBackground();
nameCell.redraw();
return;
}
GC bufGc = new GC(foldBackBuffer);
- Rectangle nameCellRect = nameCell.getClientArea();
- Rectangle imageRect = nameCellCurrentBGImage.getBounds();
- int copyHeight = DEFAULT_FOLD_TOGGLE_BUTTON_SIZE * imageRect.height
- / nameCellRect.height;
-
- bufGc.drawImage(nameCellCurrentBGImage, 0, imageRect.height / 2
- - copyHeight / 2, 1, copyHeight, 0, 0,
- DEFAULT_FOLD_TOGGLE_BUTTON_SIZE,
- DEFAULT_FOLD_TOGGLE_BUTTON_SIZE);
-
+ bufGc.setForeground(nameCellCurrentBGColorStart);
+ bufGc.setBackground(nameCellCurrentBGColorEnd);
+ bufGc.fillGradientRectangle(0, 0, DEFAULT_FOLD_TOGGLE_BUTTON_SIZE,
+ DEFAULT_FOLD_TOGGLE_BUTTON_SIZE, false);
childFoldButton.setBackgroundImage(foldBackBuffer);
childFoldButton.redraw();
bufGc.dispose();
}
}
- /*
- * TODO need to source arrangement. remove redundancy and hard coding for margin.
- */
- public void setAdditionalInfo(final String additionalInfo) {
+ private void drawNameCellBackGround(GC gc, Rectangle rect) {
+ gc.setForeground(nameCellCurrentBGColorStart);
+ gc.setBackground(nameCellCurrentBGColorEnd);
+ gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, false);
+ }
+
+ private void drawNameImage(GC gc, Image image, Rectangle rect, int x, int y) {
+ if (image != null) {
+ gc.drawImage(image, x, y);
+ }
+ }
+
+ private int drawText(GC gc, String text, Rectangle rect, int startY) {
+ String[] temp = text.split("\n");
+ int lineLength = temp.length;
+ Point[] p = new Point[lineLength];
+ int middleX = rect.width / 2;
+
+ for (int i = 0; i < lineLength; i++) {
+ p[i] = gc.textExtent(temp[i]);
+ gc.drawText(temp[i], middleX - p[i].x / 2, startY, true);
+ startY += p[i].y;
+ }
+ return startY;
+ }
+
+ public void setAdditionalInfo(final String additionalInfo, final Image minItemIcon) {
+ hasAdditionalInfo = true;
nameCell.removePaintListener(nameCellPaintListener);
nameCell.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
- Rectangle nameCellRect = ((Canvas) (e.widget)).getClientArea();
-
- if (nameCellCurrentBGImage != null) {
- Rectangle imageRect = nameCellCurrentBGImage.getBounds();
- e.gc.drawImage(nameCellCurrentBGImage, imageRect.x,
- imageRect.y, imageRect.width, imageRect.height,
- nameCellRect.x, nameCellRect.y, nameCellRect.width, nameCellRect.height);
+ Rectangle rect = ((Canvas) (e.widget)).getClientArea();
+ drawNameCellBackGround(e.gc, rect);
+ int startY = rect.height / 2;
+ if (rect.height > NAME_CELL_IMAGE_NAME_MARGIN) {
+ drawNameImage(e.gc, minItemIcon, rect, NAME_ICON_MIN_X, NAME_ICON_MIN_Y);
+ startY = NAME_ICON_MIN_Y + NAME_CELL_IMAGE_NAME_MIN_MARGIN;
+ }
+ if (minItemIcon == null) {
+ Point allNamep = e.gc.textExtent(itemName, SWT.DRAW_DELIMITER);
+ startY = rect.height / 2 - allNamep.y / 2 + NAME_CELL_DEFAULT_MARGIN;
}
-
e.gc.setForeground(ColorResources.BLACK);
e.gc.setFont(parentItem.getNameFont());
-
- if (itemName == null) {
- return;
- }
-
- Point allNamep = e.gc.textExtent(itemName, SWT.DRAW_DELIMITER);
- Rectangle iconRect;
-
- int startY = nameCellRect.height / 2 - allNamep.y / 2;
-
- // drawIcon
- if (itemIcon != null) {
- iconRect = itemIcon.getBounds();
- int NameIconHeight = allNamep.y + iconRect.height + DEFAULT_NAME_ICON_MARGIN;
- if (NameIconHeight < nameCellRect.height) {
- startY = nameCellRect.height / 2 - NameIconHeight / 2;
- e.gc.drawImage(itemIcon, iconRect.x, iconRect.y, iconRect.width, iconRect.height,
- nameCellRect.width / 3, startY,
- iconRect.width / 2, iconRect.height / 2);
- startY += iconRect.height / 2;
- }
- }
-
- // drawName
- String[] temp = itemName.split("\n");
- int lineLength = temp.length;
- Point[] p = new Point[lineLength];
- int middleX = nameCellRect.width / 2;
-
- for (int i = 0; i < lineLength; i++) {
- p[i] = e.gc.textExtent(temp[i]);
- e.gc.drawText(temp[i], middleX - p[i].x / 2, startY, true);
- startY += p[i].y + 1;
- }
-
- startY += 2;
-
- // draw additional Info
- temp = additionalInfo.split("\n");
- lineLength = temp.length;
- p = new Point[lineLength];
- middleX = nameCellRect.width / 2;
-
- for (int i = 0; i < lineLength; i++) {
- p[i] = e.gc.textExtent(temp[i]);
- e.gc.drawText(temp[i], middleX - p[i].x / 2, startY, true);
- startY += p[i].y;
- }
+ startY = drawText(e.gc, itemName, rect, startY);
+ startY += NAME_CELL_NAME_ADD_MARGIN;
+ e.gc.setForeground(ColorResources.CHART_NAME_ADD_INFO_TEXT);
+ drawText(e.gc, additionalInfo, rect, startY);
}
});
public static Color SCALE_AREA_OUTLINE_COLOR = getColor(\r
"scale_area_outline_color", new RGB(250, 250, 250)); //$NON-NLS-1$\r
\r
+ // chartBoard\r
+ public static Color CHART_SIZE_TOGGLE_NORMAL_START = getColor(\r
+ "chart_size_toggle_normal_start", new RGB(251, 251, 251)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_NORMAL_END = getColor(\r
+ "chart_size_toggle_normal_end", new RGB(207, 207, 207)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_HOVER_START = getColor(\r
+ "chart_size_toggle_hover_start", new RGB(251, 251, 251)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_HOVER_END = getColor(\r
+ "chart_size_toggle_hover_end", new RGB(207, 207, 207)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_PUSH_START = getColor(\r
+ "chart_size_toggle_push_start", new RGB(207, 207, 207)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_PUSH_END = getColor(\r
+ "chart_size_toggle_push_end", new RGB(251, 251, 251)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_NORMAL_STROKE = getColor(\r
+ "chart_size_toggle_normal_stroke", new RGB(168, 168, 168)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_HOVER_STROKE = getColor(\r
+ "chart_size_toggle_hover_stroke", new RGB(47, 85, 92)); //$NON-NLS-1$\r
+ public static Color CHART_SIZE_TOGGLE_PUSH_STROKE = getColor(\r
+ "chart_size_toggle_push_stroke", new RGB(168, 168, 168)); //$NON-NLS-1$\r
+ \r
// timeline\r
public static Color TIMELINE_NUMBER_COLOR = getColor(\r
- "timeline_number", new RGB(0, 45, 96)); //$NON-NLS-1$\r
+ "timeline_number", new RGB(92, 92, 92)); //$NON-NLS-1$\r
public static Color TIMELINE_TICK_COLOR = getColor(\r
- "timeline_tick", new RGB(159, 159, 159)); //$NON-NLS-1$\r
+ "timeline_tick", new RGB(168, 168, 168)); //$NON-NLS-1$\r
public static Color TIMELINE_BG_COLOR = getColor(\r
- "timeline_bg", new RGB(247, 247, 247)); //$NON-NLS-1$\r
-\r
- // chart\r
+ "timeline_bg", new RGB(252, 252, 252)); //$NON-NLS-1$\r
+ \r
+ // chart \r
public static Color CHART_BACKGROUND_NORMAL_TOP = getColor(\r
"chart_background_normal_top", new RGB(244, 249, 251));\r
public static Color CHART_BACKGROUND_NORMAL_BOTTOM = getColor(\r
"chart_background_selected_top", new RGB(216, 250, 255));\r
public static Color CHART_BACKGROUND_SELECTED_BOTTOM = getColor(\r
"chart_background_selected_bottom", new RGB(190, 247, 255));\r
+ public static Color CHART_NAME_PARENT_NORMAL_START = getColor(\r
+ "chart_name_parent_normal_start", new RGB(196, 204, 207)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_PARENT_NORMAL_END = getColor(\r
+ "chart_name_parent_normal_end", new RGB(196, 204, 207)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_PARENT_SELECT_START = getColor(\r
+ "chart_name_parent_select_start", new RGB(156, 208, 228)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_PARENT_SELECT_END = getColor(\r
+ "chart_name_parent_select_end", new RGB(129, 170, 186)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_ADD_INFO_TEXT = getColor(\r
+ "chart_name_add_info_text", new RGB(94, 94, 94)); //$NON-NLS-1$\r
\r
- public static Color CHART_NAME_BACK_START = getColor(\r
- "chart_name_back_start", new RGB(215, 215, 215)); //$NON-NLS-1$\r
- public static Color CHART_NAME_BACK_END = getColor(\r
- "chart_name_back_end", new RGB(157, 166, 168)); //$NON-NLS-1$\r
- public static Color CHART_NAME_SELECT_BACK_START = getColor(\r
- "chart_name_back_select_start", new RGB(180, 242, 254)); //$NON-NLS-1$\r
- public static Color CHART_NAME_SELECT_BACK_END = getColor(\r
- "chart_name_back_select_end", new RGB(56, 178, 208)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_CHILD_NORMAL_START = getColor(\r
+ "chart_name_child_normal_start", new RGB(153, 165, 169)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_CHILD_NORMAL_END = getColor(\r
+ "chart_name_child_normal_end", new RGB(153, 165, 169)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_CHILD_SELECT_START = getColor(\r
+ "chart_name_child_select_start", new RGB(126, 176, 192)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_CHILD_SELECT_END = getColor(\r
+ "chart_name_child_select_end", new RGB(126, 176, 192)); //$NON-NLS-1$\r
\r
public static Color CHART_SEPERATE_LINE = getColor(\r
"UI_event_chart_seperate_line", new RGB(189, 207, 213)); //$NON-NLS-1$\r
public static Color CHART_BOARD_BACK = getColor(\r
"chart_board_back", new RGB(230, 230, 230)); //$NON-NLS-1$\r
public static Color CHART_BOARD_ITEM_LINE = getColor(\r
- "chart_board_item_line", new RGB(171, 171, 171)); //$NON-NLS-1$\r
+ "chart_board_item_line", new RGB(139, 139, 139)); //$NON-NLS-1$\r
\r
public static Color CHART_BOARD_ITEM_NAME_FOLD_BG = getColor(\r
"chart_fold_bg", new RGB(186, 190, 191)); //$NON-NLS-1$\r
new RGB(131, 196, 218));//$NON-NLS-1$\r
public static final Color ITEM_BLUE_DARK = getColor("item blue dark",\r
new RGB(38, 104, 138));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_INITIALIZING_TOP = getColor(\r
- "lifecycle_initializing_top", new RGB(123, 182, 240));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_INITIALIZING_BOTTOM = getColor(\r
- "lifecycle_initializing_bottom", new RGB(65, 141, 218));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_RUNNING_TOP = getColor(\r
- "lifecycle_running_top", new RGB(194, 238, 131));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_RUNNING_BOTTOM = getColor(\r
- "lifecycle_running_bottom", new RGB(143, 198, 63));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_PAUSING_TOP = getColor(\r
- "lifecycle_pausing_top", new RGB(170, 170, 170));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_PAUSING_BOTTOM = getColor(\r
- "lifecycle_pausing_bottom", new RGB(113, 113, 113));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_TERMINATING_TOP = getColor(\r
- "lifecycle_terminating_top", new RGB(223, 143, 140));//$NON-NLS-1$\r
- public static final Color LIFECYCLE_TERMINATING_BOTTOM = getColor(\r
- "lifecycle_terminating_bottom", new RGB(198, 82, 77));//$NON-NLS-1$\r
-\r
- \r
\r
// public static final Color ITEM_BG = getColor("item background", new\r
// RGB(50,\r
/* timeline */
public static final Image TIMELINE_DETAILED_TIME_BALLOON = getPngImage("timeline_mouse_x"); //$NON-NLS-1$
-
+ public static final Image TIMELINE_SIZE_RESTORE = getPngImage("time_line_size_restore"); //$NON-NLS-1$
+ public static final Image TIMELINE_SIZE_MIN = getPngImage("time_line_size_min"); //$NON-NLS-1$
+
/* snapshot */
public static final Image SNAPSHOT_LEFT_NORMAL = getPngImage("snapshot_arrow_left_nor"); //$NON-NLS-1$
public static final Image SNAPSHOT_LEFT_PUSH = getPngImage("snapshot_arrow_left_push"); //$NON-NLS-1$
public static final Image CHART_NAME_BG_SELECT = getPngImage("timeline_left_bg_selected"); //$NON-NLS-1$
public static final Image CHART_NAME_CHILD_BG_NORMAL = getPngImage("timeline_left_child_bg_normal"); //$NON-NLS-1$
public static final Image CHART_NAME_CHILD_BG_SELECT = getPngImage("timeline_left_child_bg_selected"); //$NON-NLS-1$
- public static final Image CHART_ALL_SIZE_MIN_NORMAL = getPngImage("time_line_size_min_normal"); //$NON-NLS-1$
- public static final Image CHART_ALL_SIZE_MIN_PUSH = getPngImage("time_line_size_min_push"); //$NON-NLS-1$
- public static final Image CHART_ALL_SIZE_MIN_HOVER = getPngImage("time_line_size_min_hover"); //$NON-NLS-1$
- public static final Image CHART_ALL_SIZE_RESTORE_NORMAL = getPngImage("time_line_size_restore_normal"); //$NON-NLS-1$
- public static final Image CHART_ALL_SIZE_RESTORE_PUSH = getPngImage("time_line_size_restore_push"); //$NON-NLS-1$
- public static final Image CHART_ALL_SIZE_RESTORE_HOVER = getPngImage("time_line_size_restore_hover"); //$NON-NLS-1$
+
+ public static final Image CHART_ALL_SIZE_RESTORE = getPngImage("time_line_size_restore"); //$NON-NLS-1$
+ public static final Image CHART_ALL_SIZE_MIN = getPngImage("time_line_size_min"); //$NON-NLS-1$
+
public static final Image CHART_FULL_NORMAL = getPngImage("timeline_left_full_nor"); //$NON-NLS-1$
public static final Image CHART_FULL_PUSH = getPngImage("timeline_left_full_push"); //$NON-NLS-1$
public static final Image CHART_FULL_HOVER = getPngImage("timeline_left_full_hover"); //$NON-NLS-1$
public static final Image CHART_RESTORE_HOVER = getPngImage("timeline_left_restore_hover"); //$NON-NLS-1$
/* range */
- public static final Image RANGE_MARKER_START = getPngImage("range_marker_start");//$NON-NLS-1$
- public static final Image RANGE_MARKER_END = getPngImage("range_marker_end");//$NON-NLS-1$
- public static final Image RANGE_MARKER_START_PUSH = getPngImage("range_marker_start_push");//$NON-NLS-1$
- public static final Image RANGE_MARKER_END_PUSH = getPngImage("range_marker_end_push");//$NON-NLS-1$
- public static final Image RANGE_MARKER_START_HOVER = getPngImage("range_marker_start_hover");//$NON-NLS-1$
- public static final Image RANGE_MARKER_END_HOVER = getPngImage("range_marker_end_hover");//$NON-NLS-1$
-
+ public static final Image MARKER_START_NORMAL = getPngImage("marker_start_nor");
+ public static final Image MARKER_START_HOVER = getPngImage("marker_start_hover");
+ public static final Image MARKER_START_PUSH = getPngImage("marker_start_push");
+ public static final Image MARKER_END_NORMAL = getPngImage("marker_end_nor");
+ public static final Image MARKER_END_HOVER = getPngImage("marker_end_hover");
+ public static final Image MARKER_END_PUSH = getPngImage("marker_end_push");
+
/*** scale ***/
public static final Image SCALE_CONTROL_MINUS = getPngImage("scale_control_minus"); //$NON-NLS-1$
public static final Image SCALE_CONTROL_PLUS = getPngImage("scale_control_plus"); //$NON-NLS-1$
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
+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;
import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineRenderer;
public class LifecycleBar extends Canvas {
- public static final int HEIGHT = 4;
+ public static final int HEIGHT = 5;
private double visibleStartTime = 0;
private double totalEndTime = 0;
private int scale = DATimeline.SCALE_100;
private PaintListener paintListener = new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ Rectangle rt = gc.getClipping();
+ // draw underLine
+ gc.setForeground(ColorResources.TIMELINE_TICK_COLOR);
+ gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1);
+
@SuppressWarnings("unchecked")
List<LifecycleData> cloneList = (List<LifecycleData>) lifecycleDataList
.clone();
-
+
for (LifecycleData lifecycleData : cloneList) {
double startTime = lifecycleData.getStartTime();
int startPx = (int) secondToPixcel(startTime);
}
if (endTime > visibleStartTime) {
- GC gc = e.gc;
int endPx = (int) secondToPixcel(endTime);
- gc.setForeground(lifecycleData.getColorTop());
- gc.setBackground(lifecycleData.getColorBottom());
- gc.fillGradientRectangle(startPx + 1, 0, endPx
- - startPx + 1, HEIGHT, true);
+ gc.setBackground(lifecycleData.getColor());
+ gc.fillRectangle(startPx + 1, 0, endPx
+ - startPx + 1, HEIGHT - 1);
}
} else {
break;
public class LifecycleData {
private double startTime;
private double endTime = -1;
- private Color colorTop;
- private Color colorBottom;
+ private Color color;
private String text;
- public LifecycleData(double startTime, Color colorTop, Color colorBottom,
- String text) {
+ public LifecycleData(double startTime, Color color, String text) {
this.startTime = startTime;
- this.colorTop = colorTop;
- this.colorBottom = colorBottom;
+ this.color = color;
this.text = text;
}
this.endTime = endTime;
}
- public Color getColorTop() {
- return colorTop;
- }
-
- public Color getColorBottom() {
- return colorBottom;
+ public Color getColor() {
+ return color;
}
public String getText() {
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineMarker.MARKER_STATUS;
public class DATimeline extends Canvas {
public final static int SCALE_100 = 1;
timelineRenderer = new DATimelineTimeRenderer();
if (useMarker) {
startRangeMarker = new DATimelineMarker(
- ImageResources.RANGE_MARKER_START,
- ImageResources.RANGE_MARKER_START_PUSH);
+ ImageResources.MARKER_START_NORMAL,
+ ImageResources.MARKER_START_PUSH,
+ ImageResources.MARKER_START_HOVER);
endRangeMarker = new DATimelineMarker(
- ImageResources.RANGE_MARKER_END,
- ImageResources.RANGE_MARKER_END_PUSH);
+ ImageResources.MARKER_END_NORMAL,
+ ImageResources.MARKER_END_PUSH,
+ ImageResources.MARKER_END_HOVER);
this.addMouseListener(new RangeMarkerMouseEventListener());
this.addMouseMoveListener(new RangeMarkerMouseMoveEventListener());
+ this.addMouseTrackListener(new RangeMarkerMouseTrackListener());
}
}
private class RangeMarkerMouseEventListener extends MouseAdapter {
public void mouseDown(MouseEvent e) {
- double startMarkerPosition = secondToPixcel(startRangeMarker
- .getTime());
- double endMarkerPosition = secondToPixcel(endRangeMarker.getTime());
-
- if (e.x >= endMarkerPosition
- - endRangeMarker.getImage().getBounds().width
- && e.x <= endMarkerPosition) {
- endRangeMarker.setPushStatus(true);
- DATimeline.this.redraw();
- } else if (e.x >= startMarkerPosition
- && e.x <= startMarkerPosition
- + startRangeMarker.getImage().getBounds().width) {
- startRangeMarker.setPushStatus(true);
- DATimeline.this.redraw();
- }
+ setStatusInMarkerImage(e.x, e.y, MARKER_STATUS.PUSH);
}
public void mouseUp(MouseEvent e) {
if (startRangeMarker.isPushed()) {
- startRangeMarker.setPushStatus(false);
+ startRangeMarker.setStatus(MARKER_STATUS.NORMAL);
DATimeline.this.redraw();
} else if (endRangeMarker.isPushed()) {
- endRangeMarker.setPushStatus(false);
+ endRangeMarker.setStatus(MARKER_STATUS.NORMAL);
DATimeline.this.redraw();
}
}
}
}
}
+
+ private class RangeMarkerMouseTrackListener extends MouseTrackAdapter {
+ @Override
+ public void mouseHover(MouseEvent e) {
+ setStatusInMarkerImage(e.x, e.y, MARKER_STATUS.HOVER);
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ startRangeMarker.setStatus(MARKER_STATUS.NORMAL);
+ endRangeMarker.setStatus(MARKER_STATUS.NORMAL);
+ DATimeline.this.redraw();
+ }
+ }
+
+ private void setStatusInMarkerImage(int x, int y, MARKER_STATUS status) {
+ double startMarkerPosition = secondToPixcel(startRangeMarker
+ .getTime());
+ double endMarkerPosition = secondToPixcel(endRangeMarker.getTime());
+
+ // it's means that mouse pointer is in end marker image.
+ if (x >= endMarkerPosition -
+ endRangeMarker.getImage().getBounds().width / 2
+ && x <= endMarkerPosition +
+ endRangeMarker.getImage().getBounds().width / 2) {
+ endRangeMarker.setStatus(status);
+ DATimeline.this.redraw();
+ // it's means that mouse pointer is in start marker image.
+ } else if (x >= startMarkerPosition -
+ startRangeMarker.getImage().getBounds().width / 2
+ && x <= startMarkerPosition
+ + startRangeMarker.getImage().getBounds().width / 2) {
+ startRangeMarker.setStatus(status);
+ DATimeline.this.redraw();
+ } else {
+ /* Do not handle else case. above 2 case is means catching mouse pointer is in maker image.*/
+ }
+ }
}
private final Image balloon = ImageResources.TIMELINE_DETAILED_TIME_BALLOON;
private final int balloonHalfWidth = balloon.getBounds().width / 2;
private final int balloonHalfHeight = balloon.getBounds().height / 2;
+
+ protected static final int TIME_STRING_PIXCEL_Y = 4;
+ protected static final int TIME_BALLOON_PIXCEL_Y = 18;
private void drawTimeString(GC gc, int totalSecond, int pixcelX, int pixcelY) {
Point p;
gc.setBackground(ColorResources.TIMELINE_BG_COLOR);
gc.fillRectangle(rt);
+ gc.setForeground(ColorResources.TIMELINE_TICK_COLOR);
// draw underLine
gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1);
-
+
// draw time
int scale = timeline.getScale();
int frameInterval = scale * DEFAULT_INTERVAL;
pixcelX = (int) ((current-startMargin) * frameInterval);
gc.drawLine(pixcelX, rt.height - 5, pixcelX, rt.height - 1);
if (scale >= DATimeline.SCALE_800) {
- drawTimeString(gc, current+startFrame, pixcelX, 1);
+ drawTimeString(gc, current+startFrame, pixcelX, TIME_STRING_PIXCEL_Y);
}else if (scale >= DATimeline.SCALE_400) {
if((current+startFrame) % (DRAW_FRAME_INTERVAL*2) == 0){
- drawTimeString(gc, current+startFrame, pixcelX, 1);
+ drawTimeString(gc, current+startFrame, pixcelX, TIME_STRING_PIXCEL_Y);
}
}else{
if((current+startFrame) % (DRAW_FRAME_INTERVAL*5) == 0){
- drawTimeString(gc, current+startFrame, pixcelX, 1);
+ drawTimeString(gc, current+startFrame, pixcelX, TIME_STRING_PIXCEL_Y);
}
}
}
if (timeline.getDrawDetailedTime()) {
gc.drawImage(balloon, 0, 0, balloon.getBounds().width,
balloon.getBounds().height,
- timeline.getDetailedTimePosition() - balloonHalfWidth, 0,
- balloon.getBounds().width, timeline.getBounds().height - 1);
+ timeline.getDetailedTimePosition() - balloonHalfWidth, 2,
+ balloon.getBounds().width, TIME_BALLOON_PIXCEL_Y);
String time = String.valueOf((int)timeline.getDetailedTime());
gc.setForeground(ColorResources.BLACK);
gc.setFont(timeBalloonFont);
gc.drawString(time,
timeline.getDetailedTimePosition()
- - gc.stringExtent(time).x / 2, balloonHalfHeight
- - gc.stringExtent(time).y / 2 - 4, true);
+ - gc.stringExtent(time).x / 2,
+ TIME_STRING_PIXCEL_Y, true);
}
}
}
import org.eclipse.swt.graphics.Image;
public class DATimelineMarker {
+ public enum MARKER_STATUS {
+ NORMAL,
+ PUSH,
+ HOVER
+ }
+
private double time;
private Image normalImage;
private Image pushedImage;
+ private Image hoveredImage;
- private boolean isPushed = false;
+ private MARKER_STATUS status = MARKER_STATUS.NORMAL;
- public DATimelineMarker(Image normalImage, Image pushedImage) {
+ public DATimelineMarker(Image normalImage, Image pushedImage, Image hoveredImage) {
this.normalImage = normalImage;
this.pushedImage = pushedImage;
+ this.hoveredImage = hoveredImage;
}
-
+
public void setTime(double time) {
this.time = time;
}
return time;
}
- public void setPushStatus(boolean status) {
- this.isPushed = status;
+ public void setStatus(MARKER_STATUS status) {
+ this.status = status;
}
public Image getImage() {
- if(isPushed) {
+ if (status == MARKER_STATUS.PUSH) {
return pushedImage;
- } else {
+ } else if (status == MARKER_STATUS.HOVER) {
+ return hoveredImage;
+ } else { // NORMAL case
return normalImage;
}
}
public boolean isPushed() {
- return isPushed;
+ return (status == MARKER_STATUS.PUSH);
}
}
\ No newline at end of file
protected final int balloonHalfWidth = balloon.getBounds().width / 2;
protected final int balloonHalfHeight = balloon.getBounds().height / 2;
- protected static final int TICK_LINE_HEIGHT_TALL = 7;
- protected static final int TICK_LINE_HEIGHT_MID = 5;
- protected static final int TICK_LINE_HEIGHT_SMALL = 3;
-
+ protected static final int TICK_LINE_HEIGHT_TALL = 4;
+ protected static final int TICK_LINE_HEIGHT_SMALL = 2;
+ protected static final int TIME_STRING_PIXCEL_Y = 4;
+ protected static final int MARKER_START_Y = 3;
+
protected int startTime;
protected int scale;
DATimelineMarker endMarker = timeline.getEndRangeMarker();
if (startMarker.getTime() >= 0) {
+ Image startMarkerImage = startMarker.getImage();
+
double startMarkerTime = startMarker.getTime()
- timeline.getStartTime();
int pixcelStartX = (int) Math.round(startMarkerTime * scale
- * DEFAULT_INTERVAL);
- gc.drawImage(startMarker.getImage(), pixcelStartX, 1);
+ * DEFAULT_INTERVAL) - startMarkerImage.getBounds().width / 2;
+ gc.drawImage(startMarkerImage, pixcelStartX, MARKER_START_Y);
}
if (endMarker.getTime() >= 0) {
int pixcelEndX = (int) Math.round(endMarkerTime * scale
* DEFAULT_INTERVAL);
gc.drawImage(endMarker.getImage(), pixcelEndX
- - endMarker.getImage().getBounds().width, 1);
+ - endMarker.getImage().getBounds().width / 2, MARKER_START_Y);
}
}
gc.setBackground(ColorResources.TIMELINE_BG_COLOR);
gc.fillRectangle(rt);
+ gc.setForeground(ColorResources.TIMELINE_TICK_COLOR);
+ // draw headLine
+ gc.drawLine(0, 0, rt.width, 0);
// draw underLine
gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1);
startTime = (int) timeline.getStartTime();
pixcelX -= (timeline.getStartTime() - (double) startTime)
* ((double) secondInterval);
-
+
for (; pixcelX < rt.width; startTime++, pixcelX += secondInterval) {
if (startTime % 10 == 0) {
- drawTimeString(gc, startTime, pixcelX, 1);
+ drawTimeString(gc, startTime, pixcelX, TIME_STRING_PIXCEL_Y);
gc.drawLine(pixcelX, rt.height - TICK_LINE_HEIGHT_TALL,
pixcelX, rt.height - 1);
} else if (startTime % 5 == 0) {
if (scale >= DATimeline.SCALE_400) {
- drawTimeString(gc, startTime, pixcelX, 1);
+ drawTimeString(gc, startTime, pixcelX, TIME_STRING_PIXCEL_Y);
}
- gc.drawLine(pixcelX, rt.height - TICK_LINE_HEIGHT_MID, pixcelX,
+ gc.drawLine(pixcelX, rt.height - TICK_LINE_HEIGHT_TALL, pixcelX,
rt.height - 1);
} else {
if (scale >= DATimeline.SCALE_800) {
- drawTimeString(gc, startTime, pixcelX, 1);
+ drawTimeString(gc, startTime, pixcelX, TIME_STRING_PIXCEL_Y);
}
gc.drawLine(pixcelX, rt.height - TICK_LINE_HEIGHT_SMALL,
pixcelX, rt.height - 1);
balloon.getBounds().height,
timeline.getDetailedTimePosition() - balloonHalfWidth, 0,
balloon.getBounds().width, timeline.getBounds().height - 1);
-
+
String time = Formatter.toTimeFormat((long) (timeline
.getDetailedTime() * 1000000));
gc.setForeground(ColorResources.BLACK);
gc.setFont(timeBalloonFont);
gc.drawString(time,
timeline.getDetailedTimePosition()
- - gc.stringExtent(time).x / 2, balloonHalfHeight
- - gc.stringExtent(time).y / 2 - 4, true);
+ - gc.stringExtent(time).x / 2, gc.stringExtent(time).y / 2 - 4, true);
}
}
}
public class DATimelineTinyTimeRenderer extends DATimelineTimeRenderer {
private static final int MAX_STRING_GAP = 200;
private static final int MIN_STRING_GAP = 40;
+ protected static final int TIME_STRING_PIXCEL_Y = 4;
@Override
public void draw(GC gc, DATimeline timeline) {
gc.fillRectangle(rt);
// draw underLine
+ gc.setForeground(ColorResources.TIMELINE_TICK_COLOR);
gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1);
// draw time
Point p;
p = gc.textExtent(timeString, SWT.DRAW_MNEMONIC);
gc.setForeground(ColorResources.TIMELINE_NUMBER_COLOR);
- gc.drawText(timeString, pixcelX - p.x / 2, 1, true);
+ gc.drawText(timeString, pixcelX - p.x / 2, TIME_STRING_PIXCEL_Y, true);
gc.setForeground(ColorResources.TIMELINE_TICK_COLOR);
}
gc.setFont(timeBalloonFont);
gc.drawString(time,
timeline.getDetailedTimePosition()
- - gc.stringExtent(time).x / 2, balloonHalfHeight
- - gc.stringExtent(time).y / 2 - 4, true);
+ - gc.stringExtent(time).x / 2,
+ gc.stringExtent(time).y / 2 - 4, true);
}
}
}
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- parentBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ parentBoardItem.getItemCell().setAdditionalInfo(
+ processName + "\nPID : " + pid.intValue(),
+ ImageResources.CHART_HEAP_SMALL);
}
});
}
HeapChart childChart = new HeapChart();
DAChartBoardItem childBoardItem = childChart.createChildBoardItem(parentBoardItem);
String processName = AnalyzerUtil.getProcessName(pid.intValue());
- childBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ childBoardItem.getItemCell().setAdditionalInfo(
+ processName + "\nPID : " + pid.intValue(),
+ ImageResources.CHART_HEAP_SMALL);
for (int i = 0; i < seriesList.size(); i++) {
childBoardItem.getChart().addSeries(seriesList.get(i));
}
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- parentBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ parentBoardItem.getItemCell().setAdditionalInfo(
+ processName + "\nPID : " + pid.intValue(),
+ ImageResources.CHART_PROCESS_MEMORY_SMALL);
}
});
}
ProcessMemoryChart childChart = new ProcessMemoryChart();
DAChartBoardItem childBoardItem = childChart.createChildBoardItem(parentBoardItem);
String processName = AnalyzerUtil.getProcessName(pid.intValue());
- childBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ childBoardItem.getItemCell().setAdditionalInfo(
+ processName + "\nPID : " + pid.intValue(),
+ ImageResources.CHART_PROCESS_MEMORY_SMALL);
for (int i = 0; i < seriesList.size(); i++) {
childBoardItem.getChart().addSeries(seriesList.get(i));
}
addItemComp.setBackground(ColorResources.VIEW_BG_COLOR);
addItems = new DACustomButton(addItemComp,
- ImageResources.ADD_ITEMS_NORMAL, ImageResources.ADD_ITEMS_PUSH,
- ImageResources.ADD_ITEMS_HOVER, null);
+ ColorResources.ADD_CHART_NORMAL_START, ColorResources.ADD_CHART_NORMAL_END,
+ ColorResources.ADD_CHART_PUSH_START, ColorResources.ADD_CHART_PUSH_END,
+ ColorResources.ADD_CHART_HOVER_START, ColorResources.ADD_CHART_HOVER_END,
+ ColorResources.ADD_CHART_DISABLE_COLOR_START, ColorResources.ADD_CHART_DISABLE_COLOR_END);
+
+ addItems.setOutlineColors(ColorResources.ADD_CHART_NORMAL_STROKE,
+ ColorResources.ADD_CHART_PUSH_STROKE,
+ ColorResources.ADD_CHART_HOVER_STROKE, null);
+
addItems.setTitle(TimelineChartLabels.TIMELINE_TICK_ADD);
- addItems.setFontPoint(new Point(45, 4));
- addItems.setFontColors(ColorResources.DEFAULT_FONT_COLOR,
- ColorResources.DEFAULT_FONT_COLOR,
- ColorResources.DEFAULT_FONT_COLOR,
- ColorResources.DEFAULT_FONT_COLOR);
+
+ addItems.setButtonImages(ImageResources.ADD_CHART_ICON,
+ ImageResources.ADD_CHART_ICON,
+ ImageResources.ADD_CHART_ICON,
+ ImageResources.ADD_CHART_ICON);
+
+ addItems.setButtonImagePoint(new Point(6, 4));
+
+ addItems.setFontPoint(new Point(43, 5));
+
+ addItems.setFontColors(ColorResources.ADD_CHART_FONT_COLOR,
+ ColorResources.ADD_CHART_FONT_COLOR,
+ ColorResources.ADD_CHART_FONT_COLOR,
+ ColorResources.ADD_CHART_FONT_COLOR);
addItems.setButtonFont(FontResources.ADDITEM_BUTTON_FONT);
GridData gDataAddBtn = new GridData();
// range marker
DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(
-1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
- rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setForegroundColor(ColorResources.SELECTION_LINE);
rangeMarker.setAlpha((int) (255 * 0.25));
board.addIntervalMarker(rangeMarker);
}
import org.eclipse.swt.graphics.Color;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.logparser.Logs;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.util.DALogger;
-import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.lifecycle.LifecycleBar;
import org.tizen.dynamicanalyzer.widgets.lifecycle.LifecycleData;
import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
private void parseLog(LifeCycleLogData logData) {
int apiId= logData.getApiId();
- Color colorTop;
- Color colorBottom;
+ Color color;
String text;
if (apiId == API_ID_INITIALIZING) {
DA_LOG.performance("TEST", "App Lifecycle", "Initializing");
- colorTop = ColorResources.LIFECYCLE_INITIALIZING_TOP;
- colorBottom = ColorResources.LIFECYCLE_INITIALIZING_BOTTOM;
+ color = ColorResources.LIFECYCLE_INITIALIZING;
text = TimelineChartLabels.LIFECYCLE_INITIALIZING;
} else if (apiId == API_ID_RUNNING) {
DA_LOG.performance("TEST", "App Lifecycle", "Running");
- colorTop = ColorResources.LIFECYCLE_RUNNING_TOP;
- colorBottom = ColorResources.LIFECYCLE_RUNNING_BOTTOM;
+ color = ColorResources.LIFECYCLE_RUNNING;
text = TimelineChartLabels.LIFECYCLE_RUNNING;
} else if (apiId ==API_ID_PAUSING) {
DA_LOG.performance("TEST", "App Lifecycle", "Pausing");
- colorTop = ColorResources.LIFECYCLE_PAUSING_TOP;
- colorBottom = ColorResources.LIFECYCLE_PAUSING_BOTTOM;
+ color = ColorResources.LIFECYCLE_PAUSING;
text = TimelineChartLabels.LIFECYCLE_PAUSING;
} else if (apiId == API_ID_TERMINATING) {
DA_LOG.performance("TEST", "App Lifecycle", "Terminating");
- colorTop = ColorResources.LIFECYCLE_TERMINATING_TOP;
- colorBottom = ColorResources.LIFECYCLE_TERMINATING_BOTTOM;
+ color = ColorResources.LIFECYCLE_TERMINATING;
text = TimelineChartLabels.LIFECYCLE_TERMINATING;
} else {
DA_LOG.error("lifecycle log error"); //$NON-NLS-1$
double startTime = Double.parseDouble(Long.toString(logData.getTime()))
/ TimelineConstants.MEGA_DOUBLE;
- LifecycleData lifecycleData = new LifecycleData(startTime, colorTop,
- colorBottom, text);
+ LifecycleData lifecycleData = new LifecycleData(startTime, color, text);
for (LifecycleBar lifecycleBar : lifecycleBarList) {
lifecycleBar.addLifecycleData(lifecycleData);
}