Package com.nexirius.util

Examples of com.nexirius.util.TextFile


     */
    public void init(String stylefile)
            throws Exception {
        Style default_style = m_doc.addStyle(StyleContext.DEFAULT_STYLE, m_doc.getLogicalStyle(0));
        Style parent_style = default_style;
        TextFile file = new TextFile(stylefile);

        file.openForRead(file_id);

        TextToken token = file.nextToken();

        for (; token != null; token = file.nextToken()) {
            parent_style = default_style;
            String style_name = token.getString();

            if (token.isIdentifier()) {

                token = file.nextToken();

                if (token.isIdentifier("extends")) {
                    token = file.nextToken();

                    Style ps = m_doc.getStyle(token.getString());

                    if (ps != null) {
                        parent_style = ps;
                    }

                    token = file.nextToken();
                }

                Style new_style = m_doc.addStyle(style_name, parent_style);

                error("new style " + style_name);

                if (!token.isChar('{')) {
                    throw new Exception("Can't read style on line " + file.getActLine());
                }

                Attribute attr = readNextAttribute(file);

                // set the attributes
                for (; attr != null; attr = readNextAttribute(file)) {
                    attr.set(new_style);
                }
            } else {
                break;
            }
        }

        file.close();
    }
View Full Code Here


    /**
     * not yet supported!
     */
    public void writeTo(String stylefile)
            throws Exception {
        TextFile file = new TextFile(stylefile);

        if (file.exists()) {
            file.openExistingFileForWrite(file_id, file_version);
        } else {
            file.openNewFileForWrite(file_id, file_version);
        }

        file.close();
    }
View Full Code Here

TOP

Related Classes of com.nexirius.util.TextFile

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.