Re: Caching components

2010-03-24 Thread zkn
Thanks Martin!

If possible can you please give a hint how to use behavior to cache the 
rendered HTML for a component?

On 24.03.2010, at 10:26, Martin Sachs wrote:

> hi,
> 
> we need caching of components, since the construction of huge
> hierarchies is not cheap. The rendering ist fast. We cache the rendered
> HTML of a hole component via a beheaviour and write them on the next
> requests into a Label (unescaped). So instead of creating the complete
> hierarchie on every request, we create a much smaller one. But you must
> check, that the cachable components are stateless. Also we have JQuery
> for client-effects in this components, this would also be cached.
> 
> The performance is much better with that: approx. 10-50 times better:
>100ms with cache (the response time is not much depending on count
> of users)
>vs
>1500 ms without cache depending how many parallel users.
> 
> 
> in near feature i will announce the site officially here.
> 
> Martin


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



Re: Caching components

2010-03-24 Thread zkn

On 24.03.2010, at 09:23, Jeremy Thomerson wrote:

> Components are not thread safe, and not intended to be used in this way -
> there would be a significant undertaking to make them cacheable, and the
> cost of the synchronization would likely far outweigh the current costs of
> component instantiation, etc...

I see this could be a problem especially for with Java 1.4. With concurrency 
packages in Java 1.5  I believe this could easily be made thread safe with 
almost no cost for synchronization.

> 
> Where you can make the biggest difference is caching your models.  If you
> don't have to re-retrieve your model data, then you can get huge gains.

Yes, but still keeping the rendered html for complex read-only components would 
be the fastest possible way.

> 
> Of course, if you thoroughly do your performance testing and find that your
> site really is so huge and has so much traffic that the extra instantiation
> is hurting you, the way to go is caching the generated markup with a
> frontend cache.

I was first considering this approach especially with bookmarkable urls this 
could become beautiful. But would Wicket really allow using frontend cache 
cause it relies on user's session to handle form submits, ajax actions etc...?


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



Caching components

2010-03-24 Thread zkn
Hi,

since Wicket uses session to store the components hierarchy for a page is it 
possible to store parts of the hierarchy in the application context instead of 
the user session? If it's not possible do you consider it worth to add as 
feature request?

What's the idea: imagine a home page of a website where eventually for a short 
time of period( say 1 minute) the only dynamic component is a search form( and 
that's only in case the user hits search). The rest of the page consist of 
components that do not change for each user request - for example a block of 
news. If 100 users hit the page simultaneously they will actually see the same 
content in that block and there is nothing in that block that depends on the 
user session. The content may change in few minutes when a new article has been 
added. 

What if for example the developer has the option to make a component cacheable 
by implementing specific interface which will give the developer the option to 
use the cached version or render and possible store the new rendered component 
in cache? 

Seems like this can significantly improve performance in certain situations.

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



How to disable AJAX call on ModalWindow close

2010-02-12 Thread zkn
Hi,

I'm using 

Wicket.Ajax.registerPreCallHandler(showBusyScreen);
Wicket.Ajax.registerPostCallHandler(hideBusyScreen);
Wicket.Ajax.registerFailureHandler(hideBusyScreen);

to show and hide a busy screen on the page while executing AJAX calls. But it 
also shows up when I click the close button of a modal window even though I 
don't need to do anything on the server side.
Is there are way to disable this AJAX call on modal window close?



Re: Adding AjaxLink to a DataTable cell

2010-02-03 Thread zkn
Thanks.

It worked with 

@Override
protected void onComponentTagBody(
MarkupStream markupStream, ComponentTag 
openTag) {
// TODO Auto-generated method stub
replaceComponentTagBody(markupStream, openTag,
getModelObject());
}

@Override
protected void onComponentTag(ComponentTag tag) {
// TODO Auto-generated method stub
tag.setName("a");
super.onComponentTag(tag);
}

On 03.02.2010, at 01:06, Igor Vaynberg wrote:

> search this link for TextLink, or create a panel/fragment that contain
> a link and a label
> 
> -igor
> 
> On Tue, Feb 2, 2010 at 3:04 PM, zkn  wrote:
>> Hi,
>> 
>> I'm have a problem adding an AjaxLink to a DataTable cell. Everything works 
>> fine except that I don't know how to set the text for the link.
>> The result is that I see only  "[cell]" as a text in the cell but onClick() 
>> works fine.
>> 
>> Here is my code:
>> 
>> columns.add(new AbstractColumn(new Model("Title")) {
>> 
>>public void populateItem(Item> 
>> cellItem,   String componentId, IModel model) {
>> 
>>final Book book = model.getObject();
>> 
>>if (book.getAuthor() == null) {
>> 
>>book.setAuthor( new Author());
>> 
>>AjaxLink link = new 
>> AjaxLink(componentId, new Model("change author")) {
>>@Override
>>public void onClick(AjaxRequestTarget 
>> target) {
>> 
>>modalWindow.setContent(new 
>> AuthorSwitchPanel(modalWindow
>>.getContentId(), new 
>> Model(book.getAuthor(;
>>modalWindow.show(target);
>>}
>>};
>> 
>>cellItem.add(link);
>>}
>>else
>>cellItem.add(new Label(componentId,
>>new 
>> PropertyModel(book.getAuthor(), "name")));
>>}
>> });
>> 
>> 
>> 



Adding AjaxLink to a DataTable cell

2010-02-02 Thread zkn
Hi,

I'm have a problem adding an AjaxLink to a DataTable cell. Everything works 
fine except that I don't know how to set the text for the link.
The result is that I see only  "[cell]" as a text in the cell but onClick() 
works fine.

Here is my code:

columns.add(new AbstractColumn(new Model("Title")) {

public void populateItem(Item> 
cellItem,   String componentId, IModel model) {

final Book book = model.getObject();

if (book.getAuthor() == null) {

book.setAuthor( new Author());

AjaxLink link = new 
AjaxLink(componentId, new Model("change author")) {
@Override
public void onClick(AjaxRequestTarget 
target) {


modalWindow.setContent(new 
AuthorSwitchPanel(modalWindow
.getContentId(), new 
Model(book.getAuthor(;
modalWindow.show(target);
}
};

cellItem.add(link);
}
else
cellItem.add(new Label(componentId,
new 
PropertyModel(book.getAuthor(), "name")));
}
});




Re: dynamically adding components to a ListView

2010-01-22 Thread zkn

On 22.01.2010, at 03:18, vasil.pup...@gmail.com wrote:

> http://old.nabble.com/dynamically-adding-components-to-a-ListView-td26626657.html
> 
> In this post you said "You found it". Could you please post how did you do it?
> 
> Zinovii

in addPanel()

replaced 

panels.add(panel);

with

panels.getModelObject().add(panel);





On 04.12.2009, at 00:17, zkn wrote:

> found it.
> 
> On 03.12.2009, at 16:19, zkn wrote:
> 
>> Hi,
>> 
>> I'm trying to dynamically add components to an existing ListView but I can't 
>> figure out how to do that. Here is my case:
>> 
>> MyPanelContainer  class with markup
>> 
>> 
>>  
>>  
>>  
>>  add panel
>> 
>> 
>> and here is how I create the container in the constructor of my page
>> 
>> ..
>> MyPanelContainer container = new MyPanelContainer("panels_list_1");
>> List panels = new ArrayList();
>> 
>> for (int j = 0; j < 5; j++) {
>>  MyPanel panel = new MyPanel("panel");
>>  
>>  .
>>  
>>  panels.add(panel);
>> .
>> 
>> 
>> container.add(new ListView("panels", panels) {
>>  protected void populateItem(ListItem item) {
>>  item.add( item.getModelObject());
>>  }
>> });
>> add(Container);
>> ..
>> 
>> This works fine and I can see all  MyPanel inside the container.
>> 
>> Now I'm trying to add another MyPanel inside the container on user click. 
>> Here is the constructor of MyPanelContainer
>> 
>> public MyPanelContainer(String id) {
>>  super(id);
>>  
>>  add(new Link("addPanel") {
>>  @Override
>>  public void onClick() {
>>  addPanel();
>>  }
>>  
>>  });
>> .
>> 
>> ..
>> public void addPanel() {
>>  
>>  ListView< MyPanel > panels = (ListView< MyPanel >) 
>> get("panels");
>>  
>>  MyPanel panel = new MyPanel("panel");
>>  ...
>>  panels.add(panel);
>>  }
>> 
>> Basically addPanel() does the same thing as in page constructor to add 
>> panels to the list but nothing shows up.
>> 
>> Thanks in advance for your help
>> 
>> Ozkan
>> 
> 



Fwd: DELIVERY FAILURE: Invalid/unknown recipient [MAPI Reason Code: 1, MAPI Diagnostic Code 1]

2009-12-03 Thread zkn
I believe I should not receive emails like this, should I?

Begin forwarded message:

> From: postmas...@td.com
> Date: 04 декември 2009 00:17:36 Гриинуич+0200
> To: z...@abv.bg
> Subject: DELIVERY FAILURE: Invalid/unknown recipient [MAPI Reason Code: 1, 
> MAPI Diagnostic Code 1]
> 
> Your message
> 
>  Subject: Re: dynamically adding components to a ListView
> 
> was not delivered to:
> 
>  john.mattu...@td.com
> 
> because:
> 
>  Invalid/unknown recipient [MAPI Reason Code: 1, MAPI Diagnostic Code 1]
> 
> 
> 
> NOTICE OF CONFIDENTIALITY
> This communication including any information transmitted with it is 
> intended only for the use of the addressees and is confidential. 
> If you are not an intended recipient or responsible for delivering 
> the message to an intended recipient, any review, disclosure, 
> conversion to hard copy, dissemination, reproduction or other use 
> of any part of this communication is strictly prohibited, as is the 
> taking or omitting of any action in reliance upon this communication. 
> If you receive this communication in error or without authorization 
> please notify us immediately by return e-mail or otherwise and 
> permanently delete the entire communication from any computer, 
> disk drive, or other storage medium.
> 
> If the above disclaimer is not properly readable, it can be found at 
> www.td.com/legal
> 
> AVERTISSEMENT DE CONFIDENTIALITE   
> Ce courriel, ainsi que tout renseignement ci-inclus, destiné uniquement 
> aux destinataires susmentionnés,  est confidentiel.  Si vous 
> n'êtes pas le destinataire prévu ou un agent responsable de la 
> livraison de ce courriel, tout examen, divulgation, copie, impression, 
> reproduction, distribution, ou autre utilisation d'une partie de ce 
> courriel est strictement interdit de même que toute intervention ou 
> abstraction à cet égard.  Si vous avez reçu ce message par erreur ou 
> sans autorisation, veuillez en aviser immédiatement l'expéditeur par 
> retour de courriel ou par un autre moyen et supprimer immédiatement 
> cette communication entière de tout système électronique.
> 
> Si l'avis de non-responsabilité ci-dessus n'est pas lisible, vous 
> pouvez le consulter à www.td.com/francais/legale
> Reporting-MTA: x-local-hostname; TDGROUP
> 
> Final-Recipient: rfc822;john.mattu...@td.com
> Action: failed
> Status: 5.0.0
> Diagnostic-Code: X-Notes;Invalid/unknown recipient [MAPI Reason Code: 1, MAPI 
> Diagnostic Code 1]
> 
> From: z...@abv.bg
> Date: 04 декември 2009 00:17:36 Гриинуич+0200
> To: 
> Subject: Re: dynamically adding components to a ListView
> Reply-To: users@wicket.apache.org
> 
> 
> found it.
> 
> On 03.12.2009, at 16:19, zkn wrote:
> 
> > Hi,
> >
> > I'm trying to dynamically add components to an existing ListView but I 
> > can't figure out how to do that. Here is my case:
> >
> > MyPanelContainer  class with markup
> >
> > 
> >   
> >   
> >   
> >   add panel
> > 
> >
> > and here is how I create the container in the constructor of my page
> >
> > ..
> > MyPanelContainer container = new MyPanelContainer("panels_list_1");
> > List panels = new ArrayList();
> >
> > for (int j = 0; j < 5; j++) {
> >   MyPanel panel = new MyPanel("panel");
> >  
> >   .
> >  
> >   panels.add(panel);
> > .
> >
> >
> > container.add(new ListView("panels", panels) {
> >   protected void populateItem(ListItem item) {
> >   item.add( item.getModelObject());
> >   }
> > });
> > add(Container);
> > ..
> >
> > This works fine and I can see all  MyPanel inside the container.
> >
> > Now I'm trying to add another MyPanel inside the container on user click. 
> > Here is the constructor of MyPanelContainer
> >
> > public MyPanelContainer(String id) {
> >   super(id);
> >   
> >   add(new Link("addPanel") {
> >   @Override
> >   public void onClick() {
> >   addPanel();
> >   }
> >  
> >   });
> > .
> >
> > ..
> > public void addPanel() {
> >  
> >   ListView< MyPanel > panels = (ListView< MyPanel >) 
> > get("panels");
> >  
> >   MyPanel panel = new MyPanel("panel");
> >   ...
> >   panels.add(panel);
> >   }
> >
> > Basically addPanel() does the same thing as in page constructor to add 
> > panels to the list but nothing shows up.
> >
> > Thanks in advance for your help
> >
> > Ozkan
> >
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> 
> 
> 
> 



Re: dynamically adding components to a ListView

2009-12-03 Thread zkn
found it.

On 03.12.2009, at 16:19, zkn wrote:

> Hi,
> 
> I'm trying to dynamically add components to an existing ListView but I can't 
> figure out how to do that. Here is my case:
> 
> MyPanelContainer  class with markup
> 
> 
>   
>   
>   
>   add panel
> 
> 
> and here is how I create the container in the constructor of my page
> 
> ..
> MyPanelContainer container = new MyPanelContainer("panels_list_1");
> List panels = new ArrayList();
> 
> for (int j = 0; j < 5; j++) {
>   MyPanel panel = new MyPanel("panel");
>   
>   .
>   
>   panels.add(panel);
> .
> 
> 
> container.add(new ListView("panels", panels) {
>   protected void populateItem(ListItem item) {
>   item.add( item.getModelObject());
>   }
> });
> add(Container);
> ..
> 
> This works fine and I can see all  MyPanel inside the container.
> 
> Now I'm trying to add another MyPanel inside the container on user click. 
> Here is the constructor of MyPanelContainer
> 
> public MyPanelContainer(String id) {
>   super(id);
>   
>   add(new Link("addPanel") {
>   @Override
>   public void onClick() {
>   addPanel();
>   }
>   
>   });
> .
> 
> ..
> public void addPanel() {
>   
>   ListView< MyPanel > panels = (ListView< MyPanel >) 
> get("panels");
>   
>   MyPanel panel = new MyPanel("panel");
>   ...
>   panels.add(panel);
>   }
> 
> Basically addPanel() does the same thing as in page constructor to add panels 
> to the list but nothing shows up.
> 
> Thanks in advance for your help
> 
> Ozkan
> 


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



dynamically adding components to a ListView

2009-12-03 Thread zkn
Hi,

I'm trying to dynamically add components to an existing ListView but I can't 
figure out how to do that. Here is my case:

MyPanelContainer  class with markup





add panel


and here is how I create the container in the constructor of my page

...
MyPanelContainer container = new MyPanelContainer("panels_list_1");
List panels = new ArrayList();

for (int j = 0; j < 5; j++) {
MyPanel panel = new MyPanel("panel");

.

panels.add(panel);
}

container.add(new ListView("panels", panels) {
protected void populateItem(ListItem item) {
item.add( item.getModelObject());
}
});
add(Container);
...

This works fine and I can see all  MyPanel inside the container.

Now I'm trying to add another MyPanel inside the container on user click. Here 
is the constructor of MyPanelContainer

public MyPanelContainer(String id) {
super(id);

add(new Link("addPanel") {
@Override
public void onClick() {
addPanel();
}

});
}
...
public void addPanel() {

ListView< MyPanel > panels = (ListView< MyPanel >) 
get("panels");

MyPanel panel = new MyPanel("panel");
...
panels.add(panel);
}

Basically addPanel() does the same thing as in page constructor to add panels 
to the list but nothing shows up.

Thanks in advance for your help

Ozkan