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

mmb.engine.recipe.PlugAndPlayRecipeCellRenderer Maven / Gradle / Ivy

/**
 * 
 */
package mmb.engine.recipe;

import java.awt.Component;

import javax.swing.JList;
import javax.swing.ListCellRenderer;

import mmb.NN;
import mmb.Nil;

/**
 * An implementation of cell renderer using a recipe view
 * @author oskar
 * @param  recipe type
 * @param  view type
 */
public class PlugAndPlayRecipeCellRenderer<@NN Tr, @NN Tv extends RecipeView> implements ListCellRenderer<@NN Tr> {
	@NN private final Tv view;
	/**
	 * Creates a recipe renderer
	 * @param view recipe view
	 */
	public PlugAndPlayRecipeCellRenderer(Tv view) {
		this.view = view;
	}
	@Override
	public Component getListCellRendererComponent(@Nil JList list, Tr value, int index, boolean isSelected,
			boolean cellHasFocus) {
		view.set(value);
		return view;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy