@@ -220,6 +220,12 @@ public abstract class AbstractSceneFileEditor<IM extends AbstractSceneFileEditor
220220 @ Nullable
221221 private ToggleButton gridButton ;
222222
223+ /**
224+ * The statistics toggle.
225+ */
226+ @ Nullable
227+ private ToggleButton statisticsButton ;
228+
223229 /**
224230 * The move tool toggle.
225231 */
@@ -438,6 +444,7 @@ protected void loadState() {
438444 editorState = currentWorkspace .getEditorState (getEditFile (), getStateConstructor ());
439445 mainSplitContainer .updateFor (editorState );
440446 gridButton .setSelected (editorState .isEnableGrid ());
447+ statisticsButton .setSelected (editorState .isShowStatistics ());
441448 selectionButton .setSelected (editorState .isEnableSelection ());
442449
443450 final TransformType transformType = TransformType .valueOf (editorState .getTransformationType ());
@@ -939,6 +946,13 @@ protected void createToolbar(@NotNull final HBox container) {
939946 gridButton .selectedProperty ().addListener ((observable , oldValue , newValue ) ->
940947 changeGridVisible (newValue ));
941948
949+ statisticsButton = new ToggleButton ();
950+ statisticsButton .setTooltip (new Tooltip (Messages .SCENE_FILE_EDITOR_ACTION_STATISTICS ));
951+ statisticsButton .setGraphic (new ImageView (Icons .STATISTICS_16 ));
952+ statisticsButton .setSelected (true );
953+ statisticsButton .selectedProperty ().addListener ((observable , oldValue , newValue ) ->
954+ changeStatisticsVisible (newValue ));
955+
942956 moveToolButton = new ToggleButton ();
943957 moveToolButton .setTooltip (new Tooltip (Messages .SCENE_FILE_EDITOR_ACTION_MOVE_TOOL + " (G)" ));
944958 moveToolButton .setGraphic (new ImageView (Icons .MOVE_16 ));
@@ -962,6 +976,8 @@ protected void createToolbar(@NotNull final HBox container) {
962976 FXUtils .addClassTo (selectionButton , CSSClasses .FILE_EDITOR_TOOLBAR_BUTTON );
963977 FXUtils .addClassTo (gridButton , CSSClasses .TOOLBAR_BUTTON );
964978 FXUtils .addClassTo (gridButton , CSSClasses .FILE_EDITOR_TOOLBAR_BUTTON );
979+ FXUtils .addClassTo (statisticsButton , CSSClasses .TOOLBAR_BUTTON );
980+ FXUtils .addClassTo (statisticsButton , CSSClasses .FILE_EDITOR_TOOLBAR_BUTTON );
965981 FXUtils .addClassTo (moveToolButton , CSSClasses .TOOLBAR_BUTTON );
966982 FXUtils .addClassTo (moveToolButton , CSSClasses .FILE_EDITOR_TOOLBAR_BUTTON );
967983 FXUtils .addClassTo (rotationToolButton , CSSClasses .TOOLBAR_BUTTON );
@@ -971,6 +987,7 @@ protected void createToolbar(@NotNull final HBox container) {
971987
972988 FXUtils .addToPane (selectionButton , container );
973989 FXUtils .addToPane (gridButton , container );
990+ FXUtils .addToPane (statisticsButton , container );
974991 FXUtils .addToPane (moveToolButton , container );
975992 FXUtils .addToPane (rotationToolButton , container );
976993 FXUtils .addToPane (scaleToolButton , container );
@@ -1198,6 +1215,19 @@ private void changeGridVisible(@NotNull final Boolean newValue) {
11981215 if (editorState != null ) editorState .setEnableGrid (newValue );
11991216 }
12001217
1218+ /**
1219+ * Handle changing statistics visibility.
1220+ */
1221+ private void changeStatisticsVisible (@ NotNull final Boolean newValue ) {
1222+ if (isIgnoreListeners ()) return ;
1223+
1224+ statsAppState .setEnabled (newValue );
1225+
1226+ final ES editorState = getEditorState ();
1227+ if (editorState != null ) editorState .setShowStatistics (newValue );
1228+ }
1229+
1230+
12011231 /**
12021232 * Notify about transformed the object.
12031233 */
0 commit comments