ltearno / hexa.tools Goto Github PK
View Code? Open in Web Editor NEWTools to aid Java development, mainly for GWT
License: MIT License
Tools to aid Java development, mainly for GWT
License: MIT License
Hey!
I've been messing around a bit with GWT and Hexa Binding. I noticed one thing. If you have a model that already has data in it and you bind it to a Widget (HasValue<?>), the Widget won't take the models current value.
Maybe it's not always what you want, but in my case I'd like it.
In my case, I have a simple HashMap as my model. I create a one-way property adapter for it (implementing PropertyAdapter). This of course means that if I make changes to my Map, it won't be reflected to the bound component, but that is fine.
The Map has default values set on them, and when I bind each key to a GWT component, I want that GWT component to immediately get the models value.
Can we work this out, you think? Maybe a new overload, to(HasValue<?> widget, boolean useExistingModelValue);
Some super classes create malformed class info files and I don't have time to resolve the use case but its in this case:
ViewImpl.java
protected void bindSlot(IsSingleSlot<?> slot, Object container) { ... }
protected void bindSlot(Slot<?> slot, HasWidgets container) { ... }
protected <T extends HasWidgets & InsertPanel> void bindSlot(OrderedSlot<?> slot, T container) { ... }
The generator attempts to create the invoke
for these methods but can't assure that the 3rd bindSlot
is unique to the others since its using a T container
the generator chooses HasWidgets
to cast to which then creates an ambiguous method call operation.
So this is a workaround for me.
I have seen the Sample 2 project that has some really cool examples, but I would really like to see how many of the other GWT (or even custom libraries) components are bound. For example the popular ListBox
isn't an obvious situation for this data binding tool (for me at least).
Some more examples would be awesome!
Mon Aug 10 01:35:28 GMT+1200 2015 nz.co.doltech.wayhome.client.Application$PreApplicationImpl
SEVERE: undefinedjava.lang.ClassCastException
at Unknown.fillInStackTrace(Throwable.java:116)
at Unknown.Throwable(Throwable.java:55)
at Unknown.Exception(Exception.java:25)
at Unknown.RuntimeException(RuntimeException.java:25)
at Unknown.ClassCastException(ClassCastException.java:23)
at Unknown.dynamicCast(Cast.java:59)
at Unknown.$clinit_ObservableSetting(ObservableSetting.java:33)
at Unknown.ObservableSetting_0(ObservableSetting.java:46)
at Unknown.setSetting_0(SettingForm.java:44)
at Unknown.bindSettingForm(HomeView.java:101)
at Unknown.setSetting(HomePresenter.java:203)
at Unknown.onSuccess_28(HomePresenter.java:193)
at Unknown.onSuccess_29(HomePresenter.java:189)
at Unknown.onExecuteSuccess(DispatchCall.java:134)
at Unknown.onExecuteSuccess_0(DispatchCall.java:144)
at Unknown.onExecuteSuccess_1(RestDispatchCall.java:108)
at Unknown.onResponseReceived(RestDispatchCall.java:148)
at Unknown.onResponseReceived_0(RestDispatchCall.java:132)
at Unknown.fireOnResponseReceived(Request.java:250)
at Unknown.onReadyStateChange(RequestBuilder.java:412)
at Unknown.anonymous(XMLHttpRequest.java:329)
at Unknown.apply_0(Impl.java:247)
at Unknown.entry0(Impl.java:299)
at Unknown.anonymous(Impl.java:72)
Everything works fine until I recompiling in SuperDevMode when I make changes
It seems to be failing when calling:
static
{
GWT.<ClassBundle>create( ClassBundle.class ).register();
}
inside the Observable generated class, not sure why this happens sometimes. I implemented it this way:
public void setSetting(Setting setting) {
this.setting = new ObservableSetting(setting);
Binder.bindObject(this.setting).mapTo(this);
Binder.bind(this.setting, "type")
.withConverter(new EnumConverter(SettingType.values()))
.to(typeBox);
}
public Setting getSetting() {
return setting;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.