From: hansonr Date: Mon, 23 Jul 2018 03:46:44 +0000 (-0500) Subject: MigInfo.com layout fixe (again?) libjs rebuilt X-Git-Tag: Release_2_11_4_0~45^2~18^2~509 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=202fe33d33dc847ed125a0fc85ac5caf01a77978;p=jalview.git MigInfo.com layout fixe (again?) libjs rebuilt --- diff --git a/libjs/MiGLayout-site.zip b/libjs/MiGLayout-site.zip index 54fcc37..c8c25d0 100644 Binary files a/libjs/MiGLayout-site.zip and b/libjs/MiGLayout-site.zip differ diff --git a/libjs/VARNA-site.zip b/libjs/VARNA-site.zip index 7d7aeae..5ac5c1e 100644 Binary files a/libjs/VARNA-site.zip and b/libjs/VARNA-site.zip differ diff --git a/libjs/jsonsimple-site.zip b/libjs/jsonsimple-site.zip index d43476a..26c3fa7 100644 Binary files a/libjs/jsonsimple-site.zip and b/libjs/jsonsimple-site.zip differ diff --git a/srcjar/net/miginfocom/layout/BoundSize.java b/srcjar/net/miginfocom/layout/BoundSize.java index 531235f..e41c27d 100644 --- a/srcjar/net/miginfocom/layout/BoundSize.java +++ b/srcjar/net/miginfocom/layout/BoundSize.java @@ -245,24 +245,24 @@ public class BoundSize implements Serializable } static { - if(LayoutUtil.HAS_BEANS){ - LayoutUtil.setDelegate(BoundSize.class, new PersistenceDelegate() { - @Override - protected Expression instantiate(Object oldInstance, Encoder out) - { - BoundSize bs = (BoundSize) oldInstance; - if (Grid.TEST_GAPS) { - return new Expression(oldInstance, BoundSize.class, "new", new Object[] { - bs.getMin(), bs.getPreferred(), bs.getMax(), bs.getGapPush(), bs.getConstraintString() - }); - } else { - return new Expression(oldInstance, BoundSize.class, "new", new Object[] { - bs.getMin(), bs.getPreferred(), bs.getMax(), bs.getConstraintString() - }); - } - } - }); - } +// if(LayoutUtil.HAS_BEANS){ +// LayoutUtil.setDelegate(BoundSize.class, new PersistenceDelegate() { +// @Override +// protected Expression instantiate(Object oldInstance, Encoder out) +// { +// BoundSize bs = (BoundSize) oldInstance; +// if (Grid.TEST_GAPS) { +// return new Expression(oldInstance, BoundSize.class, "new", new Object[] { +// bs.getMin(), bs.getPreferred(), bs.getMax(), bs.getGapPush(), bs.getConstraintString() +// }); +// } else { +// return new Expression(oldInstance, BoundSize.class, "new", new Object[] { +// bs.getMin(), bs.getPreferred(), bs.getMax(), bs.getConstraintString() +// }); +// } +// } +// }); +// } } // ************************************************ diff --git a/srcjar/net/miginfocom/layout/LayoutUtil.java b/srcjar/net/miginfocom/layout/LayoutUtil.java index c817827..94abee4 100644 --- a/srcjar/net/miginfocom/layout/LayoutUtil.java +++ b/srcjar/net/miginfocom/layout/LayoutUtil.java @@ -1,8 +1,8 @@ package net.miginfocom.layout; -import java.beans.*; -import java.io.*; -import java.util.IdentityHashMap; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; import java.util.TreeSet; import java.util.WeakHashMap; /* @@ -69,12 +69,12 @@ public final class LayoutUtil private static boolean hasBeans() { - try { - LayoutUtil.class.getClassLoader().loadClass("java.beans.Beans"); - return true; - } catch (Throwable e) { +// try { +// LayoutUtil.class.getClassLoader().loadClass("java.beans.Beans"); +// return true; +// } catch (Throwable e) { return false; - } +// } } private LayoutUtil() @@ -140,7 +140,7 @@ public final class LayoutUtil public static boolean isDesignTime(ContainerWrapper cw) { if (DT_MAP == null) - return HAS_BEANS && Beans.isDesignTime(); + return false;//HAS_BEANS && Beans.isDesignTime(); // assume design time "in general" (cw is null) if there is at least one container with design time // (for storing constraints creation strings in method putCCString()) @@ -190,17 +190,17 @@ public final class LayoutUtil } } - /** Sets/add the persistence delegates to be used for a class. - * @param c The class to set the registered delegate for. - * @param del The new delegate or null to erase to old one. - */ - static synchronized void setDelegate(Class c, PersistenceDelegate del) - { - try { - Introspector.getBeanInfo(c, Introspector.IGNORE_ALL_BEANINFO).getBeanDescriptor().setValue("persistenceDelegate", del); - } catch (Exception ignored) { - } - } +// /** Sets/add the persistence delegates to be used for a class. +// * @param c The class to set the registered delegate for. +// * @param del The new delegate or null to erase to old one. +// */ +// static synchronized void setDelegate(Class c, PersistenceDelegate del) +// { +// try { +// Introspector.getBeanInfo(c, Introspector.IGNORE_ALL_BEANINFO).getBeanDescriptor().setValue("persistenceDelegate", del); +// } catch (Exception ignored) { +// } +// } /** Returns strings set with {@link #putCCString(Object, String)} or null if nothing is associated or * {@link LayoutUtil#isDesignTime(ContainerWrapper)} returns false. @@ -487,52 +487,52 @@ public final class LayoutUtil return (i != null && i[side] != null) ? i[side] : (getDefault ? PlatformDefaults.getPanelInsets(side) : UnitValue.ZERO); } - /** Writes the object and CLOSES the stream. Uses the persistence delegate registered in this class. - * @param os The stream to write to. Will be closed. - * @param o The object to be serialized. - * @param listener The listener to receive the exceptions if there are any. If null not used. - */ - static void writeXMLObject(OutputStream os, Object o, ExceptionListener listener) - { - ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(LayoutUtil.class.getClassLoader()); - - XMLEncoder encoder = new XMLEncoder(os); - - if (listener != null) - encoder.setExceptionListener(listener); - - encoder.writeObject(o); - encoder.close(); // Must be closed to write. - - Thread.currentThread().setContextClassLoader(oldClassLoader); - } +// /** Writes the object and CLOSES the stream. Uses the persistence delegate registered in this class. +// * @param os The stream to write to. Will be closed. +// * @param o The object to be serialized. +// * @param listener The listener to receive the exceptions if there are any. If null not used. +// */ +// static void writeXMLObject(OutputStream os, Object o, ExceptionListener listener) +// { +// ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); +// Thread.currentThread().setContextClassLoader(LayoutUtil.class.getClassLoader()); +// +// XMLEncoder encoder = new XMLEncoder(os); +// +// if (listener != null) +// encoder.setExceptionListener(listener); +// +// encoder.writeObject(o); +// encoder.close(); // Must be closed to write. +// +// Thread.currentThread().setContextClassLoader(oldClassLoader); +// } - private static ByteArrayOutputStream writeOutputStream = null; - /** Writes an object to XML. - * @param out The object out to write to. Will not be closed. - * @param o The object to write. - */ +// private static ByteArrayOutputStream writeOutputStream = null; +// /** Writes an object to XML. +// * @param out The object out to write to. Will not be closed. +// * @param o The object to write. +// */ public static synchronized void writeAsXML(ObjectOutput out, Object o) throws IOException { - if (writeOutputStream == null) - writeOutputStream = new ByteArrayOutputStream(16384); - - writeOutputStream.reset(); - - writeXMLObject(writeOutputStream, o, new ExceptionListener() { - @Override - public void exceptionThrown(Exception e) { - e.printStackTrace(); - }}); - - byte[] buf = writeOutputStream.toByteArray(); - - out.writeInt(buf.length); - out.write(buf); +// if (writeOutputStream == null) +// writeOutputStream = new ByteArrayOutputStream(16384); +// +// writeOutputStream.reset(); +// +// writeXMLObject(writeOutputStream, o, new ExceptionListener() { +// @Override +// public void exceptionThrown(Exception e) { +// e.printStackTrace(); +// }}); +// +// byte[] buf = writeOutputStream.toByteArray(); +// +// out.writeInt(buf.length); +// out.write(buf); } - - private static byte[] readBuf = null; +// +// private static byte[] readBuf = null; /** Reads an object from in using the * @param in The object input to read from. * @return The object. Never null. @@ -540,48 +540,49 @@ public final class LayoutUtil */ public static synchronized Object readAsXML(ObjectInput in) throws IOException { - if (readBuf == null) - readBuf = new byte[16384]; - - Thread cThread = Thread.currentThread(); - ClassLoader oldCL = null; - - try { - oldCL = cThread.getContextClassLoader(); - cThread.setContextClassLoader(LayoutUtil.class.getClassLoader()); - } catch(SecurityException ignored) { - } - - Object o = null; - try { - int length = in.readInt(); - if (length > readBuf.length) - readBuf = new byte[length]; - - in.readFully(readBuf, 0, length); - - o = new XMLDecoder(new ByteArrayInputStream(readBuf, 0, length)).readObject(); - - } catch(EOFException ignored) { - } - - if (oldCL != null) - cThread.setContextClassLoader(oldCL); - - return o; +// if (readBuf == null) +// readBuf = new byte[16384]; +// +// Thread f cThread = Thread.currentThread(); +// ClassLoader oldCL = null; +// +// try { +// oldCL = cThread.getContextClassLoader(); +// cThread.setContextClassLoader(LayoutUtil.class.getClassLoader()); +// } catch(SecurityException ignored) { +// } +// +// Object o = null; +// try { +// int length = in.readInt(); +// if (length > readBuf.length) +// readBuf = new byte[length]; +// +// in.readFully(readBuf, 0, length); +// +// o = new XMLDecoder(new ByteArrayInputStream(readBuf, 0, length)).readObject(); +// +// } catch(EOFException ignored) { +// } +// +// if (oldCL != null) +// cThread.setContextClassLoader(oldCL); +// +// return o; + return null; } - - private static final IdentityHashMap SER_MAP = new IdentityHashMap(2); - - /** Sets the serialized object and associates it with caller. - * @param caller The object created o - * @param o The just serialized object. - */ +// +// private static final IdentityHashMap SER_MAP = new IdentityHashMap(2); +// +// /** Sets the serialized object and associates it with caller. +// * @param caller The object created o +// * @param o The just serialized object. +// */ public static void setSerializedObject(Object caller, Object o) { - synchronized(SER_MAP) { - SER_MAP.put(caller, o); - } +// synchronized(SER_MAP) { +// SER_MAP.put(caller, o); +// } } /** Returns the serialized object that are associated with caller. It also removes it from the list. @@ -590,8 +591,9 @@ public final class LayoutUtil */ public static Object getSerializedObject(Object caller) { - synchronized(SER_MAP) { - return SER_MAP.remove(caller); - } + return null; +// synchronized(SER_MAP) { +// return SER_MAP.remove(caller); +// } } } diff --git a/srcjar/net/miginfocom/layout/UnitValue.java b/srcjar/net/miginfocom/layout/UnitValue.java index 70d8f72..dc9df9c 100644 --- a/srcjar/net/miginfocom/layout/UnitValue.java +++ b/srcjar/net/miginfocom/layout/UnitValue.java @@ -648,24 +648,24 @@ public final class UnitValue implements Serializable PlatformDefaults.setDefaultVerticalUnit(unit); } - static { - if(LayoutUtil.HAS_BEANS){ - LayoutUtil.setDelegate(UnitValue.class, new PersistenceDelegate() { - @Override - protected Expression instantiate(Object oldInstance, Encoder out) - { - UnitValue uv = (UnitValue) oldInstance; - String cs = uv.getConstraintString(); - if (cs == null) - throw new IllegalStateException("Design time must be on to use XML persistence. See LayoutUtil."); - - return new Expression(oldInstance, ConstraintParser.class, "parseUnitValueOrAlign", new Object[] { - uv.getConstraintString(), (uv.isHorizontal() ? Boolean.TRUE : Boolean.FALSE), null - }); - } - }); - } - } +// static { +// if(LayoutUtil.HAS_BEANS){ +// LayoutUtil.setDelegate(UnitValue.class, new PersistenceDelegate() { +// @Override +// protected Expression instantiate(Object oldInstance, Encoder out) +// { +// UnitValue uv = (UnitValue) oldInstance; +// String cs = uv.getConstraintString(); +// if (cs == null) +// throw new IllegalStateException("Design time must be on to use XML persistence. See LayoutUtil."); +// +// return new Expression(oldInstance, ConstraintParser.class, "parseUnitValueOrAlign", new Object[] { +// uv.getConstraintString(), (uv.isHorizontal() ? Boolean.TRUE : Boolean.FALSE), null +// }); +// } +// }); +// } +// } // ************************************************ // Persistence Delegate and Serializable combined.