当前位置: 首页>>代码示例>>Java>>正文


Java ImageThumbnailWrapper类代码示例

本文整理汇总了Java中org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper的典型用法代码示例。如果您正苦于以下问题:Java ImageThumbnailWrapper类的具体用法?Java ImageThumbnailWrapper怎么用?Java ImageThumbnailWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ImageThumbnailWrapper类属于org.waveprotocol.wave.client.doodad.attachment.render包,在下文中一共展示了ImageThumbnailWrapper类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: installDoodads

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
private DocumentRegistries.Builder installDoodads(DocumentRegistries.Builder doodads) {
  return doodads.use(new DoodadInstallers.GlobalInstaller() {

    @Override
    public void install(Registries r) {
      DiffAnnotationHandler.register(r.getAnnotationHandlerRegistry(), r.getPaintRegistry());
      DiffDeleteRenderer.register(r.getElementHandlerRegistry());
      StyleAnnotationHandler.register(r);
      LinkAnnotationHandler.register(r, createLinkAttributeAugmenter());
      SelectionAnnotationHandler.register(r, sessionId, profileManager);
      ImageThumbnail.register(r.getElementHandlerRegistry(), AttachmentManagerImpl.getInstance(),
          new ImageThumbnail.ThumbnailActionHandler() {

        @Override
        public boolean onClick(ImageThumbnailWrapper thumbnail) {
          return false;
        }
      });
    }
  });
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:StageOneProvider.java

示例2: onActivated

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
@SuppressWarnings("unchecked") // Limitations of java's type system
@Override
public void onActivated(final ContentElement element) {
  renderer.getView(element).setListener(new ImageThumbnailViewListener() {
        public void onRequestSetFullSizeMode(boolean isOn) {
          element.getMutableDoc().setElementAttribute(element,
              ImageConstants.STYLE_ATTRIBUTE, isOn ? ImageConstants.STYLE_FULL_VALUE : null);
        }
        public void onClickImage() {
          ImageThumbnailWrapper thumbnail = ImageThumbnailWrapper.of(element);
          if (!actionHandler.onClick(thumbnail)) {
            String url = thumbnail.getAttachment().getAttachmentUrl();
            if (url != null) {
              // TODO(nigeltao): Is it necessary to open a window here? All attachments are set to
              // content-disposition=attachment which means the browser should download them.
              // The current implementation means we always get a blank tab.
              Window.open(url, thumbnail.getCaptionText(), "");
            }
          }
        }
      });
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:23,代码来源:ImageThumbnailNodeEventHandler.java

示例3: onActivated

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
@SuppressWarnings("unchecked") // Limitations of java's type system
@Override
public void onActivated(final ContentElement element) {
  renderer.getView(element).setListener(new ImageThumbnailViewListener() {
    public void onRequestSetFullSizeMode(boolean isOn) {
      element.getMutableDoc().setElementAttribute(element,
          ImageThumbnail.STYLE_ATTR, isOn ? ImageThumbnail.STYLE_FULL : null);
    }
    public void onClickImage() {
      ImageThumbnailWrapper thumbnail = ImageThumbnailWrapper.of(element);
      if (!actionHandler.onClick(thumbnail)) {
        String url = thumbnail.getAttachment().getAttachmentUrl();
        if (url != null) {
          // TODO(nigeltao): Is it necessary to open a window here? All attachments are set to
          // content-disposition=attachment which means the browser should download them.
          // The current implementation means we always get a blank tab.
          Window.open(url, thumbnail.getCaptionText(), "");
        }
      }
    }
  });
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:23,代码来源:ImageThumbnailNodeEventHandler.java

示例4: installDoodads

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
protected DocumentRegistries.Builder installDoodads(DocumentRegistries.Builder doodads) {
  return doodads.use(new DoodadInstallers.GlobalInstaller() {
    @Override
    public void install(Registries r) {
      DiffAnnotationHandler.register(r.getAnnotationHandlerRegistry(), r.getPaintRegistry());
      DiffDeleteRenderer.register(r.getElementHandlerRegistry());
      StyleAnnotationHandler.register(r);
      TitleAnnotationHandler.register(r);
      LinkAnnotationHandler.register(r, createLinkAttributeAugmenter());
      SelectionAnnotationHandler.register(r, getSessionId(), getProfileManager());
      ImageThumbnail.register(r.getElementHandlerRegistry(), AttachmentManagerProvider.get(),
          new ImageThumbnail.ThumbnailActionHandler() {

            @Override
            public boolean onClick(ImageThumbnailWrapper thumbnail) {
              return false;
            }
          });
    }
  });
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:22,代码来源:StageTwo.java

示例5: onUploadStarted

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
@Override
public void onUploadStarted(String filename) {
  if (!edit.isEditing()) {
    // A concurrent editor may have deleted the context blip while this user
    // was filling out the upload form.  That was probably the cause of why
    // the edit session has terminated.
    // It may make sense to create a new blip somewhere and resume an edit
    // session, just in order to put the thumbnail somewhere, but that logic
    // would need to avoid making a bad choice of where that new blip goes
    // (e.g., in an unrelated thread, or in a different private reply, etc).
    // The simpler approach is to do nothing, and let the user upload the
    // file again if it still makes sense (the blip in which they intended it
    // to go has been deleted, so they may not want to upload it anymore).
    return;
  }
  EditorContext context = edit.getEditor();
  CMutableDocument doc = context.getDocument();
  FocusedContentRange selection = context.getSelectionHelper().getSelectionPoints();
  Point<ContentNode> point;
  if (selection != null) {
    point = selection.getFocus();
  } else {
    // Focus was probably lost.  Bring it back.
    context.focus(false);
    selection = context.getSelectionHelper().getSelectionPoints();
    if (selection != null) {
      point = selection.getFocus();
    } else {
      // Still no selection.  Oh well, put it at the end.
      point = doc.locate(doc.size() - 1);
    }
  }
  XmlStringBuilder content = ImageThumbnail.constructXml(null, filename);
  thumbnail = ImageThumbnailWrapper.of(doc.insertXml(point, content));
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:36,代码来源:UploadToolbarAction.java

示例6: onClick

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
@Override
public boolean onClick(ImageThumbnailWrapper thumbnail) {
  Window.open(thumbnail.getAttachment().getAttachmentUrl(),
      thumbnail.getAttachment().getFilename(), "");

  return true;
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:8,代码来源:DownloadThumbnailAction.java

示例7: createInsertAttachmentButton

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
private void createInsertAttachmentButton(ToolbarView toolbar, final ParticipantId user) {
    WaveRef waveRef = WaveRef.of(waveId);
    Preconditions.checkState(waveRef != null);
    final String waveRefToken = URL.encode(GwtWaverefEncoder.encodeToUriQueryString(waveRef));

    new ToolbarButtonViewBuilder().setIcon(css.insertAttachment()).setTooltip("Insert attachment")
        .applyTo(toolbar.addClickButton(), new ToolbarClickButton.Listener() {
          @Override
          public void onClicked() {
            int tmpCursor = -1;
            FocusedRange focusedRange = editor.getSelectionHelper().getSelectionRange();
            if (focusedRange != null) {
              tmpCursor = focusedRange.getFocus();
            }
            final int cursorLoc = tmpCursor;
            AttachmentPopupView attachmentView = new AttachmentPopupWidget();
            attachmentView.init(new Listener() {

              @Override
              public void onShow() {
              }

              @Override
              public void onHide() {
              }

              @Override
              public void onDone(String encodedWaveRef, String attachmentId, String fullFileName) {
                // Insert a file name linking to the attachment URL.
                int lastSlashPos = fullFileName.lastIndexOf("/");
                int lastBackSlashPos = fullFileName.lastIndexOf("\\");
                String fileName = fullFileName;
                if (lastSlashPos != -1) {
                  fileName = fullFileName.substring(lastSlashPos + 1, fullFileName.length());
                } else if (lastBackSlashPos != -1) {
                  fileName = fullFileName.substring(lastBackSlashPos + 1, fullFileName.length());
                }
                /*
                 * From UploadToolbarAction in Walkaround
                 * @author [email protected] (David Hearnden)
                 */
                CMutableDocument doc = editor.getDocument();
                FocusedContentRange selection = editor.getSelectionHelper().getSelectionPoints();
                Point<ContentNode> point;
                if (selection != null) {
                  point = selection.getFocus();
                } else {
                  // Focus was probably lost.  Bring it back.
                  editor.focus(false);
                  selection = editor.getSelectionHelper().getSelectionPoints();
                  if (selection != null) {
                    point = selection.getFocus();
                  } else {
                    // Still no selection.  Oh well, put it at the end.
                    point = doc.locate(doc.size() - 1);
                  }
                }
                XmlStringBuilder content = ImageThumbnail.constructXml(attachmentId, fileName);
                ImageThumbnailWrapper thumbnail = ImageThumbnailWrapper.of(doc.insertXml(point, content));
                thumbnail.setAttachmentId(attachmentId);
              }
            });

            attachmentView.setAttachmentId(attachmentIdGenerator.newAttachmentId());
            attachmentView.setWaveRef(waveRefToken);
            attachmentView.show();
          }
        });
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:70,代码来源:EditToolbar.java

示例8: onClick

import org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper; //导入依赖的package包/类
/**
 * Called when the user clicks the thumbnail.
 *
 * @return true if the action was handled in a special manner, false to allow default behaviour
 */
boolean onClick(ImageThumbnailWrapper thumbnail);
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:7,代码来源:ImageThumbnail.java


注:本文中的org.waveprotocol.wave.client.doodad.attachment.render.ImageThumbnailWrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。