use of name.abuchen.portfolio.ui.wizards.security.EditSecurityModel.AttributeDesignation in project portfolio by buchen.
the class AttributesPage method createControl.
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
setControl(composite);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(composite);
attributeContainer = new Composite(composite, SWT.NULL);
GridDataFactory.fillDefaults().grab(true, false).applyTo(attributeContainer);
GridLayoutFactory.fillDefaults().numColumns(3).margins(5, 5).applyTo(attributeContainer);
for (AttributeDesignation attribute : model.getAttributes()) addAttributeBlock(attributeContainer, attribute);
// add button
final Button addButton = new Button(composite, SWT.PUSH);
addButton.setImage(Images.ADD.image());
addButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
showAdditionalAttributes();
}
});
GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(addButton);
parent.addDisposeListener(e -> {
if (menu != null && !menu.isDisposed())
menu.dispose();
});
}
use of name.abuchen.portfolio.ui.wizards.security.EditSecurityModel.AttributeDesignation in project portfolio by buchen.
the class AttributesPage method menuAboutToShow.
@Override
public void menuAboutToShow(IMenuManager manager) {
manager.add(new LabelOnly(Messages.LabelAvailableAttributes));
Set<AttributeType> existing = new HashSet<AttributeType>();
for (AttributeDesignation d : model.getAttributes()) existing.add(d.getType());
//
model.getClient().getSettings().getAttributeTypes().filter(//
a -> !existing.contains(a)).filter(//
a -> a.supports(Security.class)).forEach(attribute -> addMenu(manager, attribute));
}
Aggregations