Re: Nesting Links

2011-01-28 Thread armandoxxx

Hey man 

I've used your method but it's not working .. got any other ideas ??? 

Regards

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

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



RE: Submit form from ajaxlink not a part of the form

2011-01-28 Thread Brown, Berlin [GCG-PFS]
I added a kind of dummy ajax submit link on that form and then try to invoke 
that link...  When I get a reference to the callback URL.  Here is the error.

Is there a way to debug that object error?   I could try changing:

1. ignore if not active to false?
2. changing some of the parameters to the submit call?
3. hiddenSubmitLink ...maybe that is not the correct path to that link... Maybe 
I need to try 
   panel:form:hiddenSubmitLink...etc?

From the Debug Window:

INFO: 
?xml version=1.0 encoding=UTF-8?ajax-responseevaluate![CDATA[var 
wcall=wicketSubmitFormById('form5e', 
'?wicket:interface=:0:panel:form:hiddenSubmitLink::IActivePageBehaviorListener:0:-1wicket:ignoreIfNotActive=true',
 'hiddenSubmitLink' ,function() { }.bind(this),function() { }.bind(this), 
function() {return Wicket.$$(this)Wicket.$$('form5e')}.bind(this));;; return 
false;]]/evaluate/ajax-response
INFO: Response parsed. Now invoking steps...
ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: 
[object Error]
INFO: Response processed successfully. 

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Friday, January 28, 2011 12:52 AM
To: users@wicket.apache.org
Cc: berlin.br...@gmail.com
Subject: Re: Submit form from ajaxlink not a part of the form

add(new ajaxsubmitlink(submit, form));

-igor

On Thu, Jan 27, 2011 at 7:46 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:
 So, I was able to submit a form WITHOUT ajax.  Now, how can I submit a 
 form with ajax but from a link not associated with that form.  I tried 
 the following.    But, I couldn't get the proper URLs / Button?   Are 
 those needed for the wicketSubmFormById call?

 Also, do i have an issue using target.appendJavascript(...);

 ...

 If you look at the event handler method,

 public class MyPanel {

 public static final String
 JS_SUBMIT_THIS_WORKS_BUT_HOW_TO_SUBMIT_BY_AJAX = try { 
 document.forms['%s'].submit(); } catch(err) { alert('ERR:' + err); if 
 (window.console != undefined) { console.log(err); } };

 this.add(new AjaxLinkObject(link) {
            @Override
            public void onClick(final AjaxRequestTarget target) {

                // Find the dynamic form on the page.
                final Object objAtStopTraversal = 
 getParentContainer().visitChildren(new FindFormVisitor());
                if (objAtStopTraversal instanceof Form?) {
                    // Form found, invoke javascript submit
                    final Form? form = (Form?) objAtStopTraversal;


 target.appendJavascript(getEventHandler(form.getMarkupId(), ???, 
 this));
                }
            }
        } );

 protected CharSequence getEventHandler(final String formMarkupId, 
 final String inputName, final AbstractLink link) {
        final String formId = formMarkupId;
        final CharSequence url = 
        AppendingStringBuffer call = new AppendingStringBuffer(var
 wcall=wicketSubmitFormById(')
        .append(formId).append(', ').append(url).append(', );

        call.append(')
        .append(inputName)
        .append(' );
        call.append(,function() { }.bind(this),function() { 
 }.bind(this), function() { }.bind(this));;; return false;;);
        return call;
    }

 Berlin Brown


-
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



Adding attribute to selected menu item

2011-01-28 Thread Haman Abel

Hello to all,

i am trying to build a dynamic menu based on data from a database. So i 
thought i could build it like my code shows it. To highlight the 
selected menu i try to dynamically add an attribute to the li tag in the 
onClick method. I would also want to load and repaint other panels (for 
example loading sub menus ), when the user clicks a menu link. But it is 
not working. What am i doing wrong?


pre
ListViewMenu lv = new ListViewMenu(mainMenu, menuList) {
@Override
protected void populateItem(final ListItemMenu item) {
Menu menuItem = (Menu) item.getModelObject();
LinkMenu link = new LinkMenu(menuLink) {
@Override
public void onClick() {
item.add(new AttributeAppender(id, new 
Model(current_menu), ;));
System.out.println(item was clicked  + 
item.getPath());

}

};
link.add(new Label(menuCaption, 
menuItem.getMenuNameDe()));

item.add(link);
}
};
add(lv);
/pre

and this is my panel markup:

pre
body
wicket:panel
ul
li wicket:id=mainMenu
a href=# wicket:id=menuLinkspan wicket:id=menuCaption/span/a
/li
/ul
/wicket:panel
/body
/pre
My goal:

pre
body
wicket:panel
ul
li wicket:id=mainMenu id=current_menu
a href=# wicket:id=menuLinkspan wicket:id=menuCaption/span/a
/li
/ul
/wicket:panel
/body
/pre

Thank you for any help!


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



RE: Submit form from ajaxlink not a part of the form

2011-01-28 Thread Brown, Berlin [GCG-PFS]
I got it.

But I passed function() { return true; } ... To the post and preconditions. 

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Friday, January 28, 2011 12:52 AM
To: users@wicket.apache.org
Cc: berlin.br...@gmail.com
Subject: Re: Submit form from ajaxlink not a part of the form

add(new ajaxsubmitlink(submit, form));

-igor

On Thu, Jan 27, 2011 at 7:46 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:
 So, I was able to submit a form WITHOUT ajax.  Now, how can I submit a 
 form with ajax but from a link not associated with that form.  I tried 
 the following.    But, I couldn't get the proper URLs / Button?   Are 
 those needed for the wicketSubmFormById call?

 Also, do i have an issue using target.appendJavascript(...);

 ...

 If you look at the event handler method,

 public class MyPanel {

 public static final String
 JS_SUBMIT_THIS_WORKS_BUT_HOW_TO_SUBMIT_BY_AJAX = try { 
 document.forms['%s'].submit(); } catch(err) { alert('ERR:' + err); if 
 (window.console != undefined) { console.log(err); } };

 this.add(new AjaxLinkObject(link) {
            @Override
            public void onClick(final AjaxRequestTarget target) {

                // Find the dynamic form on the page.
                final Object objAtStopTraversal = 
 getParentContainer().visitChildren(new FindFormVisitor());
                if (objAtStopTraversal instanceof Form?) {
                    // Form found, invoke javascript submit
                    final Form? form = (Form?) objAtStopTraversal;


 target.appendJavascript(getEventHandler(form.getMarkupId(), ???, 
 this));
                }
            }
        } );

 protected CharSequence getEventHandler(final String formMarkupId, 
 final String inputName, final AbstractLink link) {
        final String formId = formMarkupId;
        final CharSequence url = 
        AppendingStringBuffer call = new AppendingStringBuffer(var
 wcall=wicketSubmitFormById(')
        .append(formId).append(', ').append(url).append(', );

        call.append(')
        .append(inputName)
        .append(' );
        call.append(,function() { }.bind(this),function() { 
 }.bind(this), function() { }.bind(this));;; return false;;);
        return call;
    }

 Berlin Brown


-
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: Adding attribute to selected menu item

2011-01-28 Thread Pedro Santos
Hi Haman, ListView items are recreated by default (see RepeatingView or
ListView#setReuseItems). So your code is adding an AttributeAppender to an
component that will be discarded in benefit of a new one for the next
render.

On Fri, Jan 28, 2011 at 10:28 AM, Haman Abel fha...@online.de wrote:

 Hello to all,

 i am trying to build a dynamic menu based on data from a database. So i
 thought i could build it like my code shows it. To highlight the selected
 menu i try to dynamically add an attribute to the li tag in the onClick
 method. I would also want to load and repaint other panels (for example
 loading sub menus ), when the user clicks a menu link. But it is not
 working. What am i doing wrong?

 pre
 ListViewMenu lv = new ListViewMenu(mainMenu, menuList) {
@Override
protected void populateItem(final ListItemMenu item) {
Menu menuItem = (Menu) item.getModelObject();
LinkMenu link = new LinkMenu(menuLink) {
@Override
public void onClick() {
item.add(new AttributeAppender(id, new
 Model(current_menu), ;));
System.out.println(item was clicked  +
 item.getPath());
}

};
link.add(new Label(menuCaption,
 menuItem.getMenuNameDe()));
item.add(link);
}
};
add(lv);
 /pre

 and this is my panel markup:

 pre
 body
 wicket:panel
 ul
 li wicket:id=mainMenu
 a href=# wicket:id=menuLinkspan wicket:id=menuCaption/span/a
 /li
 /ul
 /wicket:panel
 /body
 /pre
 My goal:

 pre
 body
 wicket:panel
 ul
 li wicket:id=mainMenu id=current_menu
 a href=# wicket:id=menuLinkspan wicket:id=menuCaption/span/a
 /li
 /ul
 /wicket:panel
 /body
 /pre

 Thank you for any help!


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




-- 
Pedro Henrique Oliveira dos Santos


Re: Nesting Links

2011-01-28 Thread Pedro Santos
I think the problem is that only IE has the window.event. Look at the
Accessing the event on http://www.quirksmode.org/js/introevents.html

nested anchor tags are ilegal:
http://www.w3.org/TR/html401/struct/links.html#h-12.2.2

On Fri, Jan 28, 2011 at 9:02 AM, armandoxxx armando@dropchop.comwrote:


 Hey man

 I've used your method but it's not working .. got any other ideas ???

 Regards

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

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




-- 
Pedro Henrique Oliveira dos Santos


PagingNavigator not working in PropertyListView

2011-01-28 Thread Duro

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

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


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



Re: PagingNavigator not working in PropertyListView

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



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

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

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



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


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



Custom implementation of IStringResourceLoader not working

2011-01-28 Thread armandoxxx

Hi guys ... 

I need some help with custom IStringResourceLoader



public class DictionaryResourceLoader implements IStringResourceLoader {

private static final Logger
LOG 
= LoggerFactory.getLogger(DictionaryResourceLoader.class);

private ControllerFactory
controllerFactory   
= null;


/**
 * Constructor.
 * @param theControllerFactory  reference to application
 */
public DictionaryResourceLoader(final ControllerFactory
theControllerFactory) {
this.controllerFactory  = theControllerFactory;
}



/* (non-Javadoc)
 * @see
org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(org.apache.wicket.Component,
java.lang.String)
 */
@Override
public String loadStringResource(final Component theComponent, final 
String
theKey) {
return theKey;
}


/* (non-Javadoc)
 * @see
org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(java.lang.Class,
java.lang.String, java.util.Locale, java.lang.String)
 */
@Override
public String loadStringResource(final Class? theClazz, final String
theKey, final Locale theLocale, final String theStyle) {
DictionaryController dict   =
(DictionaryController)this.controllerFactory.getController(DictionaryController.class);

return dict.getTerm(theKey, theLocale.getLanguage()); //calls 
backend to
get translated string for the key

}


}




in application init I have 

getResourceSettings().addStringResourceLoader(0, new
DictionaryResourceLoader(this.controllerFactory)); 



and in markup: 

wicket:message key=test.string/wicket:message 




and when I debug .. my DictionaryResourceLoader is not beeing called ..
neither method ... 

what am I doing wrong ? 

Regards

Armando
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Custom-implementation-of-IStringResourceLoader-not-working-tp3244747p3244747.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Custom implementation of IStringResourceLoader not working

2011-01-28 Thread Pedro Santos
Since loadStringResource(Component, String) implementation is returning the
message key, the Localizer thinks the message for the key was found.
Delegate its call to the loadStringResource(Class, String, Locale, String)
method that uses the dictionary.

On Fri, Jan 28, 2011 at 1:42 PM, armandoxxx armando@dropchop.comwrote:


 Hi guys ...

 I need some help with custom IStringResourceLoader



 public class DictionaryResourceLoader implements IStringResourceLoader {

private static final Logger
LOG
 =
 LoggerFactory.getLogger(DictionaryResourceLoader.class);

private ControllerFactory
controllerFactory
 = null;


/**
 * Constructor.
 * @param theControllerFactory  reference to application
 */
public DictionaryResourceLoader(final ControllerFactory
 theControllerFactory) {
this.controllerFactory  = theControllerFactory;
}



/* (non-Javadoc)
 * @see

 org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(org.apache.wicket.Component,
 java.lang.String)
 */
@Override
public String loadStringResource(final Component theComponent, final
 String
 theKey) {
return theKey;
}


/* (non-Javadoc)
 * @see

 org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(java.lang.Class,
 java.lang.String, java.util.Locale, java.lang.String)
 */
@Override
public String loadStringResource(final Class? theClazz, final
 String
 theKey, final Locale theLocale, final String theStyle) {
DictionaryController dict   =

 (DictionaryController)this.controllerFactory.getController(DictionaryController.class);

return dict.getTerm(theKey, theLocale.getLanguage());
 //calls backend to
 get translated string for the key

}


 }




 in application init I have

 getResourceSettings().addStringResourceLoader(0, new
 DictionaryResourceLoader(this.controllerFactory));



 and in markup:

 wicket:message key=test.string/wicket:message




 and when I debug .. my DictionaryResourceLoader is not beeing called ..
 neither method ...

 what am I doing wrong ?

 Regards

 Armando
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Custom-implementation-of-IStringResourceLoader-not-working-tp3244747p3244747.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




-- 
Pedro Henrique Oliveira dos Santos


RE: 1.5.x javadoc

2011-01-28 Thread Zhubin Salehi
No 1.5.x!

-Original Message-
From: Steve Swinsburg [mailto:steve.swinsb...@gmail.com] 
Sent: January 28, 2011 12:04 AM
To: users@wicket.apache.org
Subject: Re: 1.5.x javadoc

Wicket By Example has a section for the Javadocs, but it needs a refresh.
http://wicketbyexample.com/api/

cheers,
Steve

On 28/01/2011, at 10:36 AM, Todd Wolff wrote:

 Hi,
 
 
 
 Is there a URL where I can pull up javadoc for latest 1.5 RC without
 having to checkout source and generate myself?  Thanks.
 


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


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



Using Wicket with businness model classes that check for rules

2011-01-28 Thread fernandospr

Hi all,

I'm new to Wicket.
I'm building an application, actually finished most of the businness model
classes.
My businness classes don't have a default constructor, they have a
constructor with parameters. Inside the constructor, it calls to the
setters. These have the business rules implemented.

For example:
public User(String email, String name,
   String password, Date birth) throws BusinessException {
   setEmail(email);
   setName(name);
   setPassword(password);
   setBirth(birth);
}

public void setEmail(String email) throws BusinessException {
   testSetEmail(email);
   doSetEmail(email);
}

private void testSetEmail(String email) throws BusinessException {
   // Check the format and if it is wrong throw a BusinessException
}

private void doSetEmail(String email) {
   this.email = email;
}


Now, this is a trivial example, I have much more complex ones.
What I want to know is how should I use this kind of classes with Wicket.
I clearly cannot use the User object and a CompoundPropertyModel because I
don't have a default constructor.
So, should I use a UserDTO and a CompoundPropertyModel and have the
textfields in a form binded to it ? and then after the form is submitted
obtain the properties from the DTO and create the real User object? Of
course, I should try/catch the call to the constructor and if any exception
is thrown show that to the user in a feedback panel.

What do you think?

Thanks. 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245298.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread James Carman
What about having a Validatable interface instead?  I realize that
this would allow you to put your business objects into an invalid
state, but it would help make things easier :)

On Fri, Jan 28, 2011 at 3:18 PM, fernandospr fernando...@gmail.com wrote:

 Hi all,

 I'm new to Wicket.
 I'm building an application, actually finished most of the businness model
 classes.
 My businness classes don't have a default constructor, they have a
 constructor with parameters. Inside the constructor, it calls to the
 setters. These have the business rules implemented.

 For example:
 public User(String email, String name,
               String password, Date birth) throws BusinessException {
   setEmail(email);
   setName(name);
   setPassword(password);
   setBirth(birth);
 }

 public void setEmail(String email) throws BusinessException {
   testSetEmail(email);
   doSetEmail(email);
 }

 private void testSetEmail(String email) throws BusinessException {
   // Check the format and if it is wrong throw a BusinessException
 }

 private void doSetEmail(String email) {
   this.email = email;
 }


 Now, this is a trivial example, I have much more complex ones.
 What I want to know is how should I use this kind of classes with Wicket.
 I clearly cannot use the User object and a CompoundPropertyModel because I
 don't have a default constructor.
 So, should I use a UserDTO and a CompoundPropertyModel and have the
 textfields in a form binded to it ? and then after the form is submitted
 obtain the properties from the DTO and create the real User object? Of
 course, I should try/catch the call to the constructor and if any exception
 is thrown show that to the user in a feedback panel.

 What do you think?

 Thanks.
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245298.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread fernandospr

Thanks James that was a quick response.
The problem is that I already have many classes designed this way.
Also, the classes where created on purpose this way as an analysis/design
decision, I mean, only valid business objects should be created.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245323.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread James Carman
Well, you could create your own BusinessPropertyModel class that
subclasses PropertyModel and catches those exceptions, perhaps.  You'd
have to figure out an elegant way to propagate the error message to
the FormComponent that caused the issue.  If you don't need
component-specific error messages you could just call error() on the
Session, I guess.

On Fri, Jan 28, 2011 at 3:34 PM, fernandospr fernando...@gmail.com wrote:

 Thanks James that was a quick response.
 The problem is that I already have many classes designed this way.
 Also, the classes where created on purpose this way as an analysis/design
 decision, I mean, only valid business objects should be created.
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245323.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread fernandospr

Thanks James I'll investigate on extending PropertyModel.

Currently I'm doing the following:

public class UserRegistrationPage extends WebPage {
@SpringBean
private UserService userService;

private FeedbackPanel feedbackPanel;
private UserDto userDto; // only has the User properties

@SuppressWarnings(unchecked)
public UserRegistrationPage() {
feedbackPanel = new FeedbackPanel(feedback);
userDto = new UserDto();
CompoundPropertyModel userDtoModel = new 
CompoundPropertyModel(userDto);
// bind to the DTO

Form registrarForm = new Form(registerForm, userDtoModel){
@Override
protected void onSubmit() {
try {
// Create a real User and obtain the
data from the DTO
User user = new 
User(userDto.getEmail(), 

userDto.getName(), 

userDto.getPassword(), 

userDto.getBirth());
userService.save(user); // service 
calls the dao which actually saves
to DB
} catch (Exception e) { // The Businness 
Exception has the message error
feedbackPanel.warn(e.getMessage());
}
}
};  

registerForm.add(new TextField(email).setRequired(true)); // 
form binded
to the DTO properties
...
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread MZemeck
Just a suggestion, pass the UserDto to the service layer and let the 
service layer do the conversion.  Then you can look at a href=
http://code.google.com/p/simple-object-assembler/;Simple Object 
Assembler/a to encapsulate the conversion.  Hint: use 
automapWhenNoConverterFound property and you won't need to write any 
converters for Simple Object Assembler (assuming your properties follow a 
naming convention).




From:   fernandospr fernando...@gmail.com
To: users@wicket.apache.org
Date:   01/28/2011 04:00 PM
Subject:Re: Using Wicket with businness model classes that check 
for rules




Thanks James I'll investigate on extending PropertyModel.

Currently I'm doing the following:

public class UserRegistrationPage extends WebPage {
 @SpringBean
 private UserService userService;

 private FeedbackPanel feedbackPanel;
 private UserDto userDto; // only has the User properties
 
 @SuppressWarnings(unchecked)
 public UserRegistrationPage() {
 feedbackPanel = new 
FeedbackPanel(feedback);
 userDto = new UserDto();
 CompoundPropertyModel userDtoModel = new 
CompoundPropertyModel(userDto);
// bind to the DTO
 
 Form registrarForm = new 
Form(registerForm, userDtoModel){
 @Override
 protected void onSubmit() 
{
 try {
// Create a real User and obtain 
the
data from the DTO
  User user = new User(userDto.getEmail(), 
   userDto.getName(), 
   userDto.getPassword(), 
   userDto.getBirth());
  userService.save(user); // service calls the dao which actually saves
to DB
 } catch 
(Exception e) { // The Businness Exception has the message error
  feedbackPanel.warn(e.getMessage());
 }
 }
 }; 

 registerForm.add(new 
TextField(email).setRequired(true)); // form binded
to the DTO properties
 ...
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html

Sent from the Users forum mailing list archive at Nabble.com.

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






Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread James Carman
But, then you lose the component-specific error messages.

On Fri, Jan 28, 2011 at 4:08 PM,  mzem...@osc.state.ny.us wrote:
 Just a suggestion, pass the UserDto to the service layer and let the
 service layer do the conversion.  Then you can look at a href=
 http://code.google.com/p/simple-object-assembler/;Simple Object
 Assembler/a to encapsulate the conversion.  Hint: use
 automapWhenNoConverterFound property and you won't need to write any
 converters for Simple Object Assembler (assuming your properties follow a
 naming convention).




 From:   fernandospr fernando...@gmail.com
 To:     users@wicket.apache.org
 Date:   01/28/2011 04:00 PM
 Subject:        Re: Using Wicket with businness model classes that check
 for rules




 Thanks James I'll investigate on extending PropertyModel.

 Currently I'm doing the following:

 public class UserRegistrationPage extends WebPage {
                 @SpringBean
                 private UserService userService;

                 private FeedbackPanel feedbackPanel;
                 private UserDto userDto; // only has the User properties

                 @SuppressWarnings(unchecked)
                 public UserRegistrationPage() {
                                 feedbackPanel = new
 FeedbackPanel(feedback);
                                 userDto = new UserDto();
                                 CompoundPropertyModel userDtoModel = new
 CompoundPropertyModel(userDto);
 // bind to the DTO

                                 Form registrarForm = new
 Form(registerForm, userDtoModel){
                                                 @Override
                                                 protected void onSubmit()
 {
                                                                 try {
                                        // Create a real User and obtain
 the
 data from the DTO
  User user = new User(userDto.getEmail(),
   userDto.getName(),
   userDto.getPassword(),
   userDto.getBirth());
  userService.save(user); // service calls the dao which actually saves
 to DB
                                                                 } catch
 (Exception e) { // The Businness Exception has the message error
  feedbackPanel.warn(e.getMessage());
                                                                 }
                                                 }
                                 };

                                 registerForm.add(new
 TextField(email).setRequired(true)); // form binded
 to the DTO properties
                                 ...
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html

 Sent from the Users forum mailing list archive at Nabble.com.

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






 Notice: This communication, including any attachments, is intended solely
 for the use of the individual or entity to which it is addressed. This
 communication may contain information that is protected from disclosure
 under State and/or Federal law. Please notify the sender immediately if
 you have received this communication in error and delete this email from
 your system. If you are not the intended recipient, you are requested not
 to disclose, copy, distribute or take any action in reliance on the
 contents of this information.

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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread James Carman
The problem with that approach is that you don't get all of the errors
at once. The user would have to submit, see an error, fix, resubmit,
see another error, etc.


On Fri, Jan 28, 2011 at 3:59 PM, fernandospr fernando...@gmail.com wrote:

 Thanks James I'll investigate on extending PropertyModel.

 Currently I'm doing the following:

 public class UserRegistrationPage extends WebPage {
        @SpringBean
        private UserService userService;

        private FeedbackPanel feedbackPanel;
        private UserDto userDto; // only has the User properties

        @SuppressWarnings(unchecked)
        public UserRegistrationPage() {
                feedbackPanel = new FeedbackPanel(feedback);
                userDto = new UserDto();
                CompoundPropertyModel userDtoModel = new 
 CompoundPropertyModel(userDto);
 // bind to the DTO

                Form registrarForm = new Form(registerForm, userDtoModel){
                        @Override
                        protected void onSubmit() {
                                try {
                                        // Create a real User and obtain the
 data from the DTO
                                        User user = new 
 User(userDto.getEmail(),
                                                                               
  userDto.getName(),
                                                                               
  userDto.getPassword(),
                                                                               
  userDto.getBirth());
                                        userService.save(user); // service 
 calls the dao which actually saves
 to DB
                                } catch (Exception e) { // The Businness 
 Exception has the message error
                                        feedbackPanel.warn(e.getMessage());
                                }
                        }
                };

                registerForm.add(new TextField(email).setRequired(true)); // 
 form binded
 to the DTO properties
                ...
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html
 Sent from the Users forum mailing list archive at Nabble.com.

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



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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread MZemeck
Right right right, good catch, but I suppose you could write a conversion 
service which throws the business exception.  Not really a solution to 
your question, but it would clean up your code a bit and take conversion 
logic out of the frontend.



From:   James Carman ja...@carmanconsulting.com
To: users@wicket.apache.org
Date:   01/28/2011 04:13 PM
Subject:Re: Using Wicket with businness model classes that check 
for rules
Sent by:jcar...@carmanconsulting.com



But, then you lose the component-specific error messages.

On Fri, Jan 28, 2011 at 4:08 PM,  mzem...@osc.state.ny.us wrote:
 Just a suggestion, pass the UserDto to the service layer and let the
 service layer do the conversion.  Then you can look at a href=
 http://code.google.com/p/simple-object-assembler/;Simple Object
 Assembler/a to encapsulate the conversion.  Hint: use
 automapWhenNoConverterFound property and you won't need to write any
 converters for Simple Object Assembler (assuming your properties follow 
a
 naming convention).




 From:   fernandospr fernando...@gmail.com
 To: users@wicket.apache.org
 Date:   01/28/2011 04:00 PM
 Subject:Re: Using Wicket with businness model classes that check
 for rules




 Thanks James I'll investigate on extending PropertyModel.

 Currently I'm doing the following:

 public class UserRegistrationPage extends WebPage {
 @SpringBean
 private UserService userService;

 private FeedbackPanel feedbackPanel;
 private UserDto userDto; // only has the User properties

 @SuppressWarnings(unchecked)
 public UserRegistrationPage() {
 feedbackPanel = new
 FeedbackPanel(feedback);
 userDto = new UserDto();
 CompoundPropertyModel userDtoModel = new
 CompoundPropertyModel(userDto);
 // bind to the DTO

 Form registrarForm = new
 Form(registerForm, userDtoModel){
 @Override
 protected void 
onSubmit()
 {
 try {
// Create a real User and obtain
 the
 data from the DTO
  User user = new User(userDto.getEmail(),
   userDto.getName(),
   userDto.getPassword(),
   userDto.getBirth());
  userService.save(user); // service calls the dao which actually saves
 to DB
 } catch
 (Exception e) { // The Businness Exception has the message error
  feedbackPanel.warn(e.getMessage());
 }
 }
 };

 registerForm.add(new
 TextField(email).setRequired(true)); // form binded
 to the DTO properties
 ...
 --
 View this message in context:
 
http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html


 Sent from the Users forum mailing list archive at Nabble.com.

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






 Notice: This communication, including any attachments, is intended 
solely
 for the use of the individual or entity to which it is addressed. This
 communication may contain information that is protected from disclosure
 under State and/or Federal law. Please notify the sender immediately if
 you have received this communication in error and delete this email from
 your system. If you are not the intended recipient, you are requested 
not
 to disclose, copy, distribute or take any action in reliance on the
 contents of this information.

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






Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.

Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread James Carman
I don't know that I would agree that the conversion logic needs to be
taken out of the front end.  The front end is where the data is
collected.  It may have to be collected in a specific way
(FileUploadField perhaps) that is connected with the chosen
presentation layer (Wicket in our case).  It is the UI's
responsibility to translate the input it receives from its user(s) and
transform it into a format that the business model requires.  That's
my $0.02

On Fri, Jan 28, 2011 at 4:19 PM,  mzem...@osc.state.ny.us wrote:
 Right right right, good catch, but I suppose you could write a conversion
 service which throws the business exception.  Not really a solution to
 your question, but it would clean up your code a bit and take conversion
 logic out of the frontend.



 From:   James Carman ja...@carmanconsulting.com
 To:     users@wicket.apache.org
 Date:   01/28/2011 04:13 PM
 Subject:        Re: Using Wicket with businness model classes that check
 for rules
 Sent by:        jcar...@carmanconsulting.com



 But, then you lose the component-specific error messages.

 On Fri, Jan 28, 2011 at 4:08 PM,  mzem...@osc.state.ny.us wrote:
 Just a suggestion, pass the UserDto to the service layer and let the
 service layer do the conversion.  Then you can look at a href=
 http://code.google.com/p/simple-object-assembler/;Simple Object
 Assembler/a to encapsulate the conversion.  Hint: use
 automapWhenNoConverterFound property and you won't need to write any
 converters for Simple Object Assembler (assuming your properties follow
 a
 naming convention).




 From:   fernandospr fernando...@gmail.com
 To:     users@wicket.apache.org
 Date:   01/28/2011 04:00 PM
 Subject:        Re: Using Wicket with businness model classes that check
 for rules




 Thanks James I'll investigate on extending PropertyModel.

 Currently I'm doing the following:

 public class UserRegistrationPage extends WebPage {
                 @SpringBean
                 private UserService userService;

                 private FeedbackPanel feedbackPanel;
                 private UserDto userDto; // only has the User properties

                 @SuppressWarnings(unchecked)
                 public UserRegistrationPage() {
                                 feedbackPanel = new
 FeedbackPanel(feedback);
                                 userDto = new UserDto();
                                 CompoundPropertyModel userDtoModel = new
 CompoundPropertyModel(userDto);
 // bind to the DTO

                                 Form registrarForm = new
 Form(registerForm, userDtoModel){
                                                 @Override
                                                 protected void
 onSubmit()
 {
                                                                 try {
                                        // Create a real User and obtain
 the
 data from the DTO
  User user = new User(userDto.getEmail(),
   userDto.getName(),
   userDto.getPassword(),
   userDto.getBirth());
  userService.save(user); // service calls the dao which actually saves
 to DB
                                                                 } catch
 (Exception e) { // The Businness Exception has the message error
  feedbackPanel.warn(e.getMessage());
                                                                 }
                                                 }
                                 };

                                 registerForm.add(new
 TextField(email).setRequired(true)); // form binded
 to the DTO properties
                                 ...
 --
 View this message in context:

 http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html


 Sent from the Users forum mailing list archive at Nabble.com.

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






 Notice: This communication, including any attachments, is intended
 solely
 for the use of the individual or entity to which it is addressed. This
 communication may contain information that is protected from disclosure
 under State and/or Federal law. Please notify the sender immediately if
 you have received this communication in error and delete this email from
 your system. If you are not the intended recipient, you are requested
 not
 to disclose, copy, distribute or take any action in reliance on the
 contents of this information.

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






 Notice: This communication, including any attachments, is intended solely
 for the use of the individual or entity to which it is addressed. This
 communication may contain information that is protected from disclosure
 under State and/or 

Add Component if markup exists?

2011-01-28 Thread Benedikt Rothe

Hi everybody

Is it possible to add a Wicket-Component depending on the existence of a 
wicket:id

in the Markup? Something like

  // Code with adding Components
  if there is a Markup-Element with WicketId Submit then
  this.add(new Button(Submit,...));

As far as I  understood, it is not possible in this way. But maybe 
there's an #

equivalent solution?

Bye
Benedikt

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



Re: Using Wicket with businness model classes that check for rules

2011-01-28 Thread MZemeck
Ok but if the conversion has to be done multiple times why not encapsulate 
it and clean up your code, rather than coding a conversion for each dto 
every time its needed.  With my suggestion the frontend calls a service to 
do the conversion, then supplies the primed object to the service to 
persist it.  I somewhat agree the service perhaps should not need to know 
about the frontend's model to do its task.

Never the less its probably a matter of taste...

Back to the original question...what if you extract your business object 
validation out into a service.  Then your business objects can call that 
service to validate, and you can write custom validators for wicket that 
call the same validation service.  This would prevent you from having to 
write validations twice in both the business layer and frontend and gives 
you the ability to attach an error at the component level, no?



From:   James Carman ja...@carmanconsulting.com
To: users@wicket.apache.org
Date:   01/28/2011 04:46 PM
Subject:Re: Using Wicket with businness model classes that check 
for rules
Sent by:jcar...@carmanconsulting.com



I don't know that I would agree that the conversion logic needs to be
taken out of the front end.  The front end is where the data is
collected.  It may have to be collected in a specific way
(FileUploadField perhaps) that is connected with the chosen
presentation layer (Wicket in our case).  It is the UI's
responsibility to translate the input it receives from its user(s) and
transform it into a format that the business model requires.  That's
my $0.02

On Fri, Jan 28, 2011 at 4:19 PM,  mzem...@osc.state.ny.us wrote:
 Right right right, good catch, but I suppose you could write a 
conversion
 service which throws the business exception.  Not really a solution to
 your question, but it would clean up your code a bit and take conversion
 logic out of the frontend.



 From:   James Carman ja...@carmanconsulting.com
 To: users@wicket.apache.org
 Date:   01/28/2011 04:13 PM
 Subject:Re: Using Wicket with businness model classes that check
 for rules
 Sent by:jcar...@carmanconsulting.com



 But, then you lose the component-specific error messages.

 On Fri, Jan 28, 2011 at 4:08 PM,  mzem...@osc.state.ny.us wrote:
 Just a suggestion, pass the UserDto to the service layer and let the
 service layer do the conversion.  Then you can look at a href=
 http://code.google.com/p/simple-object-assembler/;Simple Object
 Assembler/a to encapsulate the conversion.  Hint: use
 automapWhenNoConverterFound property and you won't need to write any
 converters for Simple Object Assembler (assuming your properties follow
 a
 naming convention).




 From:   fernandospr fernando...@gmail.com
 To: users@wicket.apache.org
 Date:   01/28/2011 04:00 PM
 Subject:Re: Using Wicket with businness model classes that 
check
 for rules




 Thanks James I'll investigate on extending PropertyModel.

 Currently I'm doing the following:

 public class UserRegistrationPage extends WebPage {
 @SpringBean
 private UserService userService;

 private FeedbackPanel feedbackPanel;
 private UserDto userDto; // only has the User 
properties

 @SuppressWarnings(unchecked)
 public UserRegistrationPage() {
 feedbackPanel = new
 FeedbackPanel(feedback);
 userDto = new UserDto();
 CompoundPropertyModel userDtoModel = 
new
 CompoundPropertyModel(userDto);
 // bind to the DTO

 Form registrarForm = new
 Form(registerForm, userDtoModel){
 @Override
 protected void
 onSubmit()
 {
 try {
// Create a real User and obtain
 the
 data from the DTO
  User user = new User(userDto.getEmail(),
   userDto.getName(),
   userDto.getPassword(),
   userDto.getBirth());
  userService.save(user); // service calls the dao which actually saves
 to DB
 } catch
 (Exception e) { // The Businness Exception has the message error
  feedbackPanel.warn(e.getMessage());
 }
 }
 };

 registerForm.add(new
 TextField(email).setRequired(true)); // form binded
 to the DTO properties
 ...
 --
 View this message in context:

 
http://apache-wicket.1842946.n4.nabble.com/Using-Wicket-with-businness-model-classes-that-check-for-rules-tp3245298p3245378.html



 Sent from the Users forum mailing list archive at Nabble.com.

 

Re: Add Component if markup exists?

2011-01-28 Thread Igor Vaynberg
if it only needs to live during render there is IComponentResolver

if you need it to have a normal lifecycle you can analyze the markup
and add the component if not already added. in 1.5 you can use
getmarkup in onmarkupattached() or oninitialize()

-igor

On Fri, Jan 28, 2011 at 2:11 PM, Benedikt Rothe benedikt.ro...@qleo.de wrote:
 Hi everybody

 Is it possible to add a Wicket-Component depending on the existence of a
 wicket:id
 in the Markup? Something like

  // Code with adding Components
  if there is a Markup-Element with WicketId Submit then
      this.add(new Button(Submit,...));

 As far as I  understood, it is not possible in this way. But maybe there's
 an #
 equivalent solution?

 Bye
 Benedikt

 -
 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



Wicket : Articles Blogs

2011-01-28 Thread Arjun Dhar

Hi, I am looking to incorporate a section on client websites for Articles 
Blogs. 
I've used Roller independently, but I feel its too bulky and self centered
to integrate with a site.

Do we have ready made components in  Wicket that can help here? 
What do you guys use with Brix?
Can I rip it off and use with my own Wicket based framework?

Anything on: Spring, Wicket  JPA is ideally welcome.

thanks

-
Don't take life too seriously, your'e not getting out it alive anyway!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Articles-Blogs-tp3245765p3245765.html
Sent from the Users forum mailing list archive at Nabble.com.

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