Package com.nexirius.framework.datamodel

Examples of com.nexirius.framework.datamodel.DataModel$MethodPropertyChangeListener


    static class TestPersistenceOpenAdapter implements PersistenceOpenAdapter {
        public void openPersistentModel(PersistenceManager manager, String environmentName, String identifier) {
            System.out.println(identifier);

            try {
                DataModel model = manager.load(environmentName, identifier);
                System.out.println(model.dragData());
                manager.close(environmentName, model, true);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
View Full Code Here


            return openModels.get(environmentName, identifier).getDataModel();
        }

        DirectoryEnvironment environment = (DirectoryEnvironment) getEnvironment(environmentName);

        DataModel m = readDataModel(environment, identifier, environment.useMagicNumber);

        openModels.put(m, environment);
        m.addSoftDataModelListener(environment.getChangeListener());

        return m;
    }
View Full Code Here

        DataModelVector v = new DataModelVector();

        for (String f = files.firstItem(); f != null; f = files.nextItem()) {
            try {
                String identifier = getIdentifier(de, f);
                DataModel m = readDataModel(de, identifier, de.useMagicNumber());

                if (m != null) {
                    v.append(m);
                }
            } catch (Exception ex) {
View Full Code Here

    }

    private DataModel readDataModel(DirectoryEnvironment environment, String identifier, boolean useMagicNumber)
            throws Exception {
        p("readDataModel", identifier, environment.getName());
        DataModel m = null;
        XFile file = makeXFile(environment, identifier);

        if (!file.exists()) {
            throw new Exception("Can't load '" + identifier + "' file not found: " + file.getAbsolutePath());
        }

        BufferedInputStream fileIn = new BufferedInputStream(new FileInputStream(file));
        PushbackInputStream in = null;

        if (useMagicNumber) {
            in = new MagicNumberInputStream(fileIn);
        } else {
            in = new PushbackInputStream(fileIn);
        }

        TextToken className = TextToken.nextToken(in);

        if (className.isString()) {
            Class cl = Class.forName(className.getString());

            m = (DataModel) cl.newInstance();
            m.readDataFrom(in);
        } else {
            throw new Exception("Expecting String literal (class name) at beginning of file but have: " + className);
        }

        if (useMagicNumber) {
            MagicNumberInputStream ms = (MagicNumberInputStream) in;

            while (!ms.hasMagic()) {

                if (-1 == ms.read()) {
                    // no magic number found
                    break;
                }
            }

            if (!ms.checkMagic()) {
                in.close();
                throw new MagicNumberException("Wrong magic number in: " + file.getAbsolutePath());
            }
        }

        in.close();
        m.setInstanceName(identifier);

        return m;
    }
View Full Code Here

    public int getNotSaved(DataModelVector v) {
        Iterator iter = needSaving.values().iterator();
        int ret = 0;

        while (iter.hasNext()) {
            DataModel m = (DataModel) iter.next();

            v.append(m);
            ++ret;
        }
View Full Code Here

        if (child == rootTreeComponent.getChildModel()) {
            return rootTreeComponent;
        }

        DataModelTreeComponent tc = rootTreeComponent;
        DataModel dm = child;
        DataModelVector path = new DataModelVector();

        while (dm != null) {
            if (dm == rootTreeComponent.getChildModel()) {
                break;
            }

            path.insert(dm);

            dm = dm.getParentDataModel();
        }

        if (dm == null) {
            return null;
        }
View Full Code Here

        ret.append("<TABLE BORDER='1' WIDTH='100%'>");

        DataModelEnumeration e = ((StructModel) model).getEnumeration();

        while (e.hasMore()) {
            DataModel child = e.next();

            ret.append("<TR>");
            ret.append("<TD>");
            ret.append("$!translate(\"");
            ret.append(child.getFieldName());
            ret.append("\")</TD>");
            ret.append("<TD>");
            ret.append("$!field(\"");
            ret.append(child.getFieldName());
            ret.append("\")");
            ret.append("</TD>");
            ret.append("</TR>\n");
        }
View Full Code Here

TOP

Related Classes of com.nexirius.framework.datamodel.DataModel$MethodPropertyChangeListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.