下面列出了javafx.scene.control.TabPane#setTabClosingPolicy ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
@SneakyThrows
public Tab getRoot(RequestContainer request) {
val script = request.getAspect(ScriptingAspect.class).get();
Tab preTab = getTab(script::getPreRequestScript, script::setPreRequestScript, "Before Request");
Tab postTab = getTab(script::getPostRequestScript, script::setPostRequestScript, "After Request");
TabPane tabs = new TabPane(preTab, postTab);
tabs.getSelectionModel().select(1); //default to show after request script
tabs.setSide(Side.LEFT);
tabs.getStyleClass().add("options-tabs");
tabs.tabMinWidthProperty().setValue(20);
tabs.tabMaxWidthProperty().setValue(20);
tabs.tabMinHeightProperty().setValue(150);
tabs.tabMaxHeightProperty().setValue(150);
tabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
return new Tab("Scripting", tabs);
}
public TabSample() {
BorderPane borderPane = new BorderPane();
final TabPane tabPane = new TabPane();
tabPane.setPrefSize(400, 400);
tabPane.setSide(Side.TOP);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
final Tab tab1 = new Tab();
tab1.setText("Tab 1");
final Tab tab2 = new Tab();
tab2.setText("Tab 2");
final Tab tab3 = new Tab();
tab3.setText("Tab 3");
final Tab tab4 = new Tab();
tab4.setText("Tab 4");
tabPane.getTabs().addAll(tab1, tab2, tab3, tab4);
borderPane.setCenter(tabPane);
getChildren().add(borderPane);
}
private TabPane createTabPane() {
tabPane = new TabPane();
tabPane.setId("ConfigurationTabPane");
tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
layouts = mpfConfigurationInfo.getProperties(this);
for (IPropertiesLayout layout : layouts) {
String name = layout.getName();
Node content = layout.getContent();
content.getStyleClass().add(StyleClassHelper.BACKGROUND);
Tab tab = new Tab(name, content);
tab.setId(name);
tab.setGraphic(layout.getIcon());
tabPane.getTabs().add(tab);
}
VBox.setVgrow(tabPane, Priority.ALWAYS);
return tabPane;
}
public TabSample() {
BorderPane borderPane = new BorderPane();
final TabPane tabPane = new TabPane();
tabPane.setPrefSize(400, 400);
tabPane.setSide(Side.TOP);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
final Tab tab1 = new Tab();
tab1.setText("Tab 1");
final Tab tab2 = new Tab();
tab2.setText("Tab 2");
final Tab tab3 = new Tab();
tab3.setText("Tab 3");
final Tab tab4 = new Tab();
tab4.setText("Tab 4");
tabPane.getTabs().addAll(tab1, tab2, tab3, tab4);
borderPane.setCenter(tabPane);
getChildren().add(borderPane);
}
public GlobalUI(){
globalGridPane = new GridPane();
// dataCollectionUI = new DataCollectionUI();
dataManipulationUI = new DataManipulationUI();
eventDetectionUI = new EventDetectionUI();
influenceAnalysisUI = new InfluenceAnalysisUI();
logUI = new LogUI();
menuBar();
tabPane = new TabPane();
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
// Tab dataCollectionTab = new Tab("Data Collection");
// dataCollectionTab.setContent(dataCollectionUI.grid);
Tab dataManipulationTab = new Tab("Data Manipulation");
dataManipulationTab.setContent(dataManipulationUI.grid);
Tab eventTab = new Tab("Event Detection");
eventTab.setContent(eventDetectionUI.grid);
Tab influenceTab = new Tab("Influence Analysis");
influenceTab.setContent(influenceAnalysisUI.grid);
tabPane.getTabs().addAll(dataManipulationTab,eventTab,influenceTab);
tabPane.getSelectionModel().select(0);
globalGridPane.add(globalMenu,0,0);
globalGridPane.add(tabPane,0,1);
globalGridPane.add(logUI.logGrid,0,2);
LogUI.addLogEntry("Application started - available cores: "+Configuration.numberOfCores+", workspace: "+Configuration.workspace);
}
public SchemaViewPane() {
schemaViewProviders = null;
schemaViewTabPane = new TabPane();
schemaViewTabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
setCenter(schemaViewTabPane);
}
@Override
public Parent getContentPane() {
BorderPane borderPane = new BorderPane();
browserTabs = new TabPane();
browserTabs.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
for (Browser browser : browsers) {
IWebBrowserProxy proxy = getProxyInstance(browser);
browserTabs.getTabs().add((Tab) proxy.getTab(browser.getBrowserName()));
}
borderPane.setCenter(browserTabs);
borderPane.setBottom(buttonBar);
return borderPane;
}
@SuppressWarnings("unchecked")
public RegexConfigFragment(PlainDictAppOptions _opt){
super();
tabPane = new TabPane();
statusBar = new Text();
tabPane.setPadding(new Insets(4,0,0,0));
opt=_opt;
bundle = ResourceBundle.getBundle("UIText", Locale.getDefault());
Tab tab1 = new Tab();
tab1.setText(bundle.getString(onegine));
tab1.setTooltip(new Tooltip("词条、全文检索时,可选用正则引擎,或快速 .* 通配"));
tab1.setClosable(false);
Text lable = new Text("");
lable.setStyle("-fx-fill: #ff0000;");
tab1.setGraphic(lable);
Tab tab2 = new Tab();
tab2.setText(bundle.getString(findpage));
tab2.setTooltip(new Tooltip("基于 Mark.js"));
tab2.setClosable(false);
Text lable1 = new Text("");
lable1.setStyle("-fx-fill: #ff0000;");
tab2.setGraphic(lable1);
tabPane.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) -> {
if(newValue.intValue()==1){
if(tab2.getContent()==null)
tab2.setContent(getSubpageContent());
}
});
tabPane.setRotateGraphic(false);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB);
tabPane.setSide(Side.TOP);
tabPane.getTabs().addAll(tab1,tab2);
tabPane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);
final String lvCss = HiddenSplitPaneApp.class.getResource("lvCss.css").toExternalForm();
tabPane.getStylesheets().add(lvCss);
tab1.setContent(getMainContent());
VBox.setVgrow(tabPane, Priority.ALWAYS);
getChildren().addAll(tabPane, statusBar);
}
void onAddDeviceUnit(ActionEvent event) {
DialogView dialog = new DialogView();
List<TopicsTab> topicstabadd = new ArrayList<>();
TabPane tabadd = new TabPane();
tabadd.getStyleClass().add("unittabpane");
tabadd.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
Consumer<ActionEvent> actionok = evOK -> {
TopicsTab tt = topicstabadd.get(tabadd.getSelectionModel().getSelectedIndex());
DialogView loading3 = Dialogs.createLoading();
loading3.show(MessageUtils.getRoot(rootpane));
CompletableAsync.handle(
tt.createSelected(),
result -> {
loading3.dispose();
devicesunitsitems.add(result);
devicesunitsselection.select(result);
},
ex -> {
loading3.dispose();
MessageUtils.showException(MessageUtils.getRoot(rootpane), resources.getString("title.new"), resources.getString("exception.cannotloadunit"), ex);
});
};
// Create Tab
TopicsTab topicstab0 = new TopicsGallery();
topicstab0.setActionOK(actionok.andThen(e -> dialog.dispose()));
// ADD Tab
topicstabadd.add(topicstab0);
Tab tab0 = new Tab(topicstab0.getText(), topicstab0.getNode());
tab0.setClosable(false);
// Create Tab
TopicsTab topicstab1 = new TopicsTemplate();
topicstab1.setActionOK(actionok.andThen(e -> dialog.dispose()));
// Add Tab
topicstabadd.add(topicstab1);
Tab tab1 = new Tab(topicstab1.getText(), topicstab1.getNode());
tab1.setClosable(false);
tabadd.getTabs().addAll(tab0, tab1);
dialog.setCSS("/com/adr/helloiot/styles/topicinfodialog.css");
dialog.setTitle(resources.getString("title.new"));
dialog.setContent(tabadd);
dialog.addButtons(dialog.createCancelButton(), dialog.createOKButton());
dialog.show(MessageUtils.getRoot(rootpane));
dialog.setActionOK(actionok);
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
tabPane = new TabPane();
generalTab = new Tab();
generalOptionsPane = new GeneralOptionsPane();
editorTab = new Tab();
editorOptionsPane = new EditorOptionsPane();
markdownTab = new Tab();
markdownOptionsPane = new MarkdownOptionsPane();
stylesheetsTab = new Tab();
stylesheetsOptionsPane = new StylesheetsOptionsPane();
//======== tabPane ========
{
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
//======== generalTab ========
{
generalTab.setText(Messages.get("OptionsDialog.generalTab.text"));
generalTab.setContent(generalOptionsPane);
}
//======== editorTab ========
{
editorTab.setText(Messages.get("OptionsDialog.editorTab.text"));
editorTab.setContent(editorOptionsPane);
}
//======== markdownTab ========
{
markdownTab.setText(Messages.get("OptionsDialog.markdownTab.text"));
markdownTab.setContent(markdownOptionsPane);
}
//======== stylesheetsTab ========
{
stylesheetsTab.setText(Messages.get("OptionsDialog.stylesheetsTab.text"));
stylesheetsTab.setContent(stylesheetsOptionsPane);
}
tabPane.getTabs().addAll(generalTab, editorTab, markdownTab, stylesheetsTab);
}
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
private TabPane createEngineVersion() {
final TabPane availableEngines = new TabPane();
availableEngines.getStyleClass().add("rightPane");
availableEngines.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
Bindings.bindContent(availableEngines.getTabs(), this.engineSubCategoryTabs);
return availableEngines;
}