Exemplo n.º 1
0
  public HomepageSection(
      final String token, final String header, final String intro, final String... steps) {
    // @formatter:off
    Elements.Builder builder =
        new Elements.Builder()
            .div()
            .div()
            .css("eap-toggle-controls")
            .a()
            .css("clickable")
            .rememberAs("toggle")
            .start("i")
            .css("icon-angle-down")
            .rememberAs("icon")
            .end()
            .span()
            .textContent(" " + header)
            .end()
            .end()
            .a()
            .attr("href", "#" + token)
            .span()
            .textContent("Start ")
            .end()
            .start("i")
            .css("icon-circle-arrow-right")
            .end()
            .end()
            .end()
            .div()
            .css("eap-toggle-container")
            .rememberAs("body")
            .p()
            .textContent(intro)
            .end()
            .ol()
            .rememberAs("steps")
            .end()
            .end()
            .end();
    // @formatter:on
    wireToggle(builder.referenceFor("toggle"));

    Document document = Browser.getDocument();
    Element ol = builder.referenceFor("steps");
    for (String step : steps) {
      Element li = document.createLIElement();
      li.setInnerHTML(step);
      ol.appendChild(li);
    }

    this.icon = builder.referenceFor("icon");
    this.body = builder.referenceFor("body");
    this.root = builder.build();
    this.collapsed = false;
  }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 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);
   }
 }
Exemplo n.º 4
0
 /** 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);
 }
Exemplo n.º 5
0
 public static Window getWindow() {
   return Browser.getWindow();
 }
Exemplo n.º 6
0
 public static Document getDocument() {
   return Browser.getDocument();
 }
Exemplo n.º 7
0
 public String historyToken(PlaceRequest placeRequest) {
   String href = Browser.getWindow().getLocation().getHref();
   href = href.substring(0, href.indexOf('#'));
   return href + "#" + tokenFormatter.toHistoryToken(singletonList(placeRequest));
 }
Exemplo n.º 8
0
 @Override
 public void attach() {
   super.attach();
   Browser.getWindow().setOnresize(event -> adjustHeight());
   adjustHeight();
 }