All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wicketstuff.egrid.column.EditableGridActionsColumn Maven / Gradle / Ivy

There is a newer version: 10.3.0
Show newest version
package org.wicketstuff.egrid.column;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
/**
 * 
 * @author Nadeem Mohammad
 *
 */
public class EditableGridActionsColumn extends PropertyColumn
{

	public EditableGridActionsColumn(IModel displayModel)
	{
		super(displayModel, "");		
	}

	private static final long serialVersionUID = 1L;

	@Override
	public void populateItem(final Item> item, final String componentId, final IModel rowModel)
	{

		item.add(new EditableGridActionsPanel(componentId, item)
		{

			private static final long serialVersionUID = 1L;

			@Override
			protected void onSave(AjaxRequestTarget target) {
				EditableGridActionsColumn.this.onSave(target, rowModel);				
			}

			@Override
			protected void onError(AjaxRequestTarget target) {				
				EditableGridActionsColumn.this.onError(target, rowModel);				
			}

			@Override
			protected void onCancel(AjaxRequestTarget target) {
				EditableGridActionsColumn.this.onCancel(target);		
			}

			@Override
			protected void onDelete(AjaxRequestTarget target) {				
				EditableGridActionsColumn.this.onDelete(target, rowModel);		
			}
			@Override
			protected boolean allowDelete(Item rowItem) {
				return EditableGridActionsColumn.this.allowDelete(rowItem);
			}
			
		});		
	}
	
	protected boolean allowDelete(Item rowItem) {
		return true;
	}

	protected void onDelete(AjaxRequestTarget target, IModel rowModel)
	{				
		
	}

	protected void onSave(AjaxRequestTarget target, IModel rowModel)
	{
				
	}

	protected void onError(AjaxRequestTarget target, IModel rowModel)
	{
				
	}
	protected void onCancel(AjaxRequestTarget target) {

	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy