package org.tizen.dynamicanalyzer.ui.views;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.ColorResources;
+import org.tizen.dynamicanalyzer.constants.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.DASelectionData;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.model.LogPackage;
+import org.tizen.dynamicanalyzer.model.Logs;
import org.tizen.dynamicanalyzer.nl.InformationViewLables;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.ui.widgets.DATable.DATableComposite;
public class RangeView extends DAView {
private DATableComposite tableComp = null;
- private String[] columnNames = { InformationViewLables.RANGE_VIEW_NAME, InformationViewLables.RANGE_VIEW_START, InformationViewLables.RANGE_VIEW_END, InformationViewLables.RANGE_VIEW_AVERAGE, InformationViewLables.RANGE_VIEW_MINIMUM,
+ private String[] columnNames = { InformationViewLables.RANGE_VIEW_NAME,
+ InformationViewLables.RANGE_VIEW_START,
+ InformationViewLables.RANGE_VIEW_END,
+ InformationViewLables.RANGE_VIEW_AVERAGE,
+ InformationViewLables.RANGE_VIEW_MINIMUM,
InformationViewLables.RANGE_VIEW_MAXIMUM };
private int[] columnSizes = { 80, 60, 60, 60, 60, 60 };
private boolean[] columnVisibility = { true, true, true, true, true, true };
public static final String ID = RangeView.class.getName();
+ public static final int STATE_INIT = 0;
+ public static final int STATE_RANGE = 1;
+ public static final int STATE_NO_RANGE = 2;
+ private int state = STATE_INIT;
+ private long lastTime = 0;
public RangeView(Composite parent, int style) {
super(parent, style);
@Override
public void updateLog(LogPackage logPack) {
// TODO Auto-generated method stub
+ Logs logs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
+ if (null == logs || logs.getLogs().size() == 0) {
+ return;
+ }
+ List<List<String>> inputs = logs.getLogs();
+ int lastIndex = inputs.size() - 1;
+ List<String> input = inputs.get(lastIndex);
+ lastTime = Long
+ .valueOf(input.get(LogCenterConstants.DEVICE_TIME_INDEX));
+ if (state != STATE_RANGE)
+ ((StatsTable) tableComp).setTimeStartEnd(0, lastTime);
}
tableComp.updateTable();
}
+ private void setState(int state) {
+ this.state = state;
+ }
+
public void setTimeStartEnd(long start, long end) {
- ((StatsTable) tableComp).setTimeStartEnd(start, end);
+ if (end - start >= 1000000) {
+ setState(STATE_RANGE);
+ ((StatsTable) tableComp).setTimeStartEnd(start, end);
+ } else {
+ setState(STATE_NO_RANGE);
+ ((StatsTable) tableComp).setTimeStartEnd(0, lastTime);
+ }
}
}