Example #1
0
  public BIDE(String configDir) {
    super(new BorderLayout());

    this.configDir = configDir;
    configFile = "config.xml";
    BXML xml = new BXML(configDir + configFile, false);
    root = xml.getRoot();
    logHandle = new BLogHandle();
    logHandle.config(log);

    // Create an application list
    develop = new HashMap<BElement, BDevelop>();
    mainPanel = new JPanel(new BorderLayout());
    treePanel = new JPanel(new BorderLayout());

    // Create a tree that allows one selection at a time.
    top = new BTreeNode(root, "APP");
    for (BElement el : root.getElements()) top.add(new BTreeNode(el, el.getValue()));

    treemodel = new DefaultTreeModel(top);
    tree = new BImageTree("/org/baraza/resources/leftpanel.jpg", treemodel, true);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setCellRenderer(new BCellRenderer());
    tree.addTreeSelectionListener(this);
    treeScroll = new JScrollPane(tree);
    treePanel.add(treeScroll, BorderLayout.CENTER);

    String menuStrs[] = {
      "New Project",
      "Close Project",
      "Delete Project",
      "Save Projects",
      "Encrypt File",
      "Open Applications",
      "About"
    };
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem menuItem = null;
    for (String menuStr : menuStrs) {
      menuItem = new JMenuItem(menuStr);
      menuItem.addActionListener(this);
      fileMenu.add(menuItem);
    }
    menuBar.add(fileMenu);
    super.add(menuBar, BorderLayout.PAGE_START);

    desktop = new BImageDesktop("/org/baraza/resources/background.jpg");
    mainPanel.add(desktop, BorderLayout.CENTER);
    mainPanel.add(logHandle.getStatusBar(), BorderLayout.PAGE_END);

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treePanel, mainPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(150);

    super.add(splitPane, BorderLayout.CENTER);
    log.info("Status : Running");
  }