import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartPlotTooltip;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
public class TimelineItemManager {
private static final int ITEM_INFO_ZOOM_HEIGHT = 16;
private Image selectedItemImage;
private IntervalMarker selectionMarker;
- private DACustomChartPlotIntervalMarker intervalMarker; // for DACustomChart Selection
+ private DACustomChartPlotIntervalMarker intervalMarker; // for DACustomChart
+ // Selection
private Shell tooltip;
private MouseListener itemZoomMouseListener = new MouseAdapter() {
@Override
public void mouseDown(MouseEvent event) {
- ItemInfoComposite itemInfoComp = (ItemInfoComposite) ((Label) event.getSource()).getParent();
+ ItemInfoComposite itemInfoComp = (ItemInfoComposite) ((Label) event
+ .getSource()).getParent();
if (null == itemInfoComp) {
return;
TimelineItemSettingProvider.setItemZoomToggle(itemID);
- TimelineComposite timelineComposite = AnalyzerUtil.getTimelineComposite();
+ TimelineComposite timelineComposite = AnalyzerUtil
+ .getTimelineComposite();
if (null != timelineComposite) {
timelineComposite.resizeItemArea();
setActivateItem(itemInfoComp.itemName);
- if (TimelineConstants.ITEM_SIZE_MODE_MAX == TimelineItemSettingProvider.getItemSetting(itemID).getSizeMode()) {
+ if (TimelineConstants.ITEM_SIZE_MODE_MAX == TimelineItemSettingProvider
+ .getItemSetting(itemID).getSizeMode()) {
focusItem(itemID);
}
}
return;
}
- ItemInfoComposite itemInfoComp = (ItemInfoComposite) label.getParent();
+ ItemInfoComposite itemInfoComp = (ItemInfoComposite) label
+ .getParent();
if (null == itemInfoComp) {
return;
}
};
+ private double getTooltipStartX(DACustomChartPlot plot,
+ List<DACustomChartSeries> seriesList, int x) {
+ double ret = -1;
+ for (int i = 0; i < seriesList.size(); i++) {
+ DACustomChartSeries series = seriesList.get(i);
+ int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
+ if (-1 == index) {
+ return ret;
+ }
+ double startVal = series.getSeriesItemList().get(index).getX();
+ if (ret < startVal) {
+ ret = startVal;
+ }
+ }
+ return ret;
+ }
+
private Listener chartMouseListener = new Listener() {
@Override
public void handleEvent(Event event) {
DACustomChart chart = (DACustomChart) event.widget;
DACustomChartPlot plot = chart.getPlot();
+ DACustomChartPlotTooltip tooltip = null;
switch (event.type) {
case SWT.MouseMove:
if ((event.stateMask & SWT.BUTTON1) != 0) {
intervalMarker.setEndVal(plot.getXFromXPixcel(event.x));
} else {
- // FIXME : tooltip
+ tooltip = plot.getTooltip();
+ if (null == tooltip) {
+ return;
+ }
+ double oldStartVal = tooltip.getStartVal();
+ double newStartVal = getTooltipStartX(plot,
+ chart.getSeriesList(), event.x);
+
+ if (oldStartVal != newStartVal) {
+ tooltip.setStartVal(newStartVal);
+ }
}
break;
case SWT.MouseDown:
- intervalMarker.setInterval(plot.getXFromXPixcel(event.x), plot.getXFromXPixcel(event.x));
+ tooltip = plot.getTooltip();
+ if (null == tooltip) {
+ return;
+ }
+ tooltip.setTooltip(false);
+ intervalMarker.setInterval(plot.getXFromXPixcel(event.x),
+ plot.getXFromXPixcel(event.x));
break;
case SWT.MouseUp:
+ tooltip = plot.getTooltip();
+ if (null == tooltip) {
+ return;
+ }
+ tooltip.setStartVal(getTooltipStartX(plot,
+ chart.getSeriesList(), event.x));
+ tooltip.setTooltip(true);
intervalMarker.setEndVal(plot.getXFromXPixcel(event.x));
break;
+ case SWT.MouseEnter:
+ tooltip = plot.getTooltip();
+ if (null == tooltip) {
+ return;
+ }
+ tooltip.setStartVal(getTooltipStartX(plot,
+ chart.getSeriesList(), event.x));
+ tooltip.setTooltip(true);
+ break;
+ case SWT.MouseExit:
+ tooltip = plot.getTooltip();
+ if (null == tooltip) {
+ return;
+ }
+ tooltip.setTooltip(false);
+ break;
default:
break;
}
XYPlot xyplot = itemChartComp.getChart().getXYPlot();
ValueAxis domainAxis = xyplot.getDomainAxis();
Rectangle2D rect2D = plotInfo.getDataArea();
- rect2D.setRect(rect2D.getX(), rect2D.getY(), canvas.getBounds().width - rect2D.getY(), rect2D.getHeight());
+ rect2D.setRect(rect2D.getX(), rect2D.getY(),
+ canvas.getBounds().width - rect2D.getY(),
+ rect2D.getHeight());
- tempUpTime = domainAxis.java2DToValue(e.x, rect2D, xyplot.getDomainAxisEdge());
+ tempUpTime = domainAxis.java2DToValue(e.x, rect2D,
+ xyplot.getDomainAxisEdge());
tempUpTime = Math.round(tempUpTime);
- int correctedX = (int) domainAxis.valueToJava2D(tempUpTime, rect2D, xyplot.getDomainAxisEdge());
- Double selectionEndTime = domainAxis.java2DToValue(correctedX, rect2D, xyplot.getDomainAxisEdge());
+ int correctedX = (int) domainAxis.valueToJava2D(tempUpTime, rect2D,
+ xyplot.getDomainAxisEdge());
+ Double selectionEndTime = domainAxis.java2DToValue(correctedX,
+ rect2D, xyplot.getDomainAxisEdge());
setSelectionMarkerEndVal(selectionEndTime);
sendSelectionTimes(e, correctedX);
- TimelineMaster.getInstance().highlightSelectedSnapshot(selectionMarker.getStartValue(), selectionMarker.getEndValue());
+ TimelineMaster.getInstance().highlightSelectedSnapshot(
+ selectionMarker.getStartValue(),
+ selectionMarker.getEndValue());
}
@Override
XYPlot xyplot = itemChartComp.getChart().getXYPlot();
ValueAxis domainAxis = xyplot.getDomainAxis();
Rectangle2D rect2D = plotInfo.getDataArea();
- rect2D.setRect(rect2D.getX(), rect2D.getY(), canvas.getBounds().width - rect2D.getY(), rect2D.getHeight());
+ rect2D.setRect(rect2D.getX(), rect2D.getY(),
+ canvas.getBounds().width - rect2D.getY(),
+ rect2D.getHeight());
- tempDownTime = domainAxis.java2DToValue(e.x, rect2D, xyplot.getDomainAxisEdge());
+ tempDownTime = domainAxis.java2DToValue(e.x, rect2D,
+ xyplot.getDomainAxisEdge());
tempDownTime = Math.round(tempDownTime);
- int correctedX = (int) domainAxis.valueToJava2D(tempDownTime, rect2D, xyplot.getDomainAxisEdge());
- Double selectionStartTime = domainAxis.java2DToValue(correctedX - TempConstants.MIN_SELECTION_HALF_WIDTH_PX, rect2D,
+ int correctedX = (int) domainAxis.valueToJava2D(tempDownTime,
+ rect2D, xyplot.getDomainAxisEdge());
+ Double selectionStartTime = domainAxis.java2DToValue(correctedX
+ - TempConstants.MIN_SELECTION_HALF_WIDTH_PX, rect2D,
xyplot.getDomainAxisEdge());
- Double selectionEndTime = domainAxis.java2DToValue(correctedX + TempConstants.MIN_SELECTION_HALF_WIDTH_PX, rect2D,
+ Double selectionEndTime = domainAxis.java2DToValue(correctedX
+ + TempConstants.MIN_SELECTION_HALF_WIDTH_PX, rect2D,
xyplot.getDomainAxisEdge());
selectionMarker.setStartValue(selectionStartTime);
XYPlot xyplot = itemChartComp.getChart().getXYPlot();
Rectangle2D rect2D = plotInfo.getDataArea();
- rect2D.setRect(rect2D.getX(), canvas.getBounds().y, canvas.getBounds().width - rect2D.getY(), canvas.getBounds().height);
- long selectedTime = Math.round(xyplot.getDomainAxis().java2DToValue(correctedX, rect2D, xyplot.getDomainAxisEdge()));
+ rect2D.setRect(rect2D.getX(), canvas.getBounds().y,
+ canvas.getBounds().width - rect2D.getY(),
+ canvas.getBounds().height);
+ long selectedTime = Math.round(xyplot.getDomainAxis().java2DToValue(
+ correctedX, rect2D, xyplot.getDomainAxisEdge()));
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
tooltip = new Shell(shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
gridLayout.verticalSpacing = SPACING;
tooltip.setLayout(gridLayout);
- Font indexInfoFont = new Font(Display.getDefault(), FontResources.ARIAL, 8, SWT.NORMAL);
+ Font indexInfoFont = new Font(Display.getDefault(),
+ FontResources.ARIAL, 8, SWT.NORMAL);
RowData rowData;
boolean show = true;
List<java.awt.Color> seriesColorList;
int seriesSize;
- TimelineChart timelineChart = TimelineChartManager.getInstance().getTimelineChartInstance(chartType);
+ TimelineChart timelineChart = TimelineChartManager.getInstance()
+ .getTimelineChartInstance(chartType);
seriesList = timelineChart.getBaseSeriesList();
seriesColorList = timelineChart.getSeriesColorList();
seriesSize = seriesList.size();
rowData = new RowData(10, 10);
- makeTooltip(seriesSize, seriesColorList, rowData, seriesList, selectedTime, indexInfoFont, timelineChart);
+ makeTooltip(seriesSize, seriesColorList, rowData, seriesList,
+ selectedTime, indexInfoFont, timelineChart);
if (show) {
showTooltip(itemChartComp, correctedX, e.y);
}
}
-
- private void makeTooltip(int seriesSize, List<java.awt.Color> seriesColorList, RowData rowData, List<XYSeries> seriesList, long selectedTime,
- Font indexInfoFont, TimelineChart timelineChart) {
+
+ private void makeTooltip(int seriesSize,
+ List<java.awt.Color> seriesColorList, RowData rowData,
+ List<XYSeries> seriesList, long selectedTime, Font indexInfoFont,
+ TimelineChart timelineChart) {
for (int i = 0; i < seriesSize; i++) {
if (i == 0) {
indexInfoLabelList.clear();
IndexInfoComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
Canvas indexCanvas = new Canvas(IndexInfoComposite, SWT.BORDER);
- indexCanvas.setBackground(getColorFromAwtColor(seriesColorList.get(i)));
+ indexCanvas.setBackground(getColorFromAwtColor(seriesColorList
+ .get(i)));
indexCanvas.setLayoutData(rowData);
Label indexLabel = new Label(IndexInfoComposite, SWT.NONE);
private void showTooltip(ChartComposite chartComp, int x, int y) {
Point size = tooltip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point pt = chartComp.toDisplay(x, y);
- tooltip.setBounds(pt.x + TOOLTIP_MARGIN, pt.y - y + (chartComp.getBounds().height - size.y) / 2, size.x, size.y);
+ tooltip.setBounds(pt.x + TOOLTIP_MARGIN,
+ pt.y - y + (chartComp.getBounds().height - size.y) / 2, size.x,
+ size.y);
tooltip.setVisible(true);
}
}
private Color getColorFromAwtColor(java.awt.Color color) {
- return new Color(Display.getDefault(), color.getRed(), color.getGreen(), color.getBlue());
+ return new Color(Display.getDefault(), color.getRed(),
+ color.getGreen(), color.getBlue());
}
public void addItems(Composite itemAreaComp) {
public void updateActiveItem(double runTimeMs) {
chartManager.updateChart();
- SnapshotData.getInstance().querySnapshotInfo(runTimeMs * TimelineConstants.TIME_US_TO_MS);
+ SnapshotData.getInstance().querySnapshotInfo(
+ runTimeMs * TimelineConstants.TIME_US_TO_MS);
}
public void clear() {
dispose();
for (int i = 0; i < selectedItemList.size(); i++) {
- ItemInfo info = createItemInfo(itemsAreaComp, TimelineUtils.getChartType(selectedItemList.get(i)));
+ ItemInfo info = createItemInfo(itemsAreaComp,
+ TimelineUtils.getChartType(selectedItemList.get(i)));
realTimeItemList.add(info);
}
}
private void initSelectionMarker() {
selectionMarker = new IntervalMarker(-1, -1);
- selectionMarker.setPaint(new java.awt.Color(ColorResources.SELECTION_RANGE.getRed(), ColorResources.SELECTION_RANGE.getGreen(),
+ selectionMarker.setPaint(new java.awt.Color(
+ ColorResources.SELECTION_RANGE.getRed(),
+ ColorResources.SELECTION_RANGE.getGreen(),
ColorResources.SELECTION_RANGE.getBlue(), 25));
selectionMarker.setOutlineStroke(null);
TimelineMaster.getInstance().setSelectionMarker(selectionMarker);
}
-
- private void initIntervalMarker(){
+
+ private void initIntervalMarker() {
intervalMarker = new DACustomChartPlotIntervalMarker(-1, -1);
intervalMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
intervalMarker.setAlpha((int) (255 * 0.25));
private void setSelectionMarkerEndVal(Double endTime) {
double selectionMarkerStartValue = selectionMarker.getStartValue();
double selectionMarkerEndValue = selectionMarker.getEndValue();
- if (endTime >= selectionMarkerStartValue && endTime <= selectionMarkerEndValue) {
+ if (endTime >= selectionMarkerStartValue
+ && endTime <= selectionMarkerEndValue) {
return;
}
- double minSelectionWidthTime = selectionMarkerEndValue - selectionMarkerStartValue;
- if (endTime < selectionMarkerStartValue && endTime > selectionMarkerStartValue - minSelectionWidthTime) {
+ double minSelectionWidthTime = selectionMarkerEndValue
+ - selectionMarkerStartValue;
+ if (endTime < selectionMarkerStartValue
+ && endTime > selectionMarkerStartValue - minSelectionWidthTime) {
selectionMarker.setStartValue(endTime);
return;
}
if (tempDownTime == tempUpTime) {
long time = (long) (tempDownTime * TimelineConstants.TIME_SEC_TO_MS * TimelineConstants.TIME_SEC_TO_MS);
if (time <= coolBarTime) {
- AnalyzerManager.getCurrentPage().updatePage(new DASelectionData(TimelineComposite.ID, time, time, null, null));
+ AnalyzerManager.getCurrentPage().updatePage(
+ new DASelectionData(TimelineComposite.ID, time, time,
+ null, null));
}
disposeTooltip();
createTooltip(e, correctedX);
} else {
- long startTime = (long) ((tempDownTime < tempUpTime ? tempDownTime : tempUpTime) * TimelineConstants.TIME_SEC_TO_MS * TimelineConstants.TIME_SEC_TO_MS);
- long endTime = (long) ((tempDownTime < tempUpTime ? tempUpTime : tempDownTime) * TimelineConstants.TIME_SEC_TO_MS * TimelineConstants.TIME_SEC_TO_MS);
+ long startTime = (long) ((tempDownTime < tempUpTime ? tempDownTime
+ : tempUpTime) * TimelineConstants.TIME_SEC_TO_MS * TimelineConstants.TIME_SEC_TO_MS);
+ long endTime = (long) ((tempDownTime < tempUpTime ? tempUpTime
+ : tempDownTime) * TimelineConstants.TIME_SEC_TO_MS * TimelineConstants.TIME_SEC_TO_MS);
if (startTime < coolBarTime) {
if (endTime > coolBarTime) {
endTime = coolBarTime;
if (startTime < 0) {
startTime = 0;
}
- AnalyzerManager.getCurrentPage().updatePage(new DASelectionData(TimelineComposite.ID, startTime, endTime, null, null));
+ AnalyzerManager.getCurrentPage().updatePage(
+ new DASelectionData(TimelineComposite.ID, startTime,
+ endTime, null, null));
}
}
}
private Composite createItemArea(Composite itemAreaComp) {
- realTimeItemList.add(createItemInfo(itemAreaComp, TimelineConstants.CHART_TYPE_CPU));
- realTimeItemList.add(createItemInfo(itemAreaComp, TimelineConstants.CHART_TYPE_CPU_CORE));
- realTimeItemList.add(createItemInfo(itemAreaComp, TimelineConstants.CHART_TYPE_CPU_FREQUENCY));
- realTimeItemList.add(createItemInfo(itemAreaComp, TimelineConstants.CHART_TYPE_HEAP));
- realTimeItemList.add(createItemInfo(itemAreaComp, TimelineConstants.CHART_TYPE_PROCESS_MEMORY));
- realTimeItemList.add(createItemInfo(itemAreaComp, TimelineConstants.CHART_TYPE_SYSTEM_MEMORY));
- realTimeItemList.add(createItemInfo(itemAreaComp, TimelineConstants.CHART_TYPE_FILE));
+ realTimeItemList.add(createItemInfo(itemAreaComp,
+ TimelineConstants.CHART_TYPE_CPU));
+ realTimeItemList.add(createItemInfo(itemAreaComp,
+ TimelineConstants.CHART_TYPE_CPU_CORE));
+ realTimeItemList.add(createItemInfo(itemAreaComp,
+ TimelineConstants.CHART_TYPE_CPU_FREQUENCY));
+ realTimeItemList.add(createItemInfo(itemAreaComp,
+ TimelineConstants.CHART_TYPE_HEAP));
+ realTimeItemList.add(createItemInfo(itemAreaComp,
+ TimelineConstants.CHART_TYPE_PROCESS_MEMORY));
+ realTimeItemList.add(createItemInfo(itemAreaComp,
+ TimelineConstants.CHART_TYPE_SYSTEM_MEMORY));
+ realTimeItemList.add(createItemInfo(itemAreaComp,
+ TimelineConstants.CHART_TYPE_FILE));
TimelineMaster.getInstance().redrawTimeTickCanvas();
private ItemInfo createItemInfo(Composite parent, int chartType) {
ItemInfo info;
- if (chartType == TimelineConstants.CHART_TYPE_CPU && bCustomChart == true) {
+ if (chartType == TimelineConstants.CHART_TYPE_CPU
+ && bCustomChart == true) {
info = createDAItem(parent, chartType);
} else {
info = createItem(parent, chartType);
FormLayout fLayout = new FormLayout();
infoComp.setLayout(fLayout);
- if (chartType != TimelineConstants.CHART_TYPE_SNAPSHOT && chartType != TimelineConstants.CHART_TYPE_DEVICE) {
+ if (chartType != TimelineConstants.CHART_TYPE_SNAPSHOT
+ && chartType != TimelineConstants.CHART_TYPE_DEVICE) {
addZoomLabel(infoComp, chartType);
}
addIconInfoLabel(infoComp, chartType);
infoComp.infoZoomLabel.setText(info);
infoComp.infoZoomLabel.setImage(ImageResources.TIMLINE_FULL);
infoComp.infoZoomLabel.setAlignment(SWT.RIGHT);
- FormData fData2 = new FormData(ITEM_INFO_ZOOM_HEIGHT, ITEM_INFO_ZOOM_HEIGHT);
+ FormData fData2 = new FormData(ITEM_INFO_ZOOM_HEIGHT,
+ ITEM_INFO_ZOOM_HEIGHT);
fData2.top = new FormAttachment(1, 0);
fData2.left = new FormAttachment(82, 0);
infoComp.infoIconLabel = new Label(infoComp, SWT.NONE);
infoComp.infoIconLabel.setImage(TimelineUtils.getIconImage(chartType));
infoComp.infoIconLabel.setAlignment(SWT.CENTER);
- FormData fData = new FormData(TimelineConstants.TIMELINE_ITEM_INFO_WIDTH, ITEM_INFO_ICON_HEIGHT);
+ FormData fData = new FormData(
+ TimelineConstants.TIMELINE_ITEM_INFO_WIDTH,
+ ITEM_INFO_ICON_HEIGHT);
fData.top = new FormAttachment(8, 0);
infoComp.infoIconLabel.setLayoutData(fData);
infoComp.infoIconLabel.addMouseListener(itemLableMouseListener);
}
- private boolean addTextInfoLabel(ItemInfoComposite infoComp, int chartType, boolean isAlone) {
+ private boolean addTextInfoLabel(ItemInfoComposite infoComp, int chartType,
+ boolean isAlone) {
String info = TimelineUtils.getChartName(chartType);
if (null == infoComp || infoComp.isDisposed()) {
infoComp.infoTextLabel.setForeground(ColorResources.WHITE);
infoComp.infoTextLabel.setText(info);
infoComp.infoTextLabel.setAlignment(SWT.CENTER);
- FormData fData2 = new FormData(TimelineConstants.TIMELINE_ITEM_INFO_WIDTH, ITEM_INFO_LABEL_HEIGHT);
+ FormData fData2 = new FormData(
+ TimelineConstants.TIMELINE_ITEM_INFO_WIDTH,
+ ITEM_INFO_LABEL_HEIGHT);
if (isAlone) {
fData2.top = new FormAttachment(0, 8);
} else {
iteminfo.itemComp.setBackground(ColorResources.GRAY_170);
/* Item info composite */
- final ItemInfoComposite itemInfoComp = createItemInfoComp(iteminfo.itemComp, chartType);
+ final ItemInfoComposite itemInfoComp = createItemInfoComp(
+ iteminfo.itemComp, chartType);
if (chartType == TimelineConstants.CHART_TYPE_SNAPSHOT) {
TempConstants.isSnapshotChartDisposed = false;
}
GridData gDataInfo = new GridData();
- if (chartType == TimelineConstants.CHART_TYPE_SNAPSHOT || chartType == TimelineConstants.CHART_TYPE_DEVICE) {
+ if (chartType == TimelineConstants.CHART_TYPE_SNAPSHOT
+ || chartType == TimelineConstants.CHART_TYPE_DEVICE) {
gDataInfo.heightHint = TimelineConstants.ITEM_HEIGHT_DEF;
gDataInfo.verticalAlignment = GridData.BEGINNING;
} else {
/* Item Chart composite */
JFreeChart chart = chartManager.createTimelineChart(chartType);
- final ChartComposite itemChartComposite = new ChartComposite(iteminfo.itemComp, SWT.NONE, chart, true) {
- protected Menu createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom) {
+ final ChartComposite itemChartComposite = new ChartComposite(
+ iteminfo.itemComp, SWT.NONE, chart, true) {
+ protected Menu createPopupMenu(boolean properties, boolean save,
+ boolean print, boolean zoom) {
return null;
}
};
itemChartComposite.setData(chartType);
GridData gDataChart;
- if (chartType == TimelineConstants.CHART_TYPE_SNAPSHOT || chartType == TimelineConstants.CHART_TYPE_DEVICE) {
+ if (chartType == TimelineConstants.CHART_TYPE_SNAPSHOT
+ || chartType == TimelineConstants.CHART_TYPE_DEVICE) {
gDataChart = new GridData(GridData.FILL_HORIZONTAL);
gDataChart.heightHint = TempConstants.JFREE_MIN_SIZE;
} else {
if (selectionMarker == null) {
initSelectionMarker();
}
- itemChartComposite.getChart().getXYPlot().addDomainMarker(selectionMarker, Layer.FOREGROUND);
+ itemChartComposite.getChart().getXYPlot()
+ .addDomainMarker(selectionMarker, Layer.FOREGROUND);
iteminfo.infoComp = itemInfoComp;
iteminfo.chartComp = itemChartComposite;
iteminfo.itemComp.setBackground(ColorResources.GRAY_170);
/* Item info composite */
- final ItemInfoComposite itemInfoComp = createItemInfoComp(iteminfo.itemComp, chartType);
+ final ItemInfoComposite itemInfoComp = createItemInfoComp(
+ iteminfo.itemComp, chartType);
GridData gDataInfo = new GridData();
itemInfoComp.addListener(SWT.Resize, resizeListenerBG);
- Composite itemChartComposite = new Composite(iteminfo.itemComp, SWT.NONE);
+ Composite itemChartComposite = new Composite(iteminfo.itemComp,
+ SWT.NONE);
FillLayout layout = new FillLayout();
layout.marginHeight = 1;
layout.marginWidth = 1;
itemChartComposite.setLayout(layout);
itemChartComposite.setBackground(ColorResources.WINDOW_BG_COLOR);
- DACustomChart chart = chartManager.createDATimelineChart(itemChartComposite, chartType);
+ DACustomChart chart = chartManager.createDATimelineChart(
+ itemChartComposite, chartType);
itemChartComposite.setData(chartType);
chart.addListener(SWT.MouseMove, chartMouseListener);
chart.addListener(SWT.MouseDown, chartMouseListener);
chart.addListener(SWT.MouseUp, chartMouseListener);
+ chart.addListener(SWT.MouseEnter, chartMouseListener);
+ chart.addListener(SWT.MouseExit, chartMouseListener);
// itemChartComposite.addMouseMoveListener(itemMouseMouveListener);
// itemChartComposite.getChart().getXYPlot().addDomainMarker(selectionMarker,
// Layer.FOREGROUND);
-
- if(null == intervalMarker){
+
+ if (null == intervalMarker) {
initIntervalMarker();
}
-
+
chart.getPlot().setIntervalMarker(intervalMarker);
iteminfo.infoComp = itemInfoComp;
}
for (int i = 0; i < ItemList.size(); i++) {
- if (null != ItemList.get(i).chartComp && !ItemList.get(i).chartComp.isDisposed()) {
- ItemList.get(i).chartComp.removeMouseListener(itemMouseListener);
- ItemList.get(i).chartComp.getChart().getXYPlot().removeDomainMarker(selectionMarker);
+ if (null != ItemList.get(i).chartComp
+ && !ItemList.get(i).chartComp.isDisposed()) {
+ ItemList.get(i).chartComp
+ .removeMouseListener(itemMouseListener);
+ ItemList.get(i).chartComp.getChart().getXYPlot()
+ .removeDomainMarker(selectionMarker);
}
}
ItemList.clear();
int width = itemsAreaComp.getBounds().width;
for (int i = 0; i < realTimeItemList.size(); i++) {
- TimelineItemSetting itemSetting = TimelineItemSettingProvider.getItemSetting(realTimeItemList.get(i).itemType);
- setItemSize(realTimeItemList.get(i), width, itemSetting.getSizeMode());
+ TimelineItemSetting itemSetting = TimelineItemSettingProvider
+ .getItemSetting(realTimeItemList.get(i).itemType);
+ setItemSize(realTimeItemList.get(i), width,
+ itemSetting.getSizeMode());
}
itemsAreaComp.layout();
private void setItemInfoGradientBG(Composite composite) {
Rectangle rect = composite.getClientArea();
- itemImage = new Image(composite.getDisplay(), 1, Math.max(1, rect.height));
+ itemImage = new Image(composite.getDisplay(), 1, Math.max(1,
+ rect.height));
GC gc = new GC(itemImage);
gc.setForeground(ColorResources.GRAY_210); // brighter
gc.setBackground(ColorResources.GRAY_130); // darker
Rectangle rect = composite.getClientArea();
if (null == selectedItemImage) {
- selectedItemImage = new Image(composite.getDisplay(), 1, Math.max(1, rect.height));
+ selectedItemImage = new Image(composite.getDisplay(), 1, Math.max(
+ 1, rect.height));
GC gc = new GC(selectedItemImage);
gc.setForeground(ColorResources.ITEM_BLUE_BRIGHT); // brighter
gc.setBackground(ColorResources.ITEM_BLUE_DARK); // darker
} else if (selectedItemImage.getBounds().height != rect.height) {
selectedItemImage.dispose();
- selectedItemImage = new Image(composite.getDisplay(), 1, Math.max(1, rect.height));
+ selectedItemImage = new Image(composite.getDisplay(), 1, Math.max(
+ 1, rect.height));
GC gc = new GC(selectedItemImage);
gc.setForeground(ColorResources.ITEM_BLUE_BRIGHT); // brighter
gc.setBackground(ColorResources.ITEM_BLUE_DARK); // darker
}
if (isSelected) {
- chartComp.getChart().setBackgroundPaint(ColorResources.ITEM_BLUE_AWT);
+ chartComp.getChart().setBackgroundPaint(
+ ColorResources.ITEM_BLUE_AWT);
} else {
chartComp.getChart().setBackgroundPaint(ColorResources.ITEM_BG_AWT);
}
ScrolledComposite sc = (ScrolledComposite) itemsAreaComp.getParent();
if (itemsAreaComp.getBounds().height - sc.getClientArea().height < focusY) {
- focusY = itemsAreaComp.getBounds().height - sc.getClientArea().height;
+ focusY = itemsAreaComp.getBounds().height
+ - sc.getClientArea().height;
}
itemsAreaComp.setLocation(0, -focusY);
sc.getVerticalBar().setSelection(focusY);
}
- private void setItemInfoIconVisible(ItemInfoComposite infoComp, boolean isIconVisible) {
+ private void setItemInfoIconVisible(ItemInfoComposite infoComp,
+ boolean isIconVisible) {
if (null == infoComp) {
return;
}
if (isIconVisible) {
- if (null == infoComp.getIconLabel() || infoComp.getIconLabel().isDisposed()) {
- addIconInfoLabel(infoComp, TimelineUtils.getChartType(infoComp.itemName));
+ if (null == infoComp.getIconLabel()
+ || infoComp.getIconLabel().isDisposed()) {
+ addIconInfoLabel(infoComp,
+ TimelineUtils.getChartType(infoComp.itemName));
if (null != infoComp.infoTextLabel) {
infoComp.infoTextLabel.dispose();
}
- addTextInfoLabel(infoComp, TimelineUtils.getChartType(infoComp.itemName), false);
+ addTextInfoLabel(infoComp,
+ TimelineUtils.getChartType(infoComp.itemName), false);
}
} else {
if (null != infoComp.infoIconLabel) {
infoComp.infoIconLabel.dispose();
infoComp.infoTextLabel.dispose();
- boolean isSucced = addTextInfoLabel(infoComp, TimelineUtils.getChartType(infoComp.itemName), true);
+ boolean isSucced = addTextInfoLabel(infoComp,
+ TimelineUtils.getChartType(infoComp.itemName), true);
if (isSucced) {
infoComp.layout();
}