Comments (12)
Too bad jQuery UI isn't following any kind of standardized patterns.
I've included another method to run widget methods as a workaround.
public JavaScriptObject method(String method) {
return invoke(ui, widgetType, method);
}
Just below the option() method inside UiWidget.java.
So to run a method, you'd have to use:
$("#dialogForm").as(Ui).dialog().method("open");
-
Let's hope the jQueryUI team will do a better job on the upcoming API rewrite.
Original comment by [email protected]
on 15 Aug 2011 at 5:39
from gwtquery-ui.
Try the "Animated Dialog" demo here:
http://gwtquery-ui.googlecode.com/svn/demos/GwtQueryUi.html
Does the dialog open when you click the button? It does in Chromium 13.
Also, the Dialog class already has an "open" method. You should be able to do
this:
$("#dialogForm").as(Ui).dialog().open();
Original comment by [email protected]
on 15 Aug 2011 at 7:47
from gwtquery-ui.
Ah, haven't expected real methods there, sorry.
Though it would look more like jQuery.
Nevertheless, like I said jQuery is following kind of chaotic patterns.
For example:
.dialog( "isOpen" )
Returns true if the dialog is currently open.
So this method returns a value.
Can't find it in qwtquery-ui.
I guess we'd need something like: invokeForInt, invokeForBoolean,
invokeForClass... so it's easier to implement inside DialogPlugin for instance.
What do you think?
Original comment by [email protected]
on 15 Aug 2011 at 8:20
from gwtquery-ui.
Well, gwtquery-ui tries to re-implement the functionalities available in
jQueryUI, but it can't be identical because of the nature of JavaScript.
I made gwtquery-ui more Java-esque (have typesafe methods for example) on
purpose. The goal is not to have a one to one relationship with jQueryUI's API.
That being said, it would be useful to have gwtquery-ui be more "open ended"
and allow calling any method on the jQuery instance.
Original comment by [email protected]
on 15 Aug 2011 at 8:52
from gwtquery-ui.
yes, I know.
But it would be much easier to have some prepared invoke methods to be able to
use them inside upper widget objects, like the ones you're already using
(invoke).
I'd like to implement the missing isOpen for instance.
There are plenty other methods that would make use of it.
Like your current implementation inside Datepicker:
public Date getDate() {
invoke("getDate");
return null;
}
seems like there is something missing ;)
Original comment by [email protected]
on 15 Aug 2011 at 9:14
from gwtquery-ui.
Oops! :)
Patches welcomed! I'll gladly review patches you submit and merge them when
appropriate.
Original comment by [email protected]
on 15 Aug 2011 at 9:44
from gwtquery-ui.
ok, I've done some changes and fixes.
Check the diffs file.
Original comment by [email protected]
on 15 Aug 2011 at 11:50
Attachments:
from gwtquery-ui.
Thanks for the patch. Mind rewriting the invokeFor* methods to only take the
method argument?
protected int invokeForInt(String method) {
return invokeForInt(ui, widgetType, method);
}
I'd like to hide the implementation (passing the jQuery instance and using
widgetType) within UiWidget.
Original comment by [email protected]
on 16 Aug 2011 at 12:10
- Changed state: Accepted
from gwtquery-ui.
No, it's ok.
You'd have to add more methods with more arguments then.
I've moved some of your invoke implementations to UiWidget.
See Slider:
public Slider values(int index, JsArrayNumber values) {
ui = invoke(ui, widgetType, "values", index, values);
return this;
}
That's why I changed them to protected.
Original comment by [email protected]
on 16 Aug 2011 at 12:24
from gwtquery-ui.
Added isOpen method in r143. Fixed getDate in Datepicker also.
Original comment by [email protected]
on 16 Aug 2011 at 12:08
- Changed state: Fixed
from gwtquery-ui.
Do you think you could take all changes into count?
For example the Slider.java:
public Slider value(Number value) {
invoke("value", value);
return this;
}
public int intValue() {
return invokeForInt(ui, widgetType, "value");
}
public int intValues(int index) {
return invoke(ui, widgetType, "values", index);
}
public Slider values(int index, JsArrayNumber values) {
invoke(ui, widgetType, "values", index, values);
return this;
}
private native final int invoke(JavaScriptObject ui, String type, String method, int index)
/*-{
return ui[type](method, index);
}-*/;
private native final JavaScriptObject invoke(JavaScriptObject ui, String type, String method, int index, Object args)
/*-{
return ui[type](method, index, args);
}-*/;
Datepicker.java is still missing:
public boolean isDisabled() {
return invokeForBoolean(ui, widgetType, "isDisabled");
}
take a look at the ones I've attached earlier.
Thanks
Original comment by [email protected]
on 16 Aug 2011 at 1:04
from gwtquery-ui.
Done.
Original comment by [email protected]
on 16 Aug 2011 at 1:44
from gwtquery-ui.
Related Issues (15)
- Provide ability to use different methods for adding JavaScript dependencies HOT 1
- Draggable wont work in IE9
- get/set individual options HOT 8
- Implement Datepicker utility methods HOT 1
- Dialog Options - Creating Buttons also creates an extra button. HOT 2
- Creating Accordion from $("<div id=\"accordion\">"); HOT 5
- Upgrade to jQuery-UI 1.8.4 HOT 1
- Slider issue in IE HOT 2
- Upgrade to jQuery-ui 1.8.5 HOT 1
- effects HOT 1
- GWT 2.2.x? HOT 8
- Datepicker's onSelect event callback does not work HOT 2
- Setting Datepicker's default date causes exception HOT 1
- GWTquery UI mobile HOT 7
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 gwtquery-ui.