Re: how to disable the table while it is empty in wicket

2014-06-18 Thread Martin Grigorov
Hi,

On Thu, Jun 19, 2014 at 7:06 AM, kumar ramanathan 
wrote:

> Hi Martin,
>
> I have added that code in the dataview as below.
>
> dataView = new DataView>("AssignmentList", new
> ListDataProvider(assignments)) {
>public void onConfigure() {
>  *super.onConfigure();* *//am getting error here*
>

What is the error ?


>   setVisible(getDataProvider().size() > 1);
> }
>public void
> populateItem(Item> item) {
>.
>}
>   };
>
> Also in the above code in the thread above , i have add a assignmentdb
> object with empty values before form submit code, so it is loaded a table
> with empty row. while onsubmit i have removed the list values and populate
> the table with new values. I believe I should not add the empty values
> first.How to correct this ,i have done this because wicket says
> labels,dataview Ids are not defined,dataview should not be null am not
> aware
>

You should pass an empty IDataProvider.
In your case an empty list.


> of how to handle the null values.  please advice and help me.
>
> code snap:
>
> assignments.add(new AssignmentDB());
>  dataView = new
> DataView>("AssignmentList", new
> ListDataProvider(assignments)) {
>  public void populateItem(Item> item) {
>   final AssignmentDB  assign = (AssignmentDB)
> item.getModelObject();
>
> item.add(new Label("AOmemberId", assign.getMemberId()));
> item.add(new Label("AOlossId", assign.getLossId()));
>
>   }};
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/how-to-disable-the-table-while-it-is-empty-in-wicket-tp4666308p4666316.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: how to disable the table while it is empty in wicket

2014-06-18 Thread kumar ramanathan
Hi Martin,

I have added that code in the dataview as below.

dataView = new DataView>("AssignmentList", new
ListDataProvider(assignments)) {
   public void onConfigure() {
 *super.onConfigure();* *//am getting error here*
  setVisible(getDataProvider().size() > 1);
} 
   public void populateItem(Item> 
item) {
   .
   }
  };

Also in the above code in the thread above , i have add a assignmentdb
object with empty values before form submit code, so it is loaded a table
with empty row. while onsubmit i have removed the list values and populate
the table with new values. I believe I should not add the empty values
first.How to correct this ,i have done this because wicket says
labels,dataview Ids are not defined,dataview should not be null am not aware
of how to handle the null values.  please advice and help me. 

code snap:

assignments.add(new AssignmentDB());
 dataView = new DataView>("AssignmentList", 
new
ListDataProvider(assignments)) {
 public void populateItem(Item> item) {
  final AssignmentDB  assign = (AssignmentDB) 
item.getModelObject();

item.add(new Label("AOmemberId", assign.getMemberId()));
item.add(new Label("AOlossId", assign.getLossId()));

  }};




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-disable-the-table-while-it-is-empty-in-wicket-tp4666308p4666316.html
Sent from the Users forum mailing list archive at Nabble.com.

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



after redirect to statefull page and browser back button results StalePageException

2014-06-18 Thread Rakesh A
Hi,
I've a link on the page, which requires a redirect to statefull page, and
the resultant page also has this type of link, upon clicking on it [on the
second page], and on the third page, if use the browser back button, I get
StalePageException.

Click on link - will result
a. Create a page instance
b. Update its model with some data
c. Redirect to this page instance using RestartResponseException

Steps i follow are
1. Click on a link which will do the above mentioned steps
2. On the resultant page of Step#1, click on the link again.
3. Step#2 will take me to a page
4. On this page use the browser back button.

Is there any way I can set some data in page modal after page gets
instantiated [only in special cases] ?

BTW: I am using Wicket v6.12.0

Thanks,
Rakesh.A

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/after-redirect-to-statefull-page-and-browser-back-button-results-StalePageException-tp4666311.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: how to disable the table while it is empty in wicket

2014-06-18 Thread Martin Grigorov
new DataView() {
@Override
public void onConfigure() {
  super.onConfigure();
  setVisible(getDataProvider().size() > 0);
}

}

Martin Grigorov
Wicket Training and Consulting


On Wed, Jun 18, 2014 at 11:24 AM, kumar ramanathan  wrote:

>
>
> Hi Friends,
> Finally i have created a program to display table with links with guidance
> of you all.I have the below program which displays the data in a table
> format.While the page loads initially an empty table will be shown , once
> the submit button is pressed the data is populated in the table.I would
> like
> to disable the empty table while the page loads initially. I am not aware
> of
> ajax, also i have tried dataview.setenabled(false), it did not work.Please
> help me.
>
>
> Code:
> Homepage.java:
>
> public class HomePage extends WebPage {
>   ArrayList assignments = new ArrayList();
>   DataView> dataView ;
>   private String memberNumber,lossNumber;
>   public HomePage(){
> PropertyModel memberIdModel=new PropertyModel(this,"memberNumber");
> PropertyModel lossIdModel=new PropertyModel(this,"lossNumber");
> TextField memberIdField = new TextField("memberId",memberIdModel);
> TextField lossIdField = new TextField("lossId",lossIdModel);
> assignments.add(new AssignmentDB());
>   dataView = new DataView>("AssignmentList", new
> ListDataProvider(assignments)) {
> public void populateItem(Item> item) {
>  final AssignmentDB  assign = (AssignmentDB) item.getModelObject();
>  item.add(new Label("AOmemberId", assign.getMemberId()));
>  item.add(new Label("AOlossId", assign.getLossId()));
>Link link1 = new Link("AssignmentIdLink"){
>  public void onClick()
>{
>  System.out.println("Linkclicked"+ assign.getMemberId() + " " +
> assign.getLossId() );
> //this.setResponsePage(new Output() );
> //System.out.println("Linkclicked" );
> }//populateitem
>  };//dataview
>item.add(link1);
>link1.add(new Label("AOassignmentId", assign.getAssignmentId()));
>item.add(new Label("AOdol", assign.getDOL()));
>   }
> };
>
> dataView.setEnabled(true);
>
> Form form=new Form("form1"){
> public void onSubmit(){
> assignments.clear();
>   assignments.add(new
> AssignmentDB("1234","001","1357","10/12/1067"));
>   assignments.add(new
> AssignmentDB("1234","003","1357","10/12/1067"));
> dataView.setEnabled(true);
> dataView = new DataView>("AssignmentList",
> new
> ListDataProvider(assignments)) {
> public void populateItem(Item> item) {
> final AssignmentDB assign = (AssignmentDB)
> item.getModelObject();
>   item.add(new Label("AOmemberId", assign.getMemberId()));
>item.add(new Label("AOlossId", assign.getLossId()));
>Link link1 = new Link("AssignmentIdLink"){
>public void onClick(){
>  System.out.println("Linkclicked"+ assign.getMemberId() +
> " " +
> assign.getLossId() );
>}
>};
> item.add(link1);
>   link1.add(new Label("AOassignmentId", assign.getAssignmentId());
>   item.add(new Label("AOdol", assign.getDOL()));
>}
> };
>
> }//form submit
> };//form
>
> form.add(dataView);
> dataView.setEnabled(false);
>
>
>form.add(memberIdField);
>form.add(lossIdField);
>add(form);
>}//constructor
>
>
>
>  public void setMemberNumber(String x){
> this.memberNumber=x;
>  }
>  public void setLossNumber(String x){
> this.lossNumber=x;
>  }
>  public String getMemberNumber(){
> return this.memberNumber;
>  }
>  public String getLossNumber(){
> return this.lossNumber;
>  }
>
> }//class
>
>
>
> HTML FILE:
>
>  "http://www.w3.org/TR/html4/loose.dtd";>
> 
> 
> 
> EstimateSearcher
> 
> 
>
> 
> Member Number 
> Loss Number   
> 
>
>
>
> MemberNo
> LossNo
> AssignmentNo
> dol
>
>
>
>
>
>
><#> [Address]
>
>
>
>
>
>  
>
> 
> 
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/how-to-disable-the-table-while-it-is-empty-in-wicket-tp4666308.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


how to disable the table while it is empty in wicket

2014-06-18 Thread kumar ramanathan


Hi Friends,
Finally i have created a program to display table with links with guidance
of you all.I have the below program which displays the data in a table
format.While the page loads initially an empty table will be shown , once
the submit button is pressed the data is populated in the table.I would like
to disable the empty table while the page loads initially. I am not aware of
ajax, also i have tried dataview.setenabled(false), it did not work.Please
help me.

 
Code:
Homepage.java:

public class HomePage extends WebPage {
  ArrayList assignments = new ArrayList();
  DataView> dataView ;
  private String memberNumber,lossNumber;
  public HomePage(){
PropertyModel memberIdModel=new PropertyModel(this,"memberNumber");
PropertyModel lossIdModel=new PropertyModel(this,"lossNumber");
TextField memberIdField = new TextField("memberId",memberIdModel);
TextField lossIdField = new TextField("lossId",lossIdModel);
assignments.add(new AssignmentDB());
  dataView = new DataView>("AssignmentList", new
ListDataProvider(assignments)) {
public void populateItem(Item> item) {
 final AssignmentDB  assign = (AssignmentDB) item.getModelObject();
 item.add(new Label("AOmemberId", assign.getMemberId()));
 item.add(new Label("AOlossId", assign.getLossId()));
   Link link1 = new Link("AssignmentIdLink"){
 public void onClick()
   {
 System.out.println("Linkclicked"+ assign.getMemberId() + " " +
assign.getLossId() );
//this.setResponsePage(new Output() );
//System.out.println("Linkclicked" );
}//populateitem
 };//dataview
   item.add(link1);
   link1.add(new Label("AOassignmentId", assign.getAssignmentId()));
   item.add(new Label("AOdol", assign.getDOL()));
  }
};

dataView.setEnabled(true);

Form form=new Form("form1"){
public void onSubmit(){
assignments.clear();
  assignments.add(new AssignmentDB("1234","001","1357","10/12/1067"));
  assignments.add(new AssignmentDB("1234","003","1357","10/12/1067"));
dataView.setEnabled(true);
dataView = new DataView>("AssignmentList", new
ListDataProvider(assignments)) {
public void populateItem(Item> item) {
final AssignmentDB assign = (AssignmentDB) 
item.getModelObject();
  item.add(new Label("AOmemberId", assign.getMemberId()));
   item.add(new Label("AOlossId", assign.getLossId()));
   Link link1 = new Link("AssignmentIdLink"){
   public void onClick(){
 System.out.println("Linkclicked"+ assign.getMemberId() + " " +
assign.getLossId() );
   }
   };
item.add(link1);
  link1.add(new Label("AOassignmentId", assign.getAssignmentId());
  item.add(new Label("AOdol", assign.getDOL()));
   }
};

}//form submit
};//form

form.add(dataView);
dataView.setEnabled(false);
   
   
   form.add(memberIdField);
   form.add(lossIdField);
   add(form);
   }//constructor



 public void setMemberNumber(String x){
this.memberNumber=x;
 }
 public void setLossNumber(String x){
this.lossNumber=x;
 }
 public String getMemberNumber(){
return this.memberNumber;
 }
 public String getLossNumber(){
return this.lossNumber;
 }

}//class



HTML FILE:

http://www.w3.org/TR/html4/loose.dtd";>



EstimateSearcher




Member Number 
Loss Number   
 



MemberNo
LossNo
AssignmentNo
dol

   
 



   <#> [Address]  

 
   
  

 




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-disable-the-table-while-it-is-empty-in-wicket-tp4666308.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Re: Exclude link from disabled hierarchy

2014-06-18 Thread Martin Grigorov
Even simpler!

Martin Grigorov
Wicket Training and Consulting


On Wed, Jun 18, 2014 at 10:55 AM, Per Newgro  wrote:

> Thanks for your respose Martin.
>
> I maybe found another solution meanwhile. There is a method in AbstractLink
>
>
> @Override
> protected boolean isLinkEnabled() {
> return isEnabledInHierarchy();
> }
>
> I've overwritten this by
>
> @Override
> protected boolean isLinkEnabled() {
> return true;
> }
>
> Now it seems to work as expected.
>
> Thanks for your support
> Per
>
> > Gesendet: Mittwoch, 18. Juni 2014 um 09:49 Uhr
> > Von: "Martin Grigorov" 
> > An: "users@wicket.apache.org" 
> > Betreff: Re: Exclude link from disabled hierarchy
> >
> > Hi,
> >
> > I believe there is a ticket for such requirement but JIRA is too slow
> today
> > and I cannot find it.
> > In general this is not possible.
> > But it is possible for links - override
> > org.apache.wicket.markup.html.link.AbstractLink#disableLink() for this
> > special link.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> >
> >
> > On Wed, Jun 18, 2014 at 10:32 AM, Per Newgro  wrote:
> >
> > > Hi,
> > >
> > > I enable a Form by autorized role. Some users see the form enabled,
> some
> > > disabled. All works fine.
> > >
> > > My problem is that i've added a goback-link which should be enabled
> always
> > > for all users. But because the
> > > link is added to the form (within a button panel) it get's disabled to.
> > >
> > > Is there a smart way to exclude the goback link form
> "enabledInHierarchy"
> > > processing?
> > >
> > > Thanks for your support
> > > Per
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Aw: Re: Exclude link from disabled hierarchy

2014-06-18 Thread Per Newgro
Thanks for your respose Martin.

I maybe found another solution meanwhile. There is a method in AbstractLink


@Override
protected boolean isLinkEnabled() {
return isEnabledInHierarchy();
}

I've overwritten this by

@Override
protected boolean isLinkEnabled() {
return true;
}

Now it seems to work as expected.

Thanks for your support
Per

> Gesendet: Mittwoch, 18. Juni 2014 um 09:49 Uhr
> Von: "Martin Grigorov" 
> An: "users@wicket.apache.org" 
> Betreff: Re: Exclude link from disabled hierarchy
>
> Hi,
> 
> I believe there is a ticket for such requirement but JIRA is too slow today
> and I cannot find it.
> In general this is not possible.
> But it is possible for links - override
> org.apache.wicket.markup.html.link.AbstractLink#disableLink() for this
> special link.
> 
> Martin Grigorov
> Wicket Training and Consulting
> 
> 
> On Wed, Jun 18, 2014 at 10:32 AM, Per Newgro  wrote:
> 
> > Hi,
> >
> > I enable a Form by autorized role. Some users see the form enabled, some
> > disabled. All works fine.
> >
> > My problem is that i've added a goback-link which should be enabled always
> > for all users. But because the
> > link is added to the form (within a button panel) it get's disabled to.
> >
> > Is there a smart way to exclude the goback link form "enabledInHierarchy"
> > processing?
> >
> > Thanks for your support
> > Per
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 

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



Re: Exclude link from disabled hierarchy

2014-06-18 Thread Martin Grigorov
Hi,

I believe there is a ticket for such requirement but JIRA is too slow today
and I cannot find it.
In general this is not possible.
But it is possible for links - override
org.apache.wicket.markup.html.link.AbstractLink#disableLink() for this
special link.

Martin Grigorov
Wicket Training and Consulting


On Wed, Jun 18, 2014 at 10:32 AM, Per Newgro  wrote:

> Hi,
>
> I enable a Form by autorized role. Some users see the form enabled, some
> disabled. All works fine.
>
> My problem is that i've added a goback-link which should be enabled always
> for all users. But because the
> link is added to the form (within a button panel) it get's disabled to.
>
> Is there a smart way to exclude the goback link form "enabledInHierarchy"
> processing?
>
> Thanks for your support
> Per
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Exclude link from disabled hierarchy

2014-06-18 Thread Per Newgro
Hi,

I enable a Form by autorized role. Some users see the form enabled, some 
disabled. All works fine.

My problem is that i've added a goback-link which should be enabled always for 
all users. But because the
link is added to the form (within a button panel) it get's disabled to.

Is there a smart way to exclude the goback link form "enabledInHierarchy" 
processing?

Thanks for your support
Per

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



Re: Submiting form on a stateless page creates form page twice

2014-06-18 Thread Martin Grigorov
Hi,

On Tue, Jun 17, 2014 at 8:46 PM, KotFilemon  wrote:

> Hello
>
> I used wicket to create small web application with search page. This page
> is
> called many times in single minute, that is why we use stateless page for
> smaller memory usage. On this page is stateless form with query text field
> and after submit user is redirected to the same page with different page
> parameters (setResponsePage(clazz,pageParameters);). We noticed that when
> user clicked submit button wicket generate this page with old parameters,
> then run osSubmit method and later generate this page with new parameters,
> what call twice our search engine for the results! This is the normal
> situation? Is any way to deal with this behaviour?
>

The flow looks OK.
Wicket creates a new instance of the page to be able to find the stateless
form inside it and submit it with the entered by the user data.
If conversion and validation passes then Wicket sets the form components'
model objects and calls #onSubmit().
Since you do #setResponsePage() in #onSubmit() Wicket will obey and
redirect to the desired page (in your case the same page).

But you say that the search engine is called twice. That means you use the
raw request parameters to make the search. It seems you don't need
conversion and validation (this is what Wicket Form component provides for
you) then you don't need (Stateless)Form at all. You just need a  in
your markup that 'action' attribute points to the mount point of the page.

add(new WebMarkupContainer("form") {
 @Override
  public void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("action", urlFor(ThePage.class, new PageParameters()));
  }
});

There is no need to use TextField or other form components too. Use simple
HTML form elements.


>
> Best regards
> KotFilemon
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Submiting-form-on-a-stateless-page-creates-form-page-twice-tp4666301.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>