/** * @param element * Must not be null. * @param className * The name of a CSS class. Must not be null. * @return True iff the given element has the given CSS class as part of its class list. */ public static boolean hasCSSClass(final HTMLElement element, final String className) { return element.getClassList().contains(className); }
/** * @param element * Must not be null. * @param className * The name of a CSS class. Must not be null. * @return True iff the given element has the given CSS class as part of its class list. */ public static boolean hasCSSClass(final HTMLElement element, final String className) { return element.getClassList().contains(className); }
private boolean isOverBootstrapSelectContainer(final HTMLElement e) { if (!e.getClassList().contains(BOOTSTRAP_SELECT_CLASS)) { return false; } else if (!e.getClassList().contains(BOOTSTRAP_SELECT_OPEN_CLASS)) { return false; } return true; } }
private boolean isOverCellEditorContainer(final HTMLElement e) { return e.getClassList().contains(CONTAINER_CLASS); }
@Override public void hide() { getElement().getClassList().remove(OPEN); } }
@Override public void show() { getElement().getClassList().add(OPEN); }
void toggle() { getElement().getClassList().toggle("closed"); }
/** * Removes a CSS class from an element's class list. * * @param element * Must not be null. * @param className * The name of a CSS class. Must not be null. * @return True if the given class was removed from the given element. False if the given element did not have the * given class as part of its class list. */ public static boolean removeCSSClass(final HTMLElement element, final String className) { if (hasCSSClass(element, className)) { element.getClassList().remove(className); return true; } else { return false; } }
/** * Adds a CSS class to an element's class list. * * @param element * Must not be null. * @param className * The name of a CSS class. Must not be null. * @return True if the given class was added to the given element. False if the given element already had the * given class as part of its class list. */ public static boolean addCSSClass(final HTMLElement element, final String className) { if (hasCSSClass(element, className)) { return false; } else { element.getClassList().add(className); return true; } }
/** * Removes a CSS class from an element's class list. * * @param element * Must not be null. * @param className * The name of a CSS class. Must not be null. * @return True if the given class was removed from the given element. False if the given element did not have the * given class as part of its class list. */ public static boolean removeCSSClass(final HTMLElement element, final String className) { if (hasCSSClass(element, className)) { element.getClassList().remove(className); return true; } else { return false; } }
/** * Adds a CSS class to an element's class list. * * @param element * Must not be null. * @param className * The name of a CSS class. Must not be null. * @return True if the given class was added to the given element. False if the given element already had the * given class as part of its class list. */ public static boolean addCSSClass(final HTMLElement element, final String className) { if (hasCSSClass(element, className)) { return false; } else { element.getClassList().add(className); return true; } }
@Before public void initialize() { column1.add(component1); row1.add(column1); template.addRow(row1); when(containerElement.getClassList()).thenReturn(containerClassList); when(rowElement.getClassList()).thenReturn(rowClassList); when(columnElement.getClassList()).thenReturn(columnClassList); }
void updateCSSClass() { getElement().getClassList().add(getCSSClass(getItem())); if (getItem().getChildren().size() > 0) { getElement().getClassList().add("parent-node"); } }
@Override public LayoutInstance build(LayoutTemplate layoutTemplate, LayoutGeneratorDriver driver) { HTMLElement container = driver.createContainer(); container.setId(CONTAINER_ID); container.getClassList().add("uf-perspective-container"); container.getClassList().add("uf-perspective-rendered-container"); applyCssToElement(layoutTemplate.getLayoutProperties(), container); LayoutInstance layoutInstance = new LayoutInstance(container); List<LayoutRow> rows = layoutTemplate.getRows(); generateRows(layoutTemplate, layoutInstance, driver, rows, container); return layoutInstance; }
@Test public void testMessages() { final HTMLElement htmlElement = mock(HTMLElement.class); when(htmlElement.getClassList()).thenReturn(mock(DOMTokenList.class)); when(document.createElement(anyString())).thenReturn(htmlElement); when(message.getChildNodes()).thenReturn(mock(NodeList.class)); notification.setMessage(Arrays.asList("message")); verify(message).appendChild(any(Node.class)); verify(document).createElement("li"); verify(document).createElement("ul"); } }
@Test public void testMessages() { final HTMLElement htmlElement = mock(HTMLElement.class); when(htmlElement.getClassList()).thenReturn(mock(DOMTokenList.class)); when(document.createElement(anyString())).thenReturn(htmlElement); when(message.getChildNodes()).thenReturn(mock(NodeList.class)); notification.setMessage(Arrays.asList("message")); verify(message).appendChild(any(Node.class)); verify(document).createElement("li"); verify(document).createElement("ul"); } }
@Override public LayoutInstance build(LayoutTemplate layoutTemplate, LayoutGeneratorDriver driver) { HTMLElement container = driver.createContainer(); container.setId(CONTAINER_ID); container.getClassList().add("uf-perspective-container"); container.getClassList().add("uf-perspective-rendered-container"); applyCssToElement(layoutTemplate.getLayoutProperties(), container); LayoutInstance layoutInstance = new LayoutInstance(container); List<LayoutRow> rows = layoutTemplate.getRows(); generateRows(layoutTemplate, layoutInstance, driver, rows, container); return layoutInstance; }
@Before public void setupMocks() { when(basicTab.getClassList()).thenReturn(basicTabClassList); when(basicPane.getClassList()).thenReturn(basicPaneClassList); when(advancedTab.getClassList()).thenReturn(advancedTabClassList); when(advancedPane.getClassList()).thenReturn(advancedPaneClassList); when(inlineNotification.getElement()).thenReturn(inlineNotificationElement); when(inlineNotificationElement.getClassList()).thenReturn(inlineNotificationClassList); when(jobRetriesInput.getElement()).thenReturn(numberInput); }
protected void generateComponents(LayoutTemplate layoutTemplate, final LayoutInstance layoutInstance, final LayoutGeneratorDriver driver, final LayoutColumn layoutColumn, final HTMLElement column) { for (final LayoutComponent layoutComponent : layoutColumn.getLayoutComponents()) { final IsWidget componentWidget = driver.createComponent(column, layoutComponent); if (componentWidget != null) { if (layoutTemplate.isPageStyle() && layoutColumn.getHeight().isEmpty()) { componentWidget.asWidget().getElement().addClassName("uf-perspective-col"); } else if (!layoutColumn.getHeight().isEmpty()) { column.getClassList().add("uf-perspective-row-" + layoutColumn.getHeight()); } DOMUtil.appendWidgetToElement(column, componentWidget); applyCssToElement(layoutComponent.getProperties(), componentWidget); } } }
protected void generateComponents(LayoutTemplate layoutTemplate, final LayoutInstance layoutInstance, final LayoutGeneratorDriver driver, final LayoutColumn layoutColumn, final HTMLElement column) { for (final LayoutComponent layoutComponent : layoutColumn.getLayoutComponents()) { final IsWidget componentWidget = driver.createComponent(column, layoutComponent); if (componentWidget != null) { if (layoutTemplate.isPageStyle() && layoutColumn.getHeight().isEmpty()) { componentWidget.asWidget().getElement().addClassName("uf-perspective-col"); } else if (!layoutColumn.getHeight().isEmpty()) { column.getClassList().add("uf-perspective-row-" + layoutColumn.getHeight()); } DOMUtil.appendWidgetToElement(column, componentWidget); applyCssToElement(layoutComponent.getProperties(), componentWidget); } } }