Search in sources :

Example 6 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class MantleModel method showBrowser.

@Bindable
public void showBrowser() {
    IPluginPerspective perspective = PerspectiveManager.getInstance().getActivePerspective();
    boolean showing = perspective.getId().equalsIgnoreCase(PerspectiveManager.OPENED_PERSPECTIVE);
    if (!showing) {
        PerspectiveManager.getInstance().setPerspective(PerspectiveManager.OPENED_PERSPECTIVE);
    }
}
Also used : IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Example 7 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class PerspectiveManager method setPluginPerspectives.

protected void setPluginPerspectives(final ArrayList<IPluginPerspective> perspectives) {
    this.perspectives = perspectives;
    clear();
    // sort perspectives
    Collections.sort(perspectives, new Comparator<IPluginPerspective>() {

        public int compare(IPluginPerspective o1, IPluginPerspective o2) {
            Integer p1 = new Integer(o1.getLayoutPriority());
            Integer p2 = new Integer(o2.getLayoutPriority());
            return p1.compareTo(p2);
        }
    });
    MenuBar perspectiveMenuBar = new MenuBar(true);
    perspectiveDropDown = new CustomDropDown("", perspectiveMenuBar, MODE.MAJOR);
    setWidget(perspectiveDropDown);
    loadResourceBundle(perspectiveDropDown, perspectives.get(0));
    ScheduledCommand noopCmd = new ScheduledCommand() {

        public void execute() {
        }
    };
    for (final IPluginPerspective perspective : perspectives) {
        // if we have overlays add it to the list
        if (perspective.getOverlays() != null) {
            overlays.addAll(perspective.getOverlays());
        }
        final MenuItem menuItem = new MenuItem("", noopCmd);
        perspectiveMenuItemMap.put(perspective.getId(), menuItem);
        ScheduledCommand cmd = new ScheduledCommand() {

            public void execute() {
                showPerspective(perspective);
                perspectiveDropDown.setText(menuItem.getText());
                perspectiveDropDown.hidePopup();
            }
        };
        menuItem.setScheduledCommand(cmd);
        perspectiveMenuBar.addItem(menuItem);
        loadResourceBundle(menuItem, perspective);
    }
    // register overlays with XulMainToolbar
    MantleXul.getInstance().addOverlays(overlays);
    setPerspective(perspectives.get(0).getId());
    loaded = true;
    EventBusUtil.EVENT_BUS.fireEvent(new PerspectivesLoadedEvent());
}
Also used : PerspectivesLoadedEvent(org.pentaho.mantle.client.events.PerspectivesLoadedEvent) ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) MenuBar(com.google.gwt.user.client.ui.MenuBar) MenuItem(com.google.gwt.user.client.ui.MenuItem) PentahoMenuItem(org.pentaho.gwt.widgets.client.menuitem.PentahoMenuItem) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)

Example 8 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class OpenFileCommand method performOperation.

protected void performOperation(boolean feedback) {
    final IPluginPerspective activePerspective = PerspectiveManager.getInstance().getActivePerspective();
    final SolutionBrowserPanel solutionBrowserPerspective = SolutionBrowserPanel.getInstance();
    boolean forceReload = false;
    if (FileChooserDialog.getIsDirty()) {
        forceReload = true;
        WaitPopup.getInstance().setVisibleById(true, spinnerId);
        FileChooserDialog.setIsDirty(Boolean.FALSE);
    }
    RepositoryFileTreeManager.getInstance().fetchRepositoryFileTree(new AsyncCallback<RepositoryFileTree>() {

        public void onFailure(Throwable caught) {
        }

        public void onSuccess(RepositoryFileTree tree) {
            // TODO Uncomment the line below and delete the line after that once gwtwidets have been branched
            WaitPopup.getInstance().setVisibleById(false, spinnerId);
            final FileChooserDialog dialog = new FileChooserDialog(FileChooserMode.OPEN, lastPath, tree, false, true, solutionBrowserPerspective.getSolutionTree().isShowHiddenFiles());
            dialog.setSubmitOnEnter(MantleApplication.submitOnEnter);
            dialog.addFileChooserListener(new FileChooserListener() {

                public void dialogCanceled() {
                    // retain current active perspective
                    PerspectiveManager.getInstance().setPerspective(activePerspective.getId());
                }

                @Override
                public void fileSelected(RepositoryFile repositoryFile, String filePath, String fileName, String title) {
                    dialog.hide();
                    solutionBrowserPerspective.openFile(repositoryFile, openMethod);
                }

                @Override
                public void fileSelectionChanged(RepositoryFile repositoryFile, String filePath, String fileName, String title) {
                // TODO Auto-generated method stub
                }
            });
            dialog.center();
        }
    }, forceReload, null, null, SolutionBrowserPanel.getInstance().getSolutionTree().isShowHiddenFiles());
}
Also used : FileChooserListener(org.pentaho.gwt.widgets.client.filechooser.FileChooserListener) RepositoryFile(org.pentaho.gwt.widgets.client.filechooser.RepositoryFile) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective) SolutionBrowserPanel(org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel) RepositoryFileTree(org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree) FileChooserDialog(org.pentaho.gwt.widgets.client.filechooser.FileChooserDialog)

Example 9 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class SystemPathPluginProviderIT method testLoadPerspectives.

@SuppressWarnings("deprecation")
@Test
public void testLoadPerspectives() throws PlatformPluginRegistrationException {
    microPlatform.init();
    List<IPlatformPlugin> plugins = provider.getPlugins(new StandaloneSession());
    IPlatformPlugin plugin = (IPlatformPlugin) CollectionUtils.find(plugins, new PluginNameMatcherPredicate("Plugin 1"));
    assertNotNull("Plugin 1 should have been found", plugin);
    assertEquals(2, plugin.getPluginPerspectives().size());
    IPluginPerspective perspective = plugin.getPluginPerspectives().get(0);
    assertEquals(perspective.getId(), "perspective1");
    assertEquals(perspective.getTitle(), "Test Perspective 1");
    assertEquals(perspective.getLayoutPriority(), 500);
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective) IPlatformPlugin(org.pentaho.platform.api.engine.IPlatformPlugin) Test(org.junit.Test)

Example 10 with IPluginPerspective

use of org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective in project pentaho-platform by pentaho.

the class DefaultPluginPerspectiveManagerIT method createTestPerspective.

private IPluginPerspective createTestPerspective(final String id, final String title) {
    IPluginPerspective perspective = new DefaultPluginPerspective();
    perspective.setId(id);
    perspective.setTitle(title);
    perspective.setContentUrl("test-content-url");
    perspective.setLayoutPriority(500);
    return perspective;
}
Also used : DefaultPluginPerspective(org.pentaho.platform.plugin.services.pluginmgr.perspective.pojo.DefaultPluginPerspective) IPluginPerspective(org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)

Aggregations

IPluginPerspective (org.pentaho.platform.api.engine.perspective.pojo.IPluginPerspective)12 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)2 IPluginPerspectiveManager (org.pentaho.platform.api.engine.perspective.IPluginPerspectiveManager)2 DefaultPluginPerspective (org.pentaho.platform.plugin.services.pluginmgr.perspective.pojo.DefaultPluginPerspective)2 XulOverlay (org.pentaho.ui.xul.XulOverlay)2 Bindable (org.pentaho.ui.xul.stereotype.Bindable)2 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 MenuBar (com.google.gwt.user.client.ui.MenuBar)1 MenuItem (com.google.gwt.user.client.ui.MenuItem)1 StringTokenizer (java.util.StringTokenizer)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Facet (org.codehaus.enunciate.Facet)1 Element (org.dom4j.Element)1 FileChooserDialog (org.pentaho.gwt.widgets.client.filechooser.FileChooserDialog)1 FileChooserListener (org.pentaho.gwt.widgets.client.filechooser.FileChooserListener)1 RepositoryFile (org.pentaho.gwt.widgets.client.filechooser.RepositoryFile)1 RepositoryFileTree (org.pentaho.gwt.widgets.client.filechooser.RepositoryFileTree)1