Java Code Examples for javafx.scene.control.SplitPane#setResizableWithParent()

The following examples show how to use javafx.scene.control.SplitPane#setResizableWithParent() . 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: AttachPane.java    From Recaf with MIT License 6 votes vote down vote up
/**
 * Setup primary components.
 */
private void setup() {
	view.getStyleClass().add("vm-view");
	list.getStyleClass().add("vm-list");
	list.setItems(FXCollections.observableArrayList());
	list.setCellFactory(c -> new VMCell());
	list.getSelectionModel().selectedItemProperty().addListener((ob, o, n) -> {
		view.setCenter(createVmDisplay(n));
	});
	SplitPane split = new SplitPane(list, view);
	SplitPane.setResizableWithParent(list, Boolean.FALSE);
	split.setDividerPositions(0.37);
	setCenter(split);
	// Create thread to continually update vm info (remove dead vms, add new ones)
	ThreadUtil.runRepeated(UPDATE_TIME_MS, () -> {
		Stage attachWindow = controller.windows().getAttachWindow();
		if (attachWindow == null || attachWindow.isShowing()) {
			refreshVmList();
		}
	});
}
 
Example 2
Source File: DisplayEditor.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** Create UI elements
 *  @return Root Node
 */
public Parent create ()
{
    model_root = toolkit.createModelRoot();
    autoScrollHandler = new AutoScrollHandler(model_root);

    final Group scroll_body = (Group) model_root.getContent();

    widget_parent = (Pane) scroll_body.getChildren().get(0);

    scroll_body.getChildren().add(edit_tools);

    palette = new Palette(this);
    palette_node = palette.create();

    SplitPane.setResizableWithParent(palette_node, false);
    edit_tools.getChildren().addAll(selection_tracker);
    hookListeners();

    toolbar = createToolbar();

    root.setCenter(model_and_palette);

    configureReadonly(false);
    setGrid(prefs.getBoolean(SNAP_GRID, true));
    setSnap(prefs.getBoolean(SNAP_WIDGETS, true));
    setCoords(prefs.getBoolean(SHOW_COORDS, true));

    return root;
}
 
Example 3
Source File: MainWindow.java    From Recaf with MIT License 5 votes vote down vote up
private void setup() {
	stage.getIcons().add(new Image(resource("icons/logo.png")));
	stage.setTitle("Recaf");
	menubar = new MainMenu(controller);
	root = new BorderPane();
	root.setTop(menubar);
	navRoot = new BorderPane();
	viewRoot = new BorderPane();
	tabs = new ViewportTabs(controller);
	SplitPane split = new SplitPane();
	split.setOrientation(Orientation.HORIZONTAL);
	split.getItems().addAll(navRoot, viewRoot);
	split.setDividerPositions(0.333);
	SplitPane.setResizableWithParent(navRoot, Boolean.FALSE);
	root.setCenter(split);
	viewRoot.setCenter(tabs);
	// Navigation
	updateWorkspaceNavigator();
	Recaf.getWorkspaceSetListeners().add(w -> updateWorkspaceNavigator());
	// Create scene & display the window
	Scene scene = new Scene(root, 800, 600);
	controller.windows().reapplyStyle(scene);
	controller.config().keys().registerMainWindowKeys(controller, stage, scene);
	stage.setScene(scene);
	// Show update prompt
	if (SelfUpdater.hasUpdate())
		UpdateWindow.create(this).show(root);
}
 
Example 4
Source File: HistoryPane.java    From Recaf with MIT License 5 votes vote down vote up
private void setup() {
	list.setCellFactory(cb -> new HistCell());
	list.getSelectionModel().selectedItemProperty().addListener((ob, o, n) -> {
		view.setCenter(createHistoryView(n == null ? o : n));
	});
	view.getStyleClass().add("hist-view");
	SplitPane split = new SplitPane(list, view);
	SplitPane.setResizableWithParent(list, Boolean.FALSE);
	split.setDividerPositions(0.37);
	setCenter(split);
}
 
Example 5
Source File: BytecodeStackHelper.java    From Recaf with MIT License 5 votes vote down vote up
/**
 * @param parent
 * 		Bytecode panel parent, contains bytecode being analyzed.
 */
public BytecodeStackHelper(BytecodeEditorPane parent) {
	this.parent = parent;
	getStyleClass().add("monospaced");
	getItems().addAll(locals, stack);
	setDividerPositions(0.5);
	SplitPane.setResizableWithParent(locals, Boolean.FALSE);
	locals.setCellFactory(c -> new ValueCell(true));
	stack.setCellFactory(c -> new ValueCell(false));
}
 
Example 6
Source File: PluginManagerPane.java    From Recaf with MIT License 5 votes vote down vote up
private void setup() {
	list.setCellFactory(cb -> new PluginCell());
	list.getSelectionModel().selectedItemProperty().addListener((ob, o, n) -> {
		view.setCenter(createPluginView(n == null ? o : n));
	});
	list.setItems(FXCollections.observableArrayList(PluginsManager.getInstance().plugins().values()));
	view.getStyleClass().add("plugin-view");
	SplitPane split = new SplitPane(list, view);
	SplitPane.setResizableWithParent(list, Boolean.FALSE);
	split.setDividerPositions(0.37);
	setCenter(split);
}
 
Example 7
Source File: MainLayout.java    From redtorch with MIT License 4 votes vote down vote up
private void createLayout() {

		vBox.getChildren().add(crearteMainMenuBar());
		// 左右切分布局------------------------
		SplitPane horizontalSplitPane = new SplitPane();
		horizontalSplitPane.setDividerPositions(0.5);
		vBox.getChildren().add(horizontalSplitPane);
		VBox.setVgrow(horizontalSplitPane, Priority.ALWAYS);

		// 左右切分布局----左侧上下切分布局---------
		SplitPane leftVerticalSplitPane = new SplitPane();
		leftVerticalSplitPane.setDividerPositions(0.4);
		horizontalSplitPane.getItems().add(leftVerticalSplitPane);
		leftVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		// 左右切分布局----左侧上下切分布局----上布局-----
		SplitPane leftTopHorizontalSplitPane = new SplitPane();
		leftVerticalSplitPane.getItems().add(leftTopHorizontalSplitPane);

		HBox leftTopRithtPane = new HBox();
		Node orderPanelLayoutNode = orderPanelLayout.getNode();
		HBox.setHgrow(orderPanelLayoutNode, Priority.ALWAYS);

		ScrollPane marketDetailsScrollPane = new ScrollPane();
		Node marketDetailsNode = marketDetailsLayout.getNode();
		marketDetailsScrollPane.setContent(marketDetailsNode);
		marketDetailsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
		marketDetailsScrollPane.setPrefWidth(253);
		marketDetailsScrollPane.setMinWidth(253);
		marketDetailsScrollPane.setMaxWidth(253);
		leftTopRithtPane.getChildren().addAll(marketDetailsScrollPane, orderPanelLayoutNode);
		leftTopRithtPane.setMaxWidth(680);
		leftTopRithtPane.setPrefWidth(680);

		leftTopHorizontalSplitPane.getItems().addAll(tickLayout.getNode(), leftTopRithtPane);
		SplitPane.setResizableWithParent(leftTopRithtPane, false);

		// 左右切分布局----左侧上下切分布局----下布局-----
		TabPane leftBootomTabPane = new TabPane();
		leftVerticalSplitPane.getItems().add(leftBootomTabPane);

		Tab orderTab = new Tab("定单");
		leftBootomTabPane.getTabs().add(orderTab);
		orderTab.setClosable(false);

		orderTab.setContent(orderLayout.getNode());

		Tab tradeTab = new Tab("成交");
		leftBootomTabPane.getTabs().add(tradeTab);
		tradeTab.setClosable(false);

		tradeTab.setContent(tradeLayout.getNode());

		// 左右切分布局----右侧TAB布局-------------
		TabPane rightTabPane = new TabPane();
		horizontalSplitPane.getItems().add(rightTabPane);

		Tab portfolioInvestmentTab = new Tab("投资组合");
		rightTabPane.getTabs().add(portfolioInvestmentTab);
		portfolioInvestmentTab.setClosable(false);

		SplitPane portfolioVerticalSplitPane = new SplitPane();
		portfolioInvestmentTab.setContent(portfolioVerticalSplitPane);
		portfolioVerticalSplitPane.setOrientation(Orientation.VERTICAL);
		VBox.setVgrow(portfolioVerticalSplitPane, Priority.ALWAYS);

		VBox portfolioVBox = new VBox();
		portfolioVBox.getChildren().add(combinationLayout.getNode());

		portfolioVBox.getChildren().add(accountLayout.getNode());

		VBox.setVgrow(accountLayout.getNode(), Priority.ALWAYS);

		portfolioVerticalSplitPane.getItems().add(portfolioVBox);

		portfolioVerticalSplitPane.getItems().add(positionLayout.getNode());

		Tab allContractTab = new Tab("全部合约");
		allContractTab.setContent(contractLayout.getNode());
		rightTabPane.getTabs().add(allContractTab);
		allContractTab.setClosable(false);

		// 状态栏------------------------------
		vBox.getChildren().add(createStatusBar());
	}
 
Example 8
Source File: FX.java    From FxDock with Apache License 2.0 4 votes vote down vote up
/** Prevents the node from being resized when the SplitPane is resized. */
public static void preventSplitPaneResizing(Node nd)
{
	SplitPane.setResizableWithParent(nd, Boolean.FALSE);
}
 
Example 9
Source File: MainWindow.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 4 votes vote down vote up
MainWindow() {
	fileEditorTabPane = new FileEditorTabPane(this);
	fileEditorManager = new FileEditorManager(fileEditorTabPane);
	projectPane = new ProjectPane(fileEditorManager);

	Preferences state = MarkdownWriterFXApp.getState();
	double dividerPosition = state.getDouble("projectPaneDividerPosition", 0.2);

	SplitPane splitPane = new SplitPane(projectPane.getNode(), fileEditorTabPane.getNode()) {
		private int layoutCount;

		@Override
		protected void layoutChildren() {
			super.layoutChildren();
			if (layoutCount < 2) {
				layoutCount++;
				setDividerPosition(0, dividerPosition);
				super.layoutChildren();
			}
		}
	};
	SplitPane.setResizableWithParent(projectPane.getNode(), false);
	splitPane.setDividerPosition(0, dividerPosition);
	splitPane.getDividers().get(0).positionProperty().addListener((ob, o, n) -> {
		Utils.putPrefsDouble(state, "projectPaneDividerPosition", n.doubleValue(), 0.2);
	});

	BorderPane borderPane = new BorderPane();
	borderPane.getStyleClass().add("main");
	borderPane.setPrefSize(800, 800);
	borderPane.setTop(createMenuBarAndToolBar());
	borderPane.setCenter(splitPane);

	scene = new Scene(borderPane);
	scene.getStylesheets().add("org/markdownwriterfx/MarkdownWriter.css");
	scene.windowProperty().addListener((observable, oldWindow, newWindow) -> {
		newWindow.setOnCloseRequest(e -> {
			if (!fileEditorTabPane.canCloseAllEditos())
				e.consume();
		});

		// workaround for a bug in JavaFX: unselect menubar if window looses focus
		newWindow.focusedProperty().addListener((obs, oldFocused, newFocused) -> {
			if (!newFocused) {
				// send an ESC key event to the menubar
				menuBar.fireEvent(new KeyEvent(KeyEvent.KEY_PRESSED,
						KeyEvent.CHAR_UNDEFINED, "", KeyCode.ESCAPE,
						false, false, false, false));
			}
		});
	});

	Utils.fixSpaceAfterDeadKey(scene);

	// workaround for a bad JavaFX behavior: menu bar always grabs focus when ALT key is pressed,
	// but should grab it when ALT key is releases (as all other UI toolkits do) to give other
	// controls the chance to use Alt+Key shortcuts.
	scene.addEventHandler(KeyEvent.KEY_PRESSED, e -> {
		if (e.isAltDown())
			e.consume();
	});

	// open markdown files dropped to main window
	scene.setOnDragOver(e -> {
		if (e.getDragboard().hasFiles())
			e.acceptTransferModes(TransferMode.COPY);
		e.consume();
	});
	scene.setOnDragDropped(e -> {
		boolean success = false;
		if (e.getDragboard().hasFiles()) {
			fileEditorTabPane.openEditors(e.getDragboard().getFiles(), 0, -1);
			success = true;
		}
		e.setDropCompleted(success);
		e.consume();
	});

	Platform.runLater(() -> stageFocusedProperty.bind(scene.getWindow().focusedProperty()));
}
 
Example 10
Source File: ErlyBerly.java    From erlyberly with GNU General Public License v3.0 4 votes vote down vote up
private Parent loadEntopPane() {
    Parent entopPane = new FxmlLoadable("/erlyberly/entop.fxml").load();
    SplitPane.setResizableWithParent(entopPane, Boolean.FALSE);

    return entopPane;
}