Search in sources :

Example 1 with AbstractTableBrowser

use of org.cytoscape.browser.internal.view.AbstractTableBrowser in project cytoscape-impl by cytoscape.

the class ClearErrorsEdit method getBrowserTable.

public static BrowserTable getBrowserTable(final CyTable table, final CyServiceRegistrar serviceRegistrar) {
    final CySwingApplication swingAppManager = serviceRegistrar.getService(CySwingApplication.class);
    final CytoPanel cytoPanel = swingAppManager.getCytoPanel(CytoPanelName.SOUTH);
    if (cytoPanel != null) {
        final int count = cytoPanel.getCytoPanelComponentCount();
        for (int i = 0; i < count; i++) {
            final Component c = cytoPanel.getComponentAt(i);
            if (c instanceof AbstractTableBrowser) {
                final AbstractTableBrowser tableBrowser = (AbstractTableBrowser) c;
                final BrowserTable browserTable = tableBrowser.getBrowserTable(table);
                if (browserTable != null)
                    return browserTable;
            }
        }
    }
    return null;
}
Also used : CySwingApplication(org.cytoscape.application.swing.CySwingApplication) AbstractTableBrowser(org.cytoscape.browser.internal.view.AbstractTableBrowser) BrowserTable(org.cytoscape.browser.internal.view.BrowserTable) CytoPanel(org.cytoscape.application.swing.CytoPanel) Component(java.awt.Component)

Example 2 with AbstractTableBrowser

use of org.cytoscape.browser.internal.view.AbstractTableBrowser in project cytoscape-impl by cytoscape.

the class SetColumnFormatTask method getBrowserTable.

public static BrowserTable getBrowserTable(final CyTable table, final CyServiceRegistrar serviceRegistrar) {
    final CySwingApplication swingAppManager = serviceRegistrar.getService(CySwingApplication.class);
    final CytoPanel cytoPanel = swingAppManager.getCytoPanel(CytoPanelName.SOUTH);
    if (cytoPanel != null) {
        final int count = cytoPanel.getCytoPanelComponentCount();
        for (int i = 0; i < count; i++) {
            final Component c = cytoPanel.getComponentAt(i);
            if (c instanceof AbstractTableBrowser) {
                final AbstractTableBrowser tableBrowser = (AbstractTableBrowser) c;
                final BrowserTable browserTable = tableBrowser.getBrowserTable(table);
                if (browserTable != null)
                    return browserTable;
            }
        }
    }
    return null;
}
Also used : CySwingApplication(org.cytoscape.application.swing.CySwingApplication) AbstractTableBrowser(org.cytoscape.browser.internal.view.AbstractTableBrowser) BrowserTable(org.cytoscape.browser.internal.view.BrowserTable) CytoPanel(org.cytoscape.application.swing.CytoPanel) Component(java.awt.Component)

Example 3 with AbstractTableBrowser

use of org.cytoscape.browser.internal.view.AbstractTableBrowser in project cytoscape-impl by cytoscape.

the class CyActivator method start.

@Override
public void start(BundleContext bc) {
    CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
    PopupMenuHelper popupMenuHelper = new PopupMenuHelper(serviceRegistrar);
    AbstractTableBrowser nodeTableBrowser = new DefaultTableBrowser("Node Table", CyNode.class, serviceRegistrar, popupMenuHelper);
    AbstractTableBrowser edgeTableBrowser = new DefaultTableBrowser("Edge Table", CyEdge.class, serviceRegistrar, popupMenuHelper);
    AbstractTableBrowser networkTableBrowser = new DefaultTableBrowser("Network Table", CyNetwork.class, serviceRegistrar, popupMenuHelper);
    AbstractTableBrowser globalTableBrowser = new GlobalTableBrowser("Unassigned Tables", serviceRegistrar, popupMenuHelper);
    registerAllServices(bc, nodeTableBrowser, new Properties());
    registerAllServices(bc, edgeTableBrowser, new Properties());
    registerAllServices(bc, networkTableBrowser, new Properties());
    final Properties globalTableProp = new Properties();
    registerService(bc, globalTableBrowser, ActionListener.class, globalTableProp);
    registerService(bc, globalTableBrowser, SessionLoadedListener.class, globalTableProp);
    registerService(bc, globalTableBrowser, SessionAboutToBeSavedListener.class, globalTableProp);
    registerService(bc, globalTableBrowser, TableAboutToBeDeletedListener.class, globalTableProp);
    registerService(bc, globalTableBrowser, TableAddedListener.class, globalTableProp);
    registerService(bc, globalTableBrowser, TablePrivacyChangedListener.class, globalTableProp);
    registerService(bc, globalTableBrowser, RowsSetListener.class, globalTableProp);
    registerService(bc, globalTableBrowser, RowsDeletedListener.class, globalTableProp);
    registerServiceListener(bc, popupMenuHelper::addTableColumnTaskFactory, popupMenuHelper::removeTableColumnTaskFactory, TableColumnTaskFactory.class);
    registerServiceListener(bc, popupMenuHelper::addTableCellTaskFactory, popupMenuHelper::removeTableCellTaskFactory, TableCellTaskFactory.class);
    {
        ClearAllErrorsTaskFactory taskFactory = new ClearAllErrorsTaskFactory(serviceRegistrar);
        Properties props = new Properties();
        props.setProperty(TITLE, "Clear all errors");
        registerService(bc, taskFactory, TableColumnTaskFactory.class, props);
    }
    {
        SetColumnFormatTaskFactory taskFactory = new SetColumnFormatTaskFactory(serviceRegistrar);
        Properties props = new Properties();
        props.setProperty(TITLE, "Format column...");
        registerService(bc, taskFactory, TableColumnTaskFactory.class, props);
    }
}
Also used : PopupMenuHelper(org.cytoscape.browser.internal.view.PopupMenuHelper) GlobalTableBrowser(org.cytoscape.browser.internal.view.GlobalTableBrowser) AbstractTableBrowser(org.cytoscape.browser.internal.view.AbstractTableBrowser) SetColumnFormatTaskFactory(org.cytoscape.browser.internal.task.SetColumnFormatTaskFactory) TableColumnTaskFactory(org.cytoscape.task.TableColumnTaskFactory) ClearAllErrorsTaskFactory(org.cytoscape.browser.internal.task.ClearAllErrorsTaskFactory) DefaultTableBrowser(org.cytoscape.browser.internal.view.DefaultTableBrowser) Properties(java.util.Properties) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar)

Aggregations

AbstractTableBrowser (org.cytoscape.browser.internal.view.AbstractTableBrowser)3 Component (java.awt.Component)2 CySwingApplication (org.cytoscape.application.swing.CySwingApplication)2 CytoPanel (org.cytoscape.application.swing.CytoPanel)2 BrowserTable (org.cytoscape.browser.internal.view.BrowserTable)2 Properties (java.util.Properties)1 ClearAllErrorsTaskFactory (org.cytoscape.browser.internal.task.ClearAllErrorsTaskFactory)1 SetColumnFormatTaskFactory (org.cytoscape.browser.internal.task.SetColumnFormatTaskFactory)1 DefaultTableBrowser (org.cytoscape.browser.internal.view.DefaultTableBrowser)1 GlobalTableBrowser (org.cytoscape.browser.internal.view.GlobalTableBrowser)1 PopupMenuHelper (org.cytoscape.browser.internal.view.PopupMenuHelper)1 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)1 TableColumnTaskFactory (org.cytoscape.task.TableColumnTaskFactory)1