Moderator: JIDE Support
JIDE Support wrote:However you have no problem dump it into XML using CDATA.
http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char wrote:#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
The most exciting feature is probably the new Visual Designer. Visual Designer allows you to use drag-n-drop to visually design the layout of dockable frames and command bars, and save it as an xml file. In your application, instead of calling setInitXxx method to hard code the initial side, mode and index of each dockable frame, you just call loadInitialLayout to load the layout xml file you created. Both JIDE Docking Framework and JIDE Action Framework now support to load initial layouts.
JIDE Support wrote:Base64 should work. I heard one customer used Base64 encoding/decoding at http://iharder.sourceforge.net/base64/.
Initial layout saved by Visual Designer is much simpler. After user drag-n-drop to rearrange the layout, the actual layout saved using saveLayoutData() is much more complex. One reason we don't want to save it as xml because we don't want to other people find out what information we saved by looking at the layout file.
JIDE Support wrote:Any reason you can't use Base64 to save layout as string into your own xml format?
Thanks,
String layoutData = _frame.getDockingManager().getLayoutData();
byte[] layout = Base64.encode(layoutData.getBytes());
String newLayoutData = new String(Base64.decode(layout));
if(newLayoutData.equals(layoutData)) {
System.out.println("equal");
}
JIDE Support wrote:It absolutely should work. Here is what I tried in DockingFrameworkDemo.
- Code: Select all
String layoutData = _frame.getDockingManager().getLayoutData();
byte[] layout = Base64.encode(layoutData.getBytes());
String newLayoutData = new String(Base64.decode(layout));
if(newLayoutData.equals(layoutData)) {
System.out.println("equal");
}
I simply used the Base64 class in xerces since I happen to have xerces.jar in my class path.
Thanks,
FileWriter writer = new FileWriter(new File("layout"));
String layoutData = getDockingManager().getLayoutData();
layoutData = Base64.encode(layoutData.getBytes());
writer.write(layoutData);
BufferedReader reader = new BufferedReader(new FileReader("layout"));
String layoutData = reader.readLine();
System.out.println(layoutData);
layoutData = new String(Base64.decode(layoutData));
getDockingManager().saveLayoutDataToFile("backup.layout");
getDockingManager().loadLayoutDataFromFile("backup.layout");
layoutData = getDockingManager().getLayoutData("utf-8");
getDockingManager().setLayoutData(layoutData, "utf-8");
JIDE Support wrote:So how do you resolve it? I want to know in case someone gets the same error?
BTW, our initial test found out getLayoutData("utf-8")/setLayoutData(layoutData, "utf-8") pair doesn't work. We will try to fix it. getLayoutData()/setLayoutData() works all the time even I don't rearrange component in between.
Thanks,
private String getLayout(DockingManager manager) {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
bout.reset();
try {
manager.saveLayoutTo(bout);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BASE64Encoder b64 = new BASE64Encoder();
return b64.encode(bout.toByteArray());
}
private void setLayout(DockingManager manager, String layout) {
BASE64Decoder d64 = new BASE64Decoder();
try {
if(layout == null){
manager.loadLayoutData();
}
else{
manager.loadLayoutFrom(new ByteArrayInputStream(d64.decodeBuffer(layout)));
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Users browsing this forum: Baidu [Spider] and 11 guests