private static boolean isSameTitle(final Block block, SInstance currentInstance) { return getSingleBlockLabel(block, currentInstance).equalsIgnoreCase(block.getName()); }
private IModel<String> newBlockLabelModel(Block block, WicketBuildContext ctx) { String label; if (isNotBlank(block.getName())) label = block.getName(); else { SInstance parent = ctx.getCurrentInstance(); label = block.getSingleType(parent) .map(it -> it.asAtr().getLabel()) .orElse(null); } return Model.of(label); }
@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(); }
private static boolean isBlockHandlesTitleFromChild(WicketBuildContext ctx, Block block) { SInstance currentInstance = ctx.getCurrentInstance(); if (block.isSingleType() && currentInstance instanceof ICompositeInstance) { final boolean blockTitleBlank = isBlank(block.getName()); final boolean singleTypeTitleBlank = isSingleTypeTitleBlank(block, (ICompositeInstance) currentInstance); final boolean sameTitle = isSameTitle(block, currentInstance); return blockTitleBlank ^ singleTypeTitleBlank ^ sameTitle; } return false; }
private TemplatePanel buildPortletTitle(Block block) { final String name = "name"; final String titleMarkup = "" + " <div class='caption'> " + " <span wicket:id='" + name + "' " + " class='caption-subject' /> " + " </div> "; final TemplatePanel portletTitle = new TemplatePanel(TITLE_ID, titleMarkup); final Label titleLabel = new Label(name, Model.of(block.getName())); portletTitle.setVisible(StringUtils.isNotEmpty(block.getName())); portletTitle.add(titleLabel); titleLabel.add(new ClassAttributeModifier() { @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; } }); return portletTitle; }
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));