use of org.jowidgets.common.types.Dimension 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;
}
use of org.jowidgets.common.types.Dimension in project jo-client-platform by jo-source.
the class BeanGraphAttributeListImpl method buildAttributeList.
public void buildAttributeList(final Map<String, Boolean> filterMap, final FilterType type) {
final ITableLayoutBuilder builder = Toolkit.getLayoutFactoryProvider().tableLayoutBuilder();
builder.columnCount(2);
builder.gap(15);
builder.verticalGap(4);
builder.alignment(1, Alignment.CENTER);
builder.fixedColumnWidth(0, 200);
builder.fixedColumnWidth(1, 50);
this.attributeLayoutManager = builder.build();
attributeLayoutManager.beginLayout();
this.setLayout(new MigLayoutDescriptor("hidemode 2", "[grow, 0::]", "[grow,0::]0[grow,0::]"));
final IBluePrintFactory bpf = Toolkit.getBluePrintFactory();
new AttributeHeaderComposite(add(bpf.composite(), "grow, wrap"));
initializeGroups(this, filterMap, bpf, type);
attributeLayoutManager.endLayout();
attributeLayoutManager.validate();
final Dimension prefSize = super.getPreferredSize();
setPreferredSize(new Dimension(prefSize.getWidth(), prefSize.getHeight()));
}
use of org.jowidgets.common.types.Dimension in project jo-client-platform by jo-source.
the class BeanLinkCreatorCommand method getBeanLink.
private IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> getBeanLink(final IExecutionContext executionContext) {
final ICapApiBluePrintFactory cbpf = CapUiToolkit.bluePrintFactory();
final IBeanLinkPanelBluePrint<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> linkPanelBp = cbpf.beanLinkPanel();
linkPanelBp.setLinkBeanForm(linkBeanForm);
linkPanelBp.setLinkableBeanForm(linkableBeanForm);
linkPanelBp.setLinkableTable(linkableTable);
final IBeanLinkDialogBluePrint<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> dialogBp = cbpf.beanLinkDialog(linkPanelBp);
dialogBp.setMinPackSize(new Dimension(800, 600));
dialogBp.setMaxPackSize(new Dimension(1600, 1000));
dialogBp.setExecutionContext(executionContext);
dialogBp.setMissingInputHint(null);
dialogBp.setContentScrolled(false);
if (dialogBounds != null) {
dialogBp.setPosition(dialogBounds.getPosition()).setSize(dialogBounds.getSize());
dialogBp.autoPackOff().autoCenterOff();
}
final IBeanLinkDialog<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> linkDialog;
linkDialog = Toolkit.getActiveWindow().createChildWindow(dialogBp);
final IBeanProxy<LINK_BEAN_TYPE> defaultLinkBean;
if (linkDefaultFactory != null) {
defaultLinkBean = linkDefaultFactory.create();
} else {
defaultLinkBean = createDefaultBean(linkBeanForm, linkBeanTypeId, linkBeanType, linkBeanPropertyValidators);
}
final List<IBeanProxy<LINKABLE_BEAN_TYPE>> defaultLinkedBeans;
if (linkableBeanForm != null) {
defaultLinkedBeans = Collections.singletonList(createDefaultBean(linkableBeanForm, linkableBeanTypeId, linkableBeanType, linkableBeanPropertyValidators));
} else {
defaultLinkedBeans = Collections.emptyList();
}
linkDialog.setValue(new IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE>() {
@Override
public IBeanProxy<LINK_BEAN_TYPE> getLinkBean() {
return defaultLinkBean;
}
@Override
public List<IBeanProxy<LINKABLE_BEAN_TYPE>> getLinkableBeans() {
return defaultLinkedBeans;
}
});
linkDialog.setVisible(true);
final IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> result;
if (linkDialog.isOkPressed()) {
final IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE> dialogValue = linkDialog.getValue();
result = new IBeanLink<LINK_BEAN_TYPE, LINKABLE_BEAN_TYPE>() {
@Override
public IBeanProxy<LINK_BEAN_TYPE> getLinkBean() {
final IBeanProxy<LINK_BEAN_TYPE> original = dialogValue.getLinkBean();
return original != null ? original : defaultLinkBean;
}
@Override
public List<IBeanProxy<LINKABLE_BEAN_TYPE>> getLinkableBeans() {
return dialogValue.getLinkableBeans();
}
};
} else {
result = null;
}
dialogBounds = linkDialog.getBounds();
linkDialog.dispose();
return result;
}
use of org.jowidgets.common.types.Dimension 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();
}
}
use of org.jowidgets.common.types.Dimension in project jo-client-platform by jo-source.
the class BeanRelationGraphImpl method openUpdateEdgeVisibilityDialog.
public void openUpdateEdgeVisibilityDialog(final int filterTabIndex) {
if (settingsDialog != null) {
settingsDialog.setVisible(false);
settingsDialog.removeAll();
settingsDialog.dispose();
settingsDialog = null;
}
updateVisibilityMaps();
settingsDialog = new BeanGraphSettingsDialog(vis, groupVisibilityMap, edgeVisibilityMap, settingsDialogPosition, filterTabIndex, groupColorMap);
settingsDialog.addComponentListener(new ComponentAdapter() {
@Override
public void positionChanged() {
settingsDialogPosition = settingsDialog.getPosition();
}
});
settingsDialog.setMinPackSize(new Dimension(400, 100));
settingsDialog.setMaxPackSize(new Dimension(400, 300));
settingsDialog.setVisible(true);
}
Aggregations