entity manager in webapp

2011-03-10 Thread Duro
Hi guys, is this an option to store the JPA entity manager for a wicket 
webapp:

public class DBUtil {
private static EntityManagerFactory entityManagerFactory = Persistence
.createEntityManagerFactory(db);
private static ThreadLocalEntityManager emHolder = new 
ThreadLocalEntityManager() {

protected EntityManager initialValue() {
return entityManagerFactory.createEntityManager();
};
};

public static User getUser(String userName) {
return emHolder.get().find(User.class, userName);
}

..

If not, thanks for possible better solutions, Juraj

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



FeedbackPanel inside PropertyListView

2011-02-02 Thread Duro

Hello,
 in my FeedbackPanel, which is created inside PropertyListView I 
experience this behaviour. Each item , which is created in the 
PropertyListView contains a form and some data, which u can edit and a 
FeedbackPanel.  When there is a new message in the FeedbackPanel, it is 
shown in all FeedbackPanels that are created. What do i have to do, so 
that the message is shown only in the one, where it belongs?


PropertyListViewHarvestedFile propertyListView = new 
PropertyListViewHarvestedFile(

allFiles, list) {
private static final long serialVersionUID = 
612045960036358963L;


@Override
protected void populateItem(ListItemHarvestedFile item) {

form.add(new FeedbackPanel(feedback));

form.add(textField);

 }

later, i call textField.error(False input);

thx, Juraj
__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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



PagingNavigator not working in PropertyListView

2011-01-28 Thread Duro

Hello,
 i have an component, which shows content of a table and i use 
PagingNavigator in this component to list the pages. This component is 
working correctly, when i put it directly into an page. But when i use 
repeater - PropertyListView , than PagingNavigator stops working 
correctly. No matter , which of the pages i want to navigate to, it 
always shows the content  of the 1st page.

thanks for help, Juraj
__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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



Re: PagingNavigator not working in PropertyListView

2011-01-28 Thread Duro
SOLVED, calling setReuseItems(true) on PropertyListView helped (for 
whatever reasons) :-)



Hello,
 i have an component, which shows content of a table and i use 
PagingNavigator in this component to list the pages. This component is 
working correctly, when i put it directly into an page. But when i use 
repeater - PropertyListView , than PagingNavigator stops working 
correctly. No matter , which of the pages i want to navigate to, it 
always shows the content  of the 1st page.

thanks for help, Juraj
__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden 
Schutz gegen Massenmails. http://mail.yahoo.com

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



__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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



Re: Custom IUnauthorizedComponentInstantiationListener

2011-01-14 Thread Duro

hi,
 could u describe the proposed solution more deeply please. Idon't 
know, what more i should do with my


iauthorizationstrategy , it has only 2 boolean methods and i don't see 
anything, i could improve there. Btw i use RoleAuthorizationStrategy, which is 
a CompoundAuthorizationStrategy.

thanks, Juraj


if you want to hide unauthorized components you should use
iauthorizationstrategy and veto component's RENDER action

-igor

On Wed, Jan 5, 2011 at 1:42 AM, Durodevelma...@yahoo.com  wrote:

Hi, i am trying to customize the behavior, when in a page a component is
found, that the current user is not authorized to while he is authorized to
the page. This by default throws an exception and i want to change it so,
that the component is simply not displayed. So i did this: in my web
application, that is subclass of AuthenticatedWebApplication i have this
init() method:

@Override
protected void init() {
super.init();
// we customize the default behavior, when there is an component in
page, that
// this user can't access. Default is an exception thrown, we just
set the
// component not visible
getSecuritySettings().setUnauthorizedComponentInstantiationListener(
new IUnauthorizedComponentInstantiationListener() {
@Override
public void onUnauthorizedInstantiation(Component
component) {
if (component instanceof Page) {
onUnauthorizedPage((Page) component);
} else {
component.detach();
}
}
});
}

as i can see, if the unauthorized object is a page, than i call
onUnauthorizedPage((Page) component) which redirects to login page, else i
destroy the component.
What comes out as result is that the user after accessing protected page is
redirected to login page, logs in and is authentificated but than somehow
the session is destroyed and new is created for some reason which results in
loosing the authentication and login page is displayed again. So the user
actually can't log in and always ends only in the login page.
thanks for help in advance, Juraj

__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
gegen Massenmails. http://mail.yahoo.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



__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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



Custom IUnauthorizedComponentInstantiationListener

2011-01-05 Thread Duro
Hi, i am trying to customize the behavior, when in a page a component is 
found, that the current user is not authorized to while he is authorized 
to the page. This by default throws an exception and i want to change it 
so, that the component is simply not displayed. So i did this: in my web 
application, that is subclass of AuthenticatedWebApplication i have this 
init() method:


@Override
protected void init() {
super.init();
// we customize the default behavior, when there is an 
component in page, that
// this user can't access. Default is an exception thrown, we 
just set the

// component not visible

getSecuritySettings().setUnauthorizedComponentInstantiationListener(

new IUnauthorizedComponentInstantiationListener() {
@Override
public void onUnauthorizedInstantiation(Component 
component) {

if (component instanceof Page) {
onUnauthorizedPage((Page) component);
} else {
component.detach();
}
}
});
}

as i can see, if the unauthorized object is a page, than i call 
onUnauthorizedPage((Page) component) which redirects to login page, else 
i destroy the component.
What comes out as result is that the user after accessing protected page 
is redirected to login page, logs in and is authentificated but than 
somehow the session is destroyed and new is created for some reason 
which results in loosing the authentication and login page is displayed 
again. So the user actually can't log in and always ends only in the 
login page.

thanks for help in advance, Juraj

__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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



Visibility setting with Ajax

2010-12-21 Thread Duro

Hi, i have 3 panels on my page:
wicket:extend
div align=center style=background-color:red;padding:20px
h2Epubs upload/h2
form wicket:id=form
div style=background-color:#304050
span wicket:id=uploadPanel1/
span wicket:id=uploadPanel2/
span wicket:id=uploadPanel3/
a href=# wicket:id=addLinkAdd next file/a
br/
input wicket:id=submitButton type=submit value=Datei(en) laden/
/div
div wicket:id=feedback class=error style=background-color:yellow/
/form
/div
/wicket:extend

and only after clicking addLink, the user should see the uploadPanel2. 
So i coded this:


add(new AjaxFallbackLink(addLink) {
private static final long serialVersionUID = 
-4427831923318024979L;


@Override
public void onClick(AjaxRequestTarget target) {
uploadPanel2.setVisible(true);
}
});

When i debug, the method onClick() is really entered and 
uploadPanel2.setVisible(true) is executed, but the panel is still not 
visible. What else i have to do?

 thanks!
__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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



Re: Visibility setting with Ajax

2010-12-21 Thread Duro

solved, thanks a lot

Make sure of set the OutputMarkupPlaceholderTag to true in uploadPanels also

On Tue, Dec 21, 2010 at 10:46 AM, Tejash Tarunttej...@educator.eu  wrote:


Hi,

What it looks to me that the panel of which visibility has been set is not
added to the target.
So, IMHO *target.add(uploadPanel2)* should do.

Regards

On Tue, Dec 21, 2010 at 6:09 PM, Durodevelma...@yahoo.com  wrote:


Hi, i have 3 panels on my page:
wicket:extend
div align=center style=background-color:red;padding:20px
h2Epubs upload/h2
form wicket:id=form
div style=background-color:#304050
span wicket:id=uploadPanel1/
span wicket:id=uploadPanel2/
span wicket:id=uploadPanel3/
a href=# wicket:id=addLinkAdd next file/a
br/
input wicket:id=submitButton type=submit value=Datei(en) laden/
/div
div wicket:id=feedback class=error style=background-color:yellow/
/form
/div
/wicket:extend

and only after clicking addLink, the user should see the uploadPanel2. So

i

coded this:

add(new AjaxFallbackLink(addLink) {
private static final long serialVersionUID =
-4427831923318024979L;

@Override
public void onClick(AjaxRequestTarget target) {
uploadPanel2.setVisible(true);
}
});

When i debug, the method onClick() is really entered and
uploadPanel2.setVisible(true) is executed, but the panel is still not
visible. What else i have to do?
  thanks!
__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
gegen Massenmails. http://mail.yahoo.com
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org







__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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



Re: Visibility setting with Ajax

2010-12-21 Thread Duro
thanks, setOutputMarkupId(true) is probably not necessary., but adding 
the component to target and setOutputMarkupPlaceholderTag(true) is.
Now i tried to mak eit work even better and removed the panels from the 
site. i want to add them just on time, when the user request it. so site 
looks now like this:


wicket:extend
div align=center style=background-color:red;padding:20px
h2Epubs upload/h2
form wicket:id=form
div style=background-color:#304050
span wicket:id=panel/
a href=# wicket:id=addLinkAdd next file/a
br/
input wicket:id=submitButton type=submit value=Datei(en) laden/
/div
div wicket:id=feedback class=error style=background-color:yellow/
/form
/div
/wicket:extend


and i try to create the panel dynamically:

public void onClick(AjaxRequestTarget target) {
panel.setOutputMarkupPlaceholderTag(true);
target.addComponent(panel);
panel.add(new UploadFilePanel(filePanel));

the markup of UploadFilePanel:

wicket:panel
table style=padding-bottom:5px
tr
td width=180pxTyp/td
tdselect wicket:id=type //td
tdTitel/td
tdinput type=text wicket:id=title //td
/tr
tr
tdJahr/td
tdinput type=text wicket:id=year //td
tdAusgabe Nummer/td
tdinput type=text wicket:id=issueNumber //td
/tr
tr
tdDatei/td
tdinput wicket:id=fileUploadField type=file //td
td colspan=2 valign=bottomIch bin Inhaber
   des Mediensinput type=checkbox wicket:id=ownerCheckbox//td
/tr
/table
/wicket:panel

this all end in the error:

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. [MarkupContainer [Component id = panelX]]
2. [MarkupContainer [Component id = type]]
3. [MarkupContainer [Component id = title]]
4. [MarkupContainer [Component id = year]]
5. [MarkupContainer [Component id = issueNumber]]
6. [MarkupContainer [Component id = fileUploadField]]
7. [MarkupContainer [Component id = ownerCheckbox]]

i understand that i didnt declare the things in the markup, but thats 
what i want (create them not at the start, but never or later, when the 
user clicks on the link). So what is needed to create the 
UploadFilePanel dynamically?

 thanks for help



1-Put

uploadPanel2.setOutputMarkupId(true);
uploadPanel2.setOutputMarkupPlaceholderTag(true);
uploadPanel2.setVisible(false);

when you create the panel.

2- on

  public void onClick(AjaxRequestTarget target) {
 uploadPanel2.setVisible(true);
 target.addComponent(uploadPanel2);
}

Ernesto

On Tue, Dec 21, 2010 at 1:38 PM, Juraj Petkojuraj.pe...@gmail.com  wrote:

Hi, i have 3 panels on my page:
wicket:extend
div align=center style=background-color:red;padding:20px
h2Epubs upload/h2
form wicket:id=form
div style=background-color:#304050
span wicket:id=uploadPanel1/
span wicket:id=uploadPanel2/
span wicket:id=uploadPanel3/
a href=# wicket:id=addLinkAdd next file/a
br/
input wicket:id=submitButton type=submit value=Datei(en) laden/
/div
div wicket:id=feedback class=error style=background-color:yellow/
/form
/div
/wicket:extend

and only after clicking addLink, the user should see the uploadPanel2. So i
coded this:

add(new AjaxFallbackLink(addLink) {
private static final long serialVersionUID =
-4427831923318024979L;

@Override
public void onClick(AjaxRequestTarget target) {
uploadPanel2.setVisible(true);
}
});

When i debug, the method onClick() is really entered and
uploadPanel2.setVisible(true) is executed, but the panel is still not
visible. What else i have to do?
  thanks!


-
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



__
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 


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