JAL-3032 adds Java 8 functionality (2/2)
[jalview.git] / src2 / net / miginfocom / layout / UnitValue.java
similarity index 91%
rename from src/net/miginfocom/layout/UnitValue.java
rename to src2/net/miginfocom/layout/UnitValue.java
index 690f14a..70d8f72 100644 (file)
@@ -33,10 +33,10 @@ package net.miginfocom.layout;
  *         Date: 2006-sep-08
  */
 
-//import java.beans.Encoder;
-//import java.beans.Expression;
-//import java.beans.PersistenceDelegate;
-import java.io.Serializable;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.io.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -648,44 +648,44 @@ 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
-//                    });
-//                }
-//            });
-//        }
-//     }
-//
-//     // ************************************************
-//     // Persistence Delegate and Serializable combined.
-//     // ************************************************
-//
-//     private static final long serialVersionUID = 1L;
-//
-//     private Object readResolve() throws ObjectStreamException
-//     {
-//             return LayoutUtil.getSerializedObject(this);
-//     }
-//
-//     private void writeObject(ObjectOutputStream out) throws IOException
-//     {
-//             if (getClass() == UnitValue.class)
-//                     LayoutUtil.writeAsXML(out, this);
-//     }
-//
-//     private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
-//     {
-//             LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in));
-//     }
+       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.
+       // ************************************************
+
+       private static final long serialVersionUID = 1L;
+
+       private Object readResolve() throws ObjectStreamException
+       {
+               return LayoutUtil.getSerializedObject(this);
+       }
+
+       private void writeObject(ObjectOutputStream out) throws IOException
+       {
+               if (getClass() == UnitValue.class)
+                       LayoutUtil.writeAsXML(out, this);
+       }
+
+       private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
+       {
+               LayoutUtil.setSerializedObject(this, LayoutUtil.readAsXML(in));
+       }
 }