From 654cf3f9e51949dd7e405789935e25e520dc10f0 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sat, 18 Mar 2023 12:20:29 +0100 Subject: [PATCH] fixes visual handling of Tx not yet being loaded --- .../scviewer/database/ui/swt/Constants.java | 8 +++--- .../ui/swt/internal/ArrowPainter.java | 25 +++++++++--------- ...bstractTransactionTreeContentProvider.java | 3 ++- .../txTableTree/AttributeLabelProvider.java | 16 ++++++++--- .../com.minres.scviewer.target.target | 2 +- .../inputs/my_db.fst | Bin 805 -> 805 bytes .../inputs/my_db.ftr | Bin 1806 -> 1879 bytes 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java index c56add4..213f8f6 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/Constants.java @@ -13,10 +13,10 @@ public class Constants { public static final String CONTENT_PROVIDER_TAG = "TOOLTIP_CONTENT_PROVIDER"; public static final String HELP_PROVIDER_TAG = "TOOLTIP_HELP_PROVIDER"; - public static final DecimalFormat TIME_FORMAT_FS = new DecimalFormat("#"); - public static final DecimalFormat TIME_FORMAT_PS = new DecimalFormat("#"); - public static final DecimalFormat TIME_FORMAT_NS = new DecimalFormat("#.0##"); - public static final DecimalFormat TIME_FORMAT_UMS = new DecimalFormat("#.0#####"); + public static final DecimalFormat TIME_FORMAT_FS = new DecimalFormat("#0"); + public static final DecimalFormat TIME_FORMAT_PS = new DecimalFormat("#0"); + public static final DecimalFormat TIME_FORMAT_NS = new DecimalFormat("#0.0##"); + public static final DecimalFormat TIME_FORMAT_UMS = new DecimalFormat("#0.0#####"); public static final long[] POWERS_OF_TEN = { 1L, 10L, diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java index 155bbd4..e7f4f27 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java @@ -109,20 +109,21 @@ public class ArrowPainter implements IPainter { protected void deriveGeom(Collection relations, List res, boolean useTarget) { for (ITxRelation iTxRelation : relations) { ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource(); - for(IWaveform iWaveform: new IWaveform[]{otherTx.getStream(), otherTx.getGenerator()}) { - if (waveCanvas.wave2painterMap.containsKey(iWaveform)) { - IWaveformPainter painter = waveCanvas.wave2painterMap.get(iWaveform); - if(painter!=null) { - int height = waveCanvas.styleProvider.getTrackHeight(); - Rectangle bb = new Rectangle( - (int) (otherTx.getBeginTime() / scaleFactor), - waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx), - (int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor), - height); - res.add(new LinkEntry(bb, iTxRelation.getRelationType())); + if(otherTx!=null && otherTx.getBeginTime()>=0) + for(IWaveform iWaveform: new IWaveform[]{otherTx.getStream(), otherTx.getGenerator()}) { + if (waveCanvas.wave2painterMap.containsKey(iWaveform)) { + IWaveformPainter painter = waveCanvas.wave2painterMap.get(iWaveform); + if(painter!=null) { + int height = waveCanvas.styleProvider.getTrackHeight(); + Rectangle bb = new Rectangle( + (int) (otherTx.getBeginTime() / scaleFactor), + waveCanvas.rulerHeight + painter.getVerticalOffset() + height * getConcurrencyIndex(otherTx), + (int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor), + height); + res.add(new LinkEntry(bb, iTxRelation.getRelationType())); + } } } - } } } diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AbstractTransactionTreeContentProvider.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AbstractTransactionTreeContentProvider.java index ee9f230..6b7d13e 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AbstractTransactionTreeContentProvider.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AbstractTransactionTreeContentProvider.java @@ -73,9 +73,10 @@ public abstract class AbstractTransactionTreeContentProvider implements ITreeCon case OUT_REL: Vector res_out = new Vector<>(); for(ITxRelation rel:node.element.getOutgoingRelations()){ + ITx tgt = rel.getTarget(); res_out.add(new Object[]{ rel.getRelationType(), - rel.getTarget().getGenerator().getName(), + tgt.getBeginTime()<0?"":tgt.getGenerator().getName(), rel.getTarget()}); } return res_out.toArray(); diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java index 9daf7bf..44c2fa5 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/txTableTree/AttributeLabelProvider.java @@ -40,7 +40,7 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe public static final int TX_TIME=3; String showProp; - + public String getShowProp() { return showProp; } @@ -140,7 +140,10 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe Object o = elements[field]; if(o instanceof ITx) { ITx tx = (ITx)o; - return new StyledString(this.txToString(tx)+" ("+tx.getStream().getFullName()+")"); + if(tx.getBeginTime()<0) + return new StyledString(this.txToString(tx)); + else + return new StyledString(this.txToString(tx)+" ("+tx.getStream().getFullName()+")"); } else return new StyledString(o.toString()); } else if(element instanceof ITx){ @@ -168,8 +171,13 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe */ String txToString(ITx tx){ StringBuilder sb = new StringBuilder(); - sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())); //$NON-NLS-1$ //$NON-NLS-2$ - sb.append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ + sb.append("tx#").append(tx.getId()); + if(tx.getBeginTime()>=0 && tx.getEndTime()>=0) { + sb.append("[").append(timeToString(tx.getBeginTime())); //$NON-NLS-1$ //$NON-NLS-2$ + sb.append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + sb.append("[not visible]"); + } return sb.toString(); } diff --git a/releng/com.minres.scviewer.target/com.minres.scviewer.target.target b/releng/com.minres.scviewer.target/com.minres.scviewer.target.target index 0c36901..c97669c 100644 --- a/releng/com.minres.scviewer.target/com.minres.scviewer.target.target +++ b/releng/com.minres.scviewer.target/com.minres.scviewer.target.target @@ -28,7 +28,7 @@ - + diff --git a/tests/com.minres.scviewer.database.test/inputs/my_db.fst b/tests/com.minres.scviewer.database.test/inputs/my_db.fst index f028f9870832a8d8ab7effee92142ea80a011ca1..cadf436e17528cd7409f123550b81a046cd37e89 100644 GIT binary patch delta 22 dcmZ3=wv=tcC2m6t1w#WX17j;A(~WmMm;g`-2E+gW delta 22 dcmZ3=wv=tcC2j>11w&IS19K|_lZ|&hm;g^02DJbH diff --git a/tests/com.minres.scviewer.database.test/inputs/my_db.ftr b/tests/com.minres.scviewer.database.test/inputs/my_db.ftr index d901cb5b9f784658f7ebb1e4d90cd13475cbacb6..a9e9b72c85c3a283be26e64a76ed877b29919062 100644 GIT binary patch delta 289 zcmW-XNfNDF1^W^!_9fQr8*H`P4mQ{c3WkwT;%RnP z_Fwo7;dDB0k6%C0p}I~iH@mP%f3NmiS}abFC1}YMJ(;Fuvb5Y4J!ABo)AE6yzor## z=!IKa@s3uyrx(jK02O)(Rk4OTU85m4@gUdGlH2IWO+2b?bai@oQu~-cYxVG=_VKC} c;Z2V4E)Vb_5AZ1uF_MQE%M(oH31*keKk%+CrvLx|