Subject: Re: Boolean property wicket display


Thanks for the input!  I took the approach of expanding the super class and
associated interface.  I took a short step to start, which was to eliminate
the redundant "yes" and "no" to the checkbox display [2].  I copied the
code that was on that link to override the onChange() method of the
CheckBoxX.  This works perfectly, unless you change the value again before
clicking the Submit button.  In this case, it displays another inline edit
form on top of the existing one.

In trying to tamp this down, I looked for a property to query that would
suppress this behavior.   Since first line of the code in question [1] sets
scalarModel to edit mode, I looked at scalarModel.isEditMode().  This
property seems to never be unset.  It seems to stay in edit mode even after
submitting the value.

Is this a bug?  I'd have to use a custom version of PropertyEditForm to put
this back in.

To make this exactly one-click, I will look deeper into what
PropertyEditForm is doing in onUpdate and bring it up to this new class.

Thanks,
Brian
[1]
```
@Override
protected void onChange(Boolean value, AjaxRequestTarget target) {
scalarModel.toEditMode();

switchFormForInlinePrompt(target);

getComponentForRegular().setVisible(false);
scalarIfRegularInlinePromptForm.setVisible(true);

target.add(scalarTypeContainer);
}
```

[2] BooleanPanel.java:
```
public  class BooleanPanel extends PanelAbstract<ScalarModel> implements
BooleanModelSubscriber  {

    private static final long serialVersionUID = 1L;

    protected static final String ID_SCALAR_TYPE_CONTAINER =
"scalarTypeContainer";

    protected static final String ID_SCALAR_IF_COMPACT = "scalarIfCompact";
    protected static final String ID_SCALAR_IF_REGULAR = "scalarIfRegular";
    protected static final String ID_SCALAR_NAME = "scalarName";
    protected static final String ID_SCALAR_VALUE = "scalarValue";

    /**
     * as per {@link #inlinePromptLink}
     */
    protected static final String ID_SCALAR_VALUE_INLINE_PROMPT_LINK =
"scalarValueInlinePromptLink";
    protected static final String ID_SCALAR_VALUE_INLINE_PROMPT_LABEL =
"scalarValueInlinePromptLabel";

    /**
     * as per {@link #scalarIfRegularInlinePromptForm}.
     */
    public static final String ID_SCALAR_IF_REGULAR_INLINE_PROMPT_FORM =
"scalarIfRegularInlinePromptForm";
    private static final String ID_EDIT_PROPERTY = "editProperty";
    private static final String ID_FEEDBACK = "feedback";
    private static final String ID_ASSOCIATED_ACTION_LINKS_BELOW =
"associatedActionLinksBelow";
    private static final String ID_ASSOCIATED_ACTION_LINKS_RIGHT =
"associatedActionLinksRight";

    public static class InlinePromptConfigLocal {
        private final boolean supported;
        private final Component componentToHideIfAny;

        public static InlinePromptConfigLocal supported() {
            return new InlinePromptConfigLocal(true, null);
        }

        public static InlinePromptConfigLocal notSupported() {
            return new InlinePromptConfigLocal(false, null);
        }

        public static InlinePromptConfigLocal supportedAndHide(final
Component componentToHideIfAny) {
            return new InlinePromptConfigLocal(true, componentToHideIfAny);
        }

        private InlinePromptConfigLocal(final boolean supported, final
Component componentToHideIfAny) {
            this.supported = supported;
            this.componentToHideIfAny = componentToHideIfAny;
        }

        boolean isSupported() {
            return supported;
        }

        Component getComponentToHideIfAny() {
            return componentToHideIfAny;
        }
    }

    // ///////////////////////////////////////////////////////////////////

    protected final ScalarModel scalarModel;

    private Component scalarIfCompact;
    private MarkupContainer scalarIfRegular;

    private WebMarkupContainer scalarTypeContainer;

    /**
     * Populated
     * Used by most subclasses ({@link BooleanPanel}, {@link
ReferencePanel}, {@link ValueChoicesSelect2Panel}) but not all ({@link
IsisBlobOrClobPanelAbstract}, {@link BooleanPanel})
     */
    private WebMarkupContainer scalarIfRegularInlinePromptForm;

    WebMarkupContainer inlinePromptLink;

    private CheckBoxX checkBox;

    public BooleanPanel(final String id, final ScalarModel scalarModel) {
        super(id, scalarModel);
        this.scalarModel = scalarModel;
    }
    protected MarkupContainer createComponentForRegular() {
        final String name = getModel().getName();

        checkBox = createCheckBox(ID_SCALAR_VALUE,
CheckBoxXConfig.Sizes.lg);

        checkBox.setLabel(Model.of(name));

        final FormGroup scalarIfRegularFormGroup = new
FormGroup(ID_SCALAR_IF_REGULAR, checkBox);
        scalarIfRegularFormGroup.add(checkBox);
        if(getModel().isRequired() && getModel().isEnabled()) {
            scalarIfRegularFormGroup.add(new CssClassAppender("mandatory"));
        }

        final String labelCaption =
getRenderingLocal().getLabelCaption(checkBox);
        final Label scalarName = createScalarName(ID_SCALAR_NAME,
labelCaption);

        scalarIfRegularFormGroup.add(scalarName);

        final String describedAs = getModel().getDescribedAs();
        if(describedAs != null) {
            scalarIfRegularFormGroup.add(new AttributeModifier("title",
Model.of(describedAs)));
        }
        return scalarIfRegularFormGroup;
    }
    protected Component getScalarValueComponent() {
        return checkBox;
    }
    /**
     * Mandatory hook method to build the component to render the model
when in
     * {@link RenderingLocal#COMPACT compact} format.
     */
    protected Component createComponentForCompact() {
        return createCheckBox(ID_SCALAR_IF_COMPACT, CheckBoxXConfig.Sizes.sm
);
    }
    protected InlinePromptConfigLocal getInlinePromptConfigLocal() {
        return InlinePromptConfigLocal.supportedAndHide(
                scalarModel.getMode() == EntityModel.Mode.EDIT ||
scalarModel.hasActionWithI