AjaxRequestTarget not refreshing Component

2010-10-12 Thread LutherBaker

I have created an outer list of areaGroups such that each group item contains
a list of areas. 

I am displaying a ModalWindow and editing an area. After changing the area's
name, I submit it via an AjaxSubmitButton which initially added the ListView
associated with a particular group. Obviously that failed (can't add a
repeater to an AjaxTargetRequest) at which point I added a
WebMarkupContainer to the markup. 

 
 [group name] 
  
  
Edit
 [item name]
 [item summary] 
  
  
 

I feed this inner ListView with a LodableDetachableModel where I
fetchAreasByAreaGroup: 

@Override 
protected List load() { 
return dataService.fetchAreasByAreaGroup(areaGroup); 
} 

I also created a WebMarkupContainer in code and set its outputMarkupId: 

final WebMarkupContainer itemListContainer = new
WebMarkupContainer("item.list.container"); 
itemListContainer.setOutputMarkupId(true); 

I store the markup container in a hashmap keyed by AreaGroup which allows me
to, from the ModalWindow, retrieve the markup container associated with the
edited area's AreaGroup. Which I then add to the AjaxRequestTarget in the
ModalWindow's form's AjaxButton.onSubmit handler: 

final WebMarkupContainer container =
areaPage.getWebMarkupContainer(area.getAreaGroup()); 
target.addComponent(container); 

So all is well. It all compiles and the page loads without error. So, again,
I pop the ModalWindow up, change the name and put a breakpoint in the code.
I can see the AjaxRequestTarget add the container. I can see that the
container is not null. I can see the dataService retrieve the new area. I
can see the code execute which populates the inner ListView I mentioned
earlier - with the updated area properties. 

But, after the ModalWindow goes away, the underlying screen representation
doesn't change. The old name is still displayed. 

Here is a snippet of the generated markup where you can see
"item_list_container53" which identifies the wicket:container that I wish to
repaint. 

 
 Work 
  
  
Edit
 Hammerhead
 Day job learning large
scale infrastructure skills 
  
  
 
 Business Ventures 
  
  
Edit
 Fuzzy Bearings
 Software Development
Effort 
  
  
 


Any thoughts on what I am missing? 

Thanks in advance, 
-Luther 

PS: Please note that nabble will not accept posts with 'onclick' text in the
code snippet 'a' tags ... so I specifically edited "onClick" to simply be
"click" in the code snippets.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-not-refreshing-Component-tp2993093p2993093.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



What is the correct way to extending a window - if I've not content to add

2010-10-04 Thread LutherBaker

TopMost_Parent





SubParent extends TopMost_Parent


blah blah




Child that needs to add no markup
 Nothing seems to work


To get this to work, I end up doing this:

SubParent extends TopMost_Parent


blah blah





Child that needs to add no markup

 



I understand I need child.html markup ... but do I need to 
inside of it? and do I need to include  in the SubParent?

-Luther
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/What-is-the-correct-way-to-extending-a-window-if-I-ve-not-content-to-add-tp2954955p2954955.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Basic validation question

2010-09-29 Thread LutherBaker

Thanks - works exactly as you said.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Basic-validation-question-tp2719449p2720103.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Basic validation question

2010-09-29 Thread LutherBaker

True - but neither Form.onSubmit or Form.onError give me an Ajax target
object so they are out.

I'm already handling onError for the AjaxFormComponentUpdatingBehavior but
that only gets invoked "onblur".

Am I mistaken in thinking that the FeedbackPanel must be added to the target
in order for it to update?


Igor Vaynberg-2 wrote:
> 
> things that submit a form have both onsubmit and onerror handlers
> 
> -igor
> 

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Basic-validation-question-tp2719449p2719742.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Basic validation question

2010-09-29 Thread LutherBaker

I am using a ModalWindow with a page containing a feedback panel, a form and
several AjaxButtons (that close the ModalWindow) on submission or cancel.

There are two required text fields. When I submit the form with empty fields
(fails validation), I get a warning in the logs: 

   Component-targetted feedback message was left unrendered. This could be
because you are ...

The feedback panel wasn't being updated so I thought maybe I needed to add
it to the target. So per 
http://apache-wicket.1842946.n4.nabble.com/Does-FeedbackPanel-have-to-be-added-to-Page-td1881721.html
this post , I use the AjaxFormComponentUpdatingBehavior. That works well --
but only for one field at a time. Unfortunately, I've got two fields ... and
I don't really want to trigger off of each onblur event. I want to wait
until the submission occurs.

But if validation fails, where do I hook into the flow to add the
feedbackpanel to the target so that my messages show up? I believe that, if
validation fails, my AjaxButtons event handlers are not reached and so the
feedback panel is never added to the target - and consequently, not updated
with the error strings.

What is the normal way to do this? To validate fields in a form and
dynamically update a feedback panel. Does the form have some type of Ajax
event handler with a target in the signature?

And on a side note, is it true that, if I want to close the ModalWindow on a
successful submission - I must use AjaxButtons since
modalWindow.close(..target..) requires an Ajax target. I'd like to close the
window from the Form's handler - but not sure how to do that since the
normal form handlers don't present a target to me. Feels like I'm working
around something but not quite getting it.

Thanks in advance.

-Luther

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Basic-validation-question-tp2719449p2719449.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Cancelling ala AjaxLink vs AjaxButton

2010-09-28 Thread LutherBaker

It turns out that it actually seems to work in IE.

For what it's worth, the javascript isn't working correctly in a virtual
install of Firefox 3.0.19. For all I know, could be related, in part, to our
software packaging/management process. I'll try and test in a few different
environments and confirm that this isn't a real problem.

Thanks for staying with this thread.

-Luther

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cancelling-ala-AjaxLink-vs-AjaxButton-tp2717635p2718183.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Cancelling ala AjaxLink vs AjaxButton

2010-09-28 Thread LutherBaker

Thanks Igor, I've determined that something is not playing nicely here.

The larger picture is this - user visits a page and clicks on Add to add a
widget to the database. I pop up a ModalWindow with a form on it. User can
(a) submit form, (b) cancel button (c) cancel link.

I'd like to close the form on a successful submission or if the user clicks
on either 'cancel' option.

private static class AreaEditorForm extends Form {
private static final long serialVersionUID = 1L;

public AreaEditorForm(final String id,
final Area area,
final ModalWindow modal) {
super(id, new CompoundPropertyModel(area));
final TextField name = new 
TextField("name");
add(name);
name.setRequired(true);
name.add(new DefaultFocusBehavior());

final TextArea summary = new 
TextArea("summary");
summary.setRequired(true);
add(summary);

add(new AjaxButton("submit.button", 
AreaEditorForm.this) {
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(final AjaxRequestTarget 
target,
final Form form) {
System.out.println("submit.button 
AjaxButton.onSubmit(target)");
modal.close(target);
}
});

final AjaxButton cancel = new 
AjaxButton("cancel.button",
AreaEditorForm.this) {
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(final AjaxRequestTarget 
target,
final Form form) {
System.out.println("cancel.button 
AjaxButton.onSubmit(target)");
modal.close(target);
}
};
cancel.setDefaultFormProcessing(false);
add(cancel);

add(new AjaxLink("cancel.link") {
private static final long serialVersionUID = 1L;

@Override
public void onClick(final AjaxRequestTarget 
target) {
System.out.println("AjaxLink.onClick");
modal.close(target);
}
});
}

@Override
protected void delegateSubmit(final IFormSubmittingComponent
submittingComponent) {
System.out.println("Form.delegateSubmit");
super.delegateSubmit(submittingComponent);
}

@Override
protected void onSubmit() {
System.out.println("Form.onSubmit");
super.onSubmit();
}

}


For some reason, neither AjaxButton for cancel or submit can close the
window. The AjaxLink can - and that works in my situation for 'cancelling'
but I have to be able to close the window after a successful submission and
that code is not working in the onSubmit handlers (of either button).

Am I missing a wire?

One other anomaly - I can see the screen flicker on each submission or
cancel (ie: I can tell a request is hitting the server). But, regardless of
submission or canceling button, validation ALWAYS occurs. Per the required
fields in the form - canceling does not seem to skip the validation
eventhough I've included: cancel.setDefaultFormProcessing(false);

Another anomaly, "AjaxButton: A button that submits the form via ajax. Since
this button takes the form as a constructor argument it does not need to be
added to it unlike the Button component."  but if I remove this line:

add(cancel);

wicket complains "WicketMessage: Unable to find component with id
'cancel.button' ..."

If I place data in the two fields and then click on cancel,
"Form.delegateSubmit" logs to the console followed by "Form.onSubmit" ...
but I don't initially see "cancel.button ..." log to the console. In fact, I
click the cancel button 4 more times before I actually see it echo it's
println to the console. It is odd. Then I don't see that line for 4 more
trys ... and then it happens again. If I vary the pace, I can get it to show
up unpredictably at different times.

The docs also mention: "The default when there is a submitting
IFormSubmittingComponent is to first call onSubmit on th

Cancelling ala AjaxLink vs AjaxButton

2010-09-28 Thread LutherBaker

I am popping up a ModalWindow with a form - which has Cancel and Submit
buttons. Unfortunately, I can't get the Cancel button to close the window.
It keeps submitting to the validator, stays on the form and echos validation
text to the feedback panel.

I can get it to work with an AjaxLink.







final AjaxLink cancelLink = new AjaxLink("cancel.link") 
{
private static final long serialVersionUID = 1L;

@Override
public void onClick(final AjaxRequestTarget 
target) {
modal.close(target);
}

};
add(cancelLink);

final AjaxButton cancel = new 
AjaxButton("cancel.button",
AreaEditorForm.this) {
private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(final AjaxRequestTarget 
target,
final Form form) {
modal.close(target);
}
};
cancel.setDefaultFormProcessing(false);
add(cancel);


I thought that I could set default form processing = false but that doesn't
seem to be enough.

Thoughts?

-Luther

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Cancelling-ala-AjaxLink-vs-AjaxButton-tp2717635p2717635.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: dynamic crumb trail

2010-09-25 Thread LutherBaker

Ah yes, a closure of sorts. Thanks, that was exactly what I was looking for.


Since I am passing this to 'super', one issue popped up. I'd like to use a
StringResourceModel (and leverage some parameter substitution) but
obviously, at page instantiation time, my current page doesn't exist and
consequently, can't be used as the StringResourceModel's Component
parameter.


AreaPage.java
...
private static Crumb createCrumb(final Area area) {
return new Crumb() {

private static final long serialVersionUID = 1L;

public WebPage createReponsePage() {
return new AreaPage(area);
}

public IModel label() {
return new 
StringResourceModel("AreaPage.crumb.label",
null,
new Model(area));
}
};
}

public AreaPage(final Area area) {
super(createCrumb(area));


Note the 'null' in the StringResourceModel ctor since I can't pass 'this'
before super(..) completes.


This works for me as long as "AreaPage.crumb.label" is in my global
properties but the docs discourage said practice so maybe there is another
tweak I can apply?


-Luther





Igor Vaynberg-2 wrote:
> 
> create a wrapper that can instantiate pages lazily
> 
> interface Crumb { IModel getLabel(); Page gePage(); } put your lazy
> logic into getPage() impl.
> 
> -igor
> 

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/dynamic-crumb-trail-tp2550978p2713647.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket and Netbeans

2010-08-24 Thread LutherBaker

Thanks for the suggestions.

In this case, I was able to navigate to the project's properties and find
Build | Compile where I changed the "Compile on Save" option to "For both
application and test execution". That seemed to do it. Jetty now restarts
automatically on changes to class and templates.

This last comment peaked my interest - session preservation would be nice -
ie: I assume that hot deploys are "in place" and the server doesn't actually
restart.

H


-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Netbeans-tp2337063p2337510.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket and Netbeans

2010-08-24 Thread LutherBaker

Per the  http://wicket.apache.org/start/quickstart.html quickstart page , I
built the quickstart project ala:

c:\var\dev\netbeans>mvn archetype:create 
 -DarchetypeGroupId=org.apache.wicket 
 -DarchetypeArtifactId=wicket-archetype-quickstart 
 -DarchetypeVersion=1.4.10 -DgroupId=foo.bar -DartifactId=foo

opened it in Netbeans, created the action "jetty:run" and started the
application. All is well and I can see the greeting page.

If I change the text on the html file or alter the message in the class file
- nothing happens. If I shutdown and restart jetty:run, the changes appear.
I added the scanIntervalSeconds:


org.mortbay.jetty
maven-jetty-plugin

   
3



to the POM file but still no change. Is there something else I must do in
Netbeans to see and publish changes I make to Wicket files or ... is there a
better way to do this so that I'm not constantly restarting the web server?

I also tried the 'Start' class - and I can see the pages - but they do not
refresh when I change anything on them or their related class files.

What is generally the best routine for the smoothest development workflow
with wicket. A different IDE?

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-Netbeans-tp2337063p2337063.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org