if (false == bInitialized) {
initialize(gc, chart);
}
- r = chart.getBounds();
+ r = chart.getClientArea();
// draw background Image
Image backImage = plot.getBackgroundImage();
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.widgets.chartBoard;
import org.eclipse.swt.graphics.GC;
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.widgets.chartBoard;
import java.util.ArrayList;
import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
public class DACustomChartBoard extends Composite {
+
private DACustomButton titleButton;
private DACustomToggleButton chartZoomButton;
- private DACustomTimeline timeline; //FIXME
+ private DACustomTimeline timeline; // FIXME
private ScrolledComposite chartTreeScrollComp;
private Composite chartTreeComp;
private DAScale scale;
private ScrollBar hScroll;
private DACustomChartBoardManager boardManager = null;
private List<DACustomChartBoardItem> items = new ArrayList<DACustomChartBoardItem>();
-
+ private DACustomChartBoardItem selectItem;
+
private final static int DEFAULT_CHART_ZOOMOUT_HEIGHT = 50;
private final static int DEFAULT_CHART_ZOOMIN_HEIGHT = 100;
private final static int DEFAULT_CHARTBOARD_HEADER_HEIGHT = 20;
private final static int DEFAULT_CHARTBOARD_ZOOM_BUTTON_WIDTH = 21;
private final static int DEFAULT_CHARTBOARD_FOOTER_HEIGHT = 20;
private final static int DEFAULT_CHARTBOARD_SCALE_WIDTH = 99;
-// private final static int DEFAULT_CHART_CELL_HEIGHT = 200;
+ // private final static int DEFAULT_CHART_CELL_HEIGHT = 200;
-
private int chartHeight = DEFAULT_CHART_ZOOMIN_HEIGHT;
-
-
+
public DACustomChartBoard(Composite parent, String title) {
super(parent, SWT.NONE);
this.setLayout(new FormLayout());
this.setBackground(ColorResources.WHITE);
-
+
titleButton = new DACustomButton(this, SWT.NONE, title);
- titleButton.addClickListener(new DACustomButtonClickEventListener() { //FIXME test code
-
- @Override
- public void handleClickEvent(DACustomButton button) {
- DACustomChartBoardItem item = new DACustomChartBoardItem((DACustomChartBoard)button.getParent());
- }
- });
-
+ titleButton.addClickListener(new DACustomButtonClickEventListener() { // FIXME
+ // test
+ // code
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ DACustomChartBoardItem item = new DACustomChartBoardItem(
+ (DACustomChartBoard) button.getParent(), null);
+ }
+ });
+
chartZoomButton = new DACustomToggleButton(this, SWT.NONE);
- chartZoomButton.addClickListener(new DACustomButtonClickEventListener() { //FIXME test code
-
- @Override
- public void handleClickEvent(DACustomButton button) {
- DACustomChartBoardItem item2 = new DACustomChartBoardItem(items.get(0));
- }
- });
-
+ chartZoomButton
+ .addClickListener(new DACustomButtonClickEventListener() { // FIXME
+ // test
+ // code
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ DACustomChartBoardItem item2 = new DACustomChartBoardItem(
+ items.get(0), null);
+ }
+ });
+
timeline = new DACustomTimeline(this);
-
+
scale = new DAScale(this, SWT.NONE);
scale.addSelectionListener(scaleSelectionListener);
scale.setMinimum(0);
scale.setRightImage(ImageResources.SCALE_CONTROL_PLUS);
scale.setThumbImage(ImageResources.SCALE_CONTROL_THUMB);
scale.setRenderer(new DAChartBoardScaleRenderer());
-
+
scrollComp = new Composite(this, SWT.H_SCROLL);
scrollComp.setLayout(new FillLayout());
hScroll = scrollComp.getHorizontalBar();
hScroll.setVisible(true);
hScroll.addSelectionListener(scrollbarSelectionListener);
scrollComp.addControlListener(new ControlListener() {
-
+
@Override
public void controlResized(ControlEvent e) {
- if(null != boardManager){
- boardManager.timelineWidthChanged(((Composite)(e.widget)).getClientArea().width);
+ if (null != boardManager) {
+ boardManager.timelineWidthChanged(((Composite) (e.widget))
+ .getClientArea().width);
}
}
-
+
@Override
- public void controlMoved(ControlEvent e) {
+ public void controlMoved(ControlEvent e) {
}
});
-
-
+
chartTreeScrollComp = new ScrolledComposite(this, SWT.V_SCROLL);
chartTreeScrollComp.addControlListener(new ControlListener() {
-
+
@Override
public void controlResized(ControlEvent e) {
- if(null != chartTreeComp){
- chartTreeComp.setSize(((ScrolledComposite)(e.widget)).getClientArea().width, chartTreeComp.getBounds().height);
+ if (null != chartTreeComp) {
+ int width = chartTreeScrollComp.getClientArea().width;
+ // chartTreeComp.setSize(((ScrolledComposite)(e.widget)).getClientArea().width,
+ // chartTreeComp.getBounds().height);
+ chartTreeComp.setSize(width,
+ chartTreeComp.getBounds().height);
+ int itemSize = items.size();
+
+ for (int i = 0; i < itemSize; i++) {
+ DACustomChartBoardItem item = items.get(i);
+ int height = item.getSize().y;
+ items.get(i).setSize(width, height);
+ }
}
}
-
+
@Override
public void controlMoved(ControlEvent e) {
}
});
-
chartTreeComp = new Composite(chartTreeScrollComp, SWT.NONE);
chartTreeScrollComp.setContent(chartTreeComp);
chartTreeComp.setBackground(ColorResources.WHITE);
-
+
// layout
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.width = DEFAULT_CHARTBOARD_TITLE_BUTTON_WIDTH;
data.height = DEFAULT_CHARTBOARD_HEADER_HEIGHT;
titleButton.setLayoutData(data);
-
+
data = new FormData();
data.left = new FormAttachment(titleButton, 0);
data.top = new FormAttachment(0, 0);
data.width = DEFAULT_CHARTBOARD_ZOOM_BUTTON_WIDTH;
data.height = DEFAULT_CHARTBOARD_HEADER_HEIGHT;
chartZoomButton.setLayoutData(data);
-
+
data = new FormData();
data.left = new FormAttachment(chartZoomButton, 0);
data.top = new FormAttachment(0, 0);
- data.right = new FormAttachment(100,0);
+ data.right = new FormAttachment(100, 0);
data.height = DEFAULT_CHARTBOARD_HEADER_HEIGHT;
timeline.setLayoutData(data);
-
+
data = new FormData();
data.left = new FormAttachment(0, 0);
data.top = new FormAttachment(titleButton, 0);
data.bottom = new FormAttachment(100, -20);
- data.right = new FormAttachment(100,0);
+ data.right = new FormAttachment(100, 0);
chartTreeScrollComp.setLayoutData(data);
-
+
data = new FormData();
data.left = new FormAttachment(0, 0);
data.top = new FormAttachment(chartTreeScrollComp, 0);
data.width = DEFAULT_CHARTBOARD_SCALE_WIDTH;
data.height = DEFAULT_CHARTBOARD_FOOTER_HEIGHT;
scale.setLayoutData(data);
-
+
data = new FormData();
data.left = new FormAttachment(scale, 0);
data.right = new FormAttachment(100, 0);
data.bottom = new FormAttachment(100, 0);
data.height = DEFAULT_CHARTBOARD_FOOTER_HEIGHT;
scrollComp.setLayoutData(data);
-
+
boardManager = new DACustomChartBoardManager(this);
-// boardManager.setTotalEndTime(200);
-// hScroll.setMaximum(200000);
+ // boardManager.setTotalEndTime(200);
+ // hScroll.setMaximum(200000);
}
-
+
private DAScaleSelectionListener scaleSelectionListener = new DAScaleSelectionListener() {
@Override
// updateTree();
int sel = scale.getSelection();
- if (sel == 0 && boardManager.getScaleVal() != DACustomChartBoardManager.SCALE_100) {
+ if (sel == 0
+ && boardManager.getScaleVal() != DACustomChartBoardManager.SCALE_100) {
boardManager.scaleChanged(DACustomChartBoardManager.SCALE_100);
- } else if (sel == 1 && boardManager.getScaleVal() != DACustomChartBoardManager.SCALE_400) {
+ } else if (sel == 1
+ && boardManager.getScaleVal() != DACustomChartBoardManager.SCALE_400) {
boardManager.scaleChanged(DACustomChartBoardManager.SCALE_400);
- } else if (sel == 2 && boardManager.getScaleVal() != DACustomChartBoardManager.SCALE_800) {
+ } else if (sel == 2
+ && boardManager.getScaleVal() != DACustomChartBoardManager.SCALE_800) {
boardManager.scaleChanged(DACustomChartBoardManager.SCALE_800);
} else {
return;
}
}
};
-
+
private SelectionListener scrollbarSelectionListener = new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
};
-
- protected void notifyScaleChanged(int scaleVal, double thumb, double visibleStartTime){
+
+ private void setChartAxis() {
+ int itemSize = items.size();
+ for (int i = 0; i < itemSize; i++) {
+ items.get(i).setChartAxis(getVisibleStartTime(),
+ getVisibleEndTime());
+ }
+ }
+
+ protected void notifyScaleChanged(int scaleVal, double thumb,
+ double visibleStartTime) {
timeline.setScale(scaleVal);
timeline.setStartTime(visibleStartTime);
timeline.redraw();
- hScroll.setThumb((int) (thumb*1000));
- hScroll.setSelection((int)(visibleStartTime*1000));
+ hScroll.setThumb((int) (thumb * 1000));
+ hScroll.setSelection((int) (visibleStartTime * 1000));
+ setChartAxis();
}
-
- protected void notifyScrollChanged(double visibleStratTime){
+
+ protected void notifyScrollChanged(double visibleStratTime) {
timeline.setStartTime(visibleStratTime);
timeline.redraw();
+ setChartAxis();
}
-
- public int getChartWidth(){
+
+ public int getChartWidth() {
Rectangle rt;
- if(null == (rt = scrollComp.getClientArea())){
+ if (null == (rt = scrollComp.getClientArea())) {
return 0;
- }
- else{
+ } else {
return rt.width;
}
}
-
- protected void setScrollThumb(int thumb){
+
+ protected void setScrollThumb(int thumb) {
hScroll.setThumb(thumb);
}
-
- protected void setScrollMaximum(int maximum){
+
+ protected void setScrollMaximum(int maximum) {
hScroll.setMaximum(maximum);
}
-
- protected void setScrollSelection(int selection){
+
+ protected void setScrollSelection(int selection) {
hScroll.setSelection(selection);
}
- protected void registeItem(DACustomChartBoardItem item){
+ protected void registeItem(DACustomChartBoardItem item) {
items.add(item);
Rectangle rt = chartTreeComp.getBounds();
chartTreeComp.setBounds(rt.x, rt.y, rt.width, rt.height + chartHeight);
item.setBounds(rt.x, rt.height, rt.width, chartHeight);
}
-
- private int findItemIndex(DACustomChartBoardItem item){
- for(int i=0; i<items.size(); i++){
- if(item.equals(items.get(i))){
+
+ private int findItemIndex(DACustomChartBoardItem item) {
+ for (int i = 0; i < items.size(); i++) {
+ if (item.equals(items.get(i))) {
return i;
}
}
return -1;
}
-
- protected Composite getChartComposite(){
+
+ protected Composite getChartComposite() {
return chartTreeComp;
}
-
- protected void notifyResizeChild(DACustomChartBoardItem item){
- if(null == items){
+
+ protected void notifyResizeChild(DACustomChartBoardItem item) {
+ if (null == items) {
return;
}
DACustomChartBoardItem child;
Point p;
Rectangle rect = item.getBounds();
- for(int i=findItemIndex(item) + 1; i<items.size(); i++){
+ for (int i = findItemIndex(item) + 1; i < items.size(); i++) {
child = items.get(i);
p = child.getSize();
child.setBounds(rect.x, rect.y + rect.height, rect.width, p.y);
rect.height += p.y;
}
Rectangle treeRect = chartTreeComp.getBounds();
- chartTreeComp.setBounds(treeRect.x, treeRect.y, treeRect.width, rect.y + rect.height);
+ chartTreeComp.setBounds(treeRect.x, treeRect.y, treeRect.width, rect.y
+ + rect.height);
}
- public void setTotalEndTime(long time){
- double endTime = (double)time/1000000;
+
+ public void setTotalEndTime(long time) {
+ double endTime = (double) time / 1000000;
boardManager.totalEndTimeChanged(endTime);
-// if(lastTime > 0 && lastTime > boardManager.getTotalEndTime()){
-// boardManager.setTotalEndTime(lastTime);
-// hScroll.setMaximum((int)(time/1000));
-// }
+ // if(lastTime > 0 && lastTime > boardManager.getTotalEndTime()){
+ // boardManager.setTotalEndTime(lastTime);
+ // hScroll.setMaximum((int)(time/1000));
+ // }
}
- public void clear(){
- for(int i=0; i<items.size(); i++){
+
+ public void clear() {
+ for (int i = 0; i < items.size(); i++) {
items.get(i).dispose();
}
items.clear();
setTotalEndTime(0);
timeline.setStartTime(0);
}
+
+ public double getVisibleStartTime() {
+ return boardManager.getVisibleStartTime();
+ }
+
+ public double getVisibleEndTime() {
+ return boardManager.getVisibleEndTime();
+ }
+
+ protected void NotifyCallbackSelection(DACustomChartBoardItem item) {
+ if (selectItem == item) {
+ System.out.println("select again!"); // FIXME
+ return;
+ } else {
+ selectItem = item;
+ System.out.println("select new item!"); // FIXME
+ }
+ }
}
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.widgets.chartBoard;
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.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
public class DACustomChartBoardItem extends Composite {
private DACustomChartBoard parentBoard = null;
private List<DACustomChartBoardItem> children = null;
private DACustomChartBoardItemCell itemCell;
private Composite childComposite;
-
+ private String itemName;
+
private boolean isFold = true;
private boolean isExpand = false;
- private final static int DEFAULT_ITEM_HEIGHT = 100; //FIXME get from ChartBoard
+ private final static int DEFAULT_ITEM_HEIGHT = 100; // FIXME get from
+ // ChartBoard
private int depth = 0;
- private void initWidget(){
+ private void initWidget() {
itemCell = new DACustomChartBoardItemCell(this);
Rectangle rt = this.getClientArea();
itemCell.setBounds(rt);
+ this.addControlListener(new ControlListener() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ int width = ((DACustomChartBoardItem) (e.widget)).getSize().x;
+ itemCell.setSize(width, itemCell.getSize().y);
+ }
+
+ @Override
+ public void controlMoved(ControlEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
}
- public DACustomChartBoardItem(DACustomChartBoard parent) {
+
+ public DACustomChartBoardItem(DACustomChartBoard parent, String itemName) {
super(parent.getChartComposite(), SWT.NONE);
parentBoard = parent;
+ setItemName(itemName);
parentBoard.registeItem(this);
initWidget();
}
-
- public DACustomChartBoardItem(DACustomChartBoardItem parent) {
- super(parent.getChartComposite(), SWT.NONE);
+
+ public DACustomChartBoardItem(DACustomChartBoardItem parent, String itemName) {
+ super(parent.getChildChartComposite(), SWT.NONE);
parentItem = parent;
+ setItemName(itemName);
depth = parent.getDepth() + 1;
parentItem.registeItem(this);
initWidget();
}
-
- private int findItemIndex(DACustomChartBoardItem item){
- for(int i=0; i<children.size(); i++){
- if(item.equals(children.get(i))){
+
+ private int findItemIndex(DACustomChartBoardItem item) {
+ for (int i = 0; i < children.size(); i++) {
+ if (item.equals(children.get(i))) {
return i;
}
}
return -1;
}
-
- protected int getDepth(){
+
+ protected int getDepth() {
return depth;
}
-
- private void callNotifyResizeChild(){
- if(null != parentBoard){
+
+ private void callNotifyResizeChild() {
+ if (null != parentBoard) {
parentBoard.notifyResizeChild(this);
- }
- else if(null != parentItem){
+ } else if (null != parentItem) {
parentItem.notifyResizeChild(this);
- }
- else{
+ } else {
return;
}
}
-
- private void reArrangeChildByItem(DACustomChartBoardItem item){
- if(null == children){
+
+ private void reArrangeChildByItem(DACustomChartBoardItem item) {
+ if (null == children) {
return;
}
-
+
DACustomChartBoardItem child;
Point p;
Rectangle rect = item.getBounds();
- for(int i=findItemIndex(item) + 1; i<children.size(); i++){
+ for (int i = findItemIndex(item) + 1; i < children.size(); i++) {
child = children.get(i);
p = child.getSize();
child.setBounds(rect.x, rect.y + rect.height, rect.width, p.y);
rect.height += p.y;
}
- if(null == childComposite){
+ if (null == childComposite) {
return;
}
Rectangle childRect = childComposite.getBounds();
- childComposite.setBounds(childRect.x, childRect.y, childRect.width, rect.y + rect.height);
+ childComposite.setBounds(childRect.x, childRect.y, childRect.width,
+ rect.y + rect.height);
}
- private void notifyResizeChild(DACustomChartBoardItem item){
+
+ private void notifyResizeChild(DACustomChartBoardItem item) {
reArrangeChildByItem(item);
-
- if(false == isFold){
+
+ if (false == isFold) {
reArrangeItemSize();
callNotifyResizeChild();
}
}
-
- private void reArrangeItemSize(){
+
+ private void reArrangeItemSize() {
Rectangle itemRect = getBounds();
Rectangle itemCellRect = itemCell.getBounds();
Rectangle childCompositeRect;
- if(false == isFold){
+ if (false == isFold) {
childCompositeRect = childComposite.getBounds();
itemRect.height = itemCellRect.height + childCompositeRect.height;
- }
- else{
+ } else {
itemRect.height = itemCellRect.height;
}
setBounds(itemRect);
}
-
- protected void registeItem(DACustomChartBoardItem child){
- if(null == children){
+
+ protected void registeItem(DACustomChartBoardItem child) {
+ if (null == children) {
children = new ArrayList<DACustomChartBoardItem>();
itemCell.addExpandToggleButton();
Rectangle r = getClientArea();
childComposite.setBounds(r.x, r.height, r.width, 0);
}
children.add(child);
- if(null == childComposite){
+ if (null == childComposite) {
return;
}
Rectangle rt = childComposite.getBounds();
- childComposite.setBounds(rt.x, rt.y, rt.width, rt.height+DEFAULT_ITEM_HEIGHT);
+ childComposite.setBounds(rt.x, rt.y, rt.width, rt.height
+ + DEFAULT_ITEM_HEIGHT);
child.setBounds(rt.x, rt.height, rt.width, DEFAULT_ITEM_HEIGHT);
-
- if(false == isFold){
+
+ if (false == isFold) {
reArrangeItemSize();
callNotifyResizeChild();
}
}
-
- protected void callbackFold(){
+
+ protected void callbackFold() {
isFold = true;
reArrangeItemSize();
callNotifyResizeChild();
}
-
- protected void callbackUnFold(){
+
+ protected void callbackUnFold() {
isFold = false;
reArrangeItemSize();
callNotifyResizeChild();
}
-
- protected Composite getChartComposite(){
- if(null == childComposite){
+
+ protected void NotifyCallbackSelection(DACustomChartBoardItem item) {
+ if (null != parentBoard) {
+ parentBoard.NotifyCallbackSelection(item);
+ } else if (null != parentItem) {
+ parentItem.NotifyCallbackSelection(item);
+ } else {
+ return;
+ }
+ }
+
+ protected void callbackSelect() {
+ NotifyCallbackSelection(this);
+ }
+
+ protected Composite getChildChartComposite() {
+ if (null == childComposite) {
childComposite = new Composite(this, SWT.NONE);
}
return childComposite;
}
+
+ public Composite getChartComposite() {
+ if (null == itemCell) {
+ return null;
+ } else {
+ return itemCell.getChartCell();
+ }
+ }
+
+ public String getItemName() {
+ return itemName;
+ }
+
+ public void setItemName(String itemName) {
+ this.itemName = itemName;
+ }
+
+ public DACustomChart getChart() {
+ return itemCell.getChartCell();
+ }
+
+ protected void setChartAxis(double startX, double endX) {
+ DACustomChart chart = getChart();
+ chart.getPlot().setAxisRangeX(startX, endX);
+ chart.redraw();
+ if (null == children) {
+ return;
+ }
+ int childrenSize = children.size();
+ for (int i = 0; i < childrenSize; i++) {
+ children.get(i).setChartAxis(startX, endX);
+ }
+ }
}
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.widgets.chartBoard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
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.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
class DACustomChartBoardItemCell extends Composite {
private DACustomChartBoardItem parent;
private Canvas nameCell;
- private Composite chartCell;
+ private DACustomChart chartCell;
private DACustomToggleButton childExpandButton;
- private final static int DEFAULT_NAME_CELL_WIDTH = 99; //FIXME get from ChartBoard
+ private final static int DEFAULT_NAME_CELL_WIDTH = 99; // FIXME get from
+ // ChartBoard
private final static int DEFAULT_TOGGLE_BUTTON_SIZE = 10;
private final static int DEFAULT_TOGGLE_BUTTON_MARGIN = 5;
private int nameCellWidth = DEFAULT_NAME_CELL_WIDTH;
-
+ public static final int DEFAULT_FONT_SIZE = 8;
+
+ Font font = new Font(Display.getCurrent(), "Verdana", // FIXME
+ DEFAULT_FONT_SIZE, SWT.NORMAL);
public DACustomChartBoardItemCell(final DACustomChartBoardItem parent) {
super(parent, SWT.NONE);
this.parent = parent;
this.setBackground(ColorResources.BLACK);
this.addControlListener(new ControlListener() {
-
+
@Override
public void controlResized(ControlEvent e) {
Rectangle rt = getBounds();
- if(null != nameCell){
- nameCell.setBounds(rt.x+1, rt.y, nameCellWidth-1, rt.height-1);
+
+ if (null != nameCell) {
+ nameCell.setBounds(rt.x + 1, rt.y, nameCellWidth - 1,
+ rt.height - 1);
}
- if(null != chartCell){
- chartCell.setBounds(rt.x+1 + nameCellWidth, rt.y, rt.width - nameCellWidth-1, rt.height-1);
+ if (null != chartCell) {
+ chartCell.setBounds(rt.x + 1 + nameCellWidth, rt.y,
+ rt.width - nameCellWidth - 1, rt.height - 1);
}
}
-
+
@Override
- public void controlMoved(ControlEvent e) {
+ public void controlMoved(ControlEvent e) {
}
});
-
+
nameCell = new Canvas(this, SWT.NONE);
-
+
nameCell.addPaintListener(new PaintListener() {
-
+
@Override
public void paintControl(PaintEvent e) {
- if(parent.getDepth() == 0){
- e.gc.setBackground(ColorResources.SCALE_BG_COLOR_END); // FIXME
- }
- else{
- e.gc.setBackground(ColorResources.SCALE_BG_COLOR_START);
+ Rectangle rect = ((Canvas) (e.widget)).getClientArea();
+ if (parent.getDepth() == 0) {
+ e.gc.setForeground(ColorResources.CHART_NAME_BACK_START); // FIXME
+ e.gc.setBackground(ColorResources.CHART_NAME_BACK_END); // FIXME
+ } else {
+ e.gc.setForeground(ColorResources.CHART_NAME_CHILD_BACK); // FIXME
+ e.gc.setBackground(ColorResources.CHART_NAME_CHILD_BACK);
}
- e.gc.fillRectangle(((Canvas)(e.widget)).getBounds());
+ e.gc.fillGradientRectangle(rect.x, rect.y, rect.width,
+ rect.height, true);
+ e.gc.setForeground(ColorResources.BLACK);
+ e.gc.setFont(font);
+ drawNameString(e.gc, parent.getItemName(), rect.width / 2,
+ rect.height / 2);
}
});
-
- chartCell = new Composite(this, SWT.NONE);
- if(parent.getDepth() == 0){
- chartCell.setBackground(ColorResources.ITEM_BLUE_DARK);
- }
- else{
- chartCell.setBackground(ColorResources.ITEM_BLUE_BRIGHT);
- }
- }
- public void addExpandToggleButton(){
- if(null != childExpandButton){
- return;
- }
- childExpandButton = new DACustomToggleButton(nameCell, ImageResources.TREE_FOLD, null,null,null,ImageResources.TREE_OPEN);
- Rectangle rt = nameCell.getClientArea();
- childExpandButton.setBounds(rt.width-DEFAULT_TOGGLE_BUTTON_SIZE-DEFAULT_TOGGLE_BUTTON_MARGIN, rt.height/2, DEFAULT_TOGGLE_BUTTON_SIZE, DEFAULT_TOGGLE_BUTTON_SIZE);
- childExpandButton.addClickListener(new DACustomButtonClickEventListener() {
-
+ nameCell.addMouseListener(new MouseListener() {
+
@Override
- public void handleClickEvent(DACustomButton button) {
- if(true == childExpandButton.isToggled()){
- parent.callbackUnFold();
+ public void mouseUp(MouseEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ parent.callbackSelect();
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ if (null == childExpandButton) {
+ return;
}
- else{
+ boolean isToggle = childExpandButton.isToggled();
+ childExpandButton.setToggled(!isToggle);
+ if (true == isToggle) {
parent.callbackFold();
+ } else {
+ parent.callbackUnFold();
}
}
});
+
+ chartCell = new DACustomChart(this, parent.getItemName());
+ chartCell.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ parent.callbackSelect();
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+ });
+ }
+
+ public void addExpandToggleButton() {
+ if (null != childExpandButton) {
+ return;
+ }
+ childExpandButton = new DACustomToggleButton(nameCell,
+ ImageResources.TREE_FOLD, null, null, null,
+ ImageResources.TREE_OPEN);
+ Rectangle rt = nameCell.getClientArea();
+ childExpandButton.setBounds(rt.x + DEFAULT_TOGGLE_BUTTON_SIZE
+ - DEFAULT_TOGGLE_BUTTON_MARGIN, rt.height / 2
+ - DEFAULT_TOGGLE_BUTTON_SIZE / 2, DEFAULT_TOGGLE_BUTTON_SIZE,
+ DEFAULT_TOGGLE_BUTTON_SIZE);
+ childExpandButton
+ .addClickListener(new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ if (true == childExpandButton.isToggled()) {
+ parent.callbackUnFold();
+ } else {
+ parent.callbackFold();
+ }
+ }
+ });
+ }
+
+ public DACustomChart getChartCell() {
+ return chartCell;
+ }
+
+ private void drawNameString(GC gc, String name, int pixcelX, int pixcelY) {
+ Point p;
+ if (null == name) {
+ return;
+ }
+ p = gc.textExtent(name, SWT.DRAW_MNEMONIC);
+ gc.drawText(name, pixcelX - p.x / 2, pixcelY - p.y / 2, true);
}
}
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.widgets.chartBoard;
import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimelineRenderer;
-
- class DACustomChartBoardManager {
+class DACustomChartBoardManager {
public final static int SCALE_100 = 1;
public final static int SCALE_400 = 4;
public final static int SCALE_800 = 8;
-
+
private int chartWidth = 0;
private double totalStartTime = 0;
private double totalEndTime = 0;
private double visibleStartTime = 0;
- private double visibleEndTime = 0;
private int scaleVal = SCALE_100;
private double thumb = 1;
-
+
private DACustomChartBoard board = null;
-
+
public DACustomChartBoardManager(DACustomChartBoard board) {
this.board = board;
}
}
public double getVisibleEndTime() {
- return visibleEndTime;
- }
-
- public void setVisibleEndTime(double visibleEndTime) {
- this.visibleEndTime = visibleEndTime;
+ return visibleStartTime + thumb;
}
public int getScaleVal() {
return scaleVal;
}
- public void scaleChanged(int scaleVal){
+ public void scaleChanged(int scaleVal) {
this.scaleVal = scaleVal;
-
+
double newThumb = computeThumb(chartWidth, scaleVal);
-
- visibleStartTime = computeVisibleStartTime(thumb, newThumb, totalEndTime);
+
+ visibleStartTime = computeVisibleStartTime(thumb, newThumb,
+ totalEndTime);
thumb = newThumb;
-
+
board.notifyScaleChanged(scaleVal, thumb, visibleStartTime);
}
-
- public void scrollbarSelectionChanged(int sel){
- visibleStartTime = (double)sel/1000.0;
+
+ public void scrollbarSelectionChanged(int sel) {
+ visibleStartTime = (double) sel / 1000.0;
board.notifyScrollChanged(visibleStartTime);
}
-
- public void totalEndTimeChanged(double totalEndTime){
- board.setScrollMaximum((int)(totalEndTime*1000));
- board.setScrollThumb((int) (thumb*1000));
-
- if((int)(visibleStartTime*1000) + (int)(thumb*1000) == (int)(this.totalEndTime*1000)){
+ public void totalEndTimeChanged(double totalEndTime) {
+
+ board.setScrollMaximum((int) (totalEndTime * 1000));
+ board.setScrollThumb((int) (thumb * 1000));
+
+ if ((int) (visibleStartTime * 1000) + (int) (thumb * 1000) == (int) (this.totalEndTime * 1000)) {
visibleStartTime = totalEndTime - thumb;
- board.setScrollSelection((int)(visibleStartTime*1000));
+ board.setScrollSelection((int) (visibleStartTime * 1000));
+ board.notifyScrollChanged(visibleStartTime);
}
this.totalEndTime = totalEndTime;
}
-
- private double computeThumb(int width, int scale){
- if( width == 0){
+
+ private double computeThumb(int width, int scale) {
+ if (width == 0) {
return 0;
}
- double ret = (double)chartWidth / (double)((DACustomTimelineRenderer.DEFAULT_INTERVAL * scale));
+ double ret = (double) chartWidth
+ / (double) ((DACustomTimelineRenderer.DEFAULT_INTERVAL * scale));
return ret;
}
-
- private double computeVisibleStartTime(double oldThumb, double newThumb, double totalEndTime){
+
+ private double computeVisibleStartTime(double oldThumb, double newThumb,
+ double totalEndTime) {
double ret = 0;
- if(0 == visibleStartTime){
+ if (0 == visibleStartTime) {
return ret;
- }
- else if(visibleStartTime + oldThumb == totalEndTime){
+ } else if (visibleStartTime + oldThumb == totalEndTime) {
ret = totalEndTime - newThumb;
- }
- else{
- ret = (visibleStartTime+(oldThumb/2)) - (newThumb / 2);
- if(ret + newThumb > totalEndTime){
+ } else {
+ ret = (visibleStartTime + (oldThumb / 2)) - (newThumb / 2);
+ if (ret + newThumb > totalEndTime) {
ret = totalEndTime - newThumb;
}
}
- if(ret < 0){
+ if (ret < 0) {
ret = 0;
}
return ret;
}
-
- public void timelineWidthChanged(int width){
+
+ public void timelineWidthChanged(int width) {
chartWidth = width;
thumb = computeThumb(chartWidth, scaleVal);
- board.setScrollThumb((int) (thumb*1000));
+ board.setScrollThumb((int) (thumb * 1000));
}
}
public static Color SCALE_AREA_COLOR = getColor("scale_area_color", new RGB(103, 103, 103)); //$NON-NLS-1$\r
public static Color SCALE_AREA_OUTLINE_COLOR = getColor("scale_area_outline_color", new RGB(250, 250, 250)); //$NON-NLS-1$\r
\r
+ //timeline\r
+ public static Color TIMELINE_TICK_COLOR = getColor("timeline_tick", new RGB(83, 83, 83)); //$NON-NLS-1$\r
\r
+ //chart\r
+ public static Color CHART_NAME_BACK_START = getColor("chart_name_back_start", new RGB(215, 215, 215)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_BACK_END = getColor("chart_name_back_end", new RGB(157, 166, 168)); //$NON-NLS-1$\r
+ public static Color CHART_NAME_CHILD_BACK = getColor("chart_name_child_back", new RGB(103, 103, 103)); //$NON-NLS-1$\r
+\r
+ \r
// shell window background color\r
public static final Color WINDOW_BG_COLOR = getColor(\r
"window_bg_color", new RGB(51, 52, 53)); //$NON-NLS-1$\r
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.widgets.timeline;
import org.eclipse.swt.SWT;
public final static int SCALE_100 = 1;
public final static int SCALE_400 = 4;
public final static int SCALE_800 = 8;
-// private Composite parent = null;
private double startTime = 0;
private int scale = SCALE_100;
private DACustomTimelineRenderer timelineRenderer = new DACustomTimelineRenderer();
public DACustomTimeline(Composite parent) {
super(parent, SWT.NONE);
-// this.parent = parent;
-// this.setBackground(ColorResources.WHITE);
this.addPaintListener(chartPaintListener);
}
-
+
public double getStartTime() {
return startTime;
}
@Override
public void paintControl(PaintEvent e) {
- // TODO Auto-generated method stub
timelineRenderer.draw(e.gc, (DACustomTimeline) e.widget);
}
};
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.widgets.timeline;
import org.eclipse.swt.SWT;
import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
public class DACustomTimelineRenderer {
- public static final int DEFAULT_FONT_SIZE = 8;
+ public static final int DEFAULT_FONT_SIZE = 6;
public static final int DEFAULT_INTERVAL = 5;
private int startTime;
-// double endTime;
int scale;
- Font font = new Font(Display.getCurrent(), "Arial",
- DEFAULT_FONT_SIZE, SWT.BOLD);
-
-
+ Font font = new Font(Display.getCurrent(), "Verdana", // FIXME
+ DEFAULT_FONT_SIZE, SWT.NORMAL);
+
private void drawTimeString(GC gc, int totalSecond, int pixcelX, int pixcelY) {
Point p;
String timeString = Formatter.toTimelineFormat(totalSecond);
-
+
p = gc.textExtent(timeString, SWT.DRAW_MNEMONIC);
gc.drawText(timeString, pixcelX - p.x / 2, pixcelY, true);
}
-
+
public void draw(GC gc, DACustomTimeline timeline) {
Rectangle rt = timeline.getClientArea();
gc.setFont(font);
- gc.setBackground(ColorResources.BLACK);
- gc.setForeground(ColorResources.WHITE);
+ gc.setBackground(ColorResources.WHITE);
+ gc.setForeground(ColorResources.TIMELINE_TICK_COLOR);
gc.fillRectangle(rt);
- gc.drawRectangle(0, 0, rt.width-1, rt.height-1);
-
-
+ gc.drawRectangle(0, 0, rt.width - 1, rt.height - 1);
+
// draw underLine
- gc.drawLine(0, rt.height - 2, rt.width, rt.height - 2);
-
+ gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1);
+
// draw time
int pixcelX = 0;
scale = timeline.getScale();
int secondInterval = scale * DEFAULT_INTERVAL;
-
-
- for(startTime = (int)timeline.getStartTime(); pixcelX < rt.width; startTime++, pixcelX+=secondInterval){
+ 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, 0);
+ drawTimeString(gc, startTime, pixcelX, 1);
gc.drawLine(pixcelX, rt.height - 7, pixcelX, rt.height - 1);
} else if (startTime % 5 == 0) {
- if (scale >= DACustomTimeline.SCALE_400) {
- drawTimeString(gc, startTime, pixcelX, 0);
+ if (scale >= DACustomTimeline.SCALE_400) {
+ drawTimeString(gc, startTime, pixcelX, 1);
}
gc.drawLine(pixcelX, rt.height - 5, pixcelX, rt.height - 1);
} else {
if (scale >= DACustomTimeline.SCALE_800) {
- drawTimeString(gc, startTime, pixcelX, 0);
+ drawTimeString(gc, startTime, pixcelX, 1);
}
gc.drawLine(pixcelX, rt.height - 3, pixcelX, rt.height - 1);
}
-
+
}
}
}
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoard;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoardItem;
public class ThreadChartView extends DAView {
public static final String ID = ThreadChartView.class.getName();
public final static int THREAD_CHART_HEIGHT = 40;
private DACustomChartBoard threadChart;
+ ThreadPageDataManager tManager;
public ThreadChartView(Composite parent, int style) {
super(parent, style);
this.setLayout(new FillLayout());
-
+
// TODO Auto-generated constructor stub
ViewContainer viewContainer = new ViewContainer(this, false);
viewContainer.setTitleText(ThreadPageLabels.THREAD_CHART_TITLE);
Composite contents = viewContainer.getContentArea();
contents.setBackground(ColorResources.WINDOW_BG_COLOR);
contents.setLayout(new FillLayout());
- threadChart = new DACustomChartBoard(contents, ThreadPageLabels.THREAD_CHART_TITLE);
-// threadChart = new DAPageChart(contents, SWT.SINGLE | SWT.BORDER
-// | SWT.FULL_SELECTION | SWT.V_SCROLL,
-// ThreadPageLabels.THREAD_CHART_THREAD);
-// threadChart.addSelectionListener(new SelectionListener() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// Grid chart = (Grid)(e.widget);
-// if(!(chart instanceof Grid)){
-// return;
-// }
-// PageChartItem item = threadChart.getItems().get(chart.getSelectionIndex());
-//// System.out.println("threadChart item" + threadChart.GetItems().get(chart.getSelectionIndex())); //$NON-NLS-1$
-//// System.out.println("item select!!!!" + ((Grid)(e.widget)).getSelectionIndex()); //$NON-NLS-1$
-// DASelectionData data = new DASelectionData(ID, 0, 0, item, chart);
-// AnalyzerManager.getCurrentPage().updatePage(data);
-// }
-//
-// @Override
-// public void widgetDefaultSelected(SelectionEvent e) {
-// // TODO Auto-generated method stub
-//
-// }
-// });
+ threadChart = new DACustomChartBoard(contents,
+ ThreadPageLabels.THREAD_CHART_TITLE);
+ tManager = new ThreadPageDataManager(threadChart, this);
+ // threadChart = new DAPageChart(contents, SWT.SINGLE | SWT.BORDER
+ // | SWT.FULL_SELECTION | SWT.V_SCROLL,
+ // ThreadPageLabels.THREAD_CHART_THREAD);
+ // threadChart.addSelectionListener(new SelectionListener() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // Grid chart = (Grid)(e.widget);
+ // if(!(chart instanceof Grid)){
+ // return;
+ // }
+ // PageChartItem item =
+ // threadChart.getItems().get(chart.getSelectionIndex());
+ //// System.out.println("threadChart item" + threadChart.GetItems().get(chart.getSelectionIndex())); //$NON-NLS-1$
+ //// System.out.println("item select!!!!" + ((Grid)(e.widget)).getSelectionIndex()); //$NON-NLS-1$
+ // DASelectionData data = new DASelectionData(ID, 0, 0, item, chart);
+ // AnalyzerManager.getCurrentPage().updatePage(data);
+ // }
+ //
+ // @Override
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ // // TODO Auto-generated method stub
+ //
+ // }
+ // });
}
@Override
public void updateView() {
-// System.out.println("time :" + CoolbarArea.getInstance().getTime());
+ // System.out.println("time :" + CoolbarArea.getInstance().getTime());
threadChart.setTotalEndTime(ToolbarArea.getInstance().getTime());
+ tManager.checkUpdate();
}
@Override
public void updateLog(LogPackage logPack) {
+ tManager.parsePageData(logPack);
}
@Override
public void clear() {
threadChart.clear();
- ThreadPageDataManager.getInstance().clear();
+ tManager.clear();
}
@Override
return threadChart;
}
+ // public DACustomChartBoardItem createBoardItem(){
+ // DACustomChartBoardItem ret = new DACustomChartBoardItem(threadChart);
+ // return ret;
+ // }
+
}
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Jooyoul Lee <jy.exe.lee@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.thread;
import org.eclipse.nebula.widgets.grid.GridItem;
private long totalUseTime = 0;
private int apiCount = 0;
private int failedApiCount = 0;
-
+
int[] innerMaxWeight = { 0, 100 };
int[] outerMaxWeight = { 0, 100 };
ViewContainer viewContainer = new ViewContainer(this, true);
viewContainer.setTitleText(ThreadPageLabels.THREAD_DETAILS_TITLE);
setMaxWeight(innerMaxWeight, outerMaxWeight);
-
+
Composite contents = viewContainer.getContentArea();
contents.setBackground(ColorResources.VIEW_BG_COLOR);
contents.setLayout(new FillLayout());
*
* Contact:
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
SashForm leftForm;
SashForm rightForm;
- ThreadPageDataManager tManager = ThreadPageDataManager.getInstance();
+ // ThreadPageDataManager tManager = ThreadPageDataManager.getInstance();
public ThreadPage(Composite parent, int style) {
super(parent, style);
});
}
- public void updateLog(LogPackage logPack) {
- // tManager.parsePageData(logPack);
- }
+ // public void updateLog(LogPackage logPack) {
+ // tManager.parsePageData(logPack);
+ // }
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.thread;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoardItem;
+
+public class ThreadPageData {
+ private ThreadPageDataManager manager;
+ private int tid;
+ private String address;
+ private List<ThreadPageDataEvent> contents = new ArrayList<ThreadPageDataEvent>();
+ private List<ThreadPageDataEvent> contentsQueue = new ArrayList<ThreadPageDataEvent>();
+ private DACustomChartBoardItem item;
+ private DACustomChart chart;
+ private DACustomChartSeries loadSeries;
+ private DACustomChartSeries eventSeries;
+ private DACustomChartSeries apiSeries;
+
+ public ThreadPageData(ThreadPageDataManager manager, int tid, String address) {
+ setManager(manager);
+ setTid(tid);
+ setAddress(address);
+ manager.pushRow(this);
+ }
+
+ public ThreadPageDataManager getManager() {
+ return manager;
+ }
+
+ private void setManager(ThreadPageDataManager manager) {
+ this.manager = manager;
+ }
+
+ public int getTid() {
+ return tid;
+ }
+
+ private void setTid(int tid) {
+ this.tid = tid;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public void addDataEvent(ThreadPageDataEvent dataEvent) {
+ contentsQueue.add(dataEvent);
+ }
+
+ public DACustomChartBoardItem getItem() {
+ return item;
+ }
+
+ public void setItem(DACustomChartBoardItem item) {
+ this.item = item;
+ chart = item.getChart();
+ loadSeries = chart.getSeries("LOAD");
+ eventSeries = chart.getSeries("EVENT");
+ apiSeries = chart.getSeries("API");
+ }
+
+ // private DACustomChartBoardItem
+ private void createChartItem(ThreadPageDataEvent event) {
+ DACustomChartSeriesItem seriesItem = new DACustomChartSeriesItem(
+ event.getTime(), 100);
+
+ switch (event.getType()) {
+ case ThreadPageDataEvent.TYPE_LOAD:
+ if (null == loadSeries) {
+ return;
+ }
+ loadSeries.addSeriesItem(seriesItem);
+ break;
+ case ThreadPageDataEvent.TYPE_EVENT:
+ if (null == eventSeries) {
+ return;
+ }
+ eventSeries.addSeriesItem(seriesItem);
+ break;
+ case ThreadPageDataEvent.TYPE_API:
+ if (null == apiSeries) {
+ return;
+ }
+ apiSeries.addSeriesItem(seriesItem);
+ break;
+ default:
+ return;
+ }
+ event.setChartItem(seriesItem);
+ }
+
+ protected void checkUpdate() {
+ int size = contentsQueue.size();
+ if (size > 0) {
+ for (int i = 0; i < size; i++) {
+ ThreadPageDataEvent event = contentsQueue.get(0);
+ createChartItem(event);
+ contents.add(event);
+ contentsQueue.remove(0);
+ }
+ chart.redraw();
+ }
+ }
+
+ public DACustomChart getChart() {
+ return chart;
+ }
+
+ public void setChart(DACustomChart chart) {
+ this.chart = chart;
+ }
+
+ protected void pushEvent(ThreadPageDataEvent event) {
+ contentsQueue.add(event);
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@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.thread;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
+
+public class ThreadPageDataEvent {
+ public static final int TYPE_API = 0;
+ public static final int TYPE_EVENT = 1;
+ public static final int TYPE_LOAD = 2;
+ private ThreadPageData data;
+ private List<String> contents = new ArrayList<String>();
+ private int type = -1;
+ private DACustomChartSeriesItem chartItem;
+ private double time = -1; // FIXME
+ private int tid = -1;
+
+ public ThreadPageDataEvent(ThreadPageDataManager manager, int type,
+ double time, int tid, List<String> contents) {
+ setType(type);
+ setTime(time);
+ setTid(tid);
+ setContents(contents);
+ manager.pushEvent(this);
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ private void setType(int type) {
+ this.type = type;
+ }
+
+ public List<String> getContents() {
+ return contents;
+ }
+
+ private void setContents(List<String> contents) {
+ this.contents = contents;
+ }
+
+ public DACustomChartSeriesItem getChartItem() {
+ return chartItem;
+ }
+
+ public void setChartItem(DACustomChartSeriesItem chartItem) {
+ this.chartItem = chartItem;
+ }
+
+ public double getTime() {
+ return time;
+ }
+
+ public void setTime(double time) {
+ this.time = time;
+ }
+
+ public ThreadPageData getData() {
+ return data;
+ }
+
+ public void setData(ThreadPageData data) {
+ this.data = data;
+ data.pushEvent(this);
+ }
+
+ public int getTid() {
+ return tid;
+ }
+
+ public void setTid(int tid) {
+ this.tid = tid;
+ }
+
+}
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.swt.graphics.Color;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.nl.CommonPageLabels;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.ui.basechart.PageChartGraphEventSeriesInfo;
-import org.tizen.dynamicanalyzer.ui.basechart.PageChartGraphSeries;
-import org.tizen.dynamicanalyzer.ui.basechart.PageChartGraphSeriesItem;
-import org.tizen.dynamicanalyzer.ui.basechart.PageChartItem;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.basechart.PageDataColumn;
-import org.tizen.dynamicanalyzer.ui.basechart.PageDataItem;
-import org.tizen.dynamicanalyzer.ui.basechart.PageDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoard;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoardItem;
-public class ThreadPageDataManager extends PageDataManager {
- private static ThreadPageDataManager instance = null;
- private static int THREAD_PAGE_COLUMN_COUNT = 9;
- private PageChartItem mainThreadItem = null;
+public class ThreadPageDataManager {
+ private DACustomChartBoard board;
+ ThreadChartView view;
+ private boolean isStart = false;
+ private boolean hasUpdate = false;
+ private List<ThreadPageData> rows = new ArrayList<ThreadPageData>();
+ private List<ThreadPageData> rowsQueue = new ArrayList<ThreadPageData>();
+ private List<ThreadPageDataEvent> eventQueue = new ArrayList<ThreadPageDataEvent>();
+ private int tid; // FIXME for test
private static String[] columnNames = {
CommonPageLabels.COMMON_DATA_COLUMN_KEY,
CommonPageLabels.COMMON_DATA_COLUMN_RETURN,
CommonPageLabels.COMMON_DATA_COLUMN_ERRNO,
CommonPageLabels.COMMON_DATA_COLUMN_APITYPE, };
- private static Integer[] columnAttribute = {
+ private static Integer[] columnNameType = {
PageDataColumn.COLUMN_ATTRIBUTE_STRING,
PageDataColumn.COLUMN_ATTRIBUTE_LONG,
PageDataColumn.COLUMN_ATTRIBUTE_TIME,
PageDataColumn.COLUMN_ATTRIBUTE_INT,
PageDataColumn.COLUMN_ATTRIBUTE_INT };
- public static ThreadPageDataManager getInstance() {
- if (null == instance) {
- instance = new ThreadPageDataManager();
+
+ protected void pushRow(ThreadPageData data) {
+ rowsQueue.add(data);
+ }
+
+ protected void pushEvent(ThreadPageDataEvent event) {
+ eventQueue.add(event);
+ }
+
+ protected ThreadPageDataManager(DACustomChartBoard board,
+ ThreadChartView view) {
+ this.setBoard(board);
+ }
+
+ private void createBoardItem(ThreadPageData data) {
+ DACustomChartBoardItem item = new DACustomChartBoardItem(board,
+ String.valueOf(data.getTid()));
+ DACustomChart chart = item.getChart();
+ setChartSeries(chart);
+ setChartStyle(chart);
+ data.setItem(item);
+ chart.redraw();
+ }
+
+ protected void setChartStyle(DACustomChart chart) {
+ if (null == chart) {
+ return;
+ }
+
+ DACustomChartPlot plot = chart.getPlot();
+ if (null == plot) {
+ return;
}
- return instance;
+ plot.setBackgroundImage(ImageResources.BG_GRADIENT);
+ plot.setAutoHeightRange(false);
+ // plot.setTooltip(new DACustomChartPlotTooltip(-1));
+ chart.getPlot().setAxisRangeY(0, 101);
+ chart.getPlot().setAxisRangeX(board.getVisibleStartTime(),
+ board.getVisibleEndTime());
}
- private ThreadPageDataManager() {
+ private void setChartSeries(DACustomChart chart) {
+ DACustomChartSeries loadSeries = new DACustomChartSeries("LOAD",
+ DACustomChartSeries.SERIES_STYLE_BAR, ColorResources.GREEN);
+ loadSeries.setBarWidth(1);
+ DACustomChartSeries eventSeries = new DACustomChartSeries("EVENT",
+ DACustomChartSeries.SERIES_STYLE_BAR, ColorResources.BLUE);
+
+ DACustomChartSeries apiSeries = new DACustomChartSeries("API",
+ DACustomChartSeries.SERIES_STYLE_BAR, ColorResources.ORANGE);
+
+ chart.addSeries(loadSeries);
+ chart.addSeries(eventSeries);
+ chart.addSeries(apiSeries);
+
+ chart.redraw();
}
- @Override
- public PageDataColumn registePageDataColumn() {
- // TODO Auto-generated method stub
- PageDataColumn pageColumn = new PageDataColumn(
- THREAD_PAGE_COLUMN_COUNT, columnNames, columnAttribute);
- return pageColumn;
+ private void createMainThreadItem() {
+ isStart = true;
+ Project project = AnalyzerManager.getProject();
+ int tid = project.getPID();
+ this.tid = tid;
+
+ if (0 == tid) {
+ isStart = false;
+ return;
+ }
+ long startTime = 0;
+
+ new ThreadPageData(this, tid, null);
+ new ThreadPageDataEvent(this,
+ ThreadPageDataEvent.TYPE_EVENT, startTime, tid, null);
+ hasUpdate = true;
}
- @Override
- public List<List<String>> getLogsFromLogPackage(LogPackage logPack) {
+ public List<List<String>> getLogsFromLogPackage(LogPackage logPack,
+ int logCenterConstants) {
// TODO Auto-generated method stub
- if(null == mainThreadItem){
- mainThreadItem = createMainThreadItem();
+ if (false == isStart) {
+ createMainThreadItem();
}
- Logs logs = logPack.getLogs(LogCenterConstants.LOG_RESOURCE);
+
+ Logs logs = logPack.getLogs(logCenterConstants);
if (null == logs || logs.getLogs().size() == 0) {
return null;
}
- List<List<String>> inputs = logs.getLogs();
- List<List<String>> ret = new ArrayList<List<String>>();
- int size = inputs.size();
+ List<List<String>> ret = logs.getLogs();
+ return ret;
+ }
+ private void parseLoad(LogPackage logPack) {
+ List<List<String>> inputs = getLogsFromLogPackage(logPack,
+ LogCenterConstants.LOG_DEVICE);
+ int size;
+ if (null == inputs || 0 == (size = inputs.size())) {
+ return;
+ }
+ List<String> input;
for (int i = 0; i < size; i++) {
- List<String> input = inputs.get(i);
-
- String fdType = input.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
-
- int type = Integer.parseInt(fdType);
- if (type != LogCenterConstants.FD_TYPE_THREAD) {
- continue;
- }
- ret.add(input);
+ input = inputs.get(i);
+ double time = Double.parseDouble(input
+ .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ / TimelineConstants.MEGA;
+ new ThreadPageDataEvent(this, ThreadPageDataEvent.TYPE_LOAD, time,
+ tid, null);
}
- return ret;
+
}
- @Override
- public PageDataItem makePageData(List<String> input) {
- // TODO Auto-generated method stub
- PageDataItem data = new PageDataItem(column, input);
- // key(object address)
- data.setText(PAGE_COLUMN_KEY,
- input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX));
- // number
- data.setText(PAGE_COLUMN_NUMBER,
- input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
- // time
- data.setText(PAGE_COLUMN_TIME, input.get(LogCenterConstants.TIME_INDEX));
- // name
- data.setText(PAGE_COLUMN_NAME,
- input.get(LogCenterConstants.APINAME_INDEX));
- // parameter
- data.setText(PAGE_COLUMN_PARAMETER,
- input.get(LogCenterConstants.INPUTPARM_INDEX));
- // thread id
- data.setText(PAGE_COLUMN_THREADID,
- input.get(LogCenterConstants.THREAD_ID_INDEX));
- // return
- data.setText(PAGE_COLUMN_RETURN,
- input.get(LogCenterConstants.RETURN_INDEX));
- // errno
- data.setText(PAGE_COLUMN_ERRNO,
- input.get(LogCenterConstants.ERROR_INDEX));
- // api type
- data.setText(PAGE_COLUMN_APITYPE,
- input.get(LogCenterConstants.RESOURCE_FDAPITYPE_INDEX));
- return data;
+ public void parsePageData(LogPackage logPack) {
+ parseLoad(logPack);
+ // parseAPI(logPack);
+ // parseEvent(logPack);
+ hasUpdate = true;
}
- public void addPageChartItem(PageDataItem dataItem, int itemIndex) {
- List<PageChartItem> items = pageChart.getItems();
+ protected DACustomChartBoard getBoard() {
+ return board;
+ }
- int graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_NONE;
- Color eventColor;
- boolean bInternalStart = false;
+ private void setBoard(DACustomChartBoard board) {
+ this.board = board;
+ }
- if (dataItem.getText(PAGE_COLUMN_APITYPE).matches(
- LogCenterConstants.FD_API_TYPE_OPEN)) {
- graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_START;
- eventColor = openEventColor;
- } else if (dataItem.getText(PAGE_COLUMN_APITYPE).matches(
- LogCenterConstants.FD_API_TYPE_CLOSE)) {
- graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_END;
- eventColor = closeEventColor;
- } else if (dataItem.getText(PAGE_COLUMN_APITYPE).matches(
- LogCenterConstants.FD_API_INTERNAL_CLOSE)) {
- graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_INTERNAL_END;
- eventColor = closeEventColor;
- } else if (dataItem.getText(PAGE_COLUMN_APITYPE).matches(
- LogCenterConstants.FD_API_INTERNAL_START)) {
- graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_INTERNAL_START;
- eventColor = openEventColor;
- bInternalStart = true;
- } else if (dataItem.getText(PAGE_COLUMN_APITYPE).matches(
- LogCenterConstants.FD_API_WAIT)) {
- graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_USE;
- eventColor = otherEventColor;
- } else if (dataItem.getText(PAGE_COLUMN_APITYPE).matches(
- LogCenterConstants.FD_API_INTERNAL_USE)) {
- graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_INTERNAL_USE;
- eventColor = otherEventColor;
- } else {
- graphSeriesItemStyle = PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_START;
- eventColor = otherEventColor;
+ private ThreadPageData findParentData(int tid) {
+ int size = rows.size();
+ ThreadPageData ret;
+ for (int i = 0; i < size; i++) {
+ ret = rows.get(i);
+ if (ret.getTid() == tid) {
+ return ret;
+ }
}
+ return null;
+ }
- PageChartGraphSeriesItem seriesItem = new PageChartGraphSeriesItem(
- Long.parseLong(dataItem.getText(PAGE_COLUMN_TIME)), itemIndex,
- eventColor, graphSeriesItemStyle);
- String itemName = dataItem.getText(PAGE_COLUMN_KEY);
- int chartItemIndex = findChartItem(items, itemName);
- PageChartItem findItem = null;
- if (0 <= chartItemIndex) {
- findItem = items.get(chartItemIndex);
+ protected void checkUpdate() {
+ if (false == hasUpdate) {
+ return;
+ } else {
+ hasUpdate = false;
}
-
- if (null != findItem && true == bInternalStart) {
- findItem.setTitle(dataItem.getText(PAGE_COLUMN_THREADID) + "("
- + findItem.getTitle() + ")");
+ int size = rowsQueue.size();
+ if (size > 0) {
+ for (int i = 0; i < size; i++) {
+ ThreadPageData data = rowsQueue.get(0);
+ createBoardItem(data);
+ rows.add(data);
+ rowsQueue.remove(0);
+ }
}
- PageChartGraphSeries firstItemSeries;
- if (null != findItem) {
- if (true == useSecondKey) {
- String childItemName = dataItem.getText(secondKeyIndex);
- List<PageChartItem> children = findItem.getChildren();
- int secondChartItemIndex = findChartItem(children,
- childItemName);
- PageChartItem secondFindItem = null;
- if (0 <= secondChartItemIndex) {
- secondFindItem = children.get(secondChartItemIndex);
- }
- PageChartGraphSeries secondItemseries = null;
- if (secondFindItem != null) {
- secondItemseries = secondFindItem.getSeriesList().get(0);
- secondItemseries.add(seriesItem);
- // return;
- } else {
- // FIXME :
- // create new child item
- secondItemseries = new PageChartGraphSeries(
- PageChartGraphSeries.PAGECHART_GRAPHITEM_STATUS_EVENT);
- secondItemseries.add(seriesItem);
- // children.add(new PageChartItem(findItem, childItemName,
- // secondItemseries));
- new PageChartItem(findItem, childItemName, secondItemseries);
- // add series item to paret
+ size = eventQueue.size();
+ if (size > 0) {
+ ThreadPageData data;
+ ThreadPageDataEvent event;
+ for (int i = 0; i < size; i++) {
+ event = eventQueue.get(0);
+ data = findParentData(event.getTid());
+ if (null != data) {
+ data.pushEvent(event);
}
+ eventQueue.remove(0);
}
- firstItemSeries = findItem.getSeriesList().get(0);
- firstItemSeries.add(seriesItem);
- } else {
- firstItemSeries = new PageChartGraphSeries(
- PageChartGraphSeries.PAGECHART_GRAPHITEM_STATUS_EVENT);
- firstItemSeries
- .setEventSeriesInfo(new PageChartGraphEventSeriesInfo(
- ColorResources.THREAD_OPEN_START_RUN,
- ColorResources.THREAD_OPEN_END_RUN,
- ColorResources.THREAD_OPEN_START_STOP,
- ColorResources.THREAD_OPEN_END_STOP,
- ColorResources.THREAD_SLEEP_START,
- ColorResources.THREAD_SLEEP_END,
- ColorResources.THREAD_CLOSED_START,
- ColorResources.THREAD_CLOSED_END));
- firstItemSeries.add(seriesItem);
- PageChartItem firstItem = new PageChartItem(pageChart, itemName,
- firstItemSeries);
- // pageChart.addItem(firstItem);
- if (true == useSecondKey) {
- String childItemName = dataItem.getText(secondKeyIndex);
- PageChartGraphSeries secondItemseries = new PageChartGraphSeries(
- PageChartGraphSeries.PAGECHART_GRAPHITEM_STATUS_EVENT);
- secondItemseries
- .setEventSeriesInfo(new PageChartGraphEventSeriesInfo(
- ColorResources.THREAD_OPEN_START_RUN,
- ColorResources.THREAD_OPEN_END_RUN,
- ColorResources.THREAD_OPEN_START_STOP,
- ColorResources.THREAD_OPEN_END_STOP,
- ColorResources.THREAD_SLEEP_START,
- ColorResources.THREAD_SLEEP_END,
- ColorResources.THREAD_CLOSED_START,
- ColorResources.THREAD_CLOSED_END));
- secondItemseries.add(seriesItem);
- new PageChartItem(firstItem, childItemName, secondItemseries);
+ }
+ size = rows.size();
+ if (size > 0) {
+ ThreadPageData data;
+ for (int i = 0; i < size; i++) {
+ data = rows.get(i);
+ data.checkUpdate();
}
}
- return;
- }
-
- // @Override
- // public abstract PageChartDataItem MakePageChartData(PageDataItem){
- // //FIXME
- // }
- @Override
- public boolean errorCheck(List<String> input) {
- // TODO Auto-generated method stub
- return false;
}
public void clear() {
- super.clear();
- mainThreadItem = null;
- // instance = null;
- }
-
- private PageChartItem createMainThreadItem(){
- Project project = AnalyzerManager.getProject();
- int pid = project.getPID();
- long startTime = 0;
-
- if(0 == pid){
- return null;
- }
- String pID = String.valueOf(pid);
- PageDataItem data = new PageDataItem(column, null);
- data.setText(PAGE_COLUMN_KEY, pID);
- data.setText(PAGE_COLUMN_NUMBER,null);
- data.setText(PAGE_COLUMN_TIME,null);
- data.setText(PAGE_COLUMN_NAME,null);
- data.setText(PAGE_COLUMN_PARAMETER,null);
- data.setText(PAGE_COLUMN_THREADID,null);
- data.setText(PAGE_COLUMN_RETURN,null);
- data.setText(PAGE_COLUMN_ERRNO,null);
- data.setText(PAGE_COLUMN_APITYPE, LogCenterConstants.FD_API_INTERNAL_START);
- int index = addPageDataItem(data);
-
-
- PageChartGraphSeriesItem seriesItem = new PageChartGraphSeriesItem(
- startTime, index,
- openEventColor, PageChartGraphEventSeriesInfo.PAGECHART_GRAPHITEM_STYLE_EVENT_PERIOD_INTERNAL_START);
- PageChartGraphSeries itemSeries = new PageChartGraphSeries(
- PageChartGraphSeries.PAGECHART_GRAPHITEM_STATUS_EVENT);
- itemSeries
- .setEventSeriesInfo(new PageChartGraphEventSeriesInfo(
- ColorResources.THREAD_OPEN_START_RUN,
- ColorResources.THREAD_OPEN_END_RUN,
- ColorResources.THREAD_OPEN_START_STOP,
- ColorResources.THREAD_OPEN_END_STOP,
- ColorResources.THREAD_SLEEP_START,
- ColorResources.THREAD_SLEEP_END,
- ColorResources.THREAD_CLOSED_START,
- ColorResources.THREAD_CLOSED_END));
- itemSeries.add(seriesItem);
- PageChartItem item = new PageChartItem(pageChart, pID,
- itemSeries);
- item.setTitle(item.getTitle()+"(main)");
- return item;
-
+ isStart = false;
+ rows.clear(); // FIXME : clear chart
}
}