/** Check the post box. */
  private void checkPostBox() {
    postCharCount.setInnerText(Integer.toString(POST_MAX - postBox.getText().length()));

    if (POST_MAX - postBox.getText().length() < 0) {
      postCharCount.addClassName(style.postCharCountOverLimit());
    } else {
      postCharCount.removeClassName(style.postCharCountOverLimit());
    }

    if ((postBox.getText().length() > 0 && POST_MAX - postBox.getText().length() >= 0)
        || attachment != null) {
      postButton.removeStyleName(style.postButtonInactive());
    } else {
      postButton.addStyleName(style.postButtonInactive());
    }
  }
  /**
   * Load CodeMirror library into editor. TODO: Switching off CodeMirror support will be removed in
   * Q2 2016. Targeting for R8.
   */
  private void loadCodeMirrorForHeaders() {
    if (SyncAdapter.codeMirrorHeaders) {
      tabContent.addClassName("codeMirror");

      if (headersCodeMirror != null) {
        headersCodeMirror.refresh();
        return;
      }

      CodeMirrorOptions opt = CodeMirrorOptions.create();
      opt.setMode("message/http");
      //			opt.setTheme("headers");
      opt.setAutoClearEmptyLines(true);
      opt.setLineWrapping(true);

      CodeMirrorKeyMap extraKey = CodeMirrorKeyMap.create();
      extraKey.add("Ctrl-Space", "autocompleteHeaders");
      opt.setExtraKeys(extraKey);

      setHeadersEditor();

      if (!(headersData == null || headersData.isEmpty())) {
        opt.setValue(headersData);
      }
      headersCodeMirror =
          CodeMirror.fromTextArea(
              headersRawInput.getElement(),
              opt,
              new CodeMirrorChangeHandler() {
                @Override
                public void onChage() {
                  headersData = headersCodeMirror.getValue();
                  headersRawInput.setValue(headersData);
                  Log.info("Code mirror change fired actually now::" + headersData);
                }
              });
      setHeadersEditorCallback(headersCodeMirror.getInstance());
      headersCodeMirror.refresh();
      // RestClient.fixChromeLayout();
    } else {
      if (headersCodeMirror != null) {
        headersCodeMirror.toTextArea();
        headersCodeMirror = null;
      }
      tabContent.removeClassName("codeMirror");
    }
  }
Exemple #3
0
 private void clearBigPhotoWrapper() {
   elBigPhotoW.setInnerHTML("");
   elBigPhotoW.removeClassName(CSS_BIG_PHOTO_ON);
 }
Exemple #4
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);
    }
  }