Package us.thinkable.framework.util

Examples of us.thinkable.framework.util.XNode


  }

  private void init(XAccessInterface frame, File infile) {
    this.frame = frame;
    this.access = frame.getAccess();
    XNode root = readFile(infile);
    makeMenu(root, -1);
  }
View Full Code Here


    }
    return s.length();
  }

  private XNode readFile(File infile) {
    XNode root = new XNode();
    try {
      List<String> lines = XUtil.readFileListSansComments(infile);

      ArrayList<XNode> list = new ArrayList<XNode>();
      list.add(root);

      for (String strLine : lines) {
        int indent = tabCount(strLine);
        XNode child = new XNode(strLine);
        list.get(indent).add(child);
        list.add(indent + 1, child);
      }
    } catch (Exception e) {//Catch exception if any
      System.err.println("Error: " + e.getMessage());
View Full Code Here

            }
          } else {
            this.add(menu);
          }
          for (int i = 0; i < node.getChildCount(); i++) {
            XNode child = (XNode) node.getChildAt(i);
            makeMenu(child, indent + 1);
          }
        }
      }
    } else {
      for (int i = 0; i < node.getChildCount(); i++) {
        XNode child = (XNode) node.getChildAt(i);
        makeMenu(child, indent + 1);
      }
    }
  }
View Full Code Here

    System.out.println(getSelectedNode());
  }

  public void addAction() {
    System.out.println("ADD!");
    XNode node = this.getSelectedNode();
    if (node != null) {
      this.addChild(node, new XNode("New Node!"));
    }
  }
View Full Code Here

    }
  }

  public void delAction() {
    System.out.println("DELETE!");
    XNode node = this.getSelectedNode();
    if (node != null) {
      this.removeChild(node);
    }
  }
View Full Code Here

    XSimpleAccess access = new XSimpleAccess(new File("resources/access.txt"));
    MyFrame frame = new MyFrame("Example", "resources/framework.menu", access);
    tool = new BoringTool(frame, "Boring", "resources/read.menu");
    treeTool = new BoringTree(frame, "Tree", "resources/tree.menu");

    XNode root = new XNode("root");
    XNode thing1 = new XNode(root, "thing1");
    XNode thing2 = new XNode(root, "thing2");
    treeTool.setRoot(root);

    // create a text panel
    readPanel = new XTextEditor(frame, "Read", "resources/read.menu");
    readPanel.setEditable(false);
View Full Code Here

  ActionListener listener;
 
  public XPopupMenu(ActionListener listener, File infile) {
    super();
    this.listener = listener;
    XNode root = readFile(infile);
    makeMenu(root, -1);
  }
View Full Code Here

    }
    return s.length();
  }

  private XNode readFile(File infile) {
    XNode root = new XNode();
    try {
      List<String> lines = XUtil.readFileListSansComments(infile);

      ArrayList<XNode> list = new ArrayList<XNode>();
      list.add(root);

      for (String strLine : lines) {
        int indent = tabCount(strLine);
        XNode child = new XNode(strLine);
        list.get(indent).add(child);
        list.add(indent + 1, child);
      }
    } catch (Exception e) {//Catch exception if any
      System.err.println("Error: " + e.getMessage());
View Full Code Here

          this.add(menu);
        }
      }
    }
    for (int i = 0; i < node.getChildCount(); i++) {
      XNode child = (XNode) node.getChildAt(i);
      makeMenu(child, indent + 1);
    }
  }
View Full Code Here

  boolean editable = false;

  public XTreeTool(XFrame frame, String title, String menuFname) {
    super(frame, title, menuFname);
    this.setLayout(new BorderLayout());
    root = new XNode("root");
    setRoot(root);
  }
View Full Code Here

TOP

Related Classes of us.thinkable.framework.util.XNode

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.