Re: java.lang.IllegalArgumentException: Parameter modelObject cannot be null

2010-07-05 Thread Dr. Wolf Blecher
Is in entity the field name also initialized? Try to set it to the empty
String in the initialization of entity.

Am 05.07.2010 09:37, schrieb Sigmar Muuga:
 Also entity is initalized for that organisation object.
 
 On Mon, Jul 5, 2010 at 10:36 AM, Sigmar Muuga meedi...@gmail.com wrote:
 
 Hello,
 I am creating a form, my form has an instance variable:
 private Organization organisation;

 Also, organisation is initialized in constructor with new Organisation().

 Now I am creating a TextField, that uses the propertyModel:
 IModelOrganization m1 = new PropertyModelOrganization(organisation, 
 entity.name);
  TextFieldOrganization organisationName = new
 TextFieldOrganization(organisationName, m1);
 organisationName.setRequired(true);
  add(organisationName);

 But when I load the page, I get:
 java.lang.IllegalArgumentException: Parameter modelObject cannot be null

 I have read the docs and manuals about models etc, but this thing here is
 really weird..

 

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



body-tag onLoad/onScroll

2010-06-22 Thread Dr. Wolf Blecher
Hi all,

I have the following situation:
I want to add a java script function call to the body tag which get's as
parameter the id of a wicket panel:

body onload=javascript: initPosition('sidebarRightSelection65');
onscroll=javascript: sideBarRightPos('sidebarRightSelection65');

So I tried the following:

add(new BodyTagAttributeModifier(onload, true, new Model(javascript:
initPosition(' + selection.getMarkupId() + ');), selection));

I also let the Panel implement the IHeaderContributor Interface but this did
not work either.

Neither way worked.

What I want to basically achieve is that if the element is scrolled out of the
page, its style will be set to fixed, so that keeps shown. I have a javascript
function for this, but this function needs the id of the element.

Any hints?

Cheers

Wolf

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



Re: DropDownChoice problem

2010-05-28 Thread Dr. Wolf Blecher
Hi,

just a few guesses:
- I don't think that this is according to a language problem.
- as far as I can see in your HTML code the DropDown is inside the span
wicket:id=adress_border, so maybe this is an issue
- may be you just ommited it, but I don't see a closing tag for your select
wicket:id=adress_city
- If I remember correctly, there (has been?) is an issue about wicket and the
short format of closing tags like in your input tag. May be you can try
input wicket:id=address id=address class=address title=an address in
Belgium type=text/input
- According to the error messages you presented, the error is not in the Java
Code but in the HTML markup you provided, so may be you have to look here
I'm not an HTML expert and may be this is valid HTML, but why do you use e.g.
\span instead of span as opening tag?

Good luck

Wolf

Am 27.05.2010 23:26, schrieb Matthieu:
 
 Hello,
 
 
 I've a problem with the DropDownChoice (and maybe language?). 
 
 I've a Panel who's rendering perfectly when i set the language in english
 and not rendering when i set in french... 
 
 
 The message from wicket :
 
 WicketMessage: The component(s) below failed to render. A common problem is
 that you have 
 added a component in code but forgot to reference it in the markup (thus the
 component will never be rendered).
  
 1. [Component id = address_city]
  
 Root cause:
  
 org.apache.wicket.WicketRuntimeException: The component(s) below failed to
 render. A common problem is that you 
 have added a component in code but forgot to reference it in the markup
 (thus the component will never be rendered).
 
 
 1. [Component id = address_city]
 
 
 My java code is :
 
 
 final DropDownChoice cityChoice = new DropDownChoice(address_city, new
 PropertyModel
 (form.getModelObject(), city), cityList); (here you can see the
 address_city)
 
 
 final AjaxFormComponentUpdatingBehavior updatingBehavior2 = new
 AjaxFormComponentUpdatingBehavior(onchange) {
 
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
 
   getAddress(form, customer_address, cityChoice, the_map);
 
   }
 
 };
 
 cityChoice.add(updatingBehavior2);
 
 
 form.add(cityChoice);
 
  
 My html code is :
 
 
 \span wicket:id=address_border\input wicket:id=address id=address 
 class=address
 title=an address in Belgium type=text /\select wicket:id=address_city
 
 I don't really understand why, anyone to explain me the problem?
 
 
 Thank you.

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



Re: Ajax Repeater Fragment Update

2010-05-18 Thread Dr. Wolf Blecher
Thanks for the response. Attached is the markup and the java classes for the
panel. It's slightly modified since normally a DataView is used, but the
behaviour is the same with the ListView. This is only the panel class and not
a complete quickstart.

Here is the markup

html xmlns:wicket
  head
meta http-equiv=Content-Type content=text/html; charset=UTF-8/
titleTreeDataViewPanel/title
  /head
  body
wicket:panel
  table
thead
  tr
th/th
thName/th
thVorname/th
  /tr
/thead
tbody
  div wicket:id=overview
div wicket:id=extendingRowUSer Data here/div
  /div
/tbody
  /table
/wicket:panel
  /body
/html

wicket:fragment wicket:id=rowView
  tr
td
  a wicket:id=extendLink
span wicket:id=extendSymbolArrow/span
  /a
/td
td
  div wicket:id=nameName/div
  div wicket:id =details
ul
  libAgain/bspan wicket:id=strasseStrasse/span/li
/ul
  /div
/td
tdspan wicket:id=vornameVorname/span/td
  /tr
/wicket:fragment

and the corresponding Java

public class TreeDataViewPanel extends Panel {

  private ListString userList = Arrays.asList(User 1,User 2,User 3);

  public TreeDataViewPanel(String id) {
super (id);
ListViewString userTable = new ListViewString(overview, userList) {
  @Override
  protected void populateItem(ListItemString item) {
String user = item.getModelObject();

DetailFragment dataView =
  new DetailFragment(extendingRow,rowView,user);
dataView.setOutputMarkupId(true);
item.add(dataView);
  }
};
add(userTable);
  }
}

class DetailFragment extends Fragment {

 private boolean compressed = true;

  public boolean isCompressed() {
return compressed;
  }

  public void setCompressed(boolean compressed) {
this.compressed = compressed;
  }

  public DetailFragment(String id, String markupId, String user) {
super(id, markupId);

WebMarkupContainer detailContainer = new WebMarkupContainer(details) {
  @Override
  public boolean isVisible() {
return !isCompressed();
  }
};

add(new DropDownLink(extendLink, this));
add(new Label(name, user));
add(new Label(vorname, user));

detailContainer.add(new Label(strasse, user));
add(detailContainer);
  }
}


class DropDownLink extends AjaxLink {

  DetailFragment parent;
  Label compressedSymbol = new Label(extendSymbol,\u25B6); // 9654
  Label expandSymbol = new Label(extendSymbol,\u25BC); // 9660
  Label linkSymbol;

  @Override
  public void onClick(AjaxRequestTarget target) {
if (parent.isCompressed()) {
  linkSymbol.replaceWith(expandSymbol);
  linkSymbol = expandSymbol;
  parent.setCompressed(false);
} else {
  linkSymbol.replaceWith(compressedSymbol);
  linkSymbol = compressedSymbol;
  parent.setCompressed(true);
}
target.addComponent(linkSymbol);
target.addComponent(parent);
  }

  public DropDownLink(String id, DetailFragment parent) {
super(id);
linkSymbol = compressedSymbol;
linkSymbol.setOutputMarkupId(true);
expandSymbol.setOutputMarkupId(true);
compressedSymbol.setOutputMarkupId(true);
this.parent = parent;
add(linkSymbol);
  }
}

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



Ajax Repeater Fragment Update

2010-05-17 Thread Dr. Wolf Blecher
Hi,

maybe I just get the usual response that I have to redraw the complete table,
but it's worth a try.

I want to implement a Drop-Down-Detail-Table, basically it is the same
functionality as a tree-table but I don't want to show additional table rows,
but extend the current table row with additional information.

What I tried is to add a Fragment to my table row, where the information I
additionally want to display is encapsulated by a WebMarkupContainer whose
isVisible method depends on the compressed state of the detail information.

On the Fragment I have a AjaxLink and three labels (one to display the link
symbol, and two to display base information)

I've overwritten the onClick Method of the Link and added the Fragment to the
target.

What happens when I click on the link is that the fragment gets redrawn (as
expected) but not _inside_ the repeater but merely ontop of the repeater:


Before Click:
-
Header BlaBla
Table Head
Compressed Entry 1
Compressed Entry 2
Footer BlaBla


After Click:
-
Header BlaBla
Expaneded Entry 1
Table Head
Compressed Entry 1
Compressed Entry 2
Footer BlaBla


Does anyone has any ideas wether it is possible to update the fragment
_inside_ the table or do I have to redraw the complete table to achieve the
expected behaviour?

Regards

Wolf

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



Re: doctype and markup inheritance

2010-05-11 Thread Dr. Wolf Blecher
Hi Stefan,

as far as I understood markup inheritance correctly, the xml and doctype
of B is ignored and only the part that is specified inside the
wicket:extend.../wicket:extend tags is taken over in A instead of
the wicket:child.../wicket:child part.
Everything that is specified additionally in B is only for previewing B
in a browser of your choice.
So the answer to your question is 1.

Wolf

Am 11.05.2010 08:09, schrieb Stefan Lindner:
 Dear Wicket wizzards,

 given is a page A with a HTML file that has no doctype, just starting with 
 html...wicket:child

 The Page's class is extended by B and the markup of B has a proper HTML file 
 with XML and doctype lines.

 What is the intended behavior of wicket?

 1. Ignore the exdending B's xml and doctype an use the settings form A
 2. Override the settings from A with the proper doctype from B
 3. Control it in Wicket's Application.init()?

 getMarkupSettings().setStripXmlDeclarationFromOutput(true/false) has no 
 effect. In my case (given A that cannot be modified) item 1. is true.

 Stefan

   



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



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



BreadCrumbPage struggle

2010-04-30 Thread Dr. Wolf Blecher
Hi,

I'm trying to implement a BreadCrumbPage
What I did was to generate a BasePage, which has a BreadCrumbBar on it,
and I subclass a startPage from it, which implements the
IBreadCrumbParticipant interface. The BreadCrumbBar is passed as
parameter to this new page, so that instead of creating the
breadCrumbBar all again, I just say Add the passed one to the page.
Furthermore I use a BreadCrumbBar.setActive(this) to add the StartPage
to the BreadCrumbBar.
in the onActivate method I do nothing at the moment.
The problem is, that when running the page I get a StackOverflowError:
The call order is the following:
Session.getDirtyObjectsList
dirtyPage
Page.onDetach
Component.detach
BreadCrumbBar.onDetach
Component.detach
detachChildren
Component.detach
BreadCrumbBar.onDetach
[...]
For me this makes sense, since the BreadCrumbBar is a Child of the Page
which is a Child of the BreadCrumbBar.(if I understood the
implementation correctly)
The Question is how to implement a BreadCrumbPage correctly? One option
I was thinking of is to subclass BreadCrumbBar and override the onDetach
method or to override the Components onDetach method. However, using a
call to super() in one of the two methods will still result in the same
problem.
Any hints on this?

Regards

Wolf


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



BreadcrumbPanel Form Model

2010-04-28 Thread Dr. Wolf Blecher
Hi everybody,

For the last two days I'm stumbling around the following problem.
I have a BreadCrumbPanel (UserEditPanel) and a form inside this panel.
In the form there are two textfields (Name, ChristianName),  a
DropDownChoice (role), a link (Edit Roles) and two buttons (Save, Cancel).
The idea is that I change something in the textfields, click on the
editRolesLink, a new BreadCrumbPanel is opened, where I can add some
Roles, and when I return to the EditUserPanel the CHANGED values are in
the text fields instead of the ORIGINAL values.

At the moment I am doing the following:
On creation of the UserEditPanel I am assigning the modelObject that is
passed via the constructor to a local variable user.
The form gets as default model a new CompoundPropertyModel with this
local variable:

userEditForm.setDefaultModel(new CompoundPropertyModelUser(user));

The values of the variable are correctly filled in the TextFields, so
adding my textfields works fine.

If I change something in the Textfields, click the Save Button (which
submits the form) and I set my values to user.getName() etc. the changed
values are taken, so the values of the local user variable are updated.

But when I click on the BreadCrumbPanelLink (which does not submit the
form by default), the original values are restored in the textfields
when I come back to the UserEditPanel.
So I tried to overwrite the onClick Method of the BreadCrumbPanelLink to
start a form processing (which should do nothing except storing changed
values from the model in the local user variable since I did not
overwrite the onSubmit method of the form)
the values of my local user variable are set to null.

One possible solution I was thinking of is that instead of using
userEditForm.add(new TextField(vorname))
I write
TextField vorname = new Textfield(vorname);
userEditForm.add(vorname);
and in the onClick Method of the BreadCrumbPanelLink I use
user.setVorname(vorname.getInput());

but as far as I understood models correctly, this should not be
necessary. But where is the missing link?

Regards

Wolf


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



Re: BreadcrumbPanel Form Model

2010-04-28 Thread Dr. Wolf Blecher
I'm not quite sure if this is the perfect way of doing this, but here is
a workaround:

Instead of placing a BreadCrumbPanelLink, I placed a SubmitLink and in
the onSubmit method I use the IBreadCrumbPanelFactory-Method to create
the new BreadCrumbPanel.
So the form gets submitted (which is needed to update the model) and the
new BreadCrumbPanel is created and after returning the changed values
are still alive.

Cheers

Wolf


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