Exemplo n.º 1
0
      public WFile readFile(String strPath) {
        File objFile = new File(strPath);
        HashMap hmConts = new HashMap();
        setHM(strPath, hmConts);

        return new WFile(objFile.lastModified(), hmConts);
      }
Exemplo n.º 2
0
  void addChildren(DefaultMutableTreeNode parent, File parentDirFile) {

    for (File file : parentDirFile.listFiles()) {
      String[] namesplitStrings = file.toString().split("\\\\");
      String filename = namesplitStrings[namesplitStrings.length - 1];

      if (file.isDirectory()) {
        DefaultMutableTreeNode child = new DefaultMutableTreeNode(filename);
        addChildren(child, file);
        parent.add(child);
      } else if (file.isFile()) {
        parent.add(new DefaultMutableTreeNode(filename));
      }
    }
  }
Exemplo n.º 3
0
  /*
   * This represents the set of actions that should be preformed when an
   * operator becomes a high-level operator
   */
  public void firstTimeAdd(OperatorWindow operatorWindow, SoarWorkingMemoryModel swmm)
      throws IOException {
    OperatorNode parent = (OperatorNode) getParent();

    // Create the Folder
    File folder = new File(parent.getFullPathName() + File.separator + name);
    if (!okayToCreate(folder, true)) return;
    if (!folder.mkdir()) throw new IOException();

    // Determine the datamap id
    if (parent instanceof SoarOperatorNode) {
      dataMapId = (parent).getStateIdVertex();
    } else {
      dataMapId = swmm.getTopstate();
    }
    dataMapIdNumber = dataMapId.getValue();

    // Make this node highlevel
    isHighLevel = true;

    // Add the folder
    folderName = folder.getName();
  }
  private ObjectOutputStream getObjectOutputStream() {
    File f = new File(".");
    String loadDirectory = f.getAbsolutePath();

    JFileChooser chooser = new JFileChooser(loadDirectory);
    chooser.setDialogTitle("Save Generation File As...");
    chooser.setMultiSelectionEnabled(false);

    int result = chooser.showSaveDialog(this);
    File selectedFile = chooser.getSelectedFile();

    if (result == JFileChooser.APPROVE_OPTION) {
      try {
        FileOutputStream fileStream = new FileOutputStream(selectedFile.getPath());
        ObjectOutputStream objectStream = new ObjectOutputStream(fileStream);

        return objectStream;
      } catch (IOException e) {
        System.err.println(e);
      }
    }

    return null;
  }
Exemplo n.º 5
0
  public SelectableTree() {
    super("JTree Selections");
    WindowUtilities.setNativeLookAndFeel();
    addWindowListener(new ExitListener());
    Container content = getContentPane();

    String[] namesplitStrings = mainDir.toString().split("\\\\");
    String filename = namesplitStrings[namesplitStrings.length - 1];
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(filename);

    addChildren(root, mainDir);
    tree = new JTree(root);
    tree.addTreeSelectionListener(this);
    content.add(new JScrollPane(tree), BorderLayout.CENTER);
    currentSelectionField = new JTextField("Current Selection: NONE");
    content.add(currentSelectionField, BorderLayout.SOUTH);
    setSize(250, 275);
    setVisible(true);
  }