protected void show(Component... components) { for (Component component : components) { component.setVisible(true); } }
protected void hide(Component... components) { for (Component component : components) { component.setVisible(false); } }
protected void initComponentsVisibility(DateIntervalValue.Type type) { componentsVisibilityMap.values().forEach(component -> component.setVisible(false)); componentsVisibilityMap.get(type).forEach(component -> component.setVisible(true)); }
protected void hideComponent(AbstractFrame parentFrame, String componentId) { Component component = parentFrame.getComponent(componentId); if (component != null) component.setVisible(false); }
protected void setCopyButtonVisible() { Component copyBtn = buttonsHbox.getComponent("copy"); if (copyBtn != null) { copyBtn.setVisible(true); } }
@Override public void setVisible(Boolean visible) { if (component != null) { checkNotNullArgument(visible, "Unable to reset visible flag for the bound FieldConfig"); component.setVisible(visible); } else { this.targetVisible = visible; } }
@Override public void setSelectHandler(Consumer lookupHandler) { this.lookupHandler = lookupHandler; if (lookupHandler != null) { getComponentNN("lookupWindowActions").setVisible(true); } } }
protected void hideComponent(AbstractFrame parentFrame, String componentId) { Component component = parentFrame.getComponent(componentId); if (component != null) component.setVisible(false); }
@Override public void setVisible(boolean visible) { boolean oldValue = this.visible; if (oldValue != visible) { this.visible = visible; for (ActionOwner owner : owners) { if (owner instanceof Component) { ((Component) owner).setVisible(visible); } } firePropertyChange(PROP_VISIBLE, oldValue, visible); } }
protected void initPoweredByLink() { Component poweredByLink = getComponent("poweredByLink"); if (poweredByLink != null) { poweredByLink.setVisible(webConfig.getLoginDialogPoweredByLinkVisible()); } }
protected void initRememberMeLocalesBox() { Component rememberLocalesBox = getComponent("rememberLocalesBox"); if (rememberLocalesBox != null) { rememberLocalesBox.setVisible(rememberMeCheckBox.isVisible() || localesSelect.isVisible()); } }
protected boolean loadVisible(Component component, Element element) { if (component instanceof DatasourceComponent && ((DatasourceComponent) component).getDatasource() != null) { DatasourceComponent wiredComponent = (DatasourceComponent) component; MetaClass metaClass = wiredComponent.getDatasource().getMetaClass(); MetaPropertyPath propertyPath = wiredComponent.getMetaPropertyPath(); if (propertyPath != null && !getSecurity().isEntityAttrReadPermitted(metaClass, propertyPath.toString())) { component.setVisible(false); return false; } } String visible = element.attributeValue("visible"); if (StringUtils.isNotEmpty(visible)) { boolean visibleValue = Boolean.parseBoolean(visible); component.setVisible(visibleValue); return visibleValue; } return true; }
protected void applyComponentPermission(Window window, String screenId, Integer permissionValue, String targetComponentId) { Component component = window.getComponent(targetComponentId); if (component != null) { if (permissionValue == UiPermissionValue.HIDE.getValue()) { component.setVisible(false); } else if (permissionValue == UiPermissionValue.READ_ONLY.getValue()) { if (component instanceof Component.Editable) { ((Component.Editable) component).setEditable(false); } else { component.setEnabled(false); } } } else { log.info(String.format("Couldn't find component %s in window %s", targetComponentId, screenId)); } }
@Override public void setSelectHandler(Consumer<Collection<T>> selectHandler) { this.selectHandler = selectHandler; Component lookupActionsLayout = getLookupActionsLayout(); if (lookupActionsLayout != null) { lookupActionsLayout.setVisible(true); Component lookupComponent = getLookupComponent(); if (lookupComponent instanceof LookupSelectionChangeNotifier) { LookupSelectionChangeNotifier selectionNotifier = (LookupSelectionChangeNotifier) lookupComponent; Action commitAction = getWindow().getAction(LOOKUP_SELECT_ACTION_ID); if (commitAction != null) { //noinspection unchecked selectionNotifier.addLookupValueChangeListener(valueChangeEvent -> commitAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty())); commitAction.setEnabled(!selectionNotifier.getLookupSelectedItems().isEmpty()); } } } }
@Override public void init(Map<String, Object> params) { super.init(params); diffTable.setStyleProvider(new DiffStyleProvider()); diffTable.setIconProvider(new DiffIconProvider()); diffDs.addItemChangeListener(e -> { boolean valuesVisible = (e.getItem() != null) && (e.getItem().hasStateValues()); boolean stateVisible = (e.getItem() != null) && (e.getItem().hasStateValues() && e.getItem().itemStateVisible()); valuesHeader.setVisible(stateVisible || valuesVisible); itemStateField.setVisible(stateVisible); diffValuesField.setVisible(valuesVisible); if (e.getItem() != null) { EntityPropertyDiff.ItemState itemState = e.getItem().getItemState(); if (itemState != EntityPropertyDiff.ItemState.Normal) { String messageCode = "ItemState." + itemState.toString(); itemStateLabel.setValue(getMessage(messageCode)); itemStateLabel.setVisible(true); } else { itemStateField.setVisible(false); } } }); }
if (component != null) { if (permissionValue == UiPermissionValue.HIDE) { component.setVisible(false); } else if (permissionValue == UiPermissionValue.READ_ONLY && this.component instanceof Editable) {
protected void initLocales() { localesSelect.setOptionsMap(globalConfig.getAvailableLocales()); localesSelect.setValue(app.getLocale()); boolean localeSelectVisible = globalConfig.getLocaleSelectVisible(); localesSelect.setVisible(localeSelectVisible); // if old layout is used Component localesSelectLabel = getComponent("localesSelectLabel"); if (localesSelectLabel != null) { localesSelectLabel.setVisible(localeSelectVisible); } localesSelect.addValueChangeListener(e -> { Locale selectedLocale = (Locale) e.getValue(); app.setLocale(selectedLocale); authInfoThreadLocal.set(new AuthInfo(loginField.getValue(), passwordField.getValue(), rememberMeCheckBox.getValue())); try { app.createTopLevelWindow(); } finally { authInfoThreadLocal.set(null); } }); }
component.setVisible(security.isEntityAttrReadPermitted(entityValueSource.getEntityMetaClass(), propertyPath.toString())); component.setVisible(false);
continue; component.setVisible(false);
fieldComponent.setVisible(fci.getTargetVisible());