Ejemplo n.º 1
0
  @Override
  public void initialize(URL arg0, ResourceBundle arg1) {
    storedPreferences = Preferences.userRoot().node(PrefsConstants.PREFS_NODE);
    // DynamiPrefs.Basic.prefs().read(preferences);
    TreeItem<PrefsItem> root = new TreeItem<PrefsItem>(new PrefsItem(null, "General", ""));
    for (DynamiPrefs p : prefsPages) {
      final Prefs prefsNode = p.prefs();
      prefsNode.read(storedPreferences);
      final Prefs.Panel panel = p.prefs().getClass().getAnnotation(Prefs.Panel.class);
      TreeItem<PrefsItem> child =
          new TreeItem<PrefsItem>(new PrefsItem(prefsNode, panel.name(), panel.description()));

      root.getChildren().add(child);
    }

    root.setExpanded(true);
    tree.setRoot(root);

    tree.getSelectionModel()
        .selectedItemProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue.getValue().prefs != null) {
                main.detailNodeProperty().set(new PrefsPage(newValue.getValue().prefs).getNode());
              }
            });
  }
Ejemplo n.º 2
0
 public void initialize(TreeView<DbTreeValue> treeView, MainFrameController mainFrameController) {
   this.treeView = treeView;
   this.mainFrameController = mainFrameController;
   treeView.setRoot(new TreeItem<>());
   treeView.setCellFactory(tv -> new TreeDbCell());
   buildDbContextMenu();
   buildCollectionContextMenu();
   buildIndexContextMenu();
   buildConnectContextMenu();
 }
  /** Initialize the TreeView by adding in children nodes to a dummy root. Dummy root is hidden. */
  private void createTree(ArrayList<String> allTask) {
    dummyRoot = new TreeItem<>(TREE_ROOT);

    overdueNode = setupNode(overdueNode, TITLE_FLAG + TREE_OVERDUE);
    todayNode = setupNode(todayNode, TITLE_FLAG + TREE_TODAY);
    tomorrowNode = setupNode(tomorrowNode, TITLE_FLAG + TREE_TOMORROW);
    everythingElseNode = setupNode(everythingElseNode, TITLE_FLAG + TREE_EVERYTHING_ELSE);

    allTreeView.setRoot(dummyRoot);
    allTreeView.setShowRoot(false);
  }
Ejemplo n.º 4
0
  /** *************************Set Tree************************** */
  private void setTree(CheckBoxTreeItem<StrucTree> treeItem, int id) throws SQLException {
    CheckBoxTreeItem<StrucTree> treeRoot = new CheckBoxTreeItem<>();
    if (treeItem == null) {
      treeRoot.setValue(new StrucTree("p", currProjectName, currPID));
      String query = "SELECT * FROM PDirs WHERE pid LIKE '" + currPID + "' AND parentid IS NULL";
      Statement st = conn.createStatement();
      ResultSet rs = st.executeQuery(query);
      while (rs.next()) {
        CheckBoxTreeItem<StrucTree> temptreeItem = new CheckBoxTreeItem<>();
        temptreeItem.setValue(
            new StrucTree("d", rs.getString("pdname"), rs.getInt("pdid"), rs.getInt("parentid")));
        treeRoot.getChildren().add(temptreeItem);
        setTree(temptreeItem, rs.getInt("pdid"));
      }
      query = "SELECT * FROM PFiles WHERE pid LIKE '" + currPID + "' AND pdid IS NULL";
      rs = st.executeQuery(query);
      while (rs.next()) {
        CheckBoxTreeItem<StrucTree> temptreeItem = new CheckBoxTreeItem<>();
        temptreeItem.setValue(
            new StrucTree("f", rs.getString("pfname"), rs.getInt("pfid"), rs.getInt("pdid")));
        getIniLine(temptreeItem);
        treeRoot.getChildren().add(temptreeItem);
      }
      structure_tree.setRoot(treeRoot);
      treeRoot.setExpanded(true);
      selected = treeRoot;
    } else {
      String query =
          "SELECT * FROM PDirs WHERE pid LIKE '" + currPID + "' AND parentid like '" + id + "'";
      Statement st = conn.createStatement();
      ResultSet rs = st.executeQuery(query);
      while (rs.next()) {
        CheckBoxTreeItem<StrucTree> temptreeItem = new CheckBoxTreeItem<>();
        temptreeItem.setValue(
            new StrucTree("d", rs.getString("pdname"), rs.getInt("pdid"), rs.getInt("parentid")));
        treeItem.getChildren().add(temptreeItem);
        setTree(temptreeItem, rs.getInt("pdid"));
      }

      query = "SELECT * FROM PFiles WHERE pid LIKE '" + currPID + "' AND pdid LIKE '" + id + "'";
      rs = st.executeQuery(query);
      while (rs.next()) {
        CheckBoxTreeItem<StrucTree> temptreeItem = new CheckBoxTreeItem<>();
        temptreeItem.setValue(
            new StrucTree("f", rs.getString("pfname"), rs.getInt("pfid"), rs.getInt("pdid")));
        getIniLine(temptreeItem);
        treeItem.getChildren().add(temptreeItem);
      }
    }
  }
Ejemplo n.º 5
0
  @SuppressWarnings("unchecked")
  @FXML
  private void handleButtonAction(ActionEvent event) {
    // createTree();
    // create root
    TreeItem<String> root = new TreeItem<>("Output Structure");

    // root.setExpanded(true);
    // create child
    TreeItem<String> item1 = new TreeItem<>("Data collect");
    TreeItem<String> item1c1 = new TreeItem<>("Data Base");
    TreeItem<String> item1c2 = new TreeItem<>("Field Trip");
    TreeItem<String> item1c3 = new TreeItem<>("Darwin01");
    item1.getChildren().addAll(item1c1, item1c2, item1c3);
    // item1.setExpanded(false);

    TreeItem<String> item2 = new TreeItem<>("Scanline");

    TreeItem<String> item2C1 = new TreeItem<>("Power Law");
    TreeItem<String> item2C2 = new TreeItem<>("New data");
    item2.getChildren().addAll(item2C1, item2C2);

    TreeItem<String> item3 = new TreeItem<>("Modeling");

    TreeItem<String> item3C1 = new TreeItem<>("2D");
    TreeItem<String> item3C2 = new TreeItem<>("3D");
    item3.getChildren().addAll(item3C1, item3C2);

    // itemChild2.setExpanded(false);
    // root is the parent of itemChild
    root.getChildren().addAll(item1, item2, item3);

    treeview_outs
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            (v, oldvalue, newvalue) -> {
              if (newvalue != null) {
                System.out.println(newvalue.toString());
              }
            });

    treeview_outs.setRoot(root);
    grid_output_project.setDisable(true);
    check_output_newproject.setDisable(false);
  }
Ejemplo n.º 6
0
  private void buildObjectTreeRoot(OtpErlangList requestFunctions) {
    boolean isExported;

    for (OtpErlangObject e : requestFunctions) {
      OtpErlangTuple tuple = (OtpErlangTuple) e;

      OtpErlangAtom moduleNameAtom = (OtpErlangAtom) tuple.elementAt(0);
      OtpErlangList exportedFuncs = (OtpErlangList) tuple.elementAt(1);
      OtpErlangList localFuncs = (OtpErlangList) tuple.elementAt(2);

      TreeItem<ModFunc> moduleItem;

      moduleItem = new TreeItem<ModFunc>(ModFunc.toModule(moduleNameAtom));
      moduleItem.setGraphic(treeIcon(AwesomeIcon.CUBE));

      ObservableList<TreeItem<ModFunc>> modFuncs = FXCollections.observableArrayList();

      SortedList<TreeItem<ModFunc>> sortedFuncs = new SortedList<TreeItem<ModFunc>>(modFuncs);

      FilteredList<TreeItem<ModFunc>> filteredFuncs =
          new FilteredList<TreeItem<ModFunc>>(sortedFuncs);

      sortedFuncs.setComparator(treeItemModFuncComparator());

      isExported = true;
      addTreeItems(toModFuncs(moduleNameAtom, exportedFuncs, isExported), modFuncs);

      isExported = false;
      addTreeItems(toModFuncs(moduleNameAtom, localFuncs, isExported), modFuncs);
      functionLists.add(filteredFuncs);

      Bindings.bindContentBidirectional(moduleItem.getChildren(), filteredFuncs);

      treeModules.add(moduleItem);
    }

    TreeItem<ModFunc> root;

    root = new TreeItem<ModFunc>();
    root.setExpanded(true);

    Bindings.bindContentBidirectional(root.getChildren(), filteredTreeModules);

    modulesTree.setRoot(root);
  }
  public void initTreeView() {
    TreeItem<TreeObj> rootItem1 = new TreeItem<TreeObj>(new TreeObj("root", 123));

    for (DbConfiguration dbc : Context.DbList.getDbConfigurations()) {

      TreeNode<TreeObj> leaf1 = new TreeNode<TreeObj>(new TreeObj(dbc.getName(), new ConnObj(dbc)));
      leaf1.setGraphic(new ImageView(Context.Icon_Connector));
      leaf1.setExpanded(true);

      rootItem1.getChildren().add(leaf1);
    }
    rootItem1.setExpanded(true);

    treeView.setRoot(rootItem1);
    treeView.setEditable(false);
    treeView.setCellFactory(
        new Callback<TreeView<TreeObj>, TreeCell<TreeObj>>() {
          @Override
          public TreeCell<TreeObj> call(TreeView<TreeObj> p) {
            return new TextFieldTreeCellImpl();
          }
        });
  }
Ejemplo n.º 8
0
  public void IniTree() {
    CheckBoxTreeItem<StrucTree> treeRoot = new CheckBoxTreeItem<>();
    treeRoot.setValue(new StrucTree("sQuire Project"));
    treeRoot.setExpanded(true);
    Node graphic = new ImageView(new Image("https://duke.kenai.com/iconSized/duke4.gif"));

    try {
      String query = "SELECT * FROM ProjectAccess WHERE userID like '" + MyuserID + "'";
      Statement st = conn.createStatement();
      ResultSet rs = st.executeQuery(query);
      while (rs.next()) {
        int PID = rs.getInt("PID");
        //	        	System.out.println(PID);
        query = "SELECT * FROM Projects WHERE PID like '" + PID + "'";
        Statement st1 = conn.createStatement();
        ResultSet rs1 = st1.executeQuery(query);

        rs1.next();
        String ProjectName = rs1.getString("pname");
        int ProjectID = rs1.getInt("PID");
        CheckBoxTreeItem<StrucTree> treeItem = new CheckBoxTreeItem<>();
        treeItem.setValue(new StrucTree("p", ProjectName, ProjectID));

        treeRoot.getChildren().add(treeItem);
      }
      structure_tree.setRoot(treeRoot);
    } catch (SQLException e) {
      e.printStackTrace();
    }
    currPID = 0;
    selected = null;
    selectedFile = null;
    currProjectName = "";
    tempFileId = 0;
    tempFileData = "";
    fileData.setText("");
  }
Ejemplo n.º 9
0
  /** 板一覧を表示 */
  public void showBoardList(List<Board> boards) {
    boardTreeView.setRoot(rootNode);
    boardTreeView.setShowRoot(false);
    rootNode.getValue().setTitle("root");
    rootNode.getValue().setId("root_");
    rootNode.setExpanded(true);

    // 履歴
    TreeItem<Board> userTree = new TreeItem<Board>(new Board());
    userTree.getValue().setTitle("ユーザ");
    userTree.getValue().setId("user_");
    userTree.setExpanded(true);
    rootNode.getChildren().add(userTree);

    TreeItem<Board> history = new TreeItem<Board>(new Board());
    history.getValue().setTitle("履歴");
    history.getValue().setId("history_");
    history.setExpanded(true);
    userTree.getChildren().add(history);

    TreeItem<Board> favorite = new TreeItem<Board>(new Board());
    favorite.getValue().setTitle("お気に入り");
    favorite.getValue().setId("favorite_");
    favorite.setExpanded(true);
    userTree.getChildren().add(favorite);

    TreeItem<Board> nichanBoard = new TreeItem<Board>(new Board());
    nichanBoard.getValue().setTitle("2ch");
    nichanBoard.getValue().setId("2ch_");
    nichanBoard.setExpanded(true);
    rootNode.getChildren().add(nichanBoard);

    for (Board board : boards) {
      setupTreeItem(nichanBoard, board);
    }
  }
Ejemplo n.º 10
0
 @Override
 public void start(Stage primaryStage) {
   final String duckLabelText = "Selected Tree Item From Duck Tree: \n";
   final String royalLabelText = "Selected Tree Item From Royal Tree: \n";
   // Use HBOX and VBOX layout panes to space out the controls
   // in a single row
   HBox treeBox = new HBox();
   VBox labelBox = new VBox(30);
   HBox controlBox = new HBox(10);
   // Create labels to highlight the selected items from the TreeViews
   final Label duckLabel = new Label(duckLabelText);
   final Label royalLabel = new Label(royalLabelText);
   // Create and empty TreeView
   TreeView<String> duckTree = new TreeView<String>();
   // Create a TreeItem that will act as the root item of the TreeView
   TreeItem<String> duckRoot = new TreeItem<String>("Della Duck - Donald Duck");
   // Add TreeItems to the root
   duckRoot
       .getChildren()
       .addAll(
           new TreeItem<String>("Huey Duck"),
           new TreeItem<String>("Dewey Duck"),
           new TreeItem<String>("Louie Duck"));
   // Use the setRoot method to set the root TreeItem
   duckTree.setRoot(duckRoot);
   // Set a ChangeListener to handle events that occur with a Treeitem
   // is selected
   duckTree
       .getSelectionModel()
       .selectedItemProperty()
       .addListener(
           new ChangeListener<TreeItem<String>>() {
             public void changed(
                 ObservableValue<? extends TreeItem<String>> observableValue,
                 TreeItem<String> oldItem,
                 TreeItem<String> newItem) {
               duckLabel.setText(duckLabelText + newItem.getValue());
             }
           });
   // Create TreeItems for the Hierarchy of the TreeView
   TreeItem<String> royalRoot = new TreeItem<String>("Queen Elizabeth - Prince Philip");
   TreeItem<String> Charlie = new TreeItem<String>("Prince Charles - Princess Diana");
   TreeItem<String> Annie = new TreeItem<String>("Princess Anne - Mark Phillips");
   TreeItem<String> Andy = new TreeItem<String>("Prince Andrew - Sarah Ferguson");
   TreeItem<String> Eddie = new TreeItem<String>("Prince Edward - Sophie");
   // Populate the TreeItem to be used as the root with the other TreeItems
   royalRoot.getChildren().addAll(Charlie, Annie, Andy, Eddie);
   // Create a TreeView using the root TreeItem
   TreeView<String> royalTree = new TreeView<String>(royalRoot);
   // Populate the other TreeItems with more TreeItems
   // to build the family tree
   Charlie.getChildren()
       .addAll(new TreeItem<String>("Prince William"), new TreeItem<String>("Prince Henry"));
   Annie.getChildren()
       .addAll(new TreeItem<String>("Peter Phillips"), new TreeItem<String>("Zara Phillips"));
   Andy.getChildren()
       .addAll(
           new TreeItem<String>("Princess Beatrice"), new TreeItem<String>("Princess Eugenie"));
   Eddie.getChildren()
       .addAll(new TreeItem<String>("Lady Louise"), new TreeItem<String>("Viscount Severn"));
   // Set a ChangeListener to handle events that occur with a Treeitem
   // is selected
   royalTree
       .getSelectionModel()
       .selectedItemProperty()
       .addListener(
           new ChangeListener<TreeItem<String>>() {
             public void changed(
                 ObservableValue<? extends TreeItem<String>> observableValue,
                 TreeItem<String> oldItem,
                 TreeItem<String> newItem) {
               royalLabel.setText(royalLabelText + newItem.getValue());
             }
           });
   // Add the TreeViews to the HBox
   treeBox.getChildren().add(duckTree);
   treeBox.getChildren().add(royalTree);
   // Add the labels to the VBox
   labelBox.getChildren().add(duckLabel);
   labelBox.getChildren().add(royalLabel);
   // Add the HBox and VBox to another HBox to
   // position the layout panes
   controlBox.getChildren().add(treeBox);
   controlBox.getChildren().add(labelBox);
   // Add the main HBOX layout pane to the scene
   Scene scene = new Scene(controlBox, 800, 250);
   // Show the form
   primaryStage.setTitle("Hello World!");
   primaryStage.setScene(scene);
   primaryStage.show();
 }