Package clips.delegate.directory.complex

Examples of clips.delegate.directory.complex.DirectoryVidalAtc


    public AtcParser(File source) throws FileNotFoundException {
        input = new BufferedReader(new FileReader(source));
    }

    public ArrayList<DirectoryVidalAtcItem> read() throws IOException, ClipsException {
    DirectoryVidalAtc dir = (DirectoryVidalAtc) DirectoryLocator.getDirectory(DirectoryVidalAtc.class, false);

        ArrayList<DirectoryVidalAtcItem> res = new ArrayList<DirectoryVidalAtcItem>();
        DirectoryVidalAtcItem stack[] = new DirectoryVidalAtcItem[10];
        int stackPos = -1;

        String line = input.readLine();
        while (line != null) {
            if (!line.trim().isEmpty()) {
                int pos = line.indexOf('\t');
                String code = line.substring(0, pos);
                line = line.substring(pos + 1);
                int lvl = 0;
                while (line.charAt(lvl) == ' ') {                   
                    lvl += 1;
                }
                line = line.substring(lvl);
                lvl = lvl/3;
                DirectoryVidalAtcItem parent;
                if (lvl-1 >= 0) {
                    parent = stack[lvl-1];
                } else {
                    parent = null;
                }
                if (lvl > stackPos + 1) {
                    System.err.println("Ошибка структуры файла");
                    break;
                }
                ClassificationAtcDetails details = new ClassificationAtcDetails();
                details.title = line;
                if (parent != null) {
                    details.groupCode = code.substring(parent.getGroupCode().length());
                    parent.getGroupCode();
                } else {
                    details.groupCode = code;
                }
                DirectoryVidalAtcItem newItem = new DirectoryVidalAtcItem(details);
               
                System.out.println("["+code+"][" + line + "]" + lvl);
                if (parent != null) {
                    System.out.println(parent+"->>>>>"+newItem);
                    parent.getItems().append(newItem);
                } else {
                    System.out.println("root->>>>>"+newItem);
                    dir.getItems().append(newItem);
                }
                stackPos = lvl;
                stack[stackPos] = newItem;
               
            }
View Full Code Here


        }
    }

   
    private void updateTree() throws ClipsException{
        DirectoryVidalAtc vdls = DirectoryLocator.getDirectory(DirectoryVidalAtc.class, false);
        TreeModelVidalAtc model = new TreeModelVidalAtc(vdls);
        treeVidalAtc.setRootVisible(true);
        treeVidalAtc.setModel(model);
        treeVidalAtc.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
//        expandTree();
View Full Code Here

TOP

Related Classes of clips.delegate.directory.complex.DirectoryVidalAtc

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.