Where to put HTML files?

2009-10-29 Thread Gonzalo Aguilar Delgado
Hi,

I'm just wondering were to put html pages. Currently I using the same
path as 
.java files. I created two compilation units, one for java and one for
resources.
After compiling both units are joined and put into the same folder.

But this is tricky to handle as sources are compiled into jar and to
modify an html
I have to process the .jar or just recompile.

Is there any other way to organize thinks so resources got out the .jar?

Thank you!


Re: Where to put HTML files?

2009-11-03 Thread Gonzalo Aguilar Delgado
Thank you a lot to all for your commentaries...

Everything exposed here seems to help me in one way or another. 

I will run a test for best approach and after decide the best way for
me.

Thank you again!


El jue, 29-10-2009 a las 14:27 +0100, Martijn Dashorst escribió:

> On Thu, Oct 29, 2009 at 2:20 PM, Olivier Bourgeois
>  wrote:
> > The pros :
> >
> > - you have instant template/properties reloading in development mode without
> > redeploying or complex IDE setup.
> 
> This is something that the quickstart
> (http://wicket.apache.org/quickstart.html) already provides, no need
> for complex setups having to keep directory structures in sync, or
> having to debug a custom resource resolver, or finding out why the
> templates don't match your java code ("Oh shouldn't I have updated
> production with the new templates?")
> 
> Martijn
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


Dynamic Rendering and Common Paramenters

2009-11-03 Thread Gonzalo Aguilar Delgado
Hello Again!

I have a form that I build dynamically based on a render parameter
value. I'm using
http://cwiki.apache.org/WICKET/forms-with-dynamic-elements.html


I use the constructor:

/**
 * Constructor
 */ 
public ViewModePage() 
{

...

// Get render parameter 
String value =
((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");
...
// Check for a valid answer from this customer
if(value!=null && value.length()>0)
{
log.debug("Value length: " + value.length());
User user = 
userDAOBean.find(UuidUserType.fromString(value));

if(user!=null)
{
answer = getLastAnswer(1,user);
if(answer!=null)
{
buildForm(answer);
surveySubmitButton.setEnabled(true);
}
}
}
...

}


buildForm(answer); gets the form build based on the user answer

The problem as you can figure out. It works as I do nothing with the
form... But when I submit the form the constructer gets not
called anymore. So no matter what's the value it will get not updated to
the new one.

The GREAT book "wicket in action" explained this issue well. You have to
use dynamic models:


 CODE --
In chapter 4, we’ll discuss the differences between static models
and dynamic mod-
els (the issue at hand) in greater depth. For now, we’ll solve the
problem by providing
the label with a model that calculates its value every time it’s
requested:

add(new Label("total", new Model() {
 @Override
public Object getObject() {
 NumberFormat nf = NumberFormat.getCurrencyInstance();
 return nf.format(getCart().getTotal());
 }
}));

---WICKET IN ACTION 


But as I have to build the form I do not have a dynamic model on page.
So how do I make the form gets updated each time
the page it's rendered without disturbing Wicket normal behaviour?

Do I explain myself?

Thank you all in advance.



















Re: Dynamic Rendering and Common Paramenters

2009-11-03 Thread Gonzalo Aguilar Delgado
Let me see if I understand what you say. 

I should build the form inside a component instead the page. And I
should keep a reference
to the dynamic model inside this component. 

This makes sense for me but I find one problem. Where do I read the
renderer parameter?

Because this code gets executed in the main page.

 CODE 
 // Get render parameter 
String value =
((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");

--


I can do it in submit but then I should be able to communicate it to the
new component and
make it render again.

Is there a common way to do this in wicket?


Thank you



El mar, 03-11-2009 a las 08:00 -0200, Pedro Santos escribió:

> > But when I submit the form the constructer gets not called anymore.
> this is an expected behavior, an component instance is held on pagemap
> between requests.
> 
> > But as I have to build the form I do not have a dynamic model on page.
> Can't you manage an instance of an dynamic model on your component,
> independent of your form build logic? You can. Figure out the best way to
> your component. You can simple keep this model on an instance variable for
> example.
> 
> On Tue, Nov 3, 2009 at 7:22 AM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> > Hello Again!
> >
> > I have a form that I build dynamically based on a render parameter
> > value. I'm using
> > http://cwiki.apache.org/WICKET/forms-with-dynamic-elements.html
> >
> >
> > I use the constructor:
> >
> > /**
> > * Constructor
> > */
> >public ViewModePage()
> >{
> >
> >...
> >
> >// Get render parameter
> >String value =
> >
> > ((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");
> >...
> >// Check for a valid answer from this customer
> >if(value!=null && value.length()>0)
> >{
> >log.debug("Value length: " + value.length());
> >User user =
> > userDAOBean.find(UuidUserType.fromString(value));
> >
> >if(user!=null)
> >{
> >answer = getLastAnswer(1,user);
> >if(answer!=null)
> >{
> >buildForm(answer);
> >surveySubmitButton.setEnabled(true);
> >}
> >}
> >}
> >...
> >
> >}
> >
> > 
> >
> > buildForm(answer); gets the form build based on the user answer
> >
> > The problem as you can figure out. It works as I do nothing with the
> > form... But when I submit the form the constructer gets not
> > called anymore. So no matter what's the value it will get not updated to
> > the new one.
> >
> > The GREAT book "wicket in action" explained this issue well. You have to
> > use dynamic models:
> >
> >
> >  CODE --
> >In chapter 4, we’ll discuss the differences between static models
> > and dynamic mod-
> > els (the issue at hand) in greater depth. For now, we’ll solve the
> > problem by providing
> > the label with a model that calculates its value every time it’s
> > requested:
> >
> > add(new Label("total", new Model() {
> > @Override
> >public Object getObject() {
> > NumberFormat nf = NumberFormat.getCurrencyInstance();
> > return nf.format(getCart().getTotal());
> > }
> > }));
> >
> > ---WICKET IN ACTION 
> >
> >
> > But as I have to build the form I do not have a dynamic model on page.
> > So how do I make the form gets updated each time
> > the page it's rendered without disturbing Wicket normal behaviour?
> >
> > Do I explain myself?
> >
> > Thank you all in advance.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 


Re: Dynamic Rendering and Common Paramenters

2009-11-03 Thread Gonzalo Aguilar Delgado



> >I should build the form inside a component instead the page. And I
> >should keep a reference
> >to the dynamic model inside this component.
> Not what I try to mean.


So what's the way?



> 
> your report:
> >But as I have to build the form I do not have a dynamic model on page.
> You can have your model, and you can have your component build logic.





> 
> you report:
> 
> >So no matter what's the value it will get not updated to
> >the new one.
> so i think you are working on diferent answer instances
> can you send some buildForm(answer) lines?


Yes but's somewhat large, anyway answer has got from the code I sent
earlier. But it got not
updated because this code goes in the constructor that never gets
called.

Here goes the code:


public void buildForm(SurveyAnswer answer)
{

List listQuestions = getQuestionList(1); // 
FIXIT: How
do we get this questionaire?

if(listQuestions!=null && listQuestions.size()>0)
{

int category = -1;
QuestionCategoryComponent categoryComponent = null;

/*
 * We add category containers to the component array and
 * questions to the category containers.
 * 
 */
for(Iterator iter = 
listQuestions.iterator();
iter.hasNext();)
{
SurveyQuestion question = iter.next();

// Check if we should start a new category
if(category !=
question.getSurveyQuestionCategory().getIdSurveyQuestionCategory())
{
log.debug("Category: " +
question.getSurveyQuestionCategory().getQuestionCategoryDescription());
categoryComponent = new
QuestionCategoryComponent("surveyComponent",
question.getSurveyQuestionCategory().getQuestionCategoryDescription());
components.add(categoryComponent);
category =
question.getSurveyQuestionCategory().getIdSurveyQuestionCategory();
}

if(categoryComponent!=null)
{
SurveyQuestionResponse response = null;
if(answer!=null)
{
response = 
surveyAnswerFactory.getResponse(question, answer);

if(response.getIdSurveyQuestionResponse()==null)
{
log.info("Creating a 
new answer for this question");


surveyQuestionResponseDAO.save(response);

}
}

// Each question component holds 
question and answer
try {

categoryComponent.add(QuestionComponentFactory.getComponent(question,
response));
} catch (ComponentTypeException e) {
try {
warn("Response for 
question: " +
question.getSurveyQuestionDescription() + " has incorrect response!");

categoryComponent.add(QuestionComponentFactory.getComponent(question));
} catch (ComponentTypeException 
e1) {
log.error("Cannot 
create component");
}
}
}


}

}
}


> 


Re: Dynamic Rendering and Common Paramenters

2009-11-03 Thread Gonzalo Aguilar Delgado
But Pedro, 

Everything works well. The form got created and everything gets sent and
updated when I click the submit button.

So in this aspect everything works well. 

The only problem is that I need to get a render parameter that actually
I only get in constructor so never gets updated 
and I want to know what's the correct way to do this.

I don't think I'm updating a object instance that isn't the one from my
model. I took this into account.

Tnx


El mar, 03-11-2009 a las 14:15 -0200, Pedro Santos escribió:

> Hi Gonzalo, I thought that with buildForm implementation I will see how you
> create your form component. But seams that it is created on the line:
> QuestionComponentFactory.getComponent(question,response)
> 
> Instead of ask you for more code, I will try to explain myself:
> 
> >So no matter what's the value it will get not updated to the new one.
> Any build component logic will stop you from create an form with an dynamic
> model on it. I thing you are updating an object instance that isn't the one
> on your form model.
> on lines:
> response = surveyAnswerFactory.getResponse(question,
> answer);
> and then:
> 
> 
> categoryComponent.add(QuestionComponentFactory.getComponent(question,
> response));
> be sure of to work on the same response instance that is on your form model.
> 
> On Tue, Nov 3, 2009 at 1:38 PM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> >
> >
> >
> > > >I should build the form inside a component instead the page. And I
> > > >should keep a reference
> > > >to the dynamic model inside this component.
> > > Not what I try to mean.
> >
> >
> > So what's the way?
> >
> >
> >
> > >
> > > your report:
> > > >But as I have to build the form I do not have a dynamic model on page.
> > > You can have your model, and you can have your component build logic.
> >
> >
> > 
> >
> >
> > >
> > > you report:
> > >
> > > >So no matter what's the value it will get not updated to
> > > >the new one.
> > > so i think you are working on diferent answer instances
> > > can you send some buildForm(answer) lines?
> >
> >
> > Yes but's somewhat large, anyway answer has got from the code I sent
> > earlier. But it got not
> > updated because this code goes in the constructor that never gets
> > called.
> >
> > Here goes the code:
> >
> >
> >public void buildForm(SurveyAnswer answer)
> >{
> >
> >List listQuestions = getQuestionList(1); //
> > FIXIT: How
> > do we get this questionaire?
> >
> >if(listQuestions!=null && listQuestions.size()>0)
> >{
> >
> >int category = -1;
> >QuestionCategoryComponent categoryComponent = null;
> >
> >/*
> > * We add category containers to the component array
> > and
> > * questions to the category containers.
> > *
> > */
> >for(Iterator iter =
> > listQuestions.iterator();
> > iter.hasNext();)
> >{
> >SurveyQuestion question = iter.next();
> >
> >// Check if we should start a new category
> >if(category !=
> > question.getSurveyQuestionCategory().getIdSurveyQuestionCategory())
> >{
> >log.debug("Category: " +
> > question.getSurveyQuestionCategory().getQuestionCategoryDescription());
> >categoryComponent = new
> > QuestionCategoryComponent("surveyComponent",
> > question.getSurveyQuestionCategory().getQuestionCategoryDescription());
> >components.add(categoryComponent);
> >category =
> > question.getSurveyQuestionCategory().getIdSurveyQuestionCategory();
> >}
> >
> >if(categoryComponent!=null)
> >{
> >SurveyQuestionResponse response =
> > null;
> >  

Portlet and ... 2.0 (How to pass parameters?)

2009-08-13 Thread Gonzalo Aguilar Delgado

Hi all!, 

I have some questions about parameter passing in portal environment. I
saw that WebPage class can have access to the Application class
but not the portlet class. This makes a little tricky to handle requests
because:

We can set session paramaters. And can call functions inside Application
(WicketExamplesMenuApplication.getExamples()).

@Override
public void onClick()
{
int index = ((LoopItem)getParent()).getIteration();
ExampleApplication ea =
WicketExamplesMenuApplication.getExamples().get(
index + 1);
PortletSession session =
((PortletRequestContext)RequestContext.get()).getPortletRequest()
.getPortletSession();

session.setAttribute(WicketExamplesMenuPortlet.EXAMPLE_APPLICATION_ATTR,
ea);
}

But it will be the portlet class the responsible for handling
processing. So the only way to pass information from the onClick
function to the
portlet application for rendering (for example) is using the portlet
session.

But I suppose that's not the preferred way.


What's the best way to pass information to the portlet class? Is there
any way to use the portlet class like we use the application class
(WicketExamplesMenuApplication.getExamples() ->
WicketExamplesMenuPortlet.getExamples())


I also saw that in the portlet example, the examples structure is
initialized by the WicketExamplesMenuPortlet and sent to the
WicketExamplesMenuApplication using the servlet context. But this will
overbloat the servlet attributes storage space. Also this should be
solved if webpages could access to the portlet class directly.

Why to do this way?



I want to know all this because I want to use shared render parameters
(I put there a user id and all the portlets update accordingly). To do
this I will do:



1.- Onclick: Put the Id on the session like above.
2.- Portlet.DoView: Recover id from session and store it in
shared render params.
3.- Delete it from session.


Is this the correct way to do it?


Thank you very much in advance...




Re: Portlet and ... 2.0 (How to pass parameters?)

2009-08-13 Thread Gonzalo Aguilar Delgado
Hi Rob, 

I want to do it because my application is composed of several portlets.
If you click on one customer, for ex. you will want 
other portlets to show information relative to the customer you have
just clicked.

This is why you will need shared-parameters. That is inside portlet 2.0
spec.

The other way to do it is with events. But this is not mature enough.




El jue, 13-08-2009 a las 22:01 +0200, Rob Sonke escribió:

> Could you maybe explain why you need it? Do you want to pass data inside 
> your portlet or to another portlet?
> 
> Rob
> 
> On 8/13/09 1:43 PM, Gonzalo Aguilar Delgado wrote:
> > Hi all!,
> >
> > I have some questions about parameter passing in portal environment. I
> > saw that WebPage class can have access to the Application class
> > but not the portlet class. This makes a little tricky to handle requests
> > because:
> >
> > We can set session paramaters. And can call functions inside Application
> > (WicketExamplesMenuApplication.getExamples()).
> >
> > @Override
> > public void onClick()
> > {
> > int index = ((LoopItem)getParent()).getIteration();
> > ExampleApplication ea =
> > WicketExamplesMenuApplication.getExamples().get(
> > index + 1);
> > PortletSession session =
> > ((PortletRequestContext)RequestContext.get()).getPortletRequest()
> > .getPortletSession();
> >
> > session.setAttribute(WicketExamplesMenuPortlet.EXAMPLE_APPLICATION_ATTR,
> > ea);
> > }
> >
> > But it will be the portlet class the responsible for handling
> > processing. So the only way to pass information from the onClick
> > function to the
> > portlet application for rendering (for example) is using the portlet
> > session.
> >
> > But I suppose that's not the preferred way.
> >
> >
> > What's the best way to pass information to the portlet class? Is there
> > any way to use the portlet class like we use the application class
> > (WicketExamplesMenuApplication.getExamples() ->
> > WicketExamplesMenuPortlet.getExamples())
> >
> >
> > I also saw that in the portlet example, the examples structure is
> > initialized by the WicketExamplesMenuPortlet and sent to the
> > WicketExamplesMenuApplication using the servlet context. But this will
> > overbloat the servlet attributes storage space. Also this should be
> > solved if webpages could access to the portlet class directly.
> >
> > Why to do this way?
> >
> >
> >
> > I want to know all this because I want to use shared render parameters
> > (I put there a user id and all the portlets update accordingly). To do
> > this I will do:
> >
> >
> >
> >  1.- Onclick: Put the Id on the session like above.
> >  2.- Portlet.DoView: Recover id from session and store it in
> >  shared render params.
> >  3.- Delete it from session.
> >
> >
> > Is this the correct way to do it?
> >
> >
> > Thank you very much in advance...
> >
> >
> >
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org


Re: SV: Portlet and ... 2.0 (How to pass parameters?)

2009-08-13 Thread Gonzalo Aguilar Delgado


El jue, 13-08-2009 a las 14:46 +0200, Wilhelmsen Tor Iver escribió:

> > But it will be the portlet class the responsible for handling
> > processing. So the only way to pass information from the onClick
> > function to the
> > portlet application for rendering (for example) is using the portlet
> > session.
> 
> But why would you want to go via the Application? The WicketPortlet is mostly 
> just the "front controller" responsible for mapping between the "portlet 
> world" and the "Wicket world": Either use a custom WebSession for the portlet 
> app, or pass the values you need in the PageParameters you send to the 
> response page in your onClick()/onSubmit(). This assumes the onClick() is for 
> a link on a Page that is part of the portlet application. Rendering is left 
> to these Pages.


I have no means to access my portlet from the page. How can you do it?



> 
> > I also saw that in the portlet example, the examples structure is
> > initialized by the WicketExamplesMenuPortlet and sent to the
> > WicketExamplesMenuApplication using the servlet context. But this will
> > overbloat the servlet attributes storage space. Also this should be
> > solved if webpages could access to the portlet class directly.
> > 
> > Why to do this way?
> 
> The Examples portlet is a bit strange compared to how you would normally do 
> things it seems.


Yep. I configured the application in 5 different ways. I have to mix
Spring+ Wicket+Hibernate+Portlets... It's a mess. 
But now it works perfectly. And curiously is a way I've never seen
before. You don't need portlet beans... Normally you do...



> 
> > 1.- Onclick: Put the Id on the session like above.
> > 2.- Portlet.DoView: Recover id from session and store it in
> > shared render params.
> > 3.- Delete it from session.
> > 
> > 
> > Is this the correct way to do it?
> 
> You could try making "normal" PortletURLs instead of using Wicket Link 
> elements; use setProperty()/addProperty() to set the portlet parameter. 
> Presumably Wicket's Portlet API implementation will deal with the mapping 
> just as it does today with mapping to and from PageParameters.


Nope. With normal parameters the other portlets must not see them!!! If
so it's a security error. Every portlet must be isolated.





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


Re: Portlet and ... 2.0 (How to pass parameters?)

2009-08-13 Thread Gonzalo Aguilar Delgado
Hi all!

I managed to do it with wicket 1.4. This is how:

Define it in portlet.xml


...

crmportal:userId
http://www.level2crm.com/params";>x:userId



Every portlet that will use it must also be configured with:

...
crmportal:userId


After doing this the portlet must have access to this parameter. But as
I have not access from Page processing to the
Wicket Portlet class I should hold the variable in session for a while:

Link link = new Link("id", new
PropertyModel(userObject, "uuid.uuid"))
{
@Override
public void onClick()
{

UUID uuid =  (UUID) 
this.getModelObject();

PortletSession session =
((PortletRequestContext)RequestContext.get()).getPortletRequest()
.getPortletSession();

session.setAttribute(CustomerListPortlet.CURRENT_UUID,
uuid.toString());
}
};


And after in the function processActionResponseState we can set the
public parameter after we recover it from session.

@Override
protected void processActionResponseState(String wicketURL,
String wicketFilterPath, String wicketFilterQuery,
PortletRequest request, ActionResponse response,
WicketResponseState responseState) throws 
PortletException,
IOException {

PortletSession session = request.getPortletSession();
String uuid = (String)session.getAttribute(CURRENT_UUID);
if(uuid!=null)
{
response.setRenderParameter("crmportal:userId", uuid);
}

// TODO Auto-generated method stub
super.processActionResponseState(wicketURL, wicketFilterPath,
wicketFilterQuery, request, response, 
responseState);
}



The other portlets will see this public render parameter as normal
parameter (NOTE: I don't know why not differentiate from the rest of
parameters. Can it have security considerations?). 

This is accessible directly in the page (This is other portlet and other
application inside the portal):
IModel loadableUserModel = new LoadableDetachableModel() {

@Override
protected Object load(){
User selectedUser = null;
String value =
((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");
if(value!=null)
{
UuidUserType uuid = 
UuidUserType.fromString(value);
selectedUser = userDAO.find(uuid);

if(!userDAO.isAttached(selectedUser))
{
userDAO.save(selectedUser); //Attach it
}

Set setDetails =
selectedUser.getContactBasicDetails();
setDetails.isEmpty();

return setDetails.toArray();
}
return null;
}


};


It seems to work right.

But means are subject of discussion...

Tnx


El jue, 13-08-2009 a las 13:43 +0200, Gonzalo Aguilar Delgado escribió:

> Hi all!, 
> 
> I have some questions about parameter passing in portal environment. I
> saw that WebPage class can have access to the Application class
> but not the portlet class. This makes a little tricky to handle requests
> because:
> 
> We can set session paramaters. And can call functions inside Application
> (WicketExamplesMenuApplication.getExamples()).
> 
> @Override
> public void onClick()
> {
>   int index = ((LoopItem)getParent()).getIteration();
>   ExampleApplication ea =
> WicketExamplesMenuApplication.getExamples().get(
>   index + 1);
>   PortletSession session =
> ((PortletRequestContext)RequestContext.get()).getPortletRequest()
>   .getPortletSession();
> 
> session.setAttribute(WicketExamplesMenuPortlet.EXAMPLE_APPLICATION_ATTR,
> ea);
> }
> 
> But it will be the portlet class the resp

CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-14 Thread Gonzalo Aguilar Delgado

Hi again, 

For a shake of completeness y will provide two of the working
configurations I've found to work. I would know what's the one 
correct and why. Someone can throw a little bit light on this issue,
please?

-=[ First Choice ]=-


-
web.xml
-


http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
My Portlet Application





com.ibm.websphere.portletcontainer.PortletDeploymentEnabled
false




contextConfigLocation
/WEB-INF/applicationContext.xml




org.springframework.web.context.ContextLoaderListener





opensessioninview

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter


opensessioninview
/hibernate/*




 
 
CustomerListPortlet 

org.apache.wicket.protocol.http.WicketFilter 

applicationClassName

com.level2crm.portals.crm.wicket.customerlist.WicketCustomerListApplication
 


portletOnlyFilter
true

 
  
CustomerListPortlet 
/CustomerListPortlet/* 
REQUEST
 INCLUDE
 FORWARD   
 

 

org.apache.wicket.detectPortletContext
true







MVC Servlet for Jetspeed Portlet
Applications
Jetspeed Container
JetspeedContainer

org.apache.jetspeed.container.JetspeedContainerServlet

contextName
crmportal-contact

0


JetspeedContainer
/container/*



http://java.sun.com/portlet

/WEB-INF/tld/portlet.tld


http://java.sun.com/portlet_2_0

/WEB-INF/tld/portlet_2_0.tld







-
portlet.xml
-



http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";
version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd 
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";>


Customer viewer
crm-customer-list
Customer list viewer

com.level2crm.portals.crm.wicket.customerlist.CustomerListPortlet
 
   wicketFilterPath
   /CustomerListPortlet
 


*/*
VIEW
EDIT

es

Customer list viewer
Customer list viewer
none


crmportal:userId

 


-
applicationContext.xml
-


http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:tx="http://www.springframework.org/schema/tx";
xmlns:aop="http://www.springframework.org/schema/aop";
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd";>



















.
Comments
-

I found this to work well. Spring gets initialized and everything works.
The only problem I've found is that hibernate session does not start
when needed. 
I have to check why. Maybe a problem with this configuration?




-=[ First Option ]=-


-
web.xml
-

Same above, but filters:



 

CustomerListPortlet 

org.apache.wicket.protocol.http.WicketFilter 

applicationFactoryClassName

org.apache.wicket.spring.SpringWebApplicationFactory


applicationBean
customerListPortletBean

 
  
CustomerListPortlet 
/CustomerListPortlet/* 
REQUEST
 INCLUDE

Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-14 Thread Gonzalo Aguilar Delgado
About the error I mentioned the exception it throws is:

Caused by: org.hibernate.LazyInitializationException: failed to lazily
initialize a collection of role:
com.level2crm.hibernate.generated.User.contactBasicDetails, no session
or session was closed
at
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at
org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at
org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
at
org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:146)
at com.level2crm.portals.crm.wicket.customerdetail.pages.ViewModePage
$1.load(ViewModePage.java:54)
at
org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:122)
at
org.apache.wicket.Component.getDefaultModelObject(Component.java:1664)
at
org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:221)
at
org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:525)
at
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131)
at
org.apache.wicket.Component.internalBeforeRender(Component.java:1061)
at org.apache.wicket.Component.beforeRender(Component.java:1095)
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1751)
... 109 more


May this have something to do with selected configuration?

Thank you again.


El vie, 14-08-2009 a las 10:53 +0200, Gonzalo Aguilar Delgado escribió:

> Hi again, 
> 
> For a shake of completeness y will provide two of the working
> configurations I've found to work. I would know what's the one 
> correct and why. Someone can throw a little bit light on this issue,
> please?
> 
> -=[ First Choice ]=-
> 
> 
> -
> web.xml
> -
> 
> 
> http://java.sun.com/xml/ns/j2ee";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.4"
>   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
> My Portlet Application
> 
> 
> 
> 
> 
> com.ibm.websphere.portletcontainer.PortletDeploymentEnabled
> false
> 
> 
> 
>   
>   contextConfigLocation
>   /WEB-INF/applicationContext.xml
>   
> 
>   
> 
> org.springframework.web.context.ContextLoaderListener
>   
> 
>   
> 
>   
>   opensessioninview
> 
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
>   
>   
>   opensessioninview
>   /hibernate/*
>   
>   
> 
> 
>
>  
> CustomerListPortlet 
> 
> org.apache.wicket.protocol.http.WicketFilter 
> 
> applicationClassName
> 
> com.level2crm.portals.crm.wicket.customerlist.WicketCustomerListApplication
>  
> 
> 
> portletOnlyFilter
> true
>   
>  
>   
> CustomerListPortlet 
> /CustomerListPortlet/* 
> REQUEST
>  INCLUDE
>  FORWARD   
>  
>   
>  
>   
> org.apache.wicket.detectPortletContext
> true
>   
>   
> 
> 
>   
>   
>   
>   MVC Servlet for Jetspeed Portlet
> Applications
>   Jetspeed Container
>   JetspeedContainer
> 
> org.apache.jetspeed.container.JetspeedContainerServlet
>   
>   contextName
>   crmportal-contact
>   
>   0
>   
>   
>   JetspeedContainer
>   /container/*
>   
>   
>   
>   http://java.sun.com/portlet
>   
> /WEB-INF/tld/portlet.tld
>   
>   
>   http://java.sun.com/portlet_2_0
>   
> /WEB-INF/tld/portlet_2_0.tld
>   
>   
>   
> 
> 
> 
> 
> -
> portlet.xml
> -
> 
> 
>   
>  xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd";
>   version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> 
> xsi:schemaLocation="http:/

Wicket and Transactions

2009-08-14 Thread Gonzalo Aguilar Delgado
Hi, 

I've found that introducing a pointcut over my portlet and application
makes Wicket to scream...

It seesm that pointcut is effective but interfere with wicket normal
init. I tried to setup the pointcut over the
pages instead, where the hibernate daos are used but it has no effect. 

What can be wrong there?

Thank's a lot!

---


GRAVE: Excepción arrancando filtro CustomerListPortlet
java.lang.IllegalStateException: the application key does not seem to be
set properly or this method is called before WicketServlet is set, which
leads to the wrong behavior
at
org.apache.wicket.protocol.http.WebApplication.getApplicationKey(WebApplication.java:164)
at org.apache.wicket.Application.internalInit(Application.java:989)
at
org.apache.wicket.protocol.http.WebApplication.internalInit(WebApplication.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.Cglib2AopProxy
$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:697)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy
$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
at
com.level2crm.portals.crm.wicket.customerlist.WicketCustomerListApplication$$EnhancerByCGLIB$$826be947.internalInit()
at
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:693)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at
org.apache.catalina.core.StandardService.start(StandardService.java:516)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


Pointcut

  





and advice...







 




Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread Gonzalo Aguilar Delgado
Sure? 


But I will loose control over how transactions are managed...



El vie, 14-08-2009 a las 22:14 +0200, nino martinez wael escribió:

> Yup so you should either use open session in view or more preferred
> AFAIK detachable models.
> 
> 2009/8/14 Russell Simpkins :
> >
> > Errors like those are caused when the hibernate session is closed too soon.
> > https://www.hibernate.org/43.html
> > Russ
> >
> >> Subject: Re: CORRECT portlet+spring+hibernate configuration (Two options, 
> >> what's right?)
> >> From: g...@aguilardelgado.com
> >> To: users@wicket.apache.org
> >> Date: Fri, 14 Aug 2009 11:01:05 +0200
> >>
> >> About the error I mentioned the exception it throws is:
> >>
> >> Caused by: org.hibernate.LazyInitializationException: failed to lazily
> >> initialize a collection of role:
> >> com.level2crm.hibernate.generated.User.contactBasicDetails, no session
> >> or session was closed
> >>   at
> >> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> >>   at
> >> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> >>   at
> >> org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
> >>   at
> >> org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:146)
> >>   at com.level2crm.portals.crm.wicket.customerdetail.pages.ViewModePage
> >> $1.load(ViewModePage.java:54)
> >>   at
> >> org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:122)
> >>   at
> >> org.apache.wicket.Component.getDefaultModelObject(Component.java:1664)
> >>   at
> >> org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:221)
> >>   at
> >> org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:525)
> >>   at
> >> org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131)
> >>   at
> >> org.apache.wicket.Component.internalBeforeRender(Component.java:1061)
> >>   at org.apache.wicket.Component.beforeRender(Component.java:1095)
> >>   at
> >> org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1751)
> >>   ... 109 more
> >>
> >>
> >> May this have something to do with selected configuration?
> >>
> >> Thank you again.
> >>
> >>
> >> El vie, 14-08-2009 a las 10:53 +0200, Gonzalo Aguilar Delgado escribió:
> >>
> >> > Hi again,
> >> >
> >> > For a shake of completeness y will provide two of the working
> >> > configurations I've found to work. I would know what's the one
> >> > correct and why. Someone can throw a little bit light on this issue,
> >> > please?
> >> >
> >> > -=[ First Choice ]=-
> >> >
> >> >
> >> > -
> >> > web.xml
> >> > -
> >> > 
> >> > 
> >> > http://java.sun.com/xml/ns/j2ee";
> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.4"
> >> > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> >> > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
> >> > My Portlet Application
> >> >
> >> > 
> >> >
> >> > 
> >> >
> >> > com.ibm.websphere.portletcontainer.PortletDeploymentEnabled
> >> > false
> >> > 
> >> >
> >> > 
> >> > 
> >> > contextConfigLocation
> >> > /WEB-INF/applicationContext.xml
> >> > 
> >> >
> >> > 
> >> >
> >> > org.springframework.web.context.ContextLoaderListener
> >> > 
> >> >
> >> > 
> >> >
> >> > 
> >> > opensessioninview
> >> >
> >> > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> >> > 
> >> > 
> >> > opensessioninview
> >> > /hibernate/*
> >&

Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread Gonzalo Aguilar Delgado
Ok. Maybe I don't understand...

Let me show the situation. I have Spring + portlet + hibernate config
with transactions working with the current configuration:

I have my DAO objects under package
com.level2crm.hibernate.enterprise.dao.contact
And model under com.level2crm.model

I configured one advice:






 



And several pointcuts:















 





I tried to configure the open session in view (web.xml):


org.springframework.web.context.ContextLoaderListener





opensessioninview

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter


opensessioninview
/hibernate/*





But I found that this does not work. Because:


public class ViewModePage extends org.apache.wicket.markup.html.WebPage
{
...

@SpringBean(name = "userDAOBean")
private UserDAO userDAO;


IModel loadableUserModel = new LoadableDetachableModel() {

@Override
protected Object load(){
User selectedUser = null;
String value =
((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");
if(value!=null)
{
UuidUserType uuid = 
UuidUserType.fromString(value); //Works!!
userDAO.testSessoion(uuid);//Works!!

selectedUser = userDAO.find(uuid);//Works!!

if(!userDAO.isAttached(selectedUser)) //Works!! 
But is not
attached!!!
{

userDAO.save(selectedUser); //Attach it 
//Works!! It
saves/updates the object but it's still not attached
}



Set setDetails =
selectedUser.getContactBasicDetails(); //Works!! It gets the set
setDetails.isEmpty(); // FAIL FAIL Cannot load 
lazy

return setDetails.toArray();
}
return null;
}


};
...
}


This load() function does not work! It makes the exception. But:


1.- It can get the User. Because the pointcut works inside the
DAO?
2.- It can save the object. Because the pointcut works inside
the DAO?
3.- It can get the Set. Because the pointcut works inside the
DAO?


The  userDAO.testSessoion(uuid); function inside the DAO object works.
What I do is to get the Hibernate session, check that is ok. And check
also if the transaction was created and I can attach and use object.
Inside the userDAO.testSessoion function I do the same code that in the
load() function but this time everything works!

I'm sure that it works because it has a session and a open transaction
due to the pointcut defined as follows works above: 

  
  
  
  


What is not working is the pointcut that should provide a
transaction/session to the page:
  

  
  
  

And I think this has something to do with the hibernate+wicket
configuration. As the page is not created by the Spring bean interface
it cannot
make a proxy around it. So it will never get the session/transaction.


Opening a session with the view manually will make my pointcuts not
usable so I will loose the control over what classes
will be managed and over transactions. Do will I?




> >> Yup so you should either use open session in view or more preferred
> >> AFAIK detachable models.

Yep, I do it but it does not work. Indeed it fails inside the load()
function. That makes me thing something is wrong configured... 




Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread Gonzalo Aguilar Delgado


> I have several suggestions.
> 
> The order of the web filters are important. You could also try with
> with the wicket spring managed apps, im not sure how that applies.

Will check. I didn't know about filter order... Will also check it.
Thanks!


> 
> And are you sure that your filter ( /hibernate/*), get's hit? What's
> your wicket filter url, the same or?


No, It's different. Can I set it to just "/*"? Should I do it that way?

Thank you very much for your answers...



> 
> 2009/8/17 Gonzalo Aguilar Delgado :
> > Ok. Maybe I don't understand...
> >
> > Let me show the situation. I have Spring + portlet + hibernate config
> > with transactions working with the current configuration:
> >
> > I have my DAO objects under package
> > com.level2crm.hibernate.enterprise.dao.contact
> > And model under com.level2crm.model
> >
> > I configured one advice:
> >
> >
> >
> >
> > > read-only="true" />
> >
> > 
> >
> >
> >
> > And several pointcuts:
> >
> >
> > > pointcut-ref="allModelOperation"/>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> > I tried to configure the open session in view (web.xml):
> >
> >
> > org.springframework.web.context.ContextLoaderListener
> >
> >
> >
> >
> >
> >opensessioninview
> >
> > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> >
> >
> >opensessioninview
> >/hibernate/*
> >
> >
> >
> >
> >
> > But I found that this does not work. Because:
> >
> >
> > public class ViewModePage extends org.apache.wicket.markup.html.WebPage
> > {
> > ...
> >
> >@SpringBean(name = "userDAOBean")
> >private UserDAO userDAO;
> >
> >
> >IModel loadableUserModel = new LoadableDetachableModel() {
> >
> >@Override
> >protected Object load(){
> >User selectedUser = null;
> >String value =
> > ((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");
> >if(value!=null)
> >{
> >UuidUserType uuid = 
> > UuidUserType.fromString(value); //Works!!
> >userDAO.testSessoion(uuid);//Works!!
> >
> >selectedUser = userDAO.find(uuid);//Works!!
> >
> >if(!userDAO.isAttached(selectedUser)) 
> > //Works!! But is not
> > attached!!!
> >{
> >
> >userDAO.save(selectedUser); //Attach 
> > it //Works!! It
> > saves/updates the object but it's still not attached
> >}
> >
> >
> >
> >Set setDetails =
> > selectedUser.getContactBasicDetails(); //Works!! It gets the set
> >setDetails.isEmpty(); // FAIL FAIL Cannot 
> > load lazy
> >
> >return setDetails.toArray();
> >}
> >return null;
> >}
> >
> >
> >};
> > ...
> > }
> >
> >
> > This load() function does not work! It makes the exception. But:
> >
> >
> >1.- It can get the User. Because the pointcut works inside the
> >DAO?
> >2.- It can save the object. Because the pointcut works inside
> >the DAO?
> >3.- It can get the Set. Because the pointcut works inside the
> >DAO?
> >
> >
> > The  userDAO.testSessoion(uuid); function inside the DAO object works.
> > What I do is to get the Hibernate session, check that is ok. And check
> > also if the tran

Re: Portlet and ... 2.0 (How to pass parameters?)

2009-08-19 Thread Gonzalo Aguilar Delgado
Spam detection software, running on the system "azul3.aguilardelgado.com", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  Hi Rob, Yep, of course is more beautiful!!! :D But I did not
   know that you can cast a PortletResponse to an action response... [...] 

Content analysis details:   (5.5 points, 5.0 required)

 pts rule name  description
 -- --
 0.5 RCVD_IN_PBLRBL: Received via a relay in Spamhaus PBL
[87.223.212.129 listed in zen.spamhaus.org]
 1.6 RCVD_IN_SORBS_DUL  RBL: SORBS: sent directly from dynamic IP address
[87.223.212.129 listed in dnsbl.sorbs.net]
 1.0 EXTRA_MPART_TYPE   Header has extraneous Content-type:...type= entry
 2.3 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date
 0.0 HTML_MESSAGE   BODY: HTML included in message
 0.1 RDNS_DYNAMIC   Delivered to trusted network by host with
dynamic-looking rDNS
 0.0 DYN_RDNS_AND_INLINE_IMAGE Contains image, and was sent by dynamic
rDNS

The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam.  If you wish to view
it, it may be safer to save it to a file and open it with an editor.

--- Begin Message ---
Hi Rob, 

Yep, of course is more beautiful!!! :D

But I did not know that you can cast a PortletResponse to an action
response...

It should not be the same. I'm a little bit confused about  the big
number of XXXResponse object going around...

Thank you for the suggestion. I will change my code...

:D




El vie, 14-08-2009 a las 07:13 +0200, Rob Sonke escribió:

> It's up to you but I think there is a more beautiful/easier way. Just 
> configure the public render params the same in the portlet.xml. Use this 
> to set params in e.g. an onClick:
> 
> ActionResponse actionResponse = (ActionResponse) 
> ((PortletRequestContext)PortletRequestContext.get()).getPortletResponse();
> actionResponse.setRenderParameter(name.getValue(), value);
> 
> And this to retrieve a parameter anywhere:
> PortletRequestContext prc = (PortletRequestContext)RequestContext.get();
> Map map = prc.getPortletRequest().getPublicParameterMap();
> map.get(name.getValue());
> 
> But that's up to you :)
> 
> Rob
> 
> On 8/14/09 1:50 AM, Gonzalo Aguilar Delgado wrote:
> > Hi all!
> >
> > I managed to do it with wicket 1.4. This is how:
> >
> > Define it in portlet.xml
> >
> > 
> > ...
> > 
> >  crmportal:userId
> >   > xmlns:x="http://www.level2crm.com/params";>x:userId
> > 
> > 
> >
> > Every portlet that will use it must also be configured with:
> > 
> > ...
> > crmportal:userId
> > 
> >
> > After doing this the portlet must have access to this parameter. But as
> > I have not access from Page processing to the
> > Wicket Portlet class I should hold the variable in session for a while:
> >
> >  Link link = new Link("id", new
> > PropertyModel(userObject, "uuid.uuid"))
> > {
> > @Override
> > public void onClick()
> > {
> > 
> > UUID uuid =  (UUID) 
> > this.getModelObject();
> > 
> > PortletSession session =
> > ((PortletRequestContext)RequestContext.get()).getPortletRequest()
> > .getPortletSession();
> > 
> > session.setAttribute(CustomerListPortlet.CURRENT_UUID,
> > uuid.toString());
> > }
> > };
> >
> >
> > And after in the function processActionResponseState we can set the
> > public parameter after we recover it from session.
> >
> > @Override
> > protected void processActionResponseState(String wicketURL,
> > String wicketFilterPath, String wicketFilterQuery,
> > PortletRequest request, ActionRespon

Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-09-12 Thread Gonzalo Aguilar Delgado


Hi again! 

I'm really lost on this toppic. It seems to not work. 

First of all. Can someone post a complete configuration of a wicket
portlet + spring, please?

I found several ways to do it but none seems to be correct.

Thank you.



El mar, 18-08-2009 a las 09:53 +0200, nino martinez wael escribió: 

> Happy to help, please see further answers below.
> 
> 2009/8/17 Gonzalo Aguilar Delgado :
> >
> >
> >> I have several suggestions.
> >>
> >> The order of the web filters are important. You could also try with
> >> with the wicket spring managed apps, im not sure how that applies.
> >
> > Will check. I didn't know about filter order... Will also check it.
> > Thanks!
> >
> >
> >>
> >> And are you sure that your filter ( /hibernate/*), get's hit? What's
> >> your wicket filter url, the same or?
> >
> >
> > No, It's different. Can I set it to just "/*"? Should I do it that way?
> Well it depends, if the hibernate filter should be activated at the
> same url's as wicket.
> 
> I've never had a case where my wicket filter and osiw did not match.
> You might have performance increases if they differ, for example if
> you know that you willl never use hibernate on /myapp/ but always put
> in /myapp/pages/dynamic/*  for pages that use db lookup..
> >
> > Thank you very much for your answers...
> >
> >
> >
> >>
> >> 2009/8/17 Gonzalo Aguilar Delgado :
> >> > Ok. Maybe I don't understand...
> >> >
> >> > Let me show the situation. I have Spring + portlet + hibernate config
> >> > with transactions working with the current configuration:
> >> >
> >> > I have my DAO objects under package
> >> > com.level2crm.hibernate.enterprise.dao.contact
> >> > And model under com.level2crm.model
> >> >
> >> > I configured one advice:
> >> >
> >> >
> >> >
> >> >
> >> > >> > read-only="true" />
> >> >
> >> > 
> >> > 
> >> >
> >> >
> >> >
> >> > And several pointcuts:
> >> >
> >> > >> > expression="execution(*
> >> > com.level2crm.model..*+.*(..))"/>
> >> > >> > pointcut-ref="allModelOperation"/>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > 
> >> >
> >> >
> >> > >> > pointcut-ref="portlets"/>
> >> >
> >> >
> >> > I tried to configure the open session in view (web.xml):
> >> >
> >> >
> >> > org.springframework.web.context.ContextLoaderListener
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >opensessioninview
> >> >
> >> > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> >> >
> >> >
> >> >opensessioninview
> >> >/hibernate/*
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > But I found that this does not work. Because:
> >> >
> >> >
> >> > public class ViewModePage extends org.apache.wicket.markup.html.WebPage
> >> > {
> >> > ...
> >> >
> >> >@SpringBean(name = "userDAOBean")
> >> >private UserDAO userDAO;
> >> >
> >> >
> >> >IModel loadableUserModel = new LoadableDetachableModel() {
> >> >
> >> >@Override
> >> >protected Object load(){
> >> >User selectedUser = null;
> >> >String value =
> >> > ((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");

Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-09-12 Thread Gonzalo Aguilar Delgado
Hi again! 

I'm really lost on this toppic. It seems to not work. 

First of all. Can someone post a complete configuration of a wicket
portlet + spring, please?

I found several ways to do it but none seems to be correct.

Thank you.



El mar, 18-08-2009 a las 09:53 +0200, nino martinez wael escribió:

> Happy to help, please see further answers below.
> 
> 2009/8/17 Gonzalo Aguilar Delgado :
> >
> >
> >> I have several suggestions.
> >>
> >> The order of the web filters are important. You could also try with
> >> with the wicket spring managed apps, im not sure how that applies.
> >
> > Will check. I didn't know about filter order... Will also check it.
> > Thanks!
> >
> >
> >>
> >> And are you sure that your filter ( /hibernate/*), get's hit? What's
> >> your wicket filter url, the same or?
> >
> >
> > No, It's different. Can I set it to just "/*"? Should I do it that way?
> Well it depends, if the hibernate filter should be activated at the
> same url's as wicket.
> 
> I've never had a case where my wicket filter and osiw did not match.
> You might have performance increases if they differ, for example if
> you know that you willl never use hibernate on /myapp/ but always put
> in /myapp/pages/dynamic/*  for pages that use db lookup..
> >
> > Thank you very much for your answers...
> >
> >
> >
> >>
> >> 2009/8/17 Gonzalo Aguilar Delgado :
> >> > Ok. Maybe I don't understand...
> >> >
> >> > Let me show the situation. I have Spring + portlet + hibernate config
> >> > with transactions working with the current configuration:
> >> >
> >> > I have my DAO objects under package
> >> > com.level2crm.hibernate.enterprise.dao.contact
> >> > And model under com.level2crm.model
> >> >
> >> > I configured one advice:
> >> >
> >> >
> >> >
> >> >
> >> > >> > read-only="true" />
> >> >
> >> > 
> >> > 
> >> >
> >> >
> >> >
> >> > And several pointcuts:
> >> >
> >> > >> > expression="execution(*
> >> > com.level2crm.model..*+.*(..))"/>
> >> > >> > pointcut-ref="allModelOperation"/>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > 
> >> >
> >> >
> >> > >> > pointcut-ref="portlets"/>
> >> >
> >> >
> >> > I tried to configure the open session in view (web.xml):
> >> >
> >> >
> >> > org.springframework.web.context.ContextLoaderListener
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >opensessioninview
> >> >
> >> > org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
> >> >
> >> >
> >> >opensessioninview
> >> >/hibernate/*
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > But I found that this does not work. Because:
> >> >
> >> >
> >> > public class ViewModePage extends org.apache.wicket.markup.html.WebPage
> >> > {
> >> > ...
> >> >
> >> >@SpringBean(name = "userDAOBean")
> >> >private UserDAO userDAO;
> >> >
> >> >
> >> >IModel loadableUserModel = new LoadableDetachableModel() {
> >> >
> >> >@Override
> >> >protected Object load(){
> >> >User selectedUser = null;
> >> >String value =
> >> > ((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter("crmportal:userId");
> >

OpenSessionInViewFilter not working in portlets?

2009-09-12 Thread Gonzalo Aguilar Delgado
Hi, 

I'm trying to make the OpenSessionInViewFilter to work with my portlets
but it seems that does not initialize
nor work.

Can you check if something is wrong, please?


Thank you


--
web.xml
---


http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
My Portlet Application




com.ibm.websphere.portletcontainer.PortletDeploymentEnabled
false



contextConfigLocation
/WEB-INF/applicationContext.xml




org.springframework.web.context.ContextLoaderListener




openSessionInViewFilter

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter

singleSession
true


sessionFactoryBeanName
opRoyalCaninSessionFactory



openSessionInViewFilter
/customer-detail/*



 
CustomerDetailPortlet 

org.apache.wicket.protocol.http.WicketFilter 

applicationFactoryClassName

org.apache.wicket.spring.SpringWebApplicationFactory


applicationBean
customerDetailPortletBean

 
 
CustomerDetailPortlet 
/customer-detail/* 
REQUEST
INCLUDE
FORWARD   
 



MVC Servlet for Jetspeed Portlet
Applications
Jetspeed Container
JetspeedContainer

org.apache.jetspeed.container.JetspeedContainerServlet

contextName
crmportal-contact

0


JetspeedContainer
/container/*



http://java.sun.com/portlet

/WEB-INF/tld/portlet.tld


http://java.sun.com/portlet_2_0

/WEB-INF/tld/portlet_2_0.tld








Re: OpenSessionInViewFilter not working in portlets?

2009-09-14 Thread Gonzalo Aguilar Delgado
Hi Ate, 

Right! That was! Now it's working... I will have to deal with
transactions now but I think it's working
properly now.

Thank you a lot.



El lun, 14-09-2009 a las 10:02 +0200, Ate Douma escribió:

> REQUEST
>  INCLUDE
>  FORWARD
>


Serialization Problem

2010-06-22 Thread Gonzalo Aguilar Delgado
Hi there, 

I'm currently running out of ideas on this problem. When detaching the
request wicket it's giving me a nasty Serialization exception problem.

It happens that the error is:
---
- Error serializing object class
com.level2.portals.crm.wicket.report.portlet.reportviewer.EditModePage
[object=[Page class =
com.level2.portals.crm.wicket.report.portlet.reportviewer.EditModePage,
id = 1, version = 0, ajax = 0]]
org.apache.wicket.util.io.SerializableChecker
$WicketNotSerializableException: Unable to serialize class:
com.level2.portals.crm.wicket.report.component.preferences.ReportPreferencesComponentFactory
---

And follows hierarchy. But I'm not keeping any reference to this Object
(ReportPreferencesComponentFactory).  It's a transient object that
builds some other dynamic content.

But it keeps telling me that it's not serializable. It must be a
reference anyway in code. But the only place where I use it is here:
-
ReportPreferencesComponentFactory factory = new
ReportPreferencesComponentFactory("preferenceComponent", task);

for(Iterator it = paramDefs.iterator();
it.hasNext();)
{
IParameterDefnBase paramDef = it.next();
Panel component;
try {
component = factory.buildComponent(paramDef, prefs);
componentList.add(component);
} catch (PreferenceComponentUnknown e) {
log.warn("Cannot add preference component for parameter " +
paramDef.getName() + ": " + e.getMessage());
}

}
factory = null;
-


It's used for component creation (no references inside also) and then
destroyed... No inner clases references as the hierarchy says...


Any ideas on this?

Hierarchy:
...
private java.lang.Object
org.apache.wicket.model.util.GenericBaseModel.object[write:1]
[class=com.level2.portals.crm.wicket.report.component.preferences.ScalarDynamicListPreferenceComponentImpl,
 path=preferenceComponent]
  java.lang.Object org.apache.wicket.Component.data
[class=com.level2.portals.crm.wicket.report.component.preferences.ReportPreferencesComponentFactory$1]
final
com.level2.portals.crm.wicket.report.component.preferences.ReportPreferencesComponentFactory
 
com.level2.portals.crm.wicket.report.component.preferences.ReportPreferencesComponentFactory$1.this$0
 
[class=com.level2.portals.crm.wicket.report.component.preferences.ReportPreferencesComponentFactory]
 <- field that is not serializable






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



Re: StringResourceModel - On the Fly

2010-09-06 Thread Gonzalo Aguilar Delgado
Hi MSantos, 

I have similar problem. I want to localize a string inside a class, but
I think your approach is not the good solution. I will look around but
If someone has any alternatives please say...


Tnx.


El lun, 06-09-2010 a las 06:00 -0700, msantos escribió:
> Hello there. 
> 
> I am using the StringResourceModel to get from the *.properties file strings
> to the pages of my web app. and it is working fine.
> 
> For instance: 
> 
> StringResourceModel emailLabelModel = new StringResourceModel("emailLabel",
> null);
> emailLabel = new Label("emailLabel", emailLabelModel);
> 
> But when i need string from the file on the fly, not on the rendering fase,
> it raise an exception:
> 
> StringResourceModel resultadoMsgModel = new StringResourceModel("msgResult",
> null);
> resultadoMsgModel.getString();
> 
> java.util.MissingResourceException: Unable to find property: 'msgResult'
> 
> Someone can explain why it happens and how can i get it work?
> 
> Thanks a lot


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



Re: StringResourceModel - On the Fly

2010-09-06 Thread Gonzalo Aguilar Delgado
To be more clear I will paste some code:

public class Foo
{
public String getSomething()
{
frase = "field " + filterData.getFieldName() + " of " +
criteria.getDescription() + " is equal to " +
filter.getDataValue().getValue();

{

}

Should be translated to something similar to

"field ${fieldName} of ${fieldDescription} is equal to
${fieldDataValue}"

And have a way to access this as if we were in a component.

But how to do it inside a class that is not a component?



El lun, 06-09-2010 a las 18:41 +0200, Gonzalo Aguilar Delgado escribió:
> Hi MSantos, 
> 
> I have similar problem. I want to localize a string inside a class, but
> I think your approach is not the good solution. I will look around but
> If someone has any alternatives please say...
> 
> 
> Tnx.
> 
> 
> El lun, 06-09-2010 a las 06:00 -0700, msantos escribió:
> > Hello there. 
> > 
> > I am using the StringResourceModel to get from the *.properties file strings
> > to the pages of my web app. and it is working fine.
> > 
> > For instance: 
> > 
> > StringResourceModel emailLabelModel = new StringResourceModel("emailLabel",
> > null);
> > emailLabel = new Label("emailLabel", emailLabelModel);
> > 
> > But when i need string from the file on the fly, not on the rendering fase,
> > it raise an exception:
> > 
> > StringResourceModel resultadoMsgModel = new StringResourceModel("msgResult",
> > null);
> > resultadoMsgModel.getString();
> > 
> > java.util.MissingResourceException: Unable to find property: 'msgResult'
> > 
> > Someone can explain why it happens and how can i get it work?
> > 
> > Thanks a lot
> 
> 
> -
> 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



onSelectionChanged is not calling converters

2012-05-14 Thread Gonzalo Aguilar Delgado
Hello, 

I've just found working with 1.5.6 that DropDownChoice control that it
may be not calling Converters. 

Because the model is still a string while calling to
onSelectionChanged(Provincia provincia) and it fails:

Caused by: java.lang.ClassCastException: java.lang.String cannot be
cast to generated.Provincia

I have something like this:

DropDownChoice provinciaChoice=new
DropDownChoice("provincia",new WSProvinceModel()){
...
protected void onSelectionChanged(Provincia provincia) {
if(provincia!=null)
{
if(cityModel!=null)

cityModel.setProvinceId(provincia.getId().toString());
}
}

...
};


---

In the application:
@Override
protected IConverterLocator newConverterLocator() {
ConverterLocator converterLocator = new ConverterLocator();
converterLocator.set(Provincia.class, new
ProvinciaEntryConverter());
return converterLocator;
}


It seems that it calls converter when setting the modelObject -> So it
converts from Provincia to String. 

But it does not when doing the oposite. Getting model does not get
converted from String to provincia.

This side of the converter never gets called.

For a shake of completeness:

The rederer.

provinciaChoice.setChoiceRenderer(new 
IChoiceRenderer(){

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

@Override
public Object getDisplayValue(Provincia provincia) {
return provincia.getDescripcion();
}

@Override
public String getIdValue(Provincia provincia, int 
index) {
return String.valueOf(provincia.getId());
}
});

Where is the problem?

I think that onSelectionChanged in DropDownChoice should call converter.

/**
 * Called when a selection changes.
 */
public final void onSelectionChanged()
{
convertInput();
updateModel();
onSelectionChanged(getModelObject());
}






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



Re: onSelectionChanged is not calling converters

2012-07-15 Thread Gonzalo Aguilar Delgado
Hi Sven, 

I'm sorry. I forgot to add this to the mailing list:

I added info to the bug filled by other user.

https://issues.apache.org/jira/browse/WICKET-4353


Forget this e-mail as this is followed in the bug tracking system.

Thank you Sven.


El lun, 14-05-2012 a las 20:38 +0200, Sven Meier escribió:

> Hi,
> 
> DropDownChoice doesn't use converters, that's intended.
> 
> What default model is your choice getting/setting values from/to? Do you 
> use a CompoundPropertyModel?
> 
> Sven
> 
> 
> On 05/14/2012 05:59 PM, Gonzalo Aguilar Delgado wrote:
> > Hello,
> >
> > I've just found working with 1.5.6 that DropDownChoice control that it
> > may be not calling Converters.
> >
> > Because the model is still a string while calling to
> > onSelectionChanged(Provincia provincia) and it fails:
> >
> >  Caused by: java.lang.ClassCastException: java.lang.String cannot be
> > cast to generated.Provincia
> >
> > I have something like this:
> >
> > DropDownChoice  provinciaChoice=new
> > DropDownChoice("provincia",new WSProvinceModel()){
> >  ...
> > protected void onSelectionChanged(Provincia provincia) {
> >  if(provincia!=null)
> >  {
> > if(cityModel!=null)
> > 
> > cityModel.setProvinceId(provincia.getId().toString());
> >  }
> > }
> >
> > ...
> > };
> >
> >
> > ---
> >
> > In the application:
> >  @Override
> >  protected IConverterLocator newConverterLocator() {
> >  ConverterLocator converterLocator = new ConverterLocator();
> >  converterLocator.set(Provincia.class, new
> > ProvinciaEntryConverter());
> >  return converterLocator;
> >  }
> >
> >
> > It seems that it calls converter when setting the modelObject ->  So it
> > converts from Provincia to String.
> >
> > But it does not when doing the oposite. Getting model does not get
> > converted from String to provincia.
> >
> > This side of the converter never gets called.
> >
> > For a shake of completeness:
> >
> > The rederer.
> >
> > provinciaChoice.setChoiceRenderer(new 
> > IChoiceRenderer(){
> >
> > /**
> >  *
> >  */
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > public Object getDisplayValue(Provincia provincia) {
> > return provincia.getDescripcion();
> > }
> >
> > @Override
> > public String getIdValue(Provincia provincia, int 
> > index) {
> > return String.valueOf(provincia.getId());
> > }
> > });
> >
> > Where is the problem?
> >
> > I think that onSelectionChanged in DropDownChoice should call converter.
> >
> > /**
> >  * Called when a selection changes.
> >  */
> > public final void onSelectionChanged()
> > {
> > convertInput();
> > updateModel();
> > onSelectionChanged(getModelObject());
> > }
> >
> >
> >
> >
> >
> >
> > -
> > 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
> 


body tag contributions with wicket 1.5 (Dojo needs it)

2011-03-02 Thread Gonzalo Aguilar Delgado
Hello, 

I'm building a wiJQuery equivalent for Dojo. And it seems to work nice
with new wicket 1.5. HeaderContributions are really nice... Great work!

But I ran into problems when trying to setup the themes. 

I have to put something like this in the body:





But I rode a lot and discovered that wicket no longer supports
contributing to body because onLoad handler as well others.

Reading in forums I found the BodyTagAttributeModifier but you need a
panel that I wont have.

And the:

 

add(new WebMarkupContainer("body"){
@Override
public boolean isTransparentResolver() {
return true;
}
@Override
protected void onComponentTag(ComponentTag tag) {
tag.put("class",  "somestyle");
}
}); 
It will not work because wicket:id attribute removed from body in version 1.5.


So... What's they way to go?


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



Re: body tag contributions with wicket 1.5 (Dojo needs it)

2011-03-03 Thread Gonzalo Aguilar Delgado
Hello Matt,

It does not work as I cannot override add method from webmarkupcontainer.

Even if it works I will have to add something to the htlm. Right?


Tnx again

Matt Brictson  wrote:

>Since isTransparentResolver() is going away in 1.5, the trick that I found is 
>to create a normal WebMarkupContainer for the  element, then override 
>add(Component...) of the page to mimic the transparent resolver feature.
>
>Your pages can then contribute to the  element by adding 
>AttributeModifier, etc. to the WebMarkupContainer.
>
>See:
><https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-MarkupContainer.isTransparentResolver%2528%2529removed>
>
>Here's an example:
>
>public abstract class BasePage extends WebPage
>{
>private WebMarkupContainer _body;
>
>public BasePage(PageParameters params)
>{
>super(params);
>
>// Allow subclasses to register CSS classes on the body tag
>WebMarkupContainer body = new WebMarkupContainer("body");
>body.setOutputMarkupId(true);
>add(body);
>
>// From now on add() will add to _body instead of page
>this._body = body;
>}
>
>/**
> * Return a component that represents the {@code } of the page.
> * Use this to add CSS classes or set the markup ID for styling purposes.
> */
>public WebMarkupContainer getBody()
>{
>return _body;
>}
>
>/**
> * When subclasses of BasePage add components to the page, in reality
> * they need to be added as children of the {@code } container.
> * This implementation ensures the page hierarchy is correctly enforced.
> * 
> * @return {@code this} to allow chaining
> */
>@Override
>public BasePage add(Component... childs)
>{
>for(Component c : childs)
>{
>// Wicket automatically translates  into an
>// HtmlHeaderContainer and adds it to the page. Make sure this
>// is registered as a direct child of the page itself, not the
>// body.
>if(null == _body || c instanceof HtmlHeaderContainer)
>{
>super.add(c);
>}
>// Everything else goes into the .
>else
>{
>_body.add(c);
>}
>}
>return this;
>}
>}
>
>-- 
>Matt
>
>On Mar 2, 2011, at 11:35 AM, Gonzalo Aguilar Delgado wrote:
>
>> Hello, 
>> 
>> I'm building a wiJQuery equivalent for Dojo. And it seems to work nice
>> with new wicket 1.5. HeaderContributions are really nice... Great work!
>> 
>> But I ran into problems when trying to setup the themes. 
>> 
>> I have to put something like this in the body:
>> 
>> 
>> 
>> 
>> 
>> But I rode a lot and discovered that wicket no longer supports
>> contributing to body because onLoad handler as well others.
>> 
>> Reading in forums I found the BodyTagAttributeModifier but you need a
>> panel that I wont have.
>> 
>> And the:
>> 
>>  
>> 
>>add(new WebMarkupContainer("body"){
>>@Override
>>public boolean isTransparentResolver() {
>>return true;
>>}
>>@Override
>>protected void onComponentTag(ComponentTag tag) {
>>tag.put("class",  "somestyle");
>>}
>>}); 
>> It will not work because wicket:id attribute removed from body in version 
>> 1.5.
>> 
>> 
>> So... What's they way to go?
>> 
>> 
>> -
>> 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: body tag contributions with wicket 1.5 (Dojo needs it)

2011-03-03 Thread Gonzalo Aguilar Delgado
Hi Martin,

I will try the IMarkupFilter approach.

The problem with Matt approach  is not in the body component but in BasePage of 
the Matt example. 

Since Webpage inherits from MarkupContainer I cannot override the add method to 
add childs to body component instead of the page. So this approach will not 
work. 


Tnx a lot

Martin Grigorov  wrote:

>Hi,
>
>you may use TransparentWebMarkupContainer for the body.
>Or create your own IMarkupFilter that adds a Behavior to the  open
>tag, and this behavior appends/sets the class attribute depending on the
>user session or whatever the Dojo theme depends on.
>See org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler for
>example.
>
>
>On Thu, Mar 3, 2011 at 12:15 PM, Gonzalo Aguilar Delgado <
>gagui...@aguilardelgado.com> wrote:
>
>> Hello Matt,
>>
>> It does not work as I cannot override add method from webmarkupcontainer.
>>
>> Even if it works I will have to add something to the htlm. Right?
>>
>>
>> Tnx again
>>
>> Matt Brictson  wrote:
>>
>> >Since isTransparentResolver() is going away in 1.5, the trick that I found
>> is to create a normal WebMarkupContainer for the  element, then
>> override add(Component...) of the page to mimic the transparent resolver
>> feature.
>> >
>> >Your pages can then contribute to the  element by adding
>> AttributeModifier, etc. to the WebMarkupContainer.
>> >
>> >See:
>> ><
>> https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-MarkupContainer.isTransparentResolver%2528%2529removed
>> >
>> >
>> >Here's an example:
>> >
>> >public abstract class BasePage extends WebPage
>> >{
>> >private WebMarkupContainer _body;
>> >
>> >public BasePage(PageParameters params)
>> >{
>> >super(params);
>> >
>> >// Allow subclasses to register CSS classes on the body tag
>> >WebMarkupContainer body = new WebMarkupContainer("body");
>> >body.setOutputMarkupId(true);
>> >add(body);
>> >
>> >// From now on add() will add to _body instead of page
>> >this._body = body;
>> >}
>> >
>> >/**
>> > * Return a component that represents the {@code } of the page.
>> > * Use this to add CSS classes or set the markup ID for styling
>> purposes.
>> > */
>> >public WebMarkupContainer getBody()
>> >{
>> >return _body;
>> >}
>> >
>> >/**
>> > * When subclasses of BasePage add components to the page, in reality
>> > * they need to be added as children of the {@code } container.
>> > * This implementation ensures the page hierarchy is correctly
>> enforced.
>> > *
>> > * @return {@code this} to allow chaining
>> > */
>> >@Override
>> >public BasePage add(Component... childs)
>> >{
>> >for(Component c : childs)
>> >{
>> >// Wicket automatically translates  into an
>> >// HtmlHeaderContainer and adds it to the page. Make sure this
>> >// is registered as a direct child of the page itself, not the
>> >// body.
>> >if(null == _body || c instanceof HtmlHeaderContainer)
>> >{
>> >super.add(c);
>> >}
>> >// Everything else goes into the .
>> >else
>> >{
>> >_body.add(c);
>> >}
>> >}
>> >return this;
>> >}
>> >}
>> >
>> >--
>> >Matt
>> >
>> >On Mar 2, 2011, at 11:35 AM, Gonzalo Aguilar Delgado wrote:
>> >
>> >> Hello,
>> >>
>> >> I'm building a wiJQuery equivalent for Dojo. And it seems to work nice
>> >> with new wicket 1.5. HeaderContributions are really nice... Great work!
>> >>
>> >> But I ran into problems when trying to setup the themes.
>> >>
>> >> I have to put something like this in the body:
>> >>
>> >> 
>> >>
>> >> 
>> >>
>> >> But I rode a lot and discovered that wicket no longer supports
>> >> contributing to body because onLoad handler as well others.
>> >>
>> >> Reading i

Re: [1.5.0-rc2] possible bug with danish characters

2011-03-03 Thread Gonzalo Aguilar Delgado
Hi


Will try it.

Is there a complete example with the html in place there?

Tnx


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



Re: [1.5.0-rc2] possible bug with danish characters

2011-03-03 Thread Gonzalo Aguilar Delgado
Have you tried 1.5?


-- 


  Gonzalo Aguilar Delgado
  Consultor CRM - Ingeniero en
Informática

M. +34 607 81 42 76



"No subestimes el poder de la gente estúpida en grupos grandes" 

El jue, 03-03-2011 a las 20:09 +0200, Martin Grigorov escribió:

> trunk from today runs at http://www.wicket-library.com/wicket-examples
> 
> On Wed, Mar 2, 2011 at 9:21 PM, nino martinez wael <
> nino.martinez.w...@gmail.com> wrote:
> 
> > is there a server somewhere where rc2 live examples are running on?
> >
> >
> > 2011/3/2 Martin Grigorov 
> >
> > > quickstart will help us to debug it.
> > > attach it to jira
> > > thanks!
> > >
> > > On Wed, Mar 2, 2011 at 3:16 PM, nino martinez wael <
> > > nino.martinez.w...@gmail.com> wrote:
> > >
> > > > anyone have an idea why changing from rc1 to rc2 would have an have an
> > > > impact on this..? There was no issue that looked related to me (in the
> > > > change log).
> > > >
> > > > 2011/3/2 nino martinez wael 
> > > >
> > > > > Charset are UTF8... Anyhow there's no problem on rc1..
> > > > >
> > > > > 2011/3/2 Wilhelmsen Tor Iver 
> > > > >
> > > > > > I just noticed that after upgrading to rc2, my some of my texts
> > like
> > > > >> > "håndteret kald" when getting saved/posted becomes this:
> > "håndteret
> > > > >> kald"..
> > > > >>
> > > > >> Charset issue, they get posted as UTF-8; you probably  either need
> > to
> > > > test
> > > > >> for charset or assume UTF-8 across the board.
> > > > >>
> > > > >> - Tor Iver
> > > > >>
> > > > >>
> > -
> > > > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > > >> For additional commands, e-mail: users-h...@wicket.apache.org
> > > > >>
> > > > >>
> > > > >
> > > >
> > >
> >


Re: body tag contributions with wicket 1.5 (Dojo needs it)

2011-03-03 Thread Gonzalo Aguilar Delgado
Martin, 

I tried the filter and the filter runs quite well but no change on the
tag... Everything remains the same.

Do you see something wrong? It also runs several times, not just one.
One for each component that has body in it's html. I suppose that is
normal Right? But how to know which one is the one that is going to be
rendered? The others are discarded...

Thank you.


package com.level2.dojo.core.commons.filter;

import java.text.ParseException;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.behavior.AbstractBehavior;
import org.apache.wicket.behavior.IBehavior;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupElement;
import org.apache.wicket.markup.parser.AbstractMarkupFilter;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.IRequestCodingStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DojoBodyMarkupFilter extends AbstractMarkupFilter {
/** Logger */
private static final Logger log =
LoggerFactory.getLogger(DojoBodyMarkupFilter.class);

/**
 * Behavior that adds a prefix to src, href and background
attributes to
make them
 * context-relative
 */
public static final IBehavior RELATIVE_PATH_BEHAVIOR = new
AbstractBehavior()
{
private static final long serialVersionUID = 1L;

@Override
public void onComponentTag(Component component,
ComponentTag tag)
{
IRequestCodingStrategy coder =
RequestCycle.get()
.getProcessor()
.getRequestCodingStrategy();

// Modify all relevant attributes
String attrName = "class";
String attrValue =
tag.getAttributes().getString(attrName);
attrValue = "mytest";
tag.getAttributes().put(attrName,
coder.rewriteStaticRelativeUrl(attrValue));
}
};

public MarkupElement nextTag() throws ParseException {
// Get next tag. Null, if no more tag available
final ComponentTag tag =
(ComponentTag)getParent().nextTag();
if (tag == null)
{
return tag;
}

// For all  tags which probably change
the
// current autolink status.
if (tag.getName().equals("body"))
{

// Beginning of the region
if (tag.isOpen() || tag.isOpenClose())
{
if (tag.isOpen())
{
//
log.debug("Tag: " +
tag.getName() + " Will add new class " +
tag.getId());

tag.addBehavior(RELATIVE_PATH_BEHAVIOR);
tag.setModified(true);
}

}
else if (tag.isClose())
{

}
}

        return tag;
}

}





-- 


  Gonzalo Aguilar Delgado
  Consultor CRM - Ingeniero en
Informática

M. +34 607 81 42 76



"No subestimes el poder de la gente estúpida en grupos grandes" 

El jue, 03-03-2011 a las 12:39 +0200, Martin Grigorov escribió:

> Hi,
> 
> you may use TransparentWebMarkupContainer for the body.
> Or create your own IMarkupFilter that adds a Behavior to the  open
> tag, and this behavior appends/sets the class attribute depending on the
> user session or whatever the Dojo theme depends on.
> See org.apache.wicket.markup.parser.filter.RelativePathPrefixHandler for
> example.
> 
> 
> On Thu, Mar 3, 2011 at 12:15 PM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> > Hello Matt,
> >
> > It does not work as I cannot override add method from webmarkupcontainer.
> >
> > Even if it works I will have to add something to the htlm. Right?
> >
> >
> > Tnx again
> >
> > Matt Brictson  wrote:
> >
> > >Since isTransparentResolver() is going away in 1.5, the trick that I found
> > is to create a normal WebMarkupContainer for the  element, then
> > override add(Component...) of the page to mimic the transparent resolver
> > feature.
> > >
> > >Your pages can then contribute to the  element by add

Re: body tag contributions with wicket 1.5 (Dojo needs it)

2011-03-04 Thread Gonzalo Aguilar Delgado
Yes I did it.

It runs as I told but does not change body

Martin Grigorov  wrote:

>Did you register this custom markup filter ?
>See org.apache.wicket.markup.MarkupParserFactory javadoc to see how to do
>it.
>
>On Fri, Mar 4, 2011 at 8:08 AM, Gonzalo Aguilar Delgado <
>gagui...@aguilardelgado.com> wrote:
>
>> Martin,
>>
>> I tried the filter and the filter runs quite well but no change on the
>> tag... Everything remains the same.
>>
>> Do you see something wrong? It also runs several times, not just one.
>> One for each component that has body in it's html. I suppose that is
>> normal Right? But how to know which one is the one that is going to be
>> rendered? The others are discarded...
>>
>> Thank you.
>>
>>
>> package com.level2.dojo.core.commons.filter;
>>
>> import java.text.ParseException;
>>
>> import org.apache.wicket.AttributeModifier;
>> import org.apache.wicket.Component;
>> import org.apache.wicket.RequestCycle;
>> import org.apache.wicket.behavior.AbstractBehavior;
>> import org.apache.wicket.behavior.IBehavior;
>> import org.apache.wicket.markup.ComponentTag;
>> import org.apache.wicket.markup.MarkupElement;
>> import org.apache.wicket.markup.parser.AbstractMarkupFilter;
>> import org.apache.wicket.model.Model;
>> import org.apache.wicket.request.IRequestCodingStrategy;
>> import org.slf4j.Logger;
>> import org.slf4j.LoggerFactory;
>>
>> public class DojoBodyMarkupFilter extends AbstractMarkupFilter {
>>/** Logger */
>>private static final Logger log =
>> LoggerFactory.getLogger(DojoBodyMarkupFilter.class);
>>
>>/**
>> * Behavior that adds a prefix to src, href and background
>> attributes to
>> make them
>> * context-relative
>> */
>>public static final IBehavior RELATIVE_PATH_BEHAVIOR = new
>> AbstractBehavior()
>>{
>>private static final long serialVersionUID = 1L;
>>
>>@Override
>>public void onComponentTag(Component component,
>> ComponentTag tag)
>>{
>>IRequestCodingStrategy coder =
>> RequestCycle.get()
>>.getProcessor()
>>.getRequestCodingStrategy();
>>
>>// Modify all relevant attributes
>>String attrName = "class";
>>String attrValue =
>> tag.getAttributes().getString(attrName);
>>attrValue = "mytest";
>>tag.getAttributes().put(attrName,
>> coder.rewriteStaticRelativeUrl(attrValue));
>>
>This rewrite is not needed. Just use the value.
>
>>}
>>};
>>
>>public MarkupElement nextTag() throws ParseException {
>>// Get next tag. Null, if no more tag available
>>final ComponentTag tag =
>> (ComponentTag)getParent().nextTag();
>>if (tag == null)
>>{
>>return tag;
>>}
>>
>>// For all  tags which probably change
>> the
>>// current autolink status.
>>if (tag.getName().equals("body"))
>>{
>>
>>// Beginning of the region
>>if (tag.isOpen() || tag.isOpenClose())
>>{
>>if (tag.isOpen())
>>{
>>        //
>>log.debug("Tag: " +
>> tag.getName() + " Will add new class " +
>> tag.getId());
>>
>>  tag.addBehavior(RELATIVE_PATH_BEHAVIOR);
>>tag.setModified(true);
>>}
>>
>>}
>>else if (tag.isClose())
>>{
>>
>>}
>>}
>>
>>return tag;
>>}
>>
>> }
>>
>>
>>
>>
>>
>> --
>>
>>
>>  Gonzalo Aguilar Delgado
>>  Consultor CRM - Ingeniero en
>> Informática
>>
>&

Re: body tag contributions with wicket 1.5 (Dojo needs it)

2011-03-13 Thread Gonzalo Aguilar Delgado
Hi Martin, 

I did it and finally found what was the problem. It was needed another
thing... The MarkupFilter to resolve the ID. 

The idea is that I had to change the component id to make wicket not
parse as raw tag. Becasuse it was a raw tag when used as .

The current effect is that I had to do something like:

public class DojoBodyMarkupFilter extends AbstractMarkupFilter  
implements IComponentResolver
{
...
public static final String DOJO_BODY_COMPONENT_ID =
"_dojo_body_prefix_";

...

public MarkupElement nextTag() throws ParseException {
...

tag.setId(DOJO_BODY_COMPONENT_ID);
tag.setAutoComponentTag(true); 
/// Why?
tag.addBehavior(new AttributeModifier("class", true, 
new Model(name)));
tag.setModified(true);
...
}
}

---

And I had an initializer that does as following:


// FIXME: Ugly hack to be able to control body tag on render.
application.getMarkupSettings().setMarkupParserFactory(
   new DojoMarkupParserFactory());

// FIXME: We need this to be able to substitute the body tag with a
markup container
application.getPageSettings().addComponentResolver(new
DojoBodyMarkupFilter());


So at the end you have three parts:

 1.- Parser Factory
 2.- Markup Filter
 3.- Component resolver


With these three it works flawlessly. I have to check it more though.


Thank you you all!

Please let me any comments or give me a touch if you need help with
this...
gagui...@aguilardelgado.com




-- 


  Gonzalo Aguilar Delgado
  Consultor CRM - Ingeniero en
Informática
M. +34 607 81 42 76


"No subestimes el poder de la gente estúpida en grupos grandes" 

El vie, 04-03-2011 a las 10:44 +0200, Martin Grigorov escribió:
> Run the debugger and see what happens.
> 
> On Fri, Mar 4, 2011 at 10:42 AM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> > Yes I did it.
> >
> > It runs as I told but does not change body
> >
> > Martin Grigorov  wrote:
> >
> > >Did you register this custom markup filter ?
> > >See org.apache.wicket.markup.MarkupParserFactory javadoc to see how to do
> > >it.
> > >
> > >On Fri, Mar 4, 2011 at 8:08 AM, Gonzalo Aguilar Delgado <
> > >gagui...@aguilardelgado.com> wrote:
> > >
> > >> Martin,
> > >>
> > >> I tried the filter and the filter runs quite well but no change on the
> > >> tag... Everything remains the same.
> > >>
> > >> Do you see something wrong? It also runs several times, not just one.
> > >> One for each component that has body in it's html. I suppose that is
> > >> normal Right? But how to know which one is the one that is going to be
> > >> rendered? The others are discarded...
> > >>
> > >> Thank you.
> > >>
> > >>
> > >> package com.level2.dojo.core.commons.filter;
> > >>
> > >> import java.text.ParseException;
> > >>
> > >> import org.apache.wicket.AttributeModifier;
> > >> import org.apache.wicket.Component;
> > >> import org.apache.wicket.RequestCycle;
> > >> import org.apache.wicket.behavior.AbstractBehavior;
> > >> import org.apache.wicket.behavior.IBehavior;
> > >> import org.apache.wicket.markup.ComponentTag;
> > >> import org.apache.wicket.markup.MarkupElement;
> > >> import org.apache.wicket.markup.parser.AbstractMarkupFilter;
> > >> import org.apache.wicket.model.Model;
> > >> import org.apache.wicket.request.IRequestCodingStrategy;
> > >> import org.slf4j.Logger;
> > >> import org.slf4j.LoggerFactory;
> > >>
> > >> public class DojoBodyMarkupFilter extends AbstractMarkupFilter {
> > >>/** Logger */
> > >>private static final Logger log =
> > >> LoggerFactory.getLogger(DojoBodyMarkupFilter.class);
> > >>
> > >>/**
> > >> * Behavior that adds a prefix to src, href and background
> > >> attributes to
> > >> make them
> > >> * context-relative
> > >> */
> > >>public static final IBehavior RELATIVE_PATH_BEHAVIOR = new
> > >> AbstractBehavior()
> > >>{
> > >>private static final long serialVersionUID = 1L;
> > >>
> > >>@Override
> > >>public void onComponentTag(Component component,
> > >> ComponentTag tag)
> > >>{
> > >> 

wicket-dojo project (Should I change project name?)

2011-03-13 Thread Gonzalo Aguilar Delgado
Hi all, 

I started a new project to give support for dojo to the current wicket
base 1.5.

I don't know if it will reach much far but wanted to revamp the dojo
support in wicket. I have not much time but will try to add widgets and
more support when I need it in my projects.

This is why I asked several times last week. I took as base excelent
wiquery+wicket examples projects and refactored them do give it dojo
ability. Looks nice! :-) 


At current time is fairly easy to implement new widgets. I just added
two partially implemented with theme support included. A standard button
and the editor. I have to cleanup the code but as you can see is easy to
use and extend. It has wiquery comments inside. Should I remove it? But
I want to give credits to the original authors...


Please, any comments will be welcome. 


http://gitorious.org/wicket-dojo



PS: Sorry If I should not say this here... Tell me and I will shut any
comments about it but I think it will be useful for the wicket
community.



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



Re: wicket-dojo project (Should I change project name?)

2011-03-13 Thread Gonzalo Aguilar Delgado
Hi Martin, 

Yes I knew about this but I thought it was obsolete. I tried to use some
time ago but it didn't worked. Also was a little bit difficult to
implement.


But I will take a reload to see if something can be commited/added.
Maybe this project is not needed if now dojo of wicketstuff works!

:D

Thank you!!! I will keep an eye on it.

Best regards,





"No subestimes el poder de la gente estúpida en grupos grandes" 

El dom, 13-03-2011 a las 18:35 +0200, Martin Grigorov escribió:
> Congratulations Gonzalo!
> 
> Dojo is also my choice of JS library. I hope one day to use your project ;-)
> Until then keep the good work and add more components.
> 
> I understand you're trying to reuse the good parts of WiQuery (I'm not
> saying there are bad parts) but I want to mention
> https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/dojo-parent as
> well. I'm not sure whether you know or not. This project has been done with
> Dojo 0.4 and Wicket 1.(2|3) and then partially upgrated to Dojo 1.1 and
> Wicket 1.(4|5).
> 
> And yes - this mailing list is the right place for such announcements and
> discussions!
> 
> On Sun, Mar 13, 2011 at 4:01 PM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> > Hi all,
> >
> > I started a new project to give support for dojo to the current wicket
> > base 1.5.
> >
> > I don't know if it will reach much far but wanted to revamp the dojo
> > support in wicket. I have not much time but will try to add widgets and
> > more support when I need it in my projects.
> >
> > This is why I asked several times last week. I took as base excelent
> > wiquery+wicket examples projects and refactored them do give it dojo
> > ability. Looks nice! :-)
> >
> >
> > At current time is fairly easy to implement new widgets. I just added
> > two partially implemented with theme support included. A standard button
> > and the editor. I have to cleanup the code but as you can see is easy to
> > use and extend. It has wiquery comments inside. Should I remove it? But
> > I want to give credits to the original authors...
> >
> >
> > Please, any comments will be welcome.
> >
> >
> > http://gitorious.org/wicket-dojo
> >
> >
> >
> > PS: Sorry If I should not say this here... Tell me and I will shut any
> > comments about it but I think it will be useful for the wicket
> > community.
> >
> >
> >
> > -
> > 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: New Wicket tutorial series

2011-03-13 Thread Gonzalo Aguilar Delgado
Nice work Tomasz!!!



El sáb, 12-03-2011 a las 22:04 +0100, Tomasz Dziurko escribió:
> Hello.
> 
> As I am using Wicket for over two years, some time ago I decided to start
> sharing my knowledge and write tutorial where I am showing process of
> creating Wicket application from scratch. Actually tutorial has six parts
> and can be viewed here:
> 
> http://tomaszdziurko.pl/2011/03/wicket-tutorial-series-building-web-application-scratch/
> 
> As this is a my first tutorial, every comment or feedback how can I make it
> better and more useful is more than welcome :)
> 


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



Re: wicket-dojo project (Should I change project name?)

2011-05-31 Thread Gonzalo Aguilar Delgado
Hi Martin, 

I need time to organize projects, but sure I can merge everything and
find best way to do things.

Just need some time and give my projects a little breath.

Thank you for the update.

-- 



"No subestimes el poder de la gente estúpida en grupos grandes" 

El dom, 13-03-2011 a las 21:25 +0200, Martin Grigorov escribió:
> Hi,
> 
> On Sun, Mar 13, 2011 at 9:04 PM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> > Hi Martin,
> >
> > Yes I knew about this but I thought it was obsolete. I tried to use some
> > time ago but it didn't worked. Also was a little bit difficult to
> > implement.
> 
> 
> > But I will take a reload to see if something can be commited/added.
> > Maybe this project is not needed if now dojo of wicketstuff works!
> >
> > Actually it is in the same state... The project has some nice features -
> like automatic download of Dojo distribution, easy way to declare Dojo
> dependencies (dojo.require()'s),  All it need is a new maintainer.
> I just committed a README file which contains a link to the last known
> working example of wicketstuff-dojo-1.1
> If you decide to give it a go then you may download this example and add it
> as a subproject in dojo-parent.
> 
> 
> > :D
> >
> > Thank you!!! I will keep an eye on it.
> >
> > Best regards,
> >
> >
> >
> >
> >
> > "No subestimes el poder de la gente estúpida en grupos grandes"
> >
> > El dom, 13-03-2011 a las 18:35 +0200, Martin Grigorov escribió:
> > > Congratulations Gonzalo!
> > >
> > > Dojo is also my choice of JS library. I hope one day to use your project
> > ;-)
> > > Until then keep the good work and add more components.
> > >
> > > I understand you're trying to reuse the good parts of WiQuery (I'm not
> > > saying there are bad parts) but I want to mention
> > >
> > https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/dojo-parentas
> > > well. I'm not sure whether you know or not. This project has been done
> > with
> > > Dojo 0.4 and Wicket 1.(2|3) and then partially upgrated to Dojo 1.1 and
> > > Wicket 1.(4|5).
> > >
> > > And yes - this mailing list is the right place for such announcements and
> > > discussions!
> > >
> > > On Sun, Mar 13, 2011 at 4:01 PM, Gonzalo Aguilar Delgado <
> > > gagui...@aguilardelgado.com> wrote:
> > >
> > > > Hi all,
> > > >
> > > > I started a new project to give support for dojo to the current wicket
> > > > base 1.5.
> > > >
> > > > I don't know if it will reach much far but wanted to revamp the dojo
> > > > support in wicket. I have not much time but will try to add widgets and
> > > > more support when I need it in my projects.
> > > >
> > > > This is why I asked several times last week. I took as base excelent
> > > > wiquery+wicket examples projects and refactored them do give it dojo
> > > > ability. Looks nice! :-)
> > > >
> > > >
> > > > At current time is fairly easy to implement new widgets. I just added
> > > > two partially implemented with theme support included. A standard
> > button
> > > > and the editor. I have to cleanup the code but as you can see is easy
> > to
> > > > use and extend. It has wiquery comments inside. Should I remove it? But
> > > > I want to give credits to the original authors...
> > > >
> > > >
> > > > Please, any comments will be welcome.
> > > >
> > > >
> > > > http://gitorious.org/wicket-dojo
> > > >
> > > >
> > > >
> > > > PS: Sorry If I should not say this here... Tell me and I will shut any
> > > > comments about it but I think it will be useful for the wicket
> > > > community.
> > > >
> > > >
> > > >
> > > > -
> > > > 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
> >
> >
> 
> 


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



While dojo project is still alpha status I want to say something about scaffolding in wicket

2011-05-31 Thread Gonzalo Aguilar Delgado
Hi again, 

too many things are going on. But I don't want to lose the oportunity to
let people join or upgrade what we are building. 

I've just created another project that uses wicket-dojo so I can test
features in a real project. I have to upload the code to gitorious.org
https://gitorious.org/wscaffold

But I created a small intro about what I'm doing:
http://level2crm.com/content/building-scaffoldling-wicket

Hope someone else can help me or propose advances.

I want also migrate all to 1.5 but it takes time... :D





"No subestimes el poder de la gente estúpida en grupos grandes" 



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



Re: While dojo project is still alpha status I want to say something about scaffolding in wicket

2011-05-31 Thread Gonzalo Aguilar Delgado
Hi James, 

I was looking for a lng time for scaffolding and found nothing. I
need to take a review to wicketopia to see what it offers.

Thank you a lot for the update.



"No subestimes el poder de la gente estúpida en grupos grandes" 

El mar, 31-05-2011 a las 10:21 -0400, James Carman escribió:
> Wicketopia has a scaffold component already.  Perhaps we can use some
> of your ideas to enhance it?
> 
> On Tue, May 31, 2011 at 9:41 AM, Gonzalo Aguilar Delgado
>  wrote:
> > Hi again,
> >
> > too many things are going on. But I don't want to lose the oportunity to
> > let people join or upgrade what we are building.
> >
> > I've just created another project that uses wicket-dojo so I can test
> > features in a real project. I have to upload the code to gitorious.org
> > https://gitorious.org/wscaffold
> >
> > But I created a small intro about what I'm doing:
> > http://level2crm.com/content/building-scaffoldling-wicket
> >
> > Hope someone else can help me or propose advances.
> >
> > I want also migrate all to 1.5 but it takes time... :D
> >
> >
> >
> >
> >
> > "No subestimes el poder de la gente estúpida en grupos grandes"
> >
> >
> >
> > -
> > 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
> 


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



Re: While dojo project is still alpha status I want to say something about scaffolding in wicket

2011-06-01 Thread Gonzalo Aguilar Delgado
Hi James, 
Looks pretty good!!! It's nice that you build it with plugins in mind. I
want to check source code to see details of the implementation.

Does it took long to program it? Do you think you will maintain it for
long time?

I cannot run the application because compile problems (need maven3).

Does it support ajax?

Do you have binaries? So I can download a package and give it a try in
my tomcat...

Sorry for posting lots of questions but it's first time I see a serious
approach to scaffolding with wicket. I'm pretty excited.

I will take a look to the code to see if it fits to my projects. Will be
nice to join this nice piece of code.

Thank you again.




"No subestimes el poder de la gente estúpida en grupos grandes" 

El mar, 31-05-2011 a las 15:43 -0400, James Carman escribió:
> Download the example application and run it and you can see it in action
> On May 31, 2011 11:36 AM, "Gonzalo Aguilar Delgado" <
> gagui...@aguilardelgado.com> wrote:
> > Hi James,
> >
> > I was looking for a lng time for scaffolding and found nothing. I
> > need to take a review to wicketopia to see what it offers.
> >
> > Thank you a lot for the update.
> >
> >
> >
> > "No subestimes el poder de la gente estúpida en grupos grandes"
> >
> > El mar, 31-05-2011 a las 10:21 -0400, James Carman escribió:
> >> Wicketopia has a scaffold component already. Perhaps we can use some
> >> of your ideas to enhance it?
> >>
> >> On Tue, May 31, 2011 at 9:41 AM, Gonzalo Aguilar Delgado
> >>  wrote:
> >> > Hi again,
> >> >
> >> > too many things are going on. But I don't want to lose the oportunity
> to
> >> > let people join or upgrade what we are building.
> >> >
> >> > I've just created another project that uses wicket-dojo so I can test
> >> > features in a real project. I have to upload the code to gitorious.org
> >> > https://gitorious.org/wscaffold
> >> >
> >> > But I created a small intro about what I'm doing:
> >> > http://level2crm.com/content/building-scaffoldling-wicket
> >> >
> >> > Hope someone else can help me or propose advances.
> >> >
> >> > I want also migrate all to 1.5 but it takes time... :D
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > "No subestimes el poder de la gente estúpida en grupos grandes"
> >> >
> >> >
> >> >
> >> > -
> >> > 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
> >>
> >
> >
> > -
> > 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: While dojo project is still alpha status I want to say something about scaffolding in wicket

2011-06-01 Thread Gonzalo Aguilar Delgado
Hi again James,

Your project looks good. Clean code, modular, well organized. I got a
little bit confused about the PropertyComponentFactory. I cannot find
where you define the right provider... Was looking into configuration.

In the code it takes to an interface. But not implementation, I looked
around and seem to find one. 

The idea is great, everything is pluggable. Even property editors as I
can see in the example.

The use of your other library, metastopheles, is good enough. The
problem with it will be automatic detection of links (foreign keys) to
other clases, specific database types and so on. Something that is
resolved just sticking to hibernate metadata (I only want one
persistence engine for now). 

Also I can see that Ajax support is in place but limited.

Will you discuss about integrating it with dojo libraries?

Thank you again.





"No subestimes el poder de la gente estúpida en grupos grandes" 

El mar, 31-05-2011 a las 15:43 -0400, James Carman escribió:
> Download the example application and run it and you can see it in action
> On May 31, 2011 11:36 AM, "Gonzalo Aguilar Delgado" <
> gagui...@aguilardelgado.com> wrote:
> > Hi James,
> >
> > I was looking for a lng time for scaffolding and found nothing. I
> > need to take a review to wicketopia to see what it offers.
> >
> > Thank you a lot for the update.
> >
> >
> >
> > "No subestimes el poder de la gente estúpida en grupos grandes"
> >
> > El mar, 31-05-2011 a las 10:21 -0400, James Carman escribió:
> >> Wicketopia has a scaffold component already. Perhaps we can use some
> >> of your ideas to enhance it?
> >>
> >> On Tue, May 31, 2011 at 9:41 AM, Gonzalo Aguilar Delgado
> >>  wrote:
> >> > Hi again,
> >> >
> >> > too many things are going on. But I don't want to lose the oportunity
> to
> >> > let people join or upgrade what we are building.
> >> >
> >> > I've just created another project that uses wicket-dojo so I can test
> >> > features in a real project. I have to upload the code to gitorious.org
> >> > https://gitorious.org/wscaffold
> >> >
> >> > But I created a small intro about what I'm doing:
> >> > http://level2crm.com/content/building-scaffoldling-wicket
> >> >
> >> > Hope someone else can help me or propose advances.
> >> >
> >> > I want also migrate all to 1.5 but it takes time... :D
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > "No subestimes el poder de la gente estúpida en grupos grandes"
> >> >
> >> >
> >> >
> >> > -
> >> > 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
> >>
> >
> >
> > -
> > 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: While dojo project is still alpha status I want to say something about scaffolding in wicket

2011-06-02 Thread Gonzalo Aguilar Delgado
Hi James, 

Yes, please, send me a .war. My e-mail has no limit in storage. 

gagui...@aguilardelgado.com





El mié, 01-06-2011 a las 16:34 -0400, James Carman escribió:
> On Wed, Jun 1, 2011 at 2:59 PM, Gonzalo Aguilar Delgado
>  wrote:
> >
> > Does it took long to program it? Do you think you will maintain it for
> > long time?
> >
> 
> I have been working on the idea for a couple of years.
> 
> > I cannot run the application because compile problems (need maven3).
> >
> 
> DOH!  I didn't realize that I made it *require* maven3.  You want me
> to send you a war file for the example application?
> 
> > Does it support ajax?
> >
> 
> The example application, which uses the Scaffold component, is all
> ajax-based.  There are ajax-based components in there that you can use
> for submitting your forms, deleting objects, etc.
> 
> -
> 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: While dojo project is still alpha status I want to say something about scaffolding in wicket

2011-06-02 Thread Gonzalo Aguilar Delgado

Hi James, 

Using dojo it's a very different approach. The idea of using dojo is to
use everything that dojo gives...

I think it has powerfull features:
* Full support for lots of widget (calendar, hour,
autocomplete text fields, etc).
* Theme support. It automagically draws beautiful
widgets with different styles.
* Fully interaction between dojo and wicket. Via ajax.
It's great you can interact without reloading anything.
* Support for mobile devices.


Thought I have some doubts about interaction between your metadata
implementation and the one I have in place. Mainly because what I
explained about the hibernate metadata (that is very robust). It also
support automatic search.

https://github.com/gadLinux/Level2-CLT-Segmentator

It builds a query search for the whole database. Also still in alpha...
I will setup some screenshots so you can see it in action. Have to port
to dojo also. :D

Too many things as I said.

Tnx again.



El mié, 01-06-2011 a las 16:43 -0400, James Carman escribió:
> On Wed, Jun 1, 2011 at 3:41 PM, Gonzalo Aguilar Delgado
>  wrote:
> >
> > Your project looks good. Clean code, modular, well organized. I got a
> > little bit confused about the PropertyComponentFactory. I cannot find
> > where you define the right provider... Was looking into configuration.
> >
> > In the code it takes to an interface. But not implementation, I looked
> > around and seem to find one.
> >
> 
> PropertyComponentFactory isn't something that you'd be implementing as
> an "extender" of the framework most likely.  You'll be adding your own
> property editors.  For an example of how to do that, take a look at
> the Joda stuff probably.
> 
> > The idea is great, everything is pluggable. Even property editors as I
> > can see in the example.
> >
> > The use of your other library, metastopheles, is good enough. The
> > problem with it will be automatic detection of links (foreign keys) to
> > other clases, specific database types and so on. Something that is
> > resolved just sticking to hibernate metadata (I only want one
> > persistence engine for now).
> >
> 
> Right now, Wicketopia doesn't support automatic editing related
> entities.  It's on the to-do list for sure.  Basically, the next big
> thing for Wicketopia would be a "search" abstraction.  Because, to
> find an entity to associate with the entity you're editing, most
> likely you'll be doing some type of search (unless it's just a
> drop-down, but that will not be the case when there are many objects,
> obviously).
> 
> >
> > Will you discuss about integrating it with dojo libraries?
> >
> 
> Sure will!  Alexandros Karypidis is working with me on Wicketopia
> right now.  He showed interest by wicket-1.5-izing Wicketopia, so I
> just gave him access to SVN and let him have at it.  If you want to
> add a dojo module, as long as its scope makes sense to be part of the
> framework itself, I see no reason why you can't be made part of the
> team!  I don't plan on maintaining this thing all by myself.  The more
> the merrier, I say!  We just have to make sure we keep our approach as
> user-focused as possible, because Wicketopia is intended to be used by
> other folks, not just us. :)
> 
> What exactly is it that you want to do with dojo that you can't do
> with the built-in ajax libraries?  Are you thinking of using a
> specific dojo component of some sort?
> 
> -
> 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



setReuseItems(true) + transactions = ERROR

2011-06-02 Thread Gonzalo Aguilar Delgado
Hello, 

I used to refresh all the components in the listview for each http
transaction.

But now I tried to use the:

setReuseItems(true); 

When using a ListView. Documentation says that is a must (but I made it
to work without it).

The problem is that now the objects are serialized and deserialized and
not loaded from database in each http transaction. Result is that I
always get the following error:

Row was updated or deleted by another transaction (or unsaved-value
mapping was incorrect)


How can I avoid this error and use the setReuseItems(true)?

Thank you in advance.


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



Re: setReuseItems(true) + transactions = ERROR

2011-06-03 Thread Gonzalo Aguilar Delgado
Hi Sven, 

Thank you for the update. I will check why they are not detached... They
should.

Tnx again.

-- 


 

"No subestimes el poder de la gente estúpida en grupos grandes" 

El vie, 03-06-2011 a las 09:00 +0200, Sven Meier escribió:
> Hi,
> 
> with resuseItems=true the listview will reuse items *on render*, but 
> this doesn't change whether model objects are serialized into the 
> session or not.
> 
> It rather seems that you're not detaching your models properly. I'd make 
> a wild guess that you keep references to your persistent objects in your 
> row components.
> 
> Best regards
> Sven
> 
> 
> On 06/03/2011 04:56 AM, Gonzalo Aguilar Delgado wrote:
> > Hello,
> >
> > I used to refresh all the components in the listview for each http
> > transaction.
> >
> > But now I tried to use the:
> >
> > setReuseItems(true);
> >
> > When using a ListView. Documentation says that is a must (but I made it
> > to work without it).
> >
> > The problem is that now the objects are serialized and deserialized and
> > not loaded from database in each http transaction. Result is that I
> > always get the following error:
> >
> > Row was updated or deleted by another transaction (or unsaved-value
> > mapping was incorrect)
> >
> >
> > How can I avoid this error and use the setReuseItems(true)?
> >
> > Thank you in advance.
> >
> >
> > -
> > 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
> 


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



Re: setReuseItems(true) + transactions = ERROR

2011-06-03 Thread Gonzalo Aguilar Delgado
EBUG - ibernateTransactionManager - Initiating transaction commit
DEBUG - ibernateTransactionManager - Committing Hibernate transaction on
Session [org.hibernate.impl.SessionImpl@145edcf5]
DEBUG - JDBCTransaction- commit
DEBUG - JDBCTransaction- re-enabling autocommit
DEBUG - JDBCTransaction- committed JDBC Connection
DEBUG - ConnectionManager  - transaction completed on session
with on_close connection release mode; be sure to close the session to
release JDBC resources!
DEBUG - ibernateTransactionManager - Closing Hibernate Session
[org.hibernate.impl.SessionImpl@145edcf5] after transaction
DEBUG - SessionFactoryUtils- Closing Hibernate Session
DEBUG - ConnectionManager  - releasing JDBC connection [ (open
PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG - ConnectionManager  - transaction completed on session
with on_close connection release mode; be sure to close the session to
release JDBC resources!


Why? Because on the new transaction it will not be attached so I cannot
save it. I suppose it must continue with the same transaction that
loaded it.



Thank you in advance.






"No subestimes el poder de la gente estúpida en grupos grandes" 

El vie, 03-06-2011 a las 09:26 +0200, Gonzalo Aguilar Delgado escribió:
> Hi Sven, 
> 
> Thank you for the update. I will check why they are not detached... They
> should.
> 
> Tnx again.
> 


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



Re: setReuseItems(true) + transactions = ERROR

2011-06-03 Thread Gonzalo Aguilar Delgado
Hi James, 

I added it already:
-

openSessionInViewFilter

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter

singleSession
true


sessionFactoryBeanName
opCustomerSessionFactory



...




BasicFormApplication
/basicform/*
REQUEST
INCLUDE


openSessionInViewFilter
/basicform/*
REQUEST
INCLUDE
FORWARD

---

But it has something to do with transactions because the session is
opened. 

It's strange. It used to work... But something I changed made it to
broke. I even saved some objects before contacting you... hehehehe

I messed it up! :D

Any directions on this?





"No subestimes el poder de la gente estúpida en grupos grandes" 

El vie, 03-06-2011 a las 13:59 -0400, James Carman escribió:
> Try using the open session in view filter


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



Re: setReuseItems(true) + transactions = ERROR

2011-06-04 Thread Gonzalo Aguilar Delgado

>Hi,
>are you sure your model is a LDM?

Yes. Sure. Encapsulated by an CompoundPropertyModel.
---
new CompoundPropertyModel(scaffoldableModel)
---
/*
 * Need this because wicket serializes everything and need to 
reload
it when
 * it's needed. This way wicket and hibernate plays well
 */
IModel scaffoldableModel = new
LoadableHibernateModelImpl(getFirst())
{
/**
 * 
 */
private static final long serialVersionUID = 1L;
@SpringBean(name = "leadDAOBean")
private LeadDAO leadDAO;
private UuidUserType uuid;

@Override
protected Lead load() {
Lead lead = null;
if(uuid!=null)
{
lead = leadDAO.find(uuid);

}
return lead;
}

@Override
protected void setNonTransientObject() {
Lead lead =  this.getObject();
if(lead!=null)
uuid = lead.getUuid();
}


};


And...
-
public abstract class LoadableHibernateModelImpl extends
LoadableDetachableModel 
implements LoadableHibernateModel, IModel
-

detach and load got called. So it's working. The problem seems to be
transactions.

I used to reload the model in the onBeforeRender functions. This made
wicked open a transaction that continued until the save. But now I made
things different (more efficient). The problem now is how to get a
transaction run during the model update and save.



>>IIRC you have a ListView involved. What's the type of 
>>this.getDefaultModel() ?

I checked this to make sure is the correct model. What I do is to set a
wrapper around. The component I use extends from panel and inside there
is a form and some other components that must use the model of the
panel. So I wrap it around with CompoundPropertyModel.

---
public ScaffoldingForm(String id, IModel scaffoldableModel) {
//super(id, scaffoldableModel);
super(id, new CompoundPropertyModel(scaffoldableModel));
---

The returning model is the CompoundPropertyModel. So seems to be ok.


Thank you in advance Sven.
I will try to make everything run in a unique transaction. I found this:
http://apache-wicket.1842946.n4.nabble.com/OpenSessionInView-OSIV-LoadableDetachableModel-and-Transactions-td1858513.html

Maybe someone else have any other useful link.

Thank you again.


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



Re: setReuseItems(true) + transactions = ERROR

2011-06-04 Thread Gonzalo Aguilar Delgado
I removed transactional pointcuts to see if this removes the issue.

But the problem got worse. It seems that something is really wrong
configured in my project.

DEBUG - DefaultListableBeanFactory - Returning cached instance of
singleton bean 'leadDAOBean'
DEBUG - SessionFactoryUtils- Opening Hibernate Session
DEBUG - SessionImpl- opened session at timestamp:
13071814596
DEBUG - SessionFactoryUtils- Closing Hibernate Session
ERROR - RequestCycle   - Can't instantiate page using
constructor public
org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()
org.apache.wicket.WicketRuntimeException: Can't instantiate page using
constructor public
org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()

Watch this:
 SessionFactoryUtils- Opening Hibernate Session

It seems that is not the OSIV filter. It's hibernate who opens the
session. Why?

It's strange because OSIV is configured:
DEBUG - OpenSessionInViewFilter- Initializing filter
'openSessionInViewFilter'
DEBUG - OpenSessionInViewFilter- Filter 'openSessionInViewFilter'
configured successfully

And the problem got worse without transactions:

WicketMessage: Can't instantiate page using constructor public
org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()

Root cause:

org.hibernate.HibernateException: No Hibernate Session bound to thread,
and configuration does not allow creation of non-transactional one here

Not even the first page is instantiated... 

Will search more... 





El sáb, 04-06-2011 a las 11:28 +0200, Gonzalo Aguilar Delgado escribió:
> >Hi,
> >are you sure your model is a LDM?
> 
> Yes. Sure. Encapsulated by an CompoundPropertyModel.
> ---
> new CompoundPropertyModel(scaffoldableModel)
> ---
> /*
>* Need this because wicket serializes everything and need to 
> reload
> it when
>* it's needed. This way wicket and hibernate plays well
>*/
>   IModel scaffoldableModel = new
> LoadableHibernateModelImpl(getFirst())
>   {
>   /**
>* 
>*/
>   private static final long serialVersionUID = 1L;
>   @SpringBean(name = "leadDAOBean")
>   private LeadDAO leadDAO;
>   private UuidUserType uuid;
>   
>   @Override
>   protected Lead load() {
>   Lead lead = null;
>   if(uuid!=null)
>   {
>   lead = leadDAO.find(uuid);
>   
>   }
>   return lead;
>   }
> 
>   @Override
>   protected void setNonTransientObject() {
>   Lead lead =  this.getObject();
>   if(lead!=null)
>   uuid = lead.getUuid();
>   }
> 
>   
>   };
> 
> 
> And...
> -
> public abstract class LoadableHibernateModelImpl extends
> LoadableDetachableModel 
>   implements LoadableHibernateModel, IModel
> -
> 
> detach and load got called. So it's working. The problem seems to be
> transactions.
> 
> I used to reload the model in the onBeforeRender functions. This made
> wicked open a transaction that continued until the save. But now I made
> things different (more efficient). The problem now is how to get a
> transaction run during the model update and save.
> 
> 
> 
> >>IIRC you have a ListView involved. What's the type of 
> >>this.getDefaultModel() ?
> 
> I checked this to make sure is the correct model. What I do is to set a
> wrapper around. The component I use extends from panel and inside there
> is a form and some other components that must use the model of the
> panel. So I wrap it around with CompoundPropertyModel.
> 
> ---
>   public ScaffoldingForm(String id, IModel scaffoldableModel) {
>   //super(id, scaffoldableModel);
>   super(id, new CompoundPropertyModel(scaffoldableModel));
> ---
> 
> The returning model is the CompoundPropertyModel. So seems to be ok.
> 
> 
> Thank you in advance Sven.
> I will try to make everything run in a unique transaction. I found this:
> http://apache-wicket.1842946.n4.nabble.com/OpenSessi

Re: setReuseItems(true) + transactions = ERROR (Solved!)

2011-06-04 Thread Gonzalo Aguilar Delgado
Oh man... It's almost solved but a lot of things happened in the middle:

1.- I was using wicket examples configurations that makes no use
of the org.apache.wicket.spring.SpringWebApplicationFactory in
the WicketFilter. I normally use it but for this project wanted
to stick to wicket example pages format. Solved problem 1 ->
change filter definition.

2.- wicket exampled had lots of libraries inside WEB-INF/lib. I
didn't realized of this and everything got mixed. Different
libraries, different versions all different. Solved problem 2 ->
remove libraries and add dependencies to maven.

3.- Filters!!! The order of the filters does matter. :D the OSIV
MUST be mapped before the wicket filter. I thought that I knew
this but did it wrooong. Solved problem 3 -> put OSIV before any
other filter.


With this everything backs to work. The only problem that I have to
check now are transactions, and the order of doing things. Now object
got loaded after model updates and it lost changes before saving. But
the actual saving works. 


Thank you all guys!!! 

Hope this e-mail serves as reference to others... :D








El sáb, 04-06-2011 a las 07:27 -0400, James Carman escribió:
> Can you try to replicate what you're doing in a more simple fashion?
> Take your wicket framework code out of the mix.  Just try a
> wicket/spring/hibernate example.  You can use the Wicketopia example
> as a template if you want.
> 
> On Sat, Jun 4, 2011 at 6:01 AM, Gonzalo Aguilar Delgado
>  wrote:
> > I removed transactional pointcuts to see if this removes the issue.
> >
> > But the problem got worse. It seems that something is really wrong
> > configured in my project.
> >
> > DEBUG - DefaultListableBeanFactory - Returning cached instance of
> > singleton bean 'leadDAOBean'
> > DEBUG - SessionFactoryUtils- Opening Hibernate Session
> > DEBUG - SessionImpl- opened session at timestamp:
> > 13071814596
> > DEBUG - SessionFactoryUtils- Closing Hibernate Session
> > ERROR - RequestCycle   - Can't instantiate page using
> > constructor public
> > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()
> > org.apache.wicket.WicketRuntimeException: Can't instantiate page using
> > constructor public
> > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()
> >
> > Watch this:
> >  SessionFactoryUtils- Opening Hibernate Session
> >
> > It seems that is not the OSIV filter. It's hibernate who opens the
> > session. Why?
> >
> > It's strange because OSIV is configured:
> > DEBUG - OpenSessionInViewFilter- Initializing filter
> > 'openSessionInViewFilter'
> > DEBUG - OpenSessionInViewFilter- Filter 'openSessionInViewFilter'
> > configured successfully
> >
> > And the problem got worse without transactions:
> >
> > WicketMessage: Can't instantiate page using constructor public
> > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()
> >
> > Root cause:
> >
> > org.hibernate.HibernateException: No Hibernate Session bound to thread,
> > and configuration does not allow creation of non-transactional one here
> >
> > Not even the first page is instantiated...
> >
> > Will search more...
> >
> >
> >
> >
> >
> > El sáb, 04-06-2011 a las 11:28 +0200, Gonzalo Aguilar Delgado escribió:
> >> >Hi,
> >> >are you sure your model is a LDM?
> >>
> >> Yes. Sure. Encapsulated by an CompoundPropertyModel.
> >> ---
> >> new CompoundPropertyModel(scaffoldableModel)
> >> ---
> >> /*
> >>* Need this because wicket serializes everything and need 
> >> to reload
> >> it when
> >>* it's needed. This way wicket and hibernate plays well
> >>*/
> >>   IModel scaffoldableModel = new
> >> LoadableHibernateModelImpl(getFirst())
> >>   {
> >>   /**
> >>*
> >>*/
> >>   private static final long serialVersionUID = 1L;
> >>   @SpringBean(name = "leadDAOBean")
> >>   private LeadDAO leadDAO;
> >>   private UuidUserType uuid;
> >>
> >>   @Override
> >>   

Re: setReuseItems(true) + transactions = ERROR (Solved!)

2011-06-04 Thread Gonzalo Aguilar Delgado
Without transactions it works now. With few implications.

1.- I have to put singleSession to true. Otherwise it fails:

openSessionInViewFilter

org.springframework.orm.hibernate3.support.OpenSessionInViewFilter

singleSession
true


sessionFactoryBeanName
opCustomerSessionFactory




2.- I have to flush manually the session after saving. Because if I
don't do it database got not updated. Any directions here? Seems to be
normal as there are no transaction delimiters. But should be normal to
flush database when session ends. 
Unfortunately the object got reloaded from the database before it
happens because it must be shown again in the form. I think because of
this the object returns to the previous values. But I don't know if this
is normal. 

Anyway this works:
@Override
protected void onSubmit() {
log.debug("Saving content");
IModel model = this.getDefaultModel();
Lead object = (Lead)model.getObject();
if(leadDAO!=null && object!=null)
{
leadDAO.save(object);
leadDAO.flush();

}

}

};


Hope it helps someone.


El sáb, 04-06-2011 a las 14:31 +0200, Gonzalo Aguilar Delgado escribió:
> Oh man... It's almost solved but a lot of things happened in the middle:
> 
> 1.- I was using wicket examples configurations that makes no use
> of the org.apache.wicket.spring.SpringWebApplicationFactory in
> the WicketFilter. I normally use it but for this project wanted
> to stick to wicket example pages format. Solved problem 1 ->
> change filter definition.
> 
> 2.- wicket exampled had lots of libraries inside WEB-INF/lib. I
> didn't realized of this and everything got mixed. Different
> libraries, different versions all different. Solved problem 2 ->
> remove libraries and add dependencies to maven.
> 
> 3.- Filters!!! The order of the filters does matter. :D the OSIV
> MUST be mapped before the wicket filter. I thought that I knew
> this but did it wrooong. Solved problem 3 -> put OSIV before any
> other filter.
> 
> 
> With this everything backs to work. The only problem that I have to
> check now are transactions, and the order of doing things. Now object
> got loaded after model updates and it lost changes before saving. But
> the actual saving works. 
> 
> 
> Thank you all guys!!! 
> 
> Hope this e-mail serves as reference to others... :D
> 
> 
> 
> 
> 
> 
> 
> 
> El sáb, 04-06-2011 a las 07:27 -0400, James Carman escribió:
> > Can you try to replicate what you're doing in a more simple fashion?
> > Take your wicket framework code out of the mix.  Just try a
> > wicket/spring/hibernate example.  You can use the Wicketopia example
> > as a template if you want.
> > 
> > On Sat, Jun 4, 2011 at 6:01 AM, Gonzalo Aguilar Delgado
> >  wrote:
> > > I removed transactional pointcuts to see if this removes the issue.
> > >
> > > But the problem got worse. It seems that something is really wrong
> > > configured in my project.
> > >
> > > DEBUG - DefaultListableBeanFactory - Returning cached instance of
> > > singleton bean 'leadDAOBean'
> > > DEBUG - SessionFactoryUtils- Opening Hibernate Session
> > > DEBUG - SessionImpl- opened session at timestamp:
> > > 13071814596
> > > DEBUG - SessionFactoryUtils- Closing Hibernate Session
> > > ERROR - RequestCycle   - Can't instantiate page using
> > > constructor public
> > > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()
> > > org.apache.wicket.WicketRuntimeException: Can't instantiate page using
> > > constructor public
> > > org.apache.wicket.examples.wscaffold.basicform.BasicFormPage()
> > >
> > > Watch this:
> > >  SessionFactoryUtils- Opening Hibernate Session
> > >
> > > It seems that is not the OSIV filter. It's hibernate who opens the
> > > session. Why?
> > >
> > > It's str

Do I need a custom ResourceAggregator

2012-09-08 Thread Gonzalo Aguilar Delgado
Hello, 

I'm reimplementing my dojo interface again with version 6.0.0 of wicket.

I need to replicate same functionality that gives ResourceAggregator +
OnDomReadyHeaderItem.

I mean, I need that every script that goes into the require when don is
aggregated.


require(["dojo/dom", "dojo/domReady!"], function(dom){
// All scripts here...
});


So I just want to create a new header item called DojoReadyHeaderItem
and add everything needed to the same script at the begining of the
page.

Behaviors will do something like this:

response.render(DojoReadyHeaderItem.forScript("foobar"));
response.render(DojoReadyHeaderItem.forScript("foobar2"));


And the result will be like:


require(["dojo/dom", "dojo/domReady!"], function(dom){
foobar;
foobar2;
});


How can I do this with current implementation?

I don't know how to add my own ResourceAggregator...


Thank you in advance.



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



Re: Do I need a custom ResourceAggregator

2012-09-08 Thread Gonzalo Aguilar Delgado
Hello, 

I can answer myself. 

I was studing wicket code and the examples and found a solution,
extending DecoratingHeaderResponse. It still makes me feel a little bit
lost but it works.

I copied functionality from ResourceAggregator.


public class DojoAggregatorHeaderResponse extends
DecoratingHeaderResponse {
...

private void renderCombinedEventScripts()
{
StringBuilder combinedScript = new StringBuilder();
List dojoDependencies = new ArrayList();
for (DojoRequireHeaderItem curItem : 
dojoRequireItemsToBeRendered)
{
HeaderItem itemToBeRendered = 
getItemToBeRendered(curItem);
if (itemToBeRendered == curItem)
{
combinedScript.append("\n");
combinedScript.append(curItem.getJavaScript());
combinedScript.append(";");
for(String requirement : 
curItem.getDojoDependencies())
{

if(!dojoDependencies.contains(requirement))

dojoDependencies.add(requirement);  // TODO Will be faster 
with a
hash?
}
}
else
{
getRealResponse().render(itemToBeRendered);
}

}
if (combinedScript.length() > 0)
{
getRealResponse().render(

DojoRequireHeaderItem.forScript(combinedScript.append("\n").toString(),dojoDependencies));
}
}
...
}



Is this correct way to do it?


Best regards,




El sáb, 08-09-2012 a las 21:35 +0200, Gonzalo Aguilar Delgado escribió:
> Hello, 
> 
> I'm reimplementing my dojo interface again with version 6.0.0 of wicket.
> 
> I need to replicate same functionality that gives ResourceAggregator +
> OnDomReadyHeaderItem.
> 
> I mean, I need that every script that goes into the require when don is
> aggregated.
> 
> 
> require(["dojo/dom", "dojo/domReady!"], function(dom){
>   // All scripts here...
> });
> 
> 
> So I just want to create a new header item called DojoReadyHeaderItem
> and add everything needed to the same script at the begining of the
> page.
> 
> Behaviors will do something like this:
> 
> response.render(DojoReadyHeaderItem.forScript("foobar"));
>   response.render(DojoReadyHeaderItem.forScript("foobar2"));
> 
> 
> And the result will be like:
> 
> 
> require(["dojo/dom", "dojo/domReady!"], function(dom){
>   foobar;
>   foobar2;
> });
> 
> 
> How can I do this with current implementation?
> 
> I don't know how to add my own ResourceAggregator...
> 
> 
> Thank you in advance.
> 
> 
> 
> -
> 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



Announce: Wicket and Dojo integration for Wicket 6.0.0

2012-09-14 Thread Gonzalo Aguilar Delgado
Hello, 

I'm doing some work integrating Wicket and Dojo. I've just taken the
well done wiquery library and
tried to go that way. But I'm diverging to optimize the library for Dojo
great toolkit. 

Maybe you want take a look. There's not much done, but the core. 

Hope it's the place to announce.

Here we have some examples, not really much as I said:

http://wicket-dojo.level2crm.com/wicket-dojo-examples-1.6.0/

I will try to setup a blog at my page:

http://www.level2crm.com/wicket-dojo

And the code is here:


https://gitorious.org/wicket-dojo

Right now, converting a button to a Dojox Busy button is as easy as:


Button ajaxButton = new Button("ajax-button");

DojoxBusyButtonBehavior dojoBehavior = new 
DojoxBusyButtonBehavior();
dojoBehavior.setBusyLabel("Loading...");
button.add(dojoBehavior);

That's it. 

There are missing lots of widgets but they are usually easy to
implement.

1.- Set the annotation with the Dojo class.
2.- Extend abstract method
3.- Add requirements to the header. 

Library will take care of the rest!

@IDojoUIPlugin("dojox/form/BusyButton")
public class DojoxBusyButtonBehavior extends AbstractDijitButtonBehavior
{
...
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
response.render(CssHeaderItem.forReference(new
DojoxCDNResourceReference("form/resources/BusyButton.css")));
}

...
}


Validation with component not required

2012-10-06 Thread Gonzalo Aguilar Delgado
Hello, 

I've found a little issue with validators. 

When you set an StringValidator.ExactLengthValidator(9) into a TextField
it requires you to enter exactly 9 chars.

This seems to be okay. But what happens when the field is not required.
setRequired(false). What's the correct behavior?!


It should let go the field if empty but should run the validator if the
field has something in it.

This is not the actual behavior. Should I open a bug report?

Best regards...


Re: Validation with component not required

2012-10-10 Thread Gonzalo Aguilar Delgado
Hello Sven, 

Because I'm using this validator in a production application and users
complained about system asking to put the homeland line phone number
because it was fixed to 9 chars.

But it's really just a validator with a exact string validator with size
9 test. It forces to put something of size 9 inside the textbox.

Let me create a test.



El sáb, 06-10-2012 a las 21:03 +0200, Sven Meier escribió:

> > ... when the field is not required ... it should let go the field if empty 
> > but should run
> > the validator if the field has something in it.
> 
> This is exactly how it works. The following test shows it:
> 
> 
> https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=d3f3b43e
> 
> Why to you think the actual behavior is different?
> 
> Sven
> 
> 
> On 10/06/2012 02:15 PM, Gonzalo Aguilar Delgado wrote:
> > Hello,
> >
> > I've found a little issue with validators.
> >
> > When you set an StringValidator.ExactLengthValidator(9) into a TextField
> > it requires you to enter exactly 9 chars.
> >
> > This seems to be okay. But what happens when the field is not required.
> > setRequired(false). What's the correct behavior?!
> >
> >
> > It should let go the field if empty but should run the validator if the
> > field has something in it.
> >
> > This is not the actual behavior. Should I open a bug report?
> >
> > Best regards...
> >
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


Re: Validation with component not required

2012-10-10 Thread Gonzalo Aguilar Delgado
Hello Sven, 

I ran some tests and in the tests everything is working. But when I run
the application it does not.


// This is the offending code.

fijo = new TextField("telefono");
fijo.setConvertEmptyInputStringToNull(false);
fijo.add(new StringValidator.ExactLengthValidator(9));
fijo.setRequired(false);

contactsForm.add(fijo);


If I leave the TextField empty and push submit I get:

El campo 'telefono' debe tener exactamente 9 caracteres.

Translated: The field 'phone' must have 9 characters -> I think I
customized the message with a property file.

So it's really not working.

What else can it be?

Thank you in advance.



El sáb, 06-10-2012 a las 21:03 +0200, Sven Meier escribió:

> > ... when the field is not required ... it should let go the field if empty 
> > but should run
> > the validator if the field has something in it.
> 
> This is exactly how it works. The following test shows it:
> 
> 
> https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=d3f3b43e
> 
> Why to you think the actual behavior is different?
> 
> Sven
> 
> 
> On 10/06/2012 02:15 PM, Gonzalo Aguilar Delgado wrote:
> > Hello,
> >
> > I've found a little issue with validators.
> >
> > When you set an StringValidator.ExactLengthValidator(9) into a TextField
> > it requires you to enter exactly 9 chars.
> >
> > This seems to be okay. But what happens when the field is not required.
> > setRequired(false). What's the correct behavior?!
> >
> >
> > It should let go the field if empty but should run the validator if the
> > field has something in it.
> >
> > This is not the actual behavior. Should I open a bug report?
> >
> > Best regards...
> >
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


Re: Validation with component not required

2012-10-16 Thread Gonzalo Aguilar Delgado
Hello Sven, 

I wanted to know when someone fills the field. It's really not
necessary. I suppose this is the problem. Will check again.

Thank you!

El mié, 10-10-2012 a las 14:44 +0300, Martin Grigorov escribió:

> Hi,
> 
> On Wed, Oct 10, 2012 at 1:59 PM, Gonzalo Aguilar Delgado
>  wrote:
> > Hello Sven,
> >
> > I ran some tests and in the tests everything is working. But when I run
> > the application it does not.
> >
> >
> > // This is the offending code.
> >
> > fijo = new TextField("telefono");
> > fijo.setConvertEmptyInputStringToNull(false);
> 
> Why do you call #setConvertEmptyInputStringToNull(false) ?
> Remove that line and try again.
> 
> > fijo.add(new StringValidator.ExactLengthValidator(9));
> > fijo.setRequired(false);
> >
> > contactsForm.add(fijo);
> >
> >
> > If I leave the TextField empty and push submit I get:
> >
> > El campo 'telefono' debe tener exactamente 9 caracteres.
> >
> > Translated: The field 'phone' must have 9 characters -> I think I
> > customized the message with a property file.
> >
> > So it's really not working.
> >
> > What else can it be?
> >
> > Thank you in advance.
> >
> >
> >
> > El sáb, 06-10-2012 a las 21:03 +0200, Sven Meier escribió:
> >
> >> > ... when the field is not required ... it should let go the field if 
> >> > empty but should run
> >> > the validator if the field has something in it.
> >>
> >> This is exactly how it works. The following test shows it:
> >>
> >> 
> >> https://git-wip-us.apache.org/repos/asf?p=wicket.git;a=commitdiff;h=d3f3b43e
> >>
> >> Why to you think the actual behavior is different?
> >>
> >> Sven
> >>
> >>
> >> On 10/06/2012 02:15 PM, Gonzalo Aguilar Delgado wrote:
> >> > Hello,
> >> >
> >> > I've found a little issue with validators.
> >> >
> >> > When you set an StringValidator.ExactLengthValidator(9) into a TextField
> >> > it requires you to enter exactly 9 chars.
> >> >
> >> > This seems to be okay. But what happens when the field is not required.
> >> > setRequired(false). What's the correct behavior?!
> >> >
> >> >
> >> > It should let go the field if empty but should run the validator if the
> >> > field has something in it.
> >> >
> >> > This is not the actual behavior. Should I open a bug report?
> >> >
> >> > Best regards...
> >> >
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> 
> 
> 


Re: Twitter Bootstrap in Wicket

2012-10-16 Thread Gonzalo Aguilar Delgado
Hello Chris, 

I can answer yes! But it's not working well for IE<9. It gave me big
headaches. For the rest of the navigators it ran well...

Here is a demo. You cannot login, sorry.

http://www1.seglan.com/remesas-movistar/remesas/login?0

I used several projects:


Bootstrap:
http://twitter.github.com/bootstrap/

For the bar at the top:
http://tomaszdziurko.pl/2012/03/wicket-and-twitter-bootstrap-navbar/


Not really related but usefull:

I use dojo for the controls, not al but some:
http://dojotoolkit.org/
And the links to wicket done by me: 
Examples:
http://wicket-dojo.level2crm.com/wicket-dojo-examples-1.6.0/
Code: https://gitorious.org/wicket-dojo

But you need controls integrate with bootstrap theme, so I used
also:

For the themes: http://bootswatch.com/
swatchmaker: for creation of new themes
dbootstrap: for dojo integration of css


With everything it really works.

Want to take a look to:  https://github.com/decebals/wicket-bootstrap

Best regards,


El vie, 12-10-2012 a las 09:11 +1000, Chris Colman escribió:

> Is it possible/feasible to 'selectively' use the Twitter bootstrap in a
> wicket app?
>  
> Scenario: our app serves many different clients. Some will want the
> Twitter Bootstrap look and feel but others will be happy to use any
> number of existing CSS/JS templates that we have created for them over
> the years.
>  
> Currently we use a combination of Wicket variations and conditional
> header injection to provide different look and feel for customers even
> though they all use the same Wicket page classes.
>  
> Is it possible to use Twitter Bootstrap in the same way? i.e.
> conditionally use it when rendering a page for one customer but not
> using it when rendering that same page class for another customer?
>  
> 
> Yours sincerely,
>  
> Chris Colman
>  
> Pagebloom Team Leader,
> Step Ahead Software
> 
> 
>  


JSON response in wicket >= 6.0.0

2012-10-20 Thread Gonzalo Aguilar Delgado
Hello, 

I was looking to some code and googling around but cannot find a
suitable solution for my problem. 


I have an AbstractDefaultAjaxBehavior that I'm implemented the function
respond(AjaxRequestTarget target) like this

---
@Override
protected void respond(AjaxRequestTarget target) {



JsonChoiceRenderer jsonRenderer = new
JsonChoiceRenderer(getChoices());

target.appendJavaScript(jsonRenderer.renderJsonArray(getComponent(),
getRenderer()));

}

---

But this is not a JSON response when it is called from javascript. I
want to respond with an application/json response.

I saw something like:

  RequestCycle requestCycle = RequestCycle.get();
  requestCycle.getResponse().setCharacterEncoding("UTF-8");
requestCycle.getResponse().setContentType("application/json;");

But it means that I have to override the final void onRequest() of the
AbstractAjaxBehavior class, but this is final so I cannot. 


What's the best way to do it with newer versions of wicket?


Thank you a lot in advance.


Re: JSON response in wicket >= 6.0.0

2012-10-20 Thread Gonzalo Aguilar Delgado
Hello Ernesto, 

Yes!!! It did the trick! Great!

Let me understand, you schedule a request handler just after the
current, like in the onRequest...
AjaxRequestTarget target =
app.newAjaxRequestTarget(getComponent().getPage());

RequestCycle requestCycle = RequestCycle.get();
requestCycle.scheduleRequestHandlerAfterCurrent(target);


So what happens with the current one. It returns nothing? Does it
changes something in the request?

Thank you a lot!



El sáb, 20-10-2012 a las 16:08 +0200, Ernesto Reinaldo Barreiro
escribió:

> on the respond method of your AbstractDefaultAjaxBehavior
> 
> On Sat, Oct 20, 2012 at 4:07 PM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
> 
> > Try the following
> >
> > TextRequestHandler textRequestHandler = new
> > TextRequestHandler("application/json", "UTF-8", "Your JSON HERE");
> > RequestCycle.get().scheduleRequestHandlerAfterCurrent(textRequestHandler);
> >
> > On Sat, Oct 20, 2012 at 4:00 PM, Gonzalo Aguilar Delgado <
> > gagui...@aguilardelgado.com> wrote:
> >
> >> Hello,
> >>
> >> I was looking to some code and googling around but cannot find a
> >> suitable solution for my problem.
> >>
> >>
> >> I have an AbstractDefaultAjaxBehavior that I'm implemented the function
> >> respond(AjaxRequestTarget target) like this
> >>
> >> ---
> >> @Override
> >> protected void respond(AjaxRequestTarget target) {
> >>
> >>
> >>
> >> JsonChoiceRenderer jsonRenderer = new
> >> JsonChoiceRenderer(getChoices());
> >>
> >> target.appendJavaScript(jsonRenderer.renderJsonArray(getComponent(),
> >> getRenderer()));
> >>
> >> }
> >>
> >> ---
> >>
> >> But this is not a JSON response when it is called from javascript. I
> >> want to respond with an application/json response.
> >>
> >> I saw something like:
> >>
> >>   RequestCycle requestCycle = RequestCycle.get();
> >>   requestCycle.getResponse().setCharacterEncoding("UTF-8");
> >> requestCycle.getResponse().setContentType("application/json;");
> >>
> >> But it means that I have to override the final void onRequest() of the
> >> AbstractAjaxBehavior class, but this is final so I cannot.
> >>
> >>
> >> What's the best way to do it with newer versions of wicket?
> >>
> >>
> >> Thank you a lot in advance.
> >>
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> > Antilia Soft
> > http://antiliasoft.com
> >
> >
> 
> 


Re: JSON response in wicket >= 6.0.0

2012-10-20 Thread Gonzalo Aguilar Delgado
Hello again, 

Sorry. I was thinking about extending AbstractAjaxBehavior directly. It
seems to have cleaner code but I loss some functionality. 

Could it be right? 


And doing like you said. The getRequestHandler(); returns your
TextRequestHandler. Do I need the stuff inside
AbstractDefaultAjaxBehavior?

Functions like updateAjaxAttributes, renderAjaxAttributes,
appendListenerHandler, getCallbackFunction and so on, does not seem
useful for me now. 


public final void onRequest()
{
//  WebApplication app =
(WebApplication)getComponent().getApplication();
//  AjaxRequestTarget target =
app.newAjaxRequestTarget(getComponent().getPage());
//
//  RequestCycle requestCycle = RequestCycle.get();
//  requestCycle.scheduleRequestHandlerAfterCurrent(target);
//
//  respond(target);

IRequestHandler handler = getRequestHandler();

if(handler!=null)
RequestCycle.get().scheduleRequestHandlerAfterCurrent(handler);
}


El sáb, 20-10-2012 a las 16:08 +0200, Ernesto Reinaldo Barreiro
escribió:

> on the respond method of your AbstractDefaultAjaxBehavior
> 
> On Sat, Oct 20, 2012 at 4:07 PM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
> 
> > Try the following
> >
> > TextRequestHandler textRequestHandler = new
> > TextRequestHandler("application/json", "UTF-8", "Your JSON HERE");
> > RequestCycle.get().scheduleRequestHandlerAfterCurrent(textRequestHandler);
> >
> > On Sat, Oct 20, 2012 at 4:00 PM, Gonzalo Aguilar Delgado <
> > gagui...@aguilardelgado.com> wrote:
> >
> >> Hello,
> >>
> >> I was looking to some code and googling around but cannot find a
> >> suitable solution for my problem.
> >>
> >>
> >> I have an AbstractDefaultAjaxBehavior that I'm implemented the function
> >> respond(AjaxRequestTarget target) like this
> >>
> >> ---
> >> @Override
> >> protected void respond(AjaxRequestTarget target) {
> >>
> >>
> >>
> >> JsonChoiceRenderer jsonRenderer = new
> >> JsonChoiceRenderer(getChoices());
> >>
> >> target.appendJavaScript(jsonRenderer.renderJsonArray(getComponent(),
> >> getRenderer()));
> >>
> >> }
> >>
> >> ---
> >>
> >> But this is not a JSON response when it is called from javascript. I
> >> want to respond with an application/json response.
> >>
> >> I saw something like:
> >>
> >>   RequestCycle requestCycle = RequestCycle.get();
> >>   requestCycle.getResponse().setCharacterEncoding("UTF-8");
> >> requestCycle.getResponse().setContentType("application/json;");
> >>
> >> But it means that I have to override the final void onRequest() of the
> >> AbstractAjaxBehavior class, but this is final so I cannot.
> >>
> >>
> >> What's the best way to do it with newer versions of wicket?
> >>
> >>
> >> Thank you a lot in advance.
> >>
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> > Antilia Soft
> > http://antiliasoft.com
> >
> >
> 
> 


Re: JSON response in wicket >= 6.0.0

2012-10-21 Thread Gonzalo Aguilar Delgado
Hello Ernesto, 

I sometimes get confused myself. ;-) I think that I don't understand
well this piece of code:

@Override
public final void onRequest()
{
WebApplication app = 
(WebApplication)getComponent().getApplication();
AjaxRequestTarget target =
app.newAjaxRequestTarget(getComponent().getPage());

RequestCycle requestCycle = RequestCycle.get();
requestCycle.scheduleRequestHandlerAfterCurrent(target);

respond(target);
}

Because the AjaxRequestTarget is really a handler like
TextRequestHandler but I don't know the
call machanism. 

What does the requestCycle.scheduleRequestHandlerAfterCurrent(target);
here and when used
with a TextRequestHandler. What's the difference?

Is there any way where this mechanism is explained?

Thank you a lot!


El sáb, 20-10-2012 a las 18:31 +0200, Ernesto Reinaldo Barreiro
escribió:

> or your question is why this works?
> 
> On Sat, Oct 20, 2012 at 6:18 PM, Ernesto Reinaldo Barreiro <
> reier...@gmail.com> wrote:
> 
> > Gonzalo,
> >
> > You want to use AbstractDefaultAjaxBehavior as context to serve some
> > JSON? Then what you do is
> >
> > add(behavior = new AbstractDefaultAjaxBehavior() {
> >  @Override
> > protected void respond(AjaxRequestTarget target) {
> > TextRequestHandler handler = new TextRequestHandler(...);
> >  RequestCycle.get().scheduleRequestHandlerAfterCurrent(handler);
> > }
> > });
> >
> > then use use behavior.getCallbackUrl() to generate the URL you need to use
> > on client side to retrieve that JSON.
> >
> >
> > On Sat, Oct 20, 2012 at 5:57 PM, Gonzalo Aguilar Delgado <
> > gagui...@aguilardelgado.com> wrote:
> >
> >> Hello again,
> >>
> >> Sorry. I was thinking about extending AbstractAjaxBehavior directly. It
> >> seems to have cleaner code but I loss some functionality.
> >>
> >> Could it be right?
> >>
> >>
> >> And doing like you said. The getRequestHandler(); returns your
> >> TextRequestHandler. Do I need the stuff inside
> >> AbstractDefaultAjaxBehavior?
> >>
> >> Functions like updateAjaxAttributes, renderAjaxAttributes,
> >> appendListenerHandler, getCallbackFunction and so on, does not seem
> >> useful for me now.
> >>
> >>
> >> public final void onRequest()
> >> {
> >> //  WebApplication app =
> >> (WebApplication)getComponent().getApplication();
> >> //  AjaxRequestTarget target =
> >> app.newAjaxRequestTarget(getComponent().getPage());
> >> //
> >> //  RequestCycle requestCycle = RequestCycle.get();
> >> //  requestCycle.scheduleRequestHandlerAfterCurrent(target);
> >> //
> >> //  respond(target);
> >>
> >> IRequestHandler handler = getRequestHandler();
> >>
> >> if(handler!=null)
> >>
> >> RequestCycle.get().scheduleRequestHandlerAfterCurrent(handler);
> >> }
> >>
> >>
> >> El sáb, 20-10-2012 a las 16:08 +0200, Ernesto Reinaldo Barreiro
> >> escribió:
> >>
> >> > on the respond method of your AbstractDefaultAjaxBehavior
> >> >
> >> > On Sat, Oct 20, 2012 at 4:07 PM, Ernesto Reinaldo Barreiro <
> >> > reier...@gmail.com> wrote:
> >> >
> >> > > Try the following
> >> > >
> >> > > TextRequestHandler textRequestHandler = new
> >> > > TextRequestHandler("application/json", "UTF-8", "Your JSON HERE");
> >> > >
> >> RequestCycle.get().scheduleRequestHandlerAfterCurrent(textRequestHandler);
> >> > >
> >> > > On Sat, Oct 20, 2012 at 4:00 PM, Gonzalo Aguilar Delgado <
> >> > > gagui...@aguilardelgado.com> wrote:
> >> > >
> >> > >> Hello,
> >> > >>
> >> > >> I was looking to some code and googling around but cannot find a
> >> > >> suitable solution for my problem.
> >> > >>
> >> > >>
> >> > >> I have an AbstractDefaultAjaxBehavior that I'm implemented the
> >> function
> >> > >> respond(AjaxRequestTarget target) like this
> >> > >>
> >> > >> ---
> >> > >> @Override
> >> > >> protected void respond(Aj

Re: JSON response in wicket >= 6.0.0

2012-11-12 Thread Gonzalo Aguilar Delgado
Hello, 

Thank you a lot both!!! 

It's great to work with this framework and the delightful people that
support it!

Tnx!


El lun, 22-10-2012 a las 12:07 +0200, Ernesto Reinaldo Barreiro
escribió:

> Hi Martin,
> 
> Thanks for the clarification.
> 
> 
> > > AJAX requests are handled int two steps (please Martin and/or other core
> > > developers correct me if I'm saying something wrong;-). First is is
> >
> > Actually everything is in two steps, not only Ajax.
> > The first step is the ACTION phase and the second is the RENDER phase.
> >
> >
> I just realized that as soon as I've looked at other examples (bookmarkable
> page links, download links and so on).
> 


Handling of Ajax response fails [Fragments]

2012-11-20 Thread Gonzalo Aguilar Delgado
Hello, 

I'm doing a scaffolding application for wicket + dojo. I'm using
fragments to change between EDIT, UPDATE, DELETE screens. 

On each switch I have to reinitializate components on the changed zone
of the web via javascript. I've implemented this in a clean
and efficient way ( I think ), because code generated is really concise
and tested.

The problem is that it works for 2 iterations. On the thirth it breaks
with an ajax DEBUG error.

-
/*]^]^>*/


]]>
ERROR: Wicket.Head.Contributor.processScript: TypeError: a is undefined: eval 
-> 
require(["dijit/MenuBar","dijit/registry","dojo/parser","dojo/ready","dijit/MenuBarItem","dojo/on"],function(MenuBar,
 registry, parser, ready, MenuBarItem, on) {
// Component section begins
// Ready Dojo statement
ready(function() {
// Added class dijit/MenuBar
parser.parse(registry.byId("toolbar29"));
// Added class dijit/MenuBarItem
parser.parse(registry.byId("id12a"));
on(registry.byId("id12a"), 'click',function(event) {
if (true) 
{Wicket.Ajax.ajax({"u":"./?13-2.IBehaviorListener.2-scaffold-wscaffold~content-toolbar-dijitMenuBarItems-1","c":"id12a"});}
});
// Added class dijit/MenuBar
parser.parse(registry.byId("toolbar2b"));

});
});
INFO: Response processed successfully.
INFO: refocus last focused component not needed/allowed
INFO: focus set on wicketDebugLink
INFO: focus removed from wicketDebugLink


-

It weird because if I run this on firefox just after it breaks, It
works! And the code is similar on the three events I trigger on the 
tests.


What I do in the interface:

START POINT -> TRANSITION 1 -> START POINT (It breaks)

I was reading about this kind of problems but the only problem I can
find is that some components does not get destroyed. But this should be
not a problem
just right now because I create new components with new names in each
iteration. (Okay I know about the memory leaks, but's not the point just
right now).


Any help on this?

--

I pasted complete log in pastie.org

http://pastie.org/5405231


Thank you in advance!





Re: Handling of Ajax response fails [Fragments]

2012-11-22 Thread Gonzalo Aguilar Delgado
Hello, 

I will trace the Wicket.Head.Contributor.processScript to see what's
missing. It seems dojo libraries are not loaded at this point, even if
the script section that loads it is there. 

Any directions on how to trace this problem? I'm a little bit lost...

Thank you.
Kindest regards


El mar, 20-11-2012 a las 10:31 +0100, Gonzalo Aguilar Delgado escribió:

> Hello, 
> 
> I'm doing a scaffolding application for wicket + dojo. I'm using
> fragments to change between EDIT, UPDATE, DELETE screens. 
> 
> On each switch I have to reinitializate components on the changed zone
> of the web via javascript. I've implemented this in a clean
> and efficient way ( I think ), because code generated is really concise
> and tested.
> 
> The problem is that it works for 2 iterations. On the thirth it breaks
> with an ajax DEBUG error.
> 
> -
> /*]^]^>*/
> 
> 
> ]]>
> ERROR: Wicket.Head.Contributor.processScript: TypeError: a is undefined: eval 
> -> 
> require(["dijit/MenuBar","dijit/registry","dojo/parser","dojo/ready","dijit/MenuBarItem","dojo/on"],function(MenuBar,
>  registry, parser, ready, MenuBarItem, on) {
> // Component section begins
> // Ready Dojo statement
> ready(function() {
> // Added class dijit/MenuBar
> parser.parse(registry.byId("toolbar29"));
> // Added class dijit/MenuBarItem
> parser.parse(registry.byId("id12a"));
> on(registry.byId("id12a"), 'click',function(event) {
> if (true) 
> {Wicket.Ajax.ajax({"u":"./?13-2.IBehaviorListener.2-scaffold-wscaffold~content-toolbar-dijitMenuBarItems-1","c":"id12a"});}
> });
> // Added class dijit/MenuBar
> parser.parse(registry.byId("toolbar2b"));
> 
> });
> });
> INFO: Response processed successfully.
> INFO: refocus last focused component not needed/allowed
> INFO: focus set on wicketDebugLink
> INFO: focus removed from wicketDebugLink
> 
> 
> -
> 
> It weird because if I run this on firefox just after it breaks, It
> works! And the code is similar on the three events I trigger on the 
> tests.
> 
> 
> What I do in the interface:
> 
> START POINT -> TRANSITION 1 -> START POINT (It breaks)
> 
> I was reading about this kind of problems but the only problem I can
> find is that some components does not get destroyed. But this should be
> not a problem
> just right now because I create new components with new names in each
> iteration. (Okay I know about the memory leaks, but's not the point just
> right now).
> 
> 
> Any help on this?
> 
> --
> 
> I pasted complete log in pastie.org
> 
> http://pastie.org/5405231
> 
> 
> Thank you in advance!
> 
> 
> 


Submit form before handle onclick

2013-02-15 Thread Gonzalo Aguilar Delgado
Hello, 

We have just a situation were the information of the form needs to be
updated before handling an ajax "click" event. 

The page has a form, with a bean and some TextFields that update the
properties in the bean. 
It has also an ajax component that also updates the bean. 

The problem is that we can fill in the form but if we do an event on the
ajax component every field filled in first step is lost because is not
submitted (and the bean updated) before handling the ajax click event. 


So the question is:

How can we submit the form before handling the click event?

Any suggestion?

Thank you in advance.


Re: Submit form before handle onclick

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

Yes. I added this to the form, and a eventhandler to the button, but the
event handler of the button is always called before the submit. 

The problem is that I cannot process the onclick handler of the button
without the information of the form. 

So I think I need to submit it on the onclick handler, but how?

Thank you in advance.


El vie, 15-02-2013 a las 11:07 +0100, Sven Meier escribió:S
venO
n 02/15/2013 11:01 AM, Gonzalo Aguilar Delgado wrote:

> > Hello,
> >
> > We have just a situation were the information of the form needs to be
> > updated before handling an ajax "click" event.
> >
> > The page has a form, with a bean and some TextFields that update the
> > properties in the bean.
> > It has also an ajax component that also updates the bean.
> >
> > The problem is that we can fill in the form but if we do an event on the
> > ajax component every field filled in first step is lost because is not
> > submitted (and the bean updated) before handling the ajax click event.
> >
> >
> > So the question is:
> >
> > How can we submit the form before handling the click event?
> >
> > Any suggestion?
> >
> > Thank you in advance.
> >
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


Re: Submit form before handle onclick

2013-02-18 Thread Gonzalo Aguilar Delgado
Hi Martin, 

Ok. I will take a look to this but I think it's not the right solution. 

Suppose this:
-
PAGE Example|
---
A <- This is a form.  | B <- This is a form.|
---|


Supppose that you want to process form B with Ajax but you also need the
information the user typed on A. 

How can you do it? With ajax of course?

I will submit A so the model of A gets updated, and after I will submit
B. So B has the model of A and B loaded.

Is there a better way to do it?



El lun, 18-02-2013 a las 10:10 +0200, Martin Grigorov escribió:

> 
> Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit
> if you
> want to execute something *after* Form#onSubmit()


Re: Submit form before handle onclick

2013-02-18 Thread Gonzalo Aguilar Delgado
Hi Martin, 

Thank you for your answer. 

What about doing like google and others? I mean save (submit) on lost
focus... So the model will get updated every time you leave a field.

Any good references?

thank you.

El lun, 18-02-2013 a las 11:02 +0200, Martin Grigorov escribió:

> Hi,
> 
> I think this is not possible if you use two root forms.
> You need to submit them by order (first A and then B) to have the values.
> 
> You can use nested forms though. B should be inside A.
> This way when you submit B Wicket will post all the data (for both A and B)
> but will process only form B. The values of the form components of A will
> be available thru request.getPostRequestParameters().get("someFromA")
> 
> 
> On Mon, Feb 18, 2013 at 10:56 AM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> > Hi Martin,
> >
> > Ok. I will take a look to this but I think it's not the right solution.
> >
> > Suppose this:
> > -
> > PAGE Example|
> > ---
> > A <- This is a form.  | B <- This is a form.|
> > ---|
> >
> >
> > Supppose that you want to process form B with Ajax but you also need the
> > information the user typed on A.
> >
> > How can you do it? With ajax of course?
> >
> > I will submit A so the model of A gets updated, and after I will submit
> > B. So B has the model of A and B loaded.
> >
> > Is there a better way to do it?
> >
> >
> >
> > El lun, 18-02-2013 a las 10:10 +0200, Martin Grigorov escribió:
> >
> > >
> > > Use org.apache.wicket.ajax.form.AjaxFormSubmitBehavior#onAfterSubmit
> > > if you
> > > want to execute something *after* Form#onSubmit()
> >
> 
> 
> 


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

2013-02-23 Thread Gonzalo Aguilar Delgado
Hello, 

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

I have an html that looks like:






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 ListView {
/**
 * 
 */
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 IModel>(){

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

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

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

@Override
public void setObject(List 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...


...



So, is this a bug or a feature?



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:
> 
>   * 
>   * NOTE:
>   *
>   * 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.
>   *
>   * 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.
>   * 
> 
> 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:
> >
> > 
> > 
> > 
> >
> >
> > 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 ListView {
> > /**
> >  *
> >  */
> > 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 IModel>(){
> >
> > /**
> >  *
> >  */
> > private static final long serialVersionUID = 1L;
> >
> > @Override
> > public void detach() {
> > // TODO Auto-generated method stub
> > }
> >
> > @Override
> > public List getObject() {
> > return region.getRegionWidgets();
> > }
> >
> > @Override
> > public void setObject(List 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...
> >
> > 
> > ...
> > 
> >
> >
> > 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
> 


"Authorization" header in http

2013-04-28 Thread Gonzalo Aguilar Delgado
Hello, 

I'm using AuthenticatedWebApplication class to manage my login and
roles. While it works well I want wicket to set the "Authorization" http
header each time it does a request. 

I don't really know if this makes sense.

The application is currently working in this context 

http://localhost:8080/lead-services-war/

If I login wicket should set the "Authorization" header in http. 


I have some services running in
http://localhost:8080/lead-services-war/services and I need to use the
same authorization made by wicket in this services. Do you know how to
propagate this authorization?

Thank you a lot in advance.

Best regards,


Re: "Authorization" header in http

2013-04-29 Thread Gonzalo Aguilar Delgado
Martin, 

You really are great. Thank you for your response. It's incredible you
take time to answer even when the questions was not much wicket beared. 

I hope I can return the community as much as you gave us.

Thank you again.


El lun, 29-04-2013 a las 07:57 +0200, Martin Grigorov escribió:

> Hi,
> 
> See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, p. 14.8.
> The "Authorization" header is a _request_ header. I.e. the user agent
> should set it. Wicket can set _response_ headers. An exception is Ajax
> request where Wicketcan set request headers.
> 
> Your use case sounds like normal session tracking. Once authenticated you
> bind a session. This way the servlet container will use either JSESSIONID
> cookie or jsessionid request path parameter.
> 
> 
> On Mon, Apr 29, 2013 at 3:23 AM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
> 
> > Hello,
> >
> > I'm using AuthenticatedWebApplication class to manage my login and
> > roles. While it works well I want wicket to set the "Authorization" http
> > header each time it does a request.
> >
> > I don't really know if this makes sense.
> >
> > The application is currently working in this context
> >
> > http://localhost:8080/lead-services-war/
> >
> > If I login wicket should set the "Authorization" header in http.
> >
> >
> > I have some services running in
> > http://localhost:8080/lead-services-war/services and I need to use the
> > same authorization made by wicket in this services. Do you know how to
> > propagate this authorization?
> >
> > Thank you a lot in advance.
> >
> > Best regards,
> >
> 
> 
> 


XSS in wicket. Wicket fault or my fault?

2014-01-29 Thread Gonzalo Aguilar Delgado

Hi there,

I'm building an application for a client and my security advisor told me 
about a XSS attack that can be performed on the site.


When user logs-in I welcome they by Saying "Hello user".



Hello ${realName}.
Welcome to the Synapse web.




As you can see I use I18N so this is not the real text that will show 
up, but's similar.


I used to think that wicket validated output before building web but the 
white hat hacked it by just putting a fake name into the database. Too 
easy for me...


The content of realName is:

'';!--"alert('XSS')=&{()}


So I ended with:

Hello'';!--"alert('XSS')=&{()}

In the web page. And the script executed on login.

I was thinking about baking a method into my DAO classes to validate everything 
that goes to the database. But it should be a better solution.

Can you point me to right one?



Best regards,




Re: XSS in wicket. Wicket fault or my fault?

2014-01-30 Thread Gonzalo Aguilar Delgado

Hi I will take a look.



maybe I did it to allow html rendering on label. Will tell you.

Thank you a lot for references.

El 29/01/14 21:29, Paul Bors escribió:

No need, Wicket escapes your model objects, see
Component#setEscapeModelStrings(true) for when HTML should be escaped and
thus the browser won't execute it as HTML or JS.
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/Component.html#setEscapeModelStrings(boolean)

That is on by default, so you should switch to using a wicket model for
your label.

See the bottom section 11.1 "What is a model?" of the wicket free guide at:
http://wicket.apache.org/guide/guide/modelsforms.html#modelsforms_1

Also, older Wicket in Action:
http://www.javaranch.com/journal/2008/10/using-wicket-labels-and-links.html


On Wed, Jan 29, 2014 at 12:26 PM, Gonzalo Aguilar Delgado <
gagui...@aguilardelgado.com> wrote:


Hi there,

I'm building an application for a client and my security advisor told me
about a XSS attack that can be performed on the site.

When user logs-in I welcome they by Saying "Hello user".


 
 Hello ${realName}.
 Welcome to the Synapse web.
 
 


As you can see I use I18N so this is not the real text that will show up,
but's similar.

I used to think that wicket validated output before building web but the
white hat hacked it by just putting a fake name into the database. Too easy
for me...

The content of realName is:

'';!--"alert('XSS')=&{()}


So I ended with:

Hello'';!--"alert('XSS')=&{()}

In the web page. And the script executed on login.

I was thinking about baking a method into my DAO classes to validate
everything that goes to the database. But it should be a better solution.

Can you point me to right one?



Best regards,






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



Re: XSS in wicket. Wicket fault or my fault?

2014-01-30 Thread Gonzalo Aguilar Delgado

Hi Martin,

This is how I've done it.

label = new Label("message", getString("main.message", new 
Model(authSession.getUser(;

label.setOutputMarkupId(true);


And in the MainTmsPage.properties I have:

main.message=Hello ${realName}. Welcome to the Technoactivity 
Payment Solutions main page.



And it worked!


El 30/01/14 10:03, Martin Grigorov escribió:

Hi,

On Wed, Jan 29, 2014 at 6:26 PM, Gonzalo Aguilar Delgado <
gagui...@aguilardelgado.com> wrote:


Hi there,

I'm building an application for a client and my security advisor told me
about a XSS attack that can be performed on the site.

When user logs-in I welcome they by Saying "Hello user".


 
 Hello ${realName}.


How do you substitute the value of ${realName} ?
Wicket doesn't support such placeholders.

The Wicket syntax would be: Hello .
Together with: page.add(new Label("realName", "Some Name");



 Welcome to the Synapse web.
 
 


As you can see I use I18N so this is not the real text that will show up,
but's similar.

I used to think that wicket validated output before building web but the
white hat hacked it by just putting a fake name into the database. Too easy
for me...

The content of realName is:

'';!--"alert('XSS')=&{()}


So I ended with:

Hello'';!--"alert('XSS')=&{()}

In the web page. And the script executed on login.

I was thinking about baking a method into my DAO classes to validate
everything that goes to the database. But it should be a better solution.

Can you point me to right one?



Best regards,






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



Re: XSS in wicket. Wicket fault or my fault?

2014-01-30 Thread Gonzalo Aguilar Delgado

Hi Paul,

you were right!!!

I did

label.setEscapeModelStrings(false);

in code. So I can show  bold text...

That was my fault!

Best regards,

El 29/01/14 21:29, Paul Bors escribió:

No need, Wicket escapes your model objects, see
Component#setEscapeModelStrings(true) for when HTML should be escaped and
thus the browser won't execute it as HTML or JS.
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/Component.html#setEscapeModelStrings(boolean)

That is on by default, so you should switch to using a wicket model for
your label.

See the bottom section 11.1 "What is a model?" of the wicket free guide at:
http://wicket.apache.org/guide/guide/modelsforms.html#modelsforms_1

Also, older Wicket in Action:
http://www.javaranch.com/journal/2008/10/using-wicket-labels-and-links.html


On Wed, Jan 29, 2014 at 12:26 PM, Gonzalo Aguilar Delgado <
gagui...@aguilardelgado.com> wrote:


Hi there,

I'm building an application for a client and my security advisor told me
about a XSS attack that can be performed on the site.

When user logs-in I welcome they by Saying "Hello user".


 
 Hello ${realName}.
 Welcome to the Synapse web.
 
 


As you can see I use I18N so this is not the real text that will show up,
but's similar.

I used to think that wicket validated output before building web but the
white hat hacked it by just putting a fake name into the database. Too easy
for me...

The content of realName is:

'';!--"alert('XSS')=&{()}


So I ended with:

Hello'';!--"alert('XSS')=&{()}

In the web page. And the script executed on login.

I was thinking about baking a method into my DAO classes to validate
everything that goes to the database. But it should be a better solution.

Can you point me to right one?



Best regards,






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



Re: XSS in wicket. Wicket fault or my fault?

2014-01-30 Thread Gonzalo Aguilar Delgado

Hi Bas,

Thank you for the reference, I forgot this one. I updated the code.

Thank you for reference. It's better with StringResourceModel... :D

El 30/01/14 11:22, Bas Gooren escribió:

Hi!

You can also replace your Label's model with a StringResourceModel.

See 
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/model/StringResourceModel.html


Met vriendelijke groet,
Kind regards,

Bas Gooren

schreef Gonzalo Aguilar Delgado op 30-1-2014 11:17:

Hi Martin,

This is how I've done it.

label = new Label("message", getString("main.message", new 
Model(authSession.getUser(;

label.setOutputMarkupId(true);


And in the MainTmsPage.properties I have:

main.message=Hello ${realName}. Welcome to the 
Technoactivity Payment Solutions main page.



And it worked!


El 30/01/14 10:03, Martin Grigorov escribió:

Hi,

On Wed, Jan 29, 2014 at 6:26 PM, Gonzalo Aguilar Delgado <
gagui...@aguilardelgado.com> wrote:


Hi there,

I'm building an application for a client and my security advisor 
told me

about a XSS attack that can be performed on the site.

When user logs-in I welcome they by Saying "Hello user".


 
 Hello ${realName}.


How do you substitute the value of ${realName} ?
Wicket doesn't support such placeholders.

The Wicket syntax would be: Hello .
Together with: page.add(new Label("realName", "Some Name");



 Welcome to the Synapse web.
 
 


As you can see I use I18N so this is not the real text that will 
show up,

but's similar.

I used to think that wicket validated output before building web 
but the
white hat hacked it by just putting a fake name into the database. 
Too easy

for me...

The content of realName is:

'';!--"alert('XSS')=&{()}


So I ended with:

Hello'';!--"alert('XSS')=&{()}

In the web page. And the script executed on login.

I was thinking about baking a method into my DAO classes to validate
everything that goes to the database. But it should be a better 
solution.


Can you point me to right one?



Best regards,






-
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



JQueryResourceReference is not rendered on JBOSS 7 AS 7.1.1

2014-10-31 Thread Gonzalo Aguilar Delgado

Hi,

We built an application that depends on JQuery because we show graphs 
with morris and raphael. And we discovered that


@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);


response.render(JavaScriptHeaderItem
.forReference(JQueryResourceReference.get()));
}

is working well on tomcat but when deployed on jboss it fails. The 
references that went to wicket are not rendering. The ones we have in 
our own packages are working.


We can see some:
12:17:42,844 WARN 
[org.apache.wicket.resource.bundles.ConcatBundleResource] 
(http-localhost-127.0.0.1-8880-3) Bundled resource: Unable to find 
resource (status=404)
12:17:42,845 WARN 
[org.apache.wicket.resource.bundles.ConcatBundleResource] 
(http-localhost-127.0.0.1-8880-2) Bundled resource: Unable to find 
resource (status=404)


Maybe has something to do , maybe not but the fact is that it works with 
tomcat 6 and not with jboss 7.


Any help will be appreciated. Should I open a bug? Can someone confirm 
this, please?


Best regards,


Re: JQueryResourceReference is not rendered on JBOSS 7 AS 7.1.1

2014-10-31 Thread Gonzalo Aguilar Delgado

Hi Martin,

Well, that's good news. Unfortunately we cannot upgrade server now. Can 
you try it in 7.1.1 because I think something wrong is happening since 
no one .js from wicket is loading.


From your comment below do you mean that it will not work on Jboss7?

Thank you in advance.


El 31/10/14 a las 12:34, Martin Grigorov escribió:

Hi,

It works well here with JBoss 8 (WildFly 8.1).

On Fri, Oct 31, 2014 at 1:22 PM, Gonzalo Aguilar Delgado <
gagui...@aguilardelgado.com> wrote:


Hi,

We built an application that depends on JQuery because we show graphs with
morris and raphael. And we discovered that

@Override
 public void renderHead(IHeaderResponse response) {
 super.renderHead(response);


 response.render(JavaScriptHeaderItem
 .forReference(JQueryResourceReference.get()));
 }

is working well on tomcat but when deployed on jboss it fails. The
references that went to wicket are not rendering. The ones we have in our
own packages are working.

We can see some:
12:17:42,844 WARN [org.apache.wicket.resource.bundles.ConcatBundleResource]
(http-localhost-127.0.0.1-8880-3) Bundled resource: Unable to find
resource (status=404)
12:17:42,845 WARN [org.apache.wicket.resource.bundles.ConcatBundleResource]
(http-localhost-127.0.0.1-8880-2) Bundled resource: Unable to find
resource (status=404)

Maybe has something to do , maybe not but the fact is that it works with
tomcat 6 and not with jboss 7.

Any help will be appreciated. Should I open a bug? Can someone confirm
this, please?


You mean a bug at JBoss JIRA, I guess ?
JBoss uses "modules" (an abstraction over a jar) and virtual file system
(an abstraction over classpath?!), so many weird things could happen there.

Wicket uses Class#getResourceAsStream("someName.js") to load a file from
the classpath. Pretty standard.



Best regards,





Repeaters and feedaback panel (not reporting error after submit)

2014-11-04 Thread Gonzalo Aguilar Delgado

Hi all!

We are using a RefreshingView to show some panels inside a form. This 
way we can add elements to a list of objects that will be processed 
after submit.


The problem is that ajax on the items of the RefreshingView does not 
refresh after the submit button is hit on the form.



We tried to use a ListView but it seems it cannot report to feedback 
panels because reuse item strategy that's why we are using a 
RefreshingView:

http://wicket.apache.org/guide/guide/repeaters.html



RefreshingView cardListView = new 
RefreshingView("tarjetas"){


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

@Override
protected void populateItem(Item item) {
item.add(new CardEntryComponent("card", 
(IModel<*TarjRealType*>) item.getDefaultModel()));

}

@Override
protected Iterator> getItemModels() {
 List> cardModelList = new 
ArrayList>();
 for(TarjRealType card : 
((List)this.getDefaultModelObject()))

 cardModelList.add(Model.of(card));
return cardModelList.iterator();
}

};

cardListView.setItemReuseStrategy(new 
ReuseIfModelsEqualStrategy());




In the CardEntryComponent we have an ajaxLink (a button) that sets the 
info inside TarjRealType object.


panNumberField = new TextField("pan", String.class);
panNumberField.setRequired(true);
panNumberField.setOutputMarkupId(true);
...

add(new AjaxLink("generatePan", (IModel<*TarjRealType*>) 
CardEntryComponent.this.getDefaultModel()) {

Random random = new Random();
public void onClick( AjaxRequestTarget target ){
TarjRealType card = (TarjRealType) 
this.getDefaultModelObject();
String PAN = 
String.valueOf(Math.abs(random.nextLong())).substring(0,15);

String realPAN = PAN + Luhn.generateDigit(PAN);
card.setPan(realPAN);
target.add(panNumberField);
}
});

It sets a random PAN number inside.

It works nice because panNumberField is required and when I hit submit 
button on the main form, it says there's nothing in the text field via 
feedback panel. After I reload the page and hit the generatePan button, 
it adds via ajax the PAN into the field and when I hit submit again 
everything works.


The problem is that after submit, the generatePan works but does not 
refresh the panNumberField so it appears as empty.


Is this a problem of the reuse strategy?

Thank you in advance.



Websockets for graph data streaming

2017-03-05 Thread Gonzalo Aguilar Delgado
Hello,

I'm using the fantastic Decebals dashboard, adding a widget json
registry and some other improvements. The idea is to provide data
streaming functionality like the one provided by graphana, kibana and
friends.

So the server will contain the datasources. And the dashboard will apply
to one or more datasources on the server. 

But I don't know what's the best way to go with wicket.

My first idea is to provide a websocket connection with a DataManager
for each user dashboard (only 1 at a time active), subscribe to
datasources, and receive the streaming over the websockets. The
DataManager then will keep track of what topic each chart wants to
receive and multiplex the result to each chart via Javascript.

This way there's only 1 connection to the server. But data can be shared
among widgets. I suppose it's not easy task.

The other way is do ajax with each chart. But I think this would make a
lot of calls to the server and I suppose it's not scalable.

S. What's the best way to go?!


Any good chart integration on wicket apart of highcharts? D3js or similar...


Preview of the current work is this link:

https://pbs.twimg.com/media/C6M_hG6WYAEeysz.jpg




Re: Websockets for graph data streaming

2017-03-07 Thread Gonzalo Aguilar Delgado
Hi Martin,

I must say I was working with websockets yesterday. And it's delightful
experience. Have to check how it does scale but it seams just great.

I have a doubt. Since I'm doing fully async I'm doing fully async
request with WebSocketResource. I suppose that there's no way to update
the interface from there. I mean, if we are sending a message because a
model changed on server. Can I trigger the repain of a widget? I suppose
this option is only available if using behavior right?


I saw the broadcast example you did. But does it worth mix
WebSocketResource and WebSocketBehavior?

What is best, more scalable?

 1. Doing a WebSocketResource with 1 connection that via Javascript
notifies all components in page.
 2. Use WebSocketResource + 1 WebSocketBehavior per component, and then
broadcast to all.


As I told what I'm doing is a Javascript hub that receives messages (via
WebSocketResource) and sends to the widgets async so they can update.
But I suppose that following this approach it's quite difficult update
components from Javascript. And so the opposite. If a component updates
it's internal model on server, there's no way to push to the interface.

Can I have both? The ability to update components (graphs mainly) from
javascript datasource, but from time to time, update components on
wicket and send updates to the UI (html)?


Best regards,



El 06/03/17 a las 09:08, Martin Grigorov escribió:
> Hi,
>
>
> On Mon, Mar 6, 2017 at 3:57 AM, Gonzalo Aguilar Delgado <
> gagui...@aguilardelgado.com> wrote:
>
>> Hello,
>>
>> I'm using the fantastic Decebals dashboard, adding a widget json
>> registry and some other improvements. The idea is to provide data
>> streaming functionality like the one provided by graphana, kibana and
>> friends.
>>
>> So the server will contain the datasources. And the dashboard will apply
>> to one or more datasources on the server.
>>
>> But I don't know what's the best way to go with wicket.
>>
>> My first idea is to provide a websocket connection with a DataManager
>> for each user dashboard (only 1 at a time active), subscribe to
>> datasources, and receive the streaming over the websockets. The
>> DataManager then will keep track of what topic each chart wants to
>> receive and multiplex the result to each chart via Javascript.
>>
>> This way there's only 1 connection to the server. But data can be shared
>> among widgets. I suppose it's not easy task.
>>
>> The other way is do ajax with each chart. But I think this would make a
>> lot of calls to the server and I suppose it's not scalable.
>>
>> S. What's the best way to go?!
>>
> I'd use WebSockets for this!
>
>
>>
>> Any good chart integration on wicket apart of highcharts? D3js or
>> similar...
>>
> The demo app for
> http://wicketinaction.com/2012/07/wicket-6-native-websockets/ uses Google
> Charts library without any Wicket component integration.
>
>
>>
>> Preview of the current work is this link:
>>
>> https://pbs.twimg.com/media/C6M_hG6WYAEeysz.jpg
>>
>>
>>

-- 
Gonzalo Aguilar Delgado *Level2 CRM*
  Gonzalo Aguilar Delgado
  Consultor CRM - Ingeniero en Informática

M. +34 607 81 42 76
T. +34 918 40 95 78
E. gagui...@level2crm.com <mailto:gagui...@level2crm.com>







PubSub from Javascript with Wicket.Event is possible?

2017-03-07 Thread Gonzalo Aguilar Delgado
Hello,

Is it possible to send events that are managed inside Javascript without
reaching the server?

Instead of using a dedicated PubSub library I pretend to use the
functionality inside Wicket to perform pubsub on javascript.

My problem is that only examples I can find is like this, where a
publish is done, but there are no arguments. Data or anything I want to
send.

Wicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);

So. Is it possible to do that way?

Something like is what I want. How should I do it?

Wicket.Event.publish("/customevent/newdata", JSON.stringify(dataObject));


Thank you in advance.



Re: Websockets for graph data streaming

2017-03-08 Thread Gonzalo Aguilar Delgado
Hi Martin,

Thank you a lot. I'm almost done!!!

It's so great. I made a clientside library that allows widgets to
register for data streams. And the Websockets library integrated with
Wicket subscribe delivers the specific data to each subscriptor.

It takes just one connection. And I loove it!

Best regards,


El 07/03/17 a las 21:45, Martin Grigorov escribió:
> Hi,
>
> On Tue, Mar 7, 2017 at 10:07 AM, Gonzalo Aguilar Delgado <
> gagui...@level2crm.com> wrote:
>
>> Hi Martin,
>>
>> I must say I was working with websockets yesterday. And it's delightful
>> experience. Have to check how it does scale but it seams just great.
>>
>> I have a doubt. Since I'm doing fully async I'm doing fully async request
>> with WebSocketResource. I suppose that there's no way to update the
>> interface from there. I mean, if we are sending a message because a model
>> changed on server. Can I trigger the repain of a widget? I suppose this
>> option is only available if using behavior right?
>>
> Correct!
>
>> I saw the broadcast example you did. But does it worth mix WebSocketResource
>> and WebSocketBehavior?
>>
>> What is best, more scalable?
>>
>>1. Doing a WebSocketResource with 1 connection that via Javascript
>>notifies all components in page.
>>2. Use WebSocketResource + 1 WebSocketBehavior per component, and then
>>broadcast to all.
>>
>> Even if you have many WebSocketBehaviors in your components Wicket will
> create only one WebSocket connection per page. A web socket message sent by
> the browser will be delivered to all behavior instances. You have to decide
> whether the message is applicable for a given behavior or should be
> discarded.
>
> The drawback of using WebSocketBehavior is that during the processing of a
> message the Page instance will be locked, so WS messages are processed
> sequencially and any Ajax requests at the same time will wait for the page
> to be unlocked.
>
>>
>>
>> As I told what I'm doing is a Javascript hub that receives messages (via
>> WebSocketResource) and sends to the widgets async so they can update. But
>> I suppose that following this approach it's quite difficult update
>> components from Javascript. And so the opposite. If a component updates
>> it's internal model on server, there's no way to push to the interface.
>>
>> Can I have both? The ability to update components (graphs mainly) from
>> javascript datasource, but from time to time, update components on wicket
>> and send updates to the UI (html)?
>>
> You can use org.apache.wicket.protocol.ws.api.WebSocketPushBroadcaster to
> repaint Wicket components initiated at the server side. You will need to
> preserve the page id to able to notify a specific page. Or
> WebSocketBehavior should keep some extra information, e.g. userId, to
> decide whether a given PushMessage is for it or not.
>
>> Best regards,
>>
>>
>>
>> El 06/03/17 a las 09:08, Martin Grigorov escribió:
>>
>> Hi,
>>
>>
>> On Mon, Mar 6, 2017 at 3:57 AM, Gonzalo Aguilar Delgado 
>>  wrote:
>>
>>
>> Hello,
>>
>> I'm using the fantastic Decebals dashboard, adding a widget json
>> registry and some other improvements. The idea is to provide data
>> streaming functionality like the one provided by graphana, kibana and
>> friends.
>>
>> So the server will contain the datasources. And the dashboard will apply
>> to one or more datasources on the server.
>>
>> But I don't know what's the best way to go with wicket.
>>
>> My first idea is to provide a websocket connection with a DataManager
>> for each user dashboard (only 1 at a time active), subscribe to
>> datasources, and receive the streaming over the websockets. The
>> DataManager then will keep track of what topic each chart wants to
>> receive and multiplex the result to each chart via Javascript.
>>
>> This way there's only 1 connection to the server. But data can be shared
>> among widgets. I suppose it's not easy task.
>>
>> The other way is do ajax with each chart. But I think this would make a
>> lot of calls to the server and I suppose it's not scalable.
>>
>> S. What's the best way to go?!
>>
>>
>> I'd use WebSockets for this!
>>
>>
>>
>> Any good chart integration on wicket apart of highcharts? D3js or
>> similar...
>>
>>
>> The demo app 
>> forhttp://wicketinaction.com/2012/07/wicket-6-native-websockets/ 

Websockets: Server to browser connection lost?

2017-03-08 Thread Gonzalo Aguilar Delgado
Hello,


As I told still doing testing with the web sockets. It seems that a
reconnection doesn't fully work. I don't know why.

If the connection is the first the browser does. It works nice. The
server sends a message to the client (browser) and the browser responds
with a request for data.

That works nicely.

But when I reload the page, most of times doesn't work.

2017-03-08 18:19:14,117 [http-bio-8080-exec-29] DEBUG
com.level2.dashboard.web.component.websocket.MessengerWebSocketResource
- Connected application
com.level2.dashboard.PandoraApplicationImpl@49b8641c with session id
AAD6510DE8CA72C6CE7FF1FD4F1CF03D
2017-03-08 18:19:14,117 [http-bio-8080-exec-29] WARN 
com.level2.dashboard.web.component.websocket.WebSocketClientManagerImpl
- The client
a13f637ea458fb61807e65429a9c18e3f5e8dd46cbe2d46cd1cc0894b4abb2f is
already connected, resending id

The server receives a connection. And in response it sends a message to
the client with a client ID. The client should respond. but it seems
browser never receives the message.

Why it doesn't work? Can connection be dropped or messages lost?

I added some logs to see if the socket is closed but it's ok.
@Override
public boolean sendMessage(ConnectionIdentifier identifier, String
message)
{
Application application =
Application.get(identifier.getApplicationName());
IWebSocketSettings webSocketSettings =
IWebSocketSettings.Holder.get(application);
IWebSocketConnectionRegistry webSocketConnectionRegistry =
webSocketSettings.getConnectionRegistry();
IWebSocketConnection connection =
webSocketConnectionRegistry.getConnection(application,
identifier.getSessionId(), identifier.getKey());
if (connection == null || !connection.isOpen())
{
log.warn("Connection is closed!!!");
return false;
}
try {
connection.sendMessage(message);
} catch (IOException e) {
log.warn("Cannot send message: {}", e.getMessage());
return false;
}
return true;
}
So Why I cannot send it. Or why the client is not receiving it?

Best regards,




Re: Websockets: Server to browser connection lost?

2017-03-09 Thread Gonzalo Aguilar Delgado
Hello,

I will respond to myself.

It seems that websockets connection is created at the begining of all
javascript initialization. When the server receives the new

connection it inmediatly (in my implementation) sends a registration
request. This is not catched by the receiver because the javascript

is still initializing. So it's lost.

If I delay it a little bit, few seconds everything goes smoothly. Of
course I have to change this to let client tell when it's really ready
to start

the communication.

Thank you for help!



El 08/03/17 a las 18:30, Gonzalo Aguilar Delgado escribió:
> Hello,
>
>
> As I told still doing testing with the web sockets. It seems that a
> reconnection doesn't fully work. I don't know why.
>
> If the connection is the first the browser does. It works nice. The
> server sends a message to the client (browser) and the browser responds
> with a request for data.
>
> That works nicely.
>
> But when I reload the page, most of times doesn't work.
>
> 2017-03-08 18:19:14,117 [http-bio-8080-exec-29] DEBUG
> com.level2.dashboard.web.component.websocket.MessengerWebSocketResource
> - Connected application
> com.level2.dashboard.PandoraApplicationImpl@49b8641c with session id
> AAD6510DE8CA72C6CE7FF1FD4F1CF03D
> 2017-03-08 18:19:14,117 [http-bio-8080-exec-29] WARN 
> com.level2.dashboard.web.component.websocket.WebSocketClientManagerImpl
> - The client
> a13f637ea458fb61807e65429a9c18e3f5e8dd46cbe2d46cd1cc0894b4abb2f is
> already connected, resending id
>
> The server receives a connection. And in response it sends a message to
> the client with a client ID. The client should respond. but it seems
> browser never receives the message.
>
> Why it doesn't work? Can connection be dropped or messages lost?
>
> I added some logs to see if the socket is closed but it's ok.
> @Override
> public boolean sendMessage(ConnectionIdentifier identifier, String
> message)
> {
> Application application =
> Application.get(identifier.getApplicationName());
> IWebSocketSettings webSocketSettings =
> IWebSocketSettings.Holder.get(application);
> IWebSocketConnectionRegistry webSocketConnectionRegistry =
> webSocketSettings.getConnectionRegistry();
> IWebSocketConnection connection =
> webSocketConnectionRegistry.getConnection(application,
> identifier.getSessionId(), identifier.getKey());
> if (connection == null || !connection.isOpen())
> {
> log.warn("Connection is closed!!!");
> return false;
> }
> try {
> connection.sendMessage(message);
> } catch (IOException e) {
> log.warn("Cannot send message: {}", e.getMessage());
> return false;
> }
> return true;
> }
> So Why I cannot send it. Or why the client is not receiving it?
>
> Best regards,
>
>
>