Example #1
0
  public MyPortfolioTab(MyPortfolioProc p) {
    mpProc = p;
    root.getChildren().addAll(toolBar, mainTable, kmPanel);
    VBox.setVgrow(mainTable, Priority.ALWAYS);
    toolBar.getItems().addAll(portfolioBtn, ckShowGraphBox);
    splitPane.setOrientation(Orientation.VERTICAL);
    splitPane.getItems().addAll(root);
    final Stage parent = CandySimpleGuiMain.getInstance().getPrimaryStage();
    portfolioBtn.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent actionEvent) {
            if (portfolioDlg == null) {
              portfolioDlg = new PortfolioDlg(parent, true, "Edit Portfolio List");
            }
            portfolioDlg.sizeToScene();
            portfolioDlg.showAndWait();
            ArrayList<String> lst = portfolioDlg.getSymbolLst();
            if (lst != null) {
              processPortfolioLst(lst);
            }
          }
        });
    ckShowGraphBox.setSelected(false);
    ckShowGraphBox
        .selectedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              public void changed(
                  ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean newVal) {
                if (newVal) {
                  splitPane.getItems().addAll(chartBox);
                } else {
                  splitPane.getItems().remove(chartBox);
                }
              }
            });
    ckKeyStathBox.setSelected(false);
    ckKeyStathBox
        .selectedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              public void changed(
                  ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean newVal) {
                if (newVal) {
                  splitPane.getItems().addAll(chartBox);
                } else {
                  splitPane.getItems().remove(chartBox);
                }
              }
            });

    chartBox.getChildren().addAll(pieChart.getGUI(), lcChart);
    chartBox.setStyle("-fx-border-color: gray");
    HBox.setHgrow(lcChart, Priority.ALWAYS);

    setText(TAB_NAME);
    setContent(splitPane);
    setClosable(false);
    updateGuiData(mpProc.getGuiData());
    updatePieChart(mpProc.getPieChartData());
    updateLcChart(mpProc.getLcXData(), mpProc.getLcYData());
  }