当前位置: 首页>>代码示例>>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;未经允许,请勿转载。