Example #1
0
  public void init(String title, ContentKind contentKind) {
    this.title.setInnerText(Strings.isNullOrEmpty(title) ? labels.untitled() : title);
    cardType.setInnerText(contentKind.toString());
    icon.addClassName(contentKind.getIcon());

    updateHeaderWidth(this.title);
  }
  /** 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");
    }
  }
Example #4
0
 private void showBigPhotoWrapper(String html) {
   elBigPhotoW.setInnerHTML(html);
   elBigPhotoW.addClassName(CSS_BIG_PHOTO_ON);
 }