Overview
This feature provides a reusable, paginated StyledJTable UI designed to work with external data providers. Developers can plug in their own data sources by implementing a simple interface and configuring the desired table columns.
Functional Requirements
- To have a similar UI for all the external data providers that are integrated as an IGB App.
- Make the UI extendable for any type of provider with custom table columns, search functionality, and load action.
Technical Implementation
This feature is implemented in the igb-services-api module. Classes that are part of this feature:
- GenomeDynamicSearchTable - a class that extends StyledJTable and defines how the columns should be displayed, especially the default columns, load, and info.
- GenomeDynamicSearchTableModel - Custom AbstractTableModel that uses the data provider interface instance to dynamically populate the table and perform actions.
- ExternalGenomeDataProvider - An interface that has all the methods that need to be implemented by any class that wants to extend this UI.
- ExternalGenomeData - A general-purpose structure used to represent each row of the table. This is passed to/from the data provider.
- GenomeDynamicSearchTableGUI - JPanel class that has all the UI components, including the custom JTable. It has below features:
- Dynamic, paginated table UI with grouped page navigation (< 1 2 3 >)
- Optional search functionality to filter table data based on user input
- Column sorting support — click any column header to sort data
- Results summary label (e.g., 1–10 of 250 results) for clarity
- Has the GenomeDynamicSearchTable, which includes customizable columns and data using the ExternalGenomeDataProvider interface, and also includes built-in "Load" button and "Info" icon actions for each row
- Responsive column sizing based on content and header length
How to Use/Extend in a Plugin App
Below are the steps that can be used to create a Plugin app and use this extendable UI to add an external data provider as an IGB app. You can use the ucsc-genark-data-provider plugin app as a reference at any point.
- Create a new module using this documentation: https://wiki.bioviz.org/confluence/display/igbdevelopers/Hello+World+IGB+App
- Include these dependencies in the pom to extend IgbTabPanel to add the app as a tab in IGB. Make sure the IGB_VERSION is 10.2.0 or higher.
pom.xml
<dependency> <groupId>org.lorainelab.igb</groupId> <artifactId>igbSwingExt</artifactId> <version>${IGB_VERSION}</version> </dependency> <dependency> <groupId>org.lorainelab.igb</groupId> <artifactId>igb-services</artifactId> <version>${IGB_VERSION}</version> </dependency>
- Create a class, CustomDataProvider, and implement the ExternalGenomeDataProvider interface to provide implementation for all the methods.
- Now, create a class to extend the IgbTabPanel like below to add the app as a tab:
CustomDataProviderTabPanel.java
package org.lorainelab.igb.custom.data.provider; import org.lorainelab.igb.services.dynamic.search.GenomeDynamicSearchTableGUI; import org.lorainelab.igb.services.window.tabs.IgbTabPanel; import org.lorainelab.igb.services.window.tabs.IgbTabPanelI; import org.osgi.service.component.annotations.Component; import java.awt.BorderLayout; @Component(service = {IgbTabPanelI.class}, immediate = true) public class CustomDataProviderTabPanel extends IgbTabPanel { private final CustomDataProvider customDataProvider = new CustomDataProvider(); private final GenomeDynamicSearchTableGUI dynamicSearchTableGUI = new GenomeDynamicSearchTableGUI(customDataProvider); public CustomDataProviderTabPanel() { super("Custom Data Provider", "Custom Data Provider", null, false, 8); init(); } private void init() { this.setLayout(new BorderLayout()); this.add(dynamicSearchTableGUI); this.pack(); } }