Re: generics

2008-07-04 Thread Matthijs Wensveen

Matej Knopp wrote:

On Thu, Jul 3, 2008 at 9:51 AM, Matej Knopp [EMAIL PROTECTED] wrote:
  

And there is some functionality in there that Wicket might
be better without. For example, onModelChanged / Changing
things become tricky when you share the same model between
different instances. And when using setModelObject() with an
object that is equal to the current model object, but a
different instance (such as a Hibernate-persisted object
bound to the correct session), you have to either do
getModel().setObject() or change the model comparator.

  

setModelObject isn't the best idea IMHO. Models should support some
kind of state change notifications, we might want to improve that for
1.5, though it probably wouldn't be very easy to do.


Well, we can hardly detect change of propertypromodels unless we pull
and compare the value every time...
  


Better state change notifications would be a huge improvement IMO 
because that way components could add themselves to AjaxRequestTarget 
when needed. Currently all Ajax functionality requires Ajaxified 
components to know about each other and when they should be displayed. 
Some kind of even mechanism as described in 
https://issues.apache.org/jira/browse/WICKET-1312 would definitely help, 
but a model-driven approach would be even better.


I was thinking to support this using annotations and aspects and the 
likes, but I haven't had the time to create a proof of concept.


Matthijs

PS. Thread subject has become little different than thread content :)

--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 423
F +31 20 4223500 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to add nodes to a tree using Ajax

2008-07-04 Thread geke

Hello,

to your point 2.
You have to build a subclass from LinkTree.
A example is in the attachement. 
http://www.nabble.com/file/p18273760/MyTree.java MyTree.java 

To point 3.

Why you only want to load only the root and reload the next level?
In my solution all Node are updated via updateTree().

GeKe


Kai Schubert-Altmann wrote:
 
 HI everybody
 
 I solved the first problem by my own by adding the following method to the
 tree:
 
   public DefaultMutableTreeNode getSelectedNode() {
 Object selected = null;
 try {
   selected = this.getTreeState().getSelectedNodes().iterator().next();
 } catch (NoSuchElementException nseEx) { }
 return (selected instanceof DefaultMutableTreeNode)?
 (DefaultMutableTreeNode)selected : null;
   }
 
 That worked for me without problems. Or is there an easier way?
 
 Kai
 
 2008/7/3 Kai Schubert-Altmann [EMAIL PROTECTED]:
 
 Hi,

 thanks to both of you! Matejs code worked very fine, so i didn't tried
 gekes version.

 But now i have the next three problems/questions:

 1. If i want to add a new node to the selected node, then i have to get
 the
 selected node first. How can i do that?

 2. Can i change the shown icons to custom ones?

 3. Is it possible to load the root element only and reload the next
 level,
 when you click the plus-image?

 Kai

 2008/6/27 geke [EMAIL PROTECTED]:


 try this code:

 fileTree = new LinkTree();

 TreeNode existingTreeNode = ...;

 DefaultMutableTreeNode newTreeNode = new DefaultMutableTreeNode(object);
 DefaultTreeModel model = (DefaultTreeModel)fileTree.getModelObject();
 model.insertNodeInto(newTreeNode, treeNode, 0);
 fileTree.updateTree(target);




 Kai Schubert-Altmann wrote:
 
  Hi,
 
  how can I add nodes to a wicket tree using a AjaxLink?
 
  I tried to add a node to the SimpleTree of this example:
  http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
 
  with this code:
 
  add(new AjaxLink(addNode)
  {
  public void onClick(AjaxRequestTarget target)
  {
List list = new ArrayList();
list.add(new node);
BaseTreePage.this.add(rootNode,list);
getTree().updateTree(target);
  }
  });
 
  But the tree will not update itself.
 
  Thanks in advance,
  Kai
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18150967.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]



 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18273760.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]



Re: Strange stack trace in logs

2008-07-04 Thread Piller Sébastien
Thank you for your answer... Unfortunately, it doesn't seem to be the 
only reason... I've got some stack trace speaking about css and js


java.lang.IllegalStateException: URL fragment has unmatched key/value pair: 
../../resources/mypack.MyClass/script.js
at 
org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy.decodeParameters(AbstractRequestTargetUrlCodingStrategy.java:174)
at 
org.apache.wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:103)

I think the user didn't try anything with the js scripts... And I really 
have a lot of traces...



Martijn Dashorst a écrit :

usually this is from users that copy/paste incomplete url's from other
users, or people tampering with urls

Martijn
  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: generics

2008-07-04 Thread Johan Compagner
There are many state things in a component. Wicket itself has only a
few like model/visibile/enable. But a developer could add many many
more.

In our project this is easily handled by our components. Every
component knows when it is changed, what ever it is and then a visitor
adds them to ajax. We have a fixed set of components so its not a big
problem.

On 7/4/08, Matthijs Wensveen [EMAIL PROTECTED] wrote:
 Matej Knopp wrote:
 On Thu, Jul 3, 2008 at 9:51 AM, Matej Knopp [EMAIL PROTECTED] wrote:

 And there is some functionality in there that Wicket might
 be better without. For example, onModelChanged / Changing
 things become tricky when you share the same model between
 different instances. And when using setModelObject() with an
 object that is equal to the current model object, but a
 different instance (such as a Hibernate-persisted object
 bound to the correct session), you have to either do
 getModel().setObject() or change the model comparator.


 setModelObject isn't the best idea IMHO. Models should support some
 kind of state change notifications, we might want to improve that for
 1.5, though it probably wouldn't be very easy to do.

 Well, we can hardly detect change of propertypromodels unless we pull
 and compare the value every time...


 Better state change notifications would be a huge improvement IMO
 because that way components could add themselves to AjaxRequestTarget
 when needed. Currently all Ajax functionality requires Ajaxified
 components to know about each other and when they should be displayed.
 Some kind of even mechanism as described in
 https://issues.apache.org/jira/browse/WICKET-1312 would definitely help,
 but a model-driven approach would be even better.

 I was thinking to support this using annotations and aspects and the
 likes, but I haven't had the time to create a proof of concept.

 Matthijs

 PS. Thread subject has become little different than thread content :)

 --
 Matthijs Wensveen
 Func. Internet Integration
 W http://www.func.nl
 T +31 20 423
 F +31 20 4223500


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: More on wicket url stratergy

2008-07-04 Thread Erik van Oosten

Ok, here is my code. Perhaps the way I (ab)use HybridUrlCodingStrategy
is what made the URLs change.

In the ctor of ChangePasswordPage:

FormPasswordObject form = new FormPasswordObject(form, new 
CompoundPropertyModelPasswordObject(passwordObject)) {
  protected void onSubmit() {
try {
  getSession().authenticateMemberByCredentials(me.getEmail(), 
passwordObject.getPassword(), true);
  ... update password ...
  info(getLocalizer().getString(form.info.password.changed, this));
  setResponsePage(new AccountPage());
} catch (AuthenticationFailure authenticationFailure) {
  error(getLocalizer().getString(form.error.wrongpassword, this));
}
  }
};

and in Application#init():

mount(new NonVersionedHybridUrlCodingStrategy(settings/account, 
AccountPage.class));
mount(new NonVersionedHybridUrlCodingStrategy(settings/account/password, 
ChangePasswordPage.class));

NonVersionedHybridUrlCodingStrategy looks like this:

/**
 * Variant of Wicket's HybridUrlCodingStrategy.
 * Use this URL coding strategy in the frontend for non versioned pages
 * (call setVersioned(false) in the constructor) that have some kind of
 * feedback (e.g. a form submit).
 */
private static class NonVersionedHybridUrlCodingStrategy extends 
HybridUrlCodingStrategy {

public NonVersionedHybridUrlCodingStrategy(String mountPath, Class? 
extends Page pageClass) {
super(mountPath, pageClass);
}

@Override
protected String addPageInfo(String url, PageInfo pageInfo) {
// Do not add the version number as super.addPageInfo would do.
return url;
}
}


Regards,
 Erik.



Mathias P.W Nilsson wrote:
 Can you please elaborate. 

 I have this Link in my List class
 Link itemLink = new Link( itemLink, listItem.getModel() ){
   @Override
   public void onClick() {
 PageParameters parameters = new PageParameters();
 parameters.add( ItemId, ((Item)getModelObject()).getId().toString());
 ItemPage itemPage = new  ItemPage( parameters, ItemListPage.this );
 itemPage.setRedirect( true );
 setResponsePage( itemPage  );
   }
 };
 This will produce url like wicket:interface=:2

 In My application class I have tried a number of mounting but without
 success. Any more pointers?
 I use the reference for the ItemListPage to go back from ItemPage to
 ItemListPage plus I use the same background as in the ItemListPage.

 If a google spider where to index this it would not be successful so I need
 a way to get this to be bookmarkable.
   

-- 

--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: TextField in IE and Opera

2008-07-04 Thread Martin Grigorov
On Thu, 2008-07-03 at 12:21 +0200, Alexander Landsnes Keül wrote:
 I'm having a wee bit of a problem getting TextFields to cooperate in our 
 project. I'm baffled by the problem, because it's something that's been 
 working fine for months.
 
  
 
 The panel I'm working with is very a simple, a form with two text fields; 
 username and password. If I submit the form in Opera it processes the input 
 correctly and I can proceed with the login. If I submit with IE 7, both 
 TextFields are submitted with a null value which isn't terribly useful to me.
 
  
 
 The code is as follows:
 
  
 
 public LoginPanel ( final String id )
 
   {
 
 super(id, new ResourceModel(message.login_header));
 
 setOutputMarkupId(true);
 
  
 
 final FeedbackPanel feedback = new FeedbackPanel(feedback);
 
 feedback.setOutputMarkupId(true);
 
 add(feedback);
 
  
 
 final Form form = new Form(form);
 
 form.setOutputMarkupId(true);
 
 add(form);
 
  
 
 final FormComponent username = new TextField(username, new 
 Model(), String.class);
 
 username.setLabel(new ResourceModel(label.username));
 
 username.setRequired(true);
 
 form.add(username);
 
 form.add(new SimpleFormComponentLabel(username_label, 
 username));
 
  
 
 final FormComponent password = new PasswordTextField(password, 
 new Model());
 
 password.setLabel(new ResourceModel(label.password));
 
 password.setRequired(true);
 
 form.add(password);
 
 form.add(new SimpleFormComponentLabel(password_label, 
 password));
 
  
 
 final AjaxFallbackButton submit = new 
 AjaxFallbackButton(submit, form)
 
 {
 
   private static final long serialVersionUID = 1L;
 
  
 
   @Override
 
   public void onSubmit( final AjaxRequestTarget target, final 
 Form form )
 
   {
 
 String user = (String) username.getConvertedInput();
 
 String pwd = (String) password.getConvertedInput();
 
 String abc = username.getRawInput();
 
 
 
 loginAction(user, pwd, target);
 
   }
 
  
 
   @Override
 
   public void onError( final AjaxRequestTarget target, final 
 Form form )
 
   {
 
 error(BAD!);
target.addComponent(feedback);
 
   }
 
 };
 
  
 
 submit.setModel(new ResourceModel(button.login));
 
 form.add(submit);
 
   }
 
  
 
 I've tried to create class member models for the TextFields, I've tried to 
 fetch the values from the TextFields with getModelObject(), 
 getModelObjectAsString(), getInput()...none of them work. I've tried to 
 downgrade from wicket 1.3.4 to wicket 1.3.3, which I know worked with IE, and 
 still no joy.
 
  
 
 I don't think my code will help overly much, but it's worth pasting it at 
 least. The panel replaces another panel when I click on an ajax link, might 
 be related to that but again it's worked like this before.
 
  
 
 Alex
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Prevent navigation to other pages on unsaved data

2008-07-04 Thread Andre van der Schyff
We're having trouble implementing a page that prevents the user from
navigating away after data has changed on the page without saving. To do
this, we've extended WebRequestCycle with the following:

public class CustomRequestCycle extends WebRequestCycle {

  protected void onBeginRequest() {
ApplicationSession applicationSession = (ApplicationSession)
getWebSession();   // Our custom Session
if (applicationSession.hasUnsavedData()) {  //
Components on the page sets this value
  applicationSession.setUnsavedData(false);

  Page page = (Page) applicationSession.getPageMaps().get(0);//
Trying to get the last page here, how do we do this?
  onRuntimeException(page, new DomainException(unsaved.data.message));
}
  }

}

We can't seem to get the last page out of the PageMap so we can return to
it. Are we doing this right, or is there some other way to do this?

Thanks,
Andre


Issues with a TreeGrid inside a Form

2008-07-04 Thread ulrik

I have a question about the TreeGrid from Inmethod .

I have a very simple page with this markup:

...
... 
  body
form wicket:id=form
div wicket:id=grid/div

input type=submit value=click wicket:id=button /
/form
  /body
...
...

And the corresponding java class

public class BaseExamplePage extends WebPage {

private AjaxEditableLabel label;

public BaseExamplePage() {

Form form = new Form(form){
protected void onSubmit() {
System.out.println(submitting in form);
}
};
add(form);
label = new AjaxEditableLabel(ajaxlabel,new Model(test)) {
@Override
protected void onSubmit(AjaxRequestTarget target) {
getLabel().setVisible(true);
getEditor().setVisible(false);
target.addComponent(label);
target.appendJavascript(window.status='';);
}
};
form.add(label);
form.add(new EditableTreeGridPage(grid));
form.add(new Button(button));
}
}

The problem is that when I edit a cell in the TreeGrid, and press Enter the
onSubmit method for the Form is called, and the entire page gets reloaded.
This is a problem for me. Is there a way of preventing the Forms' onSubmit
method to get called when I press Enter after editing a cell?

I would like it to behave like the AjaxEditableLabel: After editing the text
in the label and press Enter, the Forms onSubmit method is not called.

//Ulrik
-- 
View this message in context: 
http://www.nabble.com/Issues-with-a-TreeGrid-inside-a-Form-tp18274553p18274553.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]



Change mounted URL - redirect to new one

2008-07-04 Thread Thomas Singer

Hi,

We are using Wicket for our web*site* and want to change the URL of a 
mounted page. Is there an elegant way in Wicket to redirect from /old-path 
to /new-path or should we better do that the hard way with a URL rewriting 
filter?


--
Thanks in advance,
Tom

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



A problem with paging - Page links not showing up

2008-07-04 Thread JohannesK

Hi

I've tried searching for this problem but couldn't find anything useful. My
problem, in a nutshell, is that my PagingNavigation produces empty  blocks
where the paging should go. Here's the Java, I'm doing this in the
constructor of a wicket Panel object:

container = new WebMarkupContainer(bookDataView);
DataView bookDataView = createDataView(bookDataRepeater);
bookDataView.setItemsPerPage(5);
AjaxPagingNavigation ajaxPaging = new
AjaxPagingNavigation(paging,bookDataView);
ajaxPaging.setOutputMarkupId(true);
add(ajaxPaging);
container.add(bookDataView);
add(container);


On the HTML side:


wicket:panel

div wicket:id=bookDataView  
table class=bookDataColorTable width=100%

tr
   cut out a bunch of tdlabel/td here 
/tr

/table
/div
/wicket:panel


Now, I tested the dataview and it returns data just fine, well over 5 items.
View source shows this:



div class=bookDataView  
table class=bookDataColorTable width=100%


The paging is just empty :s. Any idea what's going on here? 
-- 
View this message in context: 
http://www.nabble.com/A-problem-with-paging---Page-links-not-showing-up-tp18275593p18275593.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]



Re: A problem with paging - Page links not showing up

2008-07-04 Thread JohannesK

There should be a  span wicket:id=paging / span  there after the
wicket:panel tag but it's only visible when i edit the post.


JohannesK wrote:
 
 Hi
 
 I've tried searching for this problem but couldn't find anything useful.
 My problem, in a nutshell, is that my PagingNavigation produces empty 
 blocks where the paging should go. Here's the Java, I'm doing this in the
 constructor of a wicket Panel object:
 
   container = new WebMarkupContainer(bookDataView);
   DataView bookDataView = createDataView(bookDataRepeater);
   bookDataView.setItemsPerPage(5);
   AjaxPagingNavigation ajaxPaging = new
 AjaxPagingNavigation(paging,bookDataView);
   ajaxPaging.setOutputMarkupId(true);
   add(ajaxPaging);
   container.add(bookDataView);
   add(container);
 
 
 On the HTML side:
 
 
 wicket:panel
   
   div wicket:id=bookDataView  
   table class=bookDataColorTable width=100%
   
   tr
    cut out a bunch of tdlabel/td here 
   /tr
   
   /table
   /div
 /wicket:panel
 
 
 Now, I tested the dataview and it returns data just fine, well over 5
 items. View source shows this:
 
 
   
   div class=bookDataView  
   table class=bookDataColorTable width=100%
 
 
 The paging is just empty :s. Any idea what's going on here? 
 

-- 
View this message in context: 
http://www.nabble.com/A-problem-with-paging---Page-links-not-showing-up-tp18275593p18275652.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]



RE: TextField in IE and Opera

2008-07-04 Thread Alexander Landsnes Keül

I found the problem with this eventually, it was related to using NTLM 
authentication. IE doesn't perform any POST on forms until you've negotiated 
the password hashes again. Something which we seem to not do :)

Alex

-Opprinnelig melding-
Fra: Alexander Landsnes Keül [mailto:[EMAIL PROTECTED] 
Sendt: 3. juli 2008 12:21
Til: users@wicket.apache.org
Emne: TextField in IE and Opera

I'm having a wee bit of a problem getting TextFields to cooperate in our 
project. I'm baffled by the problem, because it's something that's been working 
fine for months.

 

The panel I'm working with is very a simple, a form with two text fields; 
username and password. If I submit the form in Opera it processes the input 
correctly and I can proceed with the login. If I submit with IE 7, both 
TextFields are submitted with a null value which isn't terribly useful to me.

 

The code is as follows:

 

public LoginPanel ( final String id )

  {

super(id, new ResourceModel(message.login_header));

setOutputMarkupId(true);

 

final FeedbackPanel feedback = new FeedbackPanel(feedback);

feedback.setOutputMarkupId(true);

add(feedback);

 

final Form form = new Form(form);

form.setOutputMarkupId(true);

add(form);

 

final FormComponent username = new TextField(username, new 
Model(), String.class);

username.setLabel(new ResourceModel(label.username));

username.setRequired(true);

form.add(username);

form.add(new SimpleFormComponentLabel(username_label, username));

 

final FormComponent password = new PasswordTextField(password, 
new Model());

password.setLabel(new ResourceModel(label.password));

password.setRequired(true);

form.add(password);

form.add(new SimpleFormComponentLabel(password_label, password));

 

final AjaxFallbackButton submit = new AjaxFallbackButton(submit, 
form)

{

  private static final long serialVersionUID = 1L;

 

  @Override

  public void onSubmit( final AjaxRequestTarget target, final 
Form form )

  {

String user = (String) username.getConvertedInput();

String pwd = (String) password.getConvertedInput();

String abc = username.getRawInput();



loginAction(user, pwd, target);

  }

 

  @Override

  public void onError( final AjaxRequestTarget target, final 
Form form )

  {

error(BAD!);

  }

};

 

submit.setModel(new ResourceModel(button.login));

form.add(submit);

  }

 

I've tried to create class member models for the TextFields, I've tried to 
fetch the values from the TextFields with getModelObject(), 
getModelObjectAsString(), getInput()...none of them work. I've tried to 
downgrade from wicket 1.3.4 to wicket 1.3.3, which I know worked with IE, and 
still no joy.

 

I don't think my code will help overly much, but it's worth pasting it at 
least. The panel replaces another panel when I click on an ajax link, might be 
related to that but again it's worked like this before.

 

Alex


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to add nodes to a tree using Ajax

2008-07-04 Thread Kai Schubert-Altmann
Hello,

2. Thanks, but your file contains only an empty class.

3. If the tree has ever 2000 nodes, it lasts maybe a little bit to long to
get all data at once from the database.

Kai

2008/7/4 geke [EMAIL PROTECTED]:


 Hello,

 to your point 2.
 You have to build a subclass from LinkTree.
 A example is in the attachement.
 http://www.nabble.com/file/p18273760/MyTree.java MyTree.java

 To point 3.

 Why you only want to load only the root and reload the next level?
 In my solution all Node are updated via updateTree().

 GeKe


 Kai Schubert-Altmann wrote:
 
  HI everybody
 
  I solved the first problem by my own by adding the following method to
 the
  tree:
 
public DefaultMutableTreeNode getSelectedNode() {
  Object selected = null;
  try {
selected =
 this.getTreeState().getSelectedNodes().iterator().next();
  } catch (NoSuchElementException nseEx) { }
  return (selected instanceof DefaultMutableTreeNode)?
  (DefaultMutableTreeNode)selected : null;
}
 
  That worked for me without problems. Or is there an easier way?
 
  Kai
 
  2008/7/3 Kai Schubert-Altmann [EMAIL PROTECTED]:
 
  Hi,
 
  thanks to both of you! Matejs code worked very fine, so i didn't tried
  gekes version.
 
  But now i have the next three problems/questions:
 
  1. If i want to add a new node to the selected node, then i have to get
  the
  selected node first. How can i do that?
 
  2. Can i change the shown icons to custom ones?
 
  3. Is it possible to load the root element only and reload the next
  level,
  when you click the plus-image?
 
  Kai
 
  2008/6/27 geke [EMAIL PROTECTED]:
 
 
  try this code:
 
  fileTree = new LinkTree();
 
  TreeNode existingTreeNode = ...;
 
  DefaultMutableTreeNode newTreeNode = new
 DefaultMutableTreeNode(object);
  DefaultTreeModel model = (DefaultTreeModel)fileTree.getModelObject();
  model.insertNodeInto(newTreeNode, treeNode, 0);
  fileTree.updateTree(target);
 
 
 
 
  Kai Schubert-Altmann wrote:
  
   Hi,
  
   how can I add nodes to a wicket tree using a AjaxLink?
  
   I tried to add a node to the SimpleTree of this example:
   http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
  
   with this code:
  
   add(new AjaxLink(addNode)
   {
   public void onClick(AjaxRequestTarget target)
   {
 List list = new ArrayList();
 list.add(new node);
 BaseTreePage.this.add(rootNode,list);
 getTree().updateTree(target);
   }
   });
  
   But the tree will not update itself.
  
   Thanks in advance,
   Kai
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18150967.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]
 
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18273760.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]




Re: How to add nodes to a tree using Ajax

2008-07-04 Thread geke

sorry hier are the file  http://www.nabble.com/file/p18279343/MyTree.java
MyTree.java 

To your point 3:
A possible solution would be:
Catch only the root level and next level from the database, give it into the
tree model and display it.

on click on the plus image you catch the next level and so on.

the plus image can you maybe handle with the onJunctionLinkClicked method.

GeKe



Kai Schubert-Altmann wrote:
 
 Hello,
 
 2. Thanks, but your file contains only an empty class.
 
 3. If the tree has ever 2000 nodes, it lasts maybe a little bit to long to
 get all data at once from the database.
 
 Kai
 
 2008/7/4 geke [EMAIL PROTECTED]:
 

 Hello,

 to your point 2.
 You have to build a subclass from LinkTree.
 A example is in the attachement.
 http://www.nabble.com/file/p18273760/MyTree.java MyTree.java

 To point 3.

 Why you only want to load only the root and reload the next level?
 In my solution all Node are updated via updateTree().

 GeKe


 Kai Schubert-Altmann wrote:
 
  HI everybody
 
  I solved the first problem by my own by adding the following method to
 the
  tree:
 
public DefaultMutableTreeNode getSelectedNode() {
  Object selected = null;
  try {
selected =
 this.getTreeState().getSelectedNodes().iterator().next();
  } catch (NoSuchElementException nseEx) { }
  return (selected instanceof DefaultMutableTreeNode)?
  (DefaultMutableTreeNode)selected : null;
}
 
  That worked for me without problems. Or is there an easier way?
 
  Kai
 
  2008/7/3 Kai Schubert-Altmann [EMAIL PROTECTED]:
 
  Hi,
 
  thanks to both of you! Matejs code worked very fine, so i didn't tried
  gekes version.
 
  But now i have the next three problems/questions:
 
  1. If i want to add a new node to the selected node, then i have to
 get
  the
  selected node first. How can i do that?
 
  2. Can i change the shown icons to custom ones?
 
  3. Is it possible to load the root element only and reload the next
  level,
  when you click the plus-image?
 
  Kai
 
  2008/6/27 geke [EMAIL PROTECTED]:
 
 
  try this code:
 
  fileTree = new LinkTree();
 
  TreeNode existingTreeNode = ...;
 
  DefaultMutableTreeNode newTreeNode = new
 DefaultMutableTreeNode(object);
  DefaultTreeModel model = (DefaultTreeModel)fileTree.getModelObject();
  model.insertNodeInto(newTreeNode, treeNode, 0);
  fileTree.updateTree(target);
 
 
 
 
  Kai Schubert-Altmann wrote:
  
   Hi,
  
   how can I add nodes to a wicket tree using a AjaxLink?
  
   I tried to add a node to the SimpleTree of this example:
   http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
  
   with this code:
  
   add(new AjaxLink(addNode)
   {
   public void onClick(AjaxRequestTarget target)
   {
 List list = new ArrayList();
 list.add(new node);
 BaseTreePage.this.add(rootNode,list);
 getTree().updateTree(target);
   }
   });
  
   But the tree will not update itself.
  
   Thanks in advance,
   Kai
  
  
 
  --
  View this message in context:
 
 http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18150967.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]
 
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18273760.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]


 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-add-nodes-to-a-tree-using-Ajax-tp18130191p18279343.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]



Re: Strange stack trace in logs

2008-07-04 Thread Jan Stette
I've also had reports of a similar problem.  The logs I have show references
to css files, and I'm sure that the user didn't modify any URLs:

ERROR 11:52:37,426 [btpool1-5] wicket.RequestCycle URL fragment has
unmatched key/value pair:
wicket:interface/_0_1214298450782%3A0%3A3%3AINewBrowserWindowListener%3A%3A/wicket:pageMapName/_0_1214298450782/CollectionNodeComponent.css

java.lang.IllegalStateException: URL fragment has unmatched key/value pair:
wicket:interface/_0_1214298450782%3A0%3A3%3AINewBrowserWindowListener%3A%3A/wicket:pageMapName/_0_1214298450782/CollectionNodeComponent.css

at
org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy.decodeParameters(AbstractRequestTargetUrlCodingStrategy.java:174)

at
org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:76)

...

I'm trying to reproduce/debug this at the moment, I'll post more details if
I find anything out.  (We're on Wicket 1.3.3 by the way)

Jan


2008/7/4 Piller Sébastien [EMAIL PROTECTED]:

 Thank you for your answer... Unfortunately, it doesn't seem to be the only
 reason... I've got some stack trace speaking about css and js

 java.lang.IllegalStateException: URL fragment has unmatched key/value pair:
 ../../resources/mypack.MyClass/script.js
at
 org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy.decodeParameters(AbstractRequestTargetUrlCodingStrategy.java:174)
at
 org.apache.wicket.request.target.coding.PackageRequestTargetUrlCodingStrategy.decode(PackageRequestTargetUrlCodingStrategy.java:103)

 I think the user didn't try anything with the js scripts... And I really
 have a lot of traces...


 Martijn Dashorst a écrit :

 usually this is from users that copy/paste incomplete url's from other
 users, or people tampering with urls

 Martijn



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Strange stack trace in logs

2008-07-04 Thread Piller Sébastien

Thank you Jan! I'm glad not to be alone with this strange problem

On our side, we're using wicket 1.3.1 with the same behavior.

Jan Stette a écrit :

I've also had reports of a similar problem.  The logs I have show references
to css files, and I'm sure that the user didn't modify any URLs:

ERROR 11:52:37,426 [btpool1-5] wicket.RequestCycle URL fragment has
unmatched key/value pair:
wicket:interface/_0_1214298450782%3A0%3A3%3AINewBrowserWindowListener%3A%3A/wicket:pageMapName/_0_1214298450782/CollectionNodeComponent.css

java.lang.IllegalStateException: URL fragment has unmatched key/value pair:
wicket:interface/_0_1214298450782%3A0%3A3%3AINewBrowserWindowListener%3A%3A/wicket:pageMapName/_0_1214298450782/CollectionNodeComponent.css

at
org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy.decodeParameters(AbstractRequestTargetUrlCodingStrategy.java:174)

at
org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:76)

...

I'm trying to reproduce/debug this at the moment, I'll post more details if
I find anything out.  (We're on Wicket 1.3.3 by the way)

Jan
  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Strange stack trace in logs

2008-07-04 Thread Jan Stette
I can actually reproduce this problem now, with our application.  I don't
know if this is the only way to make it happen, but it occurs when right
clicking a link and selecting open in new tab, but only where the
resulting page contains a specific type of component that includes the css
file mentioned in the log trace.

Looking at it in the debugger, the request looks like:

[method = GET, protocol = HTTP/1.1, requestURL =
http://localhost:8081//home/wicket:interface/%3A2%3A1%3AINewBrowserWindowListener%3A%3A/CollectionNodeComponent.css,
contentType = null, contentLength = -1, contextPath = , pathInfo =
/home/wicket:interface/:2:1:INewBrowserWindowListener::/CollectionNodeComponent.css,
requestURI =
//home/wicket:interface/%3A2%3A1%3AINewBrowserWindowListener%3A%3A/CollectionNodeComponent.css,
servletPath = /, pathTranslated = null]

AbstractRequestTargetUrlCodingStrategy.decodeParameters tries to decode the
parametersFragment:
wicket:interface/%3A2%3A1%3AINewBrowserWindowListener%3A%3A/CollectionNodeComponent.css

which splits into 3 parts:
wicket:interface
%3A2%3A1%3AINewBrowserWindowListener%3A%3A
CollectionNodeComponent.css

Which causes the error as it's an odd number of items.

So I guess the question is why the path for this request looks like it does
- maybe someone who knows the internals of Wicket can shed some light on
this?

Regards,
Jan


2008/7/4 Piller Sébastien [EMAIL PROTECTED]:

 Thank you Jan! I'm glad not to be alone with this strange problem

 On our side, we're using wicket 1.3.1 with the same behavior.

 Jan Stette a écrit :

 I've also had reports of a similar problem.  The logs I have show
 references
 to css files, and I'm sure that the user didn't modify any URLs:

 ERROR 11:52:37,426 [btpool1-5] wicket.RequestCycle URL fragment has
 unmatched key/value pair:

 wicket:interface/_0_1214298450782%3A0%3A3%3AINewBrowserWindowListener%3A%3A/wicket:pageMapName/_0_1214298450782/CollectionNodeComponent.css

 java.lang.IllegalStateException: URL fragment has unmatched key/value
 pair:

 wicket:interface/_0_1214298450782%3A0%3A3%3AINewBrowserWindowListener%3A%3A/wicket:pageMapName/_0_1214298450782/CollectionNodeComponent.css

 at

 org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy.decodeParameters(AbstractRequestTargetUrlCodingStrategy.java:174)

 at

 org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.decode(BookmarkablePageRequestTargetUrlCodingStrategy.java:76)

 ...

 I'm trying to reproduce/debug this at the moment, I'll post more details
 if
 I find anything out.  (We're on Wicket 1.3.3 by the way)

 Jan




 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




strange log entries about wicket-event.js

2008-07-04 Thread steinen

After having migrated from wicket 1.2.7 to 1.3.4, the following error often
appears in our log:

ERROR - RequestCycle - URL fragment has unmatched key/value pair:
resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js

We use mountBookmarkablePages (nice url's) and a servlet-api Filter mapped
on url-pattern /*.
But when requesting the url directly from a browser, like:
www.mywebsite.com/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js
all is fine and the file wicket-event.js is being served properly.

What is going on?
-- 
View this message in context: 
http://www.nabble.com/strange-log-entries-about-wicket-event.js-tp18280959p18280959.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]



Re: OSGi and class loading issues solution proposal

2008-07-04 Thread Jan Stette
Hi, I'm working on a project that uses Wicket and OSGi and have come across
some of the same classloading issues.  We don't use Spring, so I can't
comment on that side of things.  Some brief comments follow below:


2008/7/3 Daniel Stoch [EMAIL PROTECTED]:


 Proposal 1 (change actual method behavior):
 Modify resolveClass() method in DefaultClassResolver as I wrote above


Using the classloader that loaded the DefaultClassLoader class, and enabling
dynamic imports in this bundle doesn't sound ideal to me.  We have created
our own Wicket bundle and we don't use dynamic imports on it.



 Proposal 2 (do not change actual method behavior):
 Make DefaultClassResolver extensible (remove final modifier in class
 declaration) and define a new method (invent a better name for it ;)):


We have implemented our own IClassResolver which delegates to Wicket's
DefaultClassResolver, then performs its own steps where this doesn't succeed
in loading a class.  So we don't actually need the DefaultClassResolver to
be extensible, nor have we needed to copy any code or patch Wicket classes.
I don't mind if DefaultClassResolver is made extensible of course, but I'm
not sure how much value this adds.

Regarding resolution of classes for components provided by other bundles, we
have implemented a simple service-based lookup of classes.  This sounds a
lot like the IClassResolver services in Pax Wicket that Edward describe.
Some common solution for how to best do this sounds potentially very useful
(a WicketOsgi subproject that provides the necessary code maybe?)

And, I'm obviously strongly in favour of fixing any bits of code in Wicket
that uses Class.forName() instead of using the IClassResolver mechanism!

Regards,
Jan


Re: generics

2008-07-04 Thread Matthijs Wensveen

How do you cope with deeply nested model properties? For example:

public class PersonViewer extends ComponentPerson {
..
}

some other component does:
person.getOrders().get(0).setAmount(0); // first order for free (as in beer)

Matthijs

Johan Compagner wrote:

There are many state things in a component. Wicket itself has only a
few like model/visibile/enable. But a developer could add many many
more.

In our project this is easily handled by our components. Every
component knows when it is changed, what ever it is and then a visitor
adds them to ajax. We have a fixed set of components so its not a big
problem.

On 7/4/08, Matthijs Wensveen [EMAIL PROTECTED] wrote:
  

Matej Knopp wrote:


On Thu, Jul 3, 2008 at 9:51 AM, Matej Knopp [EMAIL PROTECTED] wrote:

  

And there is some functionality in there that Wicket might
be better without. For example, onModelChanged / Changing
things become tricky when you share the same model between
different instances. And when using setModelObject() with an
object that is equal to the current model object, but a
different instance (such as a Hibernate-persisted object
bound to the correct session), you have to either do
getModel().setObject() or change the model comparator.


  

setModelObject isn't the best idea IMHO. Models should support some
kind of state change notifications, we might want to improve that for
1.5, though it probably wouldn't be very easy to do.



Well, we can hardly detect change of propertypromodels unless we pull
and compare the value every time...

  

Better state change notifications would be a huge improvement IMO
because that way components could add themselves to AjaxRequestTarget
when needed. Currently all Ajax functionality requires Ajaxified
components to know about each other and when they should be displayed.
Some kind of even mechanism as described in
https://issues.apache.org/jira/browse/WICKET-1312 would definitely help,
but a model-driven approach would be even better.

I was thinking to support this using annotations and aspects and the
likes, but I haven't had the time to create a proof of concept.

Matthijs

PS. Thread subject has become little different than thread content :)

--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 423
F +31 20 4223500


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  



--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 423
F +31 20 4223500 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with Pagination in Wicket 1.3.4

2008-07-04 Thread Eric Velazquez

Until 1.3.3 the PagingNavigator class added the navigation links on the
constructor, but on 1.3.4 those links are added on the onBeforeRender
method. Are you overriding the method? would be useful if you provide us
with some related piece of code.




Umesh Paliwal wrote:
 
 Hi ,
 
  
 
 I had downloaded Wicket 1.3.4 for the Autocomplete issue with IE.
 
  
 
 Now the AutoComplete works fine. But when I click on the table with
 Pagination, I get the following error.
 
  
 
 
 Unexpected RuntimeException
 
 WicketMessage: Unable to find component with id 'first' in
 [MarkupContainer [Component id = navigator, page =
 com.osi.nx.objeditor.ClassBuilder, path =
 0:classattrpanel:panel:navigator.DataViewClassTable$3, isVisible = true,
 isVersioned = false]]. This means that you declared wicket:id=first in
 your markup, but that you either did not add the component to your page
 at all, or that the hierarchy does not match.
 [markup =
 jar:file:/C:/Documents%20and%20Settings/uxp1/.m2/repository/org/apache/w
 icket/wicket/1.3.4/wicket-1.3.4.jar!/org/apache/wicket/markup/html/navig
 ation/paging/PagingNavigator.html
 
 !--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version
 2.0
(the License); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 implied.
See the License for the specific language governing permissions and
limitations under the License.
 --
 html xmlns:wicket
 body
   wicket:panel
  lt;lt; nbsp; lt; 
 
   # 5 
 
  gt; nbsp; gt;gt; 
   /wicket:panel
 /body
 /html
 , index = 3, current = ' ' (line 21, column 2)]
 
 Root cause:
 
 org.apache.wicket.markup.MarkupException: Unable to find component with
 id 'first' in [MarkupContainer [Component id = navigator, page =
 com.osi.nx.objeditor.ClassBuilder, path =
 0:classattrpanel:panel:navigator.DataViewClassTable$3, isVisible = true,
 isVersioned = false]]. This means that you declared wicket:id=first in
 your markup, but that you either did not add the component to your page
 at all, or that the hierarchy does not match.
 [markup =
 jar:file:/C:/Documents%20and%20Settings/uxp1/.m2/repository/org/apache/w
 icket/wicket/1.3.4/wicket-1.3.4.jar!/org/apache/wicket/markup/html/navig
 ation/paging/PagingNavigator.html
 
 !--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version
 2.0
(the License); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an AS IS BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 implied.
See the License for the specific language governing permissions and
limitations under the License.
 --
 html xmlns:wicket
 body
   wicket:panel
  lt;lt; nbsp; lt; 
 
   # 5 
 
  gt; nbsp; gt;gt; 
   /wicket:panel
 /body
 /html
 , index = 3, current = ' ' (line 21, column 2)]
  at
 org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.
 java:464)
  at
 org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1344)
  at
 org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer
 .java:1476)
  at
 org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer
 .java:639)
  at
 org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:
 112)
  at org.apache.wicket.Component.renderComponent(Component.java:2481)
  at
 org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1411)
  at org.apache.wicket.Component.render(Component.java:2318)
  at
 org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1297)
  at
 org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer
 .java:1476)
  at
 org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer
 .java:639)
  at
 org.apache.wicket.markup.html.panel.Panel.onComponentTagBody(Panel.java:
 112)
  at org.apache.wicket.Component.renderComponent(Component.java:2481)
  at
 

Wicket IOC / Java EE Problem?

2008-07-04 Thread David Arnold
Upon reviewing wicket-contrib-javaee, I suspect that its behavior wrt
stateful session beans is broken.

afaict, it caches a single lazy init proxy per EJB type
(JavaEEProxyFieldValueFactory#getCachedProxy).  It then injects it
into every component that needs an instance of that EJB type.

The first component to access the lazy proxy triggers the target
lookup, so all the components will have a proxy to the *same* EJB
which is the wrong behavior.  At least for stateful session beans
like, say, a shopping cart, this would be bad because every user would
share the same cart.

Furthermore, if the component is serialized and brought back, the
deserialized lazy proxy will do a new target lookup and get a new EJB.
So again in the shopping cart case, this is bad because the web
application will forget your cart.

I'm wondering if my understanding of contrib-javaee, lazy proxies, and
component serialization is correct.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Page Expired to home or login instead of default?

2008-07-04 Thread Brill Pappin
I can't seem to find anywhere, how I get wicket to automatically go to  
the home page instead of the Page Expired page when the session is  
invalidated (expires, or the user logs out).


Can anyone give me a hint as to were to look (i've likely just missed  
it in some documentation)?


- Brill

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Page Expired to home or login instead of default?

2008-07-04 Thread David Leangen

 I can't seem to find anywhere, how I get wicket to automatically go to
 the home page instead of the Page Expired page when the session is
 invalidated (expires, or the user logs out).

Never actually tried this, but I don't see why it wouldn't work...

Application.get().getApplicationSettings().setPageExpiredErrorPage(
HomePage.class );


Let me know if this works for you.


-dml-


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]