Re: Possible bug in ListView [Cannot change attributes in ListView div]

2013-02-24 Thread Sven Meier

Short answer is in ListView's javadoc:

 * p
 * strongNOTE:/strong
 *
 * When you want to change the default generated markup it is important 
to realize that the ListView
 * instance itself does not correspond to any markup, however, the 
generated ListItems do.br/

 *
 * This means that methods like {@link #setRenderBodyOnly(boolean)} and
 * {@link #add(org.apache.wicket.behavior.Behavior...)} should be 
invoked on the {@link ListItem}

 * that is given in {@link #populateItem(ListItem)} method.
 * /p

Sven

On 02/24/2013 02:40 AM, Gonzalo Aguilar Delgado wrote:

Hello,

I think I found something that may not be working right.

I have an html that looks like:

div wicket:id=regionOne
div wicket:id=regionWidget/div
/div


regionOne will be a listview and regionWidget will be one panel
populated on populateItem.


This is how it looks the class that will go to regionOne (listview)

public class RegionWidgetContainer extends ListViewRegionWidget {
/**
 *
 */
private static final long serialVersionUID = 1L;
final static Logger logger =
LoggerFactory.getLogger(RegionWidgetContainer.class);
private static int regionCounter = 1;

private int regionIdx=0;

public RegionWidgetContainer(String id, final Region region, PageUser
pageUser) {
super(id, new IModelListRegionWidget(){

/**
 *
 */
private static final long serialVersionUID = 1L;

@Override
public void detach() {
// TODO Auto-generated method stub
}

@Override
public ListRegionWidget getObject() {
return region.getRegionWidgets();
}

@Override
public void setObject(ListRegionWidget object) {
}

});
regionIdx = RegionWidgetContainer.nextCounter();
buildCssClassAttributes(region,pageUser);
this.setMarkupId(region- + region.getId() + -id);   
this.setOutputMarkupId(true);
}

protected void buildCssClassAttributes(Region region, PageUser
pageUser)
{
String cssClass = region;
if(region.isLocked() || !pageUser.isEditor())
{
cssClass +=  region-locked;
}

cssClass +=   + region.getPage().getPageLayout().getCode() + 
_ +
String.valueOf(regionIdx);
cssClass +=  regionNonDragging;


this.add(new AttributeAppender(class, cssClass));
}
...
}



As you can see it will add the class via AttributeAppender and will set
the markup id.


But it does not work. Any of two. The div is rendered like this...

div
...
/div


So, is this a bug or a feature?





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



Re: Loadable non-detachable list model for listView

2013-02-24 Thread Sven Meier

Hi,

when working with Wicket models, you should always call #getObject() or 
#getModelObject() as late as possible:


ListViewImagesGroup imagesGroupsListView = new 
ListViewImagesGroup(imagesGroupsListView, imagesGroupsModel) {

 @Override
 @Transactional
 protected void populateItem(final ListItemImagesGroup listItem) {

   AjaxLinkString deleteImagesGroup = new 
AjaxLinkString(deleteImagesGroup) {

 @Override
 public void onClick(AjaxRequestTarget target) {
   // access model object as late as possible
imagesGroupService.deleteImagesGroup(listItem.getModelObject());

   // force reload
   imagesGroupsModel.detach();

   target.add(imagesGroupsForm);
 }
   };

   listItem.add(deleteImagesGroup);
 }
};

Can you spot the difference?

Sven


On 02/24/2013 08:12 AM, meduolis wrote:

This does not solves the issue.

Heres my code:





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656727.html
Sent from the Users forum mailing list archive at Nabble.com.

-
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



Re: Possible bug in ListView [Cannot change attributes in ListView div]

2013-02-24 Thread Gonzalo Aguilar Delgado
Hello Sven, 

I'm stupid. Sorry for the question. I read a lot of times it in the
forums, saw examples, but really 
never realized that the main div was the item that get passed to the
populateItem.

It made me uncofortable someway. I don't know why. :D

Thank you a lot. 


El dom, 24-02-2013 a las 09:01 +0100, Sven Meier escribió:

 Short answer is in ListView's javadoc:
 
   * p
   * strongNOTE:/strong
   *
   * When you want to change the default generated markup it is important 
 to realize that the ListView
   * instance itself does not correspond to any markup, however, the 
 generated ListItems do.br/
   *
   * This means that methods like {@link #setRenderBodyOnly(boolean)} and
   * {@link #add(org.apache.wicket.behavior.Behavior...)} should be 
 invoked on the {@link ListItem}
   * that is given in {@link #populateItem(ListItem)} method.
   * /p
 
 Sven
 
 On 02/24/2013 02:40 AM, Gonzalo Aguilar Delgado wrote:
  Hello,
 
  I think I found something that may not be working right.
 
  I have an html that looks like:
 
  div wicket:id=regionOne
  div wicket:id=regionWidget/div
  /div
 
 
  regionOne will be a listview and regionWidget will be one panel
  populated on populateItem.
 
 
  This is how it looks the class that will go to regionOne (listview)
 
  public class RegionWidgetContainer extends ListViewRegionWidget {
  /**
   *
   */
  private static final long serialVersionUID = 1L;
  final static Logger logger =
  LoggerFactory.getLogger(RegionWidgetContainer.class);
  private static int regionCounter = 1;
 
  private int regionIdx=0;
 
  public RegionWidgetContainer(String id, final Region region, PageUser
  pageUser) {
  super(id, new IModelListRegionWidget(){
 
  /**
   *
   */
  private static final long serialVersionUID = 1L;
 
  @Override
  public void detach() {
  // TODO Auto-generated method stub
  }
 
  @Override
  public ListRegionWidget getObject() {
  return region.getRegionWidgets();
  }
 
  @Override
  public void setObject(ListRegionWidget object) {
  }
  
  });
  regionIdx = RegionWidgetContainer.nextCounter();
  buildCssClassAttributes(region,pageUser);
  this.setMarkupId(region- + region.getId() + -id);   
  this.setOutputMarkupId(true);
  }
  
  protected void buildCssClassAttributes(Region region, PageUser
  pageUser)
  {
  String cssClass = region;
  if(region.isLocked() || !pageUser.isEditor())
  {
  cssClass +=  region-locked;
  }
  
  cssClass +=   + region.getPage().getPageLayout().getCode() + 
  _ +
  String.valueOf(regionIdx);
  cssClass +=  regionNonDragging;
  
  
  this.add(new AttributeAppender(class, cssClass));
  }
  ...
  }
 
 
 
  As you can see it will add the class via AttributeAppender and will set
  the markup id.
 
 
  But it does not work. Any of two. The div is rendered like this...
 
  div
  ...
  /div
 
 
  So, is this a bug or a feature?
 
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


Re: Loadable non-detachable list model for listView

2013-02-24 Thread meduolis
I get same exception with your updates. Looks like I have to reload object
from database before it's deletion or delete it by id. Anyway, thanks for
help.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656733.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Loadable non-detachable list model for listView

2013-02-24 Thread Sven Meier
You'll need to apply the OSIV pattern for that.

Sven



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656734.html
Sent from the Users forum mailing list archive at Nabble.com.

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



org.apache.wicket.markup.html.link.PopupSettings.java problem (version 6.5.0)

2013-02-24 Thread chrome1235
Hi,

I think the line (row number=158)
 StringBuilder script = new StringBuilder(var w = window.open*( + 
target
+ , ')*.append(
windowTitle).append(', ');

must be like this. (adding ' single quotation marks  to target)
 StringBuilder script = new StringBuilder(var w = window.open*(' + 
target
+ ', ')*.append(
windowTitle).append(', ');

Because,
when I use like this, it does not work. 
popupSettings.setTarget(myULR);
target.appendJavaScript(popupSettings.getPopupJavaScript());

But this worked.
popupSettings.setTarget(' + myULR + ');
target.appendJavaScript(popupSettings.getPopupJavaScript());


kemal




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-markup-html-link-PopupSettings-java-problem-version-6-5-0-tp4656735.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: get rid of LazyLoadException

2013-02-24 Thread heapifyman

I found this blog post (and the rest of the series) very helpful:
https://www.42lines.net/2011/11/21/adding-jpahibernate-into-the-cdi-and-wicket-mix/

Or maybe try to use an EXTENDED EntityManager in your project to keep entities 
managed and get rid of LazyLoadException.


Am 23.02.2013 um 19:22 schrieb Cedric Gatay gata...@gmail.com:

 I think you need to carefully understand how the Hibernate Session works.
 This exception usually occurs when you try to access an object that has not
 been loaded from your database in your components but the session is
 already closed.
 
 Regards,
 
 __
 Cedric Gatay
 http://www.bloggure.info | http://cedric.gatay.fr |
 @Cedric_Gatayhttp://twitter.com/Cedric_Gatay
 
 
 On Sat, Feb 23, 2013 at 5:48 PM, Evgheni Emelianov e.emelia...@gmx.netwrote:
 
 Hi there, i am looking for a got way to get rid of my LazyLoadException in
 my Project, I'm using javaee 6 with hibernate 4.1.1 and
 wicketstuff-javaee-inject and don't know which is the best way to solve it?
 some good links or examples would help.
 
 
 Evgheni
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 



What is the best strategy for non versioned pages?

2013-02-24 Thread Bernard
Hi,

We don't want back button support. setVersioned(false) with the
default RenderStrategy looks like a good match for this.

But sometimes pages become stateless which results in multiple URLs
for the same page, e.g.

/mypage
and
/mypage?-1.IFormSubmitListener-panel-form

I know that Wicket pages are stateless if they don't contain state,
and that Wicket makes a page stateful as soon as it needs to e.g. when
state is added.

Does Wicket provide a strategy for a page to always have a unique
non-versioned URL - stateless or not?

Regards,

Bernard

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



Re: Loadable non-detachable list model for listView

2013-02-24 Thread meduolis
Yes, this is what I wanted. But after I made some investigation how to apply
this OSIV filter I found that it could bring more mess then happiness :D;

Source:
http://stackoverflow.com/questions/1103363/why-is-hibernate-open-session-in-view-considered-a-bad-practice

Source how to apply:
http://www.jroller.com/cardsharp/entry/open_session_in_view_pattern;

Thanks Sven, for help.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656738.html
Sent from the Users forum mailing list archive at Nabble.com.

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



inmethod grid cachedPageCount

2013-02-24 Thread Ciocoiu Elvis
Hi,

I'm trying to select a item of inmethod grid after adding it in an ajax
call. Based on the current sort properties and filters, after I effectively
add the element in the database but in the same ajax call I'm determining
the element's page number and try to set it as current page in the grid. My
code works except in the case when the created element is in the last page
(the current grid page page count is cached internally in
AbstractPageableView.cachedPageCount). In this case the cachedPageCount is
equal to the create element page and when calling
grid.setCurrentPage(newPage) { ... if (page  0 || page = pageCount 
pageCount  0) ... } throws IndexOutOfBounds exception. I want to clear the
cachedPageCount somehow ... or maybe there is another solution? I want to
select the new page in the same ajax call. For the moment if I encounter
this situation I select the previous page ... but the my newly created
element is on the next one :(

Can somebody help me with some hints?

Thank you

-- 
_
Elvis Ciocoiu
Senior Consultant

Synthesys Consulting ROMANIA

address: http://www.synthesys.ro
e-mail: elvis.cioc...@synthesys.ro
mobile : (40) 0745 13 75 85

This message and any attachments contain information, which may be
confidential or privileged.
If you are not the intended recipient, please refrain from any
disclosure, copying, distribution or use of this information.
Please be aware that such actions are prohibited. If you have received
this transmission in error, kindly notify us by email to
off...@synthesys.ro. We appreciate your cooperation.


multipart ajax upload

2013-02-24 Thread Ciocoiu Elvis
Hi,

I'm fighting with a strange problem when using a form (multipart) with a
required TextField and a FileUploadField. Sometimes works as expected (the
required error message is displayed in FeedbackPanel) but most of the times
the feedback message is not displayed. Also, after submiting for a while
with empty text field I've got a message in Wicket Ajax Debug:

   1. Wicket.Ajax: Wicket.Ajax.Call.failure: Error while parsing response:
   Could not find root ajax-response element
   
wicket-ajax-debug-ver-1359989915360.js:91http://localhost:8080/corprint-web/ui/wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-ver-1359989915360.js
  1. 
WicketAjaxDebug.logErrorwicket-ajax-debug-ver-1359989915360.js:91http://localhost:8080/corprint-web/ui/wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-ver-1359989915360.js
  2. 
Wicket.Log.errorwicket-ajax-ver-1359989915360.js:116http://localhost:8080/corprint-web/ui/wicket/resource/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax-ver-1359989915360.js
  3. 
Wicket.Ajax.Call.failurewicket-ajax-ver-1359989915360.js:1108http://localhost:8080/corprint-web/ui/wicket/resource/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax-ver-1359989915360.js
  4. Wicket.Ajax.Call.loadedCallback
  
wicket-ajax-ver-1359989915360.js:1307http://localhost:8080/corprint-web/ui/wicket/resource/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax-ver-1359989915360.js
  5. Wicket.Ajax.Call.handleMultipartComplete


The main problem is when clicking multiple times the form onSubmit is
called (even if the text field has no value). It seems that
FeedbackMessages.hasError(...) returns false ...

Can somebody help me with this? I'm using wicket 1.5.9. The problem appear
without selecting a file in the FileUploadField. I just submit an empty
form multiple times.

Thank you.
-- 
_
Elvis Ciocoiu
Senior Consultant

Synthesys Consulting ROMANIA

address: http://www.synthesys.ro
e-mail: elvis.cioc...@synthesys.ro
mobile : (40) 0745 13 75 85

This message and any attachments contain information, which may be
confidential or privileged.
If you are not the intended recipient, please refrain from any
disclosure, copying, distribution or use of this information.
Please be aware that such actions are prohibited. If you have received
this transmission in error, kindly notify us by email to
off...@synthesys.ro. We appreciate your cooperation.


Re: TinyMCE.

2013-02-24 Thread Andrea Del Bene

The code should be

contentTextArea.add(new TinyMceBehavior(new
TinyMCESettings(TinyMCESettings.Theme.advanced)));

If you still get an error can you show your pom.xml file?

Yes, fails to execute.

code:

TextArea contentTextArea = new TextArea(content);
contentTextArea.add(new TinyMceBehavior(new
TinyMCESettings(Theme.advanced)));
form.add(contentTextArea);




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/TinyMCE-tp4656649p4656722.html
Sent from the Users forum mailing list archive at Nabble.com.

-
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



Re: JavsScriptUtils.writeJavaScript() in onRender() after Ajax updates

2013-02-24 Thread Martin Dietze
On Fri, February 22, 2013, Sven Meier wrote:

 Which Wicket version? Is this rendered on an Ajax request?

It's Wicket 6.6.0, and, yes, it's rendered on an Ajax request.

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
Steht ein Bratscher vor 'ner Kneipe.

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



Re: Regarding Facebook login API in wicket 1.5

2013-02-24 Thread Martin Grigorov
Hi,

On Sun, Feb 24, 2013 at 5:26 AM, kshitiz k.agarw...@gmail.com wrote:

 No..actually that was causing some issues. So I followed your suggestions
 like I posted. One thing I would like to ask is in Scribe, how to get
 specific Facebook information like name or first name. getBody gives entire
 information. Do I need to parse that or there is any shortcut?


You need to configure your Facebook application what kind of user
information to return and then in your Wicket application to read the JSON
body and extract the info.





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Regarding-Facebook-login-API-in-wicket-1-5-tp4656656p4656726.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: load resource from other project

2013-02-24 Thread Martin Grigorov
Hi,

We will need more information to be able to help you.
Doesn't work is not enough.

Put a breakpoint in ClassPathResourceFinder#find() and see why it is not
able to find it.


On Sun, Feb 24, 2013 at 10:50 AM, oliver.stef ova...@gmail.com wrote:

 Hi,

 Thanks for the replay!

 Did it - added in Init():
 resourceSettings.setResourceFinder(myClassPathResourceFinder);

 But still didn't work...

 Any other ideas??

 Thanks!



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/load-resource-from-other-project-tp4656648p4656731.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/