fixes some drawing and state restore issues
This commit is contained in:
parent
c4fafae029
commit
f6a3da013e
|
@ -84,7 +84,10 @@ public class ArrowPainter implements IPainter {
|
||||||
private int getConcurrencyIndex(ITx tx) {
|
private int getConcurrencyIndex(ITx tx) {
|
||||||
IEvent[] eventList = tx.getStream().getEventsBeforeTime(tx.getBeginTime());
|
IEvent[] eventList = tx.getStream().getEventsBeforeTime(tx.getBeginTime());
|
||||||
Optional<Integer> res = Arrays.stream(eventList).map(e -> ((ITxEvent)e).getRowIndex()).findFirst();
|
Optional<Integer> res = Arrays.stream(eventList).map(e -> ((ITxEvent)e).getRowIndex()).findFirst();
|
||||||
return res.isPresent()? res.get():0;
|
if(res.isPresent() && res.get()>0) {
|
||||||
|
return res.get();
|
||||||
|
} else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean calculateGeometries() {
|
protected boolean calculateGeometries() {
|
||||||
|
@ -98,8 +101,10 @@ public class ArrowPainter implements IPainter {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int laneHeight = painter.getHeight() / tx.getStream().getRowCount();
|
int laneHeight = painter.getHeight() / tx.getStream().getRowCount();
|
||||||
|
int laneOffset = laneHeight * getConcurrencyIndex(tx);
|
||||||
|
int rulerHeight = waveCanvas.rulerHeight;
|
||||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * getConcurrencyIndex(tx),
|
rulerHeight + painter.getVerticalOffset() + laneOffset,
|
||||||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||||
deriveGeom(tx.getIncomingRelations(), iRect, false);
|
deriveGeom(tx.getIncomingRelations(), iRect, false);
|
||||||
deriveGeom(tx.getOutgoingRelations(), oRect, true);
|
deriveGeom(tx.getOutgoingRelations(), oRect, true);
|
||||||
|
@ -114,12 +119,13 @@ public class ArrowPainter implements IPainter {
|
||||||
if (waveCanvas.wave2painterMap.containsKey(iWaveform)) {
|
if (waveCanvas.wave2painterMap.containsKey(iWaveform)) {
|
||||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(iWaveform);
|
IWaveformPainter painter = waveCanvas.wave2painterMap.get(iWaveform);
|
||||||
if(painter!=null) {
|
if(painter!=null) {
|
||||||
int height = waveCanvas.styleProvider.getTrackHeight();
|
int laneHeight = waveCanvas.styleProvider.getTrackHeight();
|
||||||
|
int laneOffset = laneHeight * getConcurrencyIndex(tx);
|
||||||
Rectangle bb = new Rectangle(
|
Rectangle bb = new Rectangle(
|
||||||
(int) (otherTx.getBeginTime() / scaleFactor),
|
(int) (otherTx.getBeginTime() / scaleFactor),
|
||||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx),
|
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneOffset,
|
||||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
|
||||||
height);
|
laneHeight);
|
||||||
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,6 +267,7 @@ public class TransactionList extends Composite {
|
||||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
getDisplay().asyncExec(() -> {
|
getDisplay().asyncExec(() -> {
|
||||||
|
if(tableViewer.getControl().isDisposed()) return;
|
||||||
tableViewer.setInput(txList);
|
tableViewer.setInput(txList);
|
||||||
attrNames.clear();
|
attrNames.clear();
|
||||||
attrNames.addAll(newAttrNames);
|
attrNames.addAll(newAttrNames);
|
||||||
|
|
|
@ -828,7 +828,18 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
if(Boolean.parseBoolean(state.get(SHOWN_WAVEFORM + i + WAVEFORM_SELECTED)))
|
if(Boolean.parseBoolean(state.get(SHOWN_WAVEFORM + i + WAVEFORM_SELECTED)))
|
||||||
selectedTrackEntries.add(trackEntry);
|
selectedTrackEntries.add(trackEntry);
|
||||||
} else {
|
} else {
|
||||||
IWaveform waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
|
String name = state.get(SHOWN_WAVEFORM + i);
|
||||||
|
IWaveform waveform = database.getStreamByName(name);
|
||||||
|
if (waveform == null) {
|
||||||
|
int pos = name.lastIndexOf('.');
|
||||||
|
waveform = database.getStreamByName(name.substring(0, pos));
|
||||||
|
if(waveform!=null) {
|
||||||
|
List<IHierNode> childs = waveform.getChildNodes();
|
||||||
|
waveform = (IWaveform) childs.stream().filter(node -> name.substring(pos+1).equals(node.getName()))
|
||||||
|
.findAny()
|
||||||
|
.orElse(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (waveform != null) {
|
if (waveform != null) {
|
||||||
TrackEntry trackEntry = waveformPane.addWaveform(waveform, -1);
|
TrackEntry trackEntry = waveformPane.addWaveform(waveform, -1);
|
||||||
//check if t is selected
|
//check if t is selected
|
||||||
|
|
Loading…
Reference in New Issue