protected void clearEditGrid() { Collection<Component> components = new ArrayList<>(editGridContainer.getComponents()); for (Component component : components) editGridContainer.remove(component); permissionControls.clear(); }
protected void enableAllCheckBoxes(boolean b) { if (canSelectAllCheckboxGenerateEvents) { for (Component box : attributesBoxScroll.getComponents()) ((CheckBox) box).setValue(b); } }
public void clearAttributes() { for (Component c : attributesBoxScroll.getComponents()) if (!c.getId().equals(SELECT_ALL_CHECK_BOX)) attributesBoxScroll.remove(c); }
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 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); }
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); }
@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(); } }