Skip to content

Commit

Permalink
ISIS-3240: enforce text rendering (backed by label) when panel is
Browse files Browse the repository at this point in the history
textual
  • Loading branch information
andi-huber committed Oct 10, 2022
1 parent a44d53f commit 33de85d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public abstract class ScalarPanelAbstract
public enum FormatModifier {
MARKUP,
MULTILINE,
BADGE,
TEXT_ONLY,
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ protected UiString obtainOutputFormat() {
getPlaceholderRenderService()
.asHtml(PlaceholderLiteral.NULL_REPRESENTATION));
}
val useText = isUsingTextarea()
|| getFormatModifiers().contains(FormatModifier.BADGE);
return useText
return isUsingTextarea()
|| getFormatModifiers().contains(FormatModifier.TEXT_ONLY)
? UiString.text(proposedValue.getValueAsTitle().getValue())
: UiString.markup(proposedValue.getValueAsHtml().getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.isis.viewer.wicket.ui.components.scalars;

import java.util.EnumSet;

import org.apache.wicket.util.convert.IConverter;

import org.apache.isis.core.metamodel.commons.ScalarRepresentation;
Expand All @@ -41,6 +43,12 @@ protected ScalarPanelTextFieldTextualAbstract(
super(id, scalarModel, String.class);
}

@Override
protected void setupFormatModifiers(final EnumSet<FormatModifier> modifiers) {
// enforce use of text representation
modifiers.add(FormatModifier.TEXT_ONLY);
}

@Override
protected final IConverter<String> getConverter(
final @NonNull ObjectFeature propOrParam,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public ScalarTitleBadgePanel(final String id, final ScalarModel scalarModel, fin

@Override
protected void setupFormatModifiers(final EnumSet<FormatModifier> modifiers) {
modifiers.add(FormatModifier.BADGE);
// enforce use of text representation, as the HTML template fragments already have badge specific markup
modifiers.add(FormatModifier.TEXT_ONLY);
}

@Override
Expand Down

0 comments on commit 33de85d

Please sign in to comment.