summaryrefslogtreecommitdiffstats
path: root/src/de/fhswf/in/inf/java2/aufgabe05/view/DirectoryOverviewController.java
blob: e1b2cbbe7df129fcd892f35aaa8254239d701705 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
 * 
 */

package de.fhswf.in.inf.java2.aufgabe05.view;

import javafx.fxml.FXML;
import javafx.scene.control.TableView;
import javafx.scene.layout.AnchorPane;
import de.fhswf.fbin.java2fx.trees.DirectoryTreeView;

/**
 * TODO Add comment here
 *
 * @author $Author: $
 * @version $Revision: $, $Date: $ UTC
 */
public class DirectoryOverviewController
{
   @FXML
   private AnchorPane leftPane;

   @FXML
   private AnchorPane rightPane;

   private DirectoryTreeView dirTree;

   private DirectoryTableView dirTab;

   /**
    * Builds the view with custom controls.
    *
    */
   @FXML
   private void initialize()
   {
      dirTree = new DirectoryTreeView();
      leftPane.getChildren().add(dirTree);
      AnchorPane.setTopAnchor(dirTree, 0.0);
      AnchorPane.setBottomAnchor(dirTree, 0.0);
      AnchorPane.setLeftAnchor(dirTree, 0.0);
      AnchorPane.setRightAnchor(dirTree, 0.0);

      dirTab = new DirectoryTableView(dirTree.getRoot().getValue());
      rightPane.getChildren().add(dirTab);
      AnchorPane.setTopAnchor(dirTab, 0.0);
      AnchorPane.setBottomAnchor(dirTab, 0.0);
      AnchorPane.setLeftAnchor(dirTab, 0.0);
      AnchorPane.setRightAnchor(dirTab, 0.0);

      dirTab.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

      dirTree.getSelectionModel().selectedItemProperty()
            .addListener((ov, oldParent, newParent) -> {
                  dirTab.getParentDirectoryProperty().set(newParent.getValue());
               });
   }
}