use of org.jowidgets.api.widgets.IInputControl in project jo-client-platform by jo-source.
the class DocumentBeanFormPluginImpl method addBrowserAttribute.
private void addBrowserAttribute(final IContainer container, final IAttribute<?> attribute, final IBeanFormControlFactory controlFactory) {
container.setLayout(new MigLayoutDescriptor("wrap", "0[grow, 0::]0", "0[]0[grow, 0::]0"));
final String propertyName = attribute.getPropertyName();
@SuppressWarnings("unchecked") final IInputControl<IDocument> inputField = (IInputControl<IDocument>) container.add(controlFactory.createControl(propertyName), "growx, w 0::");
final IBrowser browser = container.add(BrowserBPF.browser(), MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
container.addShowingStateListener(new IShowingStateListener() {
@Override
public void showingStateChanged(final boolean isShowing) {
if (isShowing) {
setUrl(container, browser, inputField);
}
}
});
inputField.addInputListener(new IInputListener() {
@Override
public void inputChanged() {
setUrl(container, browser, inputField);
}
});
}
use of org.jowidgets.api.widgets.IInputControl in project jo-client-platform by jo-source.
the class BeanTableBatchEditCommand method getNewValue.
@SuppressWarnings("unchecked")
private IMaybe<Object> getNewValue(final IExecutionContext executionContext, final Object currentValue, final IAttribute<Object> attribute) {
final ICustomWidgetCreator<IInputControl<Object>> widgetCreator = getWidgetCreator(attribute);
if (widgetCreator == null) {
// TODO this should not occur, show an error to the user
return Nothing.getInstance();
}
final IInputDialogBluePrint<Object> dialogBp = BPF.inputDialog(new CurrentValueContentCreator(widgetCreator, attribute));
dialogBp.setExecutionContext(executionContext);
dialogBp.setAutoDispose(true);
dialogBp.setMinPackSize(new Dimension(400, 200));
dialogBp.setMaxPackSize(new Dimension(800, 600));
final IInputDialog<Object> dialog = Toolkit.getActiveWindow().createChildWindow(dialogBp);
dialog.setValue(currentValue);
dialog.setVisible(true);
if (dialog.isOkPressed()) {
return new Some<Object>(dialog.getValue());
} else {
return Nothing.getInstance();
}
}
Aggregations