Skip to content

Commit

Permalink
Use Wicket Bootstrap - Fix example project
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcGiffing committed Nov 11, 2024
1 parent 9bdc438 commit 1297e35
Show file tree
Hide file tree
Showing 54 changed files with 1,065 additions and 815 deletions.
3 changes: 2 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

Current release version:

* 4.0.x - http://wicket.apache.org/[Wicket 10.x] with Spring Boot 3.2.x - Branch master
* 4.1.x - http://wicket.apache.org/[Wicket 10.2] with Spring Boot 3.3.4 - Branch master
* 4.0.x - http://wicket.apache.org/[Wicket 10.0] with Spring Boot 3.2.x - Branch master
NOTE: http://search.maven.org/#search|ga|1|com.giffing.wicket.spring.boot

Expand Down
29 changes: 24 additions & 5 deletions wicket-spring-boot-starter-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<maven.deploy.skip>true</maven.deploy.skip>
<maven-processor-plugin.version>5.1-jdk8</maven-processor-plugin.version>
<maven.javadoc.skip>true</maven.javadoc.skip>
<wicket-bootstrap.version>7.0.8</wicket-bootstrap.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -49,6 +50,29 @@
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-annotation</artifactId>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-core</artifactId>
<version>${wicket-bootstrap.version}</version>
</dependency>

<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-extensions</artifactId>
<version>${wicket-bootstrap.version}</version>
</dependency>

<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-sass</artifactId>
<version>${wicket-bootstrap.version}</version>
</dependency>

<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-themes</artifactId>
<version>${wicket-bootstrap.version}</version>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-htmlcompressor</artifactId>
Expand Down Expand Up @@ -81,11 +105,6 @@
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-serializer-fast2</artifactId>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>5.3.3</version>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>jquery-selectors</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class Customer implements Domain<Long>, Serializable {

private String username;

private String password;

private String firstname;

private String lastname;
Expand All @@ -35,14 +33,6 @@ public void setId(Long id) {
this.id = id;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getUsername() {
return username;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.giffing.wicket.spring.boot.example.web.assets.base;

import org.apache.wicket.request.resource.CssResourceReference;

public class FixBootstrapStylesCssResourceReference extends CssResourceReference {

public static final FixBootstrapStylesCssResourceReference INSTANCE = new FixBootstrapStylesCssResourceReference();

public FixBootstrapStylesCssResourceReference() {
super(FixBootstrapStylesCssResourceReference.class, "fix.css");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.navbar {
--bs-navbar-padding-x: 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void onClick(AjaxRequestTarget target) {
};
add(link);
WebMarkupContainer webMarkupContainer = new WebMarkupContainer("icon-type");
webMarkupContainer.add(new AttributeAppender("class", "glyphicon glyphicon-" + iconType.getCssName()));
webMarkupContainer.add(new AttributeAppender("class", iconType.getCssName()));
link.add(webMarkupContainer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ActionItemLink extends AbstrractActionItem {
public ActionItemLink(IModel<String> label, IconType iconType, AbstractLink link) {
add(link);
WebMarkupContainer webMarkupContainer = new WebMarkupContainer("icon-type");
webMarkupContainer.add(new AttributeAppender("class", "glyphicon glyphicon-" + iconType.getCssName()));
webMarkupContainer.add(new AttributeAppender("class", "fa-solid fa-" + iconType.getCssName()));
link.add(webMarkupContainer);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.giffing.wicket.spring.boot.example.web.general.action.panel.items.yesno;

import com.giffing.wicket.spring.boot.example.web.pages.BasePage;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.panel.EmptyPanel;
import org.apache.wicket.model.IModel;

import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.AbstractActionItemLink;
import com.giffing.wicket.spring.boot.example.web.general.icons.IconType;
import com.giffing.wicket.spring.boot.example.web.html.modal.YesNoModal;
import com.giffing.wicket.spring.boot.example.web.pages.BasePage;

public abstract class YesNoLink<T> extends AbstractActionItemLink<T>{

Expand All @@ -21,11 +22,12 @@ public void onClick(AjaxRequestTarget target) {
@Override
protected void yesClicked(AjaxRequestTarget target) {
YesNoLink.this.yesClicked(target);
this.close(target);
close(target);
((BasePage)getPage()).replaceDefaultModal( new EmptyPanel("defaultModal"), target);
}
};
((BasePage)getPage()).replaceDefaultModal(yesNoModal);
yesNoModal.open(target);
((BasePage)getPage()).replaceDefaultModal(yesNoModal, target);
yesNoModal.appendShowDialogJavaScript(target);
}

protected abstract void yesClicked(AjaxRequestTarget target);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.giffing.wicket.spring.boot.example.web.general.icons;

import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesome6IconType;

public enum IconType {
CREATE("plus"),
EDIT("edit"),
DELETE("remove");
CREATE(FontAwesome6IconType.plus_s.cssClassName()),
EDIT(FontAwesome6IconType.pen_s.cssClassName()),
DELETE(FontAwesome6IconType.minus_s.cssClassName());

private String cssType;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void afterRender(Component component) {
} else {
error = "Your input is invalid.";
}
fc.getResponse().write("*<span id=\"helpBlock2\" class=\"help-block\">"+error+"</span>");
fc.getResponse().write("*<span class=\"invalid-feedback\">"+error+"</span>");
super.afterRender(component);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.giffing.wicket.spring.boot.example.web.html.form;

import org.apache.wicket.markup.html.form.Form;
import de.agilecoders.wicket.core.markup.html.bootstrap.form.BootstrapForm;
import org.apache.wicket.model.IModel;
import org.apache.wicket.util.visit.IVisitor;

public class ValidationForm<T> extends Form<T>{
public class ValidationForm<T> extends BootstrapForm<T> {

private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,18 @@

import com.giffing.wicket.spring.boot.example.web.html.border.behavior.ValidationMsgBehavior;

public class ValidationFormVisitor<T, R> implements IVisitor<Component, R>, IClusterable {
public class ValidationFormVisitor<R> implements IVisitor<Component, R>, IClusterable {

private static final long serialVersionUID = 1L;

Set<FormComponent> visited = new HashSet<>();

@Override
public void component(Component c, IVisit<R> visit) {
if (!visited.contains(c)) {
if(c instanceof FormComponent){
FormComponent fc = (FormComponent) c;
if(c instanceof FormComponent fc && !visited.contains(c)) {
c.add(new ValidationMsgBehavior());
// c.add(new PropertyValidator<>());
visited.add(fc);
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>TextContentModal</title>
</head>
<body>
<wicket:extend>
<div wicket:id="content"></div>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
package com.giffing.wicket.spring.boot.example.web.html.modal;

import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalDialog;

public abstract class YesNoModal extends ModalDialog {

public YesNoModal(String id) {
super(id);
YesNoPanel yesNoPanel = new YesNoPanel(CONTENT_ID){

@Override
protected void yesClicked(AjaxRequestTarget target) {
YesNoModal.this.yesClicked(target);
}

@Override
protected void noClicked(AjaxRequestTarget target) {
YesNoModal.this.noClicked(target);
}
};
setContent(yesNoPanel);
}

protected void noClicked(AjaxRequestTarget target) {
close(target);
}

protected abstract void yesClicked(AjaxRequestTarget target);
import org.apache.wicket.markup.html.panel.Panel;

public abstract class YesNoModal extends Modal<Panel> {

public YesNoModal(String id) {
super(id);
YesNoPanel yesNoPanel = new YesNoPanel("content") {

@Override
protected void yesClicked(AjaxRequestTarget target) {
YesNoModal.this.yesClicked(target);
}

@Override
protected void noClicked(AjaxRequestTarget target) {
YesNoModal.this.noClicked(target);
}

};
add(yesNoPanel);
}

protected void noClicked(AjaxRequestTarget target) {
close(target);
}

protected abstract void yesClicked(AjaxRequestTarget target);

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>TextContentModal</title>
</head>
<body>
<wicket:panel>
<label>Are you sure?</label>
<a wicket:id="yes">yes</a>
<a wicket:id="no">no</a>
<hr>
<a wicket:id="yes" class="btn btn-primary">yes</a>
<a wicket:id="no" class="btn">no</a>
</wicket:panel>
</body>
</html>
Loading

0 comments on commit 1297e35

Please sign in to comment.