當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。