Search in sources :

Example 1 with TabData

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();
            }
        }
    });
}
Also used : WorkspaceInformation(org.gephi.project.api.WorkspaceInformation) TabData(org.netbeans.swing.tabcontrol.TabData)

Example 2 with TabData

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);
    }
}
Also used : WorkspaceInformation(org.gephi.project.api.WorkspaceInformation) WorkspaceProvider(org.gephi.project.api.WorkspaceProvider) TabData(org.netbeans.swing.tabcontrol.TabData) ProjectController(org.gephi.project.api.ProjectController) Workspace(org.gephi.project.api.Workspace)

Aggregations

WorkspaceInformation (org.gephi.project.api.WorkspaceInformation)2 TabData (org.netbeans.swing.tabcontrol.TabData)2 ProjectController (org.gephi.project.api.ProjectController)1 Workspace (org.gephi.project.api.Workspace)1 WorkspaceProvider (org.gephi.project.api.WorkspaceProvider)1