Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Dialog doesn't open, if set autoOpen to false #12

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 12 comments
Closed

Dialog doesn't open, if set autoOpen to false #12

GoogleCodeExporter opened this issue Mar 14, 2015 · 12 comments

Comments

@GoogleCodeExporter
Copy link

Example:

$("#dialogForm" ).as(Ui).dialog(
        Dialog.Options.create()
            .autoOpen(false));
$("#dialogForm").as(Ui).dialog("open");

Dialog doesn't shows up.
I'm trying to figure out why.

Original issue reported on code.google.com by arny...@gmail.com on 15 Aug 2011 at 3:59

@GoogleCodeExporter
Copy link
Author

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 arny...@gmail.com on 15 Aug 2011 at 5:39

@GoogleCodeExporter
Copy link
Author

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 philippe...@gmail.com on 15 Aug 2011 at 7:47

@GoogleCodeExporter
Copy link
Author

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 arny...@gmail.com on 15 Aug 2011 at 8:20

@GoogleCodeExporter
Copy link
Author

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 philippe...@gmail.com on 15 Aug 2011 at 8:52

@GoogleCodeExporter
Copy link
Author

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 arny...@gmail.com on 15 Aug 2011 at 9:14

@GoogleCodeExporter
Copy link
Author

Oops! :)

Patches welcomed! I'll gladly review patches you submit and merge them when 
appropriate.

Original comment by philippe...@gmail.com on 15 Aug 2011 at 9:44

@GoogleCodeExporter
Copy link
Author

ok, I've done some changes and fixes.

Check the diffs file.

Original comment by arny...@gmail.com on 15 Aug 2011 at 11:50

Attachments:

@GoogleCodeExporter
Copy link
Author

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 philippe...@gmail.com on 16 Aug 2011 at 12:10

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

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 arny...@gmail.com on 16 Aug 2011 at 12:24

@GoogleCodeExporter
Copy link
Author

Added isOpen method in r143. Fixed getDate in Datepicker also.

Original comment by philippe...@gmail.com on 16 Aug 2011 at 12:08

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

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 arny...@gmail.com on 16 Aug 2011 at 1:04

@GoogleCodeExporter
Copy link
Author

Done.

Original comment by philippe...@gmail.com on 16 Aug 2011 at 1:44

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant