Search in sources :

Example 1 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() {
    if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) {
        return;
    }
    RepositoryFile file = filesListPanel.getSelectedFileItems().get(0).getRepositoryFile();
    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) RepositoryFile(org.pentaho.gwt.widgets.client.filechooser.RepositoryFile) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel) JsArrayString(com.google.gwt.core.client.JsArrayString) ContentTypePlugin(org.pentaho.mantle.client.solutionbrowser.PluginOptionsHelper.ContentTypePlugin)

Example 2 with IFrameTabPanel

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

the class MantlePopupPanel method hide.

@Override
public void hide() {
    super.hide();
    IFrameTabPanel iframeTab = SolutionBrowserPanel.getInstance().getContentTabPanel().getCurrentFrame();
    if (iframeTab == null || iframeTab.getFrame() == null) {
        return;
    }
    Frame currentFrame = iframeTab.getFrame();
    FrameUtils.setEmbedVisibility(currentFrame, true);
}
Also used : Frame(com.google.gwt.user.client.ui.Frame) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel)

Example 3 with IFrameTabPanel

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

the class MantleTabPanel method getTabByFrameId.

private PentahoTab getTabByFrameId(String frameId) {
    PentahoTab tab;
    for (int i = 0; i < getTabCount(); i++) {
        tab = getTab(i);
        IFrameTabPanel panel = getFrame(tab);
        if (panel.getFrame().getElement().getAttribute("id").equals(frameId)) {
            return tab;
        }
    }
    return null;
}
Also used : PentahoTab(org.pentaho.gwt.widgets.client.tabs.PentahoTab) IFrameTabPanel(org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel)

Example 4 with IFrameTabPanel

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

the class MantleTabPanel method setContentEditSelected.

public void setContentEditSelected(boolean selected) {
    IFrameTabPanel panel = getCurrentFrame();
    if (panel != null) {
        panel.setEditSelected(selected);
        Widget selectTabContent = null;
        if (getTab(getSelectedTabIndex()) != null) {
            selectTabContent = getTab(getSelectedTabIndex()).getContent();
        }
        List<FileItem> selectedItems = SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems();
        EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserUndefinedEvent(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) SolutionBrowserUndefinedEvent(org.pentaho.mantle.client.events.SolutionBrowserUndefinedEvent)

Example 5 with IFrameTabPanel

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

the class MantleTabPanel method setFileInfoInFrame.

/**
 * Store representation of file in the frame for reference later when save is called
 *
 * @param selectedFileItem
 */
public void setFileInfoInFrame(FileItem selectedFileItem) {
    IFrameTabPanel tp = getCurrentFrame();
    if (tp != null && selectedFileItem != null) {
        SolutionFileInfo fileInfo = new SolutionFileInfo();
        fileInfo.setName(selectedFileItem.getName());
        fileInfo.setPath(selectedFileItem.getPath());
        tp.setFileInfo(fileInfo);
    }
}
Also used : SolutionFileInfo(org.pentaho.mantle.client.objects.SolutionFileInfo) 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