Java Code Examples for com.vaadin.flow.dom.Element#setEnabled()
The following examples show how to use
com.vaadin.flow.dom.Element#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 disabledElement_updateDisallowed_updateIsNotDone() throws Exception { Element element = ElementFactory.createDiv(); UI ui = new UI(); ui.getElement().appendChild(element); element.setEnabled(false); element.addPropertyChangeListener(TEST_PROPERTY, DUMMY_EVENT, event -> { }).setDisabledUpdateMode(DisabledUpdateMode.ONLY_WHEN_ENABLED); sendSynchronizePropertyEvent(element, ui, TEST_PROPERTY, NEW_VALUE); Assert.assertNotEquals(NEW_VALUE, element.getPropertyRaw(TEST_PROPERTY)); }
Example 2
Source File: MapSyncRpcHandlerTest.java From flow with Apache License 2.0 | 6 votes |
@Test public void disabledElement_updateIsAllowedByEventListener_updateIsDone() throws Exception { Element element = ElementFactory.createDiv(); UI ui = new UI(); ui.getElement().appendChild(element); element.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 3
Source File: ElementListenersTest.java From flow with Apache License 2.0 | 6 votes |
@Test public void implicitlyDisabledElement_listenerDoesntReceiveEvent() { AtomicInteger eventCount = new AtomicInteger(); ns.add("foo", e -> eventCount.incrementAndGet()); Assert.assertEquals(0, eventCount.get()); DomEvent event = createEvent("foo"); Element parent = new Element("parent"); parent.appendChild(event.getSource()); parent.setEnabled(false); ns.fireEvent(event); Assert.assertEquals(0, eventCount.get()); }
Example 4
Source File: MapSyncRpcHandlerTest.java From flow with Apache License 2.0 | 5 votes |
@Test public void disabledElement_updateIsAllowedBySynchronizeProperty_updateIsDone() throws Exception { Element element = ElementFactory.createDiv(); UI ui = new UI(); ui.getElement().appendChild(element); element.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)); }
Example 5
Source File: NativeButtonRendererTest.java From flow with Apache License 2.0 | 4 votes |
private void mockDisabled(Element container) { container.setEnabled(false); container.getChildren().forEach(child -> child.setEnabled(false)); }