Move crumb bar to editor.fxml

This commit is contained in:
Clément Fournier 2019-01-14 03:20:05 +01:00
parent 8c4353300e
commit a7bfd4971c
4 changed files with 83 additions and 102 deletions

View File

@ -30,7 +30,6 @@ import net.sourceforge.pmd.util.fxdesigner.util.LimitedSizeStack;
import net.sourceforge.pmd.util.fxdesigner.util.TextAwareNodeWrapper;
import net.sourceforge.pmd.util.fxdesigner.util.beans.SettingsPersistenceUtil;
import net.sourceforge.pmd.util.fxdesigner.util.beans.SettingsPersistenceUtil.PersistentProperty;
import net.sourceforge.pmd.util.fxdesigner.util.controls.NodeParentageBreadCrumbBar;
import javafx.application.Platform;
import javafx.fxml.FXML;
@ -93,8 +92,6 @@ public class MainDesignerController extends AbstractController {
private Tab xpathEditorTab;
@FXML
private SplitPane mainHorizontalSplitPane;
@FXML
private NodeParentageBreadCrumbBar focusNodeParentageBreadCrumbBar;
/* Children */
@ -133,8 +130,6 @@ public class MainDesignerController extends AbstractController {
setupAuxclasspathMenuItem.setOnAction(e -> sourceEditorController.showAuxclasspathSetupPopup(designerRoot));
// the editor controller will initialize this after this controller
sourceEditorController.focusNodeParentageCrumbBar = focusNodeParentageBreadCrumbBar;
}

View File

@ -83,8 +83,8 @@ public class SourceEditorController extends AbstractController {
private TreeView<Node> astTreeView;
@FXML
private HighlightLayerCodeArea<StyleLayerIds> codeEditorArea;
// actually a child of the main controller, set during parent initialization
NodeParentageBreadCrumbBar focusNodeParentageCrumbBar;
@FXML
private NodeParentageBreadCrumbBar focusNodeParentageBreadCrumbBar;
private ASTManager astManager;
private TreeViewWrapper<Node> treeViewWrapper;
@ -158,7 +158,7 @@ public class SourceEditorController extends AbstractController {
DesignerUtil.rewire(astManager.languageVersionProperty(), languageVersionUIProperty);
// Focus the crumb
focusNodeParentageCrumbBar.setOnRegularCrumbAction(treeitem -> {
focusNodeParentageBreadCrumbBar.setOnRegularCrumbAction(treeitem -> {
if (treeitem != null && treeitem.getValue() != null) {
focusNodeInTreeView(treeitem.getValue());
@ -365,7 +365,7 @@ public class SourceEditorController extends AbstractController {
}
}
focusNodeParentageCrumbBar.setFocusNode(node);
focusNodeParentageBreadCrumbBar.setFocusNode(node);
}

View File

@ -2,25 +2,14 @@
<!--suppress JavaFxDefaultTag -->
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SeparatorMenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.ToggleButton?>
<?import javafx.scene.control.ToolBar?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Pane?>
<?import org.controlsfx.control.BreadCrumbBar?>
<?import net.sourceforge.pmd.util.fxdesigner.util.controls.NodeParentageBreadCrumbBar?>
<AnchorPane prefHeight="750.0" prefWidth="1200.0" stylesheets="@../css/designer.css" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="net.sourceforge.pmd.util.fxdesigner.MainDesignerController">
<children>
<BorderPane prefHeight="600.0" prefWidth="900.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
@ -64,25 +53,7 @@
<fx:include fx:id="nodeInfoPanel" source="node-info.fxml" />
</left>
<center>
<BorderPane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<center>
<fx:include fx:id="sourceEditor" source="editor.fxml" />
</center>
<bottom>
<NodeParentageBreadCrumbBar
stylesheets="@../css/crumbbar.css"
fx:id="focusNodeParentageBreadCrumbBar" prefHeight="30" id="main-toolbar" />
<!--<ToolBar id="main-toolbar" prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">-->
<!--<items>-->
<!--<Pane HBox.hgrow="ALWAYS" />-->
<!--<ToggleButton fx:id="bottomTabsToggle" mnemonicParsing="false" selected="true" styleClass="expand-toggle" />-->
<!--</items>-->
<!--<padding>-->
<!--<Insets left="20.0" right="20.0" />-->
<!--</padding>-->
<!--</ToolBar>-->
</bottom>
</BorderPane>
<fx:include fx:id="sourceEditor" source="editor.fxml" prefHeight="200.0" prefWidth="200.0" />
</center>
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0">

View File

@ -1,79 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- One editor, ie source + ast view -->
<!-- One editor, ie source + ast view + crumb bar -->
<?import org.kordamp.ikonli.javafx.FontIcon?>
<?import net.sourceforge.pmd.util.fxdesigner.util.codearea.HighlightLayerCodeArea?>
<?import net.sourceforge.pmd.util.fxdesigner.util.controls.NodeParentageBreadCrumbBar?>
<?import net.sourceforge.pmd.util.fxdesigner.util.controls.ToolbarTitledPane?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.MenuButton?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.ToolBar?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?>
<SplitPane dividerPositions="0.5, 0.5"
prefHeight="400.0"
prefWidth="500.0"
styleClass="accent-header"
stylesheets="@../css/designer.css"
BorderPane.alignment="CENTER"
xmlns="http://javafx.com/javafx/8.0.172-ea"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="net.sourceforge.pmd.util.fxdesigner.SourceEditorController">
<items>
<AnchorPane>
<children>
<ToolbarTitledPane
collapsible="false"
fx:id="editorTitledPane"
styleClass="accent-header,full-size-title"
title="Source Code"
AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<toolbarItems>
<MenuButton mnemonicParsing="false" styleClass="menu-button-no-arrow,icon-button"
fx:id="languageSelectionMenuButton">
<graphic>
<FontIcon iconLiteral="fas-cog" />
</graphic>
<items>
<BorderPane xmlns="http://javafx.com/javafx/8.0.172-ea"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="net.sourceforge.pmd.util.fxdesigner.SourceEditorController">
<center>
<SplitPane dividerPositions="0.5"
prefHeight="400.0"
prefWidth="500.0"
styleClass="accent-header"
stylesheets="@../css/designer.css">
<items>
<AnchorPane>
<children>
<ToolbarTitledPane fx:id="editorTitledPane"
collapsible="false"
styleClass="accent-header,full-size-title"
title="Source Code"
AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<toolbarItems>
<MenuButton fx:id="languageSelectionMenuButton"
mnemonicParsing="false"
styleClass="menu-button-no-arrow,icon-button">
<graphic>
<FontIcon iconLiteral="fas-cog" />
</graphic>
<items>
</items>
</MenuButton>
</toolbarItems>
<content>
<HighlightLayerCodeArea fx:id="codeEditorArea"
idEnum="net.sourceforge.pmd.util.fxdesigner.SourceEditorController$StyleLayerIds"
stylesheets="@../css/editor-theme.css"
BorderPane.alignment="CENTER">
<BorderPane.margin>
<Insets />
</BorderPane.margin>
</HighlightLayerCodeArea>
<!--<TextArea />-->
</content>
</ToolbarTitledPane>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<center>
<TreeView fx:id="astTreeView" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
</center>
<top>
<ToolBar prefHeight="40.0" prefWidth="200.0" styleClass="accent-header" BorderPane.alignment="CENTER">
<items>
<Label fx:id="astTitleLabel" text="Abstract Syntax Tree" />
</items>
</ToolBar>
</top>
</BorderPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</MenuButton>
</toolbarItems>
<content>
<HighlightLayerCodeArea fx:id="codeEditorArea"
idEnum="net.sourceforge.pmd.util.fxdesigner.SourceEditorController$StyleLayerIds"
stylesheets="@../css/editor-theme.css"
BorderPane.alignment="CENTER">
<BorderPane.margin>
<Insets />
</BorderPane.margin>
</HighlightLayerCodeArea>
<TextArea />
</content>
</ToolbarTitledPane>
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<BorderPane prefHeight="200.0"
prefWidth="200.0"
AnchorPane.bottomAnchor="0.0"
AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0"
AnchorPane.topAnchor="0.0">
<center>
<TreeView fx:id="astTreeView" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
</center>
<top>
<ToolBar prefHeight="40.0" prefWidth="200.0" styleClass="accent-header" BorderPane.alignment="CENTER">
<items>
<Label fx:id="astTitleLabel" text="Abstract Syntax Tree" />
</items>
</ToolBar>
</top>
</BorderPane>
</children>
</AnchorPane>
</items>
</SplitPane>
</center>
<bottom>
<NodeParentageBreadCrumbBar fx:id="focusNodeParentageBreadCrumbBar"
stylesheets="@../css/crumbbar.css"
prefHeight="30" id="main-toolbar" />
</bottom>
</BorderPane>