Search in sources :

Example 1 with PropertyData

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData in project convertigo by convertigo.

the class PropertyTableTreeObject method read.

public static Object read(Node node) throws EngineException {
    String classname = null;
    XMLVector<Object> xmlv = null;
    try {
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            Element element = (Element) node;
            classname = element.getAttribute("classname");
            xmlv = new XMLVector<Object>();
        }
    } catch (Exception e) {
        String message = "Unable to set the object properties from the serialized XML data.\n" + "Object class: '" + classname;
        EngineException ee = new EngineException(message, e);
        throw ee;
    }
    if (xmlv != null)
        return new PropertyData(PropertyTableTreeObject.class, xmlv);
    return null;
}
Also used : PropertyData(com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData) Element(org.w3c.dom.Element) EngineException(com.twinsoft.convertigo.engine.EngineException) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 2 with PropertyData

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData in project convertigo by convertigo.

the class PropertyTableTreeObject method add.

public IPropertyTreeObject add(Object object, boolean bChangeName) {
    if (object instanceof PropertyData) {
        PropertyData propertyData = (PropertyData) object;
        Class<? extends TreeParent> c = propertyData.getOwnerClass();
        if (c.equals(getRowClass())) {
            XMLVector<Object> row = propertyData.getData();
            if (bChangeName)
                row.set(0, getAvailableRowName((String) row.get(0), 0));
            return addRow(newRow(row));
        } else if (c.equals(getClass())) {
            reloadRows();
            return this;
        }
    } else if (object instanceof PropertyTableRowTreeObject) {
        return addRow((PropertyTableRowTreeObject) object);
    }
    return null;
}
Also used : PropertyData(com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 3 with PropertyData

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData in project convertigo by convertigo.

the class PropertyTableColumnTreeObject method add.

public IPropertyTreeObject add(Object object, boolean bChangeName) {
    if (object instanceof PropertyData) {
        PropertyData propertyData = (PropertyData) object;
        Class<? extends TreeParent> c = propertyData.getOwnerClass();
        if (c.equals(getClass())) {
            PropertyTableRowTreeObject row = getParentRow();
            if (row != null)
                return row.add(object, bChangeName);
        }
    } else if (object instanceof PropertyTableColumnTreeObject) {
        PropertyTableRowTreeObject row = getParentRow();
        if (row != null)
            return row.add(object, false);
    }
    return null;
}
Also used : PropertyData(com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData)

Example 4 with PropertyData

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData in project convertigo by convertigo.

the class PropertyTableColumnTreeObject method read.

public static Object read(Node node) throws EngineException {
    String classname = null;
    XMLVector<Object> xmlv = null;
    try {
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            Element element = (Element) node;
            classname = element.getAttribute("classname");
            xmlv = new XMLVector<Object>();
            NodeList childNodes = node.getChildNodes();
            int len = childNodes.getLength();
            for (int i = 0; i < len; i++) {
                Node childNode = childNodes.item(i);
                if (childNode.getNodeType() != Node.ELEMENT_NODE)
                    continue;
                String childNodeName = childNode.getNodeName();
                if ((childNodeName.equalsIgnoreCase("property"))) {
                    NodeList childValues = childNode.getChildNodes();
                    for (int j = 0; j < childValues.getLength(); j++) {
                        Node childValue = childValues.item(j);
                        if (childValue.getNodeType() != Node.ELEMENT_NODE)
                            continue;
                        Object value = XMLUtils.readObjectFromXml((Element) childValue);
                        xmlv.add(value);
                        break;
                    }
                }
            }
        }
    } catch (Exception e) {
        String message = "Unable to set the object properties from the serialized XML data.\n" + "Object class: '" + classname;
        EngineException ee = new EngineException(message, e);
        throw ee;
    }
    if (xmlv != null)
        return new PropertyData(PropertyTableColumnTreeObject.class, xmlv);
    return null;
}
Also used : PropertyData(com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData) Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) EngineException(com.twinsoft.convertigo.engine.EngineException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 5 with PropertyData

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData in project convertigo by convertigo.

the class PropertyTableRowTreeObject method read.

public static Object read(Node node) throws EngineException {
    String classname = null;
    XMLVector<Object> xmlv = null;
    try {
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            Element element = (Element) node;
            classname = element.getAttribute("classname");
            xmlv = new XMLVector<Object>();
            NodeList childNodes = node.getChildNodes();
            int len = childNodes.getLength();
            Node childNode, childValue;
            String childNodeName, propertyName;
            for (int i = 0; i < len; i++) {
                childNode = childNodes.item(i);
                if (childNode.getNodeType() != Node.ELEMENT_NODE)
                    continue;
                childNodeName = childNode.getNodeName();
                if ((childNodeName.equalsIgnoreCase("property"))) {
                    propertyName = ((Element) childNode).getAttribute("name");
                    if (propertyName.equalsIgnoreCase("columns")) {
                        xmlv.add(new XMLVector<Object>());
                    } else {
                        NodeList childValues = childNode.getChildNodes();
                        for (int j = 0; j < childValues.getLength(); j++) {
                            childValue = childValues.item(j);
                            if (childValue.getNodeType() != Node.ELEMENT_NODE)
                                continue;
                            Object value = XMLUtils.readObjectFromXml((Element) childValue);
                            xmlv.add(value);
                            break;
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        String message = "Unable to set the object properties from the serialized XML data.\n" + "Object class: '" + classname;
        EngineException ee = new EngineException(message, e);
        throw ee;
    }
    if (xmlv != null) {
        return new PropertyData(PropertyTableRowTreeObject.class, xmlv);
    }
    return null;
}
Also used : PropertyData(com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData) Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) EngineException(com.twinsoft.convertigo.engine.EngineException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Aggregations

PropertyData (com.twinsoft.convertigo.eclipse.views.projectexplorer.PropertyData)6 EngineException (com.twinsoft.convertigo.engine.EngineException)3 Element (org.w3c.dom.Element)3 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)2 Node (org.w3c.dom.Node)2 NodeList (org.w3c.dom.NodeList)2