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);
}
}
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());
}
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());
}
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);
}
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;
}
Aggregations