From: Ben Soares Date: Fri, 3 Nov 2023 15:37:07 +0000 (+0000) Subject: JAL-4239 Using own id generation to avoid Random.nextLong() not implemented in jalviewjs X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=94ca0419cc7afa75b3c51917a8beaf46a7c05540;p=jalview.git JAL-4239 Using own id generation to avoid Random.nextLong() not implemented in jalviewjs --- diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index a092cd6..e4e0e59 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -55,6 +55,8 @@ import jalview.structure.StructureSelectionManager; import jalview.util.ColorUtils; import jalview.util.FileUtils; import jalview.util.HttpUtils; +import jalview.util.IdUtils; +import jalview.util.IdUtils.IdType; import jalview.util.ImageMaker; import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; @@ -225,7 +227,7 @@ public class Commands desktop.setProgressBar( MessageManager.getString( "status.processing_commandline_args"), - progress = System.currentTimeMillis()); + progress = IdUtils.newId(IdType.PROGRESS)); progressBarSet = true; } } @@ -363,21 +365,22 @@ public class Commands } } - // Show secondary structure annotations? boolean showSSAnnotations = avm.getFromSubValArgOrPref( Arg.SHOWSSANNOTATIONS, av.getSubVals(), null, "STRUCT_FROM_PDB", true); - + // Show sequence annotations? boolean showAnnotations = avm.getFromSubValArgOrPref( Arg.SHOWANNOTATIONS, av.getSubVals(), null, "SHOW_ANNOTATIONS", true); - + boolean hideTFrows = (avm.getBoolean(Arg.NOTEMPFAC)); final AlignFrame _af = af; - // many of jalview's format/layout methods are only thread safe on the swingworker thread. - // all these methods should be on the alignViewController so it can coordinate such details + // many of jalview's format/layout methods are only thread safe on the + // swingworker thread. + // all these methods should be on the alignViewController so it can + // coordinate such details try { SwingUtilities.invokeAndWait(new Runnable() @@ -457,8 +460,9 @@ public class Commands } } if (progressBarSet && desktop != null) + { desktop.setProgressBar(null, progress); - + } } // open the structure (from same PDB file or given PDBfile) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 3ffcdd0..ba9c5b0 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -100,6 +100,8 @@ import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemeProperty; import jalview.util.ChannelProperties; import jalview.util.HttpUtils; +import jalview.util.IdUtils; +import jalview.util.IdUtils.IdType; import jalview.util.LaunchUtils; import jalview.util.MessageManager; import jalview.util.Platform; @@ -206,7 +208,7 @@ public class Jalview implements JalviewObjectI public void addFetcher(final AlignFrame af, final Vector dasSources) { - final long id = System.currentTimeMillis(); + final long id = IdUtils.newId(IdType.PROGRESS); queued++; final FeatureFetcher us = this; new Thread(new Runnable() @@ -911,7 +913,7 @@ public class Jalview implements JalviewObjectI desktop.setProgressBar( MessageManager .getString("status.processing_commandline_args"), - progress = System.currentTimeMillis()); + progress = IdUtils.newId(IdType.PROGRESS)); } Console.outPrintln("CMD [-open " + file + "] executed successfully!"); diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 08a25ba..1c1602c 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -65,6 +65,8 @@ import jalview.datamodel.SequenceI; import jalview.io.FileFormat; import jalview.io.FormatAdapter; import jalview.util.Comparison; +import jalview.util.IdUtils; +import jalview.util.IdUtils.IdType; import jalview.util.MessageManager; import jalview.util.Platform; @@ -565,7 +567,7 @@ public class AnnotationLabels extends JPanel MessageManager.formatMessage( "action.clustering_matrix_for", cm.getAnnotDescr(), 5f), - progBar = System.currentTimeMillis()); + progBar = IdUtils.newId(IdType.PROGRESS)); cm.setGroupSet(GroupSet.makeGroups(cm, true)); cm.randomlyReColourGroups(); cm.transferGroupColorsTo(alignmentAnnotation); @@ -1198,7 +1200,8 @@ public class AnnotationLabels extends JPanel * @param width * Width for scaling labels */ - public void drawComponent(Graphics g, boolean clip, int givenWidth, boolean forGUI) + public void drawComponent(Graphics g, boolean clip, int givenWidth, + boolean forGUI) { int width = givenWidth; IdwidthAdjuster iwa = null; @@ -1210,8 +1213,8 @@ public class AnnotationLabels extends JPanel { Graphics2D g2d = (Graphics2D) g; Graphics dummy = g2d.create(); - int newAnnotationIdWidth = drawLabels(dummy, clip, width, false, forGUI, - null, false); + int newAnnotationIdWidth = drawLabels(dummy, clip, width, false, + forGUI, null, false); dummy.dispose(); Dimension d = ap.calculateDefaultAlignmentIdWidth(); int alignmentIdWidth = d.width; @@ -1245,8 +1248,10 @@ public class AnnotationLabels extends JPanel } else { - int newAnnotationIdWidth = drawLabels(g, clip, width, false, forGUI, null, false); - width = newAnnotationIdWidth