private String processPhraseBreak(SInstance mi) { PhraseBreak phraseBreak = mi.asAtr().phraseBreak(); if (phraseBreak == PhraseBreak.BREAK_LINE) { return "\n"; } else if (phraseBreak == PhraseBreak.COMMA) { return ", "; } return ""; }
protected static String getTitle(ISInstanceAwareModel<SIComposite> referenced) { final String annotationLabel = referenced.getMInstancia().asAtrAnnotation().label(); if (isNotBlank(annotationLabel)) return annotationLabel; final String referencedLabel = referenced.getMInstancia().asAtr().getLabel(); if (isNotBlank(referencedLabel)) return String.format("Comentários sobre %s", referencedLabel); return "Comentários"; }
@Override protected void doWriteOnCanvas(DocumentCanvas canvas, FlatViewContext context) { SInstance instance = context.getInstance(); canvas.addFormItem(new FormItem(instance.asAtr().getLabel(), format(instance), instance.asAtrBootstrap().getColPreference())); }
private static String getEditActionTitle(SInstance instance) { String label = instance.asAtr().getLabel(); if (label != null) { return "Comentários sobre " + label; } else { return "Comentário"; } }
private Boolean isChildWithSessionBreaker(SInstance a) { return (a.asAtrBootstrap().getColPreference(12) == 12 && a.getType().isComposite() && a.asAtr().getLabel() != null) || a.getType().isList(); } }
public final String toStringDisplay() { return asAtr().getDisplayString(); }
@Override protected void doWriteOnCanvas(DocumentCanvas canvas, FlatViewContext context) { SInstance instance = context.getInstance(); canvas.addFormItem(new FormItem(instance.asAtr().getLabel(), instance.toStringDisplay(), instance.asAtrBootstrap().getColPreference())); }
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; }
public String getRootTypeSubtitle() { return getRootInstance().getObject().asAtr().getSubtitle(); }
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; }
private boolean isAnyChildrenVisible(String tabId) { BSTab bsTab = tabMap.get(tabId); SInstance instance = bsTab.getModelObject(); if ((instance instanceof SIComposite) && instance.asAtr().exists() && instance.asAtr().isVisible()) { for (String typeName : bsTab.getSubtree()) { SInstance field = instance.getField(typeName); if (field.asAtr().exists() && field.asAtr().isVisible()) { return true; } } } return false; }
private void invokeUpdateListeners(){ for (SType type : this.getType().getDependentTypes()){ SInstance dependentInstance = (SInstance) this.findNearest(type).orElse(null); if (dependentInstance != null && dependentInstance.asAtr().getUpdateListener() != null){ dependentInstance.asAtr().getUpdateListener().accept(this); } } }
@SuppressWarnings("unchecked") public String getLabel() { String label = instance.asAtr().getLabel(); if (label == null) { label = SFormUtil.getTypeLabel((Class<? extends SType<?>>) instance.getType().getClass()).orElse(null); } if (label == null) { label = instance.getName(); } return label; }
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); }
private void invokeUpdateListeners(){ if (!getDocument().isRestoreMode()) { for (SType<?> type : this.getType().getDependentTypes()) { SInstance dependentInstance = (SInstance) this.findNearest(type).orElse(null); if (dependentInstance != null && dependentInstance.asAtr().getUpdateListener() != null) { dependentInstance.asAtr().getUpdateListener().accept(dependentInstance); } } } }
protected static String resolveSimpleLabel(FormComponent<?> formComponent) { IModel<?> model = formComponent.getModel(); if (model instanceof ISInstanceAwareModel<?>) { SInstance instancia = ((ISInstanceAwareModel<?>) model).getMInstancia(); return instancia.asAtr().getLabel(); } return "[" + formComponent.getId() + "]"; }
protected static String resolveSimpleLabel(FormComponent<?> formComponent) { IModel<?> model = formComponent.getModel(); if (model instanceof ISInstanceAwareModel<?>) { SInstance instance = ((ISInstanceAwareModel<?>) model).getSInstance(); return instance.asAtr().getLabel(); } return "[" + formComponent.getId() + "]"; }
@Override public Iterable<SInstanceAction> getActions(ISInstanceActionCapable target, SInstance instance) { final String helpText = instance.asAtr().getHelp(); return (isBlank(helpText)) ? Collections.emptyList() : Arrays.asList(new SInstanceAction(SInstanceAction.ActionType.NORMAL) .setIcon(SIcon.resolve("question")) .setText("Ajuda") .setPosition(Integer.MIN_VALUE) .setPreview(new SInstanceAction.Preview() .setMessage(helpText))); } }
private void build(WicketBuildContext ctx) { label = new Label("label", Model.of(Optional.ofNullable(ctx.getCurrentInstance().asAtr().getLabel()).orElse(EMPTY))); htmlContent = new Label("htmlContent", new SInstanceValueModel<>(ctx.getModel())); hiddenInput = new HiddenField<>("hiddenInput", new SInstanceValueModel<>(ctx.getModel())); add(label); add(htmlContent); add(hiddenInput); buttonEditar = createButtonOpenEditor(); buttonEditar.add(configureLabelButton()); add(buttonEditar); htmlContent.setEscapeModelStrings(false); }