Well that is not intentional atleast.
Here are some snippets from the code:
public class ButtonEdit extends AjaxButton
{
public ButtonEdit(String id)
{
super(id);
}
@Override
protected void onSubmit(
AjaxRequestTarget target,
Form form)
{
FormItem formItem = (FormItem)form;
formItem.setEdit(target);
}
}
public class FormItem extends Form<Item>
{
private TextField textFieldPDUID;
private TextField textFieldItemName;
private TextField textFieldItemNum;
private TextField textFieldComment;
private TextField textFieldDescription;
private TextField textFieldAuthor;
private TextField textFieldDraftID;
private TextField textFieldNoteType;
private Item item;
private List<TextField> editableComponents = new
LinkedList<TextField>();
final AttributeModifier readonlyBehaviour;
private boolean buttonEditable = false;
private ButtonEdit buttonEdit;
private ButtonCancelEdit buttonCancelEdit;
private ButtonSave buttonSave;
private ButtonRefresh buttonRefresh;;
private String errorText = "";
private Label errorLabel;
private App app;
public FormItem(
Item item,
App app)
{
super ("itemForm", new CompoundPropertyModel<Item>(new
Model<Item>(item)));
this.item = item;
this.app = app;
add (new Label("pduid"));
add (new Label("creationDateTime"));
add (new Label("modificationDateTime"));
textFieldItemName = new TextField("name");
textFieldItemNum = new TextField("num");
textFieldNoteType = new TextField("note_type");
textFieldComment = new TextField("comment");
textFieldDescription = new TextField("descrip");
textFieldAuthor = new TextField("author");
textFieldDraftID = new TextField("draft_ID");
add(textFieldItemName);
add(textFieldItemNum);
add(textFieldComment);
add(textFieldDescription);
add(textFieldAuthor);
add(textFieldDraftID);
add(textFieldNoteType);
editableComponents.add(textFieldItemName);
editableComponents.add(textFieldItemNum);
editableComponents.add(textFieldComment);
editableComponents.add(textFieldDescription);
editableComponents.add(textFieldAuthor);
editableComponents.add(textFieldDraftID);
editableComponents.add(textFieldNoteType);
buttonEdit = new ButtonEdit("makeEditable");
add(buttonEdit);
buttonCancelEdit = new ButtonCancelEdit("cancelEdit");
buttonCancelEdit.setDefaultFormProcessing(false);
buttonCancelEdit.setVisible(false);
add(buttonCancelEdit);
buttonSave = new ButtonSave("save");
add(buttonSave);
buttonSave.setVisible(false);
buttonRefresh = new ButtonRefresh("refresh");
add(buttonRefresh);
readonlyBehaviour = new AttributeModifier("readonly", true, new
Model("readonly"));
setComponentsAttribute(readonlyBehaviour);
setComponentsOutPutMarkupPlaceholderTag();
this.setOutputMarkupPlaceholderTag(true);
this.add(new AttributeModifier("readonly", true, new
Model("readonly")));
this.errorLabel = new Label("errorLabel", new
PropertyModel<String>(this,
"errorText"));
errorLabel.setOutputMarkupPlaceholderTag(true);
add(errorLabel);
}
public void setEdit(AjaxRequestTarget target)
{
setErrorText(null);
if (buttonEditable == true)
{
return;
}
removeComponentsAttribute(readonlyBehaviour);;
addComponentToAjaxRequestTarget(target);
target.addComponent(this);
buttonEdit.setVisible(false);
buttonCancelEdit.setVisible(true);
buttonSave.setVisible(true);
buttonEditable = true;
}
public void cancelEdit(AjaxRequestTarget target)
{
setErrorText(null);
if (buttonEditable == false)
{
return;
}
this.setModel(new CompoundPropertyModel<Item>(new
Model<Item>(item)));
setComponentsAttribute(readonlyBehaviour);
addComponentToAjaxRequestTarget(target);
target.addComponent(this);
buttonEdit.setVisible(true);
buttonCancelEdit.setVisible(false);
buttonSave.setVisible(false);
buttonEditable = false;
}
private void setComponentsOutPutMarkupPlaceholderTag()
{
for (TextField textField : editableComponents)
{
textField.setOutputMarkupPlaceholderTag(true);
}
}
private void addComponentToAjaxRequestTarget(
AjaxRequestTarget target)
{
for (TextField textField : editableComponents)
{
target.addComponent(textField);
}
target.addComponent(errorLabel);
}
private void setComponentsAttribute( AttributeModifier
attributeModifier)
{
for (TextField textField : editableComponents)
{
textField.add(attributeModifier);
}
}
private void removeComponentsAttribute( AttributeModifier
attributeModifier)
{
for (TextField textField : editableComponents)
{
textField.remove(attributeModifier);
}
}
...
...
}
Thanks for your help. Really appreciate it.
igor.vaynberg wrote:
>
> what is your isvisible() code look like??
>
> because if isvisible() depends on some condition that both sessions
> share, eg database, you will get this behavior and it is the expected
> behavior.
>
> -igor
>
>
--
View this message in context:
http://www.nabble.com/session-%22jumping%22--tp18999615p19318494.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]