From 0723ada3b8e08771f2b29377d45fb66b05cdfb88 Mon Sep 17 00:00:00 2001 From: nmandrescu <17854915+nmandrescu@users.noreply.github.com> Date: Tue, 24 May 2022 12:37:06 +0300 Subject: [PATCH] Fixes #443 --- .../wicket/components/ComponentUtil.java | 77 ------------------- .../components/form/BootstrapAddButton.java | 2 +- .../form/BootstrapCancelButton.java | 2 +- .../form/BootstrapDeleteButton.java | 2 +- .../form/BootstrapSubmitButton.java | 2 +- .../form/FileInputBootstrapFormComponent.java | 2 +- ...ileInputBootstrapFormComponentWrapper.java | 2 +- .../SummernoteBootstrapFormComponent.java | 2 +- .../wicket/page/edit/AbstractEditPage.java | 2 +- 9 files changed, 8 insertions(+), 85 deletions(-) delete mode 100644 forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/ComponentUtil.java diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/ComponentUtil.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/ComponentUtil.java deleted file mode 100644 index dba2069e..00000000 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/ComponentUtil.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) 2015 Development Gateway, Inc and others. - *

- * All rights reserved. This program and the accompanying materials - * are made available under the terms of the MIT License (MIT) - * which accompanies this distribution, and is available at - * https://opensource.org/licenses/MIT - *

- * Contributors: - * Development Gateway - initial API and implementation - */ -/** - * - */ -package org.devgateway.toolkit.forms.wicket.components; - -import org.apache.wicket.Component; -import org.apache.wicket.MarkupContainer; -import org.apache.wicket.event.IEvent; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.FormComponent; -import org.apache.wicket.request.cycle.RequestCycle; -import org.devgateway.toolkit.forms.WebConstants; -import org.devgateway.toolkit.forms.wicket.components.form.GenericBootstrapFormComponent; -import org.devgateway.toolkit.forms.wicket.events.EditingDisabledEvent; -import org.devgateway.toolkit.forms.wicket.events.EditingEnabledEvent; - -/** - * @author mpostelnicu - * - */ -public final class ComponentUtil { - - private ComponentUtil() { - - } - - /** - * Trivial method to set the child {@link GenericBootstrapFormComponent} - * required when added to the parent {@link WebMarkupContainer} - * - * @param requiredFlag - * the {@link FormComponent#setRequired(boolean)} - * @param parent - * @param child - * - * @return the parent - */ - public static MarkupContainer addRequiredFlagBootstrapFormComponent(final boolean requiredFlag, - final WebMarkupContainer parent, - final GenericBootstrapFormComponent child) { - return parent.add(requiredFlag ? child.required() : child); - } - - /** - * Returns true if the {@link WebConstants#PARAM_VIEW_MODE} is used as a - * parameter - * - * @return - */ - public static boolean isViewMode() { - return RequestCycle.get().getRequest().getRequestParameters().getParameterValue(WebConstants.PARAM_VIEW_MODE) - .toBoolean(false); - } - - public static void enableDisableEvent(final Component c, final IEvent event) { - if (event.getPayload() instanceof EditingDisabledEvent) { - c.setEnabled(false); - } - - if (event.getPayload() instanceof EditingEnabledEvent) { - c.setEnabled(true); - } - - } - -} diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapAddButton.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapAddButton.java index 9aedca94..bb5d2bc0 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapAddButton.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapAddButton.java @@ -21,7 +21,7 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.IEvent; import org.apache.wicket.model.IModel; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; /** * @author mpostelnicu diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapCancelButton.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapCancelButton.java index a4a4b669..4cd49987 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapCancelButton.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapCancelButton.java @@ -19,7 +19,7 @@ import de.agilecoders.wicket.extensions.markup.html.bootstrap.spinner.SpinnerAjaxButton; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.model.IModel; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; /** * @author mpostelnicu diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapDeleteButton.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapDeleteButton.java index 77884f3c..dfdc94de 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapDeleteButton.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapDeleteButton.java @@ -24,7 +24,7 @@ import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.OnEventHeaderItem; import org.apache.wicket.model.IModel; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; import org.devgateway.toolkit.forms.wicket.events.EditingDisabledEvent; /** diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapSubmitButton.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapSubmitButton.java index 4737b07f..bd52c926 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapSubmitButton.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/BootstrapSubmitButton.java @@ -21,7 +21,7 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.model.IModel; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; /** * @author mpostelnicu diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponent.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponent.java index 954dc58d..9f176aea 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponent.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponent.java @@ -15,7 +15,7 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.IEvent; import org.apache.wicket.model.IModel; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; import org.devgateway.toolkit.persistence.dao.FileMetadata; import org.devgateway.toolkit.persistence.dao.GenericPersistable; diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponentWrapper.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponentWrapper.java index 52e8c7e8..2c39ee68 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponentWrapper.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/FileInputBootstrapFormComponentWrapper.java @@ -46,7 +46,7 @@ import org.apache.wicket.util.resource.AbstractResourceStreamWriter; import org.devgateway.toolkit.forms.security.SecurityConstants; import org.devgateway.toolkit.forms.util.FileTypeUtil; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; import org.devgateway.toolkit.forms.wicket.components.util.CustomDownloadLink; import org.devgateway.toolkit.forms.wicket.events.EditingDisabledEvent; import org.devgateway.toolkit.forms.wicket.events.EditingEnabledEvent; diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/SummernoteBootstrapFormComponent.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/SummernoteBootstrapFormComponent.java index 0900e1c0..e6cd5bc8 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/SummernoteBootstrapFormComponent.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/components/form/SummernoteBootstrapFormComponent.java @@ -31,7 +31,7 @@ import org.apache.wicket.validation.ValidationError; import org.apache.wicket.validation.validator.StringValidator; import org.devgateway.toolkit.forms.WebConstants; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; /** * @author mpostelnicu diff --git a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/edit/AbstractEditPage.java b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/edit/AbstractEditPage.java index b8899e8a..61762b2f 100644 --- a/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/edit/AbstractEditPage.java +++ b/forms/src/main/java/org/devgateway/toolkit/forms/wicket/page/edit/AbstractEditPage.java @@ -35,12 +35,12 @@ import org.devgateway.toolkit.forms.exceptions.NullJpaServiceException; import org.devgateway.toolkit.forms.exceptions.NullListPageClassException; import org.devgateway.toolkit.forms.util.MarkupCacheService; -import org.devgateway.toolkit.forms.wicket.components.ComponentUtil; import org.devgateway.toolkit.forms.wicket.components.form.BootstrapCancelButton; import org.devgateway.toolkit.forms.wicket.components.form.BootstrapDeleteButton; import org.devgateway.toolkit.forms.wicket.components.form.BootstrapSubmitButton; import org.devgateway.toolkit.forms.wicket.components.form.GenericBootstrapFormComponent; import org.devgateway.toolkit.forms.wicket.components.form.visitors.GenericBootstrapValidationVisitor; +import org.devgateway.toolkit.forms.wicket.components.util.ComponentUtil; import org.devgateway.toolkit.forms.wicket.page.BasePage; import org.devgateway.toolkit.persistence.dao.GenericPersistable; import org.devgateway.toolkit.persistence.service.AdminSettingsService;