List of usage examples for com.google.gwt.core.client JsArrayString length
public final native int length() ;
From source file:org.geowe.client.local.main.map.Projections.java
License:Open Source License
private static List<String> getProj4jsProjections() { List<String> projections = new ArrayList<String>(); JsArrayString projDefs = getProjDefs(); for (int i = 0; i < projDefs.length(); i++) { projections.add(projDefs.get(i).trim()); }/*from w ww . j ava 2 s.c o m*/ return projections; }
From source file:org.gk.engine.client.utils.ComLibrary.java
License:Open Source License
/** * ?(${...})//w ww .j av a 2 s . c om * * @param nodeName * @return JavaScriptObject */ public static JavaScriptObject getLibraryAttributes(String nodeName) { String gul = getContent(nodeName); JsArrayString list = (JsArrayString) findReplaceAttributes(gul); Set libAttr = new FastSet(); for (int i = 0; i < list.length(); i++) { String el = replaceToEL(list.get(i)); if (matchELPattern(el)) { String key = retriveELParameter(el).trim(); libAttr.add(key); } else { libAttr.add(el); } } return JsUtil.toJavaScriptArray(libAttr.toArray()); }
From source file:org.gk.engine.client.utils.ComLibrary.java
License:Open Source License
/** * ?//from w w w. ja v a 2 s . c o m * * @param node * @param gul * @return Map */ private static Map createMappingTable(Node node, String gul) { Map<String, String> nodeAttr = new FastMap(); // node?Map NamedNodeMap map = node.getAttributes(); for (int index = 0; index < map.getLength(); index++) { Node attrNode = map.item(index); nodeAttr.put("${" + attrNode.getNodeName() + "}", attrNode.getNodeValue()); } gul = replaceExtraBackslash(gul); // ?Map JsArrayString list = (JsArrayString) findReplaceAttributes(gul); Map<String, String> libAttr = new FastMap(); for (int i = 0; i < list.length(); i++) { String attr = list.get(i); if (!libAttr.containsKey(attr)) { String el = replaceToEL(attr); if (matchELPattern(el)) { String key = retriveELParameter(el).trim(); String value = nodeAttr.get("${" + key + "}"); libAttr.put(attr, execEL(el, key, value == null ? "" : value)); } else { if (!nodeAttr.containsKey(attr)) { libAttr.put(attr, XDOM.getUniqueId()); } } } } nodeAttr.putAll(libAttr); return nodeAttr; }
From source file:org.gk.engine.client.utils.ComLibrary.java
License:Open Source License
/** * id${xxx}??uniqueId/*w ww . j a v a2 s . c o m*/ * * @param gul * @return String */ public static String replaceAnonymousId(String gul) { JsArrayString list = (JsArrayString) findReplaceAttributes(gul); for (int i = 0; i < list.length(); i++) { gul = gul.replace(list.get(i), XDOM.getUniqueId()); } return gul; }
From source file:org.gwtbootstrap3.extras.select.client.ui.MultipleSelect.java
License:Apache License
@Override public List<String> getValue() { if (isAttached()) { JsArrayString arr = getValue(getElement()); List<String> result = new ArrayList<>(arr.length()); for (int i = 0; i < arr.length(); i++) { result.add(arr.get(i));/*from w ww . jav a 2 s . c o m*/ } return result; } return getSelectedValues(); }
From source file:org.gwtbootstrap3.extras.slider.client.ui.base.SliderBase.java
License:Apache License
private List<String> getStringArrayAttribute(SliderOption option, List<String> defaultValue) { // Get array attribute JsArrayString array = null; if (isAttached()) { array = getStringArrayAttribute(getElement(), option.getName()); } else {/*from w w w . j a v a 2 s. c om*/ String value = attributeMixin.getAttribute(option.getDataAttribute()); if (value != null && !value.isEmpty()) { array = JsonUtils.safeEval(value); } } // Attribute not set if (array == null) { return defaultValue; } // Put array to list List<String> list = new ArrayList<String>(array.length()); for (int i = 0; i < array.length(); i++) { list.add(array.get(i)); } return list; }
From source file:org.gwtbootstrap3.extras.tagsinput.client.ui.base.TagsInputBase.java
License:Apache License
protected static List<String> toMultiValue(JavaScriptObject js_multi_value) { List<String> retValue = new ArrayList<String>(); JsArrayString js_string_array = js_multi_value.cast(); for (int i = 0; i < js_string_array.length(); i++) { retValue.add(js_string_array.get(i)); }/* w ww . ja v a2 s . c om*/ return retValue; }
From source file:org.gwtnode.core.GwtNodeBootstrap.java
License:Apache License
@Override public final void onModuleLoad() { //unhandled errors GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { @Override/* w w w. j a v a 2s .c o m*/ public void onUncaughtException(Throwable e) { GwtNodeBootstrap.this.onUncaughtException(e); } }); Process.get().onUncaughtException(new ErrorEventHandler() { @Override public void onEvent(NodeJsError exception) { JavaScriptException e = new JavaScriptException(exception); if (e.getStackTrace().length == 0) { e.fillInStackTrace(); } onUncaughtException(e); } }); Process.get().nextTick(new ParameterlessEventHandler() { @Override public void onEvent() { try { //grab the arguments JsArrayString nativeArgs = Process.get().argv(); //well, the best I can do right now is find the arguments // after the .js argument //TODO: be smarter than this int jsArgIndex; for (jsArgIndex = 0; jsArgIndex < nativeArgs.length(); jsArgIndex++) { if (nativeArgs.get(jsArgIndex).endsWith(".js")) { break; } } //make the final native string array String[] args; if (jsArgIndex == nativeArgs.length()) { Util.get().log("Unable to find argument ending with .js"); args = new String[0]; } else { args = new String[nativeArgs.length() - jsArgIndex - 1]; for (int i = 0; i < args.length; i++) { args[i] = nativeArgs.get(jsArgIndex + i + 1); } } //call the main method Runner runner = GWT.create(Runner.class); runner.run(GwtNodeBootstrap.this, new Closure<Integer>() { @Override public void call(Integer result) { if (result != null) { Process.get().exit(result); } } }, args); } catch (Throwable e) { onUncaughtException(e); } } }); }
From source file:org.jboss.bpm.console.client.model.JSOModel.java
License:Open Source License
@Deprecated public final Set<String> keySet() { JsArrayString array = keys(); Set<String> set = new HashSet<String>(); for (int i = 0; i < array.length(); i++) { set.add(array.get(i));/*w w w .j a v a 2s .c o m*/ } return set; }
From source file:org.kie.workbench.common.widgets.client.widget.KieMultipleSelectElementView.java
License:Apache License
@Override public List<String> getValue() { final List<String> value = new ArrayList<>(); final JsArrayString jsValue = getValue(select); if (jsValue != null) { for (int i = 0; i < jsValue.length(); i++) { value.add(jsValue.get(i));//from w w w . j a v a2 s . c o m } } return value; }