/** Se aplica somene se o tipo for da classe {@link STypeList} */ @Override public boolean isApplicableFor(SType<?> type) { return type.isList(); } }
/** Se aplica somene se o tipo for da classe {@link STypeList} */ @Override public boolean isApplicableFor(SType<?> type) { return type.isList(); } }
private HTMLComponentType resolveSelectionType(SType<?> s) { if (s.isList()) { SView view = ViewResolver.resolveView(s); if (view instanceof SMultiSelectionByCheckboxView) { return HTMLComponentType.CHECKBOX; } else if (view instanceof SMultiSelectionByPicklistView) { return HTMLComponentType.PICK_LIST; } else { return HTMLComponentType.MULTI_SELECT; } } else { return HTMLComponentType.SELECT; } }
private HTMLComponentType resolveSelectionType(SType<?> s) { if (s.isList()) { SView view = ViewResolver.resolveView(s); if (view instanceof SMultiSelectionByCheckboxView) { return HTMLComponentType.CHECKBOX; } else if (view instanceof SMultiSelectionByPicklistView) { return HTMLComponentType.PICK_LIST; } else { return HTMLComponentType.MULTI_SELECT; } } else { return HTMLComponentType.SELECT; } }
private HTMLComponentType resolveSelectionType(SType<?> s) { if (s.isList()) { SView view = ViewResolver.resolveView(s); if (view instanceof SMultiSelectionByCheckboxView) { return HTMLComponentType.CHECKBOX; } else if (view instanceof SMultiSelectionByPicklistView) { return HTMLComponentType.PICK_LIST; } else { return HTMLComponentType.MULTI_SELECT; } } else { return HTMLComponentType.SELECT; } }
/** * Reads the attribute maxOccurs of the element tag and configures the SType with its maximum size * @param element The element tag * @param newType The SType that is represented by the element tag */ private static void readXsdOwnAttributeMaxOccurs(ElementReader element, SType<?> newType) { String value = element.getAttr("maxOccurs"); if (value != null && !"unbounded".equalsIgnoreCase(value)) { int maxOccurs = Integer.parseInt(value); if (newType.isList()) { ((STypeList<?, ?>) newType).withMaximumSizeOf(maxOccurs); } } }
public static boolean isListWithTableBound(SType<?> type) { return type.isList() && tableOpt(((STypeList<?, ?>) type).getElementsType()).isPresent(); }
private static void readXsdOwnAttributeMinOccurs(ElementReader element, SType<?> newType) { Integer minOccurs = element.getAttrInteger("minOccurs"); if (minOccurs == null || minOccurs.intValue() == 1) { newType.asAtr().required(); if (newType.isList()) { ((STypeList) newType).withMiniumSizeOf(1); } } else if (minOccurs.intValue() > 1) { if (newType.isList()) { ((STypeList) newType).withMiniumSizeOf(minOccurs); } else { throw new SingularFormException(element.errorMsgInvalidAttribute("minOccurs")); } } }
@Override protected void extendSubReference() { if (getSuperType().isList()) { E type = (E) ((STypeList) getSuperType()).elementsType; if (type != null) { setElementsType(type); } } }
/** * Checks if the SType is a list or a composite and calls the right method to include the complex element on XSD * @param sType The SType that will be inserted on the XSD * @param element The parent element */ private static void toXsdFromSType(SType<?> sType, MElement element) { if (sType.isList()) { toXsdFromList((STypeList<?, ?>) sType, element); } else if (sType.isComposite()) { toXsdFromComposite((STypeComposite<?>) sType, element); } }
@Override protected void extendSubReference() { if (getSuperType().isList()) { E type = (E) ((STypeList) getSuperType()).elementsType; if (type != null) { setElementsType(type); } } }
private static void readXsdOwnAttributeMinOccurs(ElementReader element, SType<?> newType) { Integer minOccurs = element.getAttrInteger("minOccurs"); if (minOccurs == null || minOccurs == 1) { newType.asAtr().required(); if (newType.isList()) { ((STypeList) newType).withMiniumSizeOf(1); } } else if (minOccurs.intValue() > 1) { if (newType.isList()) { ((STypeList) newType).withMiniumSizeOf(minOccurs); } else { throw new SingularFormException(element.errorMsgInvalidAttribute("minOccurs"), newType); } } }
protected void addInitialNumberOfLines(SType<?> currentType, SIList<?> list, ISupplier<? extends AbstractSViewListWithControls<?>> viewSupplier) { final AbstractSViewListWithControls<?> view = viewSupplier.get(); if (currentType.isList() && list.isEmpty()) { for (int i = 0; i < view.getInitialNumberOfLines(); i++) { list.addNew(); } } }
@SuppressWarnings("unchecked") private static void realMapToSInstance(Map<Integer, Map<String, Object>> pojoReferenceDataMap, Object pojoDataMap, SInstance rootInstance, boolean strictMode) { SType<?> type = rootInstance.getType(); if (type.isComposite()) { mapToSIComposite(pojoReferenceDataMap, (Map<String, Object>) pojoDataMap, (SIComposite) rootInstance, strictMode); } else if (type.isList()) { mapToSIList(pojoReferenceDataMap, (Map<String, Object>) pojoDataMap, (SIList<SInstance>) rootInstance, strictMode, type); } else { rootInstance.setValue(((Map<String, Object>) pojoDataMap).get(type.getNameSimple())); } }
private boolean isInsideChildrenTypes(SType<?> type, String typeName) { if (type.getNameSimple().equals(typeName)) { return true; } else if (type.isComposite()) { for (SType<?> children : ((STypeComposite<?>) type).getFields()) { if (isInsideChildrenTypes(children, typeName)) { return true; } } } else if (type.isList()) { return isInsideChildrenTypes(((STypeList<?, ?>) type).getElementsType(), typeName); } return false; }
private boolean isInsideChildrenTypes(SType<?> type, String typeName) { if (type.getNameSimple().equals(typeName)) { return true; } else if (type.isComposite()) { for (SType<?> children : ((STypeComposite<?>) type).getFields()) { if (isInsideChildrenTypes(children, typeName)) { return true; } } } else if (type.isList()) { return isInsideChildrenTypes(((STypeList<?, ?>) type).getElementsType(), typeName); } return false; }
@Override protected void doWriteOnCanvas(DocumentCanvas canvas, FlatViewContext context) { SIList<?> instance = context.getInstanceAs(SIList.class); SType<?> elementsType = instance.getElementsType(); if (elementsType.isComposite() || elementsType.isList()) { doWriteCompositeOrListOnCanvas(canvas, context, instance, elementsType); } else { doWriteSimpleOnCanvas(canvas, context, instance); } }
/** * Verifica se o tipo e seu tipos internos (se existirem) extendem corretamente o tipo pai. Faz uma analise * recursiva para os subtipos. */ public AssertionsSType isExtensionCorrect() { SType<?> superType = getTarget().getSuperType(); if (! (getTarget().isComposite() || getTarget().isList())) { throw new AssertionError(errorMsg("O tipo deve ser um composite")); } return isExtensionCorrect(superType); }
protected void addMinimumSize(SType<?> currentType, SIList<?> list) { if (currentType.isList() && list.isEmpty()) { final STypeList<?, ?> tl = (STypeList<?, ?>) currentType; if (tl.getMinimumSize() != null) { for (int i = 0; i < tl.getMinimumSize(); i++) { list.addNew(); } } else if (tl.isRequired()) { list.addNew(); } } }
private Boolean isChildWithSessionBreaker(SInstance a) { return (a.asAtrBootstrap().getColPreference(12) == 12 && a.getType().isComposite() && a.asAtr().getLabel() != null) || a.getType().isList(); } }