Java Code Examples for javafx.scene.control.Tab#getContent()

The following examples show how to use javafx.scene.control.Tab#getContent() . 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: HighlightManager.java    From CPUSim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks the addresses of the given RAM and if they have a non-null
 * SourceLine, then bring the text window to front and highlight those
 * rows.
 * Displays an error message if the text file doesn't exist or if
 * the desired line of the file does not exist.
 *
 * @param ram       the RAM with the SourceLines to be highlighted
 * @param addresses the addresses of the cells whose SourceLines are to be highlighted
 */
private void highlightText(RAM ram, int[] addresses) {
    for (int address : addresses) {
        SourceLine sourceLine = ram.getSourceLine(address);
        if (sourceLine != null) {
            File file = new File(sourceLine.getFileName());
            if (!file.canRead()) {
                Dialogs.createErrorDialog(desktop.getStage(), "File Not Found",
                        "CPU Sim could not find the file to open and highlight:  " +
                                file.getAbsolutePath()).showAndWait();
                return;
            }
            Tab newTabForFile = desktop.getTabForFile(file);
            InlineStyleTextArea text = (InlineStyleTextArea) newTabForFile.getContent();
            int line = sourceLine.getLine();
            int start = getLineStartOffset(text.getText(), line);
            int end = getLineEndOffset(text.getText(), line);
            text.selectRange(start, end);

            //window.highlightAndScrollToLine(sourceLine.getLine());

        }
    }
}
 
Example 2
Source File: AllFilesViewerController.java    From standalone-app with Apache License 2.0 6 votes vote down vote up
private void openNewEditor(Tab fileTab, EditorView editor) {
    FileTabProperties properties = (FileTabProperties) fileTab.getUserData();
    TabPane filePane = (TabPane) fileTab.getContent();
    if (properties.getOpenedEditors().containsKey(editor.getDisplayName())) {
        Tab tab = properties.getOpenedEditors().get(editor.getDisplayName());
        filePane.getSelectionModel().select(tab);
        return;
    }
    Tab editorTab = new Tab(editor.getDisplayName());
    editorTab.setContent(editor.createView(properties.getFile(), properties.getPath()));
    editorTab.setOnClosed(event -> {
        properties.getOpenedEditors().remove(editor.getDisplayName());
    });
    filePane.getTabs().add(editorTab);
    filePane.getSelectionModel().select(editorTab);
    properties.getOpenedEditors().put(editor.getDisplayName(), editorTab);
}
 
Example 3
Source File: DefaultModelConfigObjectsGuiInformer.java    From kafka-message-tool with MIT License 6 votes vote down vote up
@Override
public ModelConfigObject selectedObject() {

    final Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();
    final ListView<?> listView = (ListView<?>) selectedTab.getContent();

    if (listView == brokersListView) {
        return brokersListView.getSelectionModel().getSelectedItem();
    } else if (listView == topicsListView) {
        return topicsListView.getSelectionModel().getSelectedItem();
    } else if (listView == messagesListView) {
        return messagesListView.getSelectionModel().getSelectedItem();
    } else if (listView == listenersListView) {
        return listenersListView.getSelectionModel().getSelectedItem();
    }

    return null;
}
 
Example 4
Source File: MarketView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void loadView(Class<? extends View> viewClass) {
    final Tab tab;
    View view = viewLoader.load(viewClass);

    if (view instanceof OfferBookChartView) tab = offerBookTab;
    else if (view instanceof TradesChartsView) tab = tradesTab;
    else if (view instanceof SpreadView) tab = spreadTab;
    else throw new IllegalArgumentException("Navigation to " + viewClass + " is not supported");

    if (tab.getContent() != null && tab.getContent() instanceof ScrollPane) {
        ((ScrollPane) tab.getContent()).setContent(view.getRoot());
    } else {
        tab.setContent(view.getRoot());
    }
    root.getSelectionModel().select(tab);
}
 
Example 5
Source File: SettingsView.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
private void loadView(Class<? extends View> viewClass) {
    final Tab tab;
    View view = viewLoader.load(viewClass);

    if (view instanceof PreferencesView) tab = preferencesTab;
    else if (view instanceof NetworkSettingsView) tab = networkTab;
    else if (view instanceof AboutView) tab = aboutTab;
    else throw new IllegalArgumentException("Navigation to " + viewClass + " is not supported");

    if (tab.getContent() != null && tab.getContent() instanceof ScrollPane) {
        ((ScrollPane) tab.getContent()).setContent(view.getRoot());
    } else {
        tab.setContent(view.getRoot());
    }
    root.getSelectionModel().select(tab);
}
 
Example 6
Source File: TabDockingContainer.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public void getDockables(List<DockableState> dockables) {
    ObservableList<Tab> tabs = getTabs();
    for (Tab tab : tabs) {
        if (tab.getContent() instanceof IDockingContainer) {
            ((IDockingContainer) tab.getContent()).getDockables(dockables);
        } else {
            for (Dockable dockable : this.dockables) {
                Node component = dockable.getComponent();
                Node content = tab.getContent();
                if (component == content) {
                    dockables.add(dockable.getDockableState());
                }
            }
        }
    }
}
 
Example 7
Source File: HighlightManager.java    From CPUSim with GNU General Public License v3.0 5 votes vote down vote up
private void unhighlightBreakInText(RAM ram, int breakAddress) {
    SourceLine sourceLine = ram.getSourceLine(breakAddress);
    if (sourceLine != null) {
        File file = new File(sourceLine.getFileName());
        if (!file.canRead()) {
            return;
        }
        Tab tabForFile = desktop.getTabForFile(file);
        InlineStyleTextArea text = (InlineStyleTextArea) tabForFile.getContent();
        LineNumAndBreakpointFactory lFactory =
                (LineNumAndBreakpointFactory) text.getParagraphGraphicFactory();
        // change the background of the label in left column back to the original color
        lFactory.setCurrentBreakPointLineNumber(-1);
    }
}
 
Example 8
Source File: ConfigurationPane.java    From constellation with Apache License 2.0 5 votes vote down vote up
public void createNewRun(final Map<String, Attribute> vertexAttributes, final Map<String, Attribute> transactionAttributes, final Set<Integer> keys, final String[] columns, final List<String[]> data) {
    final Tab tab = createTab();
    RunPane runPane = (RunPane) tab.getContent();
    runPane.requestLayout();

    Platform.runLater(() -> {
        RunPane runPane1 = (RunPane) tab.getContent();
        runPane1.setDisplayedAttributes(vertexAttributes, transactionAttributes, keys);
        runPane1.setSampleData(columns, createTableRows(data));
    });
}
 
Example 9
Source File: FxDockTabPane.java    From FxDock with Apache License 2.0 5 votes vote down vote up
public Node removeTab(int ix)
{
	Tab t = getTabs().remove(ix);
	Node n = t.getContent();
	DockTools.setParent(null, n);
	return n;
}
 
Example 10
Source File: ViewportTabs.java    From Recaf with MIT License 5 votes vote down vote up
/**
 * @param name
 * 		Name of class to check.
 *
 * @return Viewport of the class.
 */
public ClassViewport getClassViewport(String name) {
	if(nameToTab.containsKey(name)) {
		// Select the tab
		Tab tab = nameToTab.get(name);
		select(tab);
		return (ClassViewport) tab.getContent();
	}
	return null;
}
 
Example 11
Source File: TabsRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void updateChanges()
{
    super.updateChanges();

    if (dirty_layout.checkAndClear())
    {
        final String style = JFXUtil.shadedStyle(model_widget.propBackgroundColor().getValue());

        final Background background = new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), null, null));

        for (Tab tab : jfx_node.getTabs())
        {   // Set the font of the 'graphic' that's used to represent the tab
            final Label label = (Label) tab.getGraphic();
            label.setFont(tab_font);

            // Set colors
            tab.setStyle(style);

            final Pane content  = (Pane) tab.getContent();
            content.setBackground(background);
        }

        final Integer width = model_widget.propWidth().getValue();
        final Integer height = model_widget.propHeight().getValue();
        jfx_node.setPrefSize(width, height);
        jfx_node.setTabMinHeight(model_widget.propTabHeight().getValue());

        refreshHack();
    }
}
 
Example 12
Source File: TabDockingContainer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void setSelectedDockable(Dockable dockable) {
    ObservableList<Tab> tabs = getTabs();
    for (Tab tab : tabs) {
        if (tab.getContent() == dockable.getComponent()) {
            getSelectionModel().select(tab);
        }
    }
}
 
Example 13
Source File: TabDockingContainer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private int findIndex(Dockable dockable) {
    ObservableList<Tab> tabs = getTabs();
    int index = 0;
    for (Tab tab : tabs) {
        if (tab.getContent() == dockable.getComponent()) {
            return index;
        }
        index++;
    }
    return -1;
}
 
Example 14
Source File: TabDockingContainer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public Dockable getSelectedDockable() {
    Tab selected = getSelectionModel().getSelectedItem();
    if (selected != null) {
        for (Dockable dockable : dockables) {
            if (dockable.getComponent() == selected.getContent()) {
                return dockable;
            }
        }
    }
    return null;
}
 
Example 15
Source File: TabDockingContainer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void debugPrint(String indent) {
    System.out.println(indent + "tab(" + getProperties().get(DockingDesktop.DOCKING_CONTAINER) + ")");
    ObservableList<Tab> tabs = getTabs();
    for (Tab tab : tabs) {
        if (tab.getContent() instanceof IDockingContainer) {
            ((IDockingContainer) tab.getContent()).debugPrint(indent + "  ");
        } else {
            System.out.println(indent + "  " + tab.getText());
        }
    }
}
 
Example 16
Source File: TabDockingContainer.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void changed(ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
    Dockable o = null, n = null;
    for (Dockable d : dockables) {
        if (oldValue != null && oldValue.getContent() == d.getComponent()) {
            o = d;
        }
        if (newValue != null && newValue.getContent() == d.getComponent()) {
            n = d;
        }
    }
    desktop.fireDockableSelectionEvent(o, n);
}
 
Example 17
Source File: ConfigurationPane.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a combined collection of all attributes that have been allocated
 * to a column in any run.
 *
 * @return a combined collection of all attributes that have been allocated
 * to a column in any run.
 */
public Collection<Attribute> getAllocatedAttributes() {
    List<Attribute> allocatedAttributes = new ArrayList<>();
    for (Tab tab : tabPane.getTabs()) {
        RunPane runPane = (RunPane) tab.getContent();
        allocatedAttributes.addAll(runPane.getAllocatedAttributes());
    }

    return allocatedAttributes;
}
 
Example 18
Source File: ConfigurationPane.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * A List&lt;ImportDefinition&gt; where each list element corresponds to a
 * RunPane tab.
 *
 * @return A List&lt;ImportDefinition&gt; where each list element
 * corresponds to a RunPane tab.
 */
public List<ImportDefinition> createDefinitions() {
    List<ImportDefinition> definitions = new ArrayList<>(tabPane.getTabs().size());

    for (Tab tab : tabPane.getTabs()) {
        RunPane runPane = (RunPane) tab.getContent();
        definitions.add(runPane.createDefinition());
    }

    return Collections.unmodifiableList(definitions);
}
 
Example 19
Source File: ShipController.java    From logbook-kai with MIT License 5 votes vote down vote up
/**
 * 画面の更新
 *
 * @param e ActionEvent
 */
void update(ActionEvent e) {
    Tab selectedTab = this.tab.getSelectionModel()
            .getSelectedItem();
    if (selectedTab != null) {
        Node content = selectedTab.getContent();
        if (content instanceof ShipTablePane) {
            ((ShipTablePane) content).update();
        }
    }
}
 
Example 20
Source File: ConfigurationPane.java    From constellation with Apache License 2.0 4 votes vote down vote up
public void setDisplayedAttributes(Map<String, Attribute> vertexAttributes, Map<String, Attribute> transactionAttributes, Set<Integer> keys) {
    for (Tab tab : tabPane.getTabs()) {
        RunPane runPane = (RunPane) tab.getContent();
        runPane.setDisplayedAttributes(vertexAttributes, transactionAttributes, keys);
    }
}