@Override public DefaultComponentConfigurator visible(boolean visible) { component.setVisible(visible); return this; }
/** * Sets the component visibility value. * <p> * When a component is set as invisible, all the updates of the component from the server to the client are blocked * until the component is set as visible again. * <p> * Invisible components don't receive any updates from the client-side. Unlike the server-side updates, client-side * updates, if any, are discarded while the component is invisible, and are not transmitted to the server when the * component is made visible. * @param visible the component visibility value */ default void setVisible(boolean visible) { getComponent().setVisible(visible); }
/** * Constructor * @param label Status component (not null) * @param hideWhenValid <code>true</code> to hide the component when the validation status is not invalid */ public LabelValidationStatusHandler(L label, boolean hideWhenValid) { super(); ObjectUtils.argumentNotNull(label, "Status label must be not null"); this.label = label; this.hideWhenValid = hideWhenValid; // check hidden if (hideWhenValid) { label.setVisible(false); } }
private void updateBadgeCaption(HasText hasText) { if (hasText != null) { int unread = getUnreadNotifications(); String value; if (unread < 1) { value = String.valueOf(0); } else if (unread < 10) { value = String.valueOf(unread); } else { value = "9+"; } hasText.setText(value); if (hasText instanceof Component) { ((Component) hasText).setVisible(unread > 0); } } }
private void updateBadgeCaption(HasText hasText) { if (hasText != null) { hasText.setText(String.valueOf(getCount())); if (hasText instanceof Component) { ((Component) hasText).setVisible(getCount() > 0); } } }
@Override public void validationStatusChange(ValidationStatusEvent<S> statusChangeEvent) { label.setText(statusChangeEvent.getErrorMessage()); if (hideWhenValid) { // Only show the label when validation has failed label.setVisible(statusChangeEvent.isInvalid()); } }