Java Code Examples for javafx.scene.layout.AnchorPane#setTopAnchor()

The following examples show how to use javafx.scene.layout.AnchorPane#setTopAnchor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProposalDisplay.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("Duplicates")
public ScrollPane getView() {
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);

    AnchorPane anchorPane = new AnchorPane();
    scrollPane.setContent(anchorPane);

    gridPane.setHgap(5);
    gridPane.setVgap(5);

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setPercentWidth(100);

    gridPane.getColumnConstraints().addAll(columnConstraints1);

    AnchorPane.setBottomAnchor(gridPane, 10d);
    AnchorPane.setRightAnchor(gridPane, 10d);
    AnchorPane.setLeftAnchor(gridPane, 10d);
    AnchorPane.setTopAnchor(gridPane, 10d);
    anchorPane.getChildren().add(gridPane);

    return scrollPane;
}
 
Example 2
Source File: SupplyView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private Pane wrapInChartPane(Node child) {
    AnchorPane chartPane = new AnchorPane();
    chartPane.getStyleClass().add("chart-pane");

    AnchorPane.setTopAnchor(child, 15d);
    AnchorPane.setBottomAnchor(child, 10d);
    AnchorPane.setLeftAnchor(child, 25d);
    AnchorPane.setRightAnchor(child, 10d);

    chartPane.getChildren().add(child);

    GridPane.setColumnSpan(chartPane, 2);
    GridPane.setRowIndex(chartPane, ++gridRow);
    GridPane.setMargin(chartPane, new Insets(10, 0, 0, 0));

    return chartPane;
}
 
Example 3
Source File: ViewPanel.java    From AsciidocFX with Apache License 2.0 5 votes vote down vote up
protected void initializeMargins() {
    AnchorPane.setBottomAnchor(this, 0D);
    AnchorPane.setTopAnchor(this, 0D);
    AnchorPane.setLeftAnchor(this, 0D);
    AnchorPane.setRightAnchor(this, 0D);
    VBox.setVgrow(this, Priority.ALWAYS);
    AnchorPane.setBottomAnchor(getWebView(), 0D);
    AnchorPane.setTopAnchor(getWebView(), 0D);
    AnchorPane.setLeftAnchor(getWebView(), 0D);
    AnchorPane.setRightAnchor(getWebView(), 0D);
    VBox.setVgrow(getWebView(), Priority.ALWAYS);
}
 
Example 4
Source File: GridTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.TOP);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 25d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example 5
Source File: CreatureLabControlsTab.java    From BowlerStudio with GNU General Public License v3.0 5 votes vote down vote up
public void setOverlayTop(VBox progress) {
	// TODO Auto-generated method stub
	progressBar.getChildren().clear();
	progressBar.getChildren().add(progress);
	AnchorPane.setTopAnchor(progress, 0.0);
	AnchorPane.setLeftAnchor(progress, 0.0);
    	AnchorPane.setRightAnchor(progress, 0.0);
    	AnchorPane.setBottomAnchor(progress, 0.0);
}
 
Example 6
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createCenterYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
    Axis axis = new Axis(Orientation.VERTICAL, Position.CENTER);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, AXIS_WIDTH);
    AnchorPane.setLeftAnchor(axis, axis.getZeroPosition());

    return axis;
}
 
Example 7
Source File: DesignerApplication.java    From OEE-Designer with MIT License 5 votes vote down vote up
void showDashboard() throws Exception {
	PlantEntity entity = getPhysicalModelController().getSelectedEntity();

	FXMLLoader dialogLoader = FXMLLoaderFactory.dashboardDialogLoader();
	AnchorPane pane = (AnchorPane) dialogLoader.getRoot();

	// Create the dialog Stage.
	Stage dialogStage = new Stage(StageStyle.DECORATED);
	dialogStage.setTitle(DesignerLocalizer.instance().getLangString("oee.dashboard", entity.getDisplayString()));
	dialogStage.initModality(Modality.NONE);
	Scene scene = new Scene(pane);
	dialogStage.setScene(scene);

	// get the controller
	DashboardDialogController dashboardDialogController = dialogLoader.getController();
	dashboardDialogController.setDialogStage(dialogStage);

	// load the content
	FXMLLoader dashboardLoader = FXMLLoaderFactory.dashboardLoader();
	DashboardController dashboardController = dashboardLoader.getController();

	SplitPane spDashboard = (SplitPane) dashboardLoader.getRoot();

	pane.getChildren().add(0, spDashboard);

	AnchorPane.setTopAnchor(spDashboard, 0.0);
	AnchorPane.setBottomAnchor(spDashboard, 50.0);
	AnchorPane.setLeftAnchor(spDashboard, 0.0);
	AnchorPane.setRightAnchor(spDashboard, 0.0);

	dashboardController.enableRefresh(true);

	dashboardDialogController.setDashboardController(dashboardController);

	dashboardController.setupEquipmentLoss((Equipment) entity);

	// Show the dialog and wait until the user closes it
	dashboardDialogController.getDialogStage().showAndWait();
}
 
Example 8
Source File: DesignerApplication.java    From OEE-Designer with MIT License 5 votes vote down vote up
void showDatabaseTrendDialog(EventResolver eventResolver) throws Exception {
	// Load the fxml file and create a new stage for the pop-up dialog.
	FXMLLoader loader = FXMLLoaderFactory.databaseTrendLoader();
	AnchorPane page = (AnchorPane) loader.getRoot();

	// Create the dialog Stage.
	Stage dialogStage = new Stage(StageStyle.DECORATED);
	dialogStage.setTitle(DesignerLocalizer.instance().getLangString("db.event.trend"));
	dialogStage.initModality(Modality.NONE);
	Scene scene = new Scene(page);
	dialogStage.setScene(scene);

	// get the controller
	DatabaseTrendController databaseTrendController = loader.getController();
	databaseTrendController.setDialogStage(dialogStage);
	databaseTrendController.setApp(this);

	// add the trend chart
	SplitPane chartPane = databaseTrendController.initializeTrend();

	AnchorPane.setBottomAnchor(chartPane, 50.0);
	AnchorPane.setLeftAnchor(chartPane, 5.0);
	AnchorPane.setRightAnchor(chartPane, 5.0);
	AnchorPane.setTopAnchor(chartPane, 50.0);

	page.getChildren().add(0, chartPane);

	// set the script resolver
	databaseTrendController.setEventResolver(eventResolver);

	// connect to the database server
	databaseTrendController.subscribeToDataSource();

	// show the window
	databaseTrendController.getDialogStage().show();
}
 
Example 9
Source File: ChartContainerController.java    From trex-stateless-gui with Apache License 2.0 5 votes vote down vote up
private void handleChartTypeChanged(
        ObservableValue<? extends String> observable,
        String oldValue,
        String newValue
) {
    chart = ChartsFactory.create(newValue, interval);

    AnchorPane.setTopAnchor((Node) chart, 0.0);
    AnchorPane.setRightAnchor((Node) chart, 0.0);
    AnchorPane.setBottomAnchor((Node) chart, 0.0);
    AnchorPane.setLeftAnchor((Node) chart, 0.0);

    root.getChildren().clear();
    root.getChildren().add((Node) chart);
}
 
Example 10
Source File: DesignerApplication.java    From OEE-Designer with MIT License 5 votes vote down vote up
void showHttpTrendDialog(EventResolver eventResolver) throws Exception {
	// Load the fxml file and create a new stage for the pop-up dialog.
	FXMLLoader loader = FXMLLoaderFactory.httpTrendLoader();
	AnchorPane page = (AnchorPane) loader.getRoot();

	// Create the dialog Stage.
	Stage dialogStage = new Stage(StageStyle.DECORATED);
	dialogStage.setTitle(DesignerLocalizer.instance().getLangString("http.trend.title"));
	dialogStage.initModality(Modality.NONE);
	Scene scene = new Scene(page);
	dialogStage.setScene(scene);

	// get the controller
	HttpTrendController httpTrendController = loader.getController();
	httpTrendController.setDialogStage(dialogStage);
	httpTrendController.setApp(this);

	// add the trend chart
	SplitPane chartPane = httpTrendController.initializeTrend();

	AnchorPane.setBottomAnchor(chartPane, 50.0);
	AnchorPane.setLeftAnchor(chartPane, 5.0);
	AnchorPane.setRightAnchor(chartPane, 5.0);
	AnchorPane.setTopAnchor(chartPane, 50.0);

	page.getChildren().add(0, chartPane);

	// set the script resolver
	httpTrendController.setScriptResolver(eventResolver);

	// start HTTP server
	httpTrendController.onStartServer();

	// show the trend
	httpTrendController.getDialogStage().show();
}
 
Example 11
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createLeftYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
    Axis axis = new Axis(Orientation.VERTICAL, Position.LEFT);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, AXIS_WIDTH);
    AnchorPane.setLeftAnchor(axis, 0d);

    return axis;
}
 
Example 12
Source File: DesignerApplication.java    From OEE-Designer with MIT License 5 votes vote down vote up
void showCronTrendDialog(EventResolver eventResolver) throws Exception {
	// Load the fxml file and create a new stage for the pop-up dialog.
	FXMLLoader loader = FXMLLoaderFactory.cronTrendLoader();
	AnchorPane page = (AnchorPane) loader.getRoot();

	// Create the dialog Stage.
	Stage dialogStage = new Stage(StageStyle.DECORATED);
	dialogStage.setTitle(DesignerLocalizer.instance().getLangString("cron.event.trend"));
	dialogStage.initModality(Modality.NONE);
	Scene scene = new Scene(page);
	dialogStage.setScene(scene);

	// get the controller
	CronTrendController cronTrendController = loader.getController();
	cronTrendController.setDialogStage(dialogStage);
	cronTrendController.setApp(this);

	// add the trend chart
	SplitPane chartPane = cronTrendController.initializeTrend();

	AnchorPane.setBottomAnchor(chartPane, 50.0);
	AnchorPane.setLeftAnchor(chartPane, 5.0);
	AnchorPane.setRightAnchor(chartPane, 5.0);
	AnchorPane.setTopAnchor(chartPane, 50.0);

	page.getChildren().add(0, chartPane);

	// set the script resolver
	cronTrendController.setEventResolver(eventResolver);

	// start the job
	cronTrendController.subscribeToDataSource();

	// show the window
	cronTrendController.getDialogStage().show();
}
 
Example 13
Source File: Helper.java    From charts with Apache License 2.0 5 votes vote down vote up
public static final Axis createAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH, final double ANCHOR, final Orientation ORIENTATION, final Position POSITION) {
    Axis axis = AxisBuilder.create(ORIENTATION, POSITION)
                           .minValue(MIN)
                           .maxValue(MAX)
                           .autoScale(AUTO_SCALE)
                           .build();

    if (Orientation.HORIZONTAL == ORIENTATION) {
        axis.setPrefHeight(AXIS_WIDTH);
    } else {
        axis.setPrefWidth(AXIS_WIDTH);
    }

    switch(POSITION) {
        case LEFT:
            AnchorPane.setTopAnchor(axis, 0d);
            AnchorPane.setBottomAnchor(axis, ANCHOR);
            AnchorPane.setLeftAnchor(axis, 0d);
            break;
        case CENTER:
            break;
        case RIGHT:
            AnchorPane.setRightAnchor(axis, 0d);
            AnchorPane.setTopAnchor(axis, 0d);
            AnchorPane.setBottomAnchor(axis, ANCHOR);
            break;
        case TOP:
            AnchorPane.setTopAnchor(axis, ANCHOR);
            AnchorPane.setLeftAnchor(axis, ANCHOR);
            AnchorPane.setRightAnchor(axis, ANCHOR);
            break;
        case BOTTOM:
            AnchorPane.setBottomAnchor(axis, 0d);
            AnchorPane.setLeftAnchor(axis, ANCHOR);
            AnchorPane.setRightAnchor(axis, ANCHOR);
            break;
    }
    return axis;
}
 
Example 14
Source File: FxmlBuilder.java    From milkman with MIT License 5 votes vote down vote up
public static <T extends Node> T anchorNode(T node, Double top, Double right, Double bottom, Double left) {
	AnchorPane.setTopAnchor(node, top);
	AnchorPane.setRightAnchor(node, right);
	AnchorPane.setBottomAnchor(node, bottom);
	AnchorPane.setLeftAnchor(node, left);
	return node;
}
 
Example 15
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addScrollPane() {
    scrollPane = new ScrollPane();
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    AnchorPane.setLeftAnchor(scrollPane, 0d);
    AnchorPane.setTopAnchor(scrollPane, 0d);
    AnchorPane.setRightAnchor(scrollPane, 0d);
    AnchorPane.setBottomAnchor(scrollPane, 0d);
    root.getChildren().add(scrollPane);
}
 
Example 16
Source File: CodeEditor.java    From ARMStrong with Mozilla Public License 2.0 5 votes vote down vote up
/**
   * Creates a new instance of a code editor
   * @param armSimulator the simulator
   */
  public CodeEditor(ArmSimulator armSimulator) {

      mainPane = new AnchorPane();

      this.armSimulator = armSimulator;
      this.textArea = new TextArea();
      this.textFlow = new TextFlow();
      this.scrollPane = new ScrollPane(this.textFlow);
      
      visibleNodes = FXCollections.observableArrayList();
      
      dockNode = new DockNode(mainPane, "Editor");
      dockNode.setPrefSize(300, 100);
      dockNode.setClosable(false);
      
      AnchorPane.setBottomAnchor(this.textArea, 0D);
      AnchorPane.setLeftAnchor(this.textArea, 0D);
      AnchorPane.setRightAnchor(this.textArea, 0D);
      AnchorPane.setTopAnchor(this.textArea, 0D);
      this.mainPane.setMinSize(300, 300);
      
      AnchorPane.setBottomAnchor(this.scrollPane, 0D);
      AnchorPane.setLeftAnchor(this.scrollPane, 0D);
      AnchorPane.setRightAnchor(this.scrollPane, 0D);
      AnchorPane.setTopAnchor(this.scrollPane, 0D);
      
      this.mainPane.getChildren().addAll(this.scrollPane, this.textFlow, this.textArea);
      this.dockNode.getStylesheets().add("/resources/style.css");
      mainPane.setMaxHeight(Double.MAX_VALUE);
      mainPane.setMaxWidth(Double.MAX_VALUE);
      
      scrollPane.vvalueProperty().addListener((obs) -> {
	checkVisible(scrollPane);
});
      scrollPane.hvalueProperty().addListener((obs) -> {
	checkVisible(scrollPane);
});
  }
 
Example 17
Source File: MutableTabPane.java    From pmd-designer with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void makeAddButton() {
    // Basically we superimpose a transparent HBox over the TabPane
    // it needs to be done in a runLater because we need to access the
    // TabPane's header region, which is created by the TabPane's skin
    // on the first layout

    Region headersRegion = (Region) tabPane.lookup(".headers-region");

    // a pane that always has the size of the header region,
    // pushing the new tab button to its right
    Pane headerSizePane = new Pane();
    headerSizePane.setMouseTransparent(true);
    headerSizePane.prefWidthProperty().bind(headersRegion.widthProperty());

    // the new tab button
    Button newTabButton = new Button();
    newTabButton.getStyleClass().addAll("icon-button", "add-tab-button");
    newTabButton.setTooltip(new Tooltip("Add new tab"));
    newTabButton.setGraphic(new FontIcon("fas-plus"));
    newTabButton.onActionProperty().set(actionEvent -> addTabWithNewController());
    // bind bounds to a square that fits inside the header's region
    newTabButton.maxHeightProperty().bind(headersRegion.heightProperty());
    newTabButton.maxWidthProperty().bind(headersRegion.heightProperty());

    // the copy tab button
    Button copyButton = new Button();
    copyButton.getStyleClass().addAll("icon-button", "duplicate-tab-button");
    copyButton.setTooltip(new Tooltip("Duplicate current tab"));
    copyButton.setGraphic(new FontIcon("far-copy"));
    copyButton.onActionProperty().set(actionEvent -> {
        T cur = currentFocusedController().getValue();
        Function<? super T, ? extends T> copy = deepCopyFun.getValue();
        if (cur == null || copy == null) {
            addTabWithNewController();
        } else {
            addTabWithController(copy.apply(cur));
        }
    });
    // bind bounds to a square that fits inside the header's region
    copyButton.maxHeightProperty().bind(headersRegion.heightProperty());
    copyButton.maxWidthProperty().bind(headersRegion.heightProperty());

    copyButton.visibleProperty().bind(ReactfxUtil.isPresentProperty(deepCopyFun));
    copyButton.managedProperty().bind(copyButton.visibleProperty());

    // Rightmost node, grows to fill the rest of the horizontal space
    Pane spring = new Pane();
    spring.setMouseTransparent(true);
    HBox.setHgrow(spring, Priority.ALWAYS);

    HBox box = new HBox();
    box.getStylesheets().addAll(resolveResource("css/flat.css"), resolveResource("css/designer.css"));
    // makes the HBox's transparent regions click-through
    // https://stackoverflow.com/questions/16876083/javafx-pass-mouseevents-through-transparent-node-to-children
    box.setPickOnBounds(false);
    box.prefHeightProperty().bind(headersRegion.heightProperty());

    box.getChildren().addAll(headerSizePane, newTabButton, copyButton, spring);

    // Fits the HBox's size to the container
    AnchorPane.setTopAnchor(box, 0d);
    AnchorPane.setRightAnchor(box, 0d);
    AnchorPane.setLeftAnchor(box, 0d);

    // don't forget that
    this.getChildren().addAll(box);
}
 
Example 18
Source File: TradeStepView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
protected TradeStepView(PendingTradesViewModel model) {
    this.model = model;
    preferences = model.dataModel.preferences;
    trade = model.dataModel.getTrade();
    checkNotNull(trade, "Trade must not be null at TradeStepView");

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    scrollPane.setFitToHeight(true);
    scrollPane.setFitToWidth(true);

    AnchorPane.setLeftAnchor(scrollPane, 10d);
    AnchorPane.setRightAnchor(scrollPane, 10d);
    AnchorPane.setTopAnchor(scrollPane, 10d);
    AnchorPane.setBottomAnchor(scrollPane, 0d);

    getChildren().add(scrollPane);

    gridPane = new GridPane();

    gridPane.setHgap(Layout.GRID_GAP);
    gridPane.setVgap(Layout.GRID_GAP);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHgrow(Priority.ALWAYS);

    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);

    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);

    scrollPane.setContent(gridPane);

    AnchorPane.setLeftAnchor(this, 0d);
    AnchorPane.setRightAnchor(this, 0d);
    AnchorPane.setTopAnchor(this, -10d);
    AnchorPane.setBottomAnchor(this, 0d);

    addContent();

    errorMessageListener = (observable, oldValue, newValue) -> {
        if (newValue != null)
            new Popup().error(newValue).show();
    };

    clockListener = new ClockWatcher.Listener() {
        @Override
        public void onSecondTick() {
        }

        @Override
        public void onMinuteTick() {
            updateTimeLeft();
        }
    };
}
 
Example 19
Source File: TransfersStage.java    From dm3270 with Apache License 2.0 4 votes vote down vote up
public TransfersStage (Screen screen)
{
  setTitle ("File Transfers");

  setOnCloseRequest (e -> closeWindow ());
  btnHide.setOnAction (e -> closeWindow ());

  tsoCommand = new TSOCommand ();
  screen.getFieldManager ().addScreenChangeListener (tsoCommand);

  datasetTab = new DatasetTab (screen, tsoCommand);
  jobTab = new BatchJobTab (screen, tsoCommand);
  filesTab = new FilesTab (screen, tsoCommand, prefs);
  commandsTab = new CommandsTab (screen, tsoCommand);
  transfersTab = new TransfersTab (screen, tsoCommand);
  tabPane.getTabs ().addAll (datasetTab, jobTab, filesTab, commandsTab, transfersTab);
  tabPane.setTabMinWidth (80);

  screenChangeListeners =
      Arrays.asList (datasetTab, jobTab, filesTab, commandsTab, transfersTab);
  keyboardStatusListeners =
      Arrays.asList (datasetTab, jobTab, filesTab, commandsTab, transfersTab);

  datasetTab.addDatasetSelectionListener (transfersTab);
  filesTab.addFileSelectionListener (transfersTab);
  jobTab.addJobSelectionListener (transfersTab);

  AnchorPane anchorPane = new AnchorPane ();
  AnchorPane.setLeftAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setBottomAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setTopAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setTopAnchor (btnHide, 10.0);
  AnchorPane.setBottomAnchor (btnHide, 10.0);
  AnchorPane.setRightAnchor (btnHide, 10.0);
  anchorPane.getChildren ().addAll (tsoCommand.getBox (), btnHide);

  BorderPane borderPane = new BorderPane ();
  menuBar = filesTab.getMenuBar ();
  borderPane.setTop (menuBar);
  borderPane.setCenter (tabPane);
  borderPane.setBottom (anchorPane);

  menuBar.setUseSystemMenuBar (SYSTEM_MENUBAR);

  Scene scene = new Scene (borderPane, 800, 500);             // width/height
  setScene (scene);

  windowSaver = new WindowSaver (prefs, this, "DatasetStage");
  windowSaver.restoreWindow ();

  tabPane.getSelectionModel ().selectedItemProperty ()
      .addListener ( (obs, oldSelection, newSelection) -> select (newSelection));

  tabPane.getSelectionModel ().select (datasetTab);
}
 
Example 20
Source File: TimelinePanel.java    From constellation with Apache License 2.0 4 votes vote down vote up
/**
     * Creates organises the TimelinePanel's layers.
     */
    private void doLayout() {
        // Layer that contains the timelinechart component:
        final BorderPane timelinePane = new BorderPane();

        timelinePane.setCenter(timeline);
        // The layer that contains the time extent labels:
        final BorderPane labelsPane = new BorderPane();
        BorderPane.setAlignment(lowerTime, Pos.CENTER);
        BorderPane.setAlignment(upperTime, Pos.CENTER);
        BorderPane.setMargin(lowerTime, new Insets(-32.0, -40.0, 0.0, -60.0));
        BorderPane.setMargin(upperTime, new Insets(-32.0, -60.0, 0.0, -40.0));
        labelsPane.setLeft(lowerTime);
        labelsPane.setRight(upperTime);
        labelsPane.setMouseTransparent(true);

        // Layer that combines the newly constructed time-extents with the timeline layer:
        final StackPane stackPane = new StackPane();
        StackPane.setAlignment(labelsPane, Pos.CENTER);
//        extentLabelPane.maxHeightProperty().bind(stackPane.heightProperty());
        StackPane.setAlignment(timelinePane, Pos.CENTER);
//        timelinePane.prefHeightProperty().bind(stackPane.heightProperty());
        stackPane.setPadding(Insets.EMPTY);
        stackPane.getChildren().addAll(timelinePane, labelsPane);

        // Layout the menu bar and the timeline object:
        final VBox vbox = new VBox();
//        stackPane.prefHeightProperty().bind(vbox.heightProperty());
        VBox.setVgrow(toolbar, Priority.NEVER);
        VBox.setVgrow(stackPane, Priority.ALWAYS);
        vbox.getChildren().addAll(toolbar, stackPane);
        vbox.setAlignment(Pos.TOP_CENTER);
        vbox.setFillWidth(true);

        // Organise the inner pane:
        AnchorPane.setTopAnchor(vbox, 0d);
        AnchorPane.setBottomAnchor(vbox, 0d);
        AnchorPane.setLeftAnchor(vbox, 0d);
        AnchorPane.setRightAnchor(vbox, 0d);
        innerPane.getChildren().add(vbox);
        innerPane.prefHeightProperty().bind(super.heightProperty());
        innerPane.prefWidthProperty().bind(super.widthProperty());

        // Attach the inner pane to the root:
        this.getChildren().add(innerPane);
    }