{"ADFMobile": Programatically invoking a popup in ADF Mobile}
Well, as you rightly guessed, in this post I'm talking about ADF mobile ;). My first 'creative' post on this technology. Straight to the topic:
There is no Java API to queue an event on actionable component in ADF mobile as of now. Recently I noticed a work around solution using both Java and JavaScript for the same(Thanks to Piyush Hari and Matt Cooper). This involves some amount of code,but it is fun.
The following code snippet(Java + JavaScript) simulates button action event programatically.
The below method is Java bean method bound to a button. Note that this is just simple example to demo the idea. In real scenario it could be your business logic which might get triggered in response to various other user actions on your page and may involve complex logic too.
The above code snippet calls showPopup() JavaScript method to generate action event programtaically. See the following doc to learn more about method AdfmfContainerUtilities.invokeContainerJavaScriptFunction. The definition of showPopup() JavaScript method is given below. As stated a while ago, this method generates the button action event programatically. The button used in this example has amx:showPopupBehavior added to display a popup and apparently the generated event ends up in displaying the popup.
Download
You can download the sample workspace from here.
[ Runs with Oracle JDeveloper 11.1.2.4.0 with mobile extension added.]
There is no Java API to queue an event on actionable component in ADF mobile as of now. Recently I noticed a work around solution using both Java and JavaScript for the same(Thanks to Piyush Hari and Matt Cooper). This involves some amount of code,but it is fun.
The following code snippet(Java + JavaScript) simulates button action event programatically.
The below method is Java bean method bound to a button. Note that this is just simple example to demo the idea. In real scenario it could be your business logic which might get triggered in response to various other user actions on your page and may involve complex logic too.
public void somePOJOMethod(...) { //Business logic go here //Now based on some condition //invoke popup by simulating //button action AdfmfContainerUtilities. invokeContainerJavaScriptFunction ("feature1", "showPopup", new Object[] {} ); }
The above code snippet calls showPopup() JavaScript method to generate action event programtaically. See the following doc to learn more about method AdfmfContainerUtilities.invokeContainerJavaScriptFunction. The definition of showPopup() JavaScript method is given below. As stated a while ago, this method generates the button action event programatically. The button used in this example has amx:showPopupBehavior added to display a popup and apparently the generated event ends up in displaying the popup.
(function () { showPopup = function () { var element = document.getElementById("cb4"); customTriggerEvent(element, "touchstart"); customTriggerEvent(element, "touchend"); } var customTriggerEvent = function (eventTarget, eventType, triggerExtra) { var evt = document.createEvent("HTMLEvents"); evt.initEvent(eventType, true, true); evt.view = window; evt.altKey = false; evt.ctrlKey = false; evt.shiftKey = false; evt.metaKey = false; evt.keyCode = 0; evt.charCode = 'a'; if (triggerExtra != null) evt.triggerExtra = triggerExtra; eventTarget.dispatchEvent(evt); }; })();
Download
You can download the sample workspace from here.
[ Runs with Oracle JDeveloper 11.1.2.4.0 with mobile extension added.]
Very good!
ReplyDeleteTks!
Good post! Could u do a blog post on Autosuggest behaviour in ADF mobile, since ADF mobile does not have autosuggest tag/client listener components.
ReplyDeleteVery useful post.
ReplyDeleteIs there a way to close popup programmatically? Thanks
Very useful info. Thank you very much.
ReplyDeleteHow do we close the popup? We would like to close the popup with an action from the popup.
Thanks!
Srini
Thanks for this post. It is very good. Here's a question. Say I want to capture the users response-> how do I do that part? Expected results would be user clicked "ok" or "cancel".
ReplyDeleteI would greatly appreciate that information.
Theresa
Thanks for your post which gather more knowledge about the topic. I read your blog everything is helpful and effective.
ReplyDeleteCloud computing courses in chennai
Cloud computing training in chennai
Cloud computing training in anna nagar
Cloud computing training in adyar
Cloud computing course in tambaram
Data science training in chennai
Data science course in chennai
Data science training in anna nagar
Great article! Just now read your blog, this is a very interesting and attractive post. Well done and keep posting...
ReplyDeleteSpark Training in Chennai
Spark Training Fees in Chennai
Pega Training in Chennai
Primavera Training in Chennai
Unix Training in Chennai
Linux Training in Chennai
Social Media Marketing Courses in Chennai
Power BI Training in Chennai
Tableau Training in Chennai
Thank you for sharing such kind of precious information with us.It really useful for many of them like me.
ReplyDeleteSoftware Testing Training in Chennai
software testing course in chennai
JAVA Training in Chennai
Python Training in Chennai
Hadoop Training in Chennai
Selenium Training in Chennai
Software Testing Training in Chennai
Software testing training in Tambaram
Its a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way. T hank you so much.
ReplyDeleteJava Training in Coimbatore
Java Training in Bangalore
Java classes in coimbatore
Data Analytics Courses in Coimbatore
Python Course in Coimbatore
CCNA Course in Coimbatore
Java Training Institutes in Bangalore
Java Institutes in Bangalore
Embedded course in Coimbatore
IELTS Coaching in Coimbatore
SEO Training in Coimbatore
The article is so informative. This is more helpful for our
ReplyDeleteBest online software testing training course institute in chennai with placement
Best selenium testing online course training in chennai
Learn best software testing online certification course class in chennai with placement
Thanks for sharing.
Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!
ReplyDeletemobile application development training online
mobile app development course
mobile application development course
learn mobile application development
mobile app development training
app development training
mobile application development training
mobile app development course online
online mobile application development