javafx.scene.control.TabPane Java Examples

The following examples show how to use javafx.scene.control.TabPane. 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: ClientSession.java    From Open-Lowcode with Eclipse Public License 2.0 7 votes vote down vote up
/**
 * creates the tab pane if required, and adds a tab with the client display
 * 
 * @param clientdisplay the display to show
 */
private void setupDisplay(ClientDisplay clientdisplay) {
	// initiates the tabpane if called for the first time
	if (this.tabpane == null) {
		this.tabpane = new TabPane();
		this.tabpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));
		this.tabpane.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
		this.tabpane.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
			@Override
			public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) {
				int index = newValue.intValue();
				activedisplayindex = index;
				logger.warning(" --> Set active display index afterselection to " + index);
			}
		});
	}
	displayTab(clientdisplay);

}
 
Example #2
Source File: CObjectIdStorage.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	// gets id data
	DataElt thiselement = inputdata.lookupDataElementByName(datareference.getName());
	if (thiselement == null)
		throw new RuntimeException("could not find any page data with name = " + datareference.getName());
	if (!thiselement.getType().equals(datareference.getType()))
		throw new RuntimeException(
				String.format("page data with name = %s does not have expected %s type, actually found %s",
						datareference.getName(), datareference.getType(), thiselement.getType()));
	ObjectIdDataElt thisidelement = (ObjectIdDataElt) thiselement;
	this.payload = thisidelement;
	// returns null as a widget
	return null;
}
 
Example #3
Source File: CObjectBand.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	dataarray = getExternalContent(inputdata, datareference);
	Pane objectbandpane = CComponentBand.returnBandPane(CComponentBand.DIRECTION_DOWN);

	for (int i = 0; i < this.dataarray.getObjectNumber(); i++) {
		ObjectDataElt thisobject = this.dataarray.getObjectAtIndex(i);
		Node thisobjectnode = CObjectDisplay.generateObjectDisplay(thisobject, this.nodepath, payloadlist, false,
				true, actionmanager, null, null, inputdata, parentwindow, parenttabpanes,nodetocollapsewhenactiontriggered);
		objectbandpane.getChildren().add(thisobjectnode);
		Callback callback = new CObjectBandCallback(i);
		if (actiongroup != null) {
			CPageNode thisactiongroup = actiongroup.deepcopyWithCallback(callback);
			objectbandpane.getChildren().add(thisactiongroup.getNode(actionmanager, inputdata, parentwindow,
					parenttabpanes, nodetocollapsewhenactiontriggered));
		}
	}

	return objectbandpane;
}
 
Example #4
Source File: MPFConfigurationStage.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: JavaFXTabPaneElement.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean marathon_select(String tab) {
    Matcher matcher = CLOSE_PATTERN.matcher(tab);
    boolean isCloseTab = matcher.matches();
    tab = isCloseTab ? matcher.group(1) : tab;
    TabPane tp = (TabPane) node;
    ObservableList<Tab> tabs = tp.getTabs();
    for (int index = 0; index < tabs.size(); index++) {
        String current = getTextForTab(tp, tabs.get(index));
        if (tab.equals(current)) {
            if (isCloseTab) {
                closeTab(tabs.get(index));
                return true;
            }
            tp.getSelectionModel().select(index);
            return true;
        }
    }
    return false;
}
 
Example #6
Source File: CCollapsibleBand.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	Node payloadnode = payload.getNode(actionmanager, inputdata, parentwindow, parenttabpanes,
			(closewheninlineactioninside ? this : null));
	collapsiblepane = new TitledPane(this.title, payloadnode);
	collapsiblepane.setCollapsible(true);
	collapsiblepane.setExpanded(this.openbydefault);
	collapsiblepane.setBorder(Border.EMPTY);
	collapsiblepane.setAnimated(false);

	return collapsiblepane;
}
 
Example #7
Source File: TabSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #8
Source File: ScriptingAspectEditor.java    From milkman with MIT License 6 votes vote down vote up
@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);
}
 
Example #9
Source File: OptionsDialog.java    From milkman with MIT License 6 votes vote down vote up
public OptionsDialogFxml(OptionsDialog controller){
			setHeading(label("Options"));

			var tabs = controller.tabs = new TabPane();
			tabs.setId("tabs");
//			tabs.setRotateGraphic(true);
			tabs.setSide(Side.LEFT);
			tabs.getStyleClass().add("options-tabs");
			tabs.setPrefHeight(400.0);
			tabs.setPrefWidth(400.0);
			//javafx setters seem to be broken, have to use property for these configs
//			tabs.setTabMinWidth(40);
//			tabs.setTabMaxWidth(40);
			tabs.tabMinWidthProperty().setValue(40);
			tabs.tabMaxWidthProperty().setValue(40);
//			tabs.setMinHeight(150);
//			tabs.setTabMaxHeight(150);
			tabs.tabMinHeightProperty().setValue(150);
			tabs.tabMaxHeightProperty().setValue(150);
			tabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
			setBody(tabs);

			setActions(cancel(controller::onClose, "Close"));
		}
 
Example #10
Source File: TabSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #11
Source File: NotesAspectEditorTest.java    From milkman with MIT License 6 votes vote down vote up
@Start
public void setupStage(Stage stage) {
	NotesAspectEditor sut = new NotesAspectEditor();
	noteAspect = new NotesAspect();
	noteAspect.setNote("first");
	RequestContainer request = new RequestContainer() {

		@Override
		public String getType() {
			return "";
		}};
	request.addAspect(noteAspect);
	Tab root = sut.getRoot(request);
	stage.setScene(new Scene(new TabPane(root)));
	stage.show();
}
 
Example #12
Source File: CComponentBand.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	Pane thispane = CComponentBand.returnBandPane(direction);
	this.bandpane = thispane;
	if (this.minwidth != 0)
		thispane.setMinWidth(this.minwidth);
	for (int i = 0; i < elements.size(); i++) {
		Node currentnode = elements.get(i).getNode(actionmanager, inputdata, parentwindow, parenttabpanes,nodetocollapsewhenactiontriggered);
		// if node is null (e.g. CObjectIdStorage), then do not add it to the graphic
		if (currentnode != null)
			thispane.getChildren().add(currentnode);

	}
	
	return thispane;
}
 
Example #13
Source File: CMultipleChoiceField.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	CChoiceFieldValue[] currentchoice = null;
	ArrayList<String> restrictedvalues = null;
	if (this.multipledefaultvaluecode != null) {
		currentchoice = new CChoiceFieldValue[multipledefaultvaluecode.length];
		for (int i = 0; i < this.multipledefaultvaluecode.length; i++) {
			currentchoice[i] = findChoiceFromStoredValue(multipledefaultvaluecode[i]);
		}
	}
	if (this.multipledefaultvaluecode==null) if (this.preselectedvalues.size()>0) {
		currentchoice = new CChoiceFieldValue[this.preselectedvalues.size()];
		for (int i=0;i<this.preselectedvalues.size();i++) currentchoice[i] = this.preselectedvalues.get(i);
	}
	choicefield = new ChoiceField(actionmanager, compactshow, twolines, label, helper, isactive, iseditable, false,
			values, currentchoice, restrictedvalues);
	Node node = choicefield.getNode();
	this.checkboxpanel = choicefield.getCheckBoxList();
	return node;
}
 
Example #14
Source File: RFXTabPaneTest.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Test
public void getText() throws Throwable {
    TabPane tabPane = (TabPane) getPrimaryStage().getScene().getRoot().lookup(".tab-pane");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            RFXTabPane rfxTabPane = new RFXTabPane(tabPane, null, null, lr);
            tabPane.getSelectionModel().select(1);
            rfxTabPane.mouseClicked(null);
            text.add(rfxTabPane.getAttribute("text"));
        }
    });
    new Wait("Waiting for tab pane text.") {
        @Override
        public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("Tab 2", text.get(0));
}
 
Example #15
Source File: DefaultActionHandlerFactory.java    From kafka-message-tool with MIT License 6 votes vote down vote up
@Override
public TemplateGuiActionsHandler<KafkaListenerConfig> createListenerConfigListViewActionHandler(AnchorPane rightContentPane,
                                                                                                TabPane masterTabPane,
                                                                                                Tab tab,
                                                                                                ListView<KafkaListenerConfig> listView,
                                                                                                ListView<KafkaTopicConfig> topicConfigListView,
                                                                                                ControllerProvider repository) {
    return new ListenerConfigGuiActionsHandler(new TabPaneSelectionInformer(masterTabPane, tab),
                                               new ListViewActionsHandler<>(interactor, listView),
                                               modelDataProxy,
                                               repository,
                                               rightContentPane,
                                               topicConfigListView,
                                               applicationPorts.getListeners(),
                                               new ToFileSaver(interactor));
}
 
Example #16
Source File: GlobalUI.java    From SONDY with GNU General Public License v3.0 6 votes vote down vote up
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);
    }
 
Example #17
Source File: DemoTabPane.java    From bootstrapfx with MIT License 6 votes vote down vote up
private DemoTab(String title, String sourceFile) throws Exception {
    super(title);
    setClosable(false);

    TabPane content = new TabPane();
    setContent(content);
    content.setSide(Side.BOTTOM);

    Tab widgets = new Tab("Widgets");
    widgets.setClosable(false);
    URL location = getClass().getResource(sourceFile);
    FXMLLoader fxmlLoader = new FXMLLoader(location);
    Node node = fxmlLoader.load();
    widgets.setContent(node);

    Tab source = new Tab("Source");
    source.setClosable(false);
    XMLEditor editor = new XMLEditor();
    editor.setEditable(false);

    String text = IOUtils.toString(getClass().getResourceAsStream(sourceFile));
    editor.setText(text);
    source.setContent(editor);

    content.getTabs().addAll(widgets, source);
}
 
Example #18
Source File: WidgetInfoDialog.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** Create dialog
 *  @param widget {@link Widget}
 *  @param pvs {@link RuntimePV}s, may be empty
 */
public WidgetInfoDialog(final Widget widget, final Collection<NameStateValue> pvs)
{
    setTitle(Messages.WidgetInfoDialog_Title);
    setHeaderText(MessageFormat.format(Messages.WidgetInfoDialog_Info_Fmt, new Object[] { widget.getName(), widget.getType() }));
	final Node node = JFXBaseRepresentation.getJFXNode(widget);
	initOwner(node.getScene().getWindow());

    if (! (widget instanceof DisplayModel))
    {   // Widgets (but not the DisplayModel!) have a descriptor for their icon
        try
        {
            final WidgetDescriptor descriptor = WidgetFactory.getInstance().getWidgetDescriptor(widget.getType());
            setGraphic(new ImageView(new Image(descriptor.getIconURL().toExternalForm())));
        }
        catch (Exception ex)
        {
            // No icon, no problem
        }
    }
    final TabPane tabs = new TabPane(createProperties(widget), createPVs(pvs), createMacros(widget.getEffectiveMacros()));
    tabs.getTabs().forEach(tab -> tab.setClosable(false));
    // If there are PVs, default to the "PVs" tab
    if (pvs.size() > 0)
        tabs.getSelectionModel().select(1);

    getDialogPane().setContent(tabs);
    getDialogPane().getButtonTypes().addAll(ButtonType.CLOSE);
    setResizable(true);
    tabs.setMinWidth(800);

    setResultConverter(button -> true);
}
 
Example #19
Source File: DockItem.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** This tab should be in a DockPane, not a plain TabPane
 *  @return DockPane that holds this tab
 */
public DockPane getDockPane()
{
    final TabPane tp = getTabPane();
    if (tp == null  ||  tp instanceof DockPane)
        return (DockPane) tp;
    throw new IllegalStateException("Expected DockPane for " + this + ", got " + tp);
}
 
Example #20
Source File: TabsRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public TabPane createJFXNode() throws Exception
{
    final TabPane tabs = new TabPane();

    // See 'twiddle' below
    tabs.setStyle("-fx-background-color: lightgray;");
    tabs.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);

    tabs.setMinSize(TabPane.USE_PREF_SIZE, TabPane.USE_PREF_SIZE);
    tabs.setTabMinHeight(model_widget.propTabHeight().getValue());

    // In edit mode, we want to support 'rubberbanding' inside the active tab.
    // This means mouse clicks need to be passed up to the 'model_root'
    // where the rubber band handler can then see them.
    if (toolkit.isEditMode())
        tabs.addEventFilter(MouseEvent.MOUSE_PRESSED, event ->
        {
            // As in 'group' widget, only do this when ALT is pressed,
            // so ALT-rubberband will select inside the tab.
            // Plain click still directly reaches the child widget in the current tab,
            // or - if we hit the background of the tab - the tab widget itself.
            // If we passed any click up to the model root, you could
            // longer click on widgets inside the tab or the tab itself.
            if (event.isAltDown())
                for (Parent parent = tabs.getParent();  parent != null;  parent = parent.getParent())
                    if (JFXRepresentation.MODEL_ROOT_ID.equals(parent.getId()))
                    {
                        parent.fireEvent(event);
                        break;
                    }
        });

    return tabs;
}
 
Example #21
Source File: RFXTabPane.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
protected void mousePressed(MouseEvent me) {
    Node target = (Node) me.getTarget();
    if (onCloseButton(target)) {
        recorder.recordSelect(this, getTextForTab((TabPane) node, getTab(target)) + "::close");
    }
}
 
Example #22
Source File: RFXTabPane.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
protected void mouseClicked(MouseEvent me) {
    TabPane tp = (TabPane) node;
    SingleSelectionModel<Tab> selectionModel = tp.getSelectionModel();
    Tab selectedTab = selectionModel.getSelectedItem();
    if (selectedTab != null && prevSelection != selectionModel.getSelectedIndex()) {
        recorder.recordSelect(this, getTextForTab(tp, selectedTab));
    }
    prevSelection = selectionModel.getSelectedIndex();
}
 
Example #23
Source File: FunctionTreeFactory.java    From zest-writer with GNU General Public License v3.0 5 votes vote down vote up
public static Tab getTabFromTextual(TabPane editorList, Textual textual) {

        Optional<Tab> find = editorList.getTabs().stream()
                .filter(t -> t.getId().equals(textual.getFilePath()))
                .findFirst();

        if (find.isPresent()) {
            return find.get();
        }
        return null;
    }
 
Example #24
Source File: DefaultActionHandlerFactory.java    From kafka-message-tool with MIT License 5 votes vote down vote up
@Override
public TemplateGuiActionsHandler<KafkaBrokerConfig> createBrokerConfigListViewActionHandler(AnchorPane rightContentPane,
                                                                                            TabPane masterTabPane,
                                                                                            Tab tab,
                                                                                            ListView<KafkaBrokerConfig> listView,
                                                                                            ControllerProvider repository) {
    return new BrokerConfigGuiActionsHandler(new TabPaneSelectionInformer(masterTabPane, tab),
                                             new ListViewActionsHandler<>(interactor, listView),
                                             interactor,
                                             modelDataProxy,
                                             repository,
                                             rightContentPane,
                                             appStage);
}
 
Example #25
Source File: BrowserConfigurationStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@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;

}
 
Example #26
Source File: BytecodeEditorPane.java    From Recaf with MIT License 5 votes vote down vote up
@Override
protected void setupBottomContent() {
	errorGraphic = new IconView("icons/error.png");
	stackHelper = new BytecodeStackHelper(this);
	stackHelper.getStyleClass().add("stack-helper");
	localHelper = new BytecodeLocalHelper(this);
	localHelper.getStyleClass().add("local-helper");
	split.setDividerPositions(DEFAULT_BOTTOM_DISPLAY_PERCENT);
	// Done in runLater so we have proper access to "isMethod"
	Platform.runLater(() -> {
		Tab tabErrors = new Tab(LangUtil.translate("misc.errors"));
		tabErrors.setGraphic(errorGraphic);
		tabErrors.setContent(errorList);
		tabErrors.setClosable(false);
		TabPane tabs = new TabPane();
		if (isMethod) {
			Tab tabStack = new Tab(LangUtil.translate("ui.edit.method.stackhelper"));
			tabStack.setGraphic(new IconView("icons/stack.png"));
			tabStack.setContent(stackHelper);
			tabStack.setClosable(false);
			Tab tabLocals = new Tab(LangUtil.translate("ui.bean.method.localvariables.name"));
			tabLocals.setGraphic(new IconView("icons/variable.png"));
			tabLocals.setContent(localHelper);
			tabLocals.setClosable(false);
			tabs.getTabs().addAll(tabErrors, tabStack, tabLocals);
		} else {
			tabs.getTabs().addAll(tabErrors);
		}
		bottomContent.setCenter(tabs);
		onErrorsReceived(null);
	});
}
 
Example #27
Source File: PortfolioView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void initialize() {
    root.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
    failedTradesTab.setClosable(false);

    openOffersTab.setText(Res.get("portfolio.tab.openOffers").toUpperCase());
    pendingTradesTab.setText(Res.get("portfolio.tab.pendingTrades").toUpperCase());
    closedTradesTab.setText(Res.get("portfolio.tab.history").toUpperCase());

    navigationListener = viewPath -> {
        if (viewPath.size() == 3 && viewPath.indexOf(PortfolioView.class) == 1)
            loadView(viewPath.tip());
    };

    tabChangeListener = (ov, oldValue, newValue) -> {
        if (newValue == openOffersTab)
            navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class);
        else if (newValue == pendingTradesTab)
            navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
        else if (newValue == closedTradesTab)
            navigation.navigateTo(MainView.class, PortfolioView.class, ClosedTradesView.class);
        else if (newValue == failedTradesTab)
            navigation.navigateTo(MainView.class, PortfolioView.class, FailedTradesView.class);
        else if (newValue == editOpenOfferTab) {
            navigation.navigateTo(MainView.class, PortfolioView.class, EditOfferView.class);
        }

        if (oldValue != null && oldValue == editOpenOfferTab)
            editOfferView.onTabSelected(false);

    };

    tabListChangeListener = change -> {
        change.next();
        List<? extends Tab> removedTabs = change.getRemoved();
        if (removedTabs.size() == 1 && removedTabs.get(0).equals(editOpenOfferTab))
            onEditOpenOfferRemoved();
    };
}
 
Example #28
Source File: DefaultModelConfigObjectsGuiInformer.java    From kafka-message-tool with MIT License 5 votes vote down vote up
public DefaultModelConfigObjectsGuiInformer(TabPane tabPane,
                                            ListView<KafkaBrokerConfig> brokersListView,
                                            ListView<KafkaTopicConfig> topicsListView,
                                            ListView<KafkaSenderConfig> messagesListView,
                                            ListView<KafkaListenerConfig> listenersListView) {
    this.tabPane = tabPane;
    this.brokersListView = brokersListView;
    this.topicsListView = topicsListView;
    this.messagesListView = messagesListView;
    this.listenersListView = listenersListView;

    bindToRemovedEventsListeners();
}
 
Example #29
Source File: JFXTabFolder.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public JFXTabFolder(JFXContainer<? extends Region> parent, boolean showClose) {
	super(new TabPane(), parent);
	
	this.tabs = new ArrayList<JFXTabItem>();
	this.closeListener = new UICloseListenerManager();
	this.selectionListener = new UISelectionListenerManager();
	
	this.getControl().setTabClosingPolicy(showClose ? TabClosingPolicy.ALL_TABS : TabClosingPolicy.UNAVAILABLE);
}
 
Example #30
Source File: DefaultActionHandlerFactory.java    From kafka-message-tool with MIT License 5 votes vote down vote up
@Override
public TemplateGuiActionsHandler<KafkaTopicConfig> createTopicConfigListViewActionHandler(AnchorPane rightContentPane,
                                                                                          TabPane masterTabPane,
                                                                                          Tab tab,
                                                                                          ListView<KafkaTopicConfig> listView,
                                                                                          ControllerProvider repository,
                                                                                          ListView<KafkaBrokerConfig> brokerConfigListView) {
    return new TopicConfigGuiActionsHandler(new TabPaneSelectionInformer(masterTabPane, tab),
                                            new ListViewActionsHandler<>(interactor, listView),
                                            modelDataProxy,
                                            repository,
                                            rightContentPane,
                                            brokerConfigListView);
}