You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Peter Diefenthaeler <pd...@csc.com> on 2011/07/04 13:30:06 UTC
Customize AjaxEditableLabel
Hallo,
is it possible to customize AjaxEditableLabel in a way that I can replace
the TextEditField with a panel? I have to display a little Form with a
text area component and some buttons. A modal window doesn't work for me
because I want to show the panel exactly at the position of the label.
Thanks, Peter
Re: Customize AjaxEditableLabel
Posted by Martin Grigorov <mg...@apache.org>.
Check org.apache.wicket.extensions.ajax.markup.html.AjaxEditableMultiLineLabel<T>
If this doesn't fit your needs then advise from
org.apache.wicket.extensions.ajax.markup.html.AjaxEditableChoiceLabel<T>
as well
On Tue, Jul 5, 2011 at 8:38 AM, PDiefent <pd...@csc.com> wrote:
> Here are some code sniplets, perhaps you can see what's wrong - I definitely
> don't call super newEditor().
>
> The next problem I will get is that the ContentEditorLabel closes when I
> click on an other field in the form. I would prefer a modal behaviour what
> means that I have to use the buttons to close the ne edit fields ...
>
>
> private class ContentEditorLabel extends AjaxEditableLabel<String> {
> private static final long serialVersionUID = 1L;
> public ContentEditorLabel(String id) {
> super(id);
>
> }
> @Override
> protected final FormComponent<String> newEditor(
> MarkupContainer parent, String componentId,
> IModel<String> model) {
>
> final SwiftFieldInput editor = new SwiftFieldInput(componentId, model){
> private static final long serialVersionUID = 1L;
>
> @Override
> public IConverter getConverter(Class<?> type)
> {
> IConverter c = ContentEditorLabel.this.getConverter(type);
> return c != null ? c : super.getConverter(type);
> }
>
> @Override
> protected void onModelChanged()
> {
> super.onModelChanged();
> ContentEditorLabel.this.onModelChanged();
> }
>
> @Override
> protected void onModelChanging()
> {
> super.onModelChanging();
> ContentEditorLabel.this.onModelChanging();
> }
> };
> editor.setOutputMarkupId(true);
> editor.setVisible(false);
> editor.add(new EditorAjaxBehavior());
> return editor;
> }
> };
>
> package com.csc.pts.web.panels.swift;
>
> import org.apache.wicket.markup.html.form.FormComponent;
> import org.apache.wicket.markup.html.form.FormComponentPanel;
> import org.apache.wicket.markup.html.form.TextArea;
> import org.apache.wicket.model.IModel;
> import org.apache.wicket.model.Model;
>
> public class SwiftFieldInput extends FormComponentPanel<String> {
> private static final long serialVersionUID = 1L;
>
> private final FormComponent<String> contentArea;
> String test;
> public SwiftFieldInput(String id, IModel<String> model) {
> super(id,model);
>
> contentArea = new TextArea<String>("contentarea",new Model<String>());
> add(contentArea);
> }
>
> @Override
> protected void onModelChanged() {
> super.onModelChanged();
> String content = getModelObject();
> if (content != null)
> contentArea.setModelObject(content);
> else
> contentArea.setModelObject(null);
> }
> }
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Customize-AjaxEditableLabel-tp3643409p3645206.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
Re: Customize AjaxEditableLabel
Posted by PDiefent <pd...@csc.com>.
Here are some code sniplets, perhaps you can see what's wrong - I definitely
don't call super newEditor().
The next problem I will get is that the ContentEditorLabel closes when I
click on an other field in the form. I would prefer a modal behaviour what
means that I have to use the buttons to close the ne edit fields ...
private class ContentEditorLabel extends AjaxEditableLabel<String> {
private static final long serialVersionUID = 1L;
public ContentEditorLabel(String id) {
super(id);
}
@Override
protected final FormComponent<String> newEditor(
MarkupContainer parent, String componentId,
IModel<String> model) {
final SwiftFieldInput editor = new SwiftFieldInput(componentId, model){
private static final long serialVersionUID = 1L;
@Override
public IConverter getConverter(Class<?> type)
{
IConverter c = ContentEditorLabel.this.getConverter(type);
return c != null ? c : super.getConverter(type);
}
@Override
protected void onModelChanged()
{
super.onModelChanged();
ContentEditorLabel.this.onModelChanged();
}
@Override
protected void onModelChanging()
{
super.onModelChanging();
ContentEditorLabel.this.onModelChanging();
}
};
editor.setOutputMarkupId(true);
editor.setVisible(false);
editor.add(new EditorAjaxBehavior());
return editor;
}
};
package com.csc.pts.web.panels.swift;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
public class SwiftFieldInput extends FormComponentPanel<String> {
private static final long serialVersionUID = 1L;
private final FormComponent<String> contentArea;
String test;
public SwiftFieldInput(String id, IModel<String> model) {
super(id,model);
contentArea = new TextArea<String>("contentarea",new Model<String>());
add(contentArea);
}
@Override
protected void onModelChanged() {
super.onModelChanged();
String content = getModelObject();
if (content != null)
contentArea.setModelObject(content);
else
contentArea.setModelObject(null);
}
}
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Customize-AjaxEditableLabel-tp3643409p3645206.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Customize AjaxEditableLabel
Posted by Martin Grigorov <mg...@apache.org>.
Unless you call super.newEditor() in your implementation it should not
know the TextField.
Paste your code in some pastebin service (e.g. www.pastie.com)
On Mon, Jul 4, 2011 at 4:10 PM, PDiefent <pd...@csc.com> wrote:
> I tried it like AjaxEditableLabel does itself, but now I get the default
> input field plus the new fields in the panel! How do I erase the default
> text field?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Customize-AjaxEditableLabel-tp3643409p3643712.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Customize AjaxEditableLabel
Posted by PDiefent <pd...@csc.com>.
I tried it like AjaxEditableLabel does itself, but now I get the default
input field plus the new fields in the panel! How do I erase the default
text field?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Customize-AjaxEditableLabel-tp3643409p3643712.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Customize AjaxEditableLabel
Posted by Martin Grigorov <mg...@apache.org>.
AjaxEditableLabel itself, I guess.
See how it creates TextField.
On Mon, Jul 4, 2011 at 1:49 PM, PDiefent <pd...@csc.com> wrote:
> Thanks for your fast response.
> Is there a QuickStart available how to implement it?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Customize-AjaxEditableLabel-tp3643409p3643435.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Customize AjaxEditableLabel
Posted by PDiefent <pd...@csc.com>.
Thanks for your fast response.
Is there a QuickStart available how to implement it?
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Customize-AjaxEditableLabel-tp3643409p3643435.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Customize AjaxEditableLabel
Posted by Martin Grigorov <mg...@apache.org>.
See org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel.newEditor(MarkupContainer,
String, IModel<T>)
Return FormComponentPanel.
On Mon, Jul 4, 2011 at 1:30 PM, Peter Diefenthaeler <pd...@csc.com> wrote:
> Hallo,
> is it possible to customize AjaxEditableLabel in a way that I can replace
> the TextEditField with a panel? I have to display a little Form with a
> text area component and some buttons. A modal window doesn't work for me
> because I want to show the panel exactly at the position of the label.
> Thanks, Peter
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org