- public static void setJsMessageSet(String messageclass, String viewId,
- String[] colcommands, JalviewApp app)
- {
- Hashtable<String, Hashtable<String, String[]>> jsmessages = app
- .getJSMessages();
- Hashtable<String, int[]> jshashes = app.getJSHashes();
-
- Hashtable<String, String[]> msgset = jsmessages.get(messageclass);
- if (msgset == null)
- {
- msgset = new Hashtable<>();
- jsmessages.put(messageclass, msgset);
- }
- msgset.put(viewId, colcommands);
- int[] l = new int[colcommands.length];
- for (int i = 0; i < colcommands.length; i++)
- {
- l[i] = colcommands[i].hashCode();
- }
- jshashes.put(messageclass + "|" + viewId, l);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String,
- * java.lang.String)
- */
- public static String getJsMessage(String messageclass, String viewId,
- JalviewApp app)
- {
- Hashtable<String, String[]> msgset = app.getJSMessages()
- .get(messageclass);
- if (msgset != null)
- {
- String[] msgs = msgset.get(viewId);
- if (msgs != null)
- {
- for (int i = 0; i < msgs.length; i++)
- {
- if (msgs[i] != null)
- {
- String m = msgs[i];
- msgs[i] = null;
- return m;
- }
- }
- }
- }
- return "";
- }
-
- public static boolean isJsMessageSetChanged(String string, String string2,
- String[] colcommands, JalviewApp app)
- {
- int[] l = app.getJSHashes().get(string + "|" + string2);
- if (l == null && colcommands != null)
- {
- return true;
- }
- for (int i = 0; i < colcommands.length; i++)
- {
- if (l[i] != colcommands[i].hashCode())
- {
- return true;
- }
- }
- return false;
- }
-
- public void tidyUp()
- {
- stopQueue();
- jvlite = null;
- }
-