示例#1
0
 /**
  * TreeViewで板を選択する。
  *
  * <p>仮実装で二階層まで対応
  *
  * @param board
  */
 public void setSelection(Board board) {
   TreeItem<Board> root = boardTreeView.getRoot();
   for (TreeItem<Board> boardItem1 : root.getChildren()) {
     for (TreeItem<Board> boardItem2 : boardItem1.getChildren()) {
       if (boardItem2.getValue() != null
           && boardItem2.getValue().getId() != null
           && boardItem2.getValue().getId().equals(board.getId())) {
         boardTreeView.getSelectionModel().select(boardItem2);
       }
     }
   }
 }
示例#2
0
 public void addDbConnect(MongoDbConnection mongoDbConnection) {
   DbTreeValue connectTreeValue =
       new DbTreeValue(mongoDbConnection, mongoDbConnection.getConnectionSettings().getHost());
   DynamicTreeItem item =
       new DynamicTreeItem(
           connectTreeValue,
           new FontAwesomeIconView(FontAwesomeIcon.SERVER),
           executor,
           popupService,
           tv -> buildDbList(tv.getHostConnect().getMongoConnection()));
   item.setOnFiled(() -> removeFromRoot(item));
   item.setExpanded(true);
   treeView.getRoot().getChildren().add(item);
 }
 public void filter(ActionEvent e) {
   final String newValue = searchText.getText();
   ObservableList<TreeItem<PrefsItem>> items = tree.getRoot().getChildren();
   if (newValue != null && !newValue.trim().equals("")) {
     items.forEach(
         n -> {
           if (newValue.contains(n.getValue().name)) {
             //					node.getGraphic().setVisible(true);
           } else {
             //					node.getGraphic().setVisible(false);
           }
         });
   } else {
     items.forEach(
         node -> {
           //				node.getGraphic().setVisible(true);
         });
   }
 }
  public void assignSampleData(FXOMObject startObject) {
    assert startObject != null;

    final Object sceneGraphObject = startObject.getSceneGraphObject();
    final AbstractSampleData currentData = sampleDataMap.get(startObject);
    final AbstractSampleData newData;

    if (sceneGraphObject == null) {
      // startObject is unresolved
      newData = null;
    } else {
      final Class<?> sceneGraphClass = sceneGraphObject.getClass();
      if (sceneGraphClass == ChoiceBox.class) {
        final ChoiceBox<?> choiceBox = (ChoiceBox) sceneGraphObject;
        if (choiceBox.getItems().isEmpty()) {
          if (currentData instanceof ChoiceBoxSampleData) {
            newData = currentData;
          } else {
            newData = new ChoiceBoxSampleData();
          }
        } else {
          newData = null;
        }
      } else if (sceneGraphClass == ComboBox.class) {
        final ComboBox<?> comboBox = (ComboBox) sceneGraphObject;
        if (comboBox.getItems().isEmpty()) {
          if (currentData instanceof ComboBoxSampleData) {
            newData = currentData;
          } else {
            newData = new ComboBoxSampleData();
          }
        } else {
          newData = null;
        }
      } else if (sceneGraphClass == ListView.class) {
        final ListView<?> listView = (ListView) sceneGraphObject;
        if (listView.getItems().isEmpty()) {
          if (currentData instanceof ListViewSampleData) {
            newData = currentData;
          } else {
            newData = new ListViewSampleData();
          }
        } else {
          newData = null;
        }
      } else if (sceneGraphClass == TreeView.class) {
        final TreeView<?> treeView = (TreeView) sceneGraphObject;
        if (treeView.getRoot() == null) {
          if (currentData instanceof TreeViewSampleData) {
            newData = currentData;
          } else {
            newData = new TreeViewSampleData();
          }
        } else {
          newData = null;
        }
      } else if (sceneGraphClass == TableView.class) {
        final TableView<?> treeView = (TableView) sceneGraphObject;
        if (TableViewSampleData.canApplyTo(treeView)) {
          if (currentData instanceof TableViewSampleData) {
            newData = currentData;
          } else {
            newData = new TableViewSampleData();
          }
        } else {
          newData = null;
        }
      } else if (sceneGraphClass == TreeTableView.class) {
        final TreeTableView<?> treeTableView = (TreeTableView) sceneGraphObject;
        if (treeTableView.getRoot() == null) {
          if (currentData instanceof TreeTableViewSampleData) {
            newData = currentData;
          } else {
            newData = new TreeTableViewSampleData();
          }
        } else {
          newData = null;
        }
      } else if (sceneGraphClass == PieChart.class) {
        final PieChart pieChart = (PieChart) sceneGraphObject;
        if (pieChart.getData().isEmpty()) {
          if (currentData instanceof PieChartSampleData) {
            newData = currentData;
          } else {
            newData = new PieChartSampleData();
          }
        } else {
          newData = null;
        }
      } else if (XYChartSampleData.isKnownXYChart(sceneGraphObject)) {
        final XYChart<?, ?> xyChart = (XYChart) sceneGraphObject;
        if (xyChart.getData().isEmpty()) {
          if (currentData instanceof XYChartSampleData) {
            newData = currentData;
          } else {
            newData = new XYChartSampleData();
          }
        } else {
          newData = null;
        }
      } else {
        newData = null;
      }
    }

    if (newData == null) {
      if (currentData != null) {
        sampleDataMap.remove(startObject);
      }
    } else {
      newData.applyTo(sceneGraphObject);
      sampleDataMap.put(startObject, newData);
    }

    if (startObject instanceof FXOMInstance) {
      final FXOMInstance fxomInstance = (FXOMInstance) startObject;
      for (FXOMProperty p : fxomInstance.getProperties().values()) {
        if (p instanceof FXOMPropertyC) {
          final FXOMPropertyC pc = (FXOMPropertyC) p;
          for (FXOMObject v : pc.getValues()) {
            assignSampleData(v);
          }
        }
      }
    } else if (startObject instanceof FXOMCollection) {
      final FXOMCollection fxomCollection = (FXOMCollection) startObject;
      for (FXOMObject i : fxomCollection.getItems()) {
        assignSampleData(i);
      }
    }
  }
示例#5
0
 private boolean removeFromRoot(TreeItem<DbTreeValue> selectedItem) {
   return treeView.getRoot().getChildren().remove(selectedItem);
 }