Re: How to load javascript file in apache wicket?

2012-11-19 Thread delta458
@Martin: yes, by the browser...

I made a detailed description of the problem here:
http://stackoverflow.com/questions/13447212/serialize-several-null-objects-with-gson
http://stackoverflow.com/questions/13447212/serialize-several-null-objects-with-gson
  

regards 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-load-javascript-file-in-apache-wicket-tp4653976p4653988.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: How to load javascript file in apache wicket?

2012-11-19 Thread delta458
Edit: This is the correct link

http://stackoverflow.com/questions/13443361/load-resources-javascript-in-a-web-application-framework-wicket-correctly
http://stackoverflow.com/questions/13443361/load-resources-javascript-in-a-web-application-framework-wicket-correctly
  



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-load-javascript-file-in-apache-wicket-tp4653976p4653989.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



Include one .js file into another .js file in wicket

2012-11-17 Thread delta458
Hello,

I have 2 .js files.

Invoice.js: content is something like:
/var price
var recipient
.../

Rules.js: content is something like:
/if(price  100){
//do Something
}/

What I need: I need to include the Invoice.js into Rules.js.
What my application does: I fill in a form and with compound proporty model
my POJO Invoice.java will be set. If I submit my form. The Invoice Object
will be mapped to the Invoice.js file. That means

/var price;/ inside Invoice.js will be generated from /private double
price;/ inside Invoice.java 

Then Rules.js should be able to read var price.
But how can I include my Invoice.js into the Rules.js in wicket?

Any help appreciated!
regards



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Include-one-js-file-into-another-js-file-in-wicket-tp4653973.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: Relative Path and Resource loading in wicket

2012-11-16 Thread delta458
@Ernest I just need to write some variables to the .js file
like

var price;
var user;

@MartinGrigorov so what should I do to make this work? How can I set my
resource to the classpath? and what should I call to make it work?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930p4653945.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



Relative Path and Resource loading in wicket

2012-11-15 Thread delta458
Hello,

Im sitting now 6 hours non-stop on this problem and cant get it work.

I want a simple thing.

I have a Invoice.js file in my resource folder.
I want to get this file and write something to it: so I did:

/URL url = getClass().getResource(Invoice.js);
File file = new File(url.getPath());

System.out.println(url.getPath());
BufferedWriter out = new BufferedWriter(new FileWriter(file),
32768);
out.write(TEST);
out.close();/

But thats not working. He writes into the file successfully, but saves the
file into the maven target folder :(
I need to read from that file later, so I need to use it again.

How can I make wicket to write to the relative path and not save it in the
target folder... 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Relative-Path-and-Resource-loading-in-wicket-tp4653930.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: Handle feedback-Messages with a custom validation framework

2012-11-04 Thread delta458
I already got it working... with the following code:

/...
//Textfields or Form Components GO HERE...

@Override
public void onValidateModelObjects() {
ValidationProcess vp = new ValidationProcess();
vp.validate(Rules.js, r);
msg = ;
if (vp.getConstraintViolations().size()  0) {

for (String s : vp.getConstraintViolations()) {
if (s.contains(;)) {
String[] splitted = s.split(;);
String elementname = splitted[0];
String errorMessage = splitted[1];

if (elementname.equals(price)) {
//SET Error of Component, will be automatically
display by FeedbackPanel...
price.error(elementname +   + errorMessage +
. );
  } else if (elementname.equals(recipient)) {
recipient.error(elementname +   +
errorMessage);
}
}
}
}
}

//Rest of the Code/



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Handle-feedback-Messages-with-a-custom-validation-framework-tp4653599p4653605.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



Handle feedback-Messages with a custom validation framework

2012-11-03 Thread delta458
Hi all,

I am using my own validation, but the view of the form (e.g. if a component
is invalid) should be highlighted or customized within wicket...

So e.g. I have my Wicket Form

/form wicket:id=inputForm
 p
 label for=RecipientRecipient/label
 input wicket:id=Recipient id=Recipient type=text
size=40/
 /p
 p
 label for=DetailsDetails/label
 input wicket:id=Details id=Details type=text size=40/
 /p
/form/

Then I have my Form.java: Here I set the values of my Java Object Invoice
and use *onValidateModelObjects* to override the wicket validation and use
my own validation... This method just calls a simple own created
ValidatorObject that takes care of the validation...
/
public InvoiceForm() {
...

FormInvoice form = new Form(inputForm, formModel) {
/*
 * Validation takes place here
 */
@Override
public void onValidateModelObjects() {
ValidationProcess vp = new ValidationProcess();
vp.validate(Rules.js, r);
msg = ;
if (vp.getConstraintViolations().size()  0) {

for (String s : vp.getConstraintViolations()) {
msg = msg + s;
}
} else {
msg = no errors.;
}
}
};

//adding Textfields to the Form etc...

...
}/

What I need: Above you can see that my errorMessages will be saved into the
msg String! Now what I want is Wicket to take this String and apply it to
the Wicket FeedBackMessage System or however...

*1. I need to get the component that will be rendered at the moment...
2. I have to set the error Message of this component to my component...

how can I do that?*

I guess I need to override some methods, but I dont know which ones and
where...




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Handle-feedback-Messages-with-a-custom-validation-framework-tp4653599.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: highlight invalid fields with custom Validation Framework?

2012-10-17 Thread delta458
Hi Martin,
thanks so much for the replies... almost done, some little questions still
there.. I got it working, could you verify that its right what I made? :)

1)
*//Had Error: Wrong number of type arguments, required 2 - It works when I
do  IVisitorComponent,Void ;-) 
public class ShinyFormVisitor implements IVisitorComponent,Serializable {*

Set visited = new HashSet();

public void component(final Component c, final IVisitVoid visit
/*[2]*/) {
if (!visited.contains(c)) {
visited.add(c);
c.add(new RequiredBorder());
c.add(new ValidationMsgBehavior());
c.add(new ErrorHighlightBehavior());
}
}

...

private class ValidationMsgBehavior extends Behavior {

public void onRendered(Component c) {
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
  * //Had error, now working with this.. thats right?
error =
fc.getFeedbackMessages().first().getLevelAsString();*
   
} else {
error = Your input is invalid.;
}
fc.getResponse().write(
div class=\validationMsg\ + error + /div);
}
}
}
}


2) Do you know any good wicket tutorials/example where I can learn how to
work with customized FeedbackMessages?

thanks..




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4653024.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: highlight invalid fields with custom Validation Framework?

2012-10-15 Thread delta458
I used the ShinyFormVisitor principle as described in the pdf: and I get
following errors(in bold):

public class ShinyFormVisitor implements IVisitor, Serializable {

Set visited = new HashSet();

public Object component(Component c) {
if (!visited.contains(c)) {
visited.add(c);
c.setComponentBorder(new RequiredBorder());
c.add(new ValidationMsgBehavior());
c.add(new ErrorHighlightBehavior());
}
*//CONTINUE_TRAVERSAL could not be found*
return *IVisitor.CONTINUE_TRAVERSAL*;
}

private class RequiredBorder extends BorderBehavior {

public void renderAfter(Component component) {
FormComponent fc = (FormComponent) component;
if (fc.isRequired()) {
super.afterRender(component);
}
}
}

*//AbstractBehaviour could not be found*
private class ValidationMsgBehavior extends *AbstractBehavior* {

public void onRendered(Component c) {
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
*//getFeedbackMessage() could not be found*
error =*
fc.getFeedbackMessage()*.getMessage().toString();
} else {
error = Your input is invalid.;
}
fc.getResponse().write(
div class=\validationMsg\ + error + /div);
}
}
}

*//AbstractBehaviour could not be found*
private class ErrorHighlightBehavior extends *AbstractBehavior* {

public void onComponentTag(Component c, ComponentTag tag) {
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
tag.put(class, error);
}
}
}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4652978.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: highlight invalid fields with custom Validation Framework?

2012-10-15 Thread delta458
Alright, I have something like this now: Problems/Errors are *bold*
*
//Here is a problem with the class: it says: ShinyFormVisitor is not
abstract and does not override abstract method component(Object,IVisit) in
IVisitor*
public class *ShinyFormVisitor* implements IVisitor, Serializable {

Set visited = new HashSet();

*//Is that ok now? with IVisitor for wicket 6.0?*
public void component(final Component c, final IVisitVoid visit) {
if (!visited.contains(c)) {
visited.add(c);
c.add(new RequiredBorder());
c.add(new ValidationMsgBehavior());
c.add(new ErrorHighlightBehavior());
}
   visit.dontGoDeeper();
}

private class RequiredBorder extends BorderBehavior {

public void renderAfter(Component component) {
FormComponent fc = (FormComponent) component;
if (fc.isRequired()) {
super.afterRender(component);
}
}
}

private class ValidationMsgBehavior extends Behavior {

public void onRendered(Component c) {
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
String error;
if (fc.hasFeedbackMessage()) {
*//getFeedbackMessage() could not be found*
error =
fc.*getFeedbackMessage()*.getMessage().toString();
} else {
error = Your input is invalid.;
}
fc.getResponse().write(
div class=\validationMsg\ + error + /div);
}
}
}

private class ErrorHighlightBehavior extends Behavior {

@Override
public void onComponentTag(Component c, ComponentTag tag) {
FormComponent fc = (FormComponent) c;
if (!fc.isValid()) {
tag.put(class, error);
}
}
}
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/highlight-invalid-fields-with-custom-Validation-Framework-tp4652949p4652990.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: button submit

2012-10-13 Thread delta458
Oh the solution is validation.
ONLY when you have a validated form (all inputs are inserted) then the
submit button will be called.

You can add a feedback panel, which will help you:

in JAVA:

form.add(new FeedbackPanel(feedback));

in HTML:
form
...
  
...
/form



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/button-submit-tp4650594p4652941.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



CompoundPropertyModel not working... Warning message

2012-10-13 Thread delta458
Tried so much... still not working..
I get the following warning message:
/WARNING: A ResourceReference wont be created for a resource with key
[scope: template.BasePage; name: wicket-logo.png; locale: null; style: null;
variation: null] because it cannot be located./

Here is the Java File:


And the HTML file:




What am I missing?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CompoundPropertyModel-not-working-Warning-message-tp4652942.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: CompoundPropertyModel not working... Warning message

2012-10-13 Thread delta458
I disabled default form processing because I need to, for my project. I will
use another validation framework for validating. 

Also when it is enabled, my object was not populated...

I will try again though...



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CompoundPropertyModel-not-working-Warning-message-tp4652942p4652944.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: CompoundPropertyModel not working... Warning message

2012-10-13 Thread delta458
Ah great. It works now.

I enabled the validation and somehow it works now... I tested it x times
before with no results..

well thanks.. :)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CompoundPropertyModel-not-working-Warning-message-tp4652942p4652946.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