MCPcopy Create free account
hub / github.com/PCGen/pcgen / buildMenu

Method buildMenu

code/src/java/pcgen/gui3/component/PCGenToolBar.java:55–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 }
54
55 public ToolBar buildMenu()
56 {
57 ToolBar toolBar = new ToolBar();
58
59 Button newButton = new Button();
60 newButton.setOnAction(this::onNew);
61 newButton.setGraphic(new ImageView(Icons.New16.asJavaFX()));
62 newButton.setText(LanguageBundle.getString("in_mnuFileNew"));
63 newButton.setDisable(true);
64 ReferenceFacade<DataSetFacade> loadedDataSetRef = rootFrame.getLoadedDataSetRef();
65 loadedDataSetRef.addReferenceListener(new EnabledOnlyWithSources(newButton, rootFrame));
66 toolBar.getItems().add(newButton);
67
68 Button openButton = new Button();
69 openButton.setOnAction(this::onOpen);
70 openButton.setGraphic(new ImageView(Icons.Open16.asJavaFX()));
71 openButton.setText(LanguageBundle.getString("in_mnuFileOpen"));
72 toolBar.getItems().add(openButton);
73
74 Button closeButton = new Button();
75 closeButton.setOnAction(this::onClose);
76 closeButton.setGraphic(new ImageView(Icons.Close16.asJavaFX()));
77 closeButton.setText (LanguageBundle.getString("in_mnuFileClose"));
78 toolBar.getItems().add(closeButton);
79 ReferenceFacade<CharacterFacade> ref = rootFrame.getSelectedCharacterRef();
80 ref.addReferenceListener(new EnabledOnlyWithCharacter(closeButton, rootFrame));
81
82 Button saveButton = new Button();
83 saveButton.setOnAction(this::onSave);
84 saveButton.setGraphic(new ImageView(Icons.Save16.asJavaFX()));
85 saveButton.setText(LanguageBundle.getString("in_mnuFileSave"));
86 toolBar.getItems().add(saveButton);
87 ref.addReferenceListener(new EnabledOnlyWithCharacter(saveButton, rootFrame));
88
89 Button printButton = new Button();
90 printButton.setOnAction(this::onPrint);
91 printButton.setGraphic(new ImageView(Icons.Print16.asJavaFX()));
92 printButton.setText(LanguageBundle.getString("in_mnuFilePrint"));
93 toolBar.getItems().add(printButton);
94 ref.addReferenceListener(new EnabledOnlyWithCharacter(printButton, rootFrame));
95
96 Button exportButton = new Button();
97 exportButton.setOnAction(this::onExport);
98 exportButton.setGraphic(new ImageView(Icons.Export16.asJavaFX()));
99 exportButton.setText(LanguageBundle.getString("in_mnuFileExport"));
100 toolBar.getItems().add(exportButton);
101 ref.addReferenceListener(new EnabledOnlyWithCharacter(exportButton, rootFrame));
102
103 Button preferencesButton = new Button();
104 preferencesButton.setOnAction(this::onPreferences);
105 preferencesButton.setGraphic(new ImageView(Icons.Preferences16.asJavaFX()));
106 preferencesButton.setText(LanguageBundle.getString("in_mnuToolsPreferences"));
107 toolBar.getItems().add(preferencesButton);
108
109 return toolBar;
110 }
111
112 private void onNew(final ActionEvent actionEvent)

Callers 1

initComponentsMethod · 0.95

Calls 7

getStringMethod · 0.95
asJavaFXMethod · 0.80
getLoadedDataSetRefMethod · 0.80
addReferenceListenerMethod · 0.65
addMethod · 0.65
setTextMethod · 0.45

Tested by

no test coverage detected