Java Code Examples for jsinterop.base.Js#uncheckedCast()
The following examples show how to use
jsinterop.base.Js#uncheckedCast() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NaluPluginCoreWeb.java From nalu with Apache License 2.0 | 5 votes |
public static void addPopStateHandler(RouteChangeHandler handler, String contextPath) { DomGlobal.window.onpopstate = e -> { String newUrl; if (PropertyFactory.get() .isUsingHash()) { Location location = Js.uncheckedCast(DomGlobal.location); newUrl = location.getHash(); } else { PopStateEvent event = (PopStateEvent) e; newUrl = (String) event.state; if (Objects.isNull(newUrl) || newUrl.trim() .length() == 0) { newUrl = PropertyFactory.get() .getStartRoute(); } } // remove leading '/' if (newUrl.length() > 1) { if (newUrl.startsWith("/")) { newUrl = newUrl.substring(1); } } // remove contextPath if (!Objects.isNull(contextPath)) { if (newUrl.length() > contextPath.length()) { newUrl = newUrl.substring(contextPath.length()); } } NaluPluginCoreWeb.handleChange(handler, newUrl); return null; }; }
Example 2
Source File: NaluPluginCoreWeb.java From nalu with Apache License 2.0 | 5 votes |
public static void addOnHashChangeHandler(RouteChangeHandler handler) { DomGlobal.window.onhashchange = e -> { String newUrl; Location location = Js.uncheckedCast(DomGlobal.location); newUrl = location.getHash(); NaluPluginCoreWeb.handleChange(handler, newUrl); return null; }; }
Example 3
Source File: NaluPluginCoreWeb.java From nalu with Apache License 2.0 | 4 votes |
@SuppressWarnings("StringSplitter") public static void getContextPath(ShellConfiguration shellConfiguration) { if (PropertyFactory.get() .isUsingHash()) { return; } Location location = Js.uncheckedCast(DomGlobal.location); String pathName = location.getPathname(); if (pathName.startsWith("/") && pathName.length() > 1) { pathName = pathName.substring(1); } if (pathName.contains(".")) { if (pathName.contains("/")) { pathName = pathName.substring(0, pathName.lastIndexOf("/")); StringBuilder context = new StringBuilder(); for (String partOfContext : pathName.split("/")) { Optional<String> optional = shellConfiguration.getShells() .stream() .map(ShellConfig::getRoute) .filter(f -> f.equals("/" + partOfContext)) .findAny(); if (optional.isPresent()) { break; } else { if (context.length() > 0) { context.append("/"); } context.append(partOfContext); } } PropertyFactory.get() .setContextPath(context.toString()); } else { PropertyFactory.get() .setContextPath(""); } } PropertyFactory.get() .setContextPath(""); }
Example 4
Source File: JsShortArrayReader.java From domino-jackson with Apache License 2.0 | 4 votes |
private static short[] reinterpretCast(JsArray<JsNumber> value) { JsNumber[] sliced = value.slice(); return Js.uncheckedCast(sliced); }
Example 5
Source File: JsDoubleArrayReader.java From domino-jackson with Apache License 2.0 | 4 votes |
private static double[] reinterpretCast(JsArray<JsNumber> value) { JsNumber[] sliced = value.slice(); return Js.uncheckedCast(sliced); }
Example 6
Source File: JsStringArrayReader.java From domino-jackson with Apache License 2.0 | 4 votes |
private static String[] reinterpretCast(JsArray<JsString> value) { JsString[] sliced = value.slice(); return Js.uncheckedCast(sliced); }
Example 7
Source File: JsIntegerArrayReader.java From domino-jackson with Apache License 2.0 | 4 votes |
private static int[] reinterpretCast(JsArray<JsNumber> value) { JsNumber[] sliced = value.slice(); return Js.uncheckedCast(sliced); }
Example 8
Source File: GwtReact.java From gwt-react with MIT License | 4 votes |
public static ReactElement castAsReactElement(Array<? extends ReactElement> children) { return Js.uncheckedCast(children); }
Example 9
Source File: GwtReact.java From gwt-react with MIT License | 4 votes |
public static ReactElement castAsReactElement(ReactElementChildren children) { return Js.uncheckedCast(children); }
Example 10
Source File: GwtReact.java From gwt-react with MIT License | 4 votes |
public static ReactElement stringLiteral(String value) { return Js.uncheckedCast(value); }
Example 11
Source File: JsPlainObj.java From gwt-interop-utils with MIT License | 2 votes |
/** * Return an Object parameter from this plain object. NOTE this method is NOT type safe. If * you access a property that isn't an Object you will get an undefined result. Also if you * access a property that does not exist you will get an undefined error * * @param prop The property to access * @param <O> The Object property value * @return The Object property value */ @JsOverlay final public <O> O getObj(String prop) { return Js.uncheckedCast(Js.asPropertyMap(this).get(prop)); }