public BlockBuilder add(String...typeNames) { for (String typeName : typeNames) { block.getTypes().add(typeName); } return this; }
public boolean isSingleType() { return this.getTypes().size() == 1; } }
public BlockBuilder add(String...typeNames) { for (String typeName : typeNames) { block.getTypes().add(typeName); } return this; }
@Override protected Set<String> update(Set<String> oldClasses) { if (block.getTypes().size() == 1) { final SIComposite sic = ctx.getCurrentInstance(); final SInstance firstChild = sic.getField(block.getTypes().get(0)); return RequiredBehaviorUtil.updateRequiredClasses(oldClasses, firstChild); } return oldClasses; } });
public Optional<SInstance> getSingleType(SInstance baseInstance) { if ((baseInstance instanceof SIComposite) && isSingleType()) { return Optional.of(((SIComposite) baseInstance).getField(this.getTypes().get(0))); } return Optional.empty(); }
@Override protected Set<String> update(Set<String> oldClasses) { if (block.getTypes().size() == 1) { final SIComposite sic = ctx.getCurrentInstance(); final SInstance firstChild = sic.getField(block.getTypes().get(0)); if (firstChild.isRequired()) { oldClasses.add("singular-form-required"); } else { oldClasses.remove("singular-form-required"); } } return oldClasses; } });
@SuppressWarnings("unchecked") private Stream<DocBlock> toStypeToBlockStream(SType<?> sType, LinkedHashSet<SType<?>> excludedTypes) { SView view = getViewFor(sType); if (view instanceof SViewByBlock) { SViewByBlock byBlock = (SViewByBlock) view; List<DocBlock> docBlockList = new ArrayList<>(); for (Block b : byBlock.getBlocks()) { List<SType<?>> list = retrieveSTypeListFromRelativeTypeName(sType, b.getTypes()); list.removeAll(excludedTypes); docBlockList.add(new DocBlock(b.getName(), list, false)); } return docBlockList.stream(); } return Stream.empty(); }
@SuppressWarnings("unchecked") private Stream<DocBlock> toStypeToBlockStream(SType<?> sType, LinkedHashSet<SType<?>> excludedTypes) { SView view = getViewFor(sType); if (view instanceof SViewByBlock) { SViewByBlock byBlock = (SViewByBlock) view; List<DocBlock> docBlockList = new ArrayList<>(); for (Block b : byBlock.getBlocks()) { List<SType<?>> list = retrieveSTypeListFromRelativeTypeName(sType, b.getTypes()); list.removeAll(excludedTypes); docBlockList.add(new DocBlock(b.getName(), list, false)); } return docBlockList.stream(); } return Stream.empty(); }
@SuppressWarnings("unchecked") private Stream<DocBlock> toStypeToBlockStream(SType<?> sType, LinkedHashSet<SType<?>> excludedTypes) { SView view = getViewFor(sType); if (view instanceof SViewByBlock) { SViewByBlock byBlock = (SViewByBlock) view; List<DocBlock> docBlockList = new ArrayList<>(); for (Block b : byBlock.getBlocks()) { List<SType<?>> list = retrieveSTypeListFromRelativeTypeName(sType, b.getTypes()); list.removeAll(excludedTypes); docBlockList.add(new DocBlock(b.getName(), list, false)); } return docBlockList.stream(); } return Stream.empty(); }
} else if (block.getTypes().size() == 1) { blockTitle = instance.getField(block.getTypes().get(0)).asAtr().getLabel(); if (block.getTypes().size() == 1) { hideTitle = true; DocumentCanvas subcanvas = canvas.addChild(); for (String type : block.getTypes()) { SInstance f = instance.getField(type); FlatViewGenerator flatViewGenerator = f.getAspect(FlatViewGenerator.ASPECT_FLAT_VIEW_GENERATOR).orElse(null);
private void appendBlock(BSGrid grid, Block block, PortletPanel portlet) { final BSGrid newGrid = portlet.getNewGrid(); BSRow row = newGrid.newRow(); grid.appendTag("div", portlet); for (String typeName : block.getTypes()) { row = buildBlockAndGetCurrentRow(getInstanceType().getField(typeName), newGrid, row, block); } }
private void appendBlock(BSGrid grid, Block block, PortletPanel portlet) { final BSGrid newGrid = portlet.getNewGrid(); BSRow row = newGrid.newRow(); grid.appendTag("div", portlet); for (String typeName : block.getTypes()) { row = buildBlockAndGetCurrentRow(getInstanceType().getField(typeName), newGrid, row); } }
if (StringUtils.isEmpty(block.getName()) && block.getTypes().size() == 1 && ctx.getCurrentInstance() instanceof SIComposite) { final SIComposite sic = ctx.getCurrentInstance(); final SInstance firstChild = sic.getField(block.getTypes().get(0)); block.setName(firstChild.asAtr().getLabel()); ctx.setTitleInBlock(true); addedTypes.addAll(block.getTypes()); appendBlock(grid, block, portlet);
final Block block = blocks.get(i); final PortletPanel portlet = new PortletPanel("_portlet" + i, block, ctx, (BlocksCompositeMapper) mapper); addedTypes.addAll(block.getTypes()); appendBlock(targetGrid, block, portlet);
private boolean isAnyChildrenVisible() { SInstance instance = ctx.getCurrentInstance(); if ((instance instanceof SIComposite) && instance.asAtr().exists() && instance.asAtr().isVisible()) { for (String typeName : block.getTypes()) { SInstance field = instance.getField(typeName); if (field.asAtr().exists() && field.asAtr().isVisible()) { return true; } } } return false; }
private boolean isAnyChildrenVisible() { SInstance instance = ctx.getCurrentInstance(); if ((instance instanceof SIComposite) && instance.asAtr().exists() && instance.asAtr().isVisible()) { for (String typeName : block.getTypes()) { SInstance field = ((SIComposite) instance).getField(typeName); if (field.asAtr().exists() && field.asAtr().isVisible()) { return true; } } } return false; }