private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio) { return group.equals(radio.getGroup()) && !clientId.equals(radio.getClientId(context)); }
public void processValidators(FacesContext context) { final String group = getGroup();
public void processValidators(FacesContext context) { final String group = getGroup();
private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio) { return group.equals(radio.getGroup()) && !clientId.equals(radio.getClientId(context)); }
public void processValidators(FacesContext context) { final String group = getGroup();
private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio) { return group.equals(radio.getGroup()) && !clientId.equals(radio.getClientId(context)); }
public void processValidators(FacesContext context) { final String group = getGroup();
private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio) { return group.equals(radio.getGroup()) && !clientId.equals(radio.getClientId(context)); }
public void processValidators(FacesContext context) { final String group = getGroup();
private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio) { return group.equals(radio.getGroup()) && !clientId.equals(radio.getClientId(context)); }
public void processValidators(FacesContext context) { final String group = getGroup();
private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio) { return group.equals(radio.getGroup()) && !clientId.equals(radio.getClientId(context)); }
private static boolean isOtherMemberOfSameGroup(FacesContext context, String group, String clientId, UISelectOne radio) { return group.equals(radio.getGroup()) && !clientId.equals(radio.getClientId(context)); }
@Override public VisitResult visit(VisitContext visitContext, UIComponent target) { if (target instanceof UISelectOne && ((UISelectOne) target).getGroup().equals(group)) { UISelectOne radio = (UISelectOne) target; // if target is an instance of UISelectOne then get all the UISelectItem children // and verify if the submitted value exists for (Iterator<UIComponent> iter = radio.getChildren().iterator(); iter.hasNext(); ) { UIComponent component = iter.next(); if (component instanceof UISelectItem) { UISelectItem item = (UISelectItem) component; if (item.getItemValue().equals(submittedValue)) { selectItemValueFound = true; return VisitResult.COMPLETE; } } } return VisitResult.REJECT; } return VisitResult.ACCEPT; } });
protected static Group getGroup(FacesContext context, UISelectOne radio) { String groupName = radio.getGroup(); if (groupName == null) { return null; } UIComponent groupContainer = RenderKitUtils.getForm(radio, context); if (groupContainer == null) { groupContainer = context.getViewRoot(); } String clientName = groupContainer.getClientId(context) + UINamingContainer.getSeparatorChar(context) + groupName; Map<String, Group> radioButtonGroups = RequestStateManager.get(context, RequestStateManager.PROCESSED_RADIO_BUTTON_GROUPS); if (radioButtonGroups == null) { radioButtonGroups = new HashMap<>(); RequestStateManager.set(context, RequestStateManager.PROCESSED_RADIO_BUTTON_GROUPS, radioButtonGroups); } Group group = radioButtonGroups.get(clientName); if (group == null) { group = new Group(context, clientName); radioButtonGroups.put(clientName, group); } return group; }
protected static Group getGroup(FacesContext context, UISelectOne radio) { String groupName = radio.getGroup(); if (groupName == null) { return null; } UIComponent groupContainer = RenderKitUtils.getForm(radio, context); if (groupContainer == null) { groupContainer = context.getViewRoot(); } String clientName = groupContainer.getClientId(context) + UINamingContainer.getSeparatorChar(context) + groupName; Map<String, Group> radioButtonGroups = RequestStateManager.get(context, RequestStateManager.PROCESSED_RADIO_BUTTON_GROUPS); if (radioButtonGroups == null) { radioButtonGroups = new HashMap<>(); RequestStateManager.set(context, RequestStateManager.PROCESSED_RADIO_BUTTON_GROUPS, radioButtonGroups); } Group group = radioButtonGroups.get(clientName); if (group == null) { group = new Group(context, clientName); radioButtonGroups.put(clientName, group); } return group; }
protected static Group getGroup(FacesContext context, UISelectOne radio) { String groupName = radio.getGroup(); if (groupName == null) { return null; } UIComponent groupContainer = RenderKitUtils.getForm(radio, context); if (groupContainer == null) { groupContainer = context.getViewRoot(); } String clientName = groupContainer.getClientId(context) + UINamingContainer.getSeparatorChar(context) + groupName; Map<String, Group> radioButtonGroups = RequestStateManager.get(context, RequestStateManager.PROCESSED_RADIO_BUTTON_GROUPS); if (radioButtonGroups == null) { radioButtonGroups = new HashMap<>(); RequestStateManager.set(context, RequestStateManager.PROCESSED_RADIO_BUTTON_GROUPS, radioButtonGroups); } Group group = radioButtonGroups.get(clientName); if (group == null) { group = new Group(context, clientName); radioButtonGroups.put(clientName, group); } return group; }
@SuppressWarnings("unchecked") private SelectItem getSelectItem() { if (selectItem == null) { FacesContext context = getFacesContext(); UISelectOne radio = (UISelectOne) getParent(); List<String> groupClientIds = (List<String>) radio.getAttributes().get(GroupSelectItem.class.getName()); UIComponent firstRadioOfGroup = context.getViewRoot().findComponent(groupClientIds.get(0)); SelectItemsIterator<SelectItem> iterator = RenderKitUtils.getSelectItems(context, firstRadioOfGroup); int index = groupClientIds.indexOf(radio.getClientId(context)); while (index-- > 0 && iterator.hasNext()) { iterator.next(); } if (!iterator.hasNext()) { throw new IllegalStateException(MessageFormat.format( "UISelectOne component id=\"{0}\" group=\"{1}\" has no UISelectItem", new Object[] { radio.getId(), radio.getGroup() })); } selectItem = iterator.next(); } return selectItem; }
@SuppressWarnings("unchecked") private SelectItem getSelectItem() { if (selectItem == null) { FacesContext context = getFacesContext(); UISelectOne radio = (UISelectOne) getParent(); List<String> groupClientIds = (List<String>) radio.getAttributes().get(GroupSelectItem.class.getName()); UIComponent firstRadioOfGroup = context.getViewRoot().findComponent(groupClientIds.get(0)); SelectItemsIterator<SelectItem> iterator = RenderKitUtils.getSelectItems(context, firstRadioOfGroup); int index = groupClientIds.indexOf(radio.getClientId(context)); while (index-- > 0 && iterator.hasNext()) { iterator.next(); } if (!iterator.hasNext()) { throw new IllegalStateException(MessageFormat.format( "UISelectOne component id=\"{0}\" group=\"{1}\" has no UISelectItem", new Object[] { radio.getId(), radio.getGroup() })); } selectItem = iterator.next(); } return selectItem; }
@SuppressWarnings("unchecked") private SelectItem getSelectItem() { if (selectItem == null) { FacesContext context = getFacesContext(); UISelectOne radio = (UISelectOne) getParent(); List<String> groupClientIds = (List<String>) radio.getAttributes().get(GroupSelectItem.class.getName()); UIComponent firstRadioOfGroup = context.getViewRoot().findComponent(groupClientIds.get(0)); SelectItemsIterator<SelectItem> iterator = RenderKitUtils.getSelectItems(context, firstRadioOfGroup); int index = groupClientIds.indexOf(radio.getClientId(context)); while (index-- > 0 && iterator.hasNext()) { iterator.next(); } if (!iterator.hasNext()) { throw new IllegalStateException(MessageFormat.format( "UISelectOne component id=\"{0}\" group=\"{1}\" has no UISelectItem", new Object[] { radio.getId(), radio.getGroup() })); } selectItem = iterator.next(); } return selectItem; }