All examples throwing internal error http://wicketstuff.org/wicket13/repeater/

2008-10-09 Thread nanotech

Just a fyi

All the examples at http://wicketstuff.org/wicket13/repeater/ are throwing
internal error.
-- 
View this message in context: 
http://www.nabble.com/All-examples-throwing-internal-error-http%3A--wicketstuff.org-wicket13-repeater--tp19906710p19906710.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Closing ModalWindow using javascript:window.close()

2008-10-07 Thread nanotech

Hi,

In my project there is a modal window.In event of WicketRuntimeException it
goes to custom Internal Error page. That Page has a button which overrides
onComponetTag method and  attaches javascript:window.close() with
onclick event. So that user can close the modal window.(I don't want user
to use [X] button in right top corner so I have hidden that button through
CSS). The problem is this [javascript:window.close() ] does not close modal
window but it does work in regaular page.(i.e. if execption occurs on a
regualr page then after the request is forwarded to Custom Internal error
page then user is able to click on close button and the browser window
closes.)

Can some one please suggest me how to achieve this is modal window.

Thanks,
RG   
-- 
View this message in context: 
http://www.nabble.com/Closing-ModalWindow-using-javascript%3Awindow.close%28%29-tp19860774p19860774.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Updating model for DropDownChoice

2008-09-23 Thread nanotech

Hi,

I have a search form which contains multiple search fields(as TextFields)
and also there is dropdown from which user can select the search criteria.
The search results are displayed in the same page at bottom.
I want to clear the search Form with help of Reset button in the form.
Question :
1. If I refresh the form(by wrapping it in WebMarkupContainer) it removes
the Choose One field. The solution to that I found was to set
setNullValid(true). But, the problem with that is it just displays the empty
value..but I really want Choose One or Select One in dropdown. Even by
putting null=Select One in properties file, it does not show Select One
option in drop-down if I have setNullValid(true) . So, How Can I have both?
i.e When I set setNullValid(true) how can I get Select One to show up in
DropDown.

2. Also, when I update the webmarkupcontainer, to clear the search the
dropdown still shows the pervious search criteria. It does not update the
model for dropdown to first value or Choose One.

Can someone please give me pointers?

Thanks,
~R 
-- 
View this message in context: 
http://www.nabble.com/Updating-model-for-DropDownChoice-tp19628281p19628281.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



All Jars are exposed at :::: http://localhost:8080/contextroot/resources/org.apache.wicket.ajax.WicketAjaxReference

2008-09-17 Thread nanotech

Hi All,

In one of the security tests for the web app I am working on the following
url
http://localhost:8080/contextroot/resources/org.apache.wicket.ajax.WicketAjaxReference
displays all the jars in the browser. The application is running on weblogic
9.2.
Is this a Wicket Issue or weblogic configuation issue ? Any pointers to
prevent this ?
Here is the list of jars it displays
3rdparty.jar
apache_xbean.jar
bids.jar
com.bea.cie.comdev_5.3.1.0.jar
com.bea.cie.paf_1.0.0.0.jar
com.bea.cie.paf-impl_1.0.0.0.jar
com.bea.cie.patch-common_3.0.0.0.jar
com.bea.cie.xmldh_2.1.0.0.jar
com.bea.core.xml.xmlbeans_2.2.0.0.jar
comdev.jar
components.xml
config_rfid_edge.jar
config.jar
configwiz.jar
gpr.xml
internalpaths.txt
javax.xml.stream_1.0.0.0.jar
jython.jar
libjni.so
log4j.jar
macrorules.xml
oxy-cci.jar
pdev.jar
platform.properties
plugin.jar
plugin-wizard.jar
quickstart.jar
uninstall.jar
upgrade
wizard.jar
wlw-plaf.jar
wlw-util.jar


-- 
View this message in context: 
http://www.nabble.com/All-Jars-are-exposed-at-%3A%3A%3A%3A--http%3A--localhost%3A8080-%3Ccontextroot%3E-resources-org.apache.wicket.ajax.WicketAjaxReference-tp19534475p19534475.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DateField throwing runtime error in IE only

2008-09-05 Thread nanotech

Hi,

Did you or anyone found the solution to this?
I am having the same problem in IE7 on a ModalWindow (implemented as Panel)
with a DateTextField and a DatePicker attached to it.

I noticed that it works for the first time when there is no date in the date
field...but after date is selected and if user wants to change the date it
does not work...Calendar does not come up.

If you remove date from the date text field and click on calendar again then
Calendar comes up but does not respond to date selection...and you cannot
close the calendar by clicking [x].It also shows unknown runtime error line
2993.

Did anyone face the similar problem?

Thanks,
RG




Michael Mehrle wrote:
 
 I have a DateField inside a modal and when clicking on the date icon
 it's throwing a 'unknown runtime error' in IE's JavaScript console.
 Works in Safari and Firefox.
 
  
 
 Is this a commonly known problem?
 
  
 
 Michael
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DateField-throwing-runtime-error-in-IE-only-tp17379574p19337621.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Link inside DataTable - PropertyColumn with Link

2008-08-26 Thread nanotech

Hi All,

I looked at the following
http://cwiki.apache.org/WICKET/adding-links-in-a-defaultdatatable.html
to create a column with hyperlinks. Also added the following for the markup
public IResourceStream getMarkupResourceStream(MarkupContainer 
container,
Class containerClass)
{
return new StringResourceStream(wicket:panel \#\ div
wicket:id=\label\[Component Name ]/div /wicket:panel);
}

Now: Question is :
I want to be able to get the value of the label on which I clicked and use
that value and get Blob from DB.

But when I access item.getModelObject() it always returns NULL as model is
already detached (btw, I am using LoadableDetachableModel while populating
DataTable). How to get back the label(text) on which I clicked.I am adding
the reusable component(PropertyColumn with Link) like this



columns.add(new LinkPropertyColumn(new Model(Generated Image
Id),SortProperty,PropertyExpression)
{
@Override
 public void onClick(Item item, String componentId, IModel model)
 {
 
//HOWTO: Get the value of the link on which I clicked ??
// model.getObject() returns NULL
// item.getModelObject() returns NULL
 

}

Thanks for any suggestions

 

-- 
View this message in context: 
http://www.nabble.com/Link-inside-DataTable---PropertyColumn-with-Link-tp19163807p19163807.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Validating FileUploadField

2008-08-20 Thread nanotech

Hi,

I have a FileUpload field on a form (which is a required field) that I need
to validate on form submission.
I want to validate wether the File Path entered by the user points to a
valid file or not.
So For example, if user types in TEMP.doc then its invalid. But right now
the Form's on submit and button's on submit is not even called when user
types invalid file name and hits submit.

Question:
1. Do I need to provide custom javascript on the onclick of Submit button /
onblur of text field, which will check if the path entered is valid path or
not?
2. If yes, How would I modify the event with custom JS code ?
3. How will I get hold of the id of text field that was generated by wicket?

Thanks,
RG
-- 
View this message in context: 
http://www.nabble.com/Validating-FileUploadField-tp19082219p19082219.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Feedback messages disappearing before display

2008-08-11 Thread nanotech

Hi,

I believe you want to display the feedback message in TestPage. If so,
do something like this:
1. make sure you have feedback panel added on the page where you will be
landing after redirect.
2. Then you can get hold of the feedback panel in the current page like
shown below:

FeedbackPanel feedback = (FeedbackPanel)
responsePage.get(responsePage-feedbackPanel);
getSession().info(You pased the test);

So your code would look like:
if (isTestPassed()) {
...
} else 
{
// response Page is the page where you will be going. In your case TestPage.
FeedbackPanel feedback = (FeedbackPanel)
responsePage.get(responsePage-feedbackPanel);
getSession().info(You did not pass the test);
setResponsePage(TestPage.class);
}



insom wrote:
 
 I have a submit button that adds a message to my FeedbackPanel, like so:
 
 if (isTestPassed()) {
   ...
 } else {
   setResponsePage(TestPage.class);
   info(You didn't pass the test...);
 }
 
 However, when the browser gets to the TestPage, it doesn't display any
 messages. I stepped through the process in Eclipse. Running
 getSession().getFeedbackMesages() in the debugger shows that the message
 did get registered. However, when it gets to line 1367 in RequestCycle
 (Wicket 1.3.4), the message is removed. Here is the relevant code from
 RequestCycle:
 
 1361  finally
 1362  {
 1363  // set step manually to clean up
 1364  currentStep = DETACH_REQUEST;
 1365  
 1366  // clean up the request
 1367  detach();  -- This is where the message 
 disappears
 1368  
 1369  // set step manually to done
 1370  currentStep = DONE;
 1371  }
 
 I have no idea what to do to fix this. Any suggestions?
 

-- 
View this message in context: 
http://www.nabble.com/Feedback-messages-disappearing-before-display-tp18932342p18932704.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: YUI DatePicker Changing default behavior

2008-08-08 Thread nanotech

Anyone has any suggestions, please?


nanotech wrote:
 
 Hi all,
 
 I have multiple questions regarding YUI datepicker that I am using on my
 project.
 
 1. I have a from which has 6 DatePicker elements. Now it is possible that
 user can open all of them opened which will make screen look bad. To
 prevent that I would like to allow Only one calendar popup to remain open
 at a time. So, as soon as user clicks on the other date picker icon (same
 form or same Page)the first calendar popup disappears and re-appears at
 other place.
 
 2. Also, The way YUI calendar works is that, when popup calendar comes up 
 you have to either select a date or click on [x] icon to close. How can I
 make calendar go away if user clicks anywhere on the form?
 
 
 
 Thanks,
 ~R
 

-- 
View this message in context: 
http://www.nabble.com/YUI-DatePicker-Changing-default-behavior-tp18882233p18895409.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need little help in understanding AjaxEventBehavior(on a Radio) and AjaxFormChoiceComponentUpdatingBehavior(on a RadioGroup)

2008-08-05 Thread nanotech

Can anyone please help?


nanotech wrote:
 
 Hi All,
 I have a two Radios that control two dropdowns which get Enabled/disbaled
 based on radio selected. All the four components are a part of radiogroup. 
 When page is loaded radio1 is pre-selected and Dropdown1 is
 enabled--radio2 is unselected and DropDown2 is dis-abled.
 
 The Problem:
 When I change the selection and select radio2 (which enables DropDown2
 also, and subsequently disables Dropdown1 and unselects radio1) and submit
 the form I get the Exception
 Attempted to set property value on a null object. Property expression:
 ddc2 Value: codeA21/descA21
 
 I believe when second radio button is selected the model somehow becomes
 null. 
 No matter where I put the code for the model  I cannot get past the
 exception mentioned above.
 
 I tried putting it in AjaxEventBehavior attached to radios and in
 AjaxFormChoiceComponentUpdatingBehavior attached to radiogroup but no
 help.
 
 Question:
 1. Where should the code for enable/disable dropdowns should go
 AjaxEventBehavior attached to radios or
 AjaxFormChoiceComponentUpdatingBehavior
attached to radiogroup?
 2. How should I update the model behind then dropdown? I set the model
 when I load up the form but this doesn't seem to work.
 3. After changing the radio selection When I submit the form the form
 model also becomes null, why is that?
 
 Please point out what am I missing.
 
 Here is my current code snippet looks like.
 Wicket 1.3.4
 java 1.5
 
 =
 TestForm.java
 =
 private class TestForm extends Form 
 {
 
   private DropDownChoice ddc1;
   private DropDownChoice ddc2;
 
   public TestForm(String id) {
   super(id);
   IModel formModel = new CompoundPropertyModel(new Person());
   setModel(formModel);
 
   final RadioGroup group = new RadioGroup(group, formModel);
 
   Radio radio1 = new Radio(radio1, formModel);
   Radio radio2 = new Radio(radio2, formModel);
 
   // DropDown controlled by Radio1... 
   DDCPOJO pojo1 = new DDCPOJO(codeA11, descA11);
   DDCPOJO pojo2 = new DDCPOJO(codeA12, descA12);
   DDCPOJO pojo3 = new DDCPOJO(codeA13, descA13);
   final ListDDCPOJO alPojo1 = new ArrayListDDCPOJO();
   alPojo1.add(pojo1);
   alPojo1.add(pojo2);
   alPojo1.add(pojo3);
 
   ddc1 = new DropDownChoice(ddc1, alPojo1, new ChoiceRenderer(
   code, code));
   ddc1.setOutputMarkupId(true);
 
   // Second DDC  
   DDCPOJO pojo4 = new DDCPOJO(codeA21, descA21);
   DDCPOJO pojo5 = new DDCPOJO(codeA22, descA22);
   DDCPOJO pojo6 = new DDCPOJO(codeA23, descA23);
   final ListDDCPOJO alPojo2 = new ArrayListDDCPOJO();
   alPojo2.add(pojo4);
   alPojo2.add(pojo5);
   alPojo2.add(pojo6);
 
   ddc2 = new DropDownChoice(ddc2, alPojo2, new ChoiceRenderer(
   code, code));
   ddc2.setOutputMarkupId(true);
 
   radio1.add(new AjaxEventBehavior(onClick) {
   private static final long serialVersionUID = 1L;
 
   @Override
   protected void onEvent(AjaxRequestTarget target) {
   group.processInput();
   // On click DISABLE text2 and ddc2
   ddc2.setEnabled(false);
 
   // On click ENABLE text1 and ddc1
   ddc1.setEnabled(true);
   // Add the targets. 
   target.addComponent(ddc2);
   target.addComponent(ddc1);
   }
 
   });
 
   radio2.add(new AjaxEventBehavior(onClick) {
   private static final long serialVersionUID = 1L;
 
   @Override
   protected void onEvent(AjaxRequestTarget target) {
 
   group.processInput();
   // On click DISABLE text1 and ddc1
   ddc1.setEnabled(false);
   // On click ENABLE text2 and ddc2   
   ddc2.setEnabled(true);
   // Add the Targets...
   target.addComponent(ddc2);
   target.addComponent(ddc1);
 
   }
 
   });
 
   // Add the Radio to Group
   group.add(radio1);
   group.add(radio2);
 
   // Add the drop down choice to group
   group.add(ddc1);
   group.add(ddc2);
 
   add(group);
 
   group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
   if (group.getInput().equals(radio1)) 
   {
   // I am doing that in AjaxEventBehavior also
   // Don't know what is the correct place to do it.
   
   // On click DISABLE text2

Re: Need little help in understanding AjaxEventBehavior(on a Radio) and AjaxFormChoiceComponentUpdatingBehavior(on a RadioGroup)

2008-08-05 Thread nanotech

Can someone please help?


nanotech wrote:
 
 Hi All,
 I have a two Radios that control two dropdowns which get Enabled/disbaled
 based on radio selected. All the four components are a part of radiogroup. 
 When page is loaded radio1 is pre-selected and Dropdown1 is
 enabled--radio2 is unselected and DropDown2 is dis-abled.
 
 The Problem:
 When I change the selection and select radio2 (which enables DropDown2
 also, and subsequently disables Dropdown1 and unselects radio1) and submit
 the form I get the Exception
 Attempted to set property value on a null object. Property expression:
 ddc2 Value: codeA21/descA21
 
 I believe when second radio button is selected the model somehow becomes
 null. 
 No matter where I put the code for the model  I cannot get past the
 exception mentioned above.
 
 I tried putting it in AjaxEventBehavior attached to radios and in
 AjaxFormChoiceComponentUpdatingBehavior attached to radiogroup but no
 help.
 
 Question:
 1. Where should the code for enable/disable dropdowns should go
 AjaxEventBehavior attached to radios or
 AjaxFormChoiceComponentUpdatingBehavior
attached to radiogroup?
 2. How should I update the model behind then dropdown? I set the model
 when I load up the form but this doesn't seem to work.
 3. After changing the radio selection When I submit the form the form
 model also becomes null, why is that?
 
 Please point out what am I missing.
 
 Here is my current code snippet looks like.
 Wicket 1.3.4
 java 1.5
 
 =
 TestForm.java
 =
 private class TestForm extends Form 
 {
 
   private DropDownChoice ddc1;
   private DropDownChoice ddc2;
 
   public TestForm(String id) {
   super(id);
   IModel formModel = new CompoundPropertyModel(new Person());
   setModel(formModel);
 
   final RadioGroup group = new RadioGroup(group, formModel);
 
   Radio radio1 = new Radio(radio1, formModel);
   Radio radio2 = new Radio(radio2, formModel);
 
   // DropDown controlled by Radio1... 
   DDCPOJO pojo1 = new DDCPOJO(codeA11, descA11);
   DDCPOJO pojo2 = new DDCPOJO(codeA12, descA12);
   DDCPOJO pojo3 = new DDCPOJO(codeA13, descA13);
   final ListDDCPOJO alPojo1 = new ArrayListDDCPOJO();
   alPojo1.add(pojo1);
   alPojo1.add(pojo2);
   alPojo1.add(pojo3);
 
   ddc1 = new DropDownChoice(ddc1, alPojo1, new ChoiceRenderer(
   code, code));
   ddc1.setOutputMarkupId(true);
 
   // Second DDC  
   DDCPOJO pojo4 = new DDCPOJO(codeA21, descA21);
   DDCPOJO pojo5 = new DDCPOJO(codeA22, descA22);
   DDCPOJO pojo6 = new DDCPOJO(codeA23, descA23);
   final ListDDCPOJO alPojo2 = new ArrayListDDCPOJO();
   alPojo2.add(pojo4);
   alPojo2.add(pojo5);
   alPojo2.add(pojo6);
 
   ddc2 = new DropDownChoice(ddc2, alPojo2, new ChoiceRenderer(
   code, code));
   ddc2.setOutputMarkupId(true);
 
   radio1.add(new AjaxEventBehavior(onClick) {
   private static final long serialVersionUID = 1L;
 
   @Override
   protected void onEvent(AjaxRequestTarget target) {
   group.processInput();
   // On click DISABLE text2 and ddc2
   ddc2.setEnabled(false);
 
   // On click ENABLE text1 and ddc1
   ddc1.setEnabled(true);
   // Add the targets. 
   target.addComponent(ddc2);
   target.addComponent(ddc1);
   }
 
   });
 
   radio2.add(new AjaxEventBehavior(onClick) {
   private static final long serialVersionUID = 1L;
 
   @Override
   protected void onEvent(AjaxRequestTarget target) {
 
   group.processInput();
   // On click DISABLE text1 and ddc1
   ddc1.setEnabled(false);
   // On click ENABLE text2 and ddc2   
   ddc2.setEnabled(true);
   // Add the Targets...
   target.addComponent(ddc2);
   target.addComponent(ddc1);
 
   }
 
   });
 
   // Add the Radio to Group
   group.add(radio1);
   group.add(radio2);
 
   // Add the drop down choice to group
   group.add(ddc1);
   group.add(ddc2);
 
   add(group);
 
   group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
   @Override
   protected void onUpdate(AjaxRequestTarget target) {
   if (group.getInput().equals(radio1)) 
   {
   // I am doing that in AjaxEventBehavior also
   // Don't know what is the correct place to do it.
   
   // On click DISABLE text2

Need little help in understanding AjaxEventBehavior(on a Radio) and AjaxFormChoiceComponentUpdatingBehavior(on a RadioGroup)

2008-08-04 Thread nanotech

Hi All,
I have a two Radios that control two dropdowns which get Enabled/disbaled
based on radio selected. All the four components are a part of radiogroup. 
When page is loaded radio1 is pre-selected and Dropdown1 is enabled--radio2
is unselected and DropDown2 is dis-abled.

The Problem:
When I change the selection and select radio2 (which enables DropDown2 also,
and subsequently disables Dropdown1 and unselects radio1) and submit the
form I get the Exception
Attempted to set property value on a null object. Property expression: ddc2
Value: codeA21/descA21

I believe when second radio button is selected the model somehow becomes
null. 
No matter where I put the code for the model  I cannot get past the
exception mentioned above.

I tried putting it in AjaxEventBehavior attached to radios and in
AjaxFormChoiceComponentUpdatingBehavior attached to radiogroup but no help.

Question:
1. Where should the code for enable/disable dropdowns should go
AjaxEventBehavior attached to radios or
AjaxFormChoiceComponentUpdatingBehavior
   attached to radiogroup?
2. How should I update the model behind then dropdown? I set the model when
I load up the form but this doesn't seem to work.
3. After changing the radio selection When I submit the form the form model
also becomes null, why is that?

Please point out what am I missing.

Here is my current code snippet looks like.
Wicket 1.3.4
java 1.5

=
TestForm.java
=
private class TestForm extends Form 
{

private DropDownChoice ddc1;
private DropDownChoice ddc2;

public TestForm(String id) {
super(id);
IModel formModel = new CompoundPropertyModel(new Person());
setModel(formModel);

final RadioGroup group = new RadioGroup(group, formModel);

Radio radio1 = new Radio(radio1, formModel);
Radio radio2 = new Radio(radio2, formModel);

// DropDown controlled by Radio1... 
DDCPOJO pojo1 = new DDCPOJO(codeA11, descA11);
DDCPOJO pojo2 = new DDCPOJO(codeA12, descA12);
DDCPOJO pojo3 = new DDCPOJO(codeA13, descA13);
final ListDDCPOJO alPojo1 = new ArrayListDDCPOJO();
alPojo1.add(pojo1);
alPojo1.add(pojo2);
alPojo1.add(pojo3);

ddc1 = new DropDownChoice(ddc1, alPojo1, new ChoiceRenderer(
code, code));
ddc1.setOutputMarkupId(true);

// Second DDC  
DDCPOJO pojo4 = new DDCPOJO(codeA21, descA21);
DDCPOJO pojo5 = new DDCPOJO(codeA22, descA22);
DDCPOJO pojo6 = new DDCPOJO(codeA23, descA23);
final ListDDCPOJO alPojo2 = new ArrayListDDCPOJO();
alPojo2.add(pojo4);
alPojo2.add(pojo5);
alPojo2.add(pojo6);

ddc2 = new DropDownChoice(ddc2, alPojo2, new ChoiceRenderer(
code, code));
ddc2.setOutputMarkupId(true);

radio1.add(new AjaxEventBehavior(onClick) {
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target) {
group.processInput();
// On click DISABLE text2 and ddc2
ddc2.setEnabled(false);

// On click ENABLE text1 and ddc1
ddc1.setEnabled(true);
// Add the targets. 
target.addComponent(ddc2);
target.addComponent(ddc1);
}

});

radio2.add(new AjaxEventBehavior(onClick) {
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target) {

group.processInput();
// On click DISABLE text1 and ddc1
ddc1.setEnabled(false);
// On click ENABLE text2 and ddc2   
ddc2.setEnabled(true);
// Add the Targets...
target.addComponent(ddc2);
target.addComponent(ddc1);

}

});

// Add the Radio to Group
group.add(radio1);
group.add(radio2);

// Add the drop down choice to group
group.add(ddc1);
group.add(ddc2);

add(group);

group.add(new AjaxFormChoiceComponentUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (group.getInput().equals(radio1)) 
{
// I am doing that in AjaxEventBehavior also
// Don't know what is the correct place to do it.

// On click DISABLE text2 and ddc2

Re: Refreshing a form inside a Modal Window

2008-08-02 Thread nanotech

Go Here
http://www.wicket-library.com/wicket-examples/ajax/modal-window.3

Look at Modal window example with Page.



vishy_sb wrote:
 
 Can you point me to an example or explain a little more about this
 
 Thanks 
 Vishy
 
 Martijn Dashorst wrote:
 
 iirc using a page instead of a panel works better and has less
 bugs/quirks.
 
 Martijn
 
 On Fri, Aug 1, 2008 at 10:22 AM, steviezz [EMAIL PROTECTED]
 wrote:

 As you can see from some of my own topics, I'm no Wicket expert.

 I did have the same problem, and solved it by simply setting the content
 for
 the ModalWindow panel inside the onClick of the AjaxLink that triggers
 it.
 So, each time you invoke the ModalWindow, it has new content.

 Something like:

add(new AjaxLink(showModal) {
public void onClick(AjaxRequestTarget target) {

// set or reset modal content here
modal.setContent(new
 ModalPanel(modal.getContentId()));

modal.show(target);
}
});

 Of course, there may be a better way.

 Steve



 vishy_sb wrote:

 The Modal Window contains a Panel. The picture shows how the window
 looks
 like when I try to search some thing the results are populated in the
 List
 as shown. All the rows which are selected will be added to another list
 on
 the main page when the apply button is pressed.

  http://www.nabble.com/file/p18766249/modalwindow.jpeg

 Now if I want to try to perform another search the Modal window still
 shows the previous list.

 /// Java code for onSubmit() for the apply button (AjaxFallBackButton) 
 is
 shown below

 applyButton = new AjaxFallbackButton(applyButton, form) {


   @Override
   protected void onSubmit(AjaxRequestTarget target,
 Form fom) {
   for(int i = 0; iaccountLimitList.size();
 i++){
   ClearingAccountLimit accLimit =
 (ClearingAccountLimit)accountLimitList.get(i);
   if(accLimit.isActive()){
  
 selectedInstruments.add(accLimit);

   }

   }
   onCancel(target);
   }

   };
   form.add(applyButton);

 Let me know if you need some more info.

 Thanks in advance
 vishy


 Matej Knopp-2 wrote:

 You need to show some code.

 -Matej

 On Fri, Aug 1, 2008 at 1:33 AM, vishy_sb [EMAIL PROTECTED]
 wrote:

 Is there anyone who has any clue about how this has to be
 done???




 vishy_sb wrote:

 Hi all,

 I have Modal Window which contains a panel. Inside the panel I am
 trying
 to perform a search and the results of the search are populating
 inside
 a
 ListView. There is an apply button which applies the list on the
 main
 page
 and closes the modal window. However when I want to do another
 search
 and
 bring up the Modal window the previous List is still present in it.
 I
 think that when the Modal window is closed it just becomes invisible
 and
 is not closing actually and thats why this is happening. But I was
 just
 wondering if there is a way so as to refresh the (search)form or the
 panel
 whenever it is loaded inside the Modal window.

 Any kind of help will be appreciated.

 Thanks,
 vishy


 --
 View this message in context:
 http://www.nabble.com/Refreshing-a-form-inside-a-Modal-Window-tp18745307p18765669.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






 --
 View this message in context:
 http://www.nabble.com/Refreshing-a-form-inside-a-Modal-Window-tp18745307p18770147.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 
 -- 
 Become a Wicket expert, learn from the best: http://wicketinaction.com
 Apache Wicket 1.3.4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Refreshing-a-form-inside-a-Modal-Window-tp18745307p18791023.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wrap Headers in DataTable to new line?

2008-07-31 Thread nanotech

Q1: How do I make Header in DataTable to wrap to new line. I am putting a
newline character but its not woorking.
columns.add(new PropertyColumn(new Model(This is a very very very long
header that does not wrap),
sortProperty, propertyExpression));

Q2:Is there a way to set the column's width, so that data always wraps if
its more that a particular width?
-- 
View this message in context: 
http://www.nabble.com/Wrap-Headers-in-DataTable-to-new-line--tp18762379p18762379.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RadioGroup, Radio with AjaxEventBehavior not updating form model

2008-07-29 Thread nanotech

Hi ,

I am trying to add Ajax Behaviour to Radio (in a radioGroup)

RadioGroup has radio_1 and radio_2
radio_1 controls Dropdown_1 (i.e when radio_1 is checked then Dropdown_1 is
enabled and Dropdown_2 is disabled--its all working fine and good)
radio_2 controls Dropdown_2 (i.e when radio_2 is checked then Dropdown_2 is
enabled and Dropdown_1 is disabled --its all working fine and good)

At setup time radio_1 is selected  and Dropdown_1 is enabled.

If I submit the form like this then I get the value in the form that I am
submitting.
But, if I change the radio_selected to radio_2 and then submit the form then
the value getting set is NULL.

Question:
How can I make sure that on changing radio appropriate form's model is
updated? What am I missing?

//Here is some code
// Keep the Model of radio group and first radio same. to pre-select it
final RadioGroup group = new RadioGroup(group, this.getModel());
// All the radio Buttons
final Radio radio_1 = new Radio(radio_1, this.getModel());
final Radio radio_2 = new Radio(radio_2,new Model(abc));

group.add(radio_1);
group.add(radio_2);

radio_1.add(new AjaxEventBehavior(onClick)
{
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target)
{
group.processInput();

dropdpwn_1.setEnabled(true);
dropdpwn_2.setEnabled(false);

if (target != null)
{
target.addComponent(dropdpwn_1);
target.addComponent(dropdpwn_2);
}
}
});

radio_2.add(new AjaxEventBehavior(onClick)
{
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target)
{
group.processInput();

dropdpwn_1.setEnabled(false);
dropdpwn_2.setEnabled(true);

if (target != null)
{
target.addComponent(dropdpwn_1);
target.addComponent(dropdpwn_2);
}
}
});
-- 
View this message in context: 
http://www.nabble.com/RadioGroup%2C-Radio-with-AjaxEventBehavior-not-updating-form-model-tp18720051p18720051.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RadioGroup, Radio with AjaxEventBehavior not updating form model

2008-07-29 Thread nanotech

Actually the exception that I am getting is :

Attempted to set property value on a null object. Property expression:
dropdown_2_Input Value: PoJO Name


final DropDownChoice dropdown_2= new DropDownChoice(dropdown_2_Input,
dropDown_List){
public boolean isRequired()
{
return securityTypeRadio.isEnabled();
}

 };
dropdown_2.setOutputMarkupId(true);

Note: Dropdown 2 is diabled onload.



nanotech wrote:
 
 Hi ,
 
 I am trying to add Ajax Behaviour to Radio (in a radioGroup)
 
 RadioGroup has radio_1 and radio_2
 radio_1 controls Dropdown_1 (i.e when radio_1 is checked then Dropdown_1
 is enabled and Dropdown_2 is disabled--its all working fine and good)
 radio_2 controls Dropdown_2 (i.e when radio_2 is checked then Dropdown_2
 is enabled and Dropdown_1 is disabled --its all working fine and good)
 
 At setup time radio_1 is selected  and Dropdown_1 is enabled.
 
 If I submit the form like this then I get the value in the form that I am
 submitting.
 But, if I change the radio_selected to radio_2 and then submit the form
 then the value getting set is NULL.
 
 Question:
 How can I make sure that on changing radio appropriate form's model is
 updated? What am I missing?
 
 //Here is some code
 // Keep the Model of radio group and first radio same. to pre-select it
 final RadioGroup group = new RadioGroup(group, this.getModel());
 // All the radio Buttons
 final Radio radio_1 = new Radio(radio_1, this.getModel());
 final Radio radio_2 = new Radio(radio_2,new Model(abc));
 
   group.add(radio_1);
   group.add(radio_2);
 
   radio_1.add(new AjaxEventBehavior(onClick)
   {
   private static final long serialVersionUID = 1L;
   @Override
   protected void onEvent(AjaxRequestTarget target)
   {
   group.processInput();
   
   dropdpwn_1.setEnabled(true);
   dropdpwn_2.setEnabled(false);
 
   if (target != null)
   {
   target.addComponent(dropdpwn_1);
   target.addComponent(dropdpwn_2);
   }
   }
   });
 
   radio_2.add(new AjaxEventBehavior(onClick)
   {
   private static final long serialVersionUID = 1L;
 
   @Override
   protected void onEvent(AjaxRequestTarget target)
   {
   group.processInput();
 
   dropdpwn_1.setEnabled(false);
   dropdpwn_2.setEnabled(true);
 
   if (target != null)
   {
   target.addComponent(dropdpwn_1);
   target.addComponent(dropdpwn_2);
   }
   }
   });
 

-- 
View this message in context: 
http://www.nabble.com/RadioGroup%2C-Radio-with-AjaxEventBehavior-not-updating-form-model-tp18720051p18720616.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Best way to implement DataTable updatable via Ajax

2008-07-28 Thread nanotech

Hi All,

I have a Save Form where user should be able to add/save new records and
should be able 
to view feedback if there are any errors. 

In short, When user loads up the page he sees a form and under it a
DataTable
which holds the deafault search results.

If he tries to add a record and Add is Successful then DataTable gets
updated via Ajax.
In case of Failure errors are reported on feedback panel.

Here is how I have implemented it:

===
SaveContactPage.html
===

div wicket:id=saveUserFeedback[Feedback-error messages etc.]/div
form wicket:id=saveUserForm
table
tr
tdFirst Name:/td
tdinput type=text wicket:id=firstName //td
/tr
tr
tdLast Name:/td
tdinput type=text wicket:id=lastName //td
/tr
tr
tdinput type=submit wicket:id=saveContactButton 
//td
/tr   

/table
/form
!--  Updatable container for search/add results  --
div wicket:id=resultsContainer
table wicket:id=addResultsTable[Results for add/search
Contacts]/table
/div  
=
SaveContactPage.java
==
public class SaveContactPage extends WebPage
{
// Hold reference to provider..
AddContactDataProvider provider;
// Hold refernce to FeedbackPanel...
FeedbackPanel saveUserFeedback;
//Hold refernece to updatable dataTable's container..
WebMarkupContainer resultsContainer;

public SaveContactPage()
{
add(saveUserFeedback = new FeedbackPanel(saveUserFeedback));
saveUserFeedback.setOutputMarkupId(true);

SaveUserForm userForm = new SaveUserForm(saveUserForm);
add(userForm);

// Get a new provider.
provider = new AddContactDataProvider((ContactInfoPOJO)
userForm.getModelObject());

// Get all the columns.
ListIColumn columns = createColumns();

resultsContainer = new WebMarkupContainer(resultsContainer);
resultsContainer.add(new DataTable(addResultsTable, columns,
provider, 10));

}

private ListIColumn createColumns()
{
ListIColumn columns = new ArrayList();
columns.add(new PropertyColumn(this.getModel(), firstName));
columns.add(new PropertyColumn(this.getModel(), lastName));
}

// Begin Save USER Form.
private class SaveUserForm extends StatelessForm
{
public SaveUserForm(String id)
{
super(id);
// Set Form's model
setModel(new CompoundPropertyModel(new ContactInfoPOJO()));
add(new TextField(firstName));
add(new TextField(lastName));
add(new AjaxFallbackButton(saveContactButton, this)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form 
form)
{
// TODO 1: Is this Correct approach 
// (i.e. calling the provider
// again to refresh the container)
// On Submitcall the provider again?

provider = new 
AddContactDataProvider(form.getModelObject());

//Refresh the dataTable
target.addComponent(resultsContainer);

// In case of Failure...Display the error 
messages.

}

protected void onError(AjaxRequestTarget target, Form 
form)
{
// TODO 3: Show Errors...if any
// But Error happned in DataProvider...
// How do I get hold of Error Object Here...
target.addComponent(saveUserFeedback);
}

});

}
}
}


==
AddContactDataProvider.java
==

public class AddContactDataProvider extends SortableDataProvider
{

private ContactInfoPOJO contactPojo;
private ContactManager contactManager;

public AddContactDataProvider(ContactInfoPOJO contactPojo) 
{
this.contactPojo = contactPojo;
contactManager = new JDBCContactManager();
}

public Iterator iterator(int first, int count) 
{
// Save the Contact...
contactManager.saveContact(contactPojo);

//TODO 2::: HOW? WHERE???
//If Save FAILED then GET ERROR MESSAGE 


// Get the saved 

Re: Best way to implement DataTable updatable via Ajax

2008-07-28 Thread nanotech

Hi Ryan,

Did you answer my post? i am unable to see any answer?

Thanks
RG


Ryan Gravener-3 wrote:
 
 On Mon, Jul 28, 2008 at 3:59 PM, nanotech [EMAIL PROTECTED] wrote:
 

 Hi All,

 I have a Save Form where user should be able to add/save new records and
 should be able
 to view feedback if there are any errors.

 In short, When user loads up the page he sees a form and under it a
 DataTable
 which holds the deafault search results.

 If he tries to add a record and Add is Successful then DataTable gets
 updated via Ajax.
 In case of Failure errors are reported on feedback panel.

 Here is how I have implemented it:

 ===
 SaveContactPage.html
 ===

 div wicket:id=saveUserFeedback[Feedback-error messages etc.]/div
 form wicket:id=saveUserForm
table
tr
tdFirst Name:/td
tdinput type=text wicket:id=firstName
 //td
/tr
tr
tdLast Name:/td
tdinput type=text wicket:id=lastName
 //td
/tr
tr
tdinput type=submit
 wicket:id=saveContactButton //td
/tr

/table
 /form
 !--  Updatable container for search/add results  --
 div wicket:id=resultsContainer
table wicket:id=addResultsTable[Results for add/search
 Contacts]/table
 /div
 =
 SaveContactPage.java
 ==
 public class SaveContactPage extends WebPage
 {
// Hold reference to provider..
AddContactDataProvider provider;
// Hold refernce to FeedbackPanel...
FeedbackPanel saveUserFeedback;
//Hold refernece to updatable dataTable's container..
WebMarkupContainer resultsContainer;

public SaveContactPage()
{
add(saveUserFeedback = new
 FeedbackPanel(saveUserFeedback));
saveUserFeedback.setOutputMarkupId(true);

SaveUserForm userForm = new SaveUserForm(saveUserForm);
add(userForm);

// Get a new provider.
provider = new AddContactDataProvider((ContactInfoPOJO)
 userForm.getModelObject());

// Get all the columns.
ListIColumn columns = createColumns();

resultsContainer = new
 WebMarkupContainer(resultsContainer);
resultsContainer.add(new DataTable(addResultsTable,
 columns,
provider, 10));

}

private ListIColumn createColumns()
{
ListIColumn columns = new ArrayList();
columns.add(new PropertyColumn(this.getModel(),
 firstName));
columns.add(new PropertyColumn(this.getModel(),
 lastName));
}

 // Begin Save USER Form.
 private class SaveUserForm extends StatelessForm
 {
public SaveUserForm(String id)
{
super(id);
// Set Form's model
setModel(new CompoundPropertyModel(new
 ContactInfoPOJO()));
add(new TextField(firstName));
add(new TextField(lastName));
add(new AjaxFallbackButton(saveContactButton, this)
{
@Override
protected void onSubmit(AjaxRequestTarget target,
 Form form)
{
// TODO 1: Is this Correct approach
// (i.e. calling the provider
// again to refresh the container)
// On Submitcall the provider again?

provider = new
 AddContactDataProvider(form.getModelObject());

//Refresh the dataTable
target.addComponent(resultsContainer);

// In case of Failure...Display the error
 messages.

}

protected void onError(AjaxRequestTarget target,
 Form form)
{
// TODO 3: Show Errors...if any
// But Error happned in DataProvider...
// How do I get hold of Error Object
 Here...
target.addComponent(saveUserFeedback);
}

});

}
 }
 }


 ==
 AddContactDataProvider.java
 ==

 public class AddContactDataProvider extends SortableDataProvider
 {

private ContactInfoPOJO contactPojo;
private ContactManager contactManager;

public AddContactDataProvider(ContactInfoPOJO contactPojo)
{
this.contactPojo = contactPojo;
contactManager = new JDBCContactManager();
}

public Iterator iterator(int first, int count)
{
// Save the Contact...
contactManager.saveContact

Re: Best way to implement DataTable updatable via Ajax

2008-07-28 Thread nanotech

please help,Anyone?

---
Hi All,
 
I have a Save Form where user should be able to add/save new records and
should be able
to view feedback if there are any errors.
 
In short, When user loads up the page he sees a form and under it a
DataTable
which holds the deafault search results.

If he tries to add a record and Add is Successful then DataTable gets
updated via Ajax.
 
In case of Failure errors are reported on feedback panel.

Here is how I have implemented it:


 ===
 SaveContactPage.html
 ===
 

 div wicket:id=saveUserFeedback[Feedback-error messages etc.]/div
 form wicket:id=saveUserForm
table
  tr
tdFirst Name:/td
tdinput type=text wicket:id=firstName//td
  /tr
  tr
 tdLast Name:/td
 tdinput type=text wicket:id=lastName//td
  /tr
  tr
 tdinput type=submit wicket:id=saveContactButton
//td
   /tr
/table
 /form
 !--  Updatable container for search/add results  --
 div wicket:id=resultsContainer
table wicket:id=addResultsTable[Results for add/search
 Contacts]/table
 /div
 
 =
 SaveContactPage.java
 ==
 
 public class SaveContactPage extends WebPage
 {
// Hold reference to provider..
AddContactDataProvider provider;
// Hold refernce to FeedbackPanel...
FeedbackPanel saveUserFeedback;
//Hold refernece to updatable dataTable's container..
WebMarkupContainer resultsContainer;

public SaveContactPage()
{
add(saveUserFeedback = new
 FeedbackPanel(saveUserFeedback));
saveUserFeedback.setOutputMarkupId(true);

SaveUserForm userForm = new SaveUserForm(saveUserForm);
add(userForm);

// Get a new provider.
provider = new AddContactDataProvider((ContactInfoPOJO)

userForm.getModelObject());

// Get all the columns.
ListIColumn columns = createColumns();

resultsContainer = new
WebMarkupContainer(resultsContainer);
resultsContainer.add(new
DataTable(addResultsTable,columns,
provider, 10));

}

private ListIColumn createColumns()
{
ListIColumn columns = new ArrayList();
columns.add(new
PropertyColumn(this.getModel(),firstName));
columns.add(new PropertyColumn(this.getModel(),lastName));
}

 // Begin Save USER Form.
 private class SaveUserForm extends StatelessForm
 {
public SaveUserForm(String id)
{
super(id);
// Set Form's model
setModel(new CompoundPropertyModel(new ContactInfoPOJO()));
add(new TextField(firstName));
add(new TextField(lastName));
add(new AjaxFallbackButton(saveContactButton, this)
{
@Override
protected void onSubmit(AjaxRequestTarget
target,Form form)
{

// TODO 1: Is this Correct approach
// (i.e. calling the provider
// again to refresh the container)
// On Submitcall the provider again?


provider = new
AddContactDataProvider(form.getModelObject());

//Refresh the dataTable
target.addComponent(resultsContainer);

   // In case of Failure...Display the error
messages.

}

protected void onError(AjaxRequestTarget target,Form
form)
{   
// TODO 3: Show Errors...if any
// But Error happned in DataProvider...
// How do I get hold of Error Object Here...

target.addComponent(saveUserFeedback);
}

});

}
 }
 }


 ==
 AddContactDataProvider.java
 ==
 

 public class AddContactDataProvider extends SortableDataProvider
 {

private ContactInfoPOJO contactPojo;
private ContactManager contactManager;

public AddContactDataProvider(ContactInfoPOJO contactPojo)
{
this.contactPojo = contactPojo;
contactManager = new JDBCContactManager();
}

public Iterator iterator(int first, int count)
{
// Save the Contact...

Re: Best /Correct way to update DataTable via Ajax

2008-07-28 Thread nanotech

Hi Ryan Posted code here..

http://pastebin.org/58032
http://pastebin.org/58035

Thanks,
RG


Ryan Gravener-3 wrote:
 
 If you post your code on pastebin i'll take a look at it.  As for the
 generic issue of updating a datatable.  I would update it in your onsubmit
 method, add it to the target.  I wouldn't have any save calls in my
 dataprovider, only logic to fetch results.
 
 On Mon, Jul 28, 2008 at 8:52 PM, nanotech [EMAIL PROTECTED] wrote:
 

 Hi Paul,

 Sorry could not understand your answer. Can you please elaborate?

 RG


 Paul Logasa Bogen II wrote:
 
  the inMethod DataGrid is excellent.
  plb
 
  nanotech wrote:
  please help,Anyone?
 
  ---
  Hi All,
 
  I have a Save Form where user should be able to add/save new records
 and
  should be able
  to view feedback if there are any errors.
 
  In short, When user loads up the page he sees a form and under it a
  DataTable
  which holds the deafault search results.
 
  If he tries to add a record and Add is Successful then DataTable
 gets
  updated via Ajax.
 
  In case of Failure errors are reported on feedback panel.
 
  Here is how I have implemented it:
 
 
   ===
   SaveContactPage.html
   ===
 
 
   div wicket:id=saveUserFeedback[Feedback-error messages
 etc.]/div
   form wicket:id=saveUserForm
  table
tr
   tdFirst Name:/td
   tdinput type=text wicket:id=firstName//td
/tr
tr
   tdLast Name:/td
   tdinput type=text wicket:id=lastName//td
/tr
tr
   tdinput type=submit
 wicket:id=saveContactButton
  //td
 /tr
  /table
   /form
   !--  Updatable container for search/add results  --
   div wicket:id=resultsContainer
  table wicket:id=addResultsTable[Results for add/search
   Contacts]/table
   /div
 
   =
   SaveContactPage.java
   ==
 
   public class SaveContactPage extends WebPage
   {
  // Hold reference to provider..
  AddContactDataProvider provider;
  // Hold refernce to FeedbackPanel...
  FeedbackPanel saveUserFeedback;
  //Hold refernece to updatable dataTable's container..
  WebMarkupContainer resultsContainer;
 
  public SaveContactPage()
  {
  add(saveUserFeedback = new
   FeedbackPanel(saveUserFeedback));
  saveUserFeedback.setOutputMarkupId(true);
 
  SaveUserForm userForm = new
 SaveUserForm(saveUserForm);
  add(userForm);
 
  // Get a new provider.
  provider = new
 AddContactDataProvider((ContactInfoPOJO)
 
  userForm.getModelObject());
 
  // Get all the columns.
  ListIColumn columns = createColumns();
 
  resultsContainer = new
  WebMarkupContainer(resultsContainer);
  resultsContainer.add(new
  DataTable(addResultsTable,columns,
   provider, 10));
 
  }
 
  private ListIColumn createColumns()
  {
  ListIColumn columns = new ArrayList();
  columns.add(new
  PropertyColumn(this.getModel(),firstName));
  columns.add(new
  PropertyColumn(this.getModel(),lastName));
  }
 
   // Begin Save USER Form.
   private class SaveUserForm extends StatelessForm
   {
  public SaveUserForm(String id)
  {
  super(id);
  // Set Form's model
  setModel(new CompoundPropertyModel(new
  ContactInfoPOJO()));
  add(new TextField(firstName));
  add(new TextField(lastName));
  add(new AjaxFallbackButton(saveContactButton, this)
  {
  @Override
  protected void onSubmit(AjaxRequestTarget
  target,Form form)
  {
 
  // TODO 1: Is this Correct approach
  // (i.e. calling the provider
  // again to refresh the container)
  // On Submitcall the provider
 again?
 
 
  provider = new
  AddContactDataProvider(form.getModelObject());
 
  //Refresh the dataTable
  target.addComponent(resultsContainer);
 
 // In case of Failure...Display the
 error
  messages.
 
  }
 
  protected void onError(AjaxRequestTarget
  target,Form
  form)
  {
  // TODO 3: Show Errors...if any
  // But Error happned in
 DataProvider

Re: DataTable + CheckGroup with CheckGroupSelector

2008-07-22 Thread nanotech

Hi All,

Looking for some pointers. Anyone?


nanotech wrote:
 
 Hi,
 
 I am trying to add a column of checkboxes in data table with CheckGroup
 Selector.
 Html looks like this
 wicket:panel
 form wicket:id=form
   
   input type=checkbox 
 wicket:id=groupselectorcheck/uncheck
 all/input
   table border=1 wicket:id=entries[Data Table will be 
 added
 here!!]/table
   
wicket:fragment wicket:id=checkBoxFrag
  input type=checkbox wicket:id=selected/
   /wicket:fragment
   /form
   /wicket:panel
 
 
 The Column is added like this
   IColumn[] columns = {
   new AbstractColumn(new Model(Select - All)){
   public void populateItem(Item cellItem, String componentId,
   IModel rowModel) {
   PhoneBookEntry entry = 
 (PhoneBookEntry)rowModel.getObject();
   cellItem.add(new 
 PhoneBookEntrySelectionFragment(componentId,
   checkBoxFrag,
   PhoneBookPanel.this,
   entry));
   }
   
   },  
   new PropertyColumn(new Model(ID), id),
   new PropertyColumn(new Model(First Name), firstName),
   new PropertyColumn(new Model(Last Name), lName, lastName),
   new PropertyColumn(new Model(Tel No), telNum, telNo) };
 
 
   DefaultDataTable dataTable = new DefaultDataTable(entries, columns,
   provider, 4);
 
   Form form = new Form(form);
   MyCheckGroup group = new MyCheckGroup(checkGroup,new ArrayList());
   
   group.add(new CheckGroupSelector(groupselector));
   
   group.add(dataTable);
   
   form.add(group);
   add(form);
 
 
 The Fragment which generates the Check boxes on each row look like this
 public class PhoneBookEntrySelectionFragment extends Fragment {
   
public PhoneBookEntrySelectionFragment(String id, 
   String markupId,
   MarkupContainer markupProvider,
   PhoneBookEntry entry) {
   super(id, markupId, markupProvider);
   add(new Check(selected, new 
 CheckBoxModel(entry.getId())) {   
   protected boolean 
 wantOnSelectionChangedNotifications() {
   return true;
   }
   });
}
}
 
 
 The Problem is:
 1. If I click on any checkbox on any row all the checkboxes get selected
 at once. I noiced that the wicked id if all the checkboxes is the same
 which in this case is selected . What am I doing wrong here?
 
 2. Also if I replace the follwing line 
   DefaultDataTable dataTable = new DefaultDataTable(entries, columns,
   provider, 4);
 
 with 
 
 AjaxFallBackDefaultDataTable dataTable = new AjaxFallBackDefaultDataTable
 (entries, columns,
   provider, 4);
 
 then the navigation links stop working? Can anyone point out why?
 
 3. Also, I want to be able to disable a button if more than one checkbox
 is selected. How can I do that?
 
 Thanks,
 Rachit
 
 

-- 
View this message in context: 
http://www.nabble.com/DataTable-%2B-CheckGroup-with-CheckGroupSelector-tp18581940p18586553.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DataTable + CheckGroup with CheckGroupSelector

2008-07-22 Thread nanotech

Hi Igor,

Thanks for the reply. I had a look at the phonebook example application in
wicket-stuff.
I have a question?
1. Currently it does not maintain the checked(or selected) items if you
change the datatable's pages. How can I add that feature?

2. Can I  replace CheckBox with AjaxCheckBox and DataTable with
AjaxFallBackDataTable ?

Thanks,
Rachit




igor.vaynberg wrote:
 
 there is a checkgroup inside datatable example in wicket-stuff phonebook
 
 -igor
 
 On Tue, Jul 22, 2008 at 3:37 AM, nanotech [EMAIL PROTECTED] wrote:

 Hi All,

 Looking for some pointers. Anyone?


 nanotech wrote:

 Hi,

 I am trying to add a column of checkboxes in data table with CheckGroup
 Selector.
 Html looks like this
 wicket:panel
 form wicket:id=form

   input type=checkbox
 wicket:id=groupselectorcheck/uncheck
 all/input
   table border=1 wicket:id=entries[Data Table will
 be added
 here!!]/table

wicket:fragment wicket:id=checkBoxFrag
  input type=checkbox wicket:id=selected/
   /wicket:fragment
   /form
   /wicket:panel


 The Column is added like this
   IColumn[] columns = {
   new AbstractColumn(new Model(Select - All)){
   public void populateItem(Item cellItem, String
 componentId,
   IModel rowModel) {
   PhoneBookEntry entry =
 (PhoneBookEntry)rowModel.getObject();
   cellItem.add(new
 PhoneBookEntrySelectionFragment(componentId,
   checkBoxFrag,
   PhoneBookPanel.this,
   entry));
   }

   },
   new PropertyColumn(new Model(ID), id),
   new PropertyColumn(new Model(First Name), firstName),
   new PropertyColumn(new Model(Last Name), lName,
 lastName),
   new PropertyColumn(new Model(Tel No), telNum, telNo)
 };


   DefaultDataTable dataTable = new DefaultDataTable(entries,
 columns,
   provider, 4);

   Form form = new Form(form);
   MyCheckGroup group = new MyCheckGroup(checkGroup,new
 ArrayList());

   group.add(new CheckGroupSelector(groupselector));

   group.add(dataTable);

   form.add(group);
   add(form);


 The Fragment which generates the Check boxes on each row look like this
 public class PhoneBookEntrySelectionFragment extends Fragment {

public PhoneBookEntrySelectionFragment(String id,
   String markupId,
   MarkupContainer
 markupProvider,
   PhoneBookEntry entry) {
   super(id, markupId, markupProvider);
   add(new Check(selected, new
 CheckBoxModel(entry.getId())) {
   protected boolean
 wantOnSelectionChangedNotifications() {
   return true;
   }
   });
}
}


 The Problem is:
 1. If I click on any checkbox on any row all the checkboxes get selected
 at once. I noiced that the wicked id if all the checkboxes is the same
 which in this case is selected . What am I doing wrong here?

 2. Also if I replace the follwing line
   DefaultDataTable dataTable = new DefaultDataTable(entries,
 columns,
   provider, 4);

 with

 AjaxFallBackDefaultDataTable dataTable = new
 AjaxFallBackDefaultDataTable
 (entries, columns,
   provider, 4);

 then the navigation links stop working? Can anyone point out why?

 3. Also, I want to be able to disable a button if more than one checkbox
 is selected. How can I do that?

 Thanks,
 Rachit



 --
 View this message in context:
 http://www.nabble.com/DataTable-%2B-CheckGroup-with-CheckGroupSelector-tp18581940p18586553.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DataTable-%2B-CheckGroup-with-CheckGroupSelector-tp18581940p18593827.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DataTable + CheckGroup with CheckGroupSelector

2008-07-22 Thread nanotech

Hi Igor,

I changed the implemention of wicket-stuff-phonebook to suit my needs where
in i needed do disable the delete button if none selected and re-enable it.
I also successfully used AjaxCheckBox and updated the webmarkup container
containing buttons.
Now, in the same example app. 
1. I am trying to add the checkgroupselector to select all the checkboxes 
and I did the following.

HTML looks like this:
form wicket:id=filter-form
input type=hidden name=tracker wicket:id=focus-tracker/

divwicket:id=group
input type=checkbox wicket:id=groupselectorcheck/uncheck 
all/input
table wicket:id=users cellspacing=0 cellpadding=2 
class=grid[for
DataTable]/table
/div

div wicket:id=focus-restore[call to focus restore script]/div


div wicket:id=buttonContainer
input wicket:id=delete-selected value=DELETE CHECKED CONTACTS
type=submit/
/div

/form

and the relavent Java Code looks like this:

CheckGroup group=new CheckGroup(group);
form.add(group);
group.add(new CheckGroupSelector(groupselector));

// create the data table
IColumn[] columns = createColumns(buttonContainer);
users = new DefaultDataTable(users, Arrays.asList(columns),
dataProvider, 10);
//users.addTopToolbar(new FilterToolbar(users, form, 
dataProvider));
group.add(users);
Problem :

1. It does show checkgroup but checking/un-checking it does not affect the
check boxes under it. What am I doing wrong here?

2. Also, can you give a brief example of the navigator with submit links. 

Thanks,
Rachit


igor.vaynberg wrote:
 
 On Tue, Jul 22, 2008 at 9:54 AM, nanotech [EMAIL PROTECTED] wrote:

 Hi Igor,

 Thanks for the reply. I had a look at the phonebook example application
 in
 wicket-stuff.
 I have a question?
 1. Currently it does not maintain the checked(or selected) items if you
 change the datatable's pages. How can I add that feature?
 
 the navigator currently uses regular links. to preserve the selection
 you have to change the links to submitlinks. there are factories on
 the navigator that let you do that.
 
 2. Can I  replace CheckBox with AjaxCheckBox and DataTable with
 AjaxFallBackDataTable ?
 
 yes
 
 -igor
 

 Thanks,
 Rachit




 igor.vaynberg wrote:

 there is a checkgroup inside datatable example in wicket-stuff phonebook

 -igor

 On Tue, Jul 22, 2008 at 3:37 AM, nanotech [EMAIL PROTECTED]
 wrote:

 Hi All,

 Looking for some pointers. Anyone?


 nanotech wrote:

 Hi,

 I am trying to add a column of checkboxes in data table with
 CheckGroup
 Selector.
 Html looks like this
 wicket:panel
 form wicket:id=form

   input type=checkbox
 wicket:id=groupselectorcheck/uncheck
 all/input
   table border=1 wicket:id=entries[Data Table
 will
 be added
 here!!]/table

wicket:fragment wicket:id=checkBoxFrag
  input type=checkbox wicket:id=selected/
   /wicket:fragment
   /form
   /wicket:panel


 The Column is added like this
   IColumn[] columns = {
   new AbstractColumn(new Model(Select - All)){
   public void populateItem(Item cellItem, String
 componentId,
   IModel rowModel) {
   PhoneBookEntry entry =
 (PhoneBookEntry)rowModel.getObject();
   cellItem.add(new
 PhoneBookEntrySelectionFragment(componentId,
   checkBoxFrag,
   PhoneBookPanel.this,
   entry));
   }

   },
   new PropertyColumn(new Model(ID), id),
   new PropertyColumn(new Model(First Name),
 firstName),
   new PropertyColumn(new Model(Last Name), lName,
 lastName),
   new PropertyColumn(new Model(Tel No), telNum,
 telNo)
 };


   DefaultDataTable dataTable = new DefaultDataTable(entries,
 columns,
   provider, 4);

   Form form = new Form(form);
   MyCheckGroup group = new MyCheckGroup(checkGroup,new
 ArrayList());

   group.add(new CheckGroupSelector(groupselector));

   group.add(dataTable);

   form.add(group);
   add(form);


 The Fragment which generates the Check boxes on each row look like
 this
 public class PhoneBookEntrySelectionFragment extends Fragment {

public PhoneBookEntrySelectionFragment(String id,
   String markupId,
   MarkupContainer
 markupProvider,
   PhoneBookEntry entry) {
   super(id, markupId, markupProvider);
   add(new Check(selected, new
 CheckBoxModel(entry.getId())) {
   protected boolean

DataTable + CheckGroup with CheckGroupSelector

2008-07-21 Thread nanotech

Hi,

I am trying to add a column of checkboxes in data table with CheckGroup
Selector.
Html looks like this
wicket:panel
form wicket:id=form

input type=checkbox 
wicket:id=groupselectorcheck/uncheck
all/input
table border=1 wicket:id=entries[Data Table will be 
added
here!!]/table

 wicket:fragment wicket:id=checkBoxFrag
   input type=checkbox wicket:id=selected/
/wicket:fragment
/form
/wicket:panel


The Column is added like this
IColumn[] columns = {
new AbstractColumn(new Model(Select - All)){
public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
PhoneBookEntry entry = 
(PhoneBookEntry)rowModel.getObject();
cellItem.add(new 
PhoneBookEntrySelectionFragment(componentId,
checkBoxFrag,
PhoneBookPanel.this,
entry));
}

},  
  new PropertyColumn(new Model(ID), id),
new PropertyColumn(new Model(First Name), firstName),
new PropertyColumn(new Model(Last Name), lName, lastName),
new PropertyColumn(new Model(Tel No), telNum, telNo) };


DefaultDataTable dataTable = new DefaultDataTable(entries, columns,
provider, 4);

Form form = new Form(form);
MyCheckGroup group = new MyCheckGroup(checkGroup,new ArrayList());

group.add(new CheckGroupSelector(groupselector));

group.add(dataTable);

form.add(group);
add(form);


The Fragment which generates the Check boxes on each row look like this
public class PhoneBookEntrySelectionFragment extends Fragment {

 public PhoneBookEntrySelectionFragment(String id, 
String markupId,
MarkupContainer markupProvider,
PhoneBookEntry entry) {
super(id, markupId, markupProvider);
add(new Check(selected, new 
CheckBoxModel(entry.getId())) {   
protected boolean 
wantOnSelectionChangedNotifications() {
return true;
}
});
 }
 }


The Problem is:
1. If I click on any checkbox on any row all the checkboxes get selected at
once. I noiced that the wicked id if all the checkboxes is the same which in
this case is selected . What am I doing wrong here?

2. Also if I replace the follwing line 
DefaultDataTable dataTable = new DefaultDataTable(entries, columns,
provider, 4);

with 

AjaxFallBackDefaultDataTable dataTable = new AjaxFallBackDefaultDataTable
(entries, columns,
provider, 4);

then the navigation links stop working? Can anyone point out why?

3. Also, I want to be able to disable a button if more than one checkbox is
selected. How can I do that?

Thanks,
Rachit

-- 
View this message in context: 
http://www.nabble.com/DataTable-%2B-CheckGroup-with-CheckGroupSelector-tp18581940p18581940.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Changing the DatePattern in DataTable

2008-07-15 Thread nanotech

Hi,

How can I change the pattern for a column displaying date from database in
DataTable.
In my case it displays the Short date format by default. which is mm/dd/yy
I want to able to display MM/dd/.

Thanks,
RG
-- 
View this message in context: 
http://www.nabble.com/Changing-the-DatePattern-in-DataTable-tp18480202p18480202.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Search and Display Results on same page[Ajax or No Ajax]

2008-07-11 Thread nanotech

Hi Guys,

I need help regarding a simple use case.
I have a BasePage that has Two Panels : Top Panel and Bottom Panel

User Can enter search criteria in top Panel and Results need to be displayed
in Bottom Panel. Results displayed in ListView/DataView 

#html looks like this...
div wicket:id=topPanel[Top panel]/div
div wicket:id=BottomPanel[Bottom panel]/div

#TopPanel
form wicket:id=searchForm 
// Lots of Search Fields
// Submit Button
/form

#BottomPanel
divwicket:id=table[ListView]/div

How do I pass the search Criteria(a POJO) of Top Panel when user Submits the
Form to Bottom Panel?
Or,
If I use a webmarkup container for the search resultsand use only one
panel(i.e the top panel) for search AND display...then how do i update the
Model for ListView? I tried all possible combinations...but failed...am I
missing something.
I was trying the use case that When user loads up the form first time the
fields of Search form are empty so ListView/dataview has no results.
When user enters some search criteria and clicks Search the web markup
container below updates its Model and displays the results according to
updated modelif there are no results then nothing gets displayed.

final WebMarkupContainer contactsWrapper = new 
WebMarkupContainer(
contactsWrap);

form.add(new AjaxButton(searchContacts) {

protected void onSubmit(AjaxRequestTarget target, Form 
f) {
final ContactInfoPOJO c = (ContactInfoPOJO) 
getForm().getModelObject();

IModel newModel = new LoadableDetachableModel() 
{
protected Object load() {
return
WicketApplication.get().getContactInfoDao().getContactsBySearch(c);
}
};

// If javascript is enabled on user's browser.
if (target != null) {
// refresh the component.
target.addComponent(contactsWrapper);
}
}
}); 

Here the problem is that Model cannot be updated??

final ListView contacts = new ListView(viewContacts, 
contactInfoModel) {
protected void populateItem(final ListItem item) {
item.add(new Label(fName, new 
PropertyModel(item.getModel(),
firstName)));
item.add(new Label(lName, new 
PropertyModel(item.getModel(),
lastName)));

}
}

contactsWrapper.add(contacts);




I have also attached the sample source files. Please help me .

Thanks

http://www.nabble.com/file/p18413133/SaveAndDisplayAjax.html
SaveAndDisplayAjax.html 
http://www.nabble.com/file/p18413133/SaveAndDisplayAjax.java
SaveAndDisplayAjax.java 
-- 
View this message in context: 
http://www.nabble.com/Search-and-Display-Results-on-same-page-Ajax-or-No-Ajax--tp18413133p18413133.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Search and Display Results on same page[Ajax or No Ajax]

2008-07-11 Thread nanotech

Hi Michael,

Thanks for your reply. 
For the Ajax solution...In the files that I attached. What I am tring to
do is loading the model when the page loads up first time.
At this time the Pojo is empty so model has no values ,which means there is
nothing to iterate so list appears empty.
Now, my challenge is when user click the search button and tries to
search...then I have to get the Pojo and call DAO to get the results and
wrap the results in the same model(that I used while loading up the
page)...so that same model gets new values and then update the
ListView/DataView without the whole page refresh.
But, I am unable to assign the newly returned values by DAO to old model
because it says final variable cannot be referred from inside

Do you think my approach is correct towards the problem?
Any suggestions?


Thanks,
RG



Michael O'Cleirigh wrote:
 
 Hello,
 
 I think your problem is in how you define the search criteria pojo model:
 
   
   final IModel addContactInfoModel = new 
 LoadableDetachableModel() {
   protected Object load() {
   ContactInfoPOJO modelObject = new 
 ContactInfoPOJO();
   return modelObject;
   }
   };
 
 
 The problem is that load() is going to be called during each request
 response sequence and by its definition 
 resetting the backing object to a newly instantiated instance each time
 the page is loaded. 
 
 
 Using final Model addContactInfoModel = new Model (new ContactInfoPOJO());
 should solve your problems.
   
 
 You should also consider using a DataTable for showing the results as it
 is backed by a repeater and has built in support for paging, sorting, etc.
 
 
 Mike
 
 

 I need help regarding a simple use case.
 I have a BasePage that has Two Panels : Top Panel and Bottom Panel

 User Can enter search criteria in top Panel and Results need to be
 displayed
 in Bottom Panel. Results displayed in ListView/DataView 

 #html looks like this...
 div wicket:id=topPanel[Top panel]/div
 div wicket:id=BottomPanel[Bottom panel]/div

 #TopPanel
 form wicket:id=searchForm 
 // Lots of Search Fields
 // Submit Button
 /form

 #BottomPanel
 divwicket:id=table[ListView]/div

 How do I pass the search Criteria(a POJO) of Top Panel when user Submits
 the
 Form to Bottom Panel?
 Or,
 If I use a webmarkup container for the search resultsand use only one
 panel(i.e the top panel) for search AND display...then how do i update
 the
 Model for ListView? I tried all possible combinations...but failed...am I
 missing something.
 I was trying the use case that When user loads up the form first time the
 fields of Search form are empty so ListView/dataview has no results.
 When user enters some search criteria and clicks Search the web markup
 container below updates its Model and displays the results according to
 updated modelif there are no results then nothing gets displayed.

  final WebMarkupContainer contactsWrapper = new 
 WebMarkupContainer(
  contactsWrap);

  form.add(new AjaxButton(searchContacts) {
  
  protected void onSubmit(AjaxRequestTarget target, Form 
 f) {
  final ContactInfoPOJO c = (ContactInfoPOJO)
 getForm().getModelObject();

  IModel newModel = new LoadableDetachableModel() 
 {
  protected Object load() {
  return
 WicketApplication.get().getContactInfoDao().getContactsBySearch(c);
  }
  };

  // If javascript is enabled on user's browser.
  if (target != null) {
  // refresh the component.
  target.addComponent(contactsWrapper);
  }
  }
  }); 

 Here the problem is that Model cannot be updated??

  final ListView contacts = new ListView(viewContacts, contactInfoModel)
 {
  protected void populateItem(final ListItem item) {
  item.add(new Label(fName, new 
 PropertyModel(item.getModel(),
  firstName)));
  item.add(new Label(lName, new 
 PropertyModel(item.getModel(),
  lastName)));

 }
 }

 contactsWrapper.add(contacts);




 I have also attached the sample source files. Please help me .

 Thanks

 http://www.nabble.com/file/p18413133/SaveAndDisplayAjax.html
 SaveAndDisplayAjax.html 
 http://www.nabble.com/file/p18413133/SaveAndDisplayAjax.java
 SaveAndDisplayAjax.java 
   
 
 
 -
 To unsubscribe, e-mail: [EMAIL 

Enclosure + AjaxButton

2008-07-08 Thread nanotech

Hi All,

I have a simple requirement in which I want to display two different
messages on Form Submit depending on whether or not the text field is filled
in . The way I thought it should work is if I use combination of AjaxButton,
WebMarkupContainer,wicket:enclosure and by overriding isVisible().
The flow of sample application is. ..
1. When the Page Loads(first-time) it displays..Not found (which means
nothing has been entered in textfield).[This is working as expected]
2. When I type in something to textfield and submit the form--it should
display Found but its not displaying that message.[Not working as
expected]
3. Also, When i clear the textfield and re-submit the form it should display
Not found.But this also does not happen.[Not working as expected]

In short, the state of the WebMarkupcontainer never gets updated after
intial load.
Can someone point out what am I missing?

Here is the code.

SamplePage.html

body
form wicket:id=myForm
input type=text wicket:id=sampleText /
input type=submit wicket:id=sampleSubmit /
div wicket:id=resultContainer
wicket:enclosure
[YES]
/wicket:enclosure
wicket:enclosure
[NO]
/wicket:enclosure 
/div
/form
/body

SamplePage.java

public class SamplePage extends WebPage {
public SamplePage() {
add(new SampleForm(myForm));
}

private class SampleForm extends Form {
public SampleForm(String id) {
super(id);
final SimplePOJO pojo = new SimplePOJO();
setModel(new CompoundPropertyModel(pojo));
add(new TextField(sampleText, new PropertyModel(pojo,
sampleText)));

final WebMarkupContainer resultContainer = new 
WebMarkupContainer(
resultContainer);
resultContainer.setOutputMarkupId(true);
resultContainer.add(new Label(gotResults, Found...) 
{
public boolean isVisible() {
return pojo.getSampleText() != null;
}
});
resultContainer.add(new Label(noResults, Not 
found...) {
public boolean isVisible() {
return pojo.getSampleText() == null;
}
});

add(new AjaxButton(sampleSubmit) {
protected void onSubmit(AjaxRequestTarget 
target, Form f) {
// If javascript is enabled on user's 
browser.  

pojo.setSampleText(pojo.getSampleText());
if (target != null) {
// refresh the component.

target.addComponent(resultContainer);
}
}
});

add(resultContainer);
}

}
}


SimplePOJO.java

public class SimplePOJO implements Serializable{

private String sampleText;

/**
 * @return the sampleText
 */
public String getSampleText() {
return sampleText;
}

/**
 * @param sampleText the sampleText to set
 */
public void setSampleText(String sampleText) {
this.sampleText = sampleText;
}

}


-- 
View this message in context: 
http://www.nabble.com/Enclosure-%2B-AjaxButton-tp18338994p18338994.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Enclosure + AjaxButton

2008-07-08 Thread nanotech

The line below
pojo.setSampleText(pojo.getSampleText());
should be ignored.

Thanks,



nanotech wrote:
 
 Hi All,
 
 I have a simple requirement in which I want to display two different
 messages on Form Submit depending on whether or not the text field is
 filled in . The way I thought it should work is if I use combination of
 AjaxButton, WebMarkupContainer,wicket:enclosure and by overriding
 isVisible().
 The flow of sample application is. ..
 1. When the Page Loads(first-time) it displays..Not found (which means
 nothing has been entered in textfield).[This is working as expected]
 2. When I type in something to textfield and submit the form--it should
 display Found but its not displaying that message.[Not working as
 expected]
 3. Also, When i clear the textfield and re-submit the form it should
 display Not found.But this also does not happen.[Not working as
 expected]
 
 In short, the state of the WebMarkupcontainer never gets updated after
 intial load.
 Can someone point out what am I missing?
 
 Here is the code.
 
 SamplePage.html
 
 body
   form wicket:id=myForm
   input type=text wicket:id=sampleText /
   input type=submit wicket:id=sampleSubmit /
   div wicket:id=resultContainer
   wicket:enclosure
   [YES]
   /wicket:enclosure
   wicket:enclosure
   [NO]
   /wicket:enclosure 
   /div
   /form
 /body
 
 SamplePage.java
 
 public class SamplePage extends WebPage {
   public SamplePage() {
   add(new SampleForm(myForm));
   }
 
   private class SampleForm extends Form {
   public SampleForm(String id) {
   super(id);
   final SimplePOJO pojo = new SimplePOJO();
   setModel(new CompoundPropertyModel(pojo));
   add(new TextField(sampleText, new PropertyModel(pojo,
   sampleText)));
 
   final WebMarkupContainer resultContainer = new 
 WebMarkupContainer(
   resultContainer);
   resultContainer.setOutputMarkupId(true);
   resultContainer.add(new Label(gotResults, Found...) 
 {
   public boolean isVisible() {
   return pojo.getSampleText() != null;
   }
   });
   resultContainer.add(new Label(noResults, Not 
 found...) {
   public boolean isVisible() {
   return pojo.getSampleText() == null;
   }
   });
 
   add(new AjaxButton(sampleSubmit) {
   protected void onSubmit(AjaxRequestTarget 
 target, Form f) {
   // If javascript is enabled on user's 
 browser.  
   
 pojo.setSampleText(pojo.getSampleText());
   if (target != null) {
   // refresh the component.
   
 target.addComponent(resultContainer);
   }
   }
   });
 
   add(resultContainer);
   }
 
   }
 }
 
 
 SimplePOJO.java
 
 public class SimplePOJO implements Serializable{
   
   private String sampleText;
 
   /**
* @return the sampleText
*/
   public String getSampleText() {
   return sampleText;
   }
 
   /**
* @param sampleText the sampleText to set
*/
   public void setSampleText(String sampleText) {
   this.sampleText = sampleText;
   }
 
 }
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Enclosure-%2B-AjaxButton-tp18338994p18339061.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Enclosure + AjaxButton

2008-07-08 Thread nanotech

Hi Richard,

Thanks for the reply. I am using 1.3.3
I will update to 1.3.4 and try again.

Thanks,
Rachit


richardwilko wrote:
 
 There was a bug in enclosure in 1.3.3, where it wouldn't call isVisible
 after the first time (fixed in 1.3.4) which version are you using?
 
 
 
 
 nanotech wrote:
 
 The line below
 pojo.setSampleText(pojo.getSampleText());
 should be ignored.
 
 Thanks,
 
 
 
 nanotech wrote:
 
 Hi All,
 
 I have a simple requirement in which I want to display two different
 messages on Form Submit depending on whether or not the text field is
 filled in . The way I thought it should work is if I use combination of
 AjaxButton, WebMarkupContainer,wicket:enclosure and by overriding
 isVisible().
 The flow of sample application is. ..
 1. When the Page Loads(first-time) it displays..Not found (which means
 nothing has been entered in textfield).[This is working as expected]
 2. When I type in something to textfield and submit the form--it should
 display Found but its not displaying that message.[Not working as
 expected]
 3. Also, When i clear the textfield and re-submit the form it should
 display Not found.But this also does not happen.[Not working as
 expected]
 
 In short, the state of the WebMarkupcontainer never gets updated after
 intial load.
 Can someone point out what am I missing?
 
 Here is the code.
 
 SamplePage.html
 
 body
 form wicket:id=myForm
 input type=text wicket:id=sampleText /
 input type=submit wicket:id=sampleSubmit /
 div wicket:id=resultContainer
 wicket:enclosure
 [YES]
 /wicket:enclosure
 wicket:enclosure
 [NO]
 /wicket:enclosure 
 /div
 /form
 /body
 
 SamplePage.java
 
 public class SamplePage extends WebPage {
 public SamplePage() {
 add(new SampleForm(myForm));
 }
 
 private class SampleForm extends Form {
 public SampleForm(String id) {
 super(id);
 final SimplePOJO pojo = new SimplePOJO();
 setModel(new CompoundPropertyModel(pojo));
 add(new TextField(sampleText, new PropertyModel(pojo,
 sampleText)));
 
 final WebMarkupContainer resultContainer = new 
 WebMarkupContainer(
 resultContainer);
 resultContainer.setOutputMarkupId(true);
 resultContainer.add(new Label(gotResults, Found...) 
 {
 public boolean isVisible() {
 return pojo.getSampleText() != null;
 }
 });
 resultContainer.add(new Label(noResults, Not 
 found...) {
 public boolean isVisible() {
 return pojo.getSampleText() == null;
 }
 });
 
 add(new AjaxButton(sampleSubmit) {
 protected void onSubmit(AjaxRequestTarget 
 target, Form f) {
 // If javascript is enabled on user's 
 browser.  
 
 pojo.setSampleText(pojo.getSampleText());
 if (target != null) {
 // refresh the component.
 
 target.addComponent(resultContainer);
 }
 }
 });
 
 add(resultContainer);
 }
 
 }
 }
 
 
 SimplePOJO.java
 
 public class SimplePOJO implements Serializable{
 
 private String sampleText;
 
 /**
  * @return the sampleText
  */
 public String getSampleText() {
 return sampleText;
 }
 
 /**
  * @param sampleText the sampleText to set
  */
 public void setSampleText(String sampleText) {
 this.sampleText = sampleText;
 }
 
 }
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Enclosure-%2B-AjaxButton-tp18338994p18341732.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Enclosure + AjaxButton

2008-07-08 Thread nanotech

Ok...it worked after upgrading to Wicket 1.3.4
So, the problem was what Richard mentioned below that in wicket 1.3.3
enclosure wouldn't call isVisible() after first time

Thanks again.
Rachit


nanotech wrote:
 
 Hi Richard,
 
 Thanks for the reply. I am using 1.3.3
 I will update to 1.3.4 and try again.
 
 Thanks,
 Rachit
 
 
 richardwilko wrote:
 
 There was a bug in enclosure in 1.3.3, where it wouldn't call isVisible
 after the first time (fixed in 1.3.4) which version are you using?
 
 
 
 
 nanotech wrote:
 
 The line below
 pojo.setSampleText(pojo.getSampleText());
 should be ignored.
 
 Thanks,
 
 
 
 nanotech wrote:
 
 Hi All,
 
 I have a simple requirement in which I want to display two different
 messages on Form Submit depending on whether or not the text field is
 filled in . The way I thought it should work is if I use combination of
 AjaxButton, WebMarkupContainer,wicket:enclosure and by overriding
 isVisible().
 The flow of sample application is. ..
 1. When the Page Loads(first-time) it displays..Not found (which
 means nothing has been entered in textfield).[This is working as
 expected]
 2. When I type in something to textfield and submit the form--it should
 display Found but its not displaying that message.[Not working as
 expected]
 3. Also, When i clear the textfield and re-submit the form it should
 display Not found.But this also does not happen.[Not working as
 expected]
 
 In short, the state of the WebMarkupcontainer never gets updated after
 intial load.
 Can someone point out what am I missing?
 
 Here is the code.
 
 SamplePage.html
 
 body
form wicket:id=myForm
input type=text wicket:id=sampleText /
input type=submit wicket:id=sampleSubmit /
div wicket:id=resultContainer
wicket:enclosure
[YES]
/wicket:enclosure
wicket:enclosure
[NO]
/wicket:enclosure 
/div
/form
 /body
 
 SamplePage.java
 
 public class SamplePage extends WebPage {
public SamplePage() {
add(new SampleForm(myForm));
}
 
private class SampleForm extends Form {
public SampleForm(String id) {
super(id);
final SimplePOJO pojo = new SimplePOJO();
setModel(new CompoundPropertyModel(pojo));
add(new TextField(sampleText, new PropertyModel(pojo,
sampleText)));
 
final WebMarkupContainer resultContainer = new 
 WebMarkupContainer(
resultContainer);
resultContainer.setOutputMarkupId(true);
resultContainer.add(new Label(gotResults, Found...) 
 {
public boolean isVisible() {
return pojo.getSampleText() != null;
}
});
resultContainer.add(new Label(noResults, Not 
 found...) {
public boolean isVisible() {
return pojo.getSampleText() == null;
}
});
 
add(new AjaxButton(sampleSubmit) {
protected void onSubmit(AjaxRequestTarget 
 target, Form f) {
// If javascript is enabled on user's 
 browser.  

 pojo.setSampleText(pojo.getSampleText());
if (target != null) {
// refresh the component.

 target.addComponent(resultContainer);
}
}
});
 
add(resultContainer);
}
 
}
 }
 
 
 SimplePOJO.java
 
 public class SimplePOJO implements Serializable{

private String sampleText;
 
/**
 * @return the sampleText
 */
public String getSampleText() {
return sampleText;
}
 
/**
 * @param sampleText the sampleText to set
 */
public void setSampleText(String sampleText) {
this.sampleText = sampleText;
}
 
 }
 
 
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Enclosure-%2B-AjaxButton-tp18338994p18342163.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket + iText ?

2008-06-26 Thread nanotech

I am trying to integrate iText on the lines of example provided by John
Krasnay below.
My question is : 
1. While iterating over the list of IColumn  .How to I get hold of the
column's headers which I had created earlier using...(See TODO::1)
final ListIColumn columns = new ArrayListIColumn();
columns.add(new PropertyColumn(new Model(Author), author) ;
2. Also, How would I get hold of the contents of the column(See
TODO::2)...the way it is now...it always gets the Author property of
POJO.but i don't understand how to get hold of the contents of current
column being rendered.

~ Any suggestions?
public void generatePDF(OutputStream outputStream, ListIColumn 
columns,
IDataProvider dataProvider) throws IOException {

try {
Document document = new Document(PageSize.A4, 50, 50, 
50, 50);
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(C:\\Test2.pdf));
document.open();
Table t = new Table(columns.size(), 
dataProvider.size());
t.setBorderColor(new Color(220, 255, 100));
t.setPadding(1);
t.setSpacing(0);
t.setBorderWidth(0);

for (Iterator iterator = columns.iterator(); 
iterator.hasNext();) {
//TODO::1: Get hold of column's model and add 
to table
// that we are generating with iText

}
Iterator iter = dataProvider.iterator(0, 
dataProvider.size());

while (iter.hasNext()) {
Object o = iter.next();
IModel rowModel = dataProvider.model(o);
// Get the POJO for the row
MyPOJO doc = (MyPOJO) rowModel.getObject();

for (short i = 0; i  columns.size(); i++) {
// TODO::2: How will we know what kind 
of property it is...
Cell cell = new Cell(doc.getAuthor());
t.addCell(cell);
}
}
document.add(t);
document.close();

} catch (BadElementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}










Ricky-22 wrote:
 
 that is sweet, thanks, i'll try it out. Appreciate it. :)
 
 Rick
 
 On Wed, Apr 16, 2008 at 9:50 PM, John Krasnay [EMAIL PROTECTED] wrote:
 
 It goes something like this. I've left out a bunch of stuff to do with
 setting column headings, widths, and styles.

 public interface ReportColumn extends Serializable {
public Object getCellValue(IModel rowModel);
 }

 public class ExcelReportGenerator implements ReportGenerator {
public void generate(
OutputStream outputStream,
ReportColumn[] columns,
IDataProvider dataProvider) throws IOException {

HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet();

Iterator iter = dataProvider.iterator(0, dataProvider.size());
while (iter.hasNext()) {
Object o = iter.next();
IModel rowModel = dataProvider.model(o);
row = sheet.createRow(rownum++);
for (short i = 0; i  columns.length; i++) {
HSSFCell cell = row.createCell(columnNumber,
HSSFCell.CELL_TYPE_STRING);
Object value = column.getCellValue(rowModel);
cell.setCellValue(new
 HSSFRichTextString(value.toString()));
}
}

workbook.write(outputStream);
}
 }


 We then use a Link with code like this in its onClick method:

public void onClick() {
final ReportGenerator generator = getReportGenerator();

IResourceStream resourceStream =
  new AbstractResourceStreamWriter() {
public void write(OutputStream output) {
try {
generator.generate(output, columns, dataProvider);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public String getContentType() {
return generator.getContentType();
}

};

getRequestCycle().setRequestTarget(
new ResourceStreamRequestTarget(resourceStream)
.setFileName(getFileName()));
}


 jk

 On Wed, Apr 16, 2008 at 09:25:41PM -0400, Ricky 

BookMarkable Home Page?

2008-06-13 Thread nanotech

Hi All,

In my application the Home Page of the class has the url that looks like
this 

http://localhost:8080/app/?id=ABCXYZ

This form has a textfield that I am pre-filling with value of id from
query param (in this case ABCYXZ). 
It also has JCaptcha component and a text field component to validate that
captcha.
And there is Submit button.

Now, The problem is:
When I Submit the form and if any of the required fields is not filled up
then it shows validation errors which is all good. But, the  page refreshes
and url of the page changes to 
http://localhost:8080/app/?wicket:interface=:0  . 

 - How can I prevent query param from disappearing?
 - How can I prevent from ?wicket:interface=:0 from appearing so that it
does not expire after server re-boot (Note: this is the home page of the
application)
 

Thanks for the help,
RG
 
-- 
View this message in context: 
http://www.nabble.com/BookMarkable-Home-Page--tp17830736p17830736.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: BookMarkable Home Page?

2008-06-13 Thread nanotech

I used StateLess form but there is no difference. both the Problems still
there.
i.e. 
1. Query parameter goes away when the form is submitted and if there are
validation errors.
2. URL changes to http://localhost:8080/app/?wicket:interface=:0

My hierarchy looks like.

--MyApplication extends WebApplication
   |
  has
   |__HomePage [ --Constructor looks like HomePage(PageParameters params) ]
   |
  has
   |___DisplayPanel [-- Constructor looks like DisplayPanel(String
id,PageParameters params)]
 |
has
 |
  DisplayForm  extends StatelessForm [-- Constructor looks like
DisplayForm(String id,PageParameters params) ]
   


igor.vaynberg wrote:
 
 use statelessform
 
 -igor
 
 On Fri, Jun 13, 2008 at 12:46 PM, nanotech [EMAIL PROTECTED]
 wrote:

 Hi All,

 In my application the Home Page of the class has the url that looks like
 this

 http://localhost:8080/app/?id=ABCXYZ

 This form has a textfield that I am pre-filling with value of id from
 query param (in this case ABCYXZ).
 It also has JCaptcha component and a text field component to validate
 that
 captcha.
 And there is Submit button.

 Now, The problem is:
 When I Submit the form and if any of the required fields is not filled up
 then it shows validation errors which is all good. But, the  page
 refreshes
 and url of the page changes to
 http://localhost:8080/app/?wicket:interface=:0  .

  - How can I prevent query param from disappearing?
  - How can I prevent from ?wicket:interface=:0 from appearing so that
 it
 does not expire after server re-boot (Note: this is the home page of the
 application)


 Thanks for the help,
 RG

 --
 View this message in context:
 http://www.nabble.com/BookMarkable-Home-Page--tp17830736p17830736.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/BookMarkable-Home-Page--tp17830736p17831329.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: BookMarkable Home Page?

2008-06-13 Thread nanotech

But if I do that wouldn't the feedback messages will go away?

-- Thoughts?
RG

Ryan Gravener-3 wrote:
 
 Maybe override onError and redirect to the bookmarkable page w/ params?
 
 On Fri, Jun 13, 2008 at 3:46 PM, nanotech [EMAIL PROTECTED] wrote:
 

 Hi All,

 In my application the Home Page of the class has the url that looks like
 this

 http://localhost:8080/app/?id=ABCXYZ

 This form has a textfield that I am pre-filling with value of id from
 query param (in this case ABCYXZ).
 It also has JCaptcha component and a text field component to validate
 that
 captcha.
 And there is Submit button.

 Now, The problem is:
 When I Submit the form and if any of the required fields is not filled up
 then it shows validation errors which is all good. But, the  page
 refreshes
 and url of the page changes to
 http://localhost:8080/app/?wicket:interface=:0  .

  - How can I prevent query param from disappearing?
  - How can I prevent from ?wicket:interface=:0 from appearing so that
 it
 does not expire after server re-boot (Note: this is the home page of the
 application)


 Thanks for the help,
 RG

 --
 View this message in context:
 http://www.nabble.com/BookMarkable-Home-Page--tp17830736p17830736.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 -- 
 Ryan Gravener
 http://twitter.com/ryangravener
 
 

-- 
View this message in context: 
http://www.nabble.com/BookMarkable-Home-Page--tp17830736p17831353.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ModalWindow

2008-06-05 Thread nanotech

Hi All,

I am using panel inside a ModalWindow. I have few questions regarding Modal
Window.

1. It seems that setInitialWidth(800)  is not being honoured. No matter what
size I set it comes out to be same size.

2. Also, when I try to increase horiznontal size of modal window (by
dragging )then it does not increase,however the parent window from where
modal window has come shows horzontal scrollbar. (I know it works fine in
the example at
http://www.wicket-library.com/wicket-examples/ajax/modal-window.0 ) . But I
wonder whats wrong in my case. 

Inspecting the div in Firebug showed

div id=_wicket_window_13 class=wicket-modal style=top: 145.5px; left:
420px; width: 1695px; position: absolute; visibility: visible;

However, the actual modal window did not expand horizontally.

3. Is there a way to set(or restrict) max width / max height of ModalWindow.

4. How can I add Header/Footer in  Modal window (Do I have to use Modal
window with Page in that case?)

5. Also, when ModalWindow gets created it uses modal.css for styling. Is it
possible to provide my own css? If yes, then do I have to keep the css class
names same as in modal.css (e.g class=wicket-modal )


Thanks,
RG
-- 
View this message in context: 
http://www.nabble.com/ModalWindow-tp17672576p17672576.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using DataTable

2008-05-29 Thread nanotech

Hi,
I have a search form (in a panel)with various search fields(as text fields)
on it. User should be able to fill in any number of search parameters  and
the results are to be displayed in table (with pagenation + sorting
capablity on columns) in a different panel on the same page under the search
panel.

I started looking at DataTable. It seems a option that will solve my need.

Looking at the datatable example on
http://www.wicket-library.com/wicket-examples/repeater/

I observed that the following methods get called in the order 

1. size() from CustomSortableDataProvider.
2. iterator() from CustomSortableDataProvider
3. load() from CustomLoadableDetachableModel.

If I understand it correctly:-(Please  correct me if I am wrong)
 * size() requires , the number of records that provider will be working
with. So, in above case i'll have to make query thrrough service layer /DAO 
like this  Select count(*) from Employees where  firstName Like 'ABC' and
lastName Like 'XYZ'

* iterator(final int first, final int count) will call Service layer/DAO to
do the actual query like this  Select * from Employees where firstName Like
'ABC' and lastName Like 'XYZ'

* finally in model ...I will call the CustomLoadableDetachableModel and its
load() method will load the actual Employee model  for each item that will
be displayed on first page of the list being rendered in data table.


It seems that there are too many queries in case of datatable. If the result
set has thousands of records and we are displaying 100 per page then it will
do 100+ queries to render all the items.

Questions:
1. Did I sum up about DataTable correctly? If yes, Won't this be a
bottleneck considering the number of queries?
2. Is there a better way of doing this?

Thanks,
RG







-- 
View this message in context: 
http://www.nabble.com/Using-DataTable-tp17543606p17543606.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using DataTable

2008-05-29 Thread nanotech

Thanks Igor for your reply.
 
So, what do you suggest I should do:

1. After making the call in iterator() method Should I store the result
object (Employee object ) in EmployeeDAO and then refer it later when I call 
public IModel model(Object object) {
return new DetachableEmployeeModel((Employee)object);
}
and then look it up (by employee Id) from that stored object?

2. Do I need to take care of synchronization when I store the object?

Any other suggestions?

Thanks,
RG

 



igor.vaynberg wrote:
 
 On Thu, May 29, 2008 at 12:09 PM, nanotech [EMAIL PROTECTED]
 wrote:

 Hi,
 I have a search form (in a panel)with various search fields(as text
 fields)
 on it. User should be able to fill in any number of search parameters 
 and
 the results are to be displayed in table (with pagenation + sorting
 capablity on columns) in a different panel on the same page under the
 search
 panel.

 I started looking at DataTable. It seems a option that will solve my
 need.

 Looking at the datatable example on
 http://www.wicket-library.com/wicket-examples/repeater/

 I observed that the following methods get called in the order

 1. size() from CustomSortableDataProvider.
 2. iterator() from CustomSortableDataProvider
 3. load() from CustomLoadableDetachableModel.

 If I understand it correctly:-(Please  correct me if I am wrong)
  * size() requires , the number of records that provider will be working
 with. So, in above case i'll have to make query thrrough service layer
 /DAO
 like this  Select count(*) from Employees where  firstName Like 'ABC' and
 lastName Like 'XYZ'

 * iterator(final int first, final int count) will call Service layer/DAO
 to
 do the actual query like this  Select * from Employees where firstName
 Like
 'ABC' and lastName Like 'XYZ'

 * finally in model ...I will call the CustomLoadableDetachableModel and
 its
 load() method will load the actual Employee model  for each item that
 will
 be displayed on first page of the list being rendered in data table.


 It seems that there are too many queries in case of datatable. If the
 result
 set has thousands of records and we are displaying 100 per page then it
 will
 do 100+ queries to render all the items.

 Questions:
 1. Did I sum up about DataTable correctly?
 
 no, there are only two queries per page render of datatable.
 
 If yes, Won't this be a
 bottleneck considering the number of queries?
 
 2. Is there a better way of doing this?
 
 not until someone finds one.
 
 -igor
 

 Thanks,
 RG







 --
 View this message in context:
 http://www.nabble.com/Using-DataTable-tp17543606p17543606.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Using-DataTable-tp17543606p17545174.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using DataTable

2008-05-29 Thread nanotech

Thanks for the reply...

Herre is What I have...

iterator() loads the list of employee instances 
public Iterator iterator(int first, int count) 
{
List employees = empService.getEmployees(); 
 
return employees.iterator();
}

in model() you give each of your detachable models an instance of the
employee, 
public IModel model(Object object) 
{
  return new EmployeeModel((Employee) object, empService);
}

and in EmployeeModel.java

public class EmployeeModel extends LoadableDetachableModel {
 
private EmployeeService empService;
 private   Long id;
public EmployeeModel(Employee emp, EmployeeService empService) {
super(emp);
this.id = emp.getId();
this.empService= empService;
}

protected Object load() {
 return empService.getEmployee(String.valueOf(id));
}
}

So, I my question is: when load() gets called from model() then where should
it look it up...as you said it does not need to go to database
againbecause we already have the object. But, we did not store the
object anywhereso that empService.getEmployee(String.valueOf(id)); can
go and look it up. When I retrieved Object in iterator() it was stored
locally. Where should I store it...so that above method can read it again?

Thanks for your help,
RG  



igor.vaynberg wrote:
 
 i dont really get what the problem is
 
 iterator() loads the list of employee instances
 
 in model() you give each of your detachable models an instance of the
 employee, so during that request the model doesnt need to load
 anything because its already there...
 
 -igor
 
 On Thu, May 29, 2008 at 1:31 PM, nanotech [EMAIL PROTECTED] wrote:

 Thanks Igor for your reply.

 So, what do you suggest I should do:

 1. After making the call in iterator() method Should I store the result
 object (Employee object ) in EmployeeDAO and then refer it later when I
 call
public IModel model(Object object) {
return new DetachableEmployeeModel((Employee)object);
}
 and then look it up (by employee Id) from that stored object?

 2. Do I need to take care of synchronization when I store the object?

 Any other suggestions?

 Thanks,
 RG





 igor.vaynberg wrote:

 On Thu, May 29, 2008 at 12:09 PM, nanotech [EMAIL PROTECTED]
 wrote:

 Hi,
 I have a search form (in a panel)with various search fields(as text
 fields)
 on it. User should be able to fill in any number of search parameters
 and
 the results are to be displayed in table (with pagenation + sorting
 capablity on columns) in a different panel on the same page under the
 search
 panel.

 I started looking at DataTable. It seems a option that will solve my
 need.

 Looking at the datatable example on
 http://www.wicket-library.com/wicket-examples/repeater/

 I observed that the following methods get called in the order

 1. size() from CustomSortableDataProvider.
 2. iterator() from CustomSortableDataProvider
 3. load() from CustomLoadableDetachableModel.

 If I understand it correctly:-(Please  correct me if I am wrong)
  * size() requires , the number of records that provider will be
 working
 with. So, in above case i'll have to make query thrrough service layer
 /DAO
 like this  Select count(*) from Employees where  firstName Like 'ABC'
 and
 lastName Like 'XYZ'

 * iterator(final int first, final int count) will call Service
 layer/DAO
 to
 do the actual query like this  Select * from Employees where firstName
 Like
 'ABC' and lastName Like 'XYZ'

 * finally in model ...I will call the CustomLoadableDetachableModel and
 its
 load() method will load the actual Employee model  for each item that
 will
 be displayed on first page of the list being rendered in data table.


 It seems that there are too many queries in case of datatable. If the
 result
 set has thousands of records and we are displaying 100 per page then it
 will
 do 100+ queries to render all the items.

 Questions:
 1. Did I sum up about DataTable correctly?

 no, there are only two queries per page render of datatable.

 If yes, Won't this be a
 bottleneck considering the number of queries?

 2. Is there a better way of doing this?

 not until someone finds one.

 -igor


 Thanks,
 RG







 --
 View this message in context:
 http://www.nabble.com/Using-DataTable-tp17543606p17543606.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




 --
 View this message in context:
 http://www.nabble.com/Using-DataTable-tp17543606p17545174.html
 Sent from the Wicket - User mailing list archive at Nabble.com

Checkbox inside the Dropdown

2008-05-20 Thread nanotech

Hi,

Does wicket have a component that gives the ability to nest the various
choices with checkboxes as dropdown options.  

I want to be able to put checkboxes in the dropdown along with other text
from compnent's model and user should be able to make selections by checking
one or multiple check boxes. Its kind of putting the ListView with
Checkboxes inside the dropdown.

An example demo is here http://easylistbox.com/demoMultiDropDown.aspx

Can some one give me a pointer?

Thanks, 
-- 
View this message in context: 
http://www.nabble.com/Checkbox-inside-the-Dropdown-tp17350248p17350248.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Checkbox inside the Dropdown

2008-05-20 Thread nanotech

Which examples you are talking about here..can you please elaborate? 


igor.vaynberg wrote:
 
 no, wicket does not have a component like this out of the box, but you
 can easily create one yourself by wrapping the javascript on the
 example page.
 
 there are plenty of javascript driven components you can use as
 examples in wicket-stuff
 
 -igor
 
 On Tue, May 20, 2008 at 1:35 PM, nanotech [EMAIL PROTECTED] wrote:

 Hi,

 Does wicket have a component that gives the ability to nest the various
 choices with checkboxes as dropdown options.

 I want to be able to put checkboxes in the dropdown along with other text
 from compnent's model and user should be able to make selections by
 checking
 one or multiple check boxes. Its kind of putting the ListView with
 Checkboxes inside the dropdown.

 An example demo is here http://easylistbox.com/demoMultiDropDown.aspx

 Can some one give me a pointer?

 Thanks,
 --
 View this message in context:
 http://www.nabble.com/Checkbox-inside-the-Dropdown-tp17350248p17350248.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Checkbox-inside-the-Dropdown-tp17350248p17352290.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Checkbox inside the Dropdown

2008-05-20 Thread nanotech

Can you please give me a starting point...for implementing this?


nanotech wrote:
 
 Which examples you are talking about here..can you please elaborate? 
 
 
 igor.vaynberg wrote:
 
 no, wicket does not have a component like this out of the box, but you
 can easily create one yourself by wrapping the javascript on the
 example page.
 
 there are plenty of javascript driven components you can use as
 examples in wicket-stuff
 
 -igor
 
 On Tue, May 20, 2008 at 1:35 PM, nanotech [EMAIL PROTECTED]
 wrote:

 Hi,

 Does wicket have a component that gives the ability to nest the various
 choices with checkboxes as dropdown options.

 I want to be able to put checkboxes in the dropdown along with other
 text
 from compnent's model and user should be able to make selections by
 checking
 one or multiple check boxes. Its kind of putting the ListView with
 Checkboxes inside the dropdown.

 An example demo is here http://easylistbox.com/demoMultiDropDown.aspx

 Can some one give me a pointer?

 Thanks,
 --
 View this message in context:
 http://www.nabble.com/Checkbox-inside-the-Dropdown-tp17350248p17350248.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Checkbox-inside-the-Dropdown-tp17350248p17352552.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Javascript + wicket

2008-05-17 Thread nanotech

thanks timo.



Timo Rantalaiho wrote:
 
 On Fri, 16 May 2008, nanotech wrote:
 I want to know what are the different approaches that I can take in
 Wicket
 to solve this simple problem.
 Consider there are two radio buttons and they both have corresponding
 text
 fields in front of them.
 
 I want to enable /disable the other text fields when the radio button is
 selected.
 
 You can do that with plain JavaScript in the markup file, or
 with Wicket ajax. If you use ajax, you have to make sure that
 the data of the repainted fields gets submitted to the
 server, because otherwise it will be lost. 
 AjaxFormComponentUpdatingBehavior or
 AjaxFormValidatingBehavior probably do the trick.
 
 Best wishes,
 Timo
 
 -- 
 Timo Rantalaiho   
 Reaktor Innovations OyURL: http://www.ri.fi/ 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Javascript-%2B-wicket-tp17279716p17293154.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Javascript + wicket

2008-05-16 Thread nanotech

Hi,

I want to know what are the different approaches that I can take in Wicket
to solve this simple problem.
Consider there are two radio buttons and they both have corresponding text
fields in front of them.

I want to enable /disable the other text fields when the radio button is
selected.


-- 
View this message in context: 
http://www.nabble.com/Javascript-%2B-wicket-tp17279716p17279716.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DefaultDataTable + CheckGroupSelector / CheckGroup

2008-05-09 Thread nanotech

Hi,

I am trying to implement CheckGroupSelector and CheckGroup( which will hold
all the Check(s) ) inside DefaultDataTable, so that each row that gets
displayed should also have checkbox and there should be checkbox on top
which allows to check/uncheck all checkboxes.

Can someone please post a simple example for this?

Also, Please suggest how to find out which check box is selected
(considering there is a button on the page)

Thanks,
~R

-- 
View this message in context: 
http://www.nabble.com/DefaultDataTable-%2B-CheckGroupSelector---CheckGroup-tp17148286p17148286.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ListView + SubmitLink + RequiredTextField

2008-04-25 Thread nanotech

Hi All,
I have a Required TextField and SubmitLink inside a ListView (which is
dynamic).  When I click the submit link for a row...it validates all the
text fields in List View rather than the textfield against that link (and
shows that field is required .) Is there a way to get around this ?

Thanks,
RG
-- 
View this message in context: 
http://www.nabble.com/ListView-%2B-SubmitLink-%2B--RequiredTextField-tp16895761p16895761.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Is it possible to disable dates in Wicket Date Picker ?

2008-04-21 Thread nanotech

Hi All,

Is it possible to programatically disable dates that have passed in wicket's
date picker. for exampleI want to disable all the dates before today's
day.

Can someone please give an example?

Thanks,
~ R
-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-disable-dates-in-Wicket-Date-Picker---tp16807706p16807706.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wicket + iText ?

2008-04-16 Thread nanotech

Hi,

I have a table displayed in ListView element of wicket and would like to
generate a PDF using iText API.
Can someone suggest how to get started with this?

Thanks,
RG 
-- 
View this message in context: 
http://www.nabble.com/Wicket-%2B-iText---tp16733269p16733269.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Displaying date as Label.

2008-04-03 Thread nanotech

Hi All,

I need some help displaying date correctly in Label. I am using a text
field(and DatePicker) to take date input and storing it in mySQL database.
But while displying it as a Label I am only seeing time (i.e it always
shows 12:00 am).The date in database is correct.

Here is how I am doing it.

# For uploading
TextField uploadDate = new TextField(uploadDate,Date.class);
uploadDate.add(new DatePicker());

#For displaying(in a ListView)

item.add(new Label(uploadDate ,new
PropertyModel(item.getModel(),uploadDate )));


#Environment:
Wicket 1.3.2 (also includes joda time)
MySQL(5.5x)


Can someone please help.
Thanks,
RG
-- 
View this message in context: 
http://www.nabble.com/Displaying-date-as-Label.-tp16467546p16467546.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]