Package org.gephi.tools.api

Examples of org.gephi.tools.api.ToolController


    private JComponent toolbar;
    private JComponent propertiesBar;
    private AddonsBar addonsBar;

    private void initToolPanels() {
        ToolController tc = Lookup.getDefault().lookup(ToolController.class);
        if (tc != null) {
            if (VizController.getInstance().getVizConfig().isToolbar()) {
                JPanel westPanel = new JPanel(new BorderLayout(0, 0));
                if (UIUtils.isAquaLookAndFeel()) {
                    westPanel.setBackground(UIManager.getColor("NbExplorerView.background"));
                }

                toolbar = tc.getToolbar();
                if (toolbar != null) {
                    westPanel.add(toolbar, BorderLayout.CENTER);
                }
                selectionToolbar = new SelectionToolbar();
                actionsToolbar = new ActionsToolbar();

                westPanel.add(selectionToolbar, BorderLayout.NORTH);
                westPanel.add(actionsToolbar, BorderLayout.SOUTH);
                add(westPanel, BorderLayout.WEST);
            }

            if (VizController.getInstance().getVizConfig().isPropertiesbar()) {
                JPanel northBar = new JPanel(new BorderLayout());
                if (UIUtils.isAquaLookAndFeel()) {
                    northBar.setBackground(UIManager.getColor("NbExplorerView.background"));
                }
                propertiesBar = tc.getPropertiesBar();
                if (propertiesBar != null) {
                    northBar.add(propertiesBar, BorderLayout.CENTER);
                }
                addonsBar = new AddonsBar();
                for (PropertiesBarAddon addon : Lookup.getDefault().lookupAll(PropertiesBarAddon.class)) {
View Full Code Here


    private ActionsToolbar actionsToolbar;
    private JComponent toolbar;
    private JComponent propertiesBar;

    private void initToolPanels() {
        final ToolController tc = Lookup.getDefault().lookup(ToolController.class);
        if (tc != null) {
            if (VizController.getInstance().getVizConfig().isToolbar()) {
                JPanel westPanel = new JPanel(new BorderLayout(0, 0));
                if (UIUtils.isAquaLookAndFeel()) {
                    westPanel.setBackground(UIManager.getColor("NbExplorerView.background"));
                }

                toolbar = tc.getToolbar();
                if (toolbar != null) {
                    westPanel.add(toolbar, BorderLayout.CENTER);
                }
                selectionToolbar = new SelectionToolbar();
                actionsToolbar = new ActionsToolbar();

                westPanel.add(selectionToolbar, BorderLayout.NORTH);
                westPanel.add(actionsToolbar, BorderLayout.SOUTH);
                add(westPanel, BorderLayout.WEST);
            }

            if (VizController.getInstance().getVizConfig().isPropertiesbar()) {
                propertiesBar = tc.getPropertiesBar();
                if (propertiesBar != null) {
                    add(propertiesBar, BorderLayout.NORTH);
                }
            }
        }

        //Workspace events
        ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
        projectController.addWorkspaceListener(new WorkspaceListener() {
            @Override
            public void initialize(Workspace workspace) {
            }

            @Override
            public void select(Workspace workspace) {
                if (toolbar != null) {
                    toolbar.setEnabled(true);
                }
                if (propertiesBar != null) {
                    propertiesBar.setEnabled(true);
                }
                if (actionsToolbar != null) {
                    actionsToolbar.setEnabled(true);
                }
                if (selectionToolbar != null) {
                    selectionToolbar.setEnabled(true);
                }
            }

            @Override
            public void unselect(Workspace workspace) {
            }

            @Override
            public void close(Workspace workspace) {
            }

            @Override
            public void disable() {
                if (toolbar != null) {
                    toolbar.setEnabled(false);
                }
                if (tc != null) {
                    tc.select(null);//Unselect any selected tool
                }
                if (propertiesBar != null) {
                    propertiesBar.setEnabled(false);
                }
                if (actionsToolbar != null) {
View Full Code Here

TOP

Related Classes of org.gephi.tools.api.ToolController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.