/** * Creates or reuses launchpad window. * * <p>This method should be called from user initiated event handler. * * <p>If popup window already exists, it is cleared. Launchpad is filled with disclaimer that * informs user that deployment is in progress. * * <p>Actually, popup is never blocked, because it is initiated by user. But in case it is not * truth, we show alert to user that instructs how to enable popups. */ public static Window createOrOpenPopup(AppContext appContext) { Window popup = Browser.getWindow().open("", BootstrapSession.getBootstrapSession().getActiveClientId()); if (popup == null) { if (!doNotShowPopupBlockedInstruction) { doNotShowPopupBlockedInstruction = true; PopupBlockedInstructionalPopup.create(appContext.getResources()).show(); } } return popup; }
private void copyToClipboard(Clipboard clipboard) { if (macroList.selectedItem() != null) { clipboard.setText(macroList.selectedItem().asCli()); Tooltip tooltip = Tooltip.element(copyToClipboard); tooltip .hide() .setTitle(resources.constants().copied()) .show() .onHide(() -> tooltip.setTitle(resources.constants().copyToClipboard())); Browser.getWindow().setTimeout(tooltip::hide, 1000); } }
/** Selects all text in the specified element. */ public static void selectAllText(Element e) { Range range = Browser.getDocument().createRange(); range.selectNode(e); Browser.getWindow().getSelection().addRange(range); }
public static Window getWindow() { return Browser.getWindow(); }
public String historyToken(PlaceRequest placeRequest) { String href = Browser.getWindow().getLocation().getHref(); href = href.substring(0, href.indexOf('#')); return href + "#" + tokenFormatter.toHistoryToken(singletonList(placeRequest)); }
@Override public void attach() { super.attach(); Browser.getWindow().setOnresize(event -> adjustHeight()); adjustHeight(); }