use of org.linkki.core.ButtonPmo in project linkki by linkki-framework.
the class ButtonPmoBindingTest method testButtonClickIsForwaredToPmo.
@Test
public void testButtonClickIsForwaredToPmo() {
ButtonPmo pmo = mock(ButtonPmo.class);
PropertyDispatcher propertyDispatcher = new org.linkki.core.binding.dispatcher.ButtonPmoDispatcher(new ReflectionPropertyDispatcher(() -> pmo, StringUtils.EMPTY, wrappedDispatcher));
ButtonPmoBinding buttonPmoBinding = new ButtonPmoBinding(button, propertyDispatcher, bindingContext::updateUI);
bindingContext.add(buttonPmoBinding);
button.click();
verify(pmo).onClick();
}
use of org.linkki.core.ButtonPmo in project linkki by linkki-framework.
the class ButtonPmoBindingTest method testUpdateFromPmo_LambdaPmo.
@Test
public void testUpdateFromPmo_LambdaPmo() {
ButtonPmo lambdaPmo = () -> System.out.println("click");
PropertyDispatcher propertyDispatcher = new org.linkki.core.binding.dispatcher.ButtonPmoDispatcher(new ReflectionPropertyDispatcher(() -> lambdaPmo, StringUtils.EMPTY, wrappedDispatcher));
ButtonPmoBinding binding = new ButtonPmoBinding(button, propertyDispatcher, bindingContext::updateUI);
bindingContext.add(binding);
binding.updateFromPmo();
assertThat(button.isVisible(), is(true));
assertThat(button.isEnabled(), is(true));
}
use of org.linkki.core.ButtonPmo in project linkki by linkki-framework.
the class AbstractSection method createOpenCloseButton.
private void createOpenCloseButton() {
ButtonPmo buttonPmo = ButtonPmo.Builder.action(this::switchOpenStatus).icon(FontAwesome.ANGLE_DOWN).get();
openCloseButton = ComponentFactory.newButton(buttonPmo.getButtonIcon(), buttonPmo.getStyleNames());
openCloseButton.addClickListener(e -> buttonPmo.onClick());
if (header != null) {
header.addComponent(openCloseButton);
}
}
use of org.linkki.core.ButtonPmo in project linkki by linkki-framework.
the class PmoBasedTableSectionFactory method createSection.
/**
* Creates a new section showing a table, table structure and content is defined by the
* factory's {@link ContainerPmo}.
*/
public TableSection<T> createSection() {
Table table = createTable();
Optional<ButtonPmo> addItemPmo = containerPmo.getAddItemButtonPmo();
TableSection<T> section = createEmptySection(addItemPmo);
section.setTable(table);
return section;
}
Aggregations