Search in sources :

Example 11 with IFrameTabPanel

use of org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel in project pentaho-platform by pentaho.

the class ExecuteUrlInNewTabCommand method performOperation.

protected void performOperation() {
    MantleTabPanel contentTabPanel = SolutionBrowserPanel.getInstance().getContentTabPanel();
    // $NON-NLS-1$
    contentTabPanel.showNewURLTab(this.tabName, this.tabToolTip, "about:blank", false);
    NamedFrame namedFrame = ((IFrameTabPanel) contentTabPanel.getSelectedTab().getContent()).getFrame();
    final FormPanel form = new FormPanel(namedFrame);
    RootPanel.get().add(form);
    form.setMethod(FormPanel.METHOD_POST);
    form.setAction(url);
    // $NON-NLS-1$
    form.add(new Hidden("reportXml", URL.encode(xml)));
    form.submit();
    ((IFrameTabPanel) contentTabPanel.getSelectedTab().getContent()).setForm(form);
}
Also used : FormPanel(com.google.gwt.user.client.ui.FormPanel) MantleTabPanel(org.pentaho.mantle.client.ui.tabs.MantleTabPanel) Hidden(com.google.gwt.user.client.ui.Hidden) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) NamedFrame(com.google.gwt.user.client.ui.NamedFrame)

Example 12 with IFrameTabPanel

use of org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel in project pentaho-platform by pentaho.

the class MantleTabPanel method selectTab.

public void selectTab(final PentahoTab selectedTab) {
    // Save previous tab's solution browser panel navigator state
    PentahoTab prevTab = getSelectedTab();
    if (prevTab != null && prevTab instanceof MantleTab) {
        MantleTab mantlePrevTab = (MantleTab) prevTab;
        boolean prevState = SolutionBrowserPanel.getInstance().isNavigatorShowing();
        if (mantlePrevTab != null) {
            mantlePrevTab.setSolutionBrowserShowing(prevState);
        }
    }
    super.selectTab(selectedTab);
    if (selectedTab == null) {
        return;
    }
    if (selectedTab instanceof MantleTab) {
        // restore previous state of solution browser panel navigator
        MantleTab mantleTab = (MantleTab) selectedTab;
        SolutionBrowserPanel.getInstance().setNavigatorShowing(mantleTab.isSolutionBrowserShowing());
    }
    Widget selectTabContent = null;
    if (getTab(getSelectedTabIndex()) != null) {
        selectTabContent = getTab(getSelectedTabIndex()).getContent();
    }
    List<FileItem> selectedItems = SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems();
    EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserSelectEvent(selectTabContent, selectedItems));
    // $NON-NLS-1$ //$NON-NLS-2$
    Window.setTitle(Messages.getString("productName") + " - " + selectedTab.getLabelText());
    // first turn off all tabs that should be
    for (int i = 0; i < getTabCount(); i++) {
        final PentahoTab tab = getTab(i);
        if (tab.getContent() instanceof IFrameTabPanel) {
            if (tab.getContent() != selectedTab.getContent()) {
                FrameUtils.setEmbedVisibility(((IFrameTabPanel) tab.getContent()).getFrame(), false);
            }
        }
    }
    // now turn on the select tab
    if (selectedTab.getContent() instanceof IFrameTabPanel) {
        FrameUtils.setEmbedVisibility(((IFrameTabPanel) selectedTab.getContent()).getFrame(), true);
        // fix for BISERVER-6027 - on selection, set the focus into a textbox
        // element to allow IE mouse access in these elements
        // this was made native due to BISERVER-7400
        ieFix(((IFrameTabPanel) selectedTab.getContent()).getFrame().getElement());
        IFrameTabPanel tabPanel = (IFrameTabPanel) selectedTab.getContent();
        if (tabPanel.getUrl() != null) {
            onTabSelect(getFrameElement(selectedTab));
        }
    }
}
Also used : FileItem(org.pentaho.mantle.client.solutionbrowser.filelist.FileItem) PentahoTab(org.pentaho.gwt.widgets.client.tabs.PentahoTab) Widget(com.google.gwt.user.client.ui.Widget) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) SolutionBrowserSelectEvent(org.pentaho.mantle.client.events.SolutionBrowserSelectEvent)

Example 13 with IFrameTabPanel

use of org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel in project pentaho-platform by pentaho.

the class MantleTabPanel method setTabSaveEnabled.

public void setTabSaveEnabled(PentahoTab tab, boolean enabled) {
    IFrameTabPanel panel = null;
    if (tab != null) {
        panel = getFrame(tab);
    }
    if (panel != null) {
        panel.setSaveEnabled(enabled);
        Widget selectTabContent = null;
        if (getTab(getSelectedTabIndex()) != null) {
            selectTabContent = getTab(getSelectedTabIndex()).getContent();
        }
        List<FileItem> selectedItems = SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems();
        EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserSelectEvent(selectTabContent, selectedItems));
    }
}
Also used : FileItem(org.pentaho.mantle.client.solutionbrowser.filelist.FileItem) Widget(com.google.gwt.user.client.ui.Widget) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) SolutionBrowserSelectEvent(org.pentaho.mantle.client.events.SolutionBrowserSelectEvent)

Example 14 with IFrameTabPanel

use of org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel in project pentaho-platform by pentaho.

the class MantleTabPanel method registerContentOverlay.

/*
   * registerContentOverlay - register the overlay with the panel. Once the registration is done it fires a soultion
   * browser event passing the current tab index and the type of event
   */
public void registerContentOverlay(String id) {
    IFrameTabPanel panel = getCurrentFrame();
    if (panel != null) {
        panel.addOverlay(id);
        Widget selectTabContent = null;
        if (getTab(getSelectedTabIndex()) != null) {
            selectTabContent = getTab(getSelectedTabIndex()).getContent();
        }
        List<FileItem> selectedItems = SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems();
        EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserOpenEvent(selectTabContent, selectedItems));
    }
}
Also used : FileItem(org.pentaho.mantle.client.solutionbrowser.filelist.FileItem) Widget(com.google.gwt.user.client.ui.Widget) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) SolutionBrowserOpenEvent(org.pentaho.mantle.client.events.SolutionBrowserOpenEvent)

Example 15 with IFrameTabPanel

use of org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel in project pentaho-platform by pentaho.

the class MantleTabPanel method showNewURLTab.

public void showNewURLTab(String tabName, String tabTooltip, String url, boolean setFileInfoInFrame, String frameName) {
    showLoadingIndicator();
    PerspectiveManager.getInstance().setPerspective(PerspectiveManager.OPENED_PERSPECTIVE);
    // than if set with the src attribute. This detects the relative paths are prepends them appropriately.
    if (url.indexOf("http") != 0 && url.indexOf("/") != 0) {
        url = GWT.getHostPageBaseURL() + url;
    }
    if (!url.contains("?")) {
        url = url + "?ts=" + System.currentTimeMillis();
    } else {
        url = url + "&ts=" + System.currentTimeMillis();
    }
    final int elementId = getTabCount();
    if (frameName == null || "".equals(frameName.trim())) {
        frameName = getUniqueFrameName();
    }
    // check for other tabs with this name
    if (existingTabMatchesName(tabName)) {
        int counter = 2;
        while (true) {
            // name
            if (existingTabMatchesName(tabName + " (" + counter + ")")) {
                // unique //$NON-NLS-1$ //$NON-NLS-2$
                counter++;
                continue;
            } else {
                // $NON-NLS-1$ //$NON-NLS-2$
                tabName = tabName + " (" + counter + ")";
                // $NON-NLS-1$ //$NON-NLS-2$
                tabTooltip = tabTooltip + " (" + counter + ")";
                break;
            }
        }
    }
    IFrameTabPanel panel = null;
    if (freeFrames.size() > 0) {
        panel = freeFrames.iterator().next();
        panel.setName(frameName);
        // mark as no longer free by removing from set
        freeFrames.remove(panel);
    } else {
        panel = new IFrameTabPanel(frameName);
    }
    addTab(tabName, tabTooltip, true, panel);
    selectTab(elementId);
    // wants to change or remove the color
    if (url.indexOf("/content") > -1 || url.indexOf("/generatedContent") > -1) {
        // white background
        panel.getElement().addClassName("mantle-white-tab-background");
    } else {
        // transparent background
        panel.getElement().addClassName("mantle-default-tab-background");
    }
    final ArrayList<com.google.gwt.dom.client.Element> parentList = new ArrayList<com.google.gwt.dom.client.Element>();
    com.google.gwt.dom.client.Element parent = panel.getFrame().getElement();
    while (parent != getElement()) {
        parentList.add(parent);
        parent = parent.getParentElement();
    }
    Collections.reverse(parentList);
    for (int i = 1; i < parentList.size(); i++) {
        // $NON-NLS-1$ //$NON-NLS-2$
        parentList.get(i).getStyle().setProperty("height", "100%");
    }
    Widget selectTabContent = null;
    if (getTab(getSelectedTabIndex()) != null) {
        selectTabContent = getTab(getSelectedTabIndex()).getContent();
    }
    List<FileItem> selectedItems = SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems();
    EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserOpenEvent(selectTabContent, selectedItems));
    // if showContent is the thing that turns on our first tab, which is entirely possible, then we
    // would encounter the same timing issue as before
    panel.setUrl(url);
    EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserSelectEvent(selectTabContent, selectedItems));
    if (setFileInfoInFrame && SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems().size() > 0) {
        setFileInfoInFrame(SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems().get(0));
    }
    // create a timer to check the readyState
    Timer t = new Timer() {

        public void run() {
            Element frameElement = getFrameElement(getSelectedTab());
            if (supportsReadyFeedback(frameElement)) {
                // cancel the timer, the content will hide the loading indicator itself
                cancel();
            } else {
                if ("complete".equalsIgnoreCase(getReadyState(frameElement))) {
                    // the content is not capable of giving us feedback so when the
                    // readyState is "complete" we hide/cancel
                    hideLoadingIndicator();
                    cancel();
                } else if (StringUtils.isEmpty(getReadyState(frameElement)) || "undefined".equals(getReadyState(frameElement))) {
                    hideLoadingIndicator();
                    cancel();
                }
            }
        }
    };
    t.scheduleRepeating(1000);
}
Also used : Element(com.google.gwt.user.client.Element) ArrayList(java.util.ArrayList) Widget(com.google.gwt.user.client.ui.Widget) FileItem(org.pentaho.mantle.client.solutionbrowser.filelist.FileItem) Timer(com.google.gwt.user.client.Timer) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) SolutionBrowserOpenEvent(org.pentaho.mantle.client.events.SolutionBrowserOpenEvent) SolutionBrowserSelectEvent(org.pentaho.mantle.client.events.SolutionBrowserSelectEvent)

Aggregations

IFrameTabPanel (org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel)22 Widget (com.google.gwt.user.client.ui.Widget)9 FileItem (org.pentaho.mantle.client.solutionbrowser.filelist.FileItem)7 Frame (com.google.gwt.user.client.ui.Frame)5 Element (com.google.gwt.user.client.Element)3 Label (com.google.gwt.user.client.ui.Label)3 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)3 IDialogCallback (org.pentaho.gwt.widgets.client.dialogs.IDialogCallback)3 PentahoTab (org.pentaho.gwt.widgets.client.tabs.PentahoTab)3 SolutionBrowserSelectEvent (org.pentaho.mantle.client.events.SolutionBrowserSelectEvent)3 JsArrayString (com.google.gwt.core.client.JsArrayString)2 ArrayList (java.util.ArrayList)2 MessageDialogBox (org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox)2 SolutionBrowserOpenEvent (org.pentaho.mantle.client.events.SolutionBrowserOpenEvent)2 SolutionBrowserUndefinedEvent (org.pentaho.mantle.client.events.SolutionBrowserUndefinedEvent)2 SolutionFileInfo (org.pentaho.mantle.client.objects.SolutionFileInfo)2 ContentTypePlugin (org.pentaho.mantle.client.solutionbrowser.PluginOptionsHelper.ContentTypePlugin)2 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 Node (com.google.gwt.dom.client.Node)1 NodeList (com.google.gwt.dom.client.NodeList)1