Search in sources :

Example 1 with TabbedPane

use of com.revolsys.swing.TabbedPane in project com.revolsys.open by revolsys.

the class ProjectFrame method newTabLeftCatalogPanel.

protected void newTabLeftCatalogPanel() {
    final BaseTreeNode recordStores = RecordStoreConnectionTrees.newRecordStoreConnectionsTreeNode();
    final BaseTreeNode fileSystems = PathTreeNode.newFileSystemsTreeNode();
    final BaseTreeNode folderConnections = FolderConnectionsTrees.newFolderConnectionsTreeNode();
    final BaseTreeNode webServices = WebServiceConnectionTrees.newWebServiceConnectionsTreeNode();
    final ListTreeNode root = new ListTreeNode("/", recordStores, fileSystems, folderConnections, webServices);
    final BaseTree tree = new BaseTree(root);
    tree.setRootVisible(false);
    recordStores.expandChildren();
    fileSystems.expand();
    folderConnections.expandChildren();
    webServices.expandChildren();
    this.catalogTree = tree;
    final Icon icon = Icons.getIconWithBadge("folder", "tree");
    final TabbedPane tabs = this.leftTabs;
    final Component component = this.catalogTree;
    tabs.addTab(icon, "Catalog", component, true);
}
Also used : BaseTree(com.revolsys.swing.tree.BaseTree) BaseTreeNode(com.revolsys.swing.tree.BaseTreeNode) DnDTabbedPane(com.revolsys.swing.component.DnDTabbedPane) JTabbedPane(javax.swing.JTabbedPane) TabbedPane(com.revolsys.swing.TabbedPane) Icon(javax.swing.Icon) Component(java.awt.Component) JComponent(javax.swing.JComponent) ListTreeNode(com.revolsys.swing.tree.node.ListTreeNode)

Example 2 with TabbedPane

use of com.revolsys.swing.TabbedPane in project com.revolsys.open by revolsys.

the class ProjectFrame method addBottomTab.

public void addBottomTab(final ProjectFramePanel panel, final Map<String, Object> config) {
    Invoke.later(() -> {
        final TabbedPane tabs = getBottomTabs();
        final Object tableView = panel.getProperty(BOTTOM_TAB);
        Component component = null;
        if (tableView instanceof Component) {
            component = (Component) tableView;
            if (component.getParent() != tabs) {
                component = null;
            }
        }
        if (component == null) {
            component = panel.newPanelComponent(config);
            if (component != null) {
                final Component panelComponent = component;
                panel.activatePanelComponent(panelComponent, config);
                final int tabIndex = tabs.getTabCount();
                panel.setPropertyWeak(BOTTOM_TAB, panelComponent);
                final String layerPath = panel.getPath();
                final Runnable closeAction = () -> removeBottomTab(panel);
                synchronized (this.bottomTabLayerPaths) {
                    this.bottomTabLayerPaths.add(layerPath);
                }
                final String name = panel.getName();
                final Icon icon = panel.getIcon();
                final TabClosableTitle tab = tabs.addClosableTab(name, icon, panelComponent, closeAction);
                tab.setMenu(panel);
                tabs.setSelectedIndex(tabIndex);
                panel.setPropertyWeak(BOTTOM_TAB_LISTENER, // 
                Arrays.asList(EventQueue.addPropertyChange(panel, "name", () -> {
                    final int index = tabs.indexOfComponent(panelComponent);
                    if (index != -1) {
                        final String newName = panel.getName();
                        tabs.setTitleAt(index, newName);
                    }
                }), // 
                EventQueue.addPropertyChange(panel, "icon", () -> {
                    final int index = tabs.indexOfComponent(panelComponent);
                    if (index != -1) {
                        final Icon newName = panel.getIcon();
                        tabs.setIconAt(index, newName);
                    }
                })));
            }
        } else {
            panel.activatePanelComponent(component, config);
            tabs.setSelectedComponent(component);
        }
    });
}
Also used : DnDTabbedPane(com.revolsys.swing.component.DnDTabbedPane) JTabbedPane(javax.swing.JTabbedPane) TabbedPane(com.revolsys.swing.TabbedPane) Icon(javax.swing.Icon) TabClosableTitle(com.revolsys.swing.component.TabClosableTitle) Component(java.awt.Component) JComponent(javax.swing.JComponent)

Aggregations

TabbedPane (com.revolsys.swing.TabbedPane)2 DnDTabbedPane (com.revolsys.swing.component.DnDTabbedPane)2 Component (java.awt.Component)2 Icon (javax.swing.Icon)2 JComponent (javax.swing.JComponent)2 JTabbedPane (javax.swing.JTabbedPane)2 TabClosableTitle (com.revolsys.swing.component.TabClosableTitle)1 BaseTree (com.revolsys.swing.tree.BaseTree)1 BaseTreeNode (com.revolsys.swing.tree.BaseTreeNode)1 ListTreeNode (com.revolsys.swing.tree.node.ListTreeNode)1