public void setValue(StudentProxy proxy) {
   this.proxy = proxy;
   id.setInnerText(proxy.getId() == null ? "" : String.valueOf(proxy.getId()));
   name.setInnerText(proxy.getName() == null ? "" : String.valueOf(proxy.getName()));
   version.setInnerText(proxy.getVersion() == null ? "" : String.valueOf(proxy.getVersion()));
   displayRenderer.setInnerText(StudentProxyRenderer.instance().render(proxy));
 }
Esempio n. 2
0
 public void testDomAccessInHtmlPanel() {
   SpanElement messageInMain = widgetUi.messageInMain;
   String text = messageInMain.getInnerText().trim();
   assertTrue(
       "sideBar should start: \"This is the main area\"",
       text.startsWith("This is the main area"));
   assertTrue("sideBar should end: \"example.\"", text.endsWith("example."));
 }
 public void setValue(TimerProxy proxy) {
   this.proxy = proxy;
   id.setInnerText(proxy.getId() == null ? "" : String.valueOf(proxy.getId()));
   message.setInnerText(proxy.getMessage() == null ? "" : String.valueOf(proxy.getMessage()));
   version.setInnerText(proxy.getVersion() == null ? "" : String.valueOf(proxy.getVersion()));
   displayRenderer.setInnerText(
       com.venca.client.managed.ui.renderer.TimerProxyRenderer.instance().render(proxy));
 }
Esempio n. 4
0
 private void setCurrentUser(String loggedInUser) {
   if (GWTUtils.isEmpty(loggedInUser)) {
     elLogged.setInnerHTML("");
     elLoggedWrapper.getStyle().setDisplay(Display.NONE);
     elLoginWrapper.getStyle().setDisplay(Display.BLOCK);
   } else {
     elLogged.setInnerHTML(GWTUtils.safeString(loggedInUser));
     elLoggedWrapper.getStyle().setDisplay(Display.BLOCK);
     elLoginWrapper.getStyle().setDisplay(Display.NONE);
   }
 }
  public com.google.gwt.user.client.ui.Widget createAndBindUi(
      final com.google.gwt.requestfactory.ui.client.LoginWidget owner) {

    com.google.gwt.requestfactory.ui.client.LoginWidget_BinderImpl_GenBundle
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay =
            (com.google.gwt.requestfactory.ui.client.LoginWidget_BinderImpl_GenBundle)
                GWT.create(
                    com.google.gwt.requestfactory.ui.client.LoginWidget_BinderImpl_GenBundle.class);
    com.google.gwt.requestfactory.ui.client.LoginWidget_BinderImpl_GenCss_style style =
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style();
    com.google.gwt.dom.client.SpanElement name = null;
    java.lang.String domId0 = com.google.gwt.dom.client.Document.get().createUniqueId();
    java.lang.String domId1 = com.google.gwt.dom.client.Document.get().createUniqueId();
    com.google.gwt.user.client.ui.InlineLabel logoutLink =
        (com.google.gwt.user.client.ui.InlineLabel)
            GWT.create(com.google.gwt.user.client.ui.InlineLabel.class);
    com.google.gwt.user.client.ui.HTMLPanel f_HTMLPanel1 =
        new com.google.gwt.user.client.ui.HTMLPanel(
            "<div> <span id='"
                + domId0
                + "'>Not logged in</span> | <span id='"
                + domId1
                + "'></span> </div>");

    logoutLink.setText("Sign out");
    logoutLink.addStyleName("" + style.link() + "");

    UiBinderUtil.TempAttachment attachRecord0 = UiBinderUtil.attachToDom(f_HTMLPanel1.getElement());
    name = com.google.gwt.dom.client.Document.get().getElementById(domId0).cast();
    name.removeAttribute("id");
    com.google.gwt.user.client.Element domId1Element =
        com.google.gwt.dom.client.Document.get().getElementById(domId1).cast();
    attachRecord0.detach();
    f_HTMLPanel1.addAndReplaceElement(logoutLink, domId1Element);

    final com.google.gwt.event.dom.client.ClickHandler
        handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1 =
            new com.google.gwt.event.dom.client.ClickHandler() {
              public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                owner.handleClick(event);
              }
            };
    logoutLink.addClickHandler(handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1);

    owner.name = name;
    clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style().ensureInjected();

    return f_HTMLPanel1;
  }
Esempio n. 6
0
  private void clearImagesState() {
    selectedFolder = null;
    loadedImages.clear();
    totalImagesCount = 0;
    nextImageId = null;
    prevImageId = null;
    startIndex = 0;
    selectedImageId = null;

    // clear and hide big photo wrapper
    clearBigPhotoWrapper();
    elFolder.setInnerHTML("");
    elCount.setInnerHTML("");
    elCountDetails.setInnerHTML("");
  }
Esempio n. 7
0
  public void setData(TaskDTO data) {
    this.task = data;
    name.setInnerHTML(data.getName());
    endDate.setInnerHTML(data.getEndDate());
    delegator.setInnerHTML(data.getDelegator());
    priority.setInnerHTML(data.getPriority() + "");
    percentCompleted.setInnerHTML(data.getPercentCompleted() + " %");
    if (!data.getExternalId().isEmpty()) {
      // TODO : display edit percent completed
      range.getStyle().setDisplay(Style.Display.NONE);
    }

    range.setAttribute("min", "0");
    range.setAttribute("max", "100");
    range.setAttribute("step", "5");
    range.setAttribute("value", String.valueOf(data.getPercentCompleted()));
    range.setDisabled(true);
    updateRange(data.getPercentCompleted());
  }
Esempio n. 8
0
  public String processCommandEntry() {
    // parse out the command text
    String promptText = prompt_.getElement().getInnerText();
    String commandText = input_.getCode();
    input_.setText("");
    // Force render to avoid subtle command movement in the console, caused
    // by the prompt disappearing before the input line does
    input_.forceImmediateRender();
    prompt_.setHTML("");

    SpanElement pendingPrompt = Document.get().createSpanElement();
    pendingPrompt.setInnerText(promptText);
    pendingPrompt.setClassName(styles_.prompt() + " " + KEYWORD_CLASS_NAME);

    if (!suppressPendingInput_ && !input_.isPasswordMode()) {
      SpanElement pendingInput = Document.get().createSpanElement();
      pendingInput.setInnerText(StringUtil.notNull(commandText).split("\n")[0] + "\n");
      pendingInput.setClassName(styles_.command() + " " + KEYWORD_CLASS_NAME);
      pendingInput_.getElement().appendChild(pendingPrompt);
      pendingInput_.getElement().appendChild(pendingInput);
      pendingInput_.setVisible(true);
    }

    ensureInputVisible();

    return commandText;
  }
  @Ignore
  @Test
  public void checkParse() throws Exception {
    // Setup
    String html =
        "<div id=\"parent0\"></div><div id=\"parent1\"><div id=\"child0\"><span class=\"spanClass\" >test</span></div><BR><DIV id=\"child2\" style=\"color:red; font-style:italic; font-weight:bold; font-family:Arial\"></div>";

    // Test
    NodeList<Node> nodes = GwtHtmlParser.parse(html);

    // Assert
    Assert.assertEquals(2, nodes.getLength());
    DivElement parent0 = (DivElement) nodes.getItem(0);
    Assert.assertEquals("parent0", parent0.getId());
    Assert.assertEquals(0, parent0.getChildCount());

    DivElement parent1 = (DivElement) nodes.getItem(1);
    Assert.assertEquals("parent1", parent1.getId());
    Assert.assertEquals(3, parent1.getChildCount());

    DivElement child0 = (DivElement) parent1.getChild(0);
    Assert.assertEquals("child0", child0.getId());
    Assert.assertEquals(1, child0.getChildCount());

    SpanElement span = (SpanElement) child0.getChild(0);
    Assert.assertEquals("", span.getId());
    Assert.assertEquals("spanClass", span.getClassName());
    Assert.assertEquals(1, span.getChildCount());
    Assert.assertEquals(Node.TEXT_NODE, span.getChild(0).getNodeType());
    Text text = span.getChild(0).cast();
    Assert.assertEquals("test", text.getData());
    Assert.assertEquals("test", span.getInnerText());

    BRElement br = (BRElement) parent1.getChild(1);
    Assert.assertEquals("", br.getId());

    DivElement child2 = (DivElement) parent1.getChild(2);
    Assert.assertEquals("child2", child2.getId());
    Assert.assertEquals(0, child2.getChildCount());
    Style style = child2.getStyle();
    Assert.assertEquals("red", style.getColor());
  }
Esempio n. 10
0
 @Override
 public void setUserData(User authenticatedUser) {
   spanName.setInnerText(authenticatedUser.getName());
 }
 public void setMemberCount(String memberCount) {
   memberCountSpan.setInnerText(memberCount);
 }
Esempio n. 12
0
  private boolean output(String text, String className, boolean addToTop) {
    if (text.indexOf('\f') >= 0) clearOutput();

    Node node;
    boolean isOutput = StringUtil.isNullOrEmpty(className) || className.equals(styles_.output());

    if (isOutput && !addToTop && trailingOutput_ != null) {
      // Short-circuit the case where we're appending output to the
      // bottom, and there's already some output there. We need to
      // treat this differently in case the new output uses control
      // characters to pound over parts of the previous output.

      int oldLineCount = DomUtils.countLines(trailingOutput_, true);
      trailingOutputConsole_.submit(text);
      trailingOutput_.setNodeValue(ensureNewLine(trailingOutputConsole_.toString()));
      int newLineCount = DomUtils.countLines(trailingOutput_, true);
      lines_ += newLineCount - oldLineCount;
    } else {
      Element outEl = output_.getElement();

      text = VirtualConsole.consolify(text);
      if (isOutput) {
        VirtualConsole console = new VirtualConsole();
        console.submit(text);
        String consoleSnapshot = console.toString();

        // We use ensureNewLine to make sure that even if output
        // doesn't end with \n, a prompt will appear on its own line.
        // However, if we call ensureNewLine indiscriminantly (i.e.
        // on an output that's going to be followed by another output)
        // we can end up inserting newlines where they don't belong.
        //
        // It's safe to add a newline when we're appending output to
        // the end of the console, because if the next append is also
        // output, we'll use the contents of VirtualConsole and the
        // newline we add here will be plowed over.
        //
        // If we're prepending output to the top of the console, then
        // it's safe to add a newline if the next chunk (which is already
        // there) is something besides output.
        if (!addToTop
            || (!outEl.hasChildNodes() || outEl.getFirstChild().getNodeType() != Node.TEXT_NODE)) {
          consoleSnapshot = ensureNewLine(consoleSnapshot);
        }

        node = Document.get().createTextNode(consoleSnapshot);
        if (!addToTop) {
          trailingOutput_ = (Text) node;
          trailingOutputConsole_ = console;
        }
      } else {
        SpanElement span = Document.get().createSpanElement();
        span.setClassName(className);
        span.setInnerText(text);
        node = span;
        if (!addToTop) {
          trailingOutput_ = null;
          trailingOutputConsole_ = null;
        }
      }

      if (addToTop) outEl.insertFirst(node);
      else outEl.appendChild(node);

      lines_ += DomUtils.countLines(node, true);
    }
    return !trimExcess();
  }
 public void setValue(AnswerProxy proxy) {
   this.proxy = proxy;
   dateAdded.setInnerText(
       proxy.getDateAdded() == null
           ? ""
           : DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT)
               .format(proxy.getDateAdded()));
   dateChanged.setInnerText(
       proxy.getDateChanged() == null
           ? ""
           : DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT)
               .format(proxy.getDateChanged()));
   rewiewer.setInnerText(
       proxy.getRewiewer() == null
           ? ""
           : medizin.client.managed.ui.PersonProxyRenderer.instance().render(proxy.getRewiewer()));
   autor.setInnerText(
       proxy.getAutor() == null
           ? ""
           : medizin.client.managed.ui.PersonProxyRenderer.instance().render(proxy.getAutor()));
   answerText.setInnerText(
       proxy.getAnswerText() == null ? "" : String.valueOf(proxy.getAnswerText()));
   isAnswerActive.setInnerText(
       proxy.getIsAnswerActive() == null ? "" : String.valueOf(proxy.getIsAnswerActive()));
   isPicture.setInnerText(
       proxy.getIsPicture() == null ? "" : String.valueOf(proxy.getIsPicture()));
   isAnswerAcceptedReviewWahrer.setInnerText(
       proxy.getIsAnswerAcceptedReviewWahrer() == null
           ? ""
           : String.valueOf(proxy.getIsAnswerAcceptedReviewWahrer()));
   isAnswerAcceptedAutor.setInnerText(
       proxy.getIsAnswerAcceptedAutor() == null
           ? ""
           : String.valueOf(proxy.getIsAnswerAcceptedAutor()));
   isAnswerAcceptedAdmin.setInnerText(
       proxy.getIsAnswerAcceptedAdmin() == null
           ? ""
           : String.valueOf(proxy.getIsAnswerAcceptedAdmin()));
   validity.setInnerText(proxy.getValidity() == null ? "" : String.valueOf(proxy.getValidity()));
   picturePath.setInnerText(
       proxy.getPicturePath() == null ? "" : String.valueOf(proxy.getPicturePath()));
   question.setInnerText(
       proxy.getQuestion() == null
           ? ""
           : medizin.client.managed.ui.QuestionProxyRenderer.instance()
               .render(proxy.getQuestion()));
   id.setInnerText(proxy.getId() == null ? "" : String.valueOf(proxy.getId()));
   version.setInnerText(proxy.getVersion() == null ? "" : String.valueOf(proxy.getVersion()));
   displayRenderer.setInnerText(
       medizin.client.managed.ui.AnswerProxyRenderer.instance().render(proxy));
 }
Esempio n. 14
0
  protected void showImages(
      ClientFolder folder,
      final String selectedImageId,
      List<ClientImage> images,
      boolean repaintImagesList) {

    if (GWTUtils.isEmpty(selectedImageId)) {
      Window.alert("Navigation error");
      return;
    }

    String folderId = folder.getId();

    // set folder name
    if (repaintImagesList) {
      elFolder.setInnerHTML(GWTUtils.safeString(folder.getCaption()));
      elCount.setInnerHTML(Integer.toString(totalImagesCount));
      String s = startIndex + " - " + (startIndex + loadedImages.size() - 1);
      elCountDetails.setInnerHTML(s);
    }

    // set big photo
    clearBigPhotoWrapper();
    StringBuilder sb = new StringBuilder();
    sb.append("<div class='bf-iw'>");
    sb.append("<div uid='" + UID_ROTATE_LEFT + "' class='bf-act bf-act-rl'></div>");
    sb.append("<div uid='" + UID_ROTATE_RIGHT + "' class='bf-act bf-act-rr'></div>");
    sb.append(
        "<img id='big-"
            + selectedImageId
            + "' src='"
            + GalleryClientUtils.genMediumImageSrc(folderId, selectedImageId)
            + "'></img>");
    sb.append("</div>");
    sb.append("<div class='bf-down-w'>");
    sb.append(
        "<a class='bf-down' href='"
            + GalleryClientUtils.genLargeImageSrc(folderId, selectedImageId)
            + "'>скачать в полном размере</a>");
    sb.append("</div>");
    final String bigPhotoHtml = sb.toString();
    new Timer() {
      @Override
      public void run() {
        showBigPhotoWrapper(bigPhotoHtml);
        GalleryPanel.this.selectedImageId = selectedImageId;
      }
    }.schedule(100);

    // show small images list
    if (repaintImagesList) {
      String smallImagesHtml = "";
      for (int i = 0; i < images.size(); i++) {
        ClientImage image = images.get(i);
        boolean navigateLeft = i == 0;
        boolean navigateRight = i == images.size() - 1;
        boolean last = navigateRight;
        smallImagesHtml += genSmallImageHtml(folderId, image, last, navigateLeft, navigateRight);
      }
      setSmallPhotosHtml("", true);
      elBigPhotoW.removeClassName(CSS_SMALL_PHOTOS_ANIME);
      final String resHtml = smallImagesHtml;
      new Timer() {
        @Override
        public void run() {
          setSmallPhotosHtml(resHtml, true);
          elSmallPhotosW.addClassName(CSS_SMALL_PHOTOS_ANIME);
          updateSelectedImageAndNavigation(selectedImageId);
        }
      }.schedule(100);
    } else {
      updateSelectedImageAndNavigation(selectedImageId);
    }
  }
Esempio n. 15
0
  public UiTest2(String firstName) {
    setElement(uiBinder.createAndBindUi(this));

    // Can access @UiField after calling createAndBindUi
    nameSpan.setInnerText(firstName);
  }