public Object deserialize(Element element) {
String floatingGroupName = element.getAttribute(PersistenceConstants.FLOATING_GROUP_ATTRIBUTE_NAME);
ISerializer rectangleSerializer = SerializerRegistry.getSerializer(Rectangle.class);
FloatingGroup floatingGroup = new FloatingGroup(floatingGroupName);
NodeList rectangleNodeList = element.getElementsByTagName(PersistenceConstants.RECTANGLE_ELEMENT_NAME);
if (rectangleNodeList.getLength() > 0 && rectangleNodeList.item(0) instanceof Element) {
Node rectangleNode = rectangleNodeList.item(0);
if (rectangleNode instanceof Element) {
Element rectangleElement = (Element) rectangleNode;
Rectangle rectangle = (Rectangle) rectangleSerializer.deserialize(rectangleElement);
floatingGroup.setBounds(rectangle);
}
}
NodeList dockableNodeList = element.getElementsByTagName(PersistenceConstants.DOCKABLE_ELEMENT_NAME);
for (int i=0; i<dockableNodeList.getLength(); i++) {
Node dockableNode = dockableNodeList.item(i);
if (dockableNode instanceof Element) {
Element dockableElement = (Element) dockableNode;
String dockableId = dockableElement.getAttribute(PersistenceConstants.DOCKABLE_ATTRIBUTE_ID);
floatingGroup.addDockable(dockableId);
}
}
return floatingGroup;
}