Comments (3)
It's not a huge issue in this particular case, since I'm keeping a copy of the item list in GWT and can just pull from there.
However, it could pose issues if there's other JS functions that take callback functions with more than one argument as parameters.
from gwt-api-generator.
It's almost impossible to figure out the arguments of a callback. Hydrolysis does not provide that info. Also we would need to define a hight amount of functional interfaces for all possibilities.
But because we are using the JsInterop @JsFunction
, we can cast different implementations and your code would be like this:
// Define the function which matches the JS signature
@JsFunction
public interface Function2 {
void call(Object a, Object b);
}
// Create your Function implementation
Function2 callback = (error, object) -> {
if (error == null) {
// Do something with object
}
};
grid.getPolymerElement().addEventListener(SelectedItemsChangedEvent.NAME, event -> {
JsArrayNumber n = grid.getSelection().selected(null, 0, 200).cast();
if (n.length() == 1) {
// Cast it in the method call
grid.getItem(n.get(0), (Function)callback, false);
}
});
from gwt-api-generator.
Ah, ok. That works!
Thanks!
from gwt-api-generator.
Related Issues (20)
- Compilation errors on the generated code. HOT 11
- Ambiguous 'setSelected' on PaperMenu / PaperTabs / PaperListbox / PaperRadioGroup HOT 1
- Duplicate method ensureRipple in PaperIconButtonLight(Element) HOT 3
- Dependency failure hydrolysis HOT 1
- Widget.template should import Polymer HOT 2
- Polymer#saveProperties ruins Vaadin's connectorId handling HOT 2
- Polymer clears the value of window.performance HOT 3
- Polymer.dom(...).removeChild(...) does not exist HOT 1
- GWTPolymer Elements 1.7.0 : Polymer.setGwtBowerLocation(""); missing HOT 2
- pom.template's ant rules doesn't take variable groupId into account HOT 1
- Polymer is not initialized with polymer-bundler imports
- Volunteer collaborators are needed HOT 5
- Depend directly on Elemental2 HOT 10
- Add model.item to Event HOT 1
- Task to create and build a starter project HOT 4
- Event parsing failure
- Generating GWT wrapper for a local Polymer element
- wrong SRC path in generated Java files
- Polymer (2.0) + GWT => Stock of the situation ? Coming GWT 3 soon or not ? What is the right way for a LTS application ? HOT 10
- Can't generate proper function with return type HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwt-api-generator.