Search in sources :

Example 16 with ProjectController

use of org.gephi.project.api.ProjectController in project gephi by gephi.

the class ProjectPropertiesEditor method save.

public void save(Project project) {
    ProjectInformation info = project.getLookup().lookup(ProjectInformation.class);
    if (info != null) {
        if (!nameTextField.getText().isEmpty() && !nameTextField.getText().equals(info.getName())) {
            ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
            pc.renameProject(project, nameTextField.getText());
        }
    }
    ProjectMetaData metaData = project.getLookup().lookup(ProjectMetaData.class);
    if (metaData != null) {
        metaData.setTitle(titleTextField.getText());
        metaData.setAuthor(authorTextField.getText());
        metaData.setKeywords(keywordsTextField.getText());
        metaData.setDescription(descriptionTextArea.getText());
    }
}
Also used : ProjectMetaData(org.gephi.project.api.ProjectMetaData) ProjectInformation(org.gephi.project.api.ProjectInformation) ProjectController(org.gephi.project.api.ProjectController)

Example 17 with ProjectController

use of org.gephi.project.api.ProjectController 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)

Example 18 with ProjectController

use of org.gephi.project.api.ProjectController in project gephi by gephi.

the class Installer method initGephi.

private void initGephi() {
    final ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    WindowManager.getDefault().invokeWhenUIReady(new Runnable() {

        @Override
        public void run() {
            pc.startup();
            DragNDropFrameAdapter.register();
        }
    });
}
Also used : ProjectController(org.gephi.project.api.ProjectController)

Example 19 with ProjectController

use of org.gephi.project.api.ProjectController in project gephi by gephi.

the class RenameWorkspace method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    String name = "";
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    name = pc.getCurrentWorkspace().getLookup().lookup(WorkspaceInformation.class).getName();
    DialogDescriptor.InputLine dd = new DialogDescriptor.InputLine("", NbBundle.getMessage(RenameWorkspace.class, "RenameWorkspace.dialog.title"));
    dd.setInputText(name);
    if (DialogDisplayer.getDefault().notify(dd).equals(DialogDescriptor.OK_OPTION) && !dd.getInputText().isEmpty()) {
        Lookup.getDefault().lookup(ProjectControllerUI.class).renameWorkspace(dd.getInputText());
    }
}
Also used : DialogDescriptor(org.openide.DialogDescriptor) ProjectController(org.gephi.project.api.ProjectController) ProjectControllerUI(org.gephi.desktop.project.api.ProjectControllerUI)

Example 20 with ProjectController

use of org.gephi.project.api.ProjectController in project gephi by gephi.

the class VizController method initInstances.

public void initInstances() {
    vizConfig = new VizConfig();
    graphIO = new StandardGraphIO();
    engine = new CompatibilityEngine();
    vizEventManager = new StandardVizEventManager();
    scheduler = new CompatibilityScheduler();
    limits = new GraphLimits();
    dataBridge = new DataBridge();
    textManager = new TextManager();
    screenshotMaker = new ScreenshotMaker();
    currentModel = new VizModel(true);
    selectionManager = new SelectionManager();
    if (vizConfig.isUseGLJPanel()) {
    //No more supported
    } else if (Utilities.isMac()) {
        drawable = createCanvas();
    } else {
        drawable = createNewtCanvas();
    }
    drawable.initArchitecture();
    engine.initArchitecture();
    ((CompatibilityScheduler) scheduler).initArchitecture();
    ((StandardGraphIO) graphIO).initArchitecture();
    dataBridge.initArchitecture();
    textManager.initArchitecture();
    screenshotMaker.initArchitecture();
    vizEventManager.initArchitecture();
    selectionManager.initArchitecture();
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    pc.addWorkspaceListener(new WorkspaceListener() {

        @Override
        public void initialize(Workspace workspace) {
            if (workspace.getLookup().lookup(VizModel.class) == null) {
                workspace.add(new VizModel(workspace));
            }
        }

        @Override
        public void select(Workspace workspace) {
            engine.reinit();
        }

        @Override
        public void unselect(Workspace workspace) {
        }

        @Override
        public void close(Workspace workspace) {
        }

        @Override
        public void disable() {
            engine.reinit();
        }
    });
    if (pc.getCurrentWorkspace() != null) {
        engine.reinit();
    }
}
Also used : SelectionManager(org.gephi.visualization.api.selection.SelectionManager) CompatibilityEngine(org.gephi.visualization.opengl.CompatibilityEngine) TextManager(org.gephi.visualization.text.TextManager) StandardVizEventManager(org.gephi.visualization.events.StandardVizEventManager) CompatibilityScheduler(org.gephi.visualization.scheduler.CompatibilityScheduler) ProjectController(org.gephi.project.api.ProjectController) WorkspaceListener(org.gephi.project.api.WorkspaceListener) StandardGraphIO(org.gephi.visualization.swing.StandardGraphIO) ScreenshotMaker(org.gephi.visualization.screenshot.ScreenshotMaker) VizConfig(org.gephi.visualization.apiimpl.VizConfig) DataBridge(org.gephi.visualization.bridge.DataBridge) Workspace(org.gephi.project.api.Workspace)

Aggregations

ProjectController (org.gephi.project.api.ProjectController)22 Workspace (org.gephi.project.api.Workspace)11 ProjectControllerUI (org.gephi.desktop.project.api.ProjectControllerUI)4 ContainerUnloader (org.gephi.io.importer.api.ContainerUnloader)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)2 JPanel (javax.swing.JPanel)2 GraphController (org.gephi.graph.api.GraphController)2 GraphModel (org.gephi.graph.api.GraphModel)2 WorkspaceInformation (org.gephi.project.api.WorkspaceInformation)2 WorkspaceListener (org.gephi.project.api.WorkspaceListener)2 WorkspaceProvider (org.gephi.project.api.WorkspaceProvider)2 DialogDescriptor (org.openide.DialogDescriptor)2 BorderLayout (java.awt.BorderLayout)1 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1