jquery-mobile spinner loading - java

i tried to do that while js is creating a timetable... it shows spinner loading..
i tried to do this $.mobile.pageLoading(); $.mobile.pageLoading(true); and also tried to use this plugin http://contextllc.com/tools/jQuery-showLoading
The result is the same.. it shows spinner after he generate time table.. and i don't know why...here is where i tried to use it...
$('#timeDropList').change(function() {
$.mobile.pageLoading(false);
$('div.addedEntry').remove();
drawTemplate();
});

Are you using the right version of jQuery Mobile? Looks like they took away the pageLoading method in 1.0b1 in favor of two separate methods: showPageLoadingMsg and hidePageLoadingMsg. The last reference I see to pageLoading is in 1.0a4.1.

$('#home').live('pagebeforecreate',function(event){
alert('This page was just enhanced by jQuery Mobile!');
$.mobile.loadingMessage = "pagebeforeshow Page...";
$.mobile.showPageLoadingMsg();
});

Related

Marterialize initializing Autocomplete inside Modal inside shadowroot not working

I´m trying to code a little chrome extension useing Materialize.
To avoid materialize interfering with the opened website i only use it inside the shadowroot which i insert into the website.
The problem only appears when trying to initialize an Autocomplete instance inside the opened Modal.
The input html looks like:
<input id="goalInput" class="col s9 autocomplete" placeholder="">
Trying to initialize:
var autocompleteInstance = M.Autocomplete.init(shadowRoot.getElementById('goalInput'));
// or
var autocompleteInstance = M.Autocomplete.init(shadowRoot.querySelectorAll('.autocomplete'));
Both queries are working and !== null;
Produces following error:
Error Picture Stackoverflow wont let me add png direktly yet:
The error happens somewhere inside materialize initialization ( i think when trying to create a dropdown or something, i might be wrong here).
I already searched for a really long time but maybe i was missing the right keywords to find the solution to my problem.
Found a workaround.
The problem was materialize.js trying to find the initialized dropdown within the normal html which excludes the shadowRoot.
_this9.dropdownEl = document.getElementById(_this9.id);
if(_this9.dropdownEl === null) {
_this9.dropdownEl = document.getElementById('shadowWrapper').shadowRoot.getElementById(_this9.id);
}
I just updated the code from materialize.js to work with my extension.

How to create a Lottie Alert Dialog in Java

I've tried searching for the Java tutorial regarding creating my LottieAlertDialog, but I can't find any. Everywhere it's in Kotlin, but I need the Java code as my project is in Java.
I've tried creating my LottieAlertDialog in this way:
LottieAlertDialog.Builder alert=new LottieAlertDialog.Builder(context,DialogTypes.TYPE_CUSTOM,
"social.json") //Here social.json is inside assets folder
.setTitle("Social")
.setDescription("social");
alert.build();
But the dialogbox doesn't show, when I run the app. To check whether my alert dialogbox was being created or not I tried testing it by printing the description set in the dialog in a Toast:
Toast.makeText(context,alert.getDescription(),Toast.LENGTH_SHORT).show();
The toast works and its showing "social"! That means the dialog is being created. But unfortunately it doesn't show in my app. What do I do? I've implemented all the dependencies as shown in the below link:
lottiealertdialog
Ok, after much hankering, I finally came to the solution. It's
alert.build().show();
The thing is not related to Kotlin or Java as such, you need to show the dialog once you have built it. So far your code is correct. You just need to show it further like this
LottieAlertDialog.Builder alert = new LottieAlertDialog.Builder(context, DialogTypes.TYPE_CUSTOM,
"social.json")
.setTitle("Social")
.setDescription("Social")
.build()
.show();

Tapestry5 Ajaxformloop limit number of rows

I am trying to limit the number of rows that a user can add in an ajaxformloop.
Short example:
For example, the loop found in the tapestry 5 documentation here: http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.html
If for example I would only like the user to be able to enter 3 phone numbers, how can that be done?
What I have tried:
1) I tried returning null from the onAddRow event, this causes an exception and the exception report page to display - these events shouldn't return null I don't think.
2) I tried adding my own add row button like this:
<p:addRow>
<t:addrowlink>Add another</t:addrowlink>
</p:addRow>
And then putting a t:if around it, like this:
<t:if test="canAddMorePhones()">
<p:addRow>
<t:addrowlink>Add another</t:addrowlink>
</p:addRow>
</t:if>
In this case, the "add another" reverts to the default "Add row" button and my add row link doesn't show.
3)I tried moving that t:if inside the , this had similar results.
--------------------------
I am sure that this is a fairly common aim, is there any simple way to do it? Perhaps someone can provide an example, and if possible this can help to go in the documentation as i'm sure i'm not going to be the only one trying to do this.
Note: I did also ask on the T5 users mailing list and had one answer but I can't seem to get it working after the response from Lance (Which I am sure is probably correct, but i'm not sure how to use the AjaxResponseRenderer as per my reply last week, this is probably due to my own technical limitations or understanding of some parts of T5).
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Ajaxformloop-add-row-link-max-size-tt5730840.html
I also tried using ajaxResponseRenderer.addRender as you did in your mailing list code, but it doesn't work because it seems that Tapestry has some problems dealing with updating a component that's busy updating another component. However, AjaxResponseRenderer also supports execution of JavaScript. Taking this approach on the AjaxFormLoop example in the docs, specify the addrowlink as follows:
<p:addrow>
<t:if test="canAddMorePhones()">
<t:addrowlink id="addRowLink" t:id="addRowLink">Add another</t:addrowlink>
</t:if>
</p:addrow>
Then add the following code right before return phone; in onAddRowFromPhones():
ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
if (!canAddMorePhones()) {
javascriptSupport.addScript("document.getElementById('addRowLink').style.display = 'none';");
}
}
});
This example was tested successfully in Tapestry 5.3.7.

Wicket DropDownChoice NOT working correctly with PropertyModels

I have been trying to debug why my DropDownChoice in a simple form with just the DropDown and a Submit Button hasn't been working correctly for hours now.
It has a very weird behaviour. Where the first value selected in the drop down choice is sent successfully to the server after which any other choice select is not updated by the model. ie if I have a List persons, and I select the 2nd person, it submits this successfully. However, on select of another person and trying to submit it again it keeps showing the first selected option.
Snippets of code here:
ChoiceRenderer<Empowerment> empowermentChoiceRenderer = new ChoiceRenderer<>("name", "id");
final DropDownChoice<Empowerment> empowermentDropDownChoice =
new DropDownChoice<>("empowerment", new PropertyModel<Empowerment>(this, "empowerment"), empowermentList, empowermentChoiceRenderer);
empowermentDropDownChoice.setRequired(true);
add(empowermentDropDownChoice);
Only way I am able to get a decent behaviour is if I set the empowerment variable above to null. In this case, on submit the empowerment is reinitialised to null and then a new submit works correctly.
empowerment is just a JPA entity.
I'll be glad to know if this is a known issue. I experienced it in wicket 6.9.1 and wicket 6.12
Finally, found the solution to the problem. Above code is correct, but problem lied in the entity class itself - Empowerment needs to implement Equals and Hashcode correctly.
The DropDownChoice works just fine after this.
Add an OnChangeAjaxBehavior to your DropDownChoice. This will update the model value on every selection change you make on the drop down:
empowermentDropDownChoice .add(new OnChangeAjaxBehavior() {
#Override
protected void onUpdate(AjaxRequestTarget art) {
//just model update
}
});

Retrieve GWT radiobutton value in servlet

I'm having a headache figuring how to retrieve the gwt Radio Buttons values in the server side.
Here is my UiBinder form:
<g:FormPanel ui:field="form"><g:VerticalPanel ui:field="fruitPanel">
<g:RadioButton name="fruit">apple</g:RadioButton>
<g:RadioButton name="fruit">banana</g:RadioButton>
<g:SubmitButton>Submit</g:SubmitButton> ...
Here is how i initialize the form:
form.setAction("/submit");
form.setMethod(FormPanel.METHOD_POST);
So i though i would have to do this on the servlet:
fruit = req.getParameter("fruit")
But of course this doesn't work, parameter fruit doesn't exist :/
Edit: Ok i get parameter fruit but it's always "on"
I also did try to add the radio button in java with:
RadioButton rb0 = new RadioButton("fruit", "apple");
RadioButton rb1 = new RadioButton("fruit", "banana");
fruitPanel.add(rb0);
fruitPanel.add(rb1);
Edit: This is a GWT issue: Issue 4795
since I cannot comment on the question: Which version of GWT are you using?
I've create the exact same template as you did and Firebug tells me that it's posting:
"fruit=on"
Of course this payload is only posted when one of the checkboxes is checked. ;-)
But beware: I've recognized recently that GWT doesn't set the "value" of the radio button when used inside UiBinder template and instead just sends "on" as value which makes the radio button more or less useless to be used in a UiBinder template.
HTH
Max
NO, no, no, no. This is not JSP, buddy!
Seems to me that you have a lot of documentation reading to do about how GWT works. This I cannot make clear in one answer post, but to start somewhere:
1) You are not running your code on the server, this is client side!
2) You should use GWT RPC to transfer data to/from the server
3) RTFM :)

Categories