Skip to content

Commit

Permalink
Example project - minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcGiffing committed Nov 12, 2024
1 parent 1297e35 commit 697e685
Show file tree
Hide file tree
Showing 45 changed files with 660 additions and 925 deletions.
709 changes: 352 additions & 357 deletions wicket-spring-boot-starter-example/pom.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@EnableJpaRepositories(basePackageClasses={DefaultRepositoryService.class})
public class WicketApplication {

public static void main(String[] args) throws Exception {
public static void main(String[] args) {
new SpringApplicationBuilder()
.sources(WicketApplication.class)
.run(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
import jakarta.persistence.Id;

import com.giffing.wicket.spring.boot.example.repository.Domain;
import lombok.Getter;
import lombok.Setter;

@Entity
@Getter
@Setter
public class Customer implements Domain<Long>, Serializable {

@Id
Expand All @@ -23,49 +27,5 @@ public class Customer implements Domain<Long>, Serializable {
private String lastname;

private boolean active;

@Override
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getFirstname() {
return firstname;
}

public void setFirstname(String firstname) {
this.firstname = firstname;
}

public String getLastname() {
return lastname;
}

public void setLastname(String lastname) {
this.lastname = lastname;
}

public boolean isActive() {
return active;
}

public void setActive(boolean active) {
this.active = active;
}




}
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package com.giffing.wicket.spring.boot.example.repository.services.customer;

import java.util.List;

import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;

import com.giffing.wicket.spring.boot.example.model.Customer;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.ListCrudRepository;

public interface CustomerRepository extends CrudRepository<Customer, Long>, JpaSpecificationExecutor<Customer> {
public interface CustomerRepository extends ListCrudRepository<Customer, Long>, JpaSpecificationExecutor<Customer> {

@Override
List<Customer> findAll(Specification<Customer> specs);

int countByUsernameIgnoreCase(String username);

Customer findByUsernameIgnoreCase(String username);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.giffing.wicket.spring.boot.example.repository.services.customer.filter;

import com.giffing.wicket.spring.boot.example.repository.DefaultFilter;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class CustomerFilter extends DefaultFilter {

private Long id;
Expand All @@ -22,52 +26,4 @@ public class CustomerFilter extends DefaultFilter {

private boolean active;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getUsernameLike() {
return usernameLike;
}

public void setUsernameLike(String usernameLike) {
this.usernameLike = usernameLike;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getFirstnameLike() {
return firstnameLike;
}

public void setFirstnameLike(String firstnameLike) {
this.firstnameLike = firstnameLike;
}

public String getLastnameLike() {
return lastnameLike;
}

public void setLastnameLike(String lastnameLike) {
this.lastnameLike = lastnameLike;
}

public boolean isActive() {
return active;
}

public void setActive(boolean active) {
this.active = active;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public enum CustomerSort implements Sort {
LASTNAME("lastname"),
ACTIVE("active");

private String sortName;
private final String sortName;

CustomerSort(String sortName){
this.sortName = sortName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.giffing.wicket.spring.boot.example.repository.services.customer.specs;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.Specification;

import com.giffing.wicket.spring.boot.example.model.Customer;
import com.giffing.wicket.spring.boot.example.model.Customer_;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class CustomerSpecs {

public static Specification<Customer> hasId(final Long id) {
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 CustomStylesCssRessourceReference extends CssResourceReference {

public static final CustomStylesCssRessourceReference INSTANCE = new CustomStylesCssRessourceReference();

public CustomStylesCssRessourceReference() {
super(CustomStylesCssRessourceReference.class, "custom.css");
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.navbar {
--bs-navbar-padding-x: 1;
}

.items {
padding-right: 5px;
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<wicket:panel><span wicket:id="items"><span wicket:id="item" /></span></wicket:panel>
<wicket:panel><span wicket:id="items" class="items"><span wicket:id="item" /></span></wicket:panel>
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
package com.giffing.wicket.spring.boot.example.web.general.action.panel;

import java.util.List;

import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.AbstrractActionItem;
import de.agilecoders.wicket.core.markup.html.bootstrap.list.BootstrapListView;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;

import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.AbstrractActionItem;
import java.util.List;

public class ActionPanel extends Panel {



public ActionPanel(String id, List<AbstrractActionItem> items) {
super(id);
ListView<AbstrractActionItem> listItems = new ListView<AbstrractActionItem>("items", items) {
add(new BootstrapListView<>("items", items) {

@Override
protected void populateItem(ListItem<AbstrractActionItem> item) {
item.add(item.getModel().getObject());
}
@Override
protected void populateItem(ListItem<AbstrractActionItem> item) {
item.add(item.getModel().getObject());
}


};
add(listItems);
});
}


}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<wicket:panel>
<a wicket:id="link">
<span aria-hidden="true" wicket:id="icon-type"></span>
<span aria-hidden="true" wicket:id="icon"></span>
</a>
</wicket:panel>
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package com.giffing.wicket.spring.boot.example.web.general.action.panel.items;

import de.agilecoders.wicket.core.markup.html.bootstrap.image.Icon;
import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;

import com.giffing.wicket.spring.boot.example.web.general.icons.IconType;

public abstract class AbstractActionItemLink<T> extends AbstrractActionItem {

public AbstractActionItemLink(IModel<T> label, IconType iconType){
protected AbstractActionItemLink(IconType iconType){
AjaxLink<T> link = new AjaxLink<T>("link") {

@Override
Expand All @@ -20,9 +17,7 @@ public void onClick(AjaxRequestTarget target) {
}
};
add(link);
WebMarkupContainer webMarkupContainer = new WebMarkupContainer("icon-type");
webMarkupContainer.add(new AttributeAppender("class", iconType.getCssName()));
link.add(webMarkupContainer);
link.add( new Icon("icon", iconType));
}

public abstract void onClick(AjaxRequestTarget target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public abstract class AbstrractActionItem extends Panel {

public AbstrractActionItem() {
protected AbstrractActionItem() {
super("item");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<wicket:panel>
<a wicket:id="link">
<span aria-hidden="true" wicket:id="icon-type"></span>
<span aria-hidden="true" wicket:id="icon"></span>
</a>
</wicket:panel>
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package com.giffing.wicket.spring.boot.example.web.general.action.panel.items.links;

import de.agilecoders.wicket.core.markup.html.bootstrap.image.Icon;
import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.model.IModel;

import com.giffing.wicket.spring.boot.example.web.general.action.panel.items.AbstrractActionItem;
import com.giffing.wicket.spring.boot.example.web.general.icons.IconType;

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", "fa-solid fa-" + iconType.getCssName()));
link.add(webMarkupContainer);
link.add(new Icon("icon", iconType));
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.giffing.wicket.spring.boot.example.web.general.action.panel.items.yesno;

import com.giffing.wicket.spring.boot.example.web.pages.BasePage;
import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
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;

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

public YesNoLink(IModel<T> label, IconType iconType) {
super(label, iconType);
public YesNoLink(IconType iconType) {
super(iconType);
}

@Override
Expand Down

This file was deleted.

Loading

0 comments on commit 697e685

Please sign in to comment.