Modal Dialogs

  9 posts   Feedicon  
Replies: 8 - Last Post: December 17, 2009 14:29
by: sundbp
showing 1 - 9 of 9
 
Posted: September 03, 2009 12:23 by szymon_wro
Hello,
I'm new to Monkeybars and I think it's really nice and useful.
However I'm lost completely with dialogs. I followed older topics on google groups and the most recent one on kenai: http://kenai.com/projects/monkeybars/forums/forum/topics/1394-define_handler-for-JDialog? . No luck. If I get the dialog to pop up, then I cannot get it event handlers working. If it is possible, could give me a step by step guide how to set up custom modal dialogs (something beyond JOptionPane, extending JDialog)?
I like your approach to MVC and the tuple (triple?, triad?) construct. I'd love to get the same approach to the specified and complicated dialogs.

Best regards

Szymon Wrozynski
 
Posted: September 03, 2009 15:33 by Logan Barnett

Szymon,
Sometimes working with Dialogs in Monkeybars can be a little odd because of the modal effects and how it blocks the current thread, which can keep Monkeybars from registering handlers properly.

Here's some code I've been using:

# in the dialog controller. This allows you to listen for when the dialog is closed
add_listener :type => :window, :components => [:java_window]

# here's the code in the controller that consumes it
DestinationSelectionController.define_handler( :window_closed ) do |event|
  update_view
end

Some other code I have isn't as nice. It's been a while since I've used this code, but I believe this is done because the dialog is modal.

# the view of the dialog
# the dialog is created manually here. This is in an MDI app, so it's fairly reasonable to know how to get to the view and grab it's main view component.
def create_main_view_component
  ShareGroupProgressDialog.new(mdi_view.instance_variable_get(:@main_view_component), true)
end

# to consume the respective controller:
ShareGroupProgressController.instance.open

I hope that gives you a start. Let me know if you have more questions!

 
Posted: September 03, 2009 15:35 by Logan Barnett

Ugh, some of that got cut off due to styling. Time to file a bug!

 
Posted: December 16, 2009 00:51 by sundbp
Hi,

I've been using monkeybars for a couple of days and I really like it so far. Great work, thanks a lot!

I was wondering if you could expand a bit on the topic of dialogs? Perhaps even a working example we could
put on the wiki to avoid it coming up repeatedly.

Also, I've been using netbeans 6.8 to design some forms etc. It doesn't seem like new JDialog's can be created
as a "top level frame", they can get added to an existing frame or pane. That doesn't seem ideal for useage with
monkeybars and I thought I'd see if anyone has some input on that side as well. How to deign a dialog with
netbeans for useage with monkeybars?

Thanks.
 
Posted: December 16, 2009 13:27 by Logan Barnett

When you say "top level frame", are you referring to a modal dialog? Is Netbeans not liking what you're doing with the Dialogs? I haven't played with Netbeans 6.8 yet.

I'll put together an example in the next couple of days. Feel free to remind me if I run late!

 
Posted: December 16, 2009 15:30 by sundbp
I mean that in netbeans you can't create a new JDialog and have the java class created being type JDialog - or that's how it seems to me, may be missing something in the GUI. You create a JFrame or a JPanel, and then from within the GUI designer you can add a JDialog (which will be part of the file created for the JFrame/JPanel). Can't add JDialog in project view, just GUI designer view.

I tried to create a JFrame and then just change the JFrame to JPanel in the Java code class declaration. No issues (GUI designer also alright). So that's a workaround.
 
Posted: December 17, 2009 01:34 by Logan Barnett

I seem to remember that there was an "other" that you could pick that would let you choose some of the less common things (and I think JDialog is included).

If that doesn't work, you can always do the UI by hand. I have an example posted in the source code repositories (see the left panel). You can also get it here: http://kenai.com/projects/monkeybars/sources/dialog-demo/show

 
Posted: December 17, 2009 09:44 by sundbp
Ah, found it under the "Other.." category. Obvious once you know it Smile

I'm checking out the dialog demo, thanks a lot of putting that together.
 
Posted: December 17, 2009 14:29 by sundbp
Got my dialogs sorted now. thanks again.
showing 1 - 9 of 9
Replies: 8 - Last Post: December 17, 2009 14:29
by: sundbp
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close