<MyColourRendererPlugin Project>/src/org/myorg/mycolourrendererplugin/ColouringRendererFactory.java |
package org.myorg.mycolourrendererplugin;
import com.im.df.api.capabilities.DFFieldDataTypeCapability;
import com.im.df.api.capabilities.DFFieldFloatCapability;
import com.im.df.api.capabilities.DFFieldIntegerCapability;
import com.im.df.api.ddl.DFField;
import com.im.df.api.util.DIFUtilities;
import com.im.ijc.core.api.renderers.IJCWidgetRenderer;
import com.im.ijc.core.api.renderers.IJCWidgetTextRenderer;
import com.im.ijc.core.api.renderers.RendererFactory;
import javax.swing.table.TableCellRenderer;
public class ColouringRendererFactory implements RendererFactory {
@Override
public int getSuitabilityFor(DFField field, RendererFactory.RendererType type) {
if (type.equals(RendererFactory.RendererType.TableCell) || type.equals(RendererFactory.RendererType.WidgetText)) {
DFFieldDataTypeCapability cap = (DFFieldDataTypeCapability) DIFUtilities.findCapability(field, DFFieldDataTypeCapability.class);
if ((cap instanceof DFFieldIntegerCapability) || (cap instanceof DFFieldFloatCapability)) {
return 30;
}
}
return UNSUPPORTED;
}
@Override
public TableCellRenderer createTableCellRenderer() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IJCWidgetRenderer createWidgetRenderer() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IJCWidgetTextRenderer createWidgetTextRenderer() {
throw new UnsupportedOperationException("Not supported yet.");
}
}