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

org.uqbar.wicket.xtend.XLink.xtend Maven / Gradle / Ivy

package org.uqbar.wicket.xtend

import org.apache.wicket.markup.html.link.Link
import org.apache.wicket.model.IModel
import org.eclipse.xtext.xbase.lib.Procedures.Procedure0
import org.uqbar.commons.model.UserException

/**
 * Link implementation that delegates onclick
 * to an xtend procedure
 */
class XLink extends Link {
	extension WicketExtensionFactoryMethods = new WicketExtensionFactoryMethods
	private Procedure0 procedure
	
	new(String id) {
		super(id)
	}
	
	new(String id, IModel model) {
		super(id, model)
	}
	
	override onClick() {
		try {
			this.apply(procedure)
		}
		catch (UserException e) {
			error(e.message)
		}
	}
	
	def void setOnClick(Procedure0 procedure) {
		this.procedure = procedure
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy