use of org.drools.workbench.screens.guided.dtree.client.widget.factories.TypeFactoryHelper in project drools-wb by kiegroup.
the class GuidedDecisionTreePalette method makeStencils.
private Widget makeStencils(final String className, final boolean isReadOnly) {
final GuidedDecisionTreePaletteGroup paletteGroup = new GuidedDecisionTreePaletteGroup();
if (className == null) {
return paletteGroup;
}
oracle.getFieldCompletions(className, new Callback<ModelField[]>() {
@Override
public void callback(final ModelField[] mfs) {
if (mfs == null || mfs.length == 0) {
return;
}
final TypeNode tn = new TypeNodeImpl(className);
paletteGroup.addStencil(typeNodeFactory, stencilBuilder, new TypeFactoryHelper(tn, isReadOnly), isReadOnly);
for (ModelField mf : mfs) {
final String fieldName = mf.getName();
if (!fieldName.equals(DataType.TYPE_THIS)) {
final ConstraintNode cn = new ConstraintNodeImpl(className, fieldName, "", new StringValue(""));
paletteGroup.addStencil(constraintNodeFactory, stencilBuilder, new ConstraintFactoryHelper(cn, isReadOnly), isReadOnly);
}
}
}
});
return paletteGroup;
}
use of org.drools.workbench.screens.guided.dtree.client.widget.factories.TypeFactoryHelper in project drools-wb by kiegroup.
the class GuidedDecisionTreeStencilPaletteBuilder method drawDescription.
@Override
protected Text drawDescription(final ShapeFactory factory, final FactoryHelper helper) {
String description = factory.getShapeDescription();
if (helper instanceof TypeFactoryHelper) {
description = ((TypeFactoryHelper) helper).getContext().getClassName();
} else if (helper instanceof ConstraintFactoryHelper) {
description = ((ConstraintFactoryHelper) helper).getContext().getFieldName();
}
final Text text = new Text(description, ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION, ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);
text.setFillColor(Color.rgbToBrowserHexColor(100, 100, 100));
text.setTextBaseLine(TextBaseLine.MIDDLE);
text.setX(STENCIL_HEIGHT);
text.setY(STENCIL_HEIGHT / 2);
return text;
}
Aggregations