private void initFields() { when(labelField.getWidget()).thenReturn(mock(Label.class)); when(labelField.isRequired()).thenReturn(true); when(labelField.isContentValid()).thenReturn(true); when(textBoxField.getWidget()).thenReturn(mock(TextBox.class)); when(textBoxField.isRequired()).thenReturn(true); when(textBoxField.isContentValid()).thenReturn(true); when(valueLabelField.getWidget()).thenReturn(mock(ValueLabel.class)); when(valueLabelField.isRequired()).thenReturn(true); when(valueLabelField.isContentValid()).thenReturn(true); fieldCollection = Arrays.asList(labelField, textBoxField, valueLabelField); }
public PermissionEditor( ProjectAccess projectAccess, boolean readOnly, AccessSection section, LabelTypes labelTypes) { this.readOnly = readOnly; this.section = section; this.projectName = projectAccess.getProjectName(); this.groupInfo = projectAccess.getGroupInfo(); this.labelTypes = labelTypes; PermissionNameRenderer nameRenderer = new PermissionNameRenderer(projectAccess.getCapabilities()); normalName = new ValueLabel<>(nameRenderer); deletedName = new ValueLabel<>(nameRenderer); initWidget(uiBinder.createAndBindUi(this)); groupToAdd.setProject(projectName); rules = ListEditor.of(new RuleEditorSource()); exclusiveGroup.setEnabled(!readOnly); exclusiveGroup.setVisible(RefConfigSection.isValid(section.getName())); if (readOnly) { addContainer.removeFromParent(); addContainer = null; deletePermission.removeFromParent(); deletePermission = null; } }