Custom Pagination

2014-06-26 Thread K
My Java Code: 

public class CustomPagingNavigator extends PagingNavigator implements
Serializable {

private static final long serialVersionUID = 1L;
private PagingNavigation pagingNavigation;
private final IPageable pageable;
private final IPagingLabelProvider labelProvider;
public static final String NAVIGATION_ID = navigation;

public CustomPagingNavigator(final String id, final IPageable pageable) 
{
this(id, pageable, null);
}

public CustomPagingNavigator(String id, IPageable pageable,
IPagingLabelProvider labelProvider) {
super(id, pageable, labelProvider);
this.pageable = pageable;
this.labelProvider = labelProvider;
}

@Override
protected void onBeforeRender() {
if (get(first) == null) {

 add(new Label(page1, Page)); 
 newNavigation(this.pageable, this.labelProvider);
  add(new Label(of,  of )); 
  add(new Label(total, 
getPageable().getPageCount())); 

// Add additional page links
add(newPagingNavigationLink(first, pageable, 0).add(
new 
TitleAppender(PagingNavigator.first)));
add(newPagingNavigationIncrementLink(prev, pageable, 
-1).add(
new 
TitleAppender(PagingNavigator.previous)));
add(newPagingNavigationIncrementLink(next, pageable, 
1).add(
new 
TitleAppender(PagingNavigator.next)));
add(newPagingNavigationLink(last, pageable, -1).add(
new 
TitleAppender(PagingNavigator.last)));
}
super.onBeforeRender();
}

protected AbstractLink newPagingNavigationIncrementLink(String id,
IPageable pageable, int increment) {
return new PagingNavigationIncrementLinkVoid(id, pageable, 
increment);
}

protected AbstractLink newPagingNavigationLink(String id,
IPageable pageable, int pageNumber) {
return new PagingNavigationLinkVoid(id, pageable, pageNumber);
}

protected void newNavigation(final IPageable pageable,
final IPagingLabelProvider labelProvider) {
String label = ;
long pageIndex = getPageable().getCurrentPage();
if (labelProvider != null)
{
label = labelProvider.getPageLabel(pageIndex);
log.info(Sheldon+label);
}
else
{
label = String.valueOf(pageIndex + 1);
log.info(Penny+label);
}
add(new Label(navigation, label));
}

private final class TitleAppender extends Behavior {
private static final long serialVersionUID = 1L;

private final String resourceKey;

public TitleAppender(String resourceKey) {
this.resourceKey = resourceKey;
}

@Override
public void onComponentTag(Component component, ComponentTag 
tag) {
tag.put(title, 
CustomPagingNavigator.this.getString(resourceKey));
}
}

}
My Mark Up:

html xmlns:wicket=http://wicket.apache.org;
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titleCustom PagingNavigator/title
/head
body
wicket:panel
 lt;lt; | nbsp; lt;
| 
 |
 gt; | nbsp; gt;gt;  
/wicket:panel
/body
/html

Error Log:
014-06-26 20:15:24,081  MarkupContainer:ERROR Unable to find component with
id 'navigator' in [CustomPagingNavigator [Component id = navigator]]
Expected: 'navigator:navigator'.
Found with similar names: 'navigator', navigator:navigation'
2014-06-26 20:15:24,085 DefaultExceptionMapper:ERROR  Unexpected error
occurred
Unable to find component with id 'navigator' in [CustomPagingNavigator
[Component id = navigator]]
Expected: 'navigator:navigator'.
Found with similar names: 'navigator', navigator:navigation'
 MarkupStream: [markup =
file:/D:/MDW_PROGRAMS/apache-tomcat-7.0.53/webapps/pdflink/WEB-INF/classes/com/mdw/eai/ui/CustomPagingNavigator.html
wicket:panel
 lt;lt; | nbsp; lt;
| 
 |
 gt; | nbsp; gt;gt;  
/wicket:panel, index = 10, current =  '' (line 0, column 0)]
at

Re: Custom Pagination

2014-06-26 Thread Sven Meier

Hi,

your markup didn't make it - do you have wicket:id=navigator in it?

Sven

On 06/26/2014 04:55 PM, K wrote:

My Java Code:

public class CustomPagingNavigator extends PagingNavigator implements
Serializable {

private static final long serialVersionUID = 1L;
private PagingNavigation pagingNavigation;
private final IPageable pageable;
private final IPagingLabelProvider labelProvider;
public static final String NAVIGATION_ID = navigation;

public CustomPagingNavigator(final String id, final IPageable pageable) 
{
this(id, pageable, null);
}

public CustomPagingNavigator(String id, IPageable pageable,
IPagingLabelProvider labelProvider) {
super(id, pageable, labelProvider);
this.pageable = pageable;
this.labelProvider = labelProvider;
}

@Override
protected void onBeforeRender() {
if (get(first) == null) {

 add(new Label(page1, Page));
 newNavigation(this.pageable, this.labelProvider);
  add(new Label(of,  of ));
  add(new Label(total, getPageable().getPageCount()));

// Add additional page links
add(newPagingNavigationLink(first, pageable, 0).add(
new 
TitleAppender(PagingNavigator.first)));
add(newPagingNavigationIncrementLink(prev, pageable, 
-1).add(
new 
TitleAppender(PagingNavigator.previous)));
add(newPagingNavigationIncrementLink(next, pageable, 
1).add(
new 
TitleAppender(PagingNavigator.next)));
add(newPagingNavigationLink(last, pageable, -1).add(
new 
TitleAppender(PagingNavigator.last)));
}
super.onBeforeRender();
}

protected AbstractLink newPagingNavigationIncrementLink(String id,
IPageable pageable, int increment) {
return new PagingNavigationIncrementLinkVoid(id, pageable, 
increment);
}

protected AbstractLink newPagingNavigationLink(String id,
IPageable pageable, int pageNumber) {
return new PagingNavigationLinkVoid(id, pageable, pageNumber);
}

protected void newNavigation(final IPageable pageable,
final IPagingLabelProvider labelProvider) {
String label = ;
long pageIndex = getPageable().getCurrentPage();
if (labelProvider != null)
{
label = labelProvider.getPageLabel(pageIndex);
log.info(Sheldon+label);
}
else
{
label = String.valueOf(pageIndex + 1);
log.info(Penny+label);
}
add(new Label(navigation, label));
}

private final class TitleAppender extends Behavior {
private static final long serialVersionUID = 1L;

private final String resourceKey;

public TitleAppender(String resourceKey) {
this.resourceKey = resourceKey;
}

@Override
public void onComponentTag(Component component, ComponentTag 
tag) {
tag.put(title, 
CustomPagingNavigator.this.getString(resourceKey));
}
}

}
My Mark Up:

html xmlns:wicket=http://wicket.apache.org;
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titleCustom PagingNavigator/title
/head
body
wicket:panel
 lt;lt; | nbsp; lt;
|
 |
 gt; | nbsp; gt;gt;
/wicket:panel
/body
/html

Error Log:
014-06-26 20:15:24,081  MarkupContainer:ERROR   Unable to find component with
id 'navigator' in [CustomPagingNavigator [Component id = navigator]]
Expected: 'navigator:navigator'.
Found with similar names: 'navigator', navigator:navigation'
2014-06-26 20:15:24,085 DefaultExceptionMapper:ERRORUnexpected error
occurred
Unable to find component with id 'navigator' in [CustomPagingNavigator
[Component id = navigator]]
Expected: 'navigator:navigator'.
Found with similar names: 'navigator', navigator:navigation'
  MarkupStream: [markup =
file:/D:/MDW_PROGRAMS/apache-tomcat-7.0.53/webapps/pdflink/WEB-INF/classes/com/mdw/eai/ui/CustomPagingNavigator.html
wicket:panel
 lt;lt; | nbsp; lt;
|
 |
 gt; | nbsp; gt;gt;
/wicket:panel, index = 10, current =  '' 

Re: Custom Pagination

2014-06-26 Thread K
My Mark-up: 
html xmlns:wicket=http://wicket.apache.org;
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titleCustom PagingNavigator/title
/head
body
wicket:panel
an wicket:id=first | nbsp;
an wicket:id=prev  | 
spa wicket:id=navigator
spa wicket:id=page1/spa
spa wicket:id=navigation/spa
spa wicket:id=of/spa
spa wicket:id=total/spa |/spa
an wicket:id=next | nbsp;
an wicket:id=last  
/wicket:panel
/body
/html

Note that i changed* newNavigation()*   method...

Any help is much appreciated...Thanks. 
  

-

K
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Custom-Pagination-tp4666387p4666389.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Custom Pagination

2014-06-26 Thread Sven Meier

Hi,

your markup has wicket:id=navigator, but I don't see this id in your 
Java code.


Sven

On 06/26/2014 05:04 PM, K wrote:

My Mark-up:
html xmlns:wicket=http://wicket.apache.org;
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titleCustom PagingNavigator/title
/head
body
wicket:panel
an wicket:id=first | nbsp;
 an wicket:id=prev  |
spa wicket:id=navigator
 spa wicket:id=page1/spa
 spa wicket:id=navigation/spa
 spa wicket:id=of/spa
 spa wicket:id=total/spa |/spa
an wicket:id=next | nbsp;
 an wicket:id=last
/wicket:panel
/body
/html

Note that i changed* newNavigation()*   method...

Any help is much appreciated...Thanks.
   


-

K
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Custom-Pagination-tp4666387p4666389.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: Model data lost when calling target.add before onSubmit

2014-06-26 Thread Martin Grigorov
Hi,

The browser doesn't send any data for form elements which are not visible.
When clicking the AjaxLink you make panel1 invisible (display:none). The
following form submit submits only the visible form elements, thus empty
value is set to the checkbox's model.

Martin Grigorov
Wicket Training and Consulting


On Wed, Jun 25, 2014 at 11:32 PM, Vishal Popat vishal.po...@cipriati.co.uk
wrote:

 Hi,

 I have two panels added to a form. The idea is to create a step 1, step 2
 type functionality where after clicking next on panel 1, it hides and shows
 Panel 2.

 I have a checkbox on Panel 1
 add(new CheckBox(single, new
 PropertyModel(SelectionPanel.this, single)));

 and I have the following link
 add(new AjaxLink(next) {
 @Override
 public void onClick(AjaxRequestTarget target) {
 panel1.add(new AttributeModifier(style,
 new ModelString(display:none)));
 target.add(panel1);

 JQueryEffectBehavior effectBehavior = new
 JQueryEffectBehavior(#panel2, slide, slideOptions, 400);

 target.appendJavaScript(effectBehavior.toString());
 target.add(panel2);
 }
 });

 I submit the form using AjaxButton on panel2 where I log out the
 PropertyModel data. The data shows the defaults for single in panel1 but is
 fine for any data in Panel2

 I have narrowed it down to when I call target.add(panel1) in the onClick.

 Does this call clear any Model data that has not been submitted?

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




how to handle null pointer exception while submit button

2014-06-26 Thread kumar ramanathan
Hi Friends,
I have a text box and a submit button , If i pressed submit button without
entering anything in textbox , am getting null pointer exception . Can you
please help us on it ?


Thanks,
Kumar 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-handle-null-pointer-exception-while-submit-button-tp4666392.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 handle null pointer exception while submit button

2014-06-26 Thread Sven Meier
#setConvertEmptyInputStringToNull(false) could help, but with a 
stacktrace we can give you a better advice.


Sven

On 06/27/2014 06:33 AM, kumar ramanathan wrote:

Hi Friends,
I have a text box and a submit button , If i pressed submit button without
entering anything in textbox , am getting null pointer exception . Can you
please help us on it ?


Thanks,
Kumar

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-handle-null-pointer-exception-while-submit-button-tp4666392.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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