barryguild1.com Posted July 20, 2006 Share Posted July 20, 2006 How do you clone the JRDesignXXX objects like JRDesignTextField? Link to comment Share on other sites More sharing options...
barryguild1.com Posted July 20, 2006 Author Share Posted July 20, 2006 All else fails, I guess I can use something like the following since it is Serializable import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.Serializable; public class CloneSerialized { public final static <T extends Serializable> T cloneObject(T o) throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(o); oos.close(); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bis); T ret = (T)ois.readObject(); return ret; }} Link to comment Share on other sites More sharing options...
barryguild1.com Posted July 21, 2006 Author Share Posted July 21, 2006 Turns out this is very slow; works but slow; likely because it is having to follow object references that get serialized as well Link to comment Share on other sites More sharing options...
dsteck Posted January 24, 2008 Share Posted January 24, 2008 JasperReports version 2.0.3 and later now includes clone support for JRDesign objects. This is exactly the right solution to the problem of dynamically generating templates with multiple columns not known until runtime.Way to go JR guys! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now