private Frame getActiveBrowserPerspectiveFrame() {
   IFrameTabPanel panel =
       SolutionBrowserPanel.getInstance().getContentTabPanel().getCurrentFrame();
   if (panel == null) {
     return null;
   } else {
     return panel.getFrame();
   }
 }
Exemplo n.º 2
0
 @Override
 public void popupClosed(PopupPanel panel) {
   IFrameTabPanel iframeTab =
       SolutionBrowserPanel.getInstance().getContentTabPanel().getCurrentFrame();
   if (iframeTab == null || iframeTab.getFrame() == null) {
     return;
   }
   Frame currentFrame = iframeTab.getFrame();
   FrameUtils.setEmbedVisibility(currentFrame, true);
 }
Exemplo n.º 3
0
 public void execute() {
   SolutionBrowserPanel sbp = SolutionBrowserPanel.getInstance();
   List<RepositoryFile> selectedList = sbp.getFilesListPanel().getRepositoryFiles();
   if (selectedList != null && selectedList.size() == 1) {
     RepositoryFile item = selectedList.get(0);
     FilePropertiesDialog dialog =
         new FilePropertiesDialog(
             item, new MantleTabPanel(), null, FilePropertiesDialog.Tabs.PERMISSION);
     dialog.showTab(FilePropertiesDialog.Tabs.PERMISSION);
     dialog.center();
   }
 }
Exemplo n.º 4
0
 @Override
 public void popupOpened(PopupPanel panel) {
   IFrameTabPanel iframeTab =
       SolutionBrowserPanel.getInstance().getContentTabPanel().getCurrentFrame();
   if (iframeTab == null || iframeTab.getFrame() == null) {
     return;
   }
   Frame currentFrame = iframeTab.getFrame();
   if (ElementUtils.elementsOverlap(panel.getElement(), currentFrame.getElement())) {
     FrameUtils.setEmbedVisibility(currentFrame, false);
   }
 }
Exemplo n.º 5
0
  /* (non-Javadoc)
   * @see org.pentaho.mantle.client.commands.AbstractCommand#performOperation()
   */
  @Override
  protected void performOperation() {

    if (this.getSolutionPath() != null) {
      SolutionBrowserPanel sbp = SolutionBrowserPanel.getInstance();
      sbp.getFile(
          this.getSolutionPath(),
          new SolutionFileHandler() {
            @Override
            public void handle(RepositoryFile repositoryFile) {
              if (repositoryFiles == null) {
                repositoryFiles = new ArrayList<FileItem>();
              }
              repositoryFiles.add(new FileItem(repositoryFile, null, null, false, null));
              performOperation(false);
            }
          });
    } else {
      performOperation(false);
    }
  }
  public void onMantleSettingsLoaded(MantleSettingsLoadedEvent event) {
    final HashMap<String, String> settings = event.getSettings();
    final String startupPerspective = Window.Location.getParameter("startupPerspective");

    mantleRevisionOverride = settings.get("user-console-revision");
    RootPanel.get("pucMenuBar").add(MantleXul.getInstance().getMenubar());
    if (!StringUtils.isEmpty(startupPerspective)) {
      RootPanel.get("pucMenuBar").setVisible(false);
    }

    RootPanel.get("pucPerspectives").add(PerspectiveManager.getInstance());
    if (!StringUtils.isEmpty(startupPerspective)) {
      RootPanel.get("pucPerspectives").setVisible(false);
    }

    RootPanel.get("pucToolBar").add(MantleXul.getInstance().getToolbar());
    if (!StringUtils.isEmpty(startupPerspective)) {
      RootPanel.get("pucToolBar").setVisible(false);
    }

    // update supported file types
    PluginOptionsHelper.buildEnabledOptionsList(settings);

    // show stuff we've created/configured
    contentDeck.add(new Label());
    contentDeck.showWidget(0);
    contentDeck.add(SolutionBrowserPanel.getInstance());
    if (!StringUtils.isEmpty(startupPerspective)) {
      SolutionBrowserPanel.getInstance().setVisible(false);
    }

    contentDeck.getElement().setId("applicationShell");
    contentDeck.setStyleName("applicationShell");

    // menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width=1200,height=800
    try {
      RootPanel.get("pucContent").add(contentDeck);
    } catch (Throwable t) {
      // onLoad of something is causing problems
    }

    RootPanel.get().add(WaitPopup.getInstance());

    // Add in the overlay panel
    overlayPanel.setVisible(false);
    overlayPanel.setHeight("100%");
    overlayPanel.setWidth("100%");
    overlayPanel.getElement().getStyle().setProperty("zIndex", "1000");
    overlayPanel.getElement().getStyle().setProperty("position", "absolute");
    RootPanel.get().add(overlayPanel, 0, 0);

    String showAdvancedFeaturesSetting = settings.get("show-advanced-features"); // $NON-NLS-1$
    showAdvancedFeatures =
        showAdvancedFeaturesSetting == null
            ? showAdvancedFeatures
            : Boolean.parseBoolean(showAdvancedFeaturesSetting);

    String submitOnEnterSetting = settings.get("submit-on-enter-key");
    submitOnEnter =
        submitOnEnterSetting == null ? submitOnEnter : Boolean.parseBoolean(submitOnEnterSetting);

    try {
      String restUrl = GWT.getHostPageBaseURL() + "api/repo/files/canAdminister"; // $NON-NLS-1$
      RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, restUrl);
      requestBuilder.sendRequest(
          null,
          new RequestCallback() {

            @Override
            public void onError(Request arg0, Throwable arg1) {
              MessageDialogBox dialogBox =
                  new MessageDialogBox(
                      Messages.getString("error"),
                      arg1.getLocalizedMessage(),
                      false,
                      false,
                      true); //$NON-NLS-1$
              dialogBox.center();
            }

            @SuppressWarnings("deprecation")
            @Override
            public void onResponseReceived(Request arg0, Response response) {
              Boolean isAdministrator = Boolean.parseBoolean(response.getText());
              SolutionBrowserPanel.getInstance().setAdministrator(isAdministrator);

              try {
                String restUrl2 =
                    GWT.getHostPageBaseURL() + "api/scheduler/canSchedule"; // $NON-NLS-1$
                RequestBuilder requestBuilder2 = new RequestBuilder(RequestBuilder.GET, restUrl2);
                requestBuilder2.sendRequest(
                    null,
                    new RequestCallback() {
                      @Override
                      public void onError(Request arg0, Throwable arg1) {
                        MessageDialogBox dialogBox =
                            new MessageDialogBox(
                                Messages.getString("error"),
                                arg1.getLocalizedMessage(),
                                false,
                                false,
                                true); //$NON-NLS-1$
                        dialogBox.center();
                      }

                      public void onResponseReceived(Request arg0, Response response) {
                        Boolean isScheduler = Boolean.parseBoolean(response.getText());
                        SolutionBrowserPanel.getInstance().setScheduler(isScheduler);

                        String numStartupURLsSetting = settings.get("num-startup-urls");
                        if (numStartupURLsSetting != null) {
                          int numStartupURLs =
                              Integer.parseInt(numStartupURLsSetting); // $NON-NLS-1$
                          for (int i = 0; i < numStartupURLs; i++) {
                            String url = settings.get("startup-url-" + (i + 1)); // $NON-NLS-1$
                            String name = settings.get("startup-name-" + (i + 1)); // $NON-NLS-1$
                            if (url != null && !"".equals(url)) { // $NON-NLS-1$
                              SolutionBrowserPanel.getInstance()
                                  .getContentTabPanel()
                                  .showNewURLTab(name != null ? name : url, url, url, false);
                            }
                          }
                        }
                        if (SolutionBrowserPanel.getInstance().getContentTabPanel().getWidgetCount()
                            > 0) {
                          SolutionBrowserPanel.getInstance().getContentTabPanel().selectTab(0);
                        }

                        // startup-url on the URL for the app, wins over settings
                        String startupURL =
                            Window.Location.getParameter("startup-url"); // $NON-NLS-1$
                        if (startupURL != null && !"".equals(startupURL)) { // $NON-NLS-1$
                          String title = Window.Location.getParameter("name"); // $NON-NLS-1$
                          startupURL = URL.decodeComponent(startupURL);
                          SolutionBrowserPanel.getInstance()
                              .getContentTabPanel()
                              .showNewURLTab(title, title, startupURL, false);
                        }
                      }
                    });
              } catch (RequestException e) {
                MessageDialogBox dialogBox =
                    new MessageDialogBox(
                        Messages.getString("error"),
                        e.getLocalizedMessage(),
                        false,
                        false,
                        true); //$NON-NLS-1$
                dialogBox.center();
              }
            }
          });
    } catch (RequestException e) {
      MessageDialogBox dialogBox =
          new MessageDialogBox(
              Messages.getString("error"),
              e.getLocalizedMessage(),
              false,
              false,
              true); //$NON-NLS-1$
      dialogBox.center();
    }

    if (!StringUtils.isEmpty(startupPerspective)) {
      ICallback<Void> callback =
          new ICallback<Void>() {
            public void onHandle(Void nothing) {
              PerspectiveManager.getInstance().setPerspective(startupPerspective);
            }
          };
      PerspectiveManager.getInstance().addPerspectivesLoadedCallback(callback);
    }
  }