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


Java JsArray.push方法代码示例

本文整理汇总了Java中com.google.gwt.core.client.JsArray.push方法的典型用法代码示例。如果您正苦于以下问题:Java JsArray.push方法的具体用法?Java JsArray.push怎么用?Java JsArray.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.core.client.JsArray的用法示例。


在下文中一共展示了JsArray.push方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPeerConnection

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
@NotNull
@Override
public Promise<WebRTCPeerConnection> createPeerConnection(final WebRTCIceServer[] webRTCIceServers, WebRTCSettings settings) {
    return new Promise<>(new PromiseFunc<WebRTCPeerConnection>() {
        @Override
        public void exec(@NotNull PromiseResolver<WebRTCPeerConnection> resolver) {
            JsArray<JsIceServer> servers = JsArray.createArray().cast();
            for (WebRTCIceServer s : webRTCIceServers) {
                if (s.getUsername() != null || s.getCredential() != null) {
                    servers.push(JsIceServer.create(s.getUrl(), s.getUsername(), s.getCredential()));
                } else {
                    servers.push(JsIceServer.create(s.getUrl()));
                }
            }
            resolver.result(new PeerConnection(JsPeerConnection.create(JsPeerConnectionConfig.create(servers))));
        }
    });
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:19,代码来源:JsWebRTCProvider.java

示例2: create

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
public static JsCall create(JsMessenger messenger, CallVM model) {
    JsArray<JsPeerInfo> members = JsArray.createArray().cast();
    for (CallMember member : model.getMembers().get()) {
        members.push(messenger.buildPeerInfo(Peer.user(member.getUid())));
    }
    String state;
    switch (model.getState().get()) {
        case RINGING:
            state = "calling";
            break;
        case CONNECTING:
            state = "connecting";
            break;
        case IN_PROGRESS:
            state = "in_progress";
            break;
        default:
        case ENDED:
            state = "ended";
            break;
    }
    return create(JsPeer.create(model.getPeer()), model.isOutgoing(), members, state, model.getIsMuted().get());
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:24,代码来源:JsCall.java

示例3: getElementsByClassName

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
/**
 * Gets a list of descendants of e that match the given class name.
 *
 * If the browser has the native method, that will be called. Otherwise, it
 * traverses descendents of the given element and returns the list of elements
 * with matching classname.
 *
 * @param e
 * @param className
 */
public static NodeList<Element> getElementsByClassName(Element e, String className) {
  if (QuirksConstants.SUPPORTS_GET_ELEMENTS_BY_CLASSNAME) {
    return getElementsByClassNameNative(e, className);
  } else {
    NodeList<Element> all = e.getElementsByTagName("*");
    if (all == null) {
      return null;
    }
    JsArray<Element> ret = JavaScriptObject.createArray().cast();
    for (int i = 0; i < all.getLength(); ++i) {
      Element item = all.getItem(i);
      if (className.equals(item.getClassName())) {
        ret.push(item);
      }
    }
    return ret.cast();
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:29,代码来源:DomHelper.java

示例4: filterForRevision

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
private static NativeMap<JsArray<CommentInfo>> filterForRevision(
    NativeMap<JsArray<CommentInfo>> comments, int id) {
  NativeMap<JsArray<CommentInfo>> filtered = NativeMap.create();
  for (String k : comments.keySet()) {
    JsArray<CommentInfo> allRevisions = comments.get(k);
    JsArray<CommentInfo> thisRevision = JsArray.createArray().cast();
    for (int i = 0; i < allRevisions.length(); i++) {
      CommentInfo c = allRevisions.get(i);
      if (c.patchSet() == id) {
        thisRevision.push(c);
      }
    }
    filtered.put(k, thisRevision);
  }
  return filtered;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:ChangeScreen.java

示例5: toArray

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
static <T extends JavaScriptObject> JsArray<T> toArray(final Collection<T> collection) {
  JsArray<T> array = JavaScriptObject.createArray().cast();
  for (T t : collection) {
    array.push(t);
  }
  return array;
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:8,代码来源:JsUtil.java

示例6: findMentions

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
@UsedByApp
public JsArray<JsMentionFilterResult> findMentions(int gid, String query) {
    List<MentionFilterResult> res = messenger.findMentions(gid, query);
    JsArray<JsMentionFilterResult> mentions = JsArray.createArray().cast();
    for (MentionFilterResult m : res) {
        mentions.push(JsMentionFilterResult.create(m));
    }
    return mentions;
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:10,代码来源:JsFacade.java

示例7: findBotCommands

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
@UsedByApp
public JsArray<JsBotCommand> findBotCommands(int uid, String query) {
    JsArray<JsBotCommand> commands = JsArray.createArray().cast();
    for (BotCommand c : messenger.getUser(uid).getBotCommands().get()) {
        if (c.getSlashCommand().startsWith(query)) {
            commands.push(JsBotCommand.create(c.getSlashCommand(), c.getDescription()));
        }
    }
    return commands;
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:11,代码来源:JsFacade.java

示例8: convertSearchRes

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
private JsArray<JsMessageSearchEntity> convertSearchRes(List<MessageSearchEntity> res) {
    JsArray<JsMessageSearchEntity> jsRes = JsArray.createArray().cast();
    for (MessageSearchEntity e : res) {
        jsRes.push(JsMessageSearchEntity.create(e.getRid() + "",
                messenger.buildPeerInfo(Peer.user(e.getSenderId())),
                //返回带时间的格式
                //by Lining 2017/3/9
                //messenger.getFormatter().formatDate(e.getDate()),
                messenger.getFormatter().formatDate(e.getDate()) + " " + messenger.getFormatter().formatTime(e.getDate()),
                JsContent.createContent(e.getContent(),
                        e.getSenderId())));
    }
    return jsRes;
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:15,代码来源:JsFacade.java

示例9: convert

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
@Override
public JsMessage convert(Message value) {
    JsMessenger messenger = JsMessenger.getInstance();

    String rid = value.getRid() + "";
    String sortKey = value.getSortDate() + "";

    JsPeerInfo sender = messenger.buildPeerInfo(Peer.user(value.getSenderId()));
    boolean isOut = value.getSenderId() == messenger.myUid();
    boolean isOnServer = value.isOnServer();
    String date = messenger.getFormatter().formatTime(value.getDate());
    JsDate fullDate = JsDate.create(value.getDate());

    JsContent content = JsContent.createContent(value.getContent(),
            value.getSenderId());

    JsArray<JsReaction> reactions = JsArray.createArray().cast();

    for (Reaction r : value.getReactions()) {
        JsArrayInteger uids = (JsArrayInteger) JsArrayInteger.createArray();
        boolean isOwnSet = false;
        for (Integer i : r.getUids()) {
            uids.push(i);
            if (i == messenger.myUid()) {
                isOwnSet = true;
            }
        }
        reactions.push(JsReaction.create(r.getCode(), uids, isOwnSet));
    }
    double sortDate = value.getDate() / 1000.0;
    return create(rid, sortKey, sender, isOut, date, fullDate, Enums.convert(value.getMessageState()), isOnServer, content,
            reactions, sortDate);
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:34,代码来源:JsMessage.java

示例10: setPositions

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
@Override
public final void setPositions(List<Position> positions) {
  JsArray<OrionLinkedModelPositionOverlay> arr = JavaScriptObject.createArray().cast();
  for (Position position : positions) {
    OrionLinkedModelPositionOverlay pos = JavaScriptObject.createObject().cast();
    pos.setLength(position.getLength());
    pos.setOffset(position.getOffset());
    arr.push(pos);
  }
  setPositions(arr);
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:OrionLinkedModelGroupOverlay.java

示例11: setGroups

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
@Override
public final void setGroups(List<LinkedModelGroup> groups) {
  JsArray<OrionLinkedModelGroupOverlay> arr = JavaScriptObject.createArray().cast();
  for (LinkedModelGroup group : groups) {
    if (group instanceof OrionLinkedModelGroupOverlay) {
      arr.push((OrionLinkedModelGroupOverlay) group);
    } else {
      throw new IllegalArgumentException(
          "This implementation supports only OrionLinkedModelGroupOverlay groups");
    }
  }
  setGroups(arr);
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:OrionLinkedModelOverlay.java

示例12: createPeerConnection

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
@NotNull
@Override
public Promise<WebRTCPeerConnection> createPeerConnection(final WebRTCIceServer[] webRTCIceServers, WebRTCSettings settings) {
    return new Promise<>((PromiseFunc<WebRTCPeerConnection>) resolver -> {
        JsArray<JsIceServer> servers = JsArray.createArray().cast();
        for (WebRTCIceServer s : webRTCIceServers) {
            if (s.getUsername() != null || s.getCredential() != null) {
                servers.push(JsIceServer.create(s.getUrl(), s.getUsername(), s.getCredential()));
            } else {
                servers.push(JsIceServer.create(s.getUrl()));
            }
        }
        resolver.result(new PeerConnection(JsPeerConnection.create(JsPeerConnectionConfig.create(servers))));
    });
}
 
开发者ID:actorapp,项目名称:actor-platform,代码行数:16,代码来源:JsWebRTCProvider.java

示例13: convertSearchRes

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
private JsArray<JsMessageSearchEntity> convertSearchRes(List<MessageSearchEntity> res) {
    JsArray<JsMessageSearchEntity> jsRes = JsArray.createArray().cast();
    for (MessageSearchEntity e : res) {
        jsRes.push(JsMessageSearchEntity.create(e.getRid() + "",
                messenger.buildPeerInfo(Peer.user(e.getSenderId())),
                messenger.getFormatter().formatDate(e.getDate()),
                JsContent.createContent(e.getContent(),
                        e.getSenderId())));
    }
    return jsRes;
}
 
开发者ID:actorapp,项目名称:actor-platform,代码行数:12,代码来源:JsFacade.java

示例14: create

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
public static JsCall create(JsMessenger messenger, CallVM model) {
    JsArray<JsPeerInfo> members = JsArray.createArray().cast();
    for (CallMember member : model.getMembers().get()) {
        members.push(messenger.buildPeerInfo(Peer.user(member.getUid())));
    }
    String state;
    switch (model.getState().get()) {
        case RINGING:
            state = "calling";
            break;
        case CONNECTING:
            state = "connecting";
            break;
        case IN_PROGRESS:
            state = "in_progress";
            break;
        default:
        case ENDED:
            state = "ended";
            break;
    }
    JsArray<JsMediaStreamTrack> tracks = JsArray.createArray().cast();
    for (WebRTCMediaTrack track : model.getTheirVideoTracks().get()) {
        tracks.push(((MediaTrack) track).getTrack());
    }
    ArrayList<WebRTCMediaTrack> ownTrack = model.getOwnVideoTracks().get();
    return create(JsPeer.create(model.getPeer()), model.isOutgoing(), members, state, !model.getIsAudioEnabled().get(), ownTrack.size() == 0 ? null : ((MediaTrack) ownTrack.get(0)).getTrack(), tracks);
}
 
开发者ID:actorapp,项目名称:actor-platform,代码行数:29,代码来源:JsCall.java

示例15: filterForParent

import com.google.gwt.core.client.JsArray; //导入方法依赖的package包/类
private JsArray<CommentInfo> filterForParent(JsArray<CommentInfo> list) {
  JsArray<CommentInfo> result = JsArray.createArray().cast();
  for (CommentInfo c : Natives.asList(list)) {
    if (c.side() == Side.REVISION) {
      result.push(c);
    } else if (base.isBaseOrAutoMerge() && !c.hasParent()) {
      result.push(c);
    } else if (base.isParent() && c.parent() == base.getParentNum()) {
      result.push(c);
    }
  }
  return result;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:CommentsCollections.java


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