use of org.jowidgets.api.widgets.content.IInputContentCreator in project jo-client-platform by jo-source.
the class AttributeFilterDialogBluePrintFactory method createDialogBluePrint.
static IInputDialogBluePrint<IUiConfigurableFilter<? extends Object>> createDialogBluePrint(final IBeanTableModel<?> model, final int columnIndex, final IExecutionContext executionContext, final IFilterType filterType) {
final IBluePrintFactory bpf = Toolkit.getBluePrintFactory();
final ICapApiBluePrintFactory capBpf = CapUiToolkit.bluePrintFactory();
final IInputContentCreator<IUiConfigurableFilter<? extends Object>> contentCreator = new IInputContentCreator<IUiConfigurableFilter<? extends Object>>() {
private IAttributeFilterControl filterControl;
@Override
public void setValue(final IUiConfigurableFilter<? extends Object> value) {
filterControl.setValue(value);
}
@Override
public IUiConfigurableFilter<? extends Object> getValue() {
return filterControl.getValue();
}
@Override
public void createContent(final IInputContentContainer container) {
container.setLayout(new MigLayoutDescriptor("[][grow, 0::]", "10[]0"));
final IAttribute<?> attribute = model.getAttribute(columnIndex);
container.add(Toolkit.getBluePrintFactory().textLabel(attribute.getCurrentLabel()).setMarkup(Markup.STRONG));
filterControl = container.add(capBpf.attributeFilterControl(model.getAttributes()), "growx, w 0::");
if (filterType != null) {
filterControl.setAttribute(attribute, filterType);
}
}
};
final IInputDialogBluePrint<IUiConfigurableFilter<? extends Object>> dialogBp = bpf.inputDialog(contentCreator);
dialogBp.setExecutionContext(executionContext);
dialogBp.setMissingInputHint(Messages.getString("AttributeFilterDialogBluePrintFactory.please_edit_the_filter"));
dialogBp.setMinPackSize(new Dimension(600, 170));
dialogBp.setMaxPackSize(new Dimension(1024, 400));
return dialogBp;
}
Aggregations