adapt ui to database API
This commit is contained in:
parent
6530362b89
commit
16de83616a
|
@ -10,9 +10,11 @@
|
|||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
@ -21,8 +23,14 @@ import org.eclipse.swt.graphics.Point;
|
|||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.minres.scviewer.database.EventKind;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.tx.ITxGenerator;
|
||||
import com.minres.scviewer.database.tx.ITxRelation;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
|
||||
|
@ -78,6 +86,12 @@ public class ArrowPainter implements IPainter {
|
|||
}
|
||||
}
|
||||
|
||||
private int getConcurrencyIndex(ITx tx) {
|
||||
IEvent[] eventList = tx.getStream().getEvents().floorEntry(tx.getBeginTime()).getValue();
|
||||
Optional<Integer> res = Arrays.stream(eventList).map(e -> ((ITxEvent)e).getRowIndex()).findFirst();
|
||||
return res.isPresent()? res.get():0;
|
||||
}
|
||||
|
||||
protected void calculateGeometries() {
|
||||
deferUpdate = false;
|
||||
iRect.clear();
|
||||
|
@ -88,9 +102,9 @@ public class ArrowPainter implements IPainter {
|
|||
deferUpdate = true;
|
||||
return;
|
||||
}
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getWidth();
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getRowCount();
|
||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * getConcurrencyIndex(tx),
|
||||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||
deriveGeom(tx.getIncomingRelations(), iRect, false);
|
||||
deriveGeom(tx.getOutgoingRelations(), oRect, true);
|
||||
|
@ -99,19 +113,46 @@ public class ArrowPainter implements IPainter {
|
|||
protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) {
|
||||
for (ITxRelation iTxRelation : relations) {
|
||||
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
|
||||
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * otherTx.getConcurrencyIndex(),
|
||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||
height);
|
||||
Rectangle bb = createLinkEntry(otherTx, otherTx.getStream());
|
||||
if(bb!=null){
|
||||
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
||||
return;
|
||||
} else {
|
||||
for(IHierNode gen:otherTx.getStream().getChildNodes()) {
|
||||
if(gen instanceof ITxGenerator) {
|
||||
bb = createLinkEntry(otherTx, (IWaveform) gen);
|
||||
if(bb!=null){
|
||||
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Rectangle createLinkEntry(ITx otherTx, IWaveform iWaveform) {
|
||||
if (waveCanvas.wave2painterMap.containsKey(iWaveform)) {
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||
if(painter==null) {
|
||||
for(IHierNode gen:otherTx.getStream().getChildNodes()) {
|
||||
if(gen instanceof ITxGenerator) {
|
||||
painter = waveCanvas.wave2painterMap.get(gen);
|
||||
if(painter!=null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
||||
return new Rectangle(
|
||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
|
||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||
height);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintArea(Projection proj, Rectangle clientRect) {
|
||||
yCtrlOffset = waveCanvas.styleProvider.getTrackHeight()/2;
|
||||
|
|
|
@ -10,10 +10,9 @@
|
|||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeSet;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
@ -37,19 +36,18 @@ public class StreamPainter extends TrackPainter{
|
|||
private IWaveform stream;
|
||||
private int txBase;
|
||||
private int txHeight;
|
||||
private TreeSet<ITx> seenTx;
|
||||
private TreeMap<ITx, ITxEvent> seenTx;
|
||||
|
||||
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
||||
super(trackEntry, even);
|
||||
this.waveCanvas = waveCanvas;
|
||||
this.stream=trackEntry.waveform;
|
||||
this.seenTx=new TreeSet<>();
|
||||
this.seenTx=new TreeMap<>();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if(stream.getEvents().size()==0) return;
|
||||
int trackHeight=trackEntry.height/stream.getWidth();
|
||||
int trackHeight=trackEntry.height/stream.getRowCount();
|
||||
txBase=trackHeight/5;
|
||||
txHeight=trackHeight*3/5;
|
||||
if(trackEntry.selected) {
|
||||
|
@ -65,8 +63,8 @@ public class StreamPainter extends TrackPainter{
|
|||
long beginTime = beginPos*scaleFactor;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
Entry<Long, IEvent[]> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, IEvent[]> lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
if(firstTx==null) firstTx = stream.getEvents().firstEntry();
|
||||
if(lastTx==null) lastTx=stream.getEvents().lastEntry();
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
|
@ -77,46 +75,51 @@ public class StreamPainter extends TrackPainter{
|
|||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
if(firstTx==lastTx) {
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)firstTx.getValue())
|
||||
drawTx(proj, area, txEvent.getTransaction(), false);
|
||||
for(IEvent txEvent: firstTx.getValue())
|
||||
drawTx(proj, area, ((ITxEvent)txEvent).getTransaction(), ((ITxEvent)txEvent).getRowIndex(), false);
|
||||
}else{
|
||||
seenTx.clear();
|
||||
NavigableMap<Long, IEvent[]> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||
boolean highlighed=false;
|
||||
ITxEvent highlighed=null;
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
|
||||
long selectedId=waveCanvas.currentSelection!=null? waveCanvas.currentSelection.getId():-1;
|
||||
for(Entry<Long, IEvent[]> entry: entries.entrySet())
|
||||
for(IEvent evt:entry.getValue()){
|
||||
ITx tx = ((ITxEvent) evt).getTransaction();
|
||||
highlighed|=selectedId==tx.getId();
|
||||
for(IEvent e:entry.getValue()){
|
||||
ITxEvent evt = (ITxEvent) e;
|
||||
ITx tx = evt.getTransaction();
|
||||
if(selectedId==tx.getId())
|
||||
highlighed=evt;
|
||||
switch(evt.getKind()) {
|
||||
case BEGIN:
|
||||
seenTx.add(tx);
|
||||
seenTx.put(tx, evt);
|
||||
break;
|
||||
case END:
|
||||
drawTx(proj, area, tx, evt.getRowIndex(), false);
|
||||
seenTx.remove(tx);
|
||||
break;
|
||||
case SINGLE:
|
||||
drawTx(proj, area, tx, false);
|
||||
drawTx(proj, area, tx, evt.getRowIndex(), false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(ITx tx:seenTx){
|
||||
drawTx(proj, area, tx, false);
|
||||
}
|
||||
if(highlighed){
|
||||
seenTx.entrySet().stream().forEach(e -> {
|
||||
drawTx(proj, area, e.getKey(), e.getValue().getRowIndex(), false);
|
||||
});
|
||||
|
||||
if(highlighed!=null){
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE_HIGHLITE));
|
||||
drawTx(proj, area, waveCanvas.currentSelection, true);
|
||||
drawTx(proj, area, highlighed.getTransaction(), highlighed.getRowIndex(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, boolean highlighted ) {
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, int concurrencyIndex, boolean highlighted ) {
|
||||
// compute colors
|
||||
Color[] transColor = waveCanvas.styleProvider.computeColor( tx.getGenerator().getName());
|
||||
|
||||
proj.setBackground(transColor[highlighted?1:0]);
|
||||
|
||||
int offset = tx.getConcurrencyIndex()*this.waveCanvas.styleProvider.getTrackHeight();
|
||||
int offset = concurrencyIndex*this.waveCanvas.styleProvider.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
|
||||
(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
|
||||
|
@ -164,25 +167,19 @@ public class StreamPainter extends TrackPainter{
|
|||
|
||||
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, IEvent[]> firstTx) {
|
||||
long timePoint=offset*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if((evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)&&
|
||||
tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
// now with some fuzziness
|
||||
timePoint=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointLow=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if((evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE) &&
|
||||
tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
for(IEvent e:firstTx.getValue()){
|
||||
if(e instanceof ITxEvent) {
|
||||
ITxEvent evt = (ITxEvent) e;
|
||||
ITx tx=evt.getTransaction();
|
||||
if(
|
||||
(evt.getKind()==EventKind.SINGLE && evt.getTime()==timePoint) ||
|
||||
(evt.getKind()==EventKind.SINGLE && evt.getTime()>timePointLow && evt.getTime()<timePointHigh) ||
|
||||
(evt.getKind()==EventKind.BEGIN && evt.getRowIndex()==lane && evt.getTime()<=timePoint && tx.getEndTime()>=timePoint)
|
||||
){
|
||||
return tx;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -11,10 +11,12 @@
|
|||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
|
@ -32,9 +34,11 @@ import org.eclipse.swt.widgets.Event;
|
|||
import org.eclipse.swt.widgets.ScrollBar;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
|
@ -424,13 +428,17 @@ public class WaveformCanvas extends Canvas {
|
|||
}
|
||||
for (IWaveformPainter painter : wave2painterMap.values()) {
|
||||
if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
|
||||
int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * tx.getConcurrencyIndex();
|
||||
int bottom = top + styleProvider.getTrackHeight();
|
||||
if (top < -origin.y) {
|
||||
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
|
||||
} else if (bottom > (size.y - origin.y)) {
|
||||
setOrigin(origin.x, size.y - bottom);
|
||||
}
|
||||
Entry<Long, IEvent[]> entry = tx.getStream().getEvents().floorEntry(tx.getBeginTime());
|
||||
Optional<IEvent> res = Arrays.stream(entry.getValue()).filter(e -> ((ITxEvent)e).getTransaction().equals(tx)).findFirst();
|
||||
if(res.isPresent()) {
|
||||
int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * ((ITxEvent)res.get()).getRowIndex();
|
||||
int bottom = top + styleProvider.getTrackHeight();
|
||||
if (top < -origin.y) {
|
||||
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
|
||||
} else if (bottom > (size.y - origin.y)) {
|
||||
setOrigin(origin.x, size.y - bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -514,7 +514,7 @@ public class WaveformView implements IWaveformView {
|
|||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getWidth();
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue = "---";
|
||||
|
@ -579,17 +579,18 @@ public class WaveformView implements IWaveformView {
|
|||
entry.currentValue = Double.toString(val);
|
||||
}
|
||||
} else if (entry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
ITx[] resultsList = new ITx[entry.waveform.getWidth()];
|
||||
ITx[] resultsList = new ITx[entry.waveform.getRowCount()];
|
||||
Entry<Long, IEvent[]> firstTx = entry.waveform.getEvents().floorEntry(time);
|
||||
if (firstTx != null) {
|
||||
do {
|
||||
for (IEvent evt : firstTx.getValue()) {
|
||||
if (evt instanceof ITxEvent) {
|
||||
ITx tx = ((ITxEvent) evt).getTransaction();
|
||||
for (IEvent e : firstTx.getValue()) {
|
||||
if (e instanceof ITxEvent) {
|
||||
ITxEvent evt = ((ITxEvent) e);
|
||||
ITx tx = evt.getTransaction();
|
||||
if ((evt.getKind() == EventKind.BEGIN || evt.getKind() == EventKind.SINGLE)
|
||||
&& tx.getBeginTime() <= time && tx.getEndTime() >= time
|
||||
&& resultsList[tx.getConcurrencyIndex()] == null)
|
||||
resultsList[tx.getConcurrencyIndex()] = ((ITxEvent) evt).getTransaction();
|
||||
&& resultsList[evt.getRowIndex()] == null)
|
||||
resultsList[evt.getRowIndex()] = evt.getTransaction();
|
||||
}
|
||||
}
|
||||
firstTx = entry.waveform.getEvents().lowerEntry(firstTx.getKey());
|
||||
|
@ -1036,7 +1037,7 @@ public class WaveformView implements IWaveformView {
|
|||
TrackEntry trackEntry = trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||
|
@ -1044,7 +1045,7 @@ public class WaveformView implements IWaveformView {
|
|||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = styleProvider.getTrackHeight();
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
||||
}
|
||||
}
|
||||
|
@ -1065,7 +1066,7 @@ public class WaveformView implements IWaveformView {
|
|||
TrackEntry trackEntry = trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||
|
@ -1073,7 +1074,7 @@ public class WaveformView implements IWaveformView {
|
|||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = styleProvider.getTrackHeight();
|
||||
if (w.getType() == WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
subArea.height *= w.getRowCount();
|
||||
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue,
|
||||
entry.getValue().selected);
|
||||
}
|
||||
|
|
|
@ -482,6 +482,7 @@ public class HeapStatus extends Composite {
|
|||
});
|
||||
}
|
||||
};
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ public class DesignBrowser {
|
|||
updateButtons();
|
||||
}
|
||||
});
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider(true));
|
||||
treeViewer.addFilter(treeAttributeFilter);
|
||||
treeViewer.setUseHashlookup(true);
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
|
@ -252,7 +252,7 @@ public class DesignBrowser {
|
|||
updateButtons();
|
||||
}
|
||||
});
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider(false));
|
||||
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
txTableViewer.addFilter(tableAttributeFilter);
|
||||
txTableViewer.addDoubleClickListener(event -> {
|
||||
|
|
|
@ -37,7 +37,6 @@ import com.minres.scviewer.database.IEvent;
|
|||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxAttribute;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
||||
|
@ -78,6 +77,8 @@ public class TransactionList extends Composite {
|
|||
|
||||
private TableViewer tableViewer = null;
|
||||
|
||||
Thread updateThread = null;
|
||||
|
||||
private TableColumn valueColumn = null;
|
||||
|
||||
private AttributeLabelProvider valueLabelProvider = null;
|
||||
|
@ -86,8 +87,6 @@ public class TransactionList extends Composite {
|
|||
|
||||
private ObservableList<AttributeNameBean> attrNames = new WritableList<>();
|
||||
|
||||
private List<ITx> eventList = new ArrayList<>();
|
||||
|
||||
private List<ITx> emptyList = new ArrayList<>();
|
||||
|
||||
TxFilter txFilter;
|
||||
|
@ -244,56 +243,48 @@ public class TransactionList extends Composite {
|
|||
} else if(stream != trackEntry.waveform) {
|
||||
stream=trackEntry.waveform;
|
||||
tableViewer.setInput(emptyList);
|
||||
new Thread() {
|
||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<>();
|
||||
|
||||
private List<AttributeNameBean> getEntries() {
|
||||
return propNames.entrySet().stream()
|
||||
.sorted((e1,e2)->e1.getKey().compareTo(e2.getKey()))
|
||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Collection<IEvent[]> values = stream.getEvents().values();
|
||||
eventList = values.parallelStream().map(Arrays::asList)
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)
|
||||
.map(evt-> {
|
||||
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||
for(ITxAttribute attr: tx.getAttributes()) {
|
||||
propNames.put(attr.getName(), attr.getDataType());
|
||||
}
|
||||
return tx;
|
||||
})
|
||||
.sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime()))
|
||||
.collect(Collectors.toList());
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tableViewer.setInput(eventList);
|
||||
attrNames.clear();
|
||||
attrNames.addAll(getEntries());
|
||||
if(!attrNames.isEmpty())
|
||||
txFilter.setSearchProp(attrNames.get(0).getName(), attrNames.get(0).getType());
|
||||
if (searchPropComboViewer!=null) {
|
||||
searchPropComboViewer.setInput(attrNames);
|
||||
Object sel = searchPropComboViewer.getElementAt(0);
|
||||
if(sel!=null) searchPropComboViewer.setSelection(new StructuredSelection(sel));
|
||||
}
|
||||
tableViewer.refresh(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
try{
|
||||
if(updateThread!=null)
|
||||
updateThread.interrupt();
|
||||
}catch(SecurityException e){}
|
||||
updateThread = new Thread(()-> {
|
||||
final ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<>();
|
||||
Collection<IEvent[]> values = stream.getEvents().values();
|
||||
final List<ITx> txList = values.parallelStream().map(Arrays::asList)
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)
|
||||
.map(evt-> {
|
||||
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||
tx.getAttributes().forEach(attr -> propNames.put(attr.getName(), attr.getDataType()));
|
||||
return tx;
|
||||
})
|
||||
.sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime()))
|
||||
.collect(Collectors.toList());
|
||||
final List<AttributeNameBean> newAttrNames=propNames.entrySet().stream()
|
||||
.sorted((e1,e2)->e1.getKey().compareTo(e2.getKey()))
|
||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
getDisplay().asyncExec(() -> {
|
||||
tableViewer.setInput(txList);
|
||||
attrNames.clear();
|
||||
attrNames.addAll(newAttrNames);
|
||||
if(!attrNames.isEmpty())
|
||||
txFilter.setSearchProp(attrNames.get(0).getName(), attrNames.get(0).getType());
|
||||
if (searchPropComboViewer!=null)
|
||||
searchPropComboViewer.refresh();
|
||||
if (viewPropComboViewer!=null)
|
||||
viewPropComboViewer.refresh();
|
||||
});
|
||||
updateThread=null;
|
||||
});
|
||||
updateThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSearchProps(String propName, DataType type, String propValue) {
|
||||
for(int i=0; i<attrNames.size(); ++i) {
|
||||
AttributeNameBean e = attrNames.get(i);
|
||||
if(propName.equals(e.getName()) && type.equals(e.getType())) {
|
||||
for(int i=0; i<searchPropComboViewer.getCombo().getItemCount(); ++i) {
|
||||
String itemName = searchPropComboViewer.getCombo().getItem(i);
|
||||
if(propName.equals(itemName)) {
|
||||
searchPropComboViewer.getCombo().select(i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -166,6 +166,8 @@ public class TxDbLabelProvider implements ILabelProvider {
|
|||
public String getText(Object element) {
|
||||
if(element instanceof IWaveformDb){
|
||||
IWaveformDb db = (IWaveformDb) element;
|
||||
if(db.getName()== null)
|
||||
return "";
|
||||
return db.getName()+(db.isLoaded()?"":" (loading)");
|
||||
} else
|
||||
return ((IHierNode)element).getName();
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
|||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
if(((IWaveform) element).getRowCount()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<!-- Bintray package name -->
|
||||
<bintrayPackage>SCViewer</bintrayPackage>
|
||||
<!-- Bintray package version number -->
|
||||
<bintrayVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</bintrayVersion>
|
||||
<bintrayVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</bintrayVersion>
|
||||
<!-- remove any preexisting files -->
|
||||
<performDestroy>true</performDestroy>
|
||||
<!-- information used when creating the package -->
|
||||
|
|
Loading…
Reference in New Issue