use of org.netbeans.swing.tabcontrol.TabData in project gephi by gephi.
the class WorkspacePanel method initialize.
// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
@Override
public void initialize(final Workspace workspace) {
final WorkspaceInformation workspaceInformation = workspace.getLookup().lookup(WorkspaceInformation.class);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
tabDataModel.addTab(tabDataModel.size(), new TabData(new WorkspaceComponent(workspace), workspaceIcon, workspaceInformation.getName(), workspaceInformation.getSource()));
if (tabDataModel.size() == 1) {
tabbedContainer.getSelectionModel().setSelectedIndex(0);
add(tabbedContainer, BorderLayout.CENTER);
getParent().revalidate();
}
}
});
}
use of org.netbeans.swing.tabcontrol.TabData in project gephi by gephi.
the class WorkspacePanel method refreshModel.
private synchronized void refreshModel() {
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
if (pc.getCurrentProject() != null) {
WorkspaceProvider workspaceProvider = pc.getCurrentProject().getLookup().lookup(WorkspaceProvider.class);
Workspace[] workspaces = workspaceProvider.getWorkspaces();
if (workspaces.length > 0) {
for (Workspace workspace : workspaces) {
int index = tabDataModel.size();
WorkspaceInformation workspaceInformation = workspace.getLookup().lookup(WorkspaceInformation.class);
tabDataModel.addTab(index, new TabData(new WorkspaceComponent(workspace), null, workspaceInformation.getName(), workspaceInformation.getSource()));
if (workspaceProvider.getCurrentWorkspace() == workspace) {
tabbedContainer.getSelectionModel().setSelectedIndex(index);
workspace.getLookup().lookup(WorkspaceInformation.class).addChangeListener(this);
}
}
return;
}
}
// Clear
tabbedContainer.getSelectionModel().clearSelection();
if (tabDataModel.size() > 0) {
tabDataModel.removeTabs(0, tabDataModel.size() - 1);
}
}
Aggregations