當前位置: 首頁>>代碼示例>>Java>>正文


Java JsArray類代碼示例

本文整理匯總了Java中com.google.gwt.core.client.JsArray的典型用法代碼示例。如果您正苦於以下問題:Java JsArray類的具體用法?Java JsArray怎麽用?Java JsArray使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JsArray類屬於com.google.gwt.core.client包,在下文中一共展示了JsArray類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onTouchEvent

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
@Override
public void onTouchEvent(TouchEvent event) {
    NativeEvent nativeEvent = event.getNativeEvent();

    JsArray<Touch> touches = nativeEvent.getTouches();
    boolean isMouseClick = isMouseClick(touches); // method is also called
    // when MouseEvents
    // occur
    boolean isOneFingerTouch = isOneFingerTouch(touches);

    switch (event.getType()) {
        case TOUCH_START:
            if (isMouseClick || isOneFingerTouch) {
                onTouchStart(nativeEvent);
            } else {
                onTouchCancel(nativeEvent);
            }
            break;
        case TOUCH_CANCEL:
        case TOUCH_END:
            onTouchEnd(nativeEvent);
            break;
        case TOUCH_MOVE:
            if (isMouseClick || isOneFingerTouch) {
                onTouchMove(nativeEvent);
            } else {
                onTouchCancel(nativeEvent);
            }
            break;
        default:
            break;
    }

}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:35,代碼來源:AbstractConnectionView.java

示例2: getDeclarationsForSelectors

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
/**
 * Adds style properties to existing JSOModel. All style properties are converted to lowercase.
 */
public final Map<String, String> getDeclarationsForSelectors(List<String> selectors) {
    JsArray<JsCssRule> rules = getCssRules(styleSheet);
    Map<String, String> result = new HashMap<String, String>();
    int ln = rules.length();
    for (int i = 0; i < ln; i++) {
        JsCssRule rule = rules.get(i);
        if (rule.isStyleRule() && selectors.contains(rule.getSelector())) {
            JsArray<JsCssDeclaration> declarations = rule.getDeclarations();
            int dln = declarations.length();
            for (int j = 0; j < dln; j++) {
                JsCssDeclaration declaration = declarations.get(j);
                if (declaration.getProperty() != null && declaration.getValue() != null)
                    result.put(declaration.getProperty(), declaration.getValue());
            }
        }
    }
    return result;
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:22,代碼來源:StyleSheet.java

示例3: 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

示例4: loadSessions

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
@UsedByApp
public JsPromise loadSessions() {
    return JsPromise.create(new JsPromiseExecutor() {
        @Override
        public void execute() {
            messenger.loadSessions().start(new CommandCallback<List<ApiAuthSession>>() {
                @Override
                public void onResult(List<ApiAuthSession> res) {
                    JsArray<JsAuthSession> jsSessions = JsArray.createArray().cast();

                    for (ApiAuthSession session : res) {
                        jsSessions.push(JsAuthSession.create(session));
                    }

                    resolve(jsSessions);
                }

                @Override
                public void onError(Exception e) {
                    Log.e(TAG, e);
                    reject(e.getMessage());
                }
            });
        }
    });
}
 
開發者ID:wex5,項目名稱:dangchat-sdk,代碼行數:27,代碼來源:JsFacade.java

示例5: loadArchivedDialogs

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
@UsedByApp
private JsPromise loadArchivedDialogs(final boolean init) {
    return JsPromise.create(new JsPromiseExecutor() {
        @Override
        public void execute() {
            messenger.loadArchivedDialogs(init, new RpcCallback<ResponseLoadArchived>() {
                @Override
                public void onResult(ResponseLoadArchived response) {
                    JsArray<JsDialogShort> res = JsArray.createArray().cast();
                    for (ApiDialog d : response.getDialogs()) {
                        res.push(JsDialogShort.create(messenger.buildPeerInfo(EntityConverter.convert(d.getPeer())), d.getUnreadCount()));
                    }
                    Log.d(TAG, "loadArchivedDialogs:result");
                    resolve(res);
                }

                @Override
                public void onError(RpcException e) {
                    Log.d(TAG, "loadArchivedDialogs:error");
                    reject(e.getMessage());
                }
            });
        }
    });
}
 
開發者ID:wex5,項目名稱:dangchat-sdk,代碼行數:26,代碼來源:JsFacade.java

示例6: findUsers

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
@UsedByApp
public JsPromise findUsers(final String query) {
    return JsPromise.create(new JsPromiseExecutor() {
        @Override
        public void execute() {
            messenger.findUsers(query).start(new CommandCallback<UserVM[]>() {
                @Override
                public void onResult(UserVM[] users) {
                    JsArray<JsUser> jsUsers = JsArray.createArray().cast();
                    for (UserVM user : users) {
                        jsUsers.push(messenger.getJsUser(user.getId()).get());
                    }
                    resolve(jsUsers);
                }

                @Override
                public void onError(Exception e) {
                    reject(e.getMessage());
                }
            });
        }
    });
}
 
開發者ID:wex5,項目名稱:dangchat-sdk,代碼行數:24,代碼來源:JsFacade.java

示例7: registerUsers

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
/**
 * 批量注冊用戶
 * by Lining 2016/8/24
 * @param userIds
 * @param userNames
 * @return
 */
@UsedByApp
public JsPromise registerUsers(final String[] userIds, final String[] userNames) {
    return JsPromise.create(new JsPromiseExecutor() {
        @Override
        public void execute() {
            messenger.registerUsers(userIds, userNames).start(new CommandCallback<RegisteredUserVM[]>() {
                @Override
                public void onResult(RegisteredUserVM[] users) {
                    JsArray<JsRegisteredUser> jsUsers = JsArray.createArray().cast();
                    for (RegisteredUserVM user : users) {
                        jsUsers.push(messenger.getJsUserRegistered(user.getId(), user.getOutId().get(), user.getIsNewUser()).get());
                    }
                    resolve(jsUsers);
                }

                @Override
                public void onError(Exception e) {
                    reject(e.getMessage());
                }
            });
        }
    });
}
 
開發者ID:wex5,項目名稱:dangchat-sdk,代碼行數:31,代碼來源:JsFacade.java

示例8: 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

示例9: create

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
public native static JsMessage create(String rid,
                                      String sortKey,
                                      JsPeerInfo sender,
                                      boolean isOut,
                                      String date,
                                      JsDate fullDate,
                                      String state,
                                      boolean isOnServer,
                                      JsContent content,
                                      JsArray<JsReaction> reactions,
                                      double sortDate)/*-{
    return {
        rid: rid,
        sortKey: sortKey,
        sender: sender,
        isOut: isOut,
        date: date,
        fullDate: fullDate,
        state: state,
        isOnServer: isOnServer,
        content: content,
        reactions: reactions,
        sortDate: sortDate
    };
}-*/;
 
開發者ID:wex5,項目名稱:dangchat-sdk,代碼行數:26,代碼來源:JsMessage.java

示例10: getStickers

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
public JsBindedValue<JsArray<JsSticker>> getStickers() {
    if (stickers == null) {
        stickers = new JsBindedValue<>((JsArray<JsSticker>) JsArray.createArray());
        messenger.getAvailableStickersVM().getOwnStickerPacks().subscribe(new ValueChangedListener<ArrayList<StickerPack>>() {
            @Override
            public void onChanged(ArrayList<StickerPack> val, Value<ArrayList<StickerPack>> valueModel) {
                JsArray<JsSticker> stickerJsArray = JsArray.createArray().cast();
                stickerJsArray.setLength(0);
                for (StickerPack pack : val) {
                    for (Sticker sticker : pack.getStickers()) {
                        stickerJsArray.push(JsSticker.create(sticker));
                    }
                }
                stickers.changeValue(stickerJsArray);
            }
        });
    }
    return stickers;
}
 
開發者ID:wex5,項目名稱:dangchat-sdk,代碼行數:20,代碼來源:JsBindingModule.java

示例11: 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

示例12: toTouchEvents

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
private Touch.Event[] toTouchEvents (Touch.Event.Kind kind, NativeEvent nevent) {
  // Convert the JsArray<Native Touch> to an array of Touch.Events
  JsArray<com.google.gwt.dom.client.Touch> nativeTouches = nevent.getChangedTouches();
  int nativeTouchesLen = nativeTouches.length();
  Touch.Event[] touches = new Touch.Event[nativeTouchesLen];
  double time = plat.time();
  for (int t = 0; t < nativeTouchesLen; t++) {
    com.google.gwt.dom.client.Touch touch = nativeTouches.get(t);
    float x = touch.getRelativeX(rootElement);
    float y = touch.getRelativeY(rootElement);
    Point xy = plat.graphics().transformMouse(x, y);
    int id = getTouchIdentifier(nevent, t);
    touches[t] = new Touch.Event(0, time, xy.x, xy.y, kind, id);
  }
  return touches;
}
 
開發者ID:playn,項目名稱:playn,代碼行數:17,代碼來源:HtmlInput.java

示例13: setIncrementalData

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
void setIncrementalData(JsArrayNumber domain, JsArray<JsArrayNumber> rangeArray) {
  int len = domain.length();  // using this length for both 
  double d[] = new double[len];
  for(int i=0; i<d.length; i++) {
    d[i] = domain.get(i);
  }
  int rangeArrayLength = rangeArray.length();
  Array1D[] ranges = new Array1DImpl[rangeArray.length()];
  for (int dimension = 0; dimension < rangeArrayLength; dimension++) {
      double[] r = new double[len];
      for(int j=0; j < r.length; j++) {
          r[j] = rangeArray.get(dimension).get(j);
      }
      ranges[dimension] = new Array1DImpl(r);
  }

  incremental = new MipMap(new Array1DImpl(d), ranges, -1, getMipMapChain().getMipMap(0));

  Interval region = new Interval(d[0], d[d.length - 1]);
  incrementalInterval = region;
  outgoingRequest = System.currentTimeMillis();
  firing = true;
  datasets.fireChanged(this, region);
  firing = false;
}
 
開發者ID:codeaudit,項目名稱:gwt-chronoscope,代碼行數:26,代碼來源:AbstractDataset.java

示例14: startElement

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
@Override
public void startElement(Element element) {
    elements.push(element);
    documentStringBuilder.append("<");
    documentStringBuilder.append(element.getTagName());
    JsArray<Node> attributes = DomUtil.getAttributes(element);
    for (int i = 0; i < attributes.length(); i++) {
        Node node = attributes.get(i);
        documentStringBuilder.append(" ");
        documentStringBuilder.append(node.getNodeName());
        documentStringBuilder.append("=\"");
        documentStringBuilder.append(node.getNodeValue());
        documentStringBuilder.append("\"");
    }
    documentStringBuilder.append(">");
}
 
開發者ID:chromium,項目名稱:dom-distiller,代碼行數:17,代碼來源:FakeWebDocumentBuilder.java

示例15: convertAry

import com.google.gwt.core.client.JsArray; //導入依賴的package包/類
public static WebPlotResult[] convertAry(PlotResultOverlay res) {
    List<WebPlotResult> rList= new ArrayList<WebPlotResult>();
    if (res.isSuccess()) {
        if (res.isArrayResult()) {
            JsArray<PlotResultOverlay> ary= res.getResultAry();
            for(int i=0; (i<ary.length()); i++) {
                rList.add(convertItem(ary.get(i)));
            }

        }
        else {
           rList.add(convertItem(res));
        }
    }
    return rList.toArray(new WebPlotResult[rList.size()]);
}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:17,代碼來源:WebPlotResultParser.java


注:本文中的com.google.gwt.core.client.JsArray類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。