You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by GitBox <gi...@apache.org> on 2021/11/14 20:14:41 UTC

[GitHub] [wicket] martin-g commented on a change in pull request #481: several minor datatable improvements

martin-g commented on a change in pull request #481:
URL: https://github.com/apache/wicket/pull/481#discussion_r748902761



##########
File path: wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/NavigatorLabel.java
##########
@@ -46,11 +46,21 @@
 	public NavigatorLabel(final String id, final IPageableItems pageable)
 	{
 		super(id);
-		setDefaultModel(new StringResourceModel("NavigatorLabel", this,
+		setDefaultModel(new StringResourceModel(getNavigationLabelKey(), this,
 			new Model<>(new LabelModelObject(pageable))));
 	}
 
-	private static class LabelModelObject implements IClusterable
+	/**
+	 * Allows to override the key used for navigation label.
+	 *
+	 * @return The i18n key.
+	 */
+	protected String getNavigationLabelKey()

Review comment:
       What is the problem you try to solve here ?
   You know that you could be specific in your i18n files to use the component path in the tree to specify different labels for different usages ?

##########
File path: wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/NavigationToolbar.java
##########
@@ -44,17 +46,18 @@ public NavigationToolbar(final DataTable<?, ?> table)
 
 		WebMarkupContainer span = new WebMarkupContainer("span");
 		add(span);
-		span.add(AttributeModifier.replace("colspan", new IModel<String>()
-		{
-			@Override
-			public String getObject()
-			{
-				return String.valueOf(table.getColumns().size()).intern();
-			}
-		}));
+		span.add(AttributeModifier.replace("colspan", (IModel<String>) () -> String.valueOf(table.getColumns().size()).intern()));
 
 		span.add(newPagingNavigator("navigator", table));
-		span.add(newNavigatorLabel("navigatorLabel", table));
+		Component complexLabel = newComplexNavigatorLabel("navigatorLabel", table);
+		if (complexLabel != null)
+		{
+			span.add(complexLabel);
+		}
+		else
+		{
+			span.add(newNavigatorLabel("navigatorLabel", table));

Review comment:
       I think it is backward compatible to change the return type from `X` to `AParentOfX`.
   Try it! The `japicmp` plugin will tell you!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org