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