@Override public void init(Map<String, Object> params) { Map<String, Locale> map = globalConfig.getAvailableLocales(); for (Map.Entry<String, Locale> entry : map.entrySet()) { localesScrollBox.add(createLocaleListComponent(entry.getValue(), entry.getKey())); } }
protected void clearEditGrid() { Collection<Component> components = new ArrayList<>(editGridContainer.getComponents()); for (Component component : components) editGridContainer.remove(component); permissionControls.clear(); }
protected void checkAllCheckboxes() { CheckBox selectAllCheckBox = (CheckBox) attributesBoxScroll.getOwnComponent(SELECT_ALL_CHECK_BOX); if (selectAllCheckBox != null) { for (Component c : attributesBoxScroll.getComponents()) { if (!c.equals(selectAllCheckBox)) { CheckBox checkBox = (CheckBox) c; if (!checkBox.getValue()) { setSelectAllCheckBox(false); return; } } } if (attributesBoxScroll.getComponents().size() != 1) setSelectAllCheckBox(true); } }
protected void addValueToLayout(final Object value, String str) { BoxLayout itemLayout = uiComponents.create(HBoxLayout.class); itemLayout.setId("itemLayout"); itemLayout.setSpacing(true); Label<String> itemLab = uiComponents.create(Label.NAME); if (options instanceof MapOptions) { //noinspection unchecked Map<String, Object> optionsMap = ((MapOptions) options).getItemsCollection(); str = optionsMap.entrySet() .stream() .filter(entry -> Objects.equals(entry.getValue(), value)) .findFirst() .get().getKey(); } itemLab.setValue(str); itemLayout.add(itemLab); itemLab.setAlignment(Alignment.MIDDLE_LEFT); LinkButton delItemBtn = uiComponents.create(LinkButton.class); delItemBtn.setIcon("icons/item-remove.png"); delItemBtn.addClickListener(e -> { valuesMap.remove(value); valuesLayout.remove(itemLayout); }); itemLayout.add(delItemBtn); if (BooleanUtils.isFalse(editable)) { delItemBtn.setEnabled(false); } valuesLayout.add(itemLayout); valuesMap.put(value, str); }
if (scrollBox.getOrientation() == ScrollBoxLayout.Orientation.HORIZONTAL) { for (Component component : scrollBox.getOwnComponents()) { if (component.getWidth() > 0 && component.getWidthSizeUnit() == SizeUnit.PERCENTAGE) { if (tips == null) { for (Component component : scrollBox.getOwnComponents()) { if (component.getHeight() > 0 && component.getHeightSizeUnit() == SizeUnit.PERCENTAGE) { if (tips == null) {
protected void enableAllCheckBoxes(boolean b) { if (canSelectAllCheckboxGenerateEvents) { for (Component box : attributesBoxScroll.getComponents()) ((CheckBox) box).setValue(b); } }
protected void enableControls() { loggedEntityTable.setEnabled(false); entityNameField.setEditable(false); autoCheckBox.setEditable(true); manualCheckBox.setEditable(true); for (Component c : attributesBoxScroll.getComponents()) ((CheckBox) c).setEditable(true); actionsPaneLayout.setVisible(true); }
@Override public void init(Map<String, Object> params) { screenFrame = openWindow(screenId, WindowManager.OpenType.DIALOG, widgetRepository.getWidgetParams(widget)); screenFrame.close(Window.CLOSE_ACTION_ID, true); screenFrame.setSizeFull(); scroll.add(screenFrame.getFrame()); } }
public void clearAttributes() { for (Component c : attributesBoxScroll.getComponents()) if (!c.getId().equals(SELECT_ALL_CHECK_BOX)) attributesBoxScroll.remove(c); }
protected void disableControls() { entityNameField.setEditable(false); loggedEntityTable.setEnabled(true); autoCheckBox.setEditable(false); manualCheckBox.setEditable(false); for (Component c : attributesBoxScroll.getComponents()) ((CheckBox) c).setEditable(false); actionsPaneLayout.setVisible(false); }
protected void initNoSearchTerm() { setCaption(getMessage("caption")); Label<String> label = componentsFactory.createComponent(Label.class); label.setValue(getMessage("noSearchTerm")); label.setStyleName("h2"); contentBox.add(label); }
@Override public void actionPerform(Component component) { LoggedEntity selectedEntity = loggedEntityTable.getSelected().iterator().next(); Set<LoggedAttribute> enabledAttributes = selectedEntity.getAttributes(); for (Component c : attributesBoxScroll.getComponents()) { CheckBox currentCheckBox = (CheckBox) c; if (currentCheckBox.getId().equals(SELECT_ALL_CHECK_BOX)) continue; Boolean currentCheckBoxValue = currentCheckBox.getValue(); if (currentCheckBoxValue && !isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //add attribute if checked and not exist in table LoggedAttribute newLoggedAttribute = metadata.create(LoggedAttribute.class); newLoggedAttribute.setName(currentCheckBox.getId()); newLoggedAttribute.setEntity(selectedEntity); loggedAttrDs.addItem(newLoggedAttribute); } if (!currentCheckBoxValue && isEntityHaveAttribute(currentCheckBox.getId(), enabledAttributes)) { //remove attribute if unchecked and exist in table LoggedAttribute removeAtr = getLoggedAttribute(currentCheckBox.getId(), enabledAttributes); if (removeAtr != null) loggedAttrDs.removeItem(removeAtr); } } getDsContext().commit(); loggedEntityDs.refresh(); disableControls(); loggedEntityTable.setEnabled(true); loggedEntityTable.focus(); logService.invalidateCache(); } }
protected void addAttribute(Set<LoggedAttribute> enabledAttributes, String name, boolean editable) { CheckBox checkBox = factory.createComponent(CheckBox.class); if (enabledAttributes != null && isEntityHaveAttribute(name, enabledAttributes)) { checkBox.setValue(true); } checkBox.setId(name); checkBox.setCaption(name); checkBox.setEditable(editable); checkBox.addValueChangeListener(e -> checkAllCheckboxes()); attributesBoxScroll.add(checkBox); }
@Override public void init(Map<String, Object> params) { super.init(params); if (exception != null) { Label<String> traceLabel = uiComponents.create(Label.NAME); traceLabel.setValue(getExceptionMessage(exception)); com.vaadin.ui.Label vaadinLbl = traceLabel.unwrap(com.vaadin.ui.Label.class); vaadinLbl.setContentMode(ContentMode.PREFORMATTED); resultLabel.setValue(getMessage("operationResult.exception")); resultContainer.add(traceLabel); } else if (result != null) { Label<String> valueHolder = uiComponents.create(Label.NAME); valueHolder.setValue(AttributeHelper.convertToString(result)); com.vaadin.ui.Label vaadinLbl = valueHolder.unwrap(com.vaadin.ui.Label.class); vaadinLbl.setContentMode(ContentMode.PREFORMATTED); resultLabel.setValue(getMessage("operationResult.result")); resultContainer.add(valueHolder); } else { resultLabel.setValue(getMessage("operationResult.void")); } }
@Override public void init(Map<String, Object> params) { lookupFrame = openWindow(lookupWindowId, WindowManager.OpenType.DIALOG, widgetRepository.getWidgetParams(widget)); for (ListComponent c : findListComponents(lookupFrame)) { c.getDatasource().addItemChangeListener(e -> events.publish(new ItemsSelectedEvent(widget, c.getSelected()))); } lookupFrame.close(Window.CLOSE_ACTION_ID, true); lookupFrame.setSizeFull(); scroll.add(lookupFrame.getFrame()); }
protected void compileEditPane(MultiplePermissionTarget item) { GridLayout editGrid = uiComponents.create(GridLayout.class); editGrid.setFrame(frame); editGrid.setId("editGrid"); editGrid.setWidth("100%"); editGrid.setColumns(4); editGrid.setMargin(true); editGrid.setColumnExpandRatio(0, 1f); editGrid.setColumnExpandRatio(1, 0); editGrid.setColumnExpandRatio(2, 0); editGrid.setColumnExpandRatio(3, 0); editGrid.setRows(item.getPermissions().size() + 2); compileDefaultControls(editGrid); initPermissionControls(item, editGrid); editGridContainer.add(editGrid); applyPermissions(hasPermissionsToModifyPermission); }