Search in sources :

Example 16 with IFrameTabPanel

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

the class MantleTab method reloadTab.

public void reloadTab() {
    if (getContent() instanceof IFrameTabPanel) {
        VerticalPanel vp = new VerticalPanel();
        // $NON-NLS-1$
        vp.add(new Label(Messages.getString("reloadQuestion")));
        final MantleDialogBox reloadConfirmDialog = new MantleDialogBox(Messages.getString("reloadConfirm"), Messages.getString("yes"), Messages.getString("no"), false, true, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        vp);
        final IDialogCallback callback = new IDialogCallback() {

            public void cancelPressed() {
                reloadConfirmDialog.hide();
            }

            public void okPressed() {
                ((IFrameTabPanel) getContent()).reload();
                reloadConfirmDialog.hide();
            }
        };
        reloadConfirmDialog.setCallback(callback);
        reloadConfirmDialog.center();
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Label(com.google.gwt.user.client.ui.Label) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) IDialogCallback(org.pentaho.gwt.widgets.client.dialogs.IDialogCallback)

Example 17 with IFrameTabPanel

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

the class MantleTab method onRightClick.

public void onRightClick(Event event) {
    FrameUtils.setEmbedVisibility(((IFrameTabPanel) getTabPanel().getSelectedTab().getContent()).getFrame(), false);
    int left = Window.getScrollLeft() + DOM.eventGetClientX(event);
    int top = Window.getScrollTop() + DOM.eventGetClientY(event);
    popupMenu.setPopupPosition(adjustLeftIfNecessary(left), top);
    MenuBar menuBar = new MenuBar(true);
    menuBar.setAutoOpen(true);
    if (getContent() instanceof IFrameTabPanel) {
        MenuItem backMenuItem = // $NON-NLS-1$
        new MenuItem(Messages.getString("back"), new TabCommand(TABCOMMANDTYPE.BACK, popupMenu));
        menuBar.addItem(backMenuItem);
        // $NON-NLS-1$
        backMenuItem.getElement().setId("back");
        menuBar.addSeparator();
        MenuItem reloadTabMenuItem = // $NON-NLS-1$
        new MenuItem(Messages.getString("reloadTab"), new TabCommand(TABCOMMANDTYPE.RELOAD, popupMenu));
        menuBar.addItem(reloadTabMenuItem);
        // $NON-NLS-1$
        reloadTabMenuItem.getElement().setId("reloadTab");
    }
    if (getTabPanel().getTabCount() > 1) {
        MenuItem reloadAllTabsMenuItem = // $NON-NLS-1$
        new MenuItem(Messages.getString("reloadAllTabs"), new TabCommand(TABCOMMANDTYPE.RELOAD_ALL, popupMenu));
        menuBar.addItem(reloadAllTabsMenuItem);
        // $NON-NLS-1$
        reloadAllTabsMenuItem.getElement().setId("reloadAllTabs");
    } else {
        // $NON-NLS-1$
        MenuItem reloadAllTabsMenuItem = new MenuItem(Messages.getString("reloadAllTabs"), (Command) null);
        menuBar.addItem(reloadAllTabsMenuItem);
        // $NON-NLS-1$
        reloadAllTabsMenuItem.getElement().setId("reloadAllTabs");
        // $NON-NLS-1$
        reloadAllTabsMenuItem.setStyleName("disabledMenuItem");
    }
    menuBar.addSeparator();
    if (getContent() instanceof IFrameTabPanel) {
        MenuItem openTabInNewWindowMenuItem = new MenuItem(Messages.getString("openTabInNewWindow"), // $NON-NLS-1$
        new TabCommand(TABCOMMANDTYPE.NEW_WINDOW, popupMenu));
        menuBar.addItem(openTabInNewWindowMenuItem);
        // $NON-NLS-1$
        openTabInNewWindowMenuItem.getElement().setId("openTabInNewWindow");
        MenuItem createDeepLinkMenuItem = new MenuItem(Messages.getString("createDeepLink"), // $NON-NLS-1$
        new TabCommand(TABCOMMANDTYPE.CREATE_DEEP_LINK, popupMenu));
        menuBar.addItem(createDeepLinkMenuItem);
        // $NON-NLS-1$
        createDeepLinkMenuItem.getElement().setId("deepLink");
        menuBar.addSeparator();
    }
    menuBar.addItem(// $NON-NLS-1$
    new MenuItem(Messages.getString("closeTab"), new TabCommand(TABCOMMANDTYPE.CLOSE, popupMenu)));
    if (getTabPanel().getTabCount() > 1) {
        MenuItem closeOtherTabsMenuItem = // $NON-NLS-1$
        new MenuItem(Messages.getString("closeOtherTabs"), new TabCommand(TABCOMMANDTYPE.CLOSE_OTHERS, popupMenu));
        menuBar.addItem(closeOtherTabsMenuItem);
        // $NON-NLS-1$
        closeOtherTabsMenuItem.getElement().setId("closeOtherTabs");
        MenuItem closeAllTabsMenuItem = // $NON-NLS-1$
        new MenuItem(Messages.getString("closeAllTabs"), new TabCommand(TABCOMMANDTYPE.CLOSE_ALL, popupMenu));
        menuBar.addItem(closeAllTabsMenuItem);
        // $NON-NLS-1$
        closeAllTabsMenuItem.getElement().setId("closeAllTabs");
    } else {
        // $NON-NLS-1$
        MenuItem closeOtherTabsMenuItem = new MenuItem(Messages.getString("closeOtherTabs"), (Command) null);
        // $NON-NLS-1$
        closeOtherTabsMenuItem.setStyleName("disabledMenuItem");
        // $NON-NLS-1$
        MenuItem closeAllTabsMenuItem = new MenuItem(Messages.getString("closeAllTabs"), (Command) null);
        // $NON-NLS-1$
        closeAllTabsMenuItem.setStyleName("disabledMenuItem");
        menuBar.addItem(closeOtherTabsMenuItem);
        menuBar.addItem(closeAllTabsMenuItem);
        // $NON-NLS-1$
        closeOtherTabsMenuItem.getElement().setId("closeOtherTabs");
        // $NON-NLS-1$
        closeAllTabsMenuItem.getElement().setId("closeAllTabs");
    }
    popupMenu.setWidget(menuBar);
    if (isIEBrowser()) {
        Frame iFrame = new Frame("about:blank");
        Style iFrameStyle = iFrame.getElement().getStyle();
        iFrameStyle.setWidth(100, Style.Unit.PCT);
        iFrameStyle.setHeight(100, Style.Unit.PCT);
        iFrameStyle.setBorderStyle(Style.BorderStyle.NONE);
        iFrameStyle.setTop(0, Unit.PX);
        iFrameStyle.setPosition(Style.Position.ABSOLUTE);
        iFrameStyle.setZIndex(-1);
        Element element = popupMenu.getElement();
        Node firstChild = element.getFirstChild();
        if (firstChild != null) {
            firstChild.appendChild(iFrame.getElement());
        }
    }
    popupMenu.hide();
    popupMenu.show();
}
Also used : Frame(com.google.gwt.user.client.ui.Frame) Element(com.google.gwt.user.client.Element) Node(com.google.gwt.dom.client.Node) MenuBar(com.google.gwt.user.client.ui.MenuBar) Style(com.google.gwt.dom.client.Style) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) MenuItem(com.google.gwt.user.client.ui.MenuItem)

Example 18 with IFrameTabPanel

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

the class MantleTab method createDeepLink.

public void createDeepLink() {
    if (getContent() instanceof IFrameTabPanel) {
        MantleDialogBox dialogBox = new MantleDialogBox(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        Messages.getString("deepLink"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        Messages.getString("ok"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        Messages.getString("cancel"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        false, true);
        String startup = ((IFrameTabPanel) getContent()).getUrl();
        if (!StringUtils.isEmpty(((IFrameTabPanel) getContent()).getDeepLinkUrl())) {
            startup = ((IFrameTabPanel) getContent()).getDeepLinkUrl();
        }
        UrlBuilder builder = new UrlBuilder();
        builder.setProtocol(Window.Location.getProtocol());
        builder.setHost(Window.Location.getHostName());
        try {
            builder.setPort(Integer.parseInt(Window.Location.getPort()));
        } catch (NumberFormatException e) {
            builder.setPort(UrlBuilder.PORT_UNSPECIFIED);
        }
        builder.setPath(Window.Location.getPath());
        // UrlBuilder will encode spaces as '+' which is a valid special character so we replace all spaces with '%20'
        builder.setParameter("name", getLabelText().replaceAll("\\s", "%20"));
        // the startup string is already encoded with ':' being replaced with '\t' and then encoded again...
        builder.setParameter("startup-url", startup);
        final TextArea urlbox = new TextArea();
        // encode any space characters
        urlbox.setText(builder.buildString());
        urlbox.setReadOnly(true);
        urlbox.setVisibleLines(3);
        dialogBox.setContent(urlbox);
        urlbox.setHeight("80px");
        urlbox.setWidth("600px");
        urlbox.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                urlbox.selectAll();
            }
        });
        dialogBox.center();
        urlbox.selectAll();
    }
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) TextArea(com.google.gwt.user.client.ui.TextArea) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) UrlBuilder(com.google.gwt.http.client.UrlBuilder)

Example 19 with IFrameTabPanel

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

the class SolutionBrowserPanel method editFile.

public void editFile(final RepositoryFile file) {
    if (file.getName().endsWith(".analysisview.xaction")) {
        // $NON-NLS-1$
        openFile(file, COMMAND.RUN);
    } else {
        // check to see if a plugin supports editing
        ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(file.getName());
        if (plugin != null && plugin.hasCommand(COMMAND.EDIT)) {
            // load the editor for this plugin
            String editUrl = getPath() + "api/repos/" + pathToId(file.getPath()) + "/" + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            (plugin != null && (plugin.getCommandPerspective(COMMAND.EDIT) != null) ? plugin.getCommandPerspective(COMMAND.EDIT) : "editor");
            // See if it's already loaded
            for (int i = 0; i < contentTabPanel.getTabCount(); i++) {
                Widget w = contentTabPanel.getTab(i).getContent();
                if (w instanceof IFrameTabPanel && ((IFrameTabPanel) w).getUrl().endsWith(editUrl)) {
                    // Already up, select and exit
                    contentTabPanel.selectTab(i);
                    return;
                }
            }
            contentTabPanel.showNewURLTab(Messages.getString("editingColon") + file.getTitle(), Messages.getString("editingColon") + file.getTitle(), editUrl, // $NON-NLS-1$ //$NON-NLS-2$
            true);
        } else {
            MessageDialogBox dialogBox = new // $NON-NLS-1$
            MessageDialogBox(// $NON-NLS-1$
            Messages.getString("error"), // $NON-NLS-1$
            Messages.getString("cannotEditFileType"), true, false, true);
            dialogBox.center();
        }
    }
}
Also used : MessageDialogBox(org.pentaho.gwt.widgets.client.dialogs.MessageDialogBox) Widget(com.google.gwt.user.client.ui.Widget) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) JsArrayString(com.google.gwt.core.client.JsArrayString) ContentTypePlugin(org.pentaho.mantle.client.solutionbrowser.PluginOptionsHelper.ContentTypePlugin)

Example 20 with IFrameTabPanel

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

the class FilesToolbar method popupOpened.

@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);
    }
}
Also used : Frame(com.google.gwt.user.client.ui.Frame) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel)

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