コード例 #1
0
ファイル: RStudio.java プロジェクト: themel/rstudio
  private Command showProgress() {
    String progressUrl = ProgressImages.createLargeGray().getUrl();
    final DivElement div = Document.get().createDivElement();
    div.setInnerHTML("<img src=\"" + progressUrl + "\"/>");
    div.getStyle().setWidth(100, Style.Unit.PCT);
    div.getStyle().setMarginTop(200, Style.Unit.PX);
    div.getStyle().setProperty("textAlign", "center");
    div.getStyle().setZIndex(1000);
    Document.get().getBody().appendChild(div);

    return new Command() {
      public void execute() {
        try {
          Document.get().getBody().removeChild(div);
        } catch (Exception e) {
          Debug.log(e.toString());
        }
      }
    };
  }
コード例 #2
0
ファイル: GalleryPanel.java プロジェクト: ssinica/ssgallery
 private void clearBigPhotoWrapper() {
   elBigPhotoW.setInnerHTML("");
   elBigPhotoW.removeClassName(CSS_BIG_PHOTO_ON);
 }
コード例 #3
0
 /**
  * Set the header.
  *
  * @param headerTextString header text.
  */
 public void setHeader(final String headerTextString) {
   headerText.getStyle().setDisplay(Display.BLOCK);
   headerText.setInnerHTML(headerTextString);
 }
コード例 #4
0
ファイル: GalleryPanel.java プロジェクト: ssinica/ssgallery
 private void showBigPhotoWrapper(String html) {
   elBigPhotoW.setInnerHTML(html);
   elBigPhotoW.addClassName(CSS_BIG_PHOTO_ON);
 }
コード例 #5
0
  private void displayTests() {
    final BodyElement body = Document.get().getBody();

    for (final Class<?> c : testClasses.keySet()) {
      final DivElement div = Document.get().createDivElement();
      div.getStyle().setDisplay(Display.INLINE_BLOCK);
      div.getStyle().setVerticalAlign(VerticalAlign.TOP);
      div.getStyle().setMarginRight(2, Unit.EM);
      div.getStyle().setProperty("maxHeight", "400px");
      div.getStyle().setOverflowY(Overflow.AUTO);

      StringBuilder b = new StringBuilder();
      final String id = toId(c);
      b.append("<h3><a id='" + id + "' href='#run:" + id + "'>")
          .append(c.getName())
          .append("</a></h3>")
          .append("<div class='results' id='" + TEST_RESULTS + id + "'> </div>");
      try {
        final String path = c.getProtectionDomain().getCodeSource().getLocation().getPath();
        b.append("<sup><a href='file://" + path + "'>").append(path).append("</a></sup>");
      } catch (final Exception ignored) {
      }
      div.setInnerHTML(b.toString());
      for (final Method m : testClasses.get(c)) {
        final String methodId = m.getName() + c.hashCode();
        b = new StringBuilder();
        b.append("<pre>");
        b.append("<a href='javascript:'>");
        b.append(m.getName());
        b.append("</a>");
        b.append('(');
        b.append(ReflectUtil.joinClasses(", ", m.getParameterTypes()));
        b.append(')');
        b.append("</pre>");
        b.append("<div id='" + methodId + "'> </div>");
        final Element el = Document.get().createDivElement().cast();
        el.setInnerHTML(b.toString());
        DOM.setEventListener(
            el,
            new EventListener() {
              @Override
              public void onBrowserEvent(final Event event) {
                if (event.getTypeInt() == Event.ONCLICK) {
                  runTest(m);
                }
              }
            });
        DOM.sinkEvents(el, Event.ONCLICK);
        div.appendChild(el);
      }
      body.appendChild(div);
      final Element anchor = Document.get().getElementById(id).cast();
      DOM.setEventListener(
          anchor,
          new EventListener() {
            @Override
            public void onBrowserEvent(final Event event) {
              final Map<Method, Boolean> res = testResults.get(c);

              for (final Method m : res.keySet().toArray(new Method[res.size()])) {
                res.put(m, null);
              }
              updateTestClass(c);

              for (final Method m : testClasses.get(c)) {
                Scheduler.get()
                    .scheduleDeferred(
                        new ScheduledCommand() {
                          @Override
                          public void execute() {
                            runTest(m);
                          }
                        });
              }
            }
          });
      DOM.sinkEvents(anchor, Event.ONCLICK);
    }
  }