public void removeFieldScreenItems(String fieldId) { // The field is being removed from the system (likely to be custom field :)) // Remove references to this field from every field screen for (FieldScreen fieldScreen : getFieldScreens()) { if (fieldScreen.containsField(fieldId)) { fieldScreen.removeFieldScreenLayoutItem(fieldId); } } }
/** * Removes field from given tab * * @param screenId id of screen * @param tabId id of tab * @return no content * * @response.representation.201.doc * Successfully removed field from tab * * @response.representation.401.doc * Returned if you do not have permissions * * @response.representation.400.doc * Returned if screen or tab does not exist */ @DELETE @WebSudoRequired @Path ("{screenId}/tabs/{tabId}/fields/{id}") public Response removeField(@PathParam ("screenId") Long screenId, @PathParam ("tabId") Long tabId, @PathParam ("id") String id) { administerPermissionCheck(); final FieldScreenTab tab = getTabById(getFieldScreen(screenId), tabId); if (tab.getFieldScreenLayoutItem(id) == null) { throwWebException(i18n.getText("admin.screens.error.field.doesnt.exist", id)); } tab.getFieldScreen().removeFieldScreenLayoutItem(id); return Response.status(Response.Status.NO_CONTENT).cacheControl(never()).build(); }
public ServiceOutcomeImpl<List<Long>> removeFromScreenTabs(final ApplicationUser user, final Long customFieldId, final List<Long> tabIds) { Preconditions.checkArgument(customFieldId != null, "customFieldId can not be null."); Preconditions.checkArgument(tabIds != null && !tabIds.isEmpty(), "List of tabs can not be null or empty."); final ErrorCollection errorCollection = new SimpleErrorCollection(); final I18nHelper i18nBean = i18nFactory.getInstance(user); if (user == null || !permissionManager.hasPermission(Permissions.ADMINISTER, user)) { errorCollection.addErrorMessage(i18nBean.getText("admin.customfields.service.no.admin.permission")); return new ServiceOutcomeImpl<List<Long>>(errorCollection, Collections.EMPTY_LIST); } for (final Long screenId : tabIds) { final FieldScreenTab fieldScreenTab = fieldScreenManager.getFieldScreenTab(screenId); fieldScreenTab.getFieldScreen().removeFieldScreenLayoutItem("customfield_" + customFieldId); } return new ServiceOutcomeImpl<List<Long>>(errorCollection, getListOfCurrentTabs(customFieldId)); }
fieldScreenTab.getFieldScreen().removeFieldScreenLayoutItem(getFieldId());