Java Code Examples for com.vaadin.flow.component.UI#setEnabled()
The following examples show how to use
com.vaadin.flow.component.UI#setEnabled() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapSyncRpcHandlerTest.java From flow with Apache License 2.0 | 6 votes |
@Test public void implicitlyDisabledElement_updateIsAllowedByEventListener_updateIsDone() throws Exception { Element element = ElementFactory.createDiv(); UI ui = new UI(); ui.getElement().appendChild(element); ui.setEnabled(false); element.addEventListener(DUMMY_EVENT, event -> { }).synchronizeProperty(TEST_PROPERTY) .setDisabledUpdateMode(DisabledUpdateMode.ALWAYS); sendSynchronizePropertyEvent(element, ui, TEST_PROPERTY, NEW_VALUE); Assert.assertEquals(NEW_VALUE, element.getPropertyRaw(TEST_PROPERTY)); }
Example 2
Source File: PublishedServerEventHandlerRpcHandlerTest.java From flow with Apache License 2.0 | 5 votes |
@Test public void implicitelyDisabledElement_eventHandlerIsNotInvoked() { UI ui = new UI(); ComponentWithMethod component = new ComponentWithMethod(); ui.add(component); ui.setEnabled(false); requestInvokeMethod(component); Assert.assertFalse(component.isInvoked); }
Example 3
Source File: MapSyncRpcHandlerTest.java From flow with Apache License 2.0 | 5 votes |
@Test public void implicitlyDisabledElement_updateIsAllowedBySynchronizeProperty_updateIsDone() throws Exception { Element element = ElementFactory.createDiv(); UI ui = new UI(); ui.getElement().appendChild(element); ui.setEnabled(false); element.addPropertyChangeListener(TEST_PROPERTY, DUMMY_EVENT, event -> { }).setDisabledUpdateMode(DisabledUpdateMode.ALWAYS); sendSynchronizePropertyEvent(element, ui, TEST_PROPERTY, NEW_VALUE); Assert.assertEquals(NEW_VALUE, element.getPropertyRaw(TEST_PROPERTY)); }