/** * */ package com.onaro.sanscreen.client.view.tabular; import com.onaro.sanscreen.client.view.common.renderers.PercentValueRenderer; import com.onaro.util.jfc.tables.filter.NumberFilter; /** * Abstract class to create Adaptable columns that render their values as percentages. * @author barrykl * */ public abstract class AdaptablePercentTabularColumn extends AdaptableTabularColumn { public AdaptablePercentTabularColumn (String id, Class valueType, String name, Boolean editable, int numFractionDigits) { super (id, valueType, name, editable); init (numFractionDigits); } public AdaptablePercentTabularColumn (String id, Class valueType, String name, Boolean editable) { super (id, valueType, name, editable); init (0); } public AdaptablePercentTabularColumn (String id, Class valueType, String name, int numFractionDigits) { super (id, valueType, name); init (numFractionDigits); } public AdaptablePercentTabularColumn (String id, Class valueType, String name) { super (id, valueType, name); init (0); } public AdaptablePercentTabularColumn (String id, Class valueType, int numFractionDigits) { super (id, valueType); init (numFractionDigits); } public AdaptablePercentTabularColumn (String id, Class valueType) { super (id, valueType); init (0); } private void init (int numFractionDigits) { setFilter (new NumberFilter()); PercentValueRenderer renderer = new PercentValueRenderer(); if (numFractionDigits > 0) { renderer.getFormatter().setMinimumFractionDigits (numFractionDigits); } setCellRenderer (renderer); } private static final long serialVersionUID = 1L; }