├── LICENSE ├── README.md ├── bgprocess ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── antilia │ │ │ ├── BgProcessApplication.java │ │ │ ├── BgProcessSession.java │ │ │ ├── HomePage.html │ │ │ ├── HomePage.java │ │ │ ├── panel │ │ │ ├── ActionsPanel.html │ │ │ ├── ActionsPanel.java │ │ │ ├── LaunchDummyTaskPanel.html │ │ │ ├── LaunchDummyTaskPanel.java │ │ │ ├── TaskDataProvider.java │ │ │ ├── TaskLaunchedEvent.java │ │ │ ├── TasksListPanel.html │ │ │ └── TasksListPanel.java │ │ │ ├── service │ │ │ ├── IAnswerService.java │ │ │ └── impl │ │ │ │ └── AnswerService.java │ │ │ └── task │ │ │ ├── ExecutionBridge.java │ │ │ ├── ITask.java │ │ │ ├── TasksRunnable.java │ │ │ └── dummy │ │ │ └── DummyTask.java │ ├── resources │ │ └── log4j.properties │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── logo.png │ │ └── style.css │ └── test │ ├── java │ └── com │ │ └── antilia │ │ └── Start.java │ └── resources │ └── keystore ├── client-sign-out-parent ├── client-sign-out-demo │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── antilia │ │ │ │ ├── HomePage.html │ │ │ │ ├── HomePage.java │ │ │ │ └── WicketApplication.java │ │ ├── resources │ │ │ └── log4j.properties │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ ├── logo.png │ │ │ └── style.css │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── antilia │ │ │ ├── Start.java │ │ │ └── TestHomePage.java │ │ └── resources │ │ └── keystore ├── client-sign-out │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── antilia │ │ └── signout │ │ ├── InactivitySignOutPanel.html │ │ ├── InactivitySignOutPanel.java │ │ └── InactivitySignOutPanel.js └── pom.xml ├── content-iframe ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── antilia │ │ │ ├── HomePage.html │ │ │ ├── HomePage.java │ │ │ ├── ScalaOverview.pdf │ │ │ ├── WicketApplication.java │ │ │ └── iframe │ │ │ └── DocumentInlineFrame.java │ ├── resources │ │ └── log4j.properties │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── logo.png │ │ └── style.css │ └── test │ ├── java │ └── com │ │ └── antilia │ │ ├── Iframe.java │ │ └── TestHomePage.java │ └── resources │ └── keystore ├── pom.xml ├── screenshots └── angular │ ├── angular1.png │ ├── angular2.png │ ├── angular3.png │ └── angular4.png ├── wicket-angular-parent ├── pom.xml ├── wicket-angular-demo │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.jdt.core.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ ├── com │ │ │ │ └── antilia │ │ │ │ │ └── angular │ │ │ │ │ ├── HomePage.html │ │ │ │ │ ├── HomePage.java │ │ │ │ │ ├── RandomString.java │ │ │ │ │ ├── TestPage.html │ │ │ │ │ ├── TestPage.java │ │ │ │ │ ├── WicketApplication.java │ │ │ │ │ ├── WicketApplication.properties │ │ │ │ │ └── example │ │ │ │ │ ├── IPersonService.java │ │ │ │ │ ├── Person.java │ │ │ │ │ ├── PersonDetailPanel.html │ │ │ │ │ ├── PersonDetailPanel.java │ │ │ │ │ ├── PersonsJSonifier.java │ │ │ │ │ ├── angularajax │ │ │ │ │ ├── PersonDetails.html │ │ │ │ │ ├── PersonDetails.java │ │ │ │ │ ├── PersonsAngularListView.html │ │ │ │ │ ├── PersonsAngularListView.java │ │ │ │ │ ├── StatelessMasterDetailPage.html │ │ │ │ │ └── StatelessMasterDetailPage.java │ │ │ │ │ ├── basic │ │ │ │ │ ├── BasicListViewLazyPage.html │ │ │ │ │ ├── BasicListViewLazyPage.java │ │ │ │ │ ├── BasicListViewPage.html │ │ │ │ │ ├── BasicListViewPage.java │ │ │ │ │ ├── BasicPersonListView.html │ │ │ │ │ └── BasicPersonListView.java │ │ │ │ │ ├── filtering │ │ │ │ │ ├── FilterPersonListViewPage.html │ │ │ │ │ ├── FilterPersonListViewPage.java │ │ │ │ │ ├── PersonsListView.html │ │ │ │ │ └── PersonsListView.java │ │ │ │ │ └── wicketajax │ │ │ │ │ ├── AngularListViewMountedResourcePage.html │ │ │ │ │ ├── AngularListViewMountedResourcePage.java │ │ │ │ │ ├── AngularListViewPage.html │ │ │ │ │ ├── AngularListViewPage.java │ │ │ │ │ ├── PersonsListView.html │ │ │ │ │ └── PersonsListView.java │ │ │ └── jgravatar │ │ │ │ ├── Gravatar.java │ │ │ │ ├── GravatarDefaultImage.java │ │ │ │ ├── GravatarDownloadException.java │ │ │ │ └── GravatarRating.java │ │ ├── resources │ │ │ └── log4j.properties │ │ └── webapp │ │ │ ├── WEB-INF │ │ │ └── web.xml │ │ │ ├── css │ │ │ ├── .gitignore │ │ │ ├── app.css │ │ │ ├── bootstrap-responsive.css │ │ │ ├── bootstrap-responsive.min.css │ │ │ ├── bootstrap.css │ │ │ └── bootstrap.min.css │ │ │ ├── img │ │ │ ├── .gitignore │ │ │ ├── glyphicons-halflings-white.png │ │ │ └── glyphicons-halflings.png │ │ │ ├── js │ │ │ ├── app.js │ │ │ ├── controllers.js │ │ │ ├── directives.js │ │ │ ├── filters.js │ │ │ ├── jquery.syntaxhighlighter.min.js │ │ │ └── services.js │ │ │ ├── lib │ │ │ └── angular │ │ │ │ ├── angular-cookies.js │ │ │ │ ├── angular-cookies.min.js │ │ │ │ ├── angular-loader.js │ │ │ │ ├── angular-loader.min.js │ │ │ │ ├── angular-resource.js │ │ │ │ ├── angular-resource.min.js │ │ │ │ ├── angular-sanitize.js │ │ │ │ ├── angular-sanitize.min.js │ │ │ │ ├── angular.js │ │ │ │ ├── angular.min.js │ │ │ │ └── version.txt │ │ │ ├── logo.png │ │ │ └── style.css │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── antilia │ │ │ ├── Angular.java │ │ │ └── Bla.java │ │ └── resources │ │ └── keystore └── wicket-angular │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── antilia │ │ │ └── angular │ │ │ └── repeater │ │ │ ├── AngularListView.html │ │ │ ├── AngularListView.java │ │ │ ├── AngularPaginatedView.html │ │ │ ├── AngularPaginatedView.java │ │ │ ├── AngularPanel.java │ │ │ ├── AngularWebMarkupContainer.java │ │ │ ├── EventBroadcasterHandler.java │ │ │ ├── IAngularRequestHandler.java │ │ │ ├── IJSONifier.java │ │ │ ├── JsonAngularListViewResourceReference.java │ │ │ ├── OnUpdateEventHandler.java │ │ │ ├── angularListView.js │ │ │ ├── angularPanel.js │ │ │ └── updatedetails.js │ ├── resources │ │ └── log4j.properties │ └── webapp │ │ └── WEB-INF │ │ └── web.xml │ └── test │ └── resources │ └── keystore ├── wicket-ember ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── antilia │ │ │ └── ember │ │ │ ├── HomePage.html │ │ │ ├── HomePage.java │ │ │ └── WicketApplication.java │ ├── resources │ │ └── log4j.properties │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── logo.png │ │ ├── part1 │ │ ├── README.txt │ │ ├── css │ │ │ ├── bootstrap.css │ │ │ └── style.css │ │ ├── glyphicons.png │ │ ├── index.html │ │ └── js │ │ │ ├── app.js │ │ │ ├── controllers │ │ │ └── application.js │ │ │ ├── libs │ │ │ ├── bootstrap.js │ │ │ ├── ember-1.0.0-pre.2.js │ │ │ ├── ember-1.0.0-pre.2.min.js │ │ │ ├── handlebars-1.0.0.beta.6.js │ │ │ └── jquery-1.7.2.min.js │ │ │ ├── models │ │ │ ├── actor.js │ │ │ └── movie.js │ │ │ ├── router.js │ │ │ └── views │ │ │ └── application.js │ │ ├── part2 │ │ ├── README.txt │ │ ├── css │ │ │ ├── bootstrap.css │ │ │ └── style.css │ │ ├── img │ │ │ └── glyphicons-halflings.png │ │ ├── index.html │ │ ├── js │ │ │ ├── app.js │ │ │ ├── controllers │ │ │ │ └── application.js │ │ │ ├── helpers.js │ │ │ ├── libs │ │ │ │ ├── bootstrap.js │ │ │ │ ├── ember-1.0.0-pre.2.js │ │ │ │ ├── ember-1.0.0-pre.2.min.js │ │ │ │ ├── handlebars-1.0.0.beta.6.js │ │ │ │ └── jquery-1.7.2.min.js │ │ │ ├── models │ │ │ │ ├── actor.js │ │ │ │ └── movie.js │ │ │ ├── router.js │ │ │ └── views │ │ │ │ └── application.js │ │ └── snippets │ │ │ └── executableCodeSnippets.js │ │ └── style.css │ └── test │ ├── java │ └── com │ │ └── antilia │ │ └── ember │ │ ├── Start.java │ │ └── TestHomePage.java │ └── resources │ └── keystore ├── wicket-replace-with-effect ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── antilia │ │ │ └── replacewitheffect │ │ │ └── ReplaceWithEffectBehavior.java │ ├── resources │ │ └── log4j.properties │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── logo.png │ │ └── style.css │ └── test │ ├── java │ └── com │ │ └── antilia │ │ └── replacewitheffect │ │ ├── HomePage.html │ │ ├── HomePage.java │ │ ├── Start.java │ │ ├── TestHomePage.java │ │ └── WicketApplication.java │ └── resources │ └── keystore └── wicket-sparelinks ├── .gitignore ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── antilia │ │ ├── HomePage.html │ │ ├── HomePage.java │ │ ├── LinksPanel.html │ │ ├── LinksPanel.java │ │ ├── Person.java │ │ ├── PersonDataProvider.java │ │ ├── WicketApplication.java │ │ └── smartlinks │ │ ├── ISmartLink.java │ │ ├── ISmartLinkContext.java │ │ ├── SmartLink.java │ │ ├── SmartLinkDataTable.java │ │ ├── SmartLinksBehavior.java │ │ └── smartLinksBehavior.js ├── resources │ └── log4j.properties └── webapp │ ├── WEB-INF │ └── web.xml │ ├── logo.png │ └── style.css └── test ├── java └── com │ └── antilia │ ├── Start.java │ └── TestHomePage.java └── resources └── keystore /LICENSE: -------------------------------------------------------------------------------- 1 | Licensed to the Apache Software Foundation (ASF) under one 2 | or more contributor license agreements. See the NOTICE file 3 | distributed with this work for additional information 4 | regarding copyright ownership. The ASF licenses this file 5 | to you under the Apache License, Version 2.0 (the 6 | "License"); you may not use this file except in compliance 7 | with the License. You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, 12 | software distributed under the License is distributed on an 13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | KIND, either express or implied. See the License for the 15 | specific language governing permissions and limitations 16 | under the License. 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | antilia-bits 2 | ============ 3 | 4 | Small contributions to Wicket -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/BgProcessApplication.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import java.util.concurrent.ExecutorService; 4 | import java.util.concurrent.LinkedBlockingQueue; 5 | import java.util.concurrent.ThreadPoolExecutor; 6 | import java.util.concurrent.TimeUnit; 7 | 8 | import org.apache.wicket.Session; 9 | import org.apache.wicket.guice.GuiceComponentInjector; 10 | import org.apache.wicket.markup.html.WebPage; 11 | import org.apache.wicket.protocol.http.WebApplication; 12 | import org.apache.wicket.request.Request; 13 | import org.apache.wicket.request.Response; 14 | 15 | import com.antilia.service.IAnswerService; 16 | import com.antilia.service.impl.AnswerService; 17 | import com.antilia.task.ExecutionBridge; 18 | import com.antilia.task.ITask; 19 | import com.antilia.task.TasksRunnable; 20 | import com.google.inject.Binder; 21 | import com.google.inject.Guice; 22 | import com.google.inject.Module; 23 | 24 | /** 25 | * Application object for your web application. 26 | * If you want to run this application without deploying, run the Start class. 27 | * 28 | * @see com.antilia.Start#main(String[]) 29 | */ 30 | public class BgProcessApplication extends WebApplication 31 | { 32 | ExecutorService executorService = new ThreadPoolExecutor(10, 10, 33 | 0L, TimeUnit.MILLISECONDS, 34 | new LinkedBlockingQueue()); 35 | 36 | /** 37 | /** 38 | * @see org.apache.wicket.Application#getHomePage() 39 | */ 40 | @Override 41 | public Class getHomePage() 42 | { 43 | return HomePage.class; 44 | } 45 | 46 | /** 47 | * @see org.apache.wicket.Application#init() 48 | */ 49 | @Override 50 | public void init() 51 | { 52 | super.init(); 53 | com.google.inject.Injector injector = Guice.createInjector(newModule()); 54 | getComponentInstantiationListeners().add( new GuiceComponentInjector(this, injector)); 55 | } 56 | 57 | @Override 58 | protected void onDestroy() { 59 | executorService.shutdown(); 60 | try { 61 | if (!executorService.awaitTermination(2, TimeUnit.SECONDS)) { 62 | executorService.shutdownNow(); 63 | } 64 | } catch (InterruptedException e) { 65 | e.printStackTrace(); 66 | } 67 | super.onDestroy(); 68 | } 69 | 70 | private Module newModule() { 71 | return new Module() { 72 | public void configure(Binder binder) { 73 | binder.bind(IAnswerService.class).to(AnswerService.class); 74 | } 75 | }; 76 | } 77 | 78 | public static BgProcessApplication getApplication() { 79 | return (BgProcessApplication)get(); 80 | } 81 | 82 | @Override 83 | public Session newSession(Request request, Response response) { 84 | return new BgProcessSession(request); 85 | } 86 | 87 | public void launch(ITask task) { 88 | // we are on WEB thread so services should be normally injected. 89 | ExecutionBridge bridge = new ExecutionBridge(); 90 | // register bridge on session 91 | bridge.setTaskName("Task-" + BgProcessSession.getSession().countTasks() + 1); 92 | BgProcessSession.getSession().add(bridge); 93 | // run the task 94 | executorService.execute( new TasksRunnable(task, bridge)); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/BgProcessSession.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import org.apache.wicket.protocol.http.WebSession; 8 | import org.apache.wicket.request.Request; 9 | 10 | import com.antilia.task.ExecutionBridge; 11 | 12 | /** 13 | * Session holding BG processes launched by user. 14 | * 15 | * @author reiern70 16 | */ 17 | @SuppressWarnings("serial") 18 | public class BgProcessSession extends WebSession { 19 | 20 | private List bridges = new ArrayList(); 21 | 22 | public BgProcessSession(Request request) { 23 | super(request); 24 | } 25 | 26 | public synchronized void add(ExecutionBridge bridge) { 27 | bind(); 28 | bridges.add(bridge); 29 | } 30 | 31 | public synchronized void pruneFinishedTasks() { 32 | ArrayList nonFinishedBridges = new ArrayList(); 33 | for(ExecutionBridge bridge: this.bridges) { 34 | if (!bridge.isFinished()) { 35 | nonFinishedBridges.add(bridge); 36 | } 37 | } 38 | this.bridges = nonFinishedBridges; 39 | } 40 | 41 | public Iterator getTasksPage(int start, int size) { 42 | int min = Math.min(size, bridges.size()); 43 | return new ArrayList(bridges.subList(start, min)).iterator(); 44 | } 45 | 46 | public long countTasks() { 47 | return bridges.size(); 48 | } 49 | 50 | public static BgProcessSession getSession() { 51 | return (BgProcessSession)get(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/HomePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Apache Wicket Quickstart 6 | 7 | 8 | 9 | 10 |
11 | 15 |
16 |
17 |

Congratulations!

18 |

19 | You can now play with tasks! 20 |

21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.request.mapper.parameter.PageParameters; 5 | 6 | import com.antilia.panel.LaunchDummyTaskPanel; 7 | import com.antilia.panel.TasksListPanel; 8 | 9 | public class HomePage extends WebPage { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public HomePage(final PageParameters parameters) { 13 | super(parameters); 14 | 15 | add( new LaunchDummyTaskPanel("launcher") ); 16 | add( new TasksListPanel("tasksLists") ); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/ActionsPanel.html: -------------------------------------------------------------------------------- 1 | 2 |  Cancel 3 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/ActionsPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.panel; 5 | 6 | import org.apache.wicket.ajax.AjaxRequestTarget; 7 | import org.apache.wicket.ajax.markup.html.AjaxLink; 8 | import org.apache.wicket.markup.html.panel.GenericPanel; 9 | import org.apache.wicket.model.AbstractReadOnlyModel; 10 | import org.apache.wicket.model.IModel; 11 | 12 | import com.antilia.task.ExecutionBridge; 13 | 14 | /** 15 | * 16 | * @author reiern70 17 | */ 18 | @SuppressWarnings("serial") 19 | public abstract class ActionsPanel extends GenericPanel { 20 | 21 | /** 22 | * @param id 23 | */ 24 | public ActionsPanel(String id, IModel model) { 25 | super(id, model); 26 | add( new AjaxLink("stop") { 27 | @Override 28 | public void onClick(AjaxRequestTarget target) { 29 | ActionsPanel.this.getModel().getObject().setStop(!ActionsPanel.this.getModel().getObject().isStop()); 30 | onAction(target); 31 | } 32 | @Override 33 | protected void onConfigure() { 34 | super.onConfigure(); 35 | setVisible(!ActionsPanel.this.getModel().getObject().isFinished()); 36 | } 37 | }.setBody(new AbstractReadOnlyModel(){ 38 | @Override 39 | public String getObject() { 40 | return ActionsPanel.this.getModel().getObject().isStop()?"Restart":"Stop/Pause"; 41 | } 42 | })); 43 | add( new AjaxLink("cancel") { 44 | 45 | @Override 46 | public void onClick(AjaxRequestTarget target) { 47 | ActionsPanel.this.getModel().getObject().setCancel(true); 48 | onAction(target); 49 | } 50 | 51 | @Override 52 | protected void onConfigure() { 53 | super.onConfigure(); 54 | setVisible(!ActionsPanel.this.getModel().getObject().isFinished()); 55 | } 56 | }); 57 | } 58 | 59 | public abstract void onAction(AjaxRequestTarget target); 60 | } 61 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/LaunchDummyTaskPanel.html: -------------------------------------------------------------------------------- 1 | 2 |

Hey! Just be bold and click bellow to launch a Dummy Task!

3 |

4 | 7 |
-------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/LaunchDummyTaskPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.panel; 5 | 6 | import org.apache.wicket.ajax.AjaxRequestTarget; 7 | import org.apache.wicket.ajax.markup.html.AjaxLink; 8 | import org.apache.wicket.event.Broadcast; 9 | import org.apache.wicket.markup.html.panel.Panel; 10 | 11 | import com.antilia.BgProcessApplication; 12 | import com.antilia.task.dummy.DummyTask; 13 | 14 | /** 15 | * @author reiern70 16 | * 17 | */ 18 | @SuppressWarnings("serial") 19 | public class LaunchDummyTaskPanel extends Panel { 20 | 21 | /** 22 | * @param id 23 | */ 24 | public LaunchDummyTaskPanel(String id) { 25 | super(id); 26 | add( new AjaxLink("launch") { 27 | @Override 28 | public void onClick(AjaxRequestTarget target) { 29 | BgProcessApplication.getApplication().launch( new DummyTask() ); 30 | getPage().send(getPage(), Broadcast.DEPTH, new TaskLaunchedEvent(target)); 31 | } 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/TaskDataProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.panel; 5 | 6 | import java.util.Iterator; 7 | 8 | import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; 9 | import org.apache.wicket.model.IModel; 10 | import org.apache.wicket.model.Model; 11 | 12 | import com.antilia.BgProcessSession; 13 | import com.antilia.task.ExecutionBridge; 14 | 15 | /** 16 | * @author reiern70 17 | * 18 | */ 19 | @SuppressWarnings("serial") 20 | public class TaskDataProvider extends SortableDataProvider { 21 | 22 | @Override 23 | public Iterator iterator(long start, long size) { 24 | return BgProcessSession.getSession().getTasksPage((int)start, (int)size); 25 | } 26 | 27 | @Override 28 | public IModel model(ExecutionBridge object) { 29 | return Model.of(object); 30 | } 31 | 32 | public long size() { 33 | return BgProcessSession.getSession().countTasks(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/TaskLaunchedEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.panel; 5 | 6 | import java.io.Serializable; 7 | 8 | import org.apache.wicket.ajax.AjaxRequestTarget; 9 | 10 | /** 11 | * @author reiern70 12 | * 13 | */ 14 | @SuppressWarnings("serial") 15 | public class TaskLaunchedEvent implements Serializable { 16 | 17 | private AjaxRequestTarget target; 18 | /** 19 | * 20 | */ 21 | public TaskLaunchedEvent(AjaxRequestTarget target) { 22 | this.target = target; 23 | } 24 | public AjaxRequestTarget getTarget() { 25 | return target; 26 | } 27 | public void setTarget(AjaxRequestTarget target) { 28 | this.target = target; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/TasksListPanel.html: -------------------------------------------------------------------------------- 1 | 2 |

See your tasks!

3 | 4 |
5 |
-------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java: -------------------------------------------------------------------------------- 1 | package com.antilia.panel; 2 | 3 | import java.util.ArrayList; 4 | 5 | import org.apache.wicket.ajax.AjaxRequestTarget; 6 | import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior; 7 | import org.apache.wicket.ajax.markup.html.AjaxLink; 8 | import org.apache.wicket.event.IEvent; 9 | import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; 10 | import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; 11 | import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; 12 | import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; 13 | import org.apache.wicket.markup.html.panel.Panel; 14 | import org.apache.wicket.markup.repeater.Item; 15 | import org.apache.wicket.model.IModel; 16 | import org.apache.wicket.model.Model; 17 | import org.apache.wicket.util.time.Duration; 18 | 19 | import com.antilia.BgProcessSession; 20 | import com.antilia.task.ExecutionBridge; 21 | 22 | /** 23 | * @author reiern70 24 | */ 25 | @SuppressWarnings("serial") 26 | public class TasksListPanel extends Panel { 27 | /** 28 | * @param id 29 | */ 30 | public TasksListPanel(String id) { 31 | super(id); 32 | setOutputMarkupId(true); 33 | add( new AjaxLink("prune") { 34 | @Override 35 | public void onClick(AjaxRequestTarget target) { 36 | BgProcessSession.getSession().pruneFinishedTasks(); 37 | target.add(TasksListPanel.this); 38 | } 39 | }); 40 | add( new AjaxSelfUpdatingTimerBehavior( Duration.seconds(5) ) ); 41 | ArrayList> columns = new ArrayList>(); 42 | columns.add( new PropertyColumn(Model.of("Actions"), "-") { 43 | @Override 44 | public void populateItem( 45 | Item> item, 46 | String componentId, IModel rowModel) { 47 | item.add( new ActionsPanel(componentId, rowModel) { 48 | @Override 49 | public void onAction(AjaxRequestTarget target) { 50 | TasksListPanel.this.add(new AjaxSelfUpdatingTimerBehavior( Duration.seconds(5))); 51 | target.add(TasksListPanel.this); 52 | } 53 | }); 54 | } 55 | }); 56 | columns.add( new PropertyColumn(Model.of("Name"), "taskName") ); 57 | columns.add( new PropertyColumn(Model.of("Stoped"), "stop") ); 58 | columns.add( new PropertyColumn(Model.of("Canceled"), "cancel") ); 59 | columns.add( new PropertyColumn(Model.of("Message"), "message") ); 60 | columns.add( new PropertyColumn(Model.of("Progress"), "progress") ); 61 | columns.add( new PropertyColumn(Model.of("Finished"), "finished") ); 62 | AjaxFallbackDefaultDataTable tasks = new AjaxFallbackDefaultDataTable("tasks", columns, new TaskDataProvider(), 10); 63 | add(tasks); 64 | } 65 | 66 | @Override 67 | public void onEvent(IEvent event) { 68 | if(event.getPayload() instanceof TaskLaunchedEvent) { 69 | TaskLaunchedEvent event2 = (TaskLaunchedEvent)event.getPayload(); 70 | TasksListPanel.this.add(new AjaxSelfUpdatingTimerBehavior( Duration.seconds(5))); 71 | event2.getTarget().add(TasksListPanel.this); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/service/IAnswerService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.service; 5 | 6 | /** 7 | * @author reiern70 8 | * 9 | */ 10 | public interface IAnswerService { 11 | 12 | public static enum AnswerType { 13 | ALL_OK, 14 | IS_STOP, 15 | IS_CANCEL, 16 | IS_ERROR, 17 | } 18 | 19 | String getMessage(AnswerType type, int i); 20 | } 21 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/service/impl/AnswerService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.service.impl; 5 | 6 | import com.antilia.service.IAnswerService; 7 | import org.apache.wicket.Application; 8 | import org.apache.wicket.Session; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | 12 | /** 13 | * @author reiern70 14 | * 15 | */ 16 | public class AnswerService implements IAnswerService { 17 | 18 | private static final Logger LOGGER = LoggerFactory.getLogger(AnswerService.class); 19 | 20 | public AnswerService() { 21 | } 22 | 23 | /* (non-Javadoc) 24 | * @see com.antilia.service.IAnswerService#getMessage(com.antilia.service.IAnswerService.AnswerType, int) 25 | */ 26 | @Override 27 | public String getMessage(AnswerType type, int i) { 28 | LOGGER.info("App: {}", Application.exists()); 29 | LOGGER.info("Session: {}", Session.exists()); 30 | 31 | 32 | if(AnswerType.IS_CANCEL.equals(type)) { 33 | return "Taking the poison pill at " + i + "!"; 34 | } 35 | if(AnswerType.ALL_OK.equals(type)) { 36 | return "Doing nothing for the " + i + "th time!"; 37 | } 38 | if(AnswerType.IS_STOP.equals(type)) { 39 | return "Having a little nap at " + i + "!"; 40 | } 41 | if(AnswerType.IS_ERROR.equals(type)) { 42 | return "Oops... Something went wrong! "; 43 | } 44 | return "Know nothing about this!"; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/task/ExecutionBridge.java: -------------------------------------------------------------------------------- 1 | package com.antilia.task; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Bridge, honoring its name, serve as a context to establish communication between 7 | * WEB layer and Service (Back-ground threads layer). 8 | * 9 | * @author reiern70 10 | */ 11 | @SuppressWarnings("serial") 12 | public class ExecutionBridge implements Serializable { 13 | 14 | private String taskName; 15 | 16 | private volatile boolean stop = false; 17 | 18 | private volatile boolean cancel = false; 19 | 20 | private volatile int progress = 0; 21 | 22 | private String message; 23 | 24 | public ExecutionBridge() { 25 | } 26 | 27 | 28 | public String getTaskName() { 29 | return taskName; 30 | } 31 | 32 | public void setTaskName(String taskName) { 33 | this.taskName = taskName; 34 | } 35 | 36 | public boolean isStop() { 37 | return stop; 38 | } 39 | 40 | public void setStop(boolean stop) { 41 | this.stop = stop; 42 | } 43 | 44 | public boolean isCancel() { 45 | return cancel; 46 | } 47 | 48 | public void setCancel(boolean cancel) { 49 | this.cancel = cancel; 50 | } 51 | 52 | public int getProgress() { 53 | return progress; 54 | } 55 | 56 | public void setProgress(int progress) { 57 | this.progress = progress; 58 | } 59 | 60 | public boolean isFinished() { 61 | return isCancel() || progress >= 100; 62 | } 63 | 64 | public String getMessage() { 65 | return message; 66 | } 67 | 68 | public void setMessage(String message) { 69 | this.message = message; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/task/ITask.java: -------------------------------------------------------------------------------- 1 | package com.antilia.task; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author reiern70 7 | * 8 | */ 9 | public interface ITask extends Serializable { 10 | 11 | void doIt(ExecutionBridge bridge); 12 | } 13 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/task/TasksRunnable.java: -------------------------------------------------------------------------------- 1 | package com.antilia.task; 2 | 3 | 4 | import org.apache.wicket.Application; 5 | import org.apache.wicket.Session; 6 | import org.apache.wicket.ThreadContext; 7 | 8 | /** 9 | * @author reiern70 10 | * 11 | */ 12 | public class TasksRunnable implements Runnable { 13 | 14 | private final ITask task; 15 | private final ExecutionBridge bridge; 16 | private final Application application; 17 | private final Session session; 18 | 19 | public TasksRunnable(ITask task, ExecutionBridge bridge) { 20 | this.task = task; 21 | this.bridge = bridge; 22 | 23 | this.application = Application.get(); 24 | this.session = Session.exists() ? Session.get() : null; 25 | } 26 | 27 | @Override 28 | public void run() { 29 | try { 30 | ThreadContext.setApplication(application); 31 | ThreadContext.setSession(session); 32 | task.doIt(bridge); 33 | } finally { 34 | ThreadContext.detach(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /bgprocess/src/main/java/com/antilia/task/dummy/DummyTask.java: -------------------------------------------------------------------------------- 1 | package com.antilia.task.dummy; 2 | 3 | import org.apache.wicket.Application; 4 | import org.apache.wicket.Session; 5 | import org.apache.wicket.injection.Injector; 6 | 7 | import com.antilia.service.IAnswerService; 8 | import com.antilia.service.IAnswerService.AnswerType; 9 | import com.antilia.task.ExecutionBridge; 10 | import com.antilia.task.ITask; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | 14 | @SuppressWarnings("serial") 15 | public class DummyTask implements ITask { 16 | 17 | private static final Logger LOGGER = LoggerFactory.getLogger(DummyTask.class); 18 | 19 | @javax.inject.Inject 20 | private IAnswerService answerService; 21 | 22 | public DummyTask() { 23 | Injector.get().inject(this); 24 | } 25 | 26 | @Override 27 | public void doIt(ExecutionBridge bridge) { 28 | 29 | LOGGER.info("App: {}", Application.exists()); 30 | LOGGER.info("Session: {}", Session.exists()); 31 | 32 | for(int i =1; i <= 100; ) { 33 | bridge.setProgress(i); 34 | if(bridge.isCancel()) { 35 | bridge.setMessage(answerService.getMessage(AnswerType.IS_CANCEL, i)); 36 | // end the task! 37 | return; 38 | } 39 | if(bridge.isStop()) { 40 | bridge.setMessage(answerService.getMessage(AnswerType.IS_STOP, i)); 41 | } else { 42 | bridge.setMessage(answerService.getMessage(AnswerType.ALL_OK, i)); 43 | i++; 44 | } 45 | try { 46 | Thread.sleep(1000L); 47 | } catch (InterruptedException e) { 48 | bridge.setProgress(100); 49 | bridge.setMessage(answerService.getMessage(AnswerType.IS_ERROR, i)); 50 | return; 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /bgprocess/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /bgprocess/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bgprocess 7 | 8 | 18 | 19 | 20 | wicket.bgprocess 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.BgProcessApplication 25 | 26 | 27 | 28 | 29 | wicket.bgprocess 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /bgprocess/src/main/webapp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/bgprocess/src/main/webapp/logo.png -------------------------------------------------------------------------------- /bgprocess/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} 2 | h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } 3 | body { margin:0;padding:0;} 4 | #hd { 5 | width : 100%; 6 | height : 87px; 7 | background-color : #092E67; 8 | margin-top : 0; 9 | padding-top : 10px; 10 | border-bottom : 1px solid #888; 11 | z-index : 0; 12 | } 13 | #ft { 14 | position : absolute; 15 | bottom : 0; 16 | width : 100%; 17 | height : 99px; 18 | background-color : #6493D2; 19 | border-top : 1px solid #888; 20 | z-index : 0; 21 | } 22 | #logo,#bd { 23 | width : 650px; 24 | margin: 0 auto; 25 | padding: 25px 50px 0 50px; 26 | } 27 | #logo h1 { 28 | color : white; 29 | font-size:36pt; 30 | display: inline; 31 | } 32 | #logo img { 33 | display:inline; 34 | vertical-align: bottom; 35 | margin-left : 50px; 36 | margin-right : 5px; 37 | } 38 | body { margin-top : 0; padding-top : 0;} 39 | #logo, #logo h1 { margin-top : 0; padding-top : 0;} 40 | #bd { 41 | position : absolute; 42 | top : 75px; 43 | bottom : 75px; 44 | left : 50%; 45 | margin-left : -325px; 46 | z-index : 1; 47 | overflow: auto; 48 | background-color : #fff; 49 | -webkit-border-radius: 10px; 50 | -moz-border-radius: 10px; 51 | border-radius: 10px; 52 | -moz-box-shadow: 0px 0px 10px #888; 53 | -webkit-box-shadow: 0px 0px 10px #888; 54 | box-shadow: 0px 0px 10px #888; 55 | } 56 | a, a:visited, a:hover, a:active { 57 | color : #6493D2; 58 | } 59 | h2 { 60 | padding : 0; margin:0; 61 | font-size:36pt; 62 | color:#FF5500; 63 | } 64 | h3 { 65 | padding : 0; margin:0; 66 | font-size:24pt; 67 | color:#092E67; 68 | } 69 | 70 | table.tasks { 71 | width: 100%; 72 | } 73 | 74 | table.tasks th { 75 | color:#092E67; 76 | } -------------------------------------------------------------------------------- /bgprocess/src/test/java/com/antilia/Start.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.time.Duration; 4 | import org.eclipse.jetty.server.Server; 5 | import org.eclipse.jetty.server.bio.SocketConnector; 6 | import org.eclipse.jetty.server.ssl.SslSocketConnector; 7 | import org.eclipse.jetty.util.resource.Resource; 8 | import org.eclipse.jetty.util.ssl.SslContextFactory; 9 | import org.eclipse.jetty.webapp.WebAppContext; 10 | 11 | public class Start { 12 | public static void main(String[] args) throws Exception { 13 | int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); 14 | 15 | Server server = new Server(); 16 | SocketConnector connector = new SocketConnector(); 17 | 18 | // Set some timeout options to make debugging easier. 19 | connector.setMaxIdleTime(timeout); 20 | connector.setSoLingerTime(-1); 21 | connector.setPort(8080); 22 | server.addConnector(connector); 23 | 24 | Resource keystore = Resource.newClassPathResource("/keystore"); 25 | if (keystore != null && keystore.exists()) { 26 | // if a keystore for a SSL certificate is available, start a SSL 27 | // connector on port 8443. 28 | // By default, the quickstart comes with a Apache Wicket Quickstart 29 | // Certificate that expires about half way september 2021. Do not 30 | // use this certificate anywhere important as the passwords are 31 | // available in the source. 32 | 33 | connector.setConfidentialPort(8443); 34 | 35 | SslContextFactory factory = new SslContextFactory(); 36 | factory.setKeyStoreResource(keystore); 37 | factory.setKeyStorePassword("wicket"); 38 | factory.setTrustStoreResource(keystore); 39 | factory.setKeyManagerPassword("wicket"); 40 | SslSocketConnector sslConnector = new SslSocketConnector(factory); 41 | sslConnector.setMaxIdleTime(timeout); 42 | sslConnector.setPort(8443); 43 | sslConnector.setAcceptors(4); 44 | server.addConnector(sslConnector); 45 | 46 | System.out.println("SSL access to the quickstart has been enabled on port 8443"); 47 | System.out.println("You can access the application using SSL on https://localhost:8443"); 48 | System.out.println(); 49 | } 50 | 51 | WebAppContext bb = new WebAppContext(); 52 | bb.setServer(server); 53 | bb.setContextPath("/"); 54 | bb.setWar("src/main/webapp"); 55 | 56 | // START JMX SERVER 57 | // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); 58 | // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); 59 | // server.getContainer().addEventListener(mBeanContainer); 60 | // mBeanContainer.start(); 61 | 62 | server.setHandler(bb); 63 | 64 | try { 65 | System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); 66 | server.start(); 67 | System.in.read(); 68 | System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); 69 | server.stop(); 70 | server.join(); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.exit(1); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /bgprocess/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/bgprocess/src/test/resources/keystore -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 22 | client-sign-out-parent 23 | com.antilia 24 | 1.0-SNAPSHOT 25 | 26 | 27 | 4.0.0 28 | client-sign-out-demo 29 | war 30 | 31 | client-sign-out-demo 32 | 33 | 39 | 40 | 41 | The Apache Software License, Version 2.0 42 | http://www.apache.org/licenses/LICENSE-2.0.txt 43 | repo 44 | 45 | 46 | 47 | 6.14.0 48 | 7.6.13.v20130916 49 | UTF-8 50 | 51 | none 52 | 53 | 54 | 55 | com.antilia 56 | client-sign-out 57 | 1.0-SNAPSHOT 58 | 59 | 60 | 61 | org.apache.wicket 62 | wicket-core 63 | ${wicket.version} 64 | 65 | 66 | 67 | 68 | 69 | org.slf4j 70 | slf4j-log4j12 71 | 1.6.4 72 | 73 | 74 | log4j 75 | log4j 76 | 1.2.16 77 | 78 | 79 | 80 | 81 | junit 82 | junit 83 | 4.11 84 | test 85 | 86 | 87 | 88 | 89 | org.eclipse.jetty.aggregate 90 | jetty-all-server 91 | ${jetty.version} 92 | provided 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Apache Wicket Quickstart 6 | 7 | 8 | 9 | 10 |
11 |
12 | 16 |
17 |
18 |

This page will automatically sign aout after 10.000 mili-seconds of inactivity:

19 | 20 | Click me to avoid sign out 21 | 22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import com.antilia.signout.InactivitySignOutPanel; 4 | import org.apache.wicket.ajax.AjaxRequestTarget; 5 | import org.apache.wicket.ajax.markup.html.AjaxLink; 6 | import org.apache.wicket.request.mapper.parameter.PageParameters; 7 | import org.apache.wicket.markup.html.basic.Label; 8 | import org.apache.wicket.markup.html.WebPage; 9 | import org.apache.wicket.util.time.Duration; 10 | 11 | public class HomePage extends WebPage { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public HomePage(final PageParameters parameters) { 15 | super(parameters); 16 | 17 | add(new InactivitySignOutPanel("logOut", Duration.seconds(10)) { 18 | protected String getOnTimeChangedFunction() { 19 | return "function(timeRemaining){if(!window.countDown) { window.countDown = $('#countDown'); } $(window.countDown).html(timeRemaining);}"; 20 | } 21 | }); 22 | 23 | add( new AjaxLink("link") { 24 | 25 | @Override 26 | public void onClick(AjaxRequestTarget target) { 27 | // do nothing 28 | } 29 | }); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/main/java/com/antilia/WicketApplication.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.protocol.http.WebApplication; 5 | 6 | /** 7 | * Application object for your web application. 8 | * If you want to run this application without deploying, run the Start class. 9 | * 10 | * @see com.antilia.Start#main(String[]) 11 | */ 12 | public class WicketApplication extends WebApplication 13 | { 14 | /** 15 | * @see org.apache.wicket.Application#getHomePage() 16 | */ 17 | @Override 18 | public Class getHomePage() 19 | { 20 | return HomePage.class; 21 | } 22 | 23 | /** 24 | * @see org.apache.wicket.Application#init() 25 | */ 26 | @Override 27 | public void init() 28 | { 29 | super.init(); 30 | 31 | // add your configuration here 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | client-sign-out 7 | 8 | 18 | 19 | 20 | wicket.client-sign-out 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.WicketApplication 25 | 26 | 27 | 28 | 29 | wicket.client-sign-out 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/main/webapp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/client-sign-out-parent/client-sign-out-demo/src/main/webapp/logo.png -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} 2 | h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } 3 | body { margin:0;padding:0;} 4 | #hd { 5 | width : 100%; 6 | height : 87px; 7 | background-color : #092E67; 8 | margin-top : 0; 9 | padding-top : 10px; 10 | border-bottom : 1px solid #888; 11 | z-index : 0; 12 | } 13 | #ft { 14 | position : absolute; 15 | bottom : 0; 16 | width : 100%; 17 | height : 99px; 18 | background-color : #6493D2; 19 | border-top : 1px solid #888; 20 | z-index : 0; 21 | } 22 | #logo,#bd { 23 | width : 650px; 24 | margin: 0 auto; 25 | padding: 25px 50px 0 50px; 26 | } 27 | #logo h1 { 28 | color : white; 29 | font-size:36pt; 30 | display: inline; 31 | } 32 | #logo img { 33 | display:inline; 34 | vertical-align: bottom; 35 | margin-left : 50px; 36 | margin-right : 5px; 37 | } 38 | body { margin-top : 0; padding-top : 0;} 39 | #logo, #logo h1 { margin-top : 0; padding-top : 0;} 40 | #bd { 41 | position : absolute; 42 | top : 75px; 43 | bottom : 75px; 44 | left : 50%; 45 | margin-left : -325px; 46 | z-index : 1; 47 | overflow: auto; 48 | background-color : #fff; 49 | -webkit-border-radius: 10px; 50 | -moz-border-radius: 10px; 51 | border-radius: 10px; 52 | -moz-box-shadow: 0px 0px 10px #888; 53 | -webkit-box-shadow: 0px 0px 10px #888; 54 | box-shadow: 0px 0px 10px #888; 55 | } 56 | a, a:visited, a:hover, a:active { 57 | color : #6493D2; 58 | } 59 | h2 { 60 | padding : 0; margin:0; 61 | font-size:36pt; 62 | color:#FF5500; 63 | } 64 | h3 { 65 | padding : 0; margin:0; 66 | font-size:24pt; 67 | color:#092E67; 68 | } -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/test/java/com/antilia/Start.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.time.Duration; 4 | import org.eclipse.jetty.server.Server; 5 | import org.eclipse.jetty.server.bio.SocketConnector; 6 | import org.eclipse.jetty.server.ssl.SslSocketConnector; 7 | import org.eclipse.jetty.util.resource.Resource; 8 | import org.eclipse.jetty.util.ssl.SslContextFactory; 9 | import org.eclipse.jetty.webapp.WebAppContext; 10 | 11 | public class Start { 12 | public static void main(String[] args) throws Exception { 13 | int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); 14 | 15 | Server server = new Server(); 16 | SocketConnector connector = new SocketConnector(); 17 | 18 | // Set some timeout options to make debugging easier. 19 | connector.setMaxIdleTime(timeout); 20 | connector.setSoLingerTime(-1); 21 | connector.setPort(8080); 22 | server.addConnector(connector); 23 | 24 | Resource keystore = Resource.newClassPathResource("/keystore"); 25 | if (keystore != null && keystore.exists()) { 26 | // if a keystore for a SSL certificate is available, start a SSL 27 | // connector on port 8443. 28 | // By default, the quickstart comes with a Apache Wicket Quickstart 29 | // Certificate that expires about half way september 2021. Do not 30 | // use this certificate anywhere important as the passwords are 31 | // available in the source. 32 | 33 | connector.setConfidentialPort(8443); 34 | 35 | SslContextFactory factory = new SslContextFactory(); 36 | factory.setKeyStoreResource(keystore); 37 | factory.setKeyStorePassword("wicket"); 38 | factory.setTrustStoreResource(keystore); 39 | factory.setKeyManagerPassword("wicket"); 40 | SslSocketConnector sslConnector = new SslSocketConnector(factory); 41 | sslConnector.setMaxIdleTime(timeout); 42 | sslConnector.setPort(8443); 43 | sslConnector.setAcceptors(4); 44 | server.addConnector(sslConnector); 45 | 46 | System.out.println("SSL access to the quickstart has been enabled on port 8443"); 47 | System.out.println("You can access the application using SSL on https://localhost:8443"); 48 | System.out.println(); 49 | } 50 | 51 | WebAppContext bb = new WebAppContext(); 52 | bb.setServer(server); 53 | bb.setContextPath("/"); 54 | bb.setWar("src/main/webapp"); 55 | 56 | // START JMX SERVER 57 | // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); 58 | // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); 59 | // server.getContainer().addEventListener(mBeanContainer); 60 | // mBeanContainer.start(); 61 | 62 | server.setHandler(bb); 63 | 64 | try { 65 | System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); 66 | server.start(); 67 | System.in.read(); 68 | System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); 69 | server.stop(); 70 | server.join(); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.exit(1); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/test/java/com/antilia/TestHomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.tester.WicketTester; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | 7 | /** 8 | * Simple test using the WicketTester 9 | */ 10 | public class TestHomePage 11 | { 12 | private WicketTester tester; 13 | 14 | @Before 15 | public void setUp() 16 | { 17 | tester = new WicketTester(new WicketApplication()); 18 | } 19 | 20 | @Test 21 | public void homepageRendersSuccessfully() 22 | { 23 | //start and render the test page 24 | tester.startPage(HomePage.class); 25 | 26 | //assert rendered page class 27 | tester.assertRenderedPage(HomePage.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out-demo/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/client-sign-out-parent/client-sign-out-demo/src/test/resources/keystore -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.java: -------------------------------------------------------------------------------- 1 | package com.antilia.signout; 2 | 3 | import org.apache.wicket.Component; 4 | import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; 5 | import org.apache.wicket.ajax.AjaxRequestTarget; 6 | import org.apache.wicket.markup.head.IHeaderResponse; 7 | import org.apache.wicket.markup.head.JavaScriptHeaderItem; 8 | import org.apache.wicket.markup.head.OnDomReadyHeaderItem; 9 | import org.apache.wicket.markup.html.panel.GenericPanel; 10 | import org.apache.wicket.model.IModel; 11 | import org.apache.wicket.model.Model; 12 | import org.apache.wicket.protocol.http.WebApplication; 13 | import org.apache.wicket.protocol.http.WebSession; 14 | import org.apache.wicket.request.resource.JavaScriptResourceReference; 15 | import org.apache.wicket.request.resource.ResourceReference; 16 | import org.apache.wicket.util.time.Duration; 17 | 18 | /** 19 | * Hidden panel the will trigger a sign out after certain period of inactivity. 20 | * This panel should be attached to a page wanting to exhibit such behavior. 21 | */ 22 | public class InactivitySignOutPanel extends GenericPanel { 23 | 24 | private final ResourceReference JS = new JavaScriptResourceReference(InactivitySignOutPanel.class, "InactivitySignOutPanel.js"); 25 | 26 | private AbstractDefaultAjaxBehavior ajaxBehavior; 27 | 28 | public InactivitySignOutPanel(String id, Duration duration) { 29 | this(id, Model.of(duration)); 30 | } 31 | 32 | public InactivitySignOutPanel(String id, IModel model) { 33 | super(id, model); 34 | setRenderBodyOnly(true); 35 | add(ajaxBehavior = new AbstractDefaultAjaxBehavior() { 36 | 37 | @Override 38 | protected void respond(AjaxRequestTarget target) { 39 | beforeSignOut(target); 40 | WebSession.get().invalidate(); 41 | setResponsePage(WebApplication.get().getApplicationSettings().getPageExpiredErrorPage()); 42 | } 43 | 44 | @Override 45 | protected void onBind() { 46 | // panel will not be repainted, no need to markup markup id. 47 | } 48 | 49 | @Override 50 | public void renderHead(Component component, IHeaderResponse response) { 51 | super.renderHead(component, response); 52 | response.render(JavaScriptHeaderItem.forReference(JS)); 53 | } 54 | }); 55 | } 56 | 57 | /** 58 | * Override to do something before sign out. 59 | * 60 | * @param target AjaxRequestTarget 61 | */ 62 | protected void beforeSignOut(AjaxRequestTarget target) { 63 | //NOP 64 | } 65 | /** 66 | * @return A function to be executed when time remaining changes. 67 | */ 68 | protected String getOnTimeChangedFunction() { 69 | return "function(timeRemaining){}"; 70 | } 71 | 72 | @Override 73 | public void renderHead(IHeaderResponse response) { 74 | StringBuilder builder = new StringBuilder(); 75 | builder.append("new Wicket.SignOut(").append(getModel().getObject().getMilliseconds()) 76 | .append(",'").append(ajaxBehavior.getCallbackUrl()) 77 | .append("',").append(getOnTimeChangedFunction()).append(");"); 78 | response.render(OnDomReadyHeaderItem.forScript(builder)); 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /client-sign-out-parent/client-sign-out/src/main/java/com/antilia/signout/InactivitySignOutPanel.js: -------------------------------------------------------------------------------- 1 | Wicket.SignOut = function(timeout, url, onChange) { 2 | this.timeout = timeout; // Timeout in miliseconds. 3 | this.url = url; 4 | this.onChange = onChange; 5 | // Add timeout (in seconds) to current time to get absolute timeout time. 6 | this.timeoutTime = new Date(); 7 | this.timeoutTime.setSeconds(this.timeoutTime.getSeconds() + this.timeout / 1000); 8 | this.init(); 9 | }; 10 | 11 | Wicket.SignOut.prototype.init = function() { 12 | var self = this; 13 | Wicket.Event.subscribe('/ajax/call/before', function(jqEvent, attributes, jqXHR, errorThrown, textStatus) { 14 | self.reset(); 15 | }); 16 | 17 | Wicket.Event.subscribe('/ajax/call/after', function(jqEvent, attributes, jqXHR, errorThrown, textStatus) { 18 | self.reset(); 19 | }); 20 | this.reset(); 21 | // Set interval to one quarter of the timeout time. 22 | var interval = this.timeout / 4; 23 | // console.log("interval", interval); 24 | setInterval(function(){self.countDown();}, interval); 25 | }; 26 | 27 | Wicket.SignOut.prototype.reset = function() { 28 | // console.log("Reset Called"); 29 | this.timeoutTime = new Date(); 30 | this.timeoutTime.setSeconds(this.timeoutTime.getSeconds() + this.timeout / 1000); 31 | }; 32 | 33 | Wicket.SignOut.prototype.countDown = function() { 34 | now = new Date(); 35 | // console.log("Countdown Called"); 36 | // console.log("now, timeoutTime", now, this.timeoutTime); 37 | try { 38 | this.onChange(this.timeoutTime, now); 39 | } catch(e) { 40 | 41 | } 42 | if (now > this.timeoutTime){ 43 | //trigger the server side sign out 44 | Wicket.Ajax.get({"u": this.url}); 45 | } 46 | }; -------------------------------------------------------------------------------- /client-sign-out-parent/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | com.antilia 6 | antilia-bits 7 | 1.0-SNAPSHOT 8 | 9 | com.antilia 10 | client-sign-out-parent 11 | 1.0-SNAPSHOT 12 | pom 13 | Different wicket components 14 | 15 | 16 | client-sign-out 17 | client-sign-out-demo 18 | 19 | -------------------------------------------------------------------------------- /content-iframe/src/main/java/com/antilia/HomePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Apache Wicket Quickstart 6 | 7 | 8 | 9 | 10 |
11 | 15 |
16 | 18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /content-iframe/src/main/java/com/antilia/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.core.util.resource.PackageResourceStream; 4 | import org.apache.wicket.markup.html.WebPage; 5 | import org.apache.wicket.request.mapper.parameter.PageParameters; 6 | 7 | import com.antilia.iframe.DocumentInlineFrame; 8 | 9 | public class HomePage extends WebPage { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public HomePage(final PageParameters parameters) { 13 | super(parameters); 14 | 15 | add(new DocumentInlineFrame("test", new PackageResourceStream(HomePage.class, "ScalaOverview.pdf"))); 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /content-iframe/src/main/java/com/antilia/ScalaOverview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/content-iframe/src/main/java/com/antilia/ScalaOverview.pdf -------------------------------------------------------------------------------- /content-iframe/src/main/java/com/antilia/WicketApplication.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.protocol.http.WebApplication; 5 | 6 | /** 7 | * Application object for your web application. If you want to run this application without deploying, run the Start class. 8 | * 9 | * @see com.antilia.Iframe#main(String[]) 10 | */ 11 | public class WicketApplication extends WebApplication 12 | { 13 | /** 14 | * @see org.apache.wicket.Application#getHomePage() 15 | */ 16 | @Override 17 | public Class getHomePage() 18 | { 19 | return HomePage.class; 20 | } 21 | 22 | /** 23 | * @see org.apache.wicket.Application#init() 24 | */ 25 | @Override 26 | public void init() 27 | { 28 | super.init(); 29 | 30 | // add your configuration here 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /content-iframe/src/main/java/com/antilia/iframe/DocumentInlineFrame.java: -------------------------------------------------------------------------------- 1 | package com.antilia.iframe; 2 | 3 | import org.apache.wicket.IResourceListener; 4 | import org.apache.wicket.markup.ComponentTag; 5 | import org.apache.wicket.markup.html.WebMarkupContainer; 6 | import org.apache.wicket.request.cycle.RequestCycle; 7 | import org.apache.wicket.request.resource.IResource; 8 | import org.apache.wicket.request.resource.IResource.Attributes; 9 | import org.apache.wicket.request.resource.ResourceStreamResource; 10 | import org.apache.wicket.util.resource.IResourceStream; 11 | import org.apache.wicket.util.string.Strings; 12 | 13 | /** 14 | * Implementation of an inline 15 | * frame component. Must be used with an iframe (<iframe src...) element. The src attribute 16 | * will be generated. Its is suitable for displaying generated contend like PDF, EXCEL, WORD, 17 | * etc. 18 | * 19 | * @author Ernesto Reinaldo Barreiro 20 | * 21 | */ 22 | 23 | public class DocumentInlineFrame extends WebMarkupContainer implements IResourceListener 24 | { 25 | private static final long serialVersionUID = 1L; 26 | 27 | 28 | private IResource documentResource; 29 | 30 | /** 31 | * 32 | * Constructor receiving an IResourceStream. 33 | * 34 | * @param id 35 | * @param stream 36 | */ 37 | public DocumentInlineFrame(String id, IResourceStream stream) { 38 | this(id, new ResourceStreamResource(stream)); 39 | } 40 | 41 | /** 42 | * Constructor receiving an IResource.. 43 | * 44 | * @param id 45 | * @param resourceListener 46 | */ 47 | public DocumentInlineFrame(final String id, IResource documentResource) 48 | { 49 | super(id); 50 | this.documentResource = documentResource; 51 | } 52 | 53 | /** 54 | * Gets the url to use for this link. 55 | * 56 | * @return The URL that this link links to 57 | */ 58 | protected CharSequence getURL() 59 | { 60 | return urlFor(IResourceListener.INTERFACE, null); 61 | } 62 | 63 | /** 64 | * Handles this frame's tag. 65 | * 66 | * @param tag 67 | * the component tag 68 | * @see org.apache.wicket.Component#onComponentTag(ComponentTag) 69 | */ 70 | @Override 71 | protected final void onComponentTag(final ComponentTag tag) 72 | { 73 | checkComponentTag(tag, "iframe"); 74 | 75 | // Set href to link to this frame's frameRequested method 76 | CharSequence url = getURL(); 77 | 78 | // generate the src attribute 79 | tag.put("src", Strings.replaceAll(url, "&", "&")); 80 | 81 | super.onComponentTag(tag); 82 | } 83 | 84 | 85 | 86 | @Override 87 | protected boolean getStatelessHint() 88 | { 89 | return false; 90 | } 91 | 92 | public void onResourceRequested() { 93 | RequestCycle requestCycle = RequestCycle.get(); 94 | Attributes attributes = new Attributes(requestCycle.getRequest(), 95 | requestCycle.getResponse(), null); 96 | this.documentResource.respond(attributes); 97 | } 98 | } -------------------------------------------------------------------------------- /content-iframe/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /content-iframe/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | content-iframe 7 | 8 | 18 | 19 | 20 | wicket.content-iframe 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.WicketApplication 25 | 26 | 27 | 28 | 29 | wicket.content-iframe 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /content-iframe/src/main/webapp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/content-iframe/src/main/webapp/logo.png -------------------------------------------------------------------------------- /content-iframe/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} 2 | h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } 3 | body { margin:0;padding:0;} 4 | #hd { 5 | width : 100%; 6 | height : 87px; 7 | background-color : #092E67; 8 | margin-top : 0; 9 | padding-top : 10px; 10 | border-bottom : 1px solid #888; 11 | z-index : 0; 12 | } 13 | #ft { 14 | position : absolute; 15 | bottom : 0; 16 | width : 100%; 17 | height : 99px; 18 | background-color : #6493D2; 19 | border-top : 1px solid #888; 20 | z-index : 0; 21 | } 22 | #logo,#bd { 23 | width : 650px; 24 | margin: 0 auto; 25 | padding: 25px 50px 0 50px; 26 | } 27 | #logo h1 { 28 | color : white; 29 | font-size:36pt; 30 | display: inline; 31 | } 32 | #logo img { 33 | display:inline; 34 | vertical-align: bottom; 35 | margin-left : 50px; 36 | margin-right : 5px; 37 | } 38 | body { margin-top : 0; padding-top : 0;} 39 | #logo, #logo h1 { margin-top : 0; padding-top : 0;} 40 | #bd { 41 | position : absolute; 42 | top : 75px; 43 | bottom : 75px; 44 | left : 50%; 45 | margin-left : -325px; 46 | z-index : 1; 47 | overflow: auto; 48 | background-color : #fff; 49 | -webkit-border-radius: 10px; 50 | -moz-border-radius: 10px; 51 | border-radius: 10px; 52 | -moz-box-shadow: 0px 0px 10px #888; 53 | -webkit-box-shadow: 0px 0px 10px #888; 54 | box-shadow: 0px 0px 10px #888; 55 | } 56 | a, a:visited, a:hover, a:active { 57 | color : #6493D2; 58 | } 59 | h2 { 60 | padding : 0; margin:0; 61 | font-size:36pt; 62 | color:#FF5500; 63 | } 64 | h3 { 65 | padding : 0; margin:0; 66 | font-size:24pt; 67 | color:#092E67; 68 | } -------------------------------------------------------------------------------- /content-iframe/src/test/java/com/antilia/Iframe.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.time.Duration; 4 | import org.eclipse.jetty.server.Server; 5 | import org.eclipse.jetty.server.bio.SocketConnector; 6 | import org.eclipse.jetty.server.ssl.SslSocketConnector; 7 | import org.eclipse.jetty.util.resource.Resource; 8 | import org.eclipse.jetty.util.ssl.SslContextFactory; 9 | import org.eclipse.jetty.webapp.WebAppContext; 10 | 11 | public class Iframe { 12 | public static void main(String[] args) throws Exception { 13 | int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); 14 | 15 | Server server = new Server(); 16 | SocketConnector connector = new SocketConnector(); 17 | 18 | // Set some timeout options to make debugging easier. 19 | connector.setMaxIdleTime(timeout); 20 | connector.setSoLingerTime(-1); 21 | connector.setPort(8080); 22 | server.addConnector(connector); 23 | 24 | Resource keystore = Resource.newClassPathResource("/keystore"); 25 | if (keystore != null && keystore.exists()) { 26 | // if a keystore for a SSL certificate is available, start a SSL 27 | // connector on port 8443. 28 | // By default, the quickstart comes with a Apache Wicket Quickstart 29 | // Certificate that expires about half way september 2021. Do not 30 | // use this certificate anywhere important as the passwords are 31 | // available in the source. 32 | 33 | connector.setConfidentialPort(8443); 34 | 35 | SslContextFactory factory = new SslContextFactory(); 36 | factory.setKeyStoreResource(keystore); 37 | factory.setKeyStorePassword("wicket"); 38 | factory.setTrustStoreResource(keystore); 39 | factory.setKeyManagerPassword("wicket"); 40 | SslSocketConnector sslConnector = new SslSocketConnector(factory); 41 | sslConnector.setMaxIdleTime(timeout); 42 | sslConnector.setPort(8443); 43 | sslConnector.setAcceptors(4); 44 | server.addConnector(sslConnector); 45 | 46 | System.out.println("SSL access to the quickstart has been enabled on port 8443"); 47 | System.out.println("You can access the application using SSL on https://localhost:8443"); 48 | System.out.println(); 49 | } 50 | 51 | WebAppContext bb = new WebAppContext(); 52 | bb.setServer(server); 53 | bb.setContextPath("/"); 54 | bb.setWar("src/main/webapp"); 55 | 56 | // START JMX SERVER 57 | // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); 58 | // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); 59 | // server.getContainer().addEventListener(mBeanContainer); 60 | // mBeanContainer.start(); 61 | 62 | server.setHandler(bb); 63 | 64 | try { 65 | System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); 66 | server.start(); 67 | System.in.read(); 68 | System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); 69 | server.stop(); 70 | server.join(); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.exit(1); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /content-iframe/src/test/java/com/antilia/TestHomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.tester.WicketTester; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | 7 | /** 8 | * Simple test using the WicketTester 9 | */ 10 | public class TestHomePage 11 | { 12 | private WicketTester tester; 13 | 14 | @Before 15 | public void setUp() 16 | { 17 | tester = new WicketTester(new WicketApplication()); 18 | } 19 | 20 | @Test 21 | public void homepageRendersSuccessfully() 22 | { 23 | //start and render the test page 24 | tester.startPage(HomePage.class); 25 | 26 | //assert rendered page class 27 | tester.assertRenderedPage(HomePage.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /content-iframe/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/content-iframe/src/test/resources/keystore -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | org.sonatype.oss 6 | oss-parent 7 | 7 8 | 9 | com.antilia 10 | antilia-bits 11 | 1.0-SNAPSHOT 12 | pom 13 | antilia-bits 14 | Different wicket components 15 | 16 | 17 | Apache 2 18 | http://www.apache.org/licenses/LICENSE-2.0.txt 19 | repo 20 | A business-friendly OSS license 21 | 22 | 23 | 24 | scm:git:https://github.com/reiern70/antilia-bits.git 25 | scm:git:https://github.com/reiern70/antilia-bits.git 26 | git@github.com/reiern70/antilia-bits.git 27 | HEAD 28 | 29 | 30 | 31 | 32 | 6.6.0 33 | 7.6.3.v20120416 34 | UTF-8 35 | 36 | 37 | 38 | wicket-angular-parent 39 | wicket-ember 40 | wicket-replace-with-effect 41 | content-iframe 42 | wicket-sparelinks 43 | client-sign-out-parent 44 | bgprocess 45 | 46 | 47 | 48 | 49 | 50 | false 51 | src/main/resources 52 | 53 | 54 | false 55 | src/main/java 56 | 57 | ** 58 | 59 | 60 | **/*.java 61 | 62 | 63 | 64 | 65 | 66 | false 67 | src/test/resources 68 | 69 | 70 | false 71 | src/test/java 72 | 73 | ** 74 | 75 | 76 | **/*.java 77 | 78 | 79 | 80 | 81 | 82 | maven-compiler-plugin 83 | 84 | 1.6 85 | 1.6 86 | 87 | 2.4 88 | 89 | 90 | org.apache.maven.plugins 91 | maven-source-plugin 92 | 2.1.2 93 | 94 | 95 | attach-sources 96 | verify 97 | 98 | jar 99 | 100 | 101 | 102 | 103 | 104 | org.apache.maven.plugins 105 | maven-release-plugin 106 | 2.3 107 | 108 | deploy 109 | true 110 | release-@{project.version} 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /screenshots/angular/angular1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/screenshots/angular/angular1.png -------------------------------------------------------------------------------- /screenshots/angular/angular2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/screenshots/angular/angular2.png -------------------------------------------------------------------------------- /screenshots/angular/angular3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/screenshots/angular/angular3.png -------------------------------------------------------------------------------- /screenshots/angular/angular4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/screenshots/angular/angular4.png -------------------------------------------------------------------------------- /wicket-angular-parent/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | antilia-bits 6 | com.antilia 7 | 1.0-SNAPSHOT 8 | 9 | com.antilia 10 | wicket-angular-parent 11 | pom 12 | wicket-angular-parent 13 | Wicket angular integration 14 | 15 | wicket-angular 16 | wicket-angular-demo 17 | 18 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | wicket-angular-demo 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.6 6 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular; 2 | 3 | import org.apache.wicket.markup.head.IHeaderResponse; 4 | import org.apache.wicket.markup.head.JavaScriptHeaderItem; 5 | import org.apache.wicket.markup.html.WebPage; 6 | import org.apache.wicket.markup.html.link.BookmarkablePageLink; 7 | import org.apache.wicket.request.mapper.parameter.PageParameters; 8 | import org.apache.wicket.resource.CoreLibrariesContributor; 9 | 10 | import com.antilia.angular.example.angularajax.StatelessMasterDetailPage; 11 | import com.antilia.angular.example.basic.BasicListViewLazyPage; 12 | import com.antilia.angular.example.basic.BasicListViewPage; 13 | import com.antilia.angular.example.filtering.FilterPersonListViewPage; 14 | import com.antilia.angular.example.wicketajax.AngularListViewMountedResourcePage; 15 | import com.antilia.angular.example.wicketajax.AngularListViewPage; 16 | 17 | public class HomePage extends WebPage { 18 | private static final long serialVersionUID = 1L; 19 | 20 | public HomePage(final PageParameters parameters) { 21 | super(parameters); 22 | 23 | 24 | add(new BookmarkablePageLink("basic", BasicListViewPage.class, null)); 25 | add(new BookmarkablePageLink("basiclazy", BasicListViewLazyPage.class, null)); 26 | add(new BookmarkablePageLink("filtering", FilterPersonListViewPage.class, null)); 27 | add(new BookmarkablePageLink("stateless", StatelessMasterDetailPage.class, null)); 28 | 29 | add(new BookmarkablePageLink("link1", AngularListViewPage.class, null)); 30 | add(new BookmarkablePageLink("link2", AngularListViewMountedResourcePage.class, null)); 31 | } 32 | 33 | @Override 34 | public void renderHead(IHeaderResponse response) { 35 | super.renderHead(response); 36 | CoreLibrariesContributor.contribute(WicketApplication.getApplication(), response); 37 | response.render(JavaScriptHeaderItem.forUrl("js/jquery.syntaxhighlighter.min.js")); 38 | response.render(JavaScriptHeaderItem.forScript("$.SyntaxHighlighter.init();","SyntaxHighlighter")); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/RandomString.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular; 2 | 3 | import java.util.Random; 4 | 5 | public class RandomString { 6 | 7 | private static final char[] symbols = new char[36]; 8 | 9 | static { 10 | for (int idx = 0; idx < 10; ++idx) 11 | symbols[idx] = (char) ('0' + idx); 12 | for (int idx = 10; idx < 36; ++idx) 13 | symbols[idx] = (char) ('a' + idx - 10); 14 | } 15 | 16 | private final Random random = new Random(); 17 | 18 | private final char[] buf; 19 | 20 | public RandomString(int length) { 21 | if (length < 1) 22 | throw new IllegalArgumentException("length < 1: " + length); 23 | buf = new char[length]; 24 | } 25 | 26 | public String nextString() { 27 | for (int idx = 0; idx < buf.length; ++idx){ 28 | if(idx%10==0) { 29 | buf[idx] = ' '; 30 | } else { 31 | buf[idx] = symbols[random.nextInt(symbols.length)]; 32 | } 33 | } 34 | return new String(buf); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/TestPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 23 | 24 | 25 |
26 |
    27 |
  • 28 | 29 |
  • 30 |
31 |
32 |
33 | {{selected}} 34 |
35 | 36 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/TestPage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular; 5 | 6 | import org.apache.wicket.markup.html.WebPage; 7 | import org.apache.wicket.model.IModel; 8 | import org.apache.wicket.request.mapper.parameter.PageParameters; 9 | 10 | /** 11 | * @author reiern70 12 | * 13 | */ 14 | public class TestPage extends WebPage { 15 | 16 | /** 17 | * 18 | */ 19 | private static final long serialVersionUID = 1L; 20 | 21 | /** 22 | * 23 | */ 24 | public TestPage() { 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | /** 29 | * @param model 30 | */ 31 | public TestPage(IModel model) { 32 | super(model); 33 | // TODO Auto-generated constructor stub 34 | } 35 | 36 | /** 37 | * @param parameters 38 | */ 39 | public TestPage(PageParameters parameters) { 40 | super(parameters); 41 | // TODO Auto-generated constructor stub 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/WicketApplication.properties: -------------------------------------------------------------------------------- 1 | id = ID 2 | name = Name 3 | lastName = Last Name 4 | age = Age 5 | registered = Registered 6 | search=Search: 7 | sortBy=Sort by: 8 | image = Picture -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/IPersonService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example; 5 | 6 | /** 7 | * @author reiern70 8 | * 9 | */ 10 | public interface IPersonService { 11 | 12 | Person find(Long id); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/Person.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example; 5 | 6 | import java.io.Serializable; 7 | import java.util.Date; 8 | 9 | /** 10 | * @author reiern70 11 | * 12 | */ 13 | public class Person implements Serializable { 14 | 15 | private static final long serialVersionUID = 1L; 16 | 17 | private Long id; 18 | 19 | private String name; 20 | 21 | private String lastName; 22 | 23 | private Integer age; 24 | 25 | private Date registered; 26 | 27 | private String longDescription; 28 | 29 | private String email; 30 | 31 | private String imageUrl; 32 | 33 | private String bigImageUrl; 34 | 35 | /** 36 | * 37 | */ 38 | public Person(Long id) { 39 | this.id = id; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public String getLastName() { 51 | return lastName; 52 | } 53 | 54 | public void setLastName(String lastName) { 55 | this.lastName = lastName; 56 | } 57 | 58 | public Date getRegistered() { 59 | return registered; 60 | } 61 | 62 | public void setRegistered(Date registered) { 63 | this.registered = registered; 64 | } 65 | 66 | public Integer getAge() { 67 | return age; 68 | } 69 | 70 | public void setAge(Integer age) { 71 | this.age = age; 72 | } 73 | 74 | public Long getId() { 75 | return id; 76 | } 77 | 78 | public void setId(Long id) { 79 | this.id = id; 80 | } 81 | 82 | public String getEmail() { 83 | return email; 84 | } 85 | 86 | public void setEmail(String email) { 87 | this.email = email; 88 | } 89 | 90 | public String getImageUrl() { 91 | return imageUrl; 92 | } 93 | 94 | public void setImageUrl(String imageUrl) { 95 | this.imageUrl = imageUrl; 96 | } 97 | 98 | public String getBigImageUrl() { 99 | return bigImageUrl; 100 | } 101 | 102 | public void setBigImageUrl(String bigImageUrl) { 103 | this.bigImageUrl = bigImageUrl; 104 | } 105 | 106 | public String getLongDescription() { 107 | return longDescription; 108 | } 109 | 110 | public void setLongDescription(String longDescription) { 111 | this.longDescription = longDescription; 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/PersonDetailPanel.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

4 | 5 |
6 |
-------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/PersonDetailPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example; 5 | 6 | import org.apache.wicket.AttributeModifier; 7 | import org.apache.wicket.markup.html.WebMarkupContainer; 8 | import org.apache.wicket.markup.html.basic.Label; 9 | import org.apache.wicket.markup.html.panel.Panel; 10 | import org.apache.wicket.model.IModel; 11 | import org.apache.wicket.model.Model; 12 | 13 | /** 14 | * 15 | * @author reiern70 16 | * 17 | */ 18 | public class PersonDetailPanel extends Panel { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * 24 | */ 25 | public PersonDetailPanel(String id, IModel model) { 26 | super(id, model); 27 | add(new Label("name", Model.of(model.getObject().getName() + " " +model.getObject().getLastName()))); 28 | 29 | add(new WebMarkupContainer("image").add(new AttributeModifier("src", model.getObject().getBigImageUrl()))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/PersonsJSonifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example; 5 | 6 | import java.text.DateFormat; 7 | import java.text.SimpleDateFormat; 8 | 9 | import com.antilia.angular.repeater.IJSONifier; 10 | 11 | /** 12 | * @author reiern70 13 | * 14 | */ 15 | public class PersonsJSonifier implements IJSONifier { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | private static final PersonsJSonifier instance = new PersonsJSonifier(); 20 | 21 | private static final DateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy"); 22 | /** 23 | * 24 | */ 25 | private PersonsJSonifier() { 26 | } 27 | 28 | /* (non-Javadoc) 29 | * @see com.antilia.angular.repeater.IJSONifier#toJSON(java.lang.Object) 30 | */ 31 | @Override 32 | public String toJSON(Person bean) { 33 | return "{" 34 | +toJSON("id", Long.toString(bean.getId()), true) 35 | +toJSON("name",bean.getName(), true) 36 | +toJSON("lastName",bean.getLastName(), true) 37 | +toJSON("age",bean.getAge(), true) 38 | +toJSON("email",bean.getEmail(), true) 39 | +toJSON("img",bean.getImageUrl(), true) 40 | +toJSON("registered",DATE_FORMAT.format(bean.getRegistered()), false) 41 | +"}"; 42 | } 43 | 44 | public String toLONGJSON(Person bean) { 45 | return "{" 46 | +toJSON("id", Long.toString(bean.getId()), true) 47 | +toJSON("name",bean.getName(), true) 48 | +toJSON("lastName",bean.getLastName(), true) 49 | +toJSON("age",bean.getAge(), true) 50 | +toJSON("email",bean.getEmail(), true) 51 | +toJSON("img",bean.getImageUrl(), true) 52 | +toJSON("bimg",bean.getBigImageUrl(), true) 53 | +toJSON("ld",bean.getLongDescription(), true) 54 | +toJSON("registered",DATE_FORMAT.format(bean.getRegistered()), false) 55 | +"}"; 56 | } 57 | 58 | private String toJSON(String name, String value, boolean comma) { 59 | return "\""+name+"\":\""+value+"\""+(comma?",":""); 60 | } 61 | 62 | private String toJSON(String name, int value, boolean comma) { 63 | return "\""+name+"\": "+value+""+(comma?",":""); 64 | } 65 | 66 | 67 | /* (non-Javadoc) 68 | * @see com.antilia.angular.repeater.IJSONifier#formJSON(java.lang.String) 69 | */ 70 | @Override 71 | public Person formJSON(String json) { 72 | return null; 73 | } 74 | 75 | public static PersonsJSonifier getInstance() { 76 | return instance; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/angularajax/PersonDetails.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

{{element.name}} {{element.lastName}}

5 |
6 | 7 |
8 |
9 |
    10 |
  1. Email: {{element.email}}
  2. 11 |
  3. Profile: {{element.ld}}
  4. 12 |
13 |
14 | 15 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/angularajax/PersonDetails.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.angularajax; 5 | 6 | import com.antilia.angular.WicketApplication; 7 | import com.antilia.angular.example.Person; 8 | import com.antilia.angular.example.PersonsJSonifier; 9 | import com.antilia.angular.repeater.AngularPanel; 10 | import com.antilia.angular.repeater.OnUpdateEventHandler; 11 | 12 | /** 13 | * @author reiern70 14 | * 15 | */ 16 | public class PersonDetails extends AngularPanel { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | private PersonsJSonifier personsJSonifier; 21 | 22 | /** 23 | * @param id 24 | * @param scope 25 | */ 26 | public PersonDetails(String id, String scope, PersonsJSonifier personsJSonifier) { 27 | super(id, scope); 28 | this.personsJSonifier = personsJSonifier; 29 | } 30 | 31 | @Override 32 | protected void onInitialize() { 33 | super.onInitialize(); 34 | 35 | addHandler(new OnUpdateEventHandler("PersonsList-RowSelected-1") { 36 | 37 | private static final long serialVersionUID = 1L; 38 | 39 | @Override 40 | protected Person getElement(Long id) { 41 | return WicketApplication.getApplication().getPersonService().find(id); 42 | } 43 | 44 | @Override 45 | protected String getJSON(Person bean) { 46 | return personsJSonifier.toLONGJSON(bean); 47 | } 48 | 49 | }); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/angularajax/PersonsAngularListView.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |

4 | 5 |

6 |

7 | 8 | 14 |

15 |
16 |
17 |

Persons

18 |
19 | 20 | 21 | 22 | 25 | 28 | 31 | 34 | 37 | 40 | 41 | 42 | 43 | 44 | 45 | 48 | 51 | 54 | 57 | 60 | 63 | 64 | 65 |
23 | 24 | 26 | 27 | 29 | 30 | 32 | e-mail 33 | 35 | 36 | 38 | 39 |
46 | {{person.id}} 47 | 49 | {{person.name}} 50 | 52 | {{person.lastName}} 53 | 55 | {{person.email}} 56 | 58 | {{person.age}} 59 | 61 | {{person.registered}} 62 |
66 |
67 |
68 |
-------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/angularajax/PersonsAngularListView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.angularajax; 5 | 6 | import com.antilia.angular.WicketApplication; 7 | import com.antilia.angular.example.Person; 8 | import com.antilia.angular.example.PersonsJSonifier; 9 | import com.antilia.angular.repeater.AngularListView; 10 | 11 | /** 12 | * @author reiern70 13 | * 14 | */ 15 | public class PersonsAngularListView extends AngularListView { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | 20 | /** 21 | * Constructor using a page based service. 22 | * @param id 23 | */ 24 | public PersonsAngularListView(String id, String scope, boolean lazy) { 25 | super(id, WicketApplication.PERSONS, PersonsJSonifier.getInstance(), scope , lazy); 26 | } 27 | 28 | 29 | @Override 30 | protected void contributeToScope(StringBuilder scope) { 31 | scope.append("$scope.orderProp = 'age';\n"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/angularajax/StatelessMasterDetailPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Persons 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | 19 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/angularajax/StatelessMasterDetailPage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular.example.angularajax; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.request.mapper.parameter.PageParameters; 5 | 6 | import com.antilia.angular.example.PersonsJSonifier; 7 | import com.antilia.angular.repeater.AngularWebMarkupContainer; 8 | import com.antilia.angular.repeater.EventBroadcasterHandler; 9 | 10 | public class StatelessMasterDetailPage extends WebPage { 11 | private static final long serialVersionUID = 1L; 12 | 13 | public StatelessMasterDetailPage(final PageParameters parameters) { 14 | super(parameters); 15 | 16 | AngularWebMarkupContainer personsContext = new AngularWebMarkupContainer("personsContext", "PersonsContext"); 17 | 18 | personsContext.addHandler(new EventBroadcasterHandler("PersonsList-RowSelected","PersonsList-RowSelected-1")); 19 | 20 | add(personsContext); 21 | 22 | personsContext.add(new PersonsAngularListView("persons", "PersonsList", false)); 23 | 24 | personsContext.add(new PersonDetails("details", "PersonDetails", PersonsJSonifier.getInstance())); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/basic/BasicListViewLazyPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BasicListViewPage 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/basic/BasicListViewLazyPage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.basic; 5 | 6 | import org.apache.wicket.markup.html.WebPage; 7 | 8 | /** 9 | * @author reiern70 10 | * 11 | */ 12 | public class BasicListViewLazyPage extends WebPage { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | /** 17 | * Constructor. 18 | * 19 | */ 20 | public BasicListViewLazyPage() { 21 | add(new BasicPersonListView("persons", true)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/basic/BasicListViewPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BasicListViewPage 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/basic/BasicListViewPage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.basic; 5 | 6 | import org.apache.wicket.markup.html.WebPage; 7 | 8 | /** 9 | * @author reiern70 10 | * 11 | */ 12 | public class BasicListViewPage extends WebPage { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | /** 17 | * Constructor. 18 | * 19 | */ 20 | public BasicListViewPage() { 21 | add(new BasicPersonListView("persons", false)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/basic/BasicPersonListView.html: -------------------------------------------------------------------------------- 1 | 2 | {{element.name}}-{{element.lastName}} 3 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/basic/BasicPersonListView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.basic; 5 | 6 | import com.antilia.angular.WicketApplication; 7 | import com.antilia.angular.example.Person; 8 | import com.antilia.angular.example.PersonsJSonifier; 9 | import com.antilia.angular.repeater.AngularListView; 10 | 11 | /** 12 | * @author reiern70 13 | * 14 | */ 15 | public class BasicPersonListView extends AngularListView { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | public BasicPersonListView(String id, boolean lazy) { 20 | super(id, WicketApplication.PERSONS, PersonsJSonifier.getInstance(), "Persons", lazy); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/filtering/FilterPersonListViewPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Filtering at client 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/filtering/FilterPersonListViewPage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.filtering; 5 | 6 | import org.apache.wicket.markup.html.WebPage; 7 | 8 | /** 9 | * @author reiern70 10 | * 11 | */ 12 | public class FilterPersonListViewPage extends WebPage { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | /** 17 | * Constructor. 18 | * 19 | */ 20 | public FilterPersonListViewPage() { 21 | add(new PersonsListView("persons", true)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/filtering/PersonsListView.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |

6 | 7 |

8 |

9 | 10 | 16 |

17 |
18 |
19 |

Persons

20 |
21 | 22 | 23 | 24 | 27 | 30 | 33 | 36 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 53 | 56 | 59 | 62 | 65 | 66 | 67 |
25 | 26 | 28 | 29 | 31 | 32 | 34 | 35 | 37 | 38 | 40 | 41 |
48 | {{person.id}} 49 | 51 | {{person.name}} 52 | 54 | {{person.lastName}} 55 | 57 | 58 | 60 | {{person.age}} 61 | 63 | {{person.registered}} 64 |
68 |
69 |
70 |
71 |
72 |
-------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/filtering/PersonsListView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.filtering; 5 | 6 | import com.antilia.angular.WicketApplication; 7 | import com.antilia.angular.example.Person; 8 | import com.antilia.angular.example.PersonsJSonifier; 9 | import com.antilia.angular.repeater.AngularListView; 10 | 11 | /** 12 | * @author reiern70 13 | * 14 | */ 15 | public class PersonsListView extends AngularListView { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | 20 | /** 21 | * Constructor using a page based service. 22 | * @param id 23 | */ 24 | public PersonsListView(String id, boolean lazy) { 25 | super(id, WicketApplication.PERSONS, PersonsJSonifier.getInstance(), null, lazy); 26 | } 27 | 28 | /** 29 | * Constructor using 30 | * 31 | * @param id 32 | * @param mountPath 33 | */ 34 | public PersonsListView(String id, String mountPath) { 35 | super(id, mountPath, null); 36 | } 37 | 38 | 39 | @Override 40 | protected void contributeToScope(StringBuilder scope) { 41 | scope.append("$scope.orderProp = 'age';\n"); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/wicketajax/AngularListViewMountedResourcePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Persons 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/wicketajax/AngularListViewMountedResourcePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular.example.wicketajax; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.request.mapper.parameter.PageParameters; 5 | 6 | import com.antilia.angular.WicketApplication; 7 | 8 | public class AngularListViewMountedResourcePage extends WebPage { 9 | private static final long serialVersionUID = 1L; 10 | 11 | public AngularListViewMountedResourcePage(final PageParameters parameters) { 12 | super(parameters); 13 | 14 | add(new PersonsListView("persons", urlFor(WicketApplication.getPersonsResource(), null).toString())); 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/wicketajax/AngularListViewPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Persons 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/wicketajax/AngularListViewPage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular.example.wicketajax; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.request.mapper.parameter.PageParameters; 5 | 6 | 7 | public class AngularListViewPage extends WebPage { 8 | private static final long serialVersionUID = 1L; 9 | 10 | public AngularListViewPage(final PageParameters parameters) { 11 | super(parameters); 12 | 13 | add(new PersonsListView("persons", false)); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/wicketajax/PersonsListView.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |
7 |
8 |

9 | 10 |

11 |

12 | 13 | 19 |

20 |
21 |
22 |

Persons

23 |
24 | 25 | 26 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 46 | 47 | 48 | 49 | 50 | 53 | 56 | 59 | 62 | 65 | 68 | 69 | 70 |
28 | 29 | 31 | 32 | 34 | 35 | 37 | 38 | 40 | 41 | 43 | 44 |
51 | {{person.id}} 52 | 54 | {{person.name}} 55 | 57 | {{person.lastName}} 58 | 60 | 61 | 63 | {{person.age}} 64 | 66 | {{person.registered}} 67 |
71 |
72 |
73 |
74 |
75 |
-------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/com/antilia/angular/example/wicketajax/PersonsListView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.example.wicketajax; 5 | 6 | import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; 7 | import org.apache.wicket.ajax.AjaxRequestTarget; 8 | import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; 9 | import org.apache.wicket.markup.head.IHeaderResponse; 10 | import org.apache.wicket.markup.head.OnDomReadyHeaderItem; 11 | import org.apache.wicket.markup.html.form.Form; 12 | import org.apache.wicket.model.Model; 13 | import org.apache.wicket.request.cycle.RequestCycle; 14 | 15 | import com.antilia.angular.WicketApplication; 16 | import com.antilia.angular.example.Person; 17 | import com.antilia.angular.example.PersonDetailPanel; 18 | import com.antilia.angular.example.PersonsJSonifier; 19 | import com.antilia.angular.repeater.AngularListView; 20 | 21 | /** 22 | * @author reiern70 23 | * 24 | */ 25 | public class PersonsListView extends AngularListView { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | private ModalWindow modalWindow; 30 | 31 | private static final String userID = "userID"; 32 | 33 | private AbstractDefaultAjaxBehavior ajaxBehavior; 34 | 35 | /** 36 | * Constructor using a page based service. 37 | * @param id 38 | */ 39 | public PersonsListView(String id, boolean lazy) { 40 | super(id, WicketApplication.PERSONS, PersonsJSonifier.getInstance(), null, lazy); 41 | } 42 | 43 | /** 44 | * Constructor using 45 | * 46 | * @param id 47 | * @param mountPath 48 | */ 49 | public PersonsListView(String id, String mountPath) { 50 | super(id, mountPath, null); 51 | } 52 | 53 | @Override 54 | protected void onInitialize() { 55 | super.onInitialize(); 56 | Form form = new Form("form"); 57 | add(form); 58 | form.add(modalWindow = new ModalWindow("modalWindow")); 59 | 60 | add(ajaxBehavior = new AbstractDefaultAjaxBehavior() { 61 | 62 | private static final long serialVersionUID = 1L; 63 | 64 | @Override 65 | protected void respond(AjaxRequestTarget target) { 66 | String personId = RequestCycle.get().getRequest().getRequestParameters().getParameterValue(userID).toString(); 67 | Person person = WicketApplication.getApplication().getPersonService().find(Long.parseLong(personId)); 68 | modalWindow.setContent(new PersonDetailPanel(modalWindow.getContentId(), Model.of(person))); 69 | modalWindow.show(target); 70 | } 71 | }); 72 | } 73 | 74 | @Override 75 | public void renderHead(IHeaderResponse response) { 76 | super.renderHead(response); 77 | 78 | StringBuilder scope = new StringBuilder(); 79 | scope.append("ajaxUrl = '"); 80 | scope.append(ajaxBehavior.getCallbackUrl()); 81 | scope.append("';\n"); 82 | scope.append("showDetails = function(id) {\n"); 83 | scope.append("var url = ajaxUrl;\n"); 84 | scope.append("Wicket.Ajax.get({'u':url, 'ep': {'userID': id}});"); 85 | scope.append("}\n"); 86 | response.render(OnDomReadyHeaderItem.forScript(scope)); 87 | } 88 | 89 | @Override 90 | protected void contributeToScope(StringBuilder scope) { 91 | scope.append("$scope.orderProp = 'age';\n"); 92 | 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/jgravatar/GravatarDefaultImage.java: -------------------------------------------------------------------------------- 1 | package jgravatar; 2 | 3 | public enum GravatarDefaultImage { 4 | 5 | GRAVATAR_ICON(""), 6 | 7 | IDENTICON("identicon"), 8 | 9 | MONSTERID("monsterid"), 10 | 11 | WAVATAR("wavatar"), 12 | 13 | HTTP_404("404"); 14 | 15 | private String code; 16 | 17 | private GravatarDefaultImage(String code) { 18 | this.code = code; 19 | } 20 | 21 | public String getCode() { 22 | return code; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/jgravatar/GravatarDownloadException.java: -------------------------------------------------------------------------------- 1 | package jgravatar; 2 | 3 | public class GravatarDownloadException extends RuntimeException { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public GravatarDownloadException(Throwable cause) { 8 | super("Gravatar could not be downloaded: " + cause.getMessage(), cause); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/java/jgravatar/GravatarRating.java: -------------------------------------------------------------------------------- 1 | package jgravatar; 2 | 3 | public enum GravatarRating { 4 | 5 | GENERAL_AUDIENCES("g"), 6 | 7 | PARENTAL_GUIDANCE_SUGGESTED("pg"), 8 | 9 | RESTRICTED("r"), 10 | 11 | XPLICIT("x"); 12 | 13 | private String code; 14 | 15 | private GravatarRating(String code) { 16 | this.code = code; 17 | } 18 | 19 | public String getCode() { 20 | return code; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | wicket-angular-demo 7 | 8 | 18 | 19 | 20 | wicket.wicket-angular-demo 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.angular.WicketApplication 25 | 26 | 27 | 28 | 29 | wicket.wicket-angular-demo 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/css/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-angular-parent/wicket-angular-demo/src/main/webapp/css/.gitignore -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/css/app.css: -------------------------------------------------------------------------------- 1 | /* app css stylesheet */ 2 | 3 | body { 4 | padding-top: 20px; 5 | font-family: "Verdana"; 6 | font-size: 12pt !important; 7 | } 8 | 9 | p { 10 | font-size: 1.0em !important; 11 | } 12 | 13 | section { 14 | border-top: 1px solid graytext; 15 | padding-bottom: 20px !important; 16 | } 17 | 18 | h3, h2, .code { 19 | margin-bottom: 10px !important; 20 | margin-top: 10px !important; 21 | } 22 | 23 | section h3, section h2 { 24 | background: graytext !important; 25 | padding-left: 10px; 26 | margin-top: 20px !important; 27 | margin-bottom: 20px !important; 28 | } 29 | 30 | h2.persons { 31 | width: 620px; 32 | text-align: center; 33 | font-weight: 1.2em; 34 | margin-bottom: 10px; 35 | } 36 | 37 | .persons .odd { 38 | background-color: graytext; 39 | color: white; 40 | } 41 | 42 | .persons .odd a { 43 | color: white; 44 | } 45 | 46 | div.persons { 47 | border: 1px solid graytext; 48 | } 49 | 50 | div.persons { 51 | height: 400px; 52 | width: 600px; 53 | overflow: auto; 54 | } 55 | 56 | div.persons table { 57 | width: 100%; 58 | } 59 | 60 | .PersonDetail img { 61 | float: right; 62 | } 63 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/img/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-angular-parent/wicket-angular-demo/src/main/webapp/img/.gitignore -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-angular-parent/wicket-angular-demo/src/main/webapp/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-angular-parent/wicket-angular-demo/src/main/webapp/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/js/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* App Module */ 4 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/js/controllers.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Controllers */ 4 | 5 | function PhoneListCtrl($scope) { 6 | $scope.phones = [ 7 | {"name": "Nexus S", 8 | "snippet": "Fast just got faster with Nexus S."}, 9 | {"name": "Motorola XOOM™ with Wi-Fi", 10 | "snippet": "The Next, Next Generation tablet."}, 11 | {"name": "MOTOROLA XOOM™", 12 | "snippet": "The Next, Next Generation tablet."} 13 | ]; 14 | } 15 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/js/directives.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Directives */ 4 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/js/filters.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Filters */ 4 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/js/services.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* Services */ 4 | 5 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/lib/angular/angular-cookies.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.0.2 3 | (c) 2010-2012 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(m,f,l){'use strict';f.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(d,c){var b={},g={},h,i=!1,j=f.copy,k=f.isUndefined;c.addPollFn(function(){var a=c.cookies();h!=a&&(h=a,j(a,g),j(a,b),i&&d.$apply())})();i=!0;d.$watch(function(){var a,e,d;for(a in g)k(b[a])&&c.cookies(a,l);for(a in b)e=b[a],f.isString(e)?e!==g[a]&&(c.cookies(a,e),d=!0):f.isDefined(g[a])?b[a]=g[a]:delete b[a];if(d)for(a in e=c.cookies(),b)b[a]!==e[a]&&(k(e[a])?delete b[a]:b[a]=e[a])});return b}]).factory("$cookieStore", 7 | ["$cookies",function(d){return{get:function(c){return f.fromJson(d[c])},put:function(c,b){d[c]=f.toJson(b)},remove:function(c){delete d[c]}}}])})(window,window.angular); 8 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/lib/angular/angular-loader.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.0.2 3 | (c) 2010-2012 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(i){'use strict';function d(c,b,e){return c[b]||(c[b]=e())}return d(d(i,"angular",Object),"module",function(){var c={};return function(b,e,f){e&&c.hasOwnProperty(b)&&(c[b]=null);return d(c,b,function(){function a(a,b,d){return function(){c[d||"push"]([a,b,arguments]);return g}}if(!e)throw Error("No module: "+b);var c=[],d=[],h=a("$injector","invoke"),g={_invokeQueue:c,_runBlocks:d,requires:e,name:b,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"), 7 | value:a("$provide","value"),constant:a("$provide","constant","unshift"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:h,run:function(a){d.push(a);return this}};f&&h(f);return g})}})})(window); 8 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/lib/angular/angular-resource.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.0.2 3 | (c) 2010-2012 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(A,f,u){'use strict';f.module("ngResource",["ng"]).factory("$resource",["$http","$parse",function(v,w){function g(b,c){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(c?null:/%20/g,"+")}function l(b,c){this.template=b+="#";this.defaults=c||{};var a=this.urlParams={};j(b.split(/\W/),function(c){c&&b.match(RegExp("[^\\\\]:"+c+"\\W"))&&(a[c]=!0)});this.template=b.replace(/\\:/g,":")}function s(b,c,a){function f(d){var b= 7 | {};j(c||{},function(a,x){var m;a.charAt&&a.charAt(0)=="@"?(m=a.substr(1),m=w(m)(d)):m=a;b[x]=m});return b}function e(a){t(a||{},this)}var y=new l(b),a=r({},z,a);j(a,function(d,g){var l=d.method=="POST"||d.method=="PUT"||d.method=="PATCH";e[g]=function(a,b,c,g){var i={},h,k=o,p=null;switch(arguments.length){case 4:p=g,k=c;case 3:case 2:if(q(b)){if(q(a)){k=a;p=b;break}k=b;p=c}else{i=a;h=b;k=c;break}case 1:q(a)?k=a:l?h=a:i=a;break;case 0:break;default:throw"Expected between 0-4 arguments [params, data, success, error], got "+ 8 | arguments.length+" arguments.";}var n=this instanceof e?this:d.isArray?[]:new e(h);v({method:d.method,url:y.url(r({},f(h),d.params||{},i)),data:h}).then(function(a){var b=a.data;if(b)d.isArray?(n.length=0,j(b,function(a){n.push(new e(a))})):t(b,n);(k||o)(n,a.headers)},p);return n};e.bind=function(d){return s(b,r({},c,d),a)};e.prototype["$"+g]=function(a,b,d){var c=f(this),i=o,h;switch(arguments.length){case 3:c=a;i=b;h=d;break;case 2:case 1:q(a)?(i=a,h=b):(c=a,i=b||o);case 0:break;default:throw"Expected between 1-3 arguments [params, success, error], got "+ 9 | arguments.length+" arguments.";}e[g].call(this,c,l?this:u,i,h)}});return e}var z={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}},o=f.noop,j=f.forEach,r=f.extend,t=f.copy,q=f.isFunction;l.prototype={url:function(b){var c=this,a=this.template,f,b=b||{};j(this.urlParams,function(e,d){f=g(b[d]||c.defaults[d]||"",!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+");a=a.replace(RegExp(":"+d+"(\\W)"),f+"$1")});var a= 10 | a.replace(/\/?#$/,""),e=[];j(b,function(a,b){c.urlParams[b]||e.push(g(b)+"="+g(a))});e.sort();a=a.replace(/\/*$/,"");return a+(e.length?"?"+e.join("&"):"")}};return s}])})(window,window.angular); 11 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/lib/angular/angular-sanitize.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.0.2 3 | (c) 2010-2012 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(I,g){'use strict';function i(a){var d={},a=a.split(","),b;for(b=0;b=0;e--)if(f[e]==b)break;if(e>=0){for(c=f.length-1;c>=e;c--)d.end&&d.end(f[c]);f.length= 7 | e}}var c,h,f=[],j=a;for(f.last=function(){return f[f.length-1]};a;){h=!0;if(!f.last()||!q[f.last()]){if(a.indexOf("<\!--")===0)c=a.indexOf("--\>"),c>=0&&(d.comment&&d.comment(a.substring(4,c)),a=a.substring(c+3),h=!1);else if(B.test(a)){if(c=a.match(r))a=a.substring(c[0].length),c[0].replace(r,e),h=!1}else if(C.test(a)&&(c=a.match(s)))a=a.substring(c[0].length),c[0].replace(s,b),h=!1;h&&(c=a.indexOf("<"),h=c<0?a:a.substring(0,c),a=c<0?"":a.substring(c),d.chars&&d.chars(k(h)))}else a=a.replace(RegExp("(.*)<\\s*\\/\\s*"+ 8 | f.last()+"[^>]*>","i"),function(b,a){a=a.replace(D,"$1").replace(E,"$1");d.chars&&d.chars(k(a));return""}),e("",f.last());if(a==j)throw"Parse Error: "+a;j=a}e()}function k(a){l.innerHTML=a.replace(//g,">")}function u(a){var d=!1,b=g.bind(a,a.push);return{start:function(a,c,h){a=g.lowercase(a);!d&&q[a]&&(d=a);!d&&v[a]== 9 | !0&&(b("<"),b(a),g.forEach(c,function(a,c){var e=g.lowercase(c);if(G[e]==!0&&(w[e]!==!0||a.match(H)))b(" "),b(c),b('="'),b(t(a)),b('"')}),b(h?"/>":">"))},end:function(a){a=g.lowercase(a);!d&&v[a]==!0&&(b(""));a==d&&(d=!1)},chars:function(a){d||b(t(a))}}}var s=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,r=/^<\s*\/\s*([\w:-]+)[^>]*>/,A=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,C=/^/g, 10 | E=//g,H=/^((ftp|https?):\/\/|mailto:|#)/,F=/([^\#-~| |!])/g,p=i("area,br,col,hr,img,wbr"),x=i("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),y=i("rp,rt"),o=g.extend({},y,x),m=g.extend({},x,i("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),n=g.extend({},y,i("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")), 11 | q=i("script,style"),v=g.extend({},p,m,n,o),w=i("background,cite,href,longdesc,src,usemap"),G=g.extend({},w,i("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,span,start,summary,target,title,type,valign,value,vspace,width")),l=document.createElement("pre");g.module("ngSanitize",[]).value("$sanitize",function(a){var d=[]; 12 | z(a,u(d));return d.join("")});g.module("ngSanitize").directive("ngBindHtml",["$sanitize",function(a){return function(d,b,e){b.addClass("ng-binding").data("$binding",e.ngBindHtml);d.$watch(e.ngBindHtml,function(c){c=a(c);b.html(c||"")})}}]);g.module("ngSanitize").filter("linky",function(){var a=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.\;\,\(\)\{\}\<\>]/,d=/^mailto:/;return function(b){if(!b)return b;for(var e=b,c=[],h=u(c),f,g;b=e.match(a);)f=b[0],b[2]==b[3]&&(f="mailto:"+f),g=b.index, 13 | h.chars(e.substr(0,g)),h.start("a",{href:f}),h.chars(b[0].replace(d,"")),h.end("a"),e=e.substring(g+b[0].length);h.chars(e);return c.join("")}})})(window,window.angular); 14 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/lib/angular/version.txt: -------------------------------------------------------------------------------- 1 | 1.0.2 2 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-angular-parent/wicket-angular-demo/src/main/webapp/logo.png -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} 2 | h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } 3 | body { margin:0;padding:0;} 4 | #hd { 5 | width : 100%; 6 | height : 87px; 7 | background-color : #092E67; 8 | margin-top : 0; 9 | padding-top : 10px; 10 | border-bottom : 1px solid #888; 11 | z-index : 0; 12 | } 13 | #ft { 14 | position : absolute; 15 | bottom : 0; 16 | width : 100%; 17 | height : 99px; 18 | background-color : #6493D2; 19 | border-top : 1px solid #888; 20 | z-index : 0; 21 | } 22 | #logo,#bd { 23 | width : 650px; 24 | margin: 0 auto; 25 | padding: 25px 50px 0 50px; 26 | } 27 | #logo h1 { 28 | color : white; 29 | font-size:36pt; 30 | display: inline; 31 | } 32 | #logo img { 33 | display:inline; 34 | vertical-align: bottom; 35 | margin-left : 50px; 36 | margin-right : 5px; 37 | } 38 | body { margin-top : 0; padding-top : 0;} 39 | #logo, #logo h1 { margin-top : 0; padding-top : 0;} 40 | #bd { 41 | position : absolute; 42 | top : 75px; 43 | bottom : 75px; 44 | left : 50%; 45 | margin-left : -325px; 46 | z-index : 1; 47 | overflow: auto; 48 | background-color : #fff; 49 | -webkit-border-radius: 10px; 50 | -moz-border-radius: 10px; 51 | border-radius: 10px; 52 | -moz-box-shadow: 0px 0px 10px #888; 53 | -webkit-box-shadow: 0px 0px 10px #888; 54 | box-shadow: 0px 0px 10px #888; 55 | } 56 | a, a:visited, a:hover, a:active { 57 | color : #6493D2; 58 | } 59 | h2 { 60 | padding : 0; margin:0; 61 | font-size:36pt; 62 | color:#FF5500; 63 | } 64 | h3 { 65 | padding : 0; margin:0; 66 | font-size:24pt; 67 | color:#092E67; 68 | } -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/test/java/com/antilia/Angular.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.time.Duration; 4 | import org.eclipse.jetty.server.Server; 5 | import org.eclipse.jetty.server.bio.SocketConnector; 6 | import org.eclipse.jetty.server.ssl.SslSocketConnector; 7 | import org.eclipse.jetty.util.resource.Resource; 8 | import org.eclipse.jetty.util.ssl.SslContextFactory; 9 | import org.eclipse.jetty.webapp.WebAppContext; 10 | 11 | public class Angular { 12 | public static void main(String[] args) throws Exception { 13 | int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); 14 | 15 | Server server = new Server(); 16 | SocketConnector connector = new SocketConnector(); 17 | 18 | // Set some timeout options to make debugging easier. 19 | connector.setMaxIdleTime(timeout); 20 | connector.setSoLingerTime(-1); 21 | connector.setPort(8080); 22 | server.addConnector(connector); 23 | 24 | Resource keystore = Resource.newClassPathResource("/keystore"); 25 | if (keystore != null && keystore.exists()) { 26 | // if a keystore for a SSL certificate is available, start a SSL 27 | // connector on port 8443. 28 | // By default, the quickstart comes with a Apache Wicket Quickstart 29 | // Certificate that expires about half way september 2021. Do not 30 | // use this certificate anywhere important as the passwords are 31 | // available in the source. 32 | 33 | connector.setConfidentialPort(8443); 34 | 35 | SslContextFactory factory = new SslContextFactory(); 36 | factory.setKeyStoreResource(keystore); 37 | factory.setKeyStorePassword("wicket"); 38 | factory.setTrustStoreResource(keystore); 39 | factory.setKeyManagerPassword("wicket"); 40 | SslSocketConnector sslConnector = new SslSocketConnector(factory); 41 | sslConnector.setMaxIdleTime(timeout); 42 | sslConnector.setPort(8443); 43 | sslConnector.setAcceptors(4); 44 | server.addConnector(sslConnector); 45 | 46 | System.out.println("SSL access to the quickstart has been enabled on port 8443"); 47 | System.out.println("You can access the application using SSL on https://localhost:8443"); 48 | System.out.println(); 49 | } 50 | 51 | WebAppContext bb = new WebAppContext(); 52 | bb.setServer(server); 53 | bb.setContextPath("/angular"); 54 | bb.setWar("src/main/webapp"); 55 | 56 | // START JMX SERVER 57 | // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); 58 | // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); 59 | // server.getContainer().addEventListener(mBeanContainer); 60 | // mBeanContainer.start(); 61 | 62 | server.setHandler(bb); 63 | 64 | try { 65 | System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); 66 | server.start(); 67 | System.in.read(); 68 | System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); 69 | server.stop(); 70 | server.join(); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.exit(1); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/test/java/com/antilia/Bla.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | public class Bla { 4 | 5 | public Bla() { 6 | // TODO Auto-generated constructor stub 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular-demo/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-angular-parent/wicket-angular-demo/src/test/resources/keystore -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/AngularListView.html: -------------------------------------------------------------------------------- 1 | 2 |
    3 |
  • 4 | 5 |
  • 6 |
7 |
-------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/AngularPaginatedView.html: -------------------------------------------------------------------------------- 1 | 2 |
    3 |
  • 4 | 5 |
  • 6 |
7 |
-------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/AngularPaginatedView.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular.repeater; 2 | 3 | import java.util.Iterator; 4 | 5 | import org.apache.wicket.AttributeModifier; 6 | import org.apache.wicket.IResourceListener; 7 | import org.apache.wicket.markup.head.IHeaderResponse; 8 | import org.apache.wicket.markup.head.JavaScriptHeaderItem; 9 | import org.apache.wicket.markup.html.panel.Panel; 10 | import org.apache.wicket.markup.repeater.data.IDataProvider; 11 | import org.apache.wicket.model.Model; 12 | 13 | /** 14 | * 15 | * @author reiern70 16 | */ 17 | public class AngularPaginatedView extends Panel implements IResourceListener { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | private IJSONifier ijsoNifier; 22 | 23 | private IDataProvider dataProvider; 24 | 25 | private int pageSize; 26 | 27 | private String viewName; 28 | 29 | 30 | /** 31 | * @param id 32 | */ 33 | public AngularPaginatedView(String id, IDataProvider dataProvider, int pageSize, IJSONifier ijsoNifier) { 34 | super(id); 35 | this.dataProvider = dataProvider; 36 | this.pageSize = pageSize; 37 | this.ijsoNifier = ijsoNifier; 38 | this.setOutputMarkupId(true); 39 | this.viewName = "AngularRepeatingView"+getMarkupId(); 40 | this.add(new AttributeModifier("ng-controller", Model.of(this.viewName))); 41 | } 42 | 43 | @Override 44 | public void onResourceRequested() { 45 | 46 | } 47 | 48 | @Override 49 | public void renderHead(IHeaderResponse response) { 50 | long size = dataProvider.size(); 51 | StringBuilder builder = new StringBuilder(); 52 | builder.append("function "); 53 | builder.append(viewName); 54 | builder.append("($scope) {\n"); 55 | builder.append("$scope.size="); 56 | builder.append(size); 57 | builder.append(";\n"); 58 | builder.append("$scope.elements = ["); 59 | Iterator it = dataProvider.iterator(0, pageSize); 60 | while(it.hasNext()) { 61 | builder.append(ijsoNifier.toJSON(it.next())); 62 | builder.append(","); 63 | } 64 | builder.append("];\n"); 65 | builder.append("}\n"); 66 | response.render(JavaScriptHeaderItem.forScript(builder.toString(), null)); 67 | } 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/EventBroadcasterHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.repeater; 5 | 6 | import java.util.Map; 7 | 8 | import org.apache.wicket.request.Request; 9 | import org.apache.wicket.request.http.WebResponse; 10 | 11 | /** 12 | * 13 | * IAngularRequestHandler used to catch an event and broadcast a new one. 14 | * 15 | * @author reiern70 16 | * 17 | */ 18 | public class EventBroadcasterHandler implements IAngularRequestHandler { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | private String inEvent; 23 | 24 | private String outEvent; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param inEvent 30 | * @param outEvent 31 | */ 32 | public EventBroadcasterHandler(String inEvent, String outEvent) { 33 | this.inEvent = inEvent; 34 | this.outEvent = outEvent; 35 | } 36 | 37 | /* (non-Javadoc) 38 | * @see com.antilia.angular.repeater.IAngularRequestHandler#canHandleRequest(org.apache.wicket.request.Request) 39 | */ 40 | @Override 41 | public boolean canHandleRequest(Request request) { 42 | return false; 43 | } 44 | 45 | /* (non-Javadoc) 46 | * @see com.antilia.angular.repeater.IAngularRequestHandler#handleRequest(org.apache.wicket.request.Request, org.apache.wicket.request.http.WebResponse) 47 | */ 48 | @Override 49 | public void handleRequest(Request request, WebResponse response) { 50 | 51 | } 52 | 53 | 54 | /* (non-Javadoc) 55 | * @see com.antilia.angular.repeater.IAngularRequestHandler#contributeToScope(java.util.Map) 56 | */ 57 | @Override 58 | public String contributeToScope(Map variables) { 59 | StringBuilder builder = new StringBuilder(); 60 | builder.append("$scope.$on('"); 61 | builder.append(inEvent); 62 | builder.append("', function(event, args) {\n"); 63 | builder.append("$scope.$broadcast('"); 64 | builder.append(outEvent); 65 | builder.append("', args)\n"); 66 | builder.append("});"); 67 | return builder.toString(); 68 | 69 | } 70 | 71 | public String getOutEvent() { 72 | return outEvent; 73 | } 74 | 75 | public void setOutEvent(String outEvent) { 76 | this.outEvent = outEvent; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/IAngularRequestHandler.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular.repeater; 2 | 3 | import java.io.Serializable; 4 | import java.util.Map; 5 | 6 | import org.apache.wicket.request.Request; 7 | import org.apache.wicket.request.http.WebResponse; 8 | 9 | /** 10 | * 11 | * @author reiern70 12 | * 13 | */ 14 | public interface IAngularRequestHandler extends Serializable { 15 | 16 | /** 17 | * Returns true if it can handle request. 18 | * @param request 19 | * @return 20 | */ 21 | public boolean canHandleRequest(Request request); 22 | 23 | /** 24 | * Handles the request. 25 | * 26 | * @param request 27 | * @param response 28 | */ 29 | public void handleRequest(Request request, WebResponse response); 30 | 31 | 32 | /** 33 | * Allows handler to contribute to scope. 34 | * 35 | * @param variables 36 | * @return 37 | */ 38 | public String contributeToScope(Map variables); 39 | } 40 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/IJSONifier.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.repeater; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * Converter from a bean to JSON and vice versa. 10 | * 11 | * @author Ernesto Reinaldo Barreiro (reiern70). 12 | * 13 | * the type of the object to translate. 14 | */ 15 | public interface IJSONifier extends Serializable { 16 | 17 | 18 | /** 19 | * Translates an object to JSON. 20 | * 21 | * @param bean 22 | * @return 23 | */ 24 | String toJSON(B bean); 25 | 26 | /** 27 | * Translates JSON to the object. 28 | * 29 | * @param json 30 | * @return 31 | */ 32 | B formJSON(String json); 33 | } 34 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/JsonAngularListViewResourceReference.java: -------------------------------------------------------------------------------- 1 | package com.antilia.angular.repeater; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.util.Iterator; 5 | 6 | import org.apache.wicket.request.resource.IResource; 7 | import org.apache.wicket.request.resource.ResourceReference; 8 | import org.apache.wicket.request.resource.ResourceStreamResource; 9 | import org.apache.wicket.util.resource.StringResourceStream; 10 | 11 | 12 | 13 | /** 14 | * A resource that serves JSON for stateless . You have to mount at application init like. E.g. 15 | * 16 | *

17 | *

18 |  * 	mountResource(CATEGORIES_JSON, new JsonAngularListViewResourceReference() {
19 |  * 			
20 |  * 			private static final long serialVersionUID = 1L;
21 |  * 	
22 |  * 			protected ChoiceProvider getChoiceProvider() {
23 |  * 				return CategoriesTextChoiceProvider.getInstance();
24 |  * 			}
25 |  * 		});
26 |  * 		
27 |  * 
28 | *

29 | * 30 | * and then on component you add 31 | * 32 | *

33 | *

34 |  *  	Select2MultiChoice c = new Select2MultiChoice("categories", new PropertyModel>(searchBean, "translations"), CategoriesTextChoiceProvider.getInstance());
35 |  *  	c.getSettings().setStateless(true);
36 |  *  	c.getSettings().setMountPath(Application.CATEGORIES_JSON);
37 |  *  
38 | *

39 | * 40 | * @author Ernesto Reinaldo Barreiro (reiern70@mail.com). 41 | */ 42 | public abstract class JsonAngularListViewResourceReference extends ResourceReference { 43 | private static final long serialVersionUID = 1L; 44 | 45 | public JsonAngularListViewResourceReference() { 46 | super(JsonAngularListViewResourceReference.class, "images"); 47 | } 48 | 49 | @Override 50 | public IResource getResource() { 51 | ByteArrayOutputStream webResponse = new ByteArrayOutputStream(); 52 | AngularListView.generateJSON(getIjsoNifier(), getListIterator(), webResponse); 53 | StringResourceStream resourceStream = new StringResourceStream(webResponse.toString(), "application/json"); 54 | return new ResourceStreamResource(resourceStream); 55 | } 56 | 57 | /** 58 | * The choice provider. 59 | * 60 | * @return 61 | */ 62 | protected abstract IJSONifier getIjsoNifier(); 63 | 64 | protected abstract Iterator getListIterator(); 65 | 66 | } 67 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/OnUpdateEventHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.angular.repeater; 5 | 6 | import java.util.Map; 7 | 8 | import org.apache.wicket.request.Request; 9 | import org.apache.wicket.request.http.WebResponse; 10 | import org.apache.wicket.util.template.PackageTextTemplate; 11 | 12 | /** 13 | * 14 | * IAngularRequestHandler used to update 15 | * 16 | * @author reiern70 17 | * 18 | * B the class 19 | */ 20 | public abstract class OnUpdateEventHandler implements IAngularRequestHandler { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private static final String elementId = "_elementId"; 25 | 26 | private String updateEvent; 27 | /** 28 | * 29 | */ 30 | public OnUpdateEventHandler(String updateEvent) { 31 | this.updateEvent = updateEvent; 32 | } 33 | 34 | /* (non-Javadoc) 35 | * @see com.antilia.angular.repeater.IAngularRequestHandler#canHandleRequest(org.apache.wicket.request.Request) 36 | */ 37 | @Override 38 | public boolean canHandleRequest(Request request) { 39 | return request.getRequestParameters().getParameterValue(OnUpdateEventHandler.elementId).toString() != null; 40 | } 41 | 42 | /* (non-Javadoc) 43 | * @see com.antilia.angular.repeater.IAngularRequestHandler#handleRequest(org.apache.wicket.request.Request, org.apache.wicket.request.http.WebResponse) 44 | */ 45 | @Override 46 | public void handleRequest(Request request, WebResponse response) { 47 | response.setContentType("application/json"); 48 | Long elementId = Long.parseLong(request.getRequestParameters().getParameterValue(OnUpdateEventHandler.elementId).toString()); 49 | B bean = getElement(elementId); 50 | if(bean != null) { 51 | response.write(getJSON(bean)); 52 | } else { 53 | response.write("{\"error\": \"could not find bean with ID: "+elementId+"\"}"); 54 | } 55 | } 56 | 57 | /** 58 | * Returns the element given the ID. 59 | * 60 | * @param id 61 | * @return 62 | */ 63 | protected abstract B getElement(Long id); 64 | 65 | /** 66 | * Returns the JSON representation for the bean. 67 | * 68 | * @param bean 69 | * @return 70 | */ 71 | protected abstract String getJSON(B bean); 72 | 73 | /* (non-Javadoc) 74 | * @see com.antilia.angular.repeater.IAngularRequestHandler#contributeToScope(java.util.Map) 75 | */ 76 | @Override 77 | public String contributeToScope(Map variables) { 78 | variables.put("elementId", elementId); 79 | variables.put("updateEvent", updateEvent); 80 | @SuppressWarnings("resource") 81 | PackageTextTemplate scriptTemplate = new PackageTextTemplate(OnUpdateEventHandler.class, "updatedetails.js"); 82 | return scriptTemplate.asString(variables); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/angularListView.js: -------------------------------------------------------------------------------- 1 | function ${scope} ($scope, $http ${additionalParams}) { 2 | 3 | ${extraContributions}; 4 | 5 | // selected row. 6 | $scope.selected=null; 7 | 8 | $scope.selectRow = function(id) { 9 | $scope.selected = id; 10 | var args = {'selected': $scope.elements[id]}; 11 | var event = '${scope}-' + 'RowSelected'; 12 | $scope.$emit(event, args); 13 | }; 14 | } -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/angularPanel.js: -------------------------------------------------------------------------------- 1 | function ${scope} ($scope, $http ${additionalParams}) { 2 | 3 | ${extraContributions}; 4 | } -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/java/com/antilia/angular/repeater/updatedetails.js: -------------------------------------------------------------------------------- 1 | $scope.element = null; 2 | 3 | $scope.$on('${updateEvent}', function(event, args) { 4 | var url = '${url}'; 5 | var selected = args['selected']; 6 | $scope.element = null; 7 | if(selected != null) { 8 | var url1 = url+ '&' + '${elementId}' + '=' + selected.id + "&_acache="+ (new Date().getTime()); 9 | } 10 | $http.get(url1).success(function(data) { 11 | $scope.element = data; 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | wicket-angular 7 | 8 | 18 | 19 | 20 | wicket.wicket-angular 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.angular.WicketApplication 25 | 26 | 27 | 28 | 29 | wicket.wicket-angular 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /wicket-angular-parent/wicket-angular/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-angular-parent/wicket-angular/src/test/resources/keystore -------------------------------------------------------------------------------- /wicket-ember/src/main/java/com/antilia/ember/HomePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Apache Wicket Quickstart 6 | 7 | 8 | 9 | 10 |

11 | 15 |
16 |
17 |

Congratulations!

18 |

19 | Your quick start works! This project is especially useful to 20 | start developing your Wicket application or to create a test 21 | case for a bug report. 22 |

23 |

Get started

24 |

25 | You can even switch to HTTPS! 26 |

27 |

28 | From here you can start hacking away at your application and 29 | wow your clients: 30 |

31 | 36 |

Get help

37 |

38 | We are here to help! 39 |

40 | 45 |

Reporting a bug

46 |

47 | Help us help you: 48 |

49 |
    50 |
  1. reproduce the bug with the least amount of code
  2. 51 |
  3. create a unit test that shows the bug
  4. 52 |
  5. fix the bug and create a patch
  6. 53 |
  7. attach the result of step 1, 2 or 3 to a JIRA issue
  8. 54 |
  9. profit!
  10. 55 |
56 |

57 | Please mention the correct Wicket version: 1.5-SNAPSHOT. 58 |

59 |
60 |
61 |
62 | 63 | 64 | -------------------------------------------------------------------------------- /wicket-ember/src/main/java/com/antilia/ember/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.ember; 2 | 3 | import org.apache.wicket.request.mapper.parameter.PageParameters; 4 | import org.apache.wicket.markup.html.basic.Label; 5 | import org.apache.wicket.markup.html.WebPage; 6 | 7 | public class HomePage extends WebPage { 8 | private static final long serialVersionUID = 1L; 9 | 10 | public HomePage(final PageParameters parameters) { 11 | super(parameters); 12 | 13 | add(new Label("version", getApplication().getFrameworkSettings().getVersion())); 14 | 15 | // TODO Add your page's components here 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /wicket-ember/src/main/java/com/antilia/ember/WicketApplication.java: -------------------------------------------------------------------------------- 1 | package com.antilia.ember; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.protocol.http.WebApplication; 5 | 6 | /** 7 | * Application object for your web application. If you want to run this application without deploying, run the Start class. 8 | * 9 | * @see com.antilia.ember.Start#main(String[]) 10 | */ 11 | public class WicketApplication extends WebApplication 12 | { 13 | /** 14 | * @see org.apache.wicket.Application#getHomePage() 15 | */ 16 | @Override 17 | public Class getHomePage() 18 | { 19 | return HomePage.class; 20 | } 21 | 22 | /** 23 | * @see org.apache.wicket.Application#init() 24 | */ 25 | @Override 26 | public void init() 27 | { 28 | super.init(); 29 | 30 | // add your configuration here 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /wicket-ember/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | wicket-ember 7 | 8 | 18 | 19 | 20 | wicket.wicket-ember 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.ember.WicketApplication 25 | 26 | 27 | 28 | 29 | wicket.wicket-ember 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-ember/src/main/webapp/logo.png -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/README.txt: -------------------------------------------------------------------------------- 1 | If you are starting to read the book, this version of the code is suggested. 2 | ---------------------------------------------------------------------------- 3 | This is my version of the Ember.js official starter kit. 4 | 5 | Inside the css folder is the styles that will be used by the application. 6 | 7 | Inside the js folder is the Ember.js code seperated into the models, views, and controllers folders. 8 | The /js/libs folder includes the libraries needed for the sample application. 9 | 10 | The img folder contains a glyphicons.png file that is used for displaying icons in the application. 11 | 12 | All you have to do to view the code all together is copy the following file into a browse: 13 | 14 | index.html 15 | 16 | There are code snippets from the book inside snippets/executableCodeSnippets that you can copy and paste into the console of a web browser. -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/glyphicons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-ember/src/main/webapp/part1/glyphicons.png -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/js/app.js: -------------------------------------------------------------------------------- 1 | // Create our Application 2 | MovieTracker = Ember.Application.create(); 3 | 4 | // Start our Ember Application 5 | MovieTracker.initialize(); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/js/controllers/application.js: -------------------------------------------------------------------------------- 1 | // Inherit outlet Support 2 | MovieTracker.ApplicationController = Ember.Controller.extend(); 3 | 4 | // ArrayController to create some new Movies 5 | MovieTracker.movieController = Ember.ArrayController.create({ 6 | content: [], 7 | init: function(){ 8 | var kidsMovie = MovieTracker.Movie.create({ 9 | title: 'Toy Story', 10 | rating: 4 11 | }); 12 | this.pushObject(kidsMovie); 13 | 14 | var avengers = MovieTracker.Movie.create({ 15 | title: 'The Avengers', 16 | rating: 5 17 | }); 18 | this.pushObject(avengers); 19 | } 20 | }); 21 | 22 | // Controller for Movie 23 | MovieTracker.watchedController = Ember.ObjectController.create({ 24 | watchController: null, 25 | contentBinding: 'watchController.selectedItem', 26 | 27 | setWatched: function() { 28 | this.toggleProperty('watched'); 29 | } 30 | }); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/js/models/actor.js: -------------------------------------------------------------------------------- 1 | // Bind an Actor to a Movie 2 | MovieTracker.Actor = Ember.Object.extend({ 3 | filmBinding: 'MovieTracker.Movie.title' 4 | }); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/js/models/movie.js: -------------------------------------------------------------------------------- 1 | MovieTracker.Movie = Ember.Object.extend({ 2 | id: null, 3 | title: null, 4 | watched: false, 5 | rating: 0, 6 | titleAndRating: function() { 7 | // Computed Property 8 | return this.get('title') + ' has a rating of ' + this.get('rating'); 9 | }.property('title', 'rating'), 10 | titleChanged: function() { 11 | // Observer 12 | console.log('Title changed!'); 13 | }.observes('title') 14 | }); 15 | 16 | // Create a subclass of Movie called ActionMovie 17 | MovieTracker.ActionMovie = MovieTracker.Movie.extend({ 18 | genre: 'action' 19 | }); 20 | 21 | // Create a new mixin 22 | Watched = Ember.Mixin.create({ 23 | isWatched: function() { 24 | var title = this.get('title'), 25 | watched = this.get('watched'); 26 | 27 | return('Has ' + title + ' been watched? ' + watched); 28 | } 29 | }); 30 | 31 | // Add our mixin to the Movie object 32 | MovieTracker.Movie = Ember.Object.extend(Watched); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/js/router.js: -------------------------------------------------------------------------------- 1 | MovieTracker.Router = Ember.Router.extend({ 2 | root: Ember.Route.extend({ 3 | // Create the index route 4 | index: Ember.Route.extend({ 5 | route: '/' 6 | }) 7 | }) 8 | }); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part1/js/views/application.js: -------------------------------------------------------------------------------- 1 | // Create the application level view 2 | MovieTracker.ApplicationView = Ember.View.extend({ 3 | templateName: 'application' 4 | }); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/README.txt: -------------------------------------------------------------------------------- 1 | If you are finished reading the book, or just want the complete version of the code, this version of the code is suggested. 2 | ---------------------------------------------------------------------------------------------------------------------------- 3 | This is my version of the Ember.js official starter kit. 4 | 5 | Inside the css folder is the styles that will be used by the application. 6 | 7 | Inside the js folder is the Ember.js code seperated into the models, views, and controllers folders. 8 | The /js/libs folder includes the libraries needed for the sample application. 9 | 10 | The img folder contains a glyphicons.png file that is used for displaying icons in the application. 11 | 12 | All you have to do to view the code all together is copy the following file into a browse: 13 | 14 | index.html 15 | 16 | There are code snippets from the book inside snippets/executableCodeSnippets that you can copy and paste into the console of a web browser. -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-ember/src/main/webapp/part2/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/js/app.js: -------------------------------------------------------------------------------- 1 | // Create our Application 2 | MovieTracker = Ember.Application.create({ 3 | ready: function() { 4 | // Override the read method. 5 | this._super(); 6 | 7 | // Populate content[] in moviesController 8 | // This method is located in js/helpers.js 9 | MovieTracker.GetMovieItems(); 10 | } 11 | }); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/js/controllers/application.js: -------------------------------------------------------------------------------- 1 | // Inherit outlet Support 2 | MovieTracker.ApplicationController = Ember.Controller.extend(); 3 | 4 | // Controller to store Movie Objects 5 | MovieTracker.moviesController = Ember.ArrayController.create({ 6 | content: [], 7 | 8 | // Property that adds an item to content[] 9 | addItem: function(item) { 10 | this.addObject(item); 11 | }, 12 | 13 | // Property that returns the length of content[] 14 | itemCount: function() { 15 | return this.get('length'); 16 | }.property('@each'), 17 | 18 | // Property that returns all objects in content[] with watched = false 19 | unwatchedCount: function() { 20 | return this.filterProperty('watched', false).get('length'); 21 | }.property('@each.watched') 22 | }); 23 | 24 | // Controller used for filtering movies if it ever needed. Should not be used for editing moviesController content[] 25 | MovieTracker.visibleMoviesController = Ember.ObjectController.create({ 26 | content: [], 27 | 28 | // Sets content[] to filtered results of moviesController 29 | filterBy: function(key, value) { 30 | this.set('content', MovieTracker.moviesController.filterProperty(key, value)); 31 | }, 32 | 33 | // Sets content[] to all items in moviesController 34 | clearFilter: function() { 35 | this.set('content', MovieTracker.moviesController.get('content')); 36 | } 37 | }); 38 | 39 | // Provides functionality related to selecting a Movie 40 | MovieTracker.selectedMovieController = Ember.ObjectController.create({ 41 | selectedMovie: [], 42 | hasPrev: false, 43 | hasNext: false, 44 | 45 | // This property is called when selecting an item 46 | select: function(item) { 47 | this.set('selectedMovie', item); 48 | if (item) { 49 | // Determine if we have a previous/next item in the array 50 | var currentIndex = MovieTracker.visibleMoviesController.content.indexOf(this.get('selectedMovie')); 51 | if (currentIndex + 1 >= MovieTracker.visibleMoviesController.get('itemCount')) { 52 | this.set('hasNext', false); 53 | } else { 54 | this.set('hasNext', true); 55 | } 56 | if (currentIndex === 0) { 57 | this.set('hasPrev', false); 58 | } else { 59 | this.set('hasPrev', true); 60 | } 61 | 62 | } else { 63 | this.set('hasPrev', false); 64 | this.set('hasNext', false); 65 | } 66 | }, 67 | 68 | // This property called when you want to toggle the "watched" property of a Movie object 69 | toggleWatched: function() { 70 | this.selectedMovie.toggleProperty('watched'); 71 | }, 72 | 73 | // Selects the next item in moviesController content[] 74 | next: function() { 75 | // Get's the current index in case we've changed the list of items, if the 76 | // item is no longer visible, it will return -1. 77 | var currentIndex = MovieTracker.visibleMoviesController.content.indexOf(this.get('selectedMovie')); 78 | // Figure out the next item by adding 1, which will put it at the start 79 | // of the newly selected items if they've changed. 80 | var nextItem = MovieTracker.visibleMoviesController.content[currentIndex + 1]; 81 | if (nextItem) { 82 | this.select(nextItem); 83 | } 84 | }, 85 | 86 | // Selects the previous item in moviesController content[] 87 | prev: function() { 88 | // Get's the current index in case we've changed the list of items, if the 89 | // item is no longer visible, it will return -1. 90 | var currentIndex = MovieTracker.visibleMoviesController.content.indexOf(this.get('selectedMovie')); 91 | // Figure out the previous item by subtracting 1, which will result in an 92 | // item not found if we're already at 0 93 | var prevItem = MovieTracker.visibleMoviesController.content[currentIndex - 1]; 94 | if (prevItem) { 95 | this.select(prevItem); 96 | } 97 | } 98 | 99 | }); 100 | 101 | -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/js/helpers.js: -------------------------------------------------------------------------------- 1 | // Method is called to populate our moviesController content[] 2 | MovieTracker.GetMovieItems = function() { 3 | MovieTracker.moviesController.addItem(MovieTracker.Movie.create({ 4 | title: 'The Avengers', 5 | rating: 4, 6 | watched: false 7 | })); 8 | 9 | MovieTracker.moviesController.addItem(MovieTracker.Movie.create({ 10 | title: 'Spiderman', 11 | rating: 1, 12 | watched: true 13 | })); 14 | 15 | MovieTracker.moviesController.addItem(MovieTracker.Movie.create({ 16 | title: 'The Hulk', 17 | rating: 2, 18 | watched: true 19 | })); 20 | 21 | MovieTracker.moviesController.addItem(MovieTracker.Movie.create({ 22 | title: 'Thor', 23 | rating: 3, 24 | watched: false 25 | })); 26 | 27 | MovieTracker.moviesController.addItem(MovieTracker.Movie.create({ 28 | title: 'Batman', 29 | rating: 5, 30 | watched: false 31 | })); 32 | }; -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/js/models/actor.js: -------------------------------------------------------------------------------- 1 | // Bind an Actor to a Movie 2 | MovieTracker.Actor = Ember.Object.extend({ 3 | filmBinding: 'MovieTracker.Movie.title' 4 | }); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/js/models/movie.js: -------------------------------------------------------------------------------- 1 | MovieTracker.Movie = Ember.Object.extend({ 2 | id: null, 3 | title: null, 4 | watched: false, 5 | rating: 0, 6 | titleAndRating: function() { 7 | // Computed Property 8 | return this.get('title') + ' has a rating of ' + this.get('rating'); 9 | }.property('title', 'rating'), 10 | 11 | titleChanged: function() { 12 | // Observer 13 | console.log('Title changed!'); 14 | }.observes('title') 15 | }); 16 | 17 | // Create a subclass of Movie called ActionMovie 18 | MovieTracker.ActionMovie = MovieTracker.Movie.extend({ 19 | genre: 'action' 20 | }); 21 | 22 | // Create a new mixin 23 | Watched = Ember.Mixin.create({ 24 | isWatched: function() { 25 | var title = this.get('title'), 26 | watched = this.get('watched'); 27 | 28 | return('Has ' + title + ' been watched? ' + watched); 29 | } 30 | }); 31 | 32 | // Add our mixin to the Movie object 33 | MovieTracker.Movie = Ember.Object.extend(Watched); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/js/router.js: -------------------------------------------------------------------------------- 1 | MovieTracker.Router = Ember.Router.extend({ 2 | root: Ember.Route.extend({ 3 | index: Ember.Route.extend({ 4 | route: '/', 5 | // Redirect to the movies state once the application loads 6 | redirectsTo: 'movies' 7 | }), 8 | 9 | movies: Ember.Route.extend({ 10 | route: '/movies', 11 | showMovie: Ember.Route.transitionTo('movie') 12 | /*, 13 | Try connecting an outlet into your index to display the movie listings 14 | connectOutlets: function(router){ 15 | router.get('applicationController').connectOutlet('details', MovieTracker.visibleMoviesController.content); 16 | }*/ 17 | }) 18 | }) 19 | }) 20 | 21 | // Start our Ember Application 22 | MovieTracker.initialize(); -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/js/views/application.js: -------------------------------------------------------------------------------- 1 | // Create the application level view 2 | MovieTracker.ApplicationView = Ember.View.extend({ 3 | templateName: 'application' 4 | }); 5 | 6 | // Movie Listings View 7 | MovieTracker.MovieListingsView = Ember.View.extend({ 8 | // Handle clicks on an item summary 9 | click: function(event) { 10 | // Figure out what the user just clicked on, then set selectedMovieController 11 | var content = this.get('content'); 12 | MovieTracker.selectedMovieController.select(content); 13 | }, 14 | 15 | nextMovie: function(event) { 16 | alert("here"); 17 | MovieTracker.selectedMovieController.next(); 18 | } 19 | }); 20 | 21 | MovieTracker.ActionPanelView = Ember.View.extend({ 22 | templateName: 'action_panel', 23 | 24 | toggleWatched: function(event) { 25 | MovieTracker.selectedMovieController.toggleWatched(); 26 | }, 27 | 28 | nextMovie: function(event) { 29 | MovieTracker.selectedMovieController.next(); 30 | } 31 | }); 32 | 33 | MovieTracker.SelectedMovieView = Ember.View.extend({}); 34 | 35 | MovieTracker.MovieDetailsView = Ember.View.extend({ 36 | contentBinding: 'MovieTracker.selectedMovieController.selectedMovie' 37 | }); 38 | -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/part2/snippets/executableCodeSnippets.js: -------------------------------------------------------------------------------- 1 | var actionMovie = MovieTracker.Movie.create({ 2 | title: "Action Movie 2", 3 | helloWorld: function() { 4 | alert("Hi my name is " + this.get('title')); 5 | } 6 | }); 7 | actionMovie.helloWorld(); 8 | 9 | MovieTracker.Movie = Ember.Object.extend({ 10 | id: null, 11 | title: null, 12 | watched: false, 13 | rating: 0, 14 | titleAndRating: function() { 15 | return this.get("title") + " has a rating of " + this.get("rating"); 16 | }.property(“title”, “rating”), 17 | ratingChanged: function() { 18 | return('title changed!'); 19 | }.observes('title') 20 | }); 21 | 22 | var comedyMovie = MovieTracker.Movie.create({ 23 | title: 'A Comedy Movie', 24 | rating: 5 25 | }); 26 | 27 | comedyMovie.get('titleAndRating'); 28 | 29 | MovieTracker.Movie = Ember.Object.extend(Watched); 30 | 31 | var watchedMovie = MovieTracker.Movie.create({ 32 | title: 'A Watched Movie', 33 | rating: 5, 34 | watched: true 35 | }); 36 | 37 | watchedMovie.isWatched(); 38 | 39 | {{action "nextMovie"}} 40 | -------------------------------------------------------------------------------- /wicket-ember/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} 2 | h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } 3 | body { margin:0;padding:0;} 4 | #hd { 5 | width : 100%; 6 | height : 87px; 7 | background-color : #092E67; 8 | margin-top : 0; 9 | padding-top : 10px; 10 | border-bottom : 1px solid #888; 11 | z-index : 0; 12 | } 13 | #ft { 14 | position : absolute; 15 | bottom : 0; 16 | width : 100%; 17 | height : 99px; 18 | background-color : #6493D2; 19 | border-top : 1px solid #888; 20 | z-index : 0; 21 | } 22 | #logo,#bd { 23 | width : 650px; 24 | margin: 0 auto; 25 | padding: 25px 50px 0 50px; 26 | } 27 | #logo h1 { 28 | color : white; 29 | font-size:36pt; 30 | display: inline; 31 | } 32 | #logo img { 33 | display:inline; 34 | vertical-align: bottom; 35 | margin-left : 50px; 36 | margin-right : 5px; 37 | } 38 | body { margin-top : 0; padding-top : 0;} 39 | #logo, #logo h1 { margin-top : 0; padding-top : 0;} 40 | #bd { 41 | position : absolute; 42 | top : 75px; 43 | bottom : 75px; 44 | left : 50%; 45 | margin-left : -325px; 46 | z-index : 1; 47 | overflow: auto; 48 | background-color : #fff; 49 | -webkit-border-radius: 10px; 50 | -moz-border-radius: 10px; 51 | border-radius: 10px; 52 | -moz-box-shadow: 0px 0px 10px #888; 53 | -webkit-box-shadow: 0px 0px 10px #888; 54 | box-shadow: 0px 0px 10px #888; 55 | } 56 | a, a:visited, a:hover, a:active { 57 | color : #6493D2; 58 | } 59 | h2 { 60 | padding : 0; margin:0; 61 | font-size:36pt; 62 | color:#FF5500; 63 | } 64 | h3 { 65 | padding : 0; margin:0; 66 | font-size:24pt; 67 | color:#092E67; 68 | } -------------------------------------------------------------------------------- /wicket-ember/src/test/java/com/antilia/ember/Start.java: -------------------------------------------------------------------------------- 1 | package com.antilia.ember; 2 | 3 | import org.apache.wicket.util.time.Duration; 4 | import org.eclipse.jetty.server.Server; 5 | import org.eclipse.jetty.server.bio.SocketConnector; 6 | import org.eclipse.jetty.server.ssl.SslSocketConnector; 7 | import org.eclipse.jetty.util.resource.Resource; 8 | import org.eclipse.jetty.util.ssl.SslContextFactory; 9 | import org.eclipse.jetty.webapp.WebAppContext; 10 | 11 | public class Start { 12 | public static void main(String[] args) throws Exception { 13 | int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); 14 | 15 | Server server = new Server(); 16 | SocketConnector connector = new SocketConnector(); 17 | 18 | // Set some timeout options to make debugging easier. 19 | connector.setMaxIdleTime(timeout); 20 | connector.setSoLingerTime(-1); 21 | connector.setPort(8080); 22 | server.addConnector(connector); 23 | 24 | Resource keystore = Resource.newClassPathResource("/keystore"); 25 | if (keystore != null && keystore.exists()) { 26 | // if a keystore for a SSL certificate is available, start a SSL 27 | // connector on port 8443. 28 | // By default, the quickstart comes with a Apache Wicket Quickstart 29 | // Certificate that expires about half way september 2021. Do not 30 | // use this certificate anywhere important as the passwords are 31 | // available in the source. 32 | 33 | connector.setConfidentialPort(8443); 34 | 35 | SslContextFactory factory = new SslContextFactory(); 36 | factory.setKeyStoreResource(keystore); 37 | factory.setKeyStorePassword("wicket"); 38 | factory.setTrustStoreResource(keystore); 39 | factory.setKeyManagerPassword("wicket"); 40 | SslSocketConnector sslConnector = new SslSocketConnector(factory); 41 | sslConnector.setMaxIdleTime(timeout); 42 | sslConnector.setPort(8443); 43 | sslConnector.setAcceptors(4); 44 | server.addConnector(sslConnector); 45 | 46 | System.out.println("SSL access to the quickstart has been enabled on port 8443"); 47 | System.out.println("You can access the application using SSL on https://localhost:8443"); 48 | System.out.println(); 49 | } 50 | 51 | WebAppContext bb = new WebAppContext(); 52 | bb.setServer(server); 53 | bb.setContextPath("/"); 54 | bb.setWar("src/main/webapp"); 55 | 56 | // START JMX SERVER 57 | // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); 58 | // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); 59 | // server.getContainer().addEventListener(mBeanContainer); 60 | // mBeanContainer.start(); 61 | 62 | server.setHandler(bb); 63 | 64 | try { 65 | System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); 66 | server.start(); 67 | System.in.read(); 68 | System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); 69 | server.stop(); 70 | server.join(); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.exit(1); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /wicket-ember/src/test/java/com/antilia/ember/TestHomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.ember; 2 | 3 | import org.apache.wicket.util.tester.WicketTester; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | 7 | /** 8 | * Simple test using the WicketTester 9 | */ 10 | public class TestHomePage 11 | { 12 | private WicketTester tester; 13 | 14 | @Before 15 | public void setUp() 16 | { 17 | tester = new WicketTester(new WicketApplication()); 18 | } 19 | 20 | @Test 21 | public void homepageRendersSuccessfully() 22 | { 23 | //start and render the test page 24 | tester.startPage(HomePage.class); 25 | 26 | //assert rendered page class 27 | tester.assertRenderedPage(HomePage.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /wicket-ember/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-ember/src/test/resources/keystore -------------------------------------------------------------------------------- /wicket-replace-with-effect/README.md: -------------------------------------------------------------------------------- 1 | ## What is this project useful for?## 2 | 3 | It contains a Wicket behavior (ReplaceWithEffectBehavior) that allows to execute some "effects" before and after 4 | a component is replaced via AJAX. 5 | 6 | ## How to use it? ## 7 | 8 | Java code 9 | 10 | ```java 11 | public HomePage() { 12 | add(slideDown = new WebMarkupContainer("slideDown")); 13 | slideDown.add(new ReplaceWithEffectBehavior()); 14 | add(new AjaxLink("link") { 15 | 16 | private static final long serialVersionUID = 1L; 17 | 18 | @Override 19 | public void onClick(AjaxRequestTarget target) { 20 | target.add(slideDown); 21 | } 22 | }); 23 | } 24 | ``` 25 | HTML template. 26 | 27 | ```html 28 | 29 | 30 | 31 | Test 32 | 40 | 41 | 42 |
43 | Test 44 |
45 |

46 | Repaint via AJAX 47 |

48 | 49 | 50 | ``` -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | wicket-replace-with-effect 7 | 8 | 18 | 19 | 20 | wicket.wicket-replace-with-effect 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.replacewitheffect.WicketApplication 25 | 26 | 27 | 28 | 29 | wicket.wicket-replace-with-effect 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/main/webapp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-replace-with-effect/src/main/webapp/logo.png -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} 2 | h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } 3 | body { margin:0;padding:0;} 4 | #hd { 5 | width : 100%; 6 | height : 87px; 7 | background-color : #092E67; 8 | margin-top : 0; 9 | padding-top : 10px; 10 | border-bottom : 1px solid #888; 11 | z-index : 0; 12 | } 13 | #ft { 14 | position : absolute; 15 | bottom : 0; 16 | width : 100%; 17 | height : 99px; 18 | background-color : #6493D2; 19 | border-top : 1px solid #888; 20 | z-index : 0; 21 | } 22 | #logo,#bd { 23 | width : 650px; 24 | margin: 0 auto; 25 | padding: 25px 50px 0 50px; 26 | } 27 | #logo h1 { 28 | color : white; 29 | font-size:36pt; 30 | display: inline; 31 | } 32 | #logo img { 33 | display:inline; 34 | vertical-align: bottom; 35 | margin-left : 50px; 36 | margin-right : 5px; 37 | } 38 | body { margin-top : 0; padding-top : 0;} 39 | #logo, #logo h1 { margin-top : 0; padding-top : 0;} 40 | #bd { 41 | position : absolute; 42 | top : 75px; 43 | bottom : 75px; 44 | left : 50%; 45 | margin-left : -325px; 46 | z-index : 1; 47 | overflow: auto; 48 | background-color : #fff; 49 | -webkit-border-radius: 10px; 50 | -moz-border-radius: 10px; 51 | border-radius: 10px; 52 | -moz-box-shadow: 0px 0px 10px #888; 53 | -webkit-box-shadow: 0px 0px 10px #888; 54 | box-shadow: 0px 0px 10px #888; 55 | } 56 | a, a:visited, a:hover, a:active { 57 | color : #6493D2; 58 | } 59 | h2 { 60 | padding : 0; margin:0; 61 | font-size:36pt; 62 | color:#FF5500; 63 | } 64 | h3 { 65 | padding : 0; margin:0; 66 | font-size:24pt; 67 | color:#092E67; 68 | } -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/test/java/com/antilia/replacewitheffect/HomePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Test 5 | 13 | 14 | 15 |
16 | Test 17 |
18 |

19 | Repaint via AJAX 20 |

21 | 22 | -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/test/java/com/antilia/replacewitheffect/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.replacewitheffect; 2 | 3 | import org.apache.wicket.ajax.AjaxRequestTarget; 4 | import org.apache.wicket.ajax.markup.html.AjaxLink; 5 | import org.apache.wicket.markup.html.WebMarkupContainer; 6 | import org.apache.wicket.markup.html.WebPage; 7 | 8 | public class HomePage extends WebPage { 9 | private static final long serialVersionUID = 1L; 10 | 11 | private WebMarkupContainer slideDown; 12 | /** 13 | * 14 | */ 15 | public HomePage() { 16 | add(slideDown = new WebMarkupContainer("slideDown")); 17 | slideDown.add(new ReplaceWithEffectBehavior()); 18 | add(new AjaxLink("link") { 19 | 20 | /** 21 | * 22 | */ 23 | private static final long serialVersionUID = 1L; 24 | 25 | @Override 26 | public void onClick(AjaxRequestTarget target) { 27 | target.add(slideDown); 28 | } 29 | }); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/test/java/com/antilia/replacewitheffect/Start.java: -------------------------------------------------------------------------------- 1 | package com.antilia.replacewitheffect; 2 | 3 | import org.apache.wicket.util.time.Duration; 4 | import org.eclipse.jetty.server.Server; 5 | import org.eclipse.jetty.server.bio.SocketConnector; 6 | import org.eclipse.jetty.server.ssl.SslSocketConnector; 7 | import org.eclipse.jetty.util.resource.Resource; 8 | import org.eclipse.jetty.util.ssl.SslContextFactory; 9 | import org.eclipse.jetty.webapp.WebAppContext; 10 | 11 | public class Start { 12 | public static void main(String[] args) throws Exception { 13 | int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); 14 | 15 | Server server = new Server(); 16 | SocketConnector connector = new SocketConnector(); 17 | 18 | // Set some timeout options to make debugging easier. 19 | connector.setMaxIdleTime(timeout); 20 | connector.setSoLingerTime(-1); 21 | connector.setPort(8080); 22 | server.addConnector(connector); 23 | 24 | Resource keystore = Resource.newClassPathResource("/keystore"); 25 | if (keystore != null && keystore.exists()) { 26 | // if a keystore for a SSL certificate is available, start a SSL 27 | // connector on port 8443. 28 | // By default, the quickstart comes with a Apache Wicket Quickstart 29 | // Certificate that expires about half way september 2021. Do not 30 | // use this certificate anywhere important as the passwords are 31 | // available in the source. 32 | 33 | connector.setConfidentialPort(8443); 34 | 35 | SslContextFactory factory = new SslContextFactory(); 36 | factory.setKeyStoreResource(keystore); 37 | factory.setKeyStorePassword("wicket"); 38 | factory.setTrustStoreResource(keystore); 39 | factory.setKeyManagerPassword("wicket"); 40 | SslSocketConnector sslConnector = new SslSocketConnector(factory); 41 | sslConnector.setMaxIdleTime(timeout); 42 | sslConnector.setPort(8443); 43 | sslConnector.setAcceptors(4); 44 | server.addConnector(sslConnector); 45 | 46 | System.out.println("SSL access to the quickstart has been enabled on port 8443"); 47 | System.out.println("You can access the application using SSL on https://localhost:8443"); 48 | System.out.println(); 49 | } 50 | 51 | WebAppContext bb = new WebAppContext(); 52 | bb.setServer(server); 53 | bb.setContextPath("/"); 54 | bb.setWar("src/main/webapp"); 55 | 56 | // START JMX SERVER 57 | // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); 58 | // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); 59 | // server.getContainer().addEventListener(mBeanContainer); 60 | // mBeanContainer.start(); 61 | 62 | server.setHandler(bb); 63 | 64 | try { 65 | System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); 66 | server.start(); 67 | System.in.read(); 68 | System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); 69 | server.stop(); 70 | server.join(); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.exit(1); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/test/java/com/antilia/replacewitheffect/TestHomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia.replacewitheffect; 2 | 3 | import org.apache.wicket.util.tester.WicketTester; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | 7 | /** 8 | * Simple test using the WicketTester 9 | */ 10 | public class TestHomePage 11 | { 12 | private WicketTester tester; 13 | 14 | @Before 15 | public void setUp() 16 | { 17 | tester = new WicketTester(new WicketApplication()); 18 | } 19 | 20 | @Test 21 | public void homepageRendersSuccessfully() 22 | { 23 | //start and render the test page 24 | tester.startPage(HomePage.class); 25 | 26 | //assert rendered page class 27 | tester.assertRenderedPage(HomePage.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/test/java/com/antilia/replacewitheffect/WicketApplication.java: -------------------------------------------------------------------------------- 1 | package com.antilia.replacewitheffect; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.protocol.http.WebApplication; 5 | 6 | /** 7 | * Application object for your web application. If you want to run this application without deploying, run the Start class. 8 | * 9 | * @see com.antilia.replacewitheffect.Start#main(String[]) 10 | */ 11 | public class WicketApplication extends WebApplication 12 | { 13 | /** 14 | * @see org.apache.wicket.Application#getHomePage() 15 | */ 16 | @Override 17 | public Class getHomePage() 18 | { 19 | return HomePage.class; 20 | } 21 | 22 | /** 23 | * @see org.apache.wicket.Application#init() 24 | */ 25 | @Override 26 | public void init() 27 | { 28 | super.init(); 29 | 30 | // add your configuration here 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /wicket-replace-with-effect/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-replace-with-effect/src/test/resources/keystore -------------------------------------------------------------------------------- /wicket-sparelinks/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /wicket-sparelinks/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /wicket-sparelinks/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.6 6 | -------------------------------------------------------------------------------- /wicket-sparelinks/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/HomePage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Apache Wicket Quickstart 6 | 7 | 8 | 9 | 10 |

11 |

Table with of links

12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/HomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.wicket.ajax.AjaxRequestTarget; 7 | import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; 8 | import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; 9 | import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; 10 | import org.apache.wicket.markup.html.WebPage; 11 | import org.apache.wicket.markup.html.basic.Label; 12 | import org.apache.wicket.markup.repeater.Item; 13 | import org.apache.wicket.model.AbstractReadOnlyModel; 14 | import org.apache.wicket.model.IModel; 15 | import org.apache.wicket.model.Model; 16 | import org.apache.wicket.request.mapper.parameter.PageParameters; 17 | 18 | import com.antilia.smartlinks.SmartLinkDataTable; 19 | 20 | public class HomePage extends WebPage { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private Label clicked; 25 | 26 | private String text; 27 | 28 | public HomePage(final PageParameters parameters) { 29 | super(parameters); 30 | 31 | text = "Nothing clicked yet!"; 32 | 33 | clicked = new Label("clicked", new AbstractReadOnlyModel() { 34 | 35 | private static final long serialVersionUID = 1L; 36 | 37 | @Override 38 | public String getObject() { 39 | return text; 40 | } 41 | } ); 42 | clicked.setOutputMarkupId(true); 43 | add( clicked ); 44 | List> columns = new ArrayList>(); 45 | columns.add( new PropertyColumn(Model.of("Name"), "name") ) ; 46 | columns.add( new PropertyColumn(Model.of("LastName"), "lastName") ) ; 47 | columns.add( new PropertyColumn(Model.of("Links"), "x") { 48 | 49 | private static final long serialVersionUID = 1L; 50 | 51 | @Override 52 | public void populateItem(Item> item, 53 | String componentId, final IModel rowModel) { 54 | item.add(new LinksPanel(componentId) { 55 | 56 | private static final long serialVersionUID = 1L; 57 | 58 | @Override 59 | public void onClick(AjaxRequestTarget target, int i) { 60 | Person person = rowModel.getObject(); 61 | text = person.getName()+ "-"+ person.getLastName()+"-Link->>"+ i; 62 | target.add( clicked ); 63 | } 64 | }); 65 | } 66 | 67 | }); 68 | add( new SmartLinkDataTable("datatable", columns , new PersonDataProvider(), 20) ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/LinksPanel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/LinksPanel.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia; 5 | 6 | import org.apache.wicket.ajax.AjaxRequestTarget; 7 | import org.apache.wicket.markup.html.WebMarkupContainer; 8 | import org.apache.wicket.markup.html.basic.Label; 9 | import org.apache.wicket.markup.html.panel.Panel; 10 | import org.apache.wicket.markup.repeater.RepeatingView; 11 | 12 | import com.antilia.smartlinks.SmartLink; 13 | 14 | /** 15 | * @author reiern70 16 | * 17 | */ 18 | public abstract class LinksPanel extends Panel { 19 | 20 | /** 21 | * 22 | */ 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private abstract class IntLink extends SmartLink{ 27 | private static final long serialVersionUID = 1L; 28 | 29 | int value; 30 | 31 | public IntLink(String id, int i) { 32 | super(id); 33 | this.value = i; 34 | } 35 | 36 | } 37 | /** 38 | * @param id 39 | */ 40 | public LinksPanel(String id) { 41 | super(id); 42 | 43 | RepeatingView repeatingView = new RepeatingView("links"); 44 | add(repeatingView); 45 | for(int i = 0; i< 40; i++) { 46 | WebMarkupContainer container = new WebMarkupContainer( repeatingView.newChildId() ); 47 | repeatingView.add( container ); 48 | IntLink smartLink = new IntLink("link", i) { 49 | 50 | private static final long serialVersionUID = 1L; 51 | 52 | @Override 53 | public void onClick(AjaxRequestTarget target) { 54 | LinksPanel.this.onClick(target, value); 55 | } 56 | }; 57 | container.add( smartLink ); 58 | smartLink.add( new Label("text", i) ); 59 | } 60 | } 61 | 62 | public abstract void onClick(AjaxRequestTarget target, int i); 63 | 64 | } 65 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/Person.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author reiern70 10 | * 11 | */ 12 | public class Person implements Serializable { 13 | 14 | private static final long serialVersionUID = 1L; 15 | 16 | private String name; 17 | private String lastName; 18 | 19 | public Person() { 20 | } 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | 30 | public String getLastName() { 31 | return lastName; 32 | } 33 | 34 | public void setLastName(String lastName) { 35 | this.lastName = lastName; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/PersonDataProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | import org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState; 10 | import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; 11 | import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider; 12 | import org.apache.wicket.extensions.markup.html.repeater.util.SingleSortState; 13 | import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; 14 | import org.apache.wicket.markup.repeater.data.ListDataProvider; 15 | 16 | /** 17 | * @author reiern70 18 | * 19 | */ 20 | public class PersonDataProvider extends ListDataProvider implements ISortableDataProvider{ 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private static List persons = new ArrayList(); 25 | 26 | static { 27 | for(int i=0; i < 1000; i++) { 28 | Person person = new Person(); 29 | person.setLastName("LastaName" + i); 30 | person.setName("Name" + i); 31 | persons.add(person); 32 | } 33 | } 34 | 35 | public PersonDataProvider() { 36 | super( persons ); 37 | } 38 | 39 | private final SingleSortState state = new SingleSortState(); 40 | 41 | /** 42 | * @see ISortableDataProvider#getSortState() 43 | */ 44 | @Override 45 | public final ISortState getSortState() 46 | { 47 | return state; 48 | } 49 | 50 | /** 51 | * Returns current sort state 52 | * 53 | * @return current sort state 54 | */ 55 | public SortParam getSort() 56 | { 57 | return state.getSort(); 58 | } 59 | 60 | /** 61 | * Sets the current sort state 62 | * 63 | * @param param 64 | * parameter containing new sorting information 65 | */ 66 | public void setSort(final SortParam param) 67 | { 68 | state.setSort(param); 69 | } 70 | 71 | /** 72 | * Sets the current sort state 73 | * 74 | * @param property 75 | * sort property 76 | * @param order 77 | * sort order 78 | */ 79 | public void setSort(final String property, final SortOrder order) 80 | { 81 | state.setPropertySortOrder(property, order); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/WicketApplication.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.markup.html.WebPage; 4 | import org.apache.wicket.protocol.http.WebApplication; 5 | 6 | /** 7 | * Application object for your web application. If you want to run this application without deploying, run the Start class. 8 | * 9 | * @see com.antilia.Start#main(String[]) 10 | */ 11 | public class WicketApplication extends WebApplication 12 | { 13 | /** 14 | * @see org.apache.wicket.Application#getHomePage() 15 | */ 16 | @Override 17 | public Class getHomePage() 18 | { 19 | return HomePage.class; 20 | } 21 | 22 | /** 23 | * @see org.apache.wicket.Application#init() 24 | */ 25 | @Override 26 | public void init() 27 | { 28 | super.init(); 29 | 30 | // add your configuration here 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/smartlinks/ISmartLink.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.smartlinks; 5 | 6 | import org.apache.wicket.ajax.AjaxRequestTarget; 7 | 8 | /** 9 | * @author reiern70 10 | * 11 | */ 12 | public interface ISmartLink { 13 | 14 | void onClick(AjaxRequestTarget target); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/smartlinks/ISmartLinkContext.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.smartlinks; 5 | 6 | /** 7 | * 8 | * @author reiern70 9 | */ 10 | public interface ISmartLinkContext { 11 | 12 | String getContextClass(); 13 | } -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/smartlinks/SmartLink.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.smartlinks; 5 | 6 | import org.apache.wicket.behavior.AttributeAppender; 7 | import org.apache.wicket.markup.html.WebMarkupContainer; 8 | import org.apache.wicket.model.Model; 9 | 10 | /** 11 | * @author reiern70 12 | * 13 | */ 14 | public abstract class SmartLink extends WebMarkupContainer implements ISmartLink { 15 | 16 | private static final long serialVersionUID = 1L; 17 | 18 | /** 19 | * @param id 20 | */ 21 | public SmartLink(String id) { 22 | super(id); 23 | setOutputMarkupId( true ); 24 | } 25 | 26 | @Override 27 | protected void onInitialize() { 28 | super.onInitialize(); 29 | ISmartLinkContext context = findParent(ISmartLinkContext.class); 30 | if(context != null) { 31 | add( new AttributeAppender("class", Model.of( "click" + context.getContextClass() ), " " ) ); 32 | add( new AttributeAppender("context", Model.of( context.getContextClass() ), " " ) ); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/smartlinks/SmartLinkDataTable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.smartlinks; 5 | 6 | import java.util.List; 7 | 8 | import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable; 9 | import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; 10 | import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider; 11 | 12 | /** 13 | * @author reiern70 14 | * 15 | */ 16 | public class SmartLinkDataTable extends AjaxFallbackDefaultDataTable implements ISmartLinkContext { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | public SmartLinkDataTable(String id, List> columns, 21 | ISortableDataProvider dataProvider, int rowsPerPage) { 22 | super(id, columns, dataProvider, rowsPerPage); 23 | setOutputMarkupId( true ); 24 | add( new SmartLinksBehavior() ); 25 | } 26 | 27 | @Override 28 | public String getContextClass() { 29 | return getMarkupId(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/smartlinks/SmartLinksBehavior.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.antilia.smartlinks; 5 | 6 | import org.apache.wicket.Component; 7 | import org.apache.wicket.MarkupContainer; 8 | import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; 9 | import org.apache.wicket.ajax.AjaxRequestTarget; 10 | import org.apache.wicket.markup.head.IHeaderResponse; 11 | import org.apache.wicket.markup.head.JavaScriptHeaderItem; 12 | import org.apache.wicket.markup.head.OnDomReadyHeaderItem; 13 | import org.apache.wicket.request.cycle.RequestCycle; 14 | import org.apache.wicket.request.resource.JavaScriptResourceReference; 15 | import org.apache.wicket.request.resource.ResourceReference; 16 | import org.apache.wicket.util.io.IClusterable; 17 | import org.apache.wicket.util.string.Strings; 18 | import org.apache.wicket.util.visit.IVisit; 19 | import org.apache.wicket.util.visit.IVisitor; 20 | 21 | /** 22 | * @author reiern70 23 | * 24 | */ 25 | public class SmartLinksBehavior extends AbstractDefaultAjaxBehavior { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | private static final ResourceReference JS = new JavaScriptResourceReference(SmartLinksBehavior.class, "smartLinksBehavior.js"); 30 | 31 | private static final String LINK_ID = "linkid"; 32 | 33 | private static class IdVisitor implements IVisitor, IClusterable { 34 | 35 | private static final long serialVersionUID = 1L; 36 | private String id; 37 | private Component component; 38 | 39 | private IdVisitor(String id) { 40 | this.id = id; 41 | } 42 | 43 | @Override 44 | public void component(final Component component, final IVisit visit) { 45 | if(id.equals(component.getMarkupId())) { 46 | this.component = component; 47 | visit.stop(); 48 | } 49 | } 50 | 51 | public Component getComponent() { 52 | return component; 53 | } 54 | } 55 | 56 | public SmartLinksBehavior() { 57 | } 58 | 59 | /* (non-Javadoc) 60 | * @see org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget) 61 | */ 62 | @Override 63 | protected void respond(AjaxRequestTarget target) { 64 | String linkId = RequestCycle.get().getRequest().getRequestParameters().getParameterValue(LINK_ID).toString(); 65 | if( !Strings.isEmpty( linkId ) ) { 66 | IdVisitor visitor = new IdVisitor(linkId); 67 | MarkupContainer container = (MarkupContainer)getComponent(); 68 | container.visitChildren( visitor ); 69 | Component component = visitor.getComponent(); 70 | if(component instanceof ISmartLink) { 71 | ((ISmartLink)component).onClick(target); 72 | } 73 | } 74 | } 75 | 76 | @Override 77 | public void renderHead(Component component, IHeaderResponse response) { 78 | super.renderHead(component, response); 79 | if(component instanceof ISmartLinkContext) { 80 | ISmartLinkContext context = (ISmartLinkContext)component; 81 | response.render( JavaScriptHeaderItem.forReference( JS ) ); 82 | StringBuilder builder = new StringBuilder(); 83 | builder.append("new Wicket.SmartLink('"); 84 | builder.append(component.getMarkupId()); 85 | builder.append("', '"); 86 | builder.append( context.getContextClass() ); 87 | builder.append("', '"); 88 | builder.append( getCallbackUrl() ); 89 | builder.append("');"); 90 | response.render( OnDomReadyHeaderItem.forScript( builder ) ); 91 | } else { 92 | throw new IllegalArgumentException("SmartLinksBehavior should be attaced to an instace of ISmartLinkContext!"); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/java/com/antilia/smartlinks/smartLinksBehavior.js: -------------------------------------------------------------------------------- 1 | ;(function( undefined ) { 2 | 'use strict'; 3 | 4 | if(typeof Wicket.SmartLinks == 'undefined') { 5 | Wicket.SmartLinks = {}; 6 | } 7 | 8 | Wicket.SmartLinks.map = {}; 9 | 10 | Wicket.SmartLink = function(id, clazz, url) { 11 | this.id = id; 12 | this.clazz = clazz; 13 | this.url = url; 14 | 15 | Wicket.SmartLinks.map[id] = this; 16 | 17 | // class or the links 18 | var $select = '#' + id + ' .' + 'click' + clazz; 19 | $( $select ).click( function() { 20 | var id = $(this).attr('id'); 21 | var context = $(this).attr('context'); 22 | Wicket.SmartLinks.clickLink(id, context); 23 | }) 24 | } 25 | 26 | Wicket.SmartLinks.clickLink = function( linkid, context ) { 27 | var c = Wicket.SmartLinks.map[context]; 28 | Wicket.Ajax.get({"u":c.url, "e": "click", "c":linkid, "ep":{ "linkid": linkid }}); 29 | } 30 | })(); 31 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.appender.Stdout=org.apache.log4j.ConsoleAppender 2 | log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout 3 | log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n 4 | 5 | log4j.rootLogger=INFO,Stdout 6 | 7 | log4j.logger.org.apache.wicket=INFO 8 | log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO 9 | log4j.logger.org.apache.wicket.version=INFO 10 | log4j.logger.org.apache.wicket.RequestCycle=INFO 11 | 12 | 13 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | wicket-sparelinks 7 | 8 | 18 | 19 | 20 | wicket.wicket-sparelinks 21 | org.apache.wicket.protocol.http.WicketFilter 22 | 23 | applicationClassName 24 | com.antilia.WicketApplication 25 | 26 | 27 | 28 | 29 | wicket.wicket-sparelinks 30 | /* 31 | 32 | 33 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/webapp/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-sparelinks/src/main/webapp/logo.png -------------------------------------------------------------------------------- /wicket-sparelinks/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | body, p, li, a { font-family: georgia, times, serif;font-size:13pt;} 2 | h1, h2, h3 { font-family: 'Yanone Kaffeesatz', arial, serif; } 3 | body { margin:0;padding:0;} 4 | #hd { 5 | width : 100%; 6 | height : 87px; 7 | background-color : #092E67; 8 | margin-top : 0; 9 | padding-top : 10px; 10 | border-bottom : 1px solid #888; 11 | z-index : 0; 12 | } 13 | #ft { 14 | position : absolute; 15 | bottom : 0; 16 | width : 100%; 17 | height : 99px; 18 | background-color : #6493D2; 19 | border-top : 1px solid #888; 20 | z-index : 0; 21 | } 22 | #logo,#bd { 23 | width : 650px; 24 | margin: 0 auto; 25 | padding: 25px 50px 0 50px; 26 | } 27 | #logo h1 { 28 | color : white; 29 | font-size:36pt; 30 | display: inline; 31 | } 32 | #logo img { 33 | display:inline; 34 | vertical-align: bottom; 35 | margin-left : 50px; 36 | margin-right : 5px; 37 | } 38 | body { margin-top : 0; padding-top : 0;} 39 | #logo, #logo h1 { margin-top : 0; padding-top : 0;} 40 | #bd { 41 | position : absolute; 42 | top : 75px; 43 | bottom : 75px; 44 | left : 50%; 45 | margin-left : -325px; 46 | z-index : 1; 47 | overflow: auto; 48 | background-color : #fff; 49 | -webkit-border-radius: 10px; 50 | -moz-border-radius: 10px; 51 | border-radius: 10px; 52 | -moz-box-shadow: 0px 0px 10px #888; 53 | -webkit-box-shadow: 0px 0px 10px #888; 54 | box-shadow: 0px 0px 10px #888; 55 | } 56 | a, a:visited, a:hover, a:active { 57 | color : #6493D2; 58 | } 59 | h2 { 60 | padding : 0; margin:0; 61 | font-size:36pt; 62 | color:#FF5500; 63 | } 64 | h3 { 65 | padding : 0; margin:0; 66 | font-size:24pt; 67 | color:#092E67; 68 | } -------------------------------------------------------------------------------- /wicket-sparelinks/src/test/java/com/antilia/Start.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.time.Duration; 4 | import org.eclipse.jetty.server.Server; 5 | import org.eclipse.jetty.server.bio.SocketConnector; 6 | import org.eclipse.jetty.server.ssl.SslSocketConnector; 7 | import org.eclipse.jetty.util.resource.Resource; 8 | import org.eclipse.jetty.util.ssl.SslContextFactory; 9 | import org.eclipse.jetty.webapp.WebAppContext; 10 | 11 | public class Start { 12 | public static void main(String[] args) throws Exception { 13 | int timeout = (int) Duration.ONE_HOUR.getMilliseconds(); 14 | 15 | Server server = new Server(); 16 | SocketConnector connector = new SocketConnector(); 17 | 18 | // Set some timeout options to make debugging easier. 19 | connector.setMaxIdleTime(timeout); 20 | connector.setSoLingerTime(-1); 21 | connector.setPort(8080); 22 | server.addConnector(connector); 23 | 24 | Resource keystore = Resource.newClassPathResource("/keystore"); 25 | if (keystore != null && keystore.exists()) { 26 | // if a keystore for a SSL certificate is available, start a SSL 27 | // connector on port 8443. 28 | // By default, the quickstart comes with a Apache Wicket Quickstart 29 | // Certificate that expires about half way september 2021. Do not 30 | // use this certificate anywhere important as the passwords are 31 | // available in the source. 32 | 33 | connector.setConfidentialPort(8443); 34 | 35 | SslContextFactory factory = new SslContextFactory(); 36 | factory.setKeyStoreResource(keystore); 37 | factory.setKeyStorePassword("wicket"); 38 | factory.setTrustStoreResource(keystore); 39 | factory.setKeyManagerPassword("wicket"); 40 | SslSocketConnector sslConnector = new SslSocketConnector(factory); 41 | sslConnector.setMaxIdleTime(timeout); 42 | sslConnector.setPort(8443); 43 | sslConnector.setAcceptors(4); 44 | server.addConnector(sslConnector); 45 | 46 | System.out.println("SSL access to the quickstart has been enabled on port 8443"); 47 | System.out.println("You can access the application using SSL on https://localhost:8443"); 48 | System.out.println(); 49 | } 50 | 51 | WebAppContext bb = new WebAppContext(); 52 | bb.setServer(server); 53 | bb.setContextPath("/"); 54 | bb.setWar("src/main/webapp"); 55 | 56 | // START JMX SERVER 57 | // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); 58 | // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); 59 | // server.getContainer().addEventListener(mBeanContainer); 60 | // mBeanContainer.start(); 61 | 62 | server.setHandler(bb); 63 | 64 | try { 65 | System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP"); 66 | server.start(); 67 | System.in.read(); 68 | System.out.println(">>> STOPPING EMBEDDED JETTY SERVER"); 69 | server.stop(); 70 | server.join(); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | System.exit(1); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/test/java/com/antilia/TestHomePage.java: -------------------------------------------------------------------------------- 1 | package com.antilia; 2 | 3 | import org.apache.wicket.util.tester.WicketTester; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | 7 | /** 8 | * Simple test using the WicketTester 9 | */ 10 | public class TestHomePage 11 | { 12 | private WicketTester tester; 13 | 14 | @Before 15 | public void setUp() 16 | { 17 | tester = new WicketTester(new WicketApplication()); 18 | } 19 | 20 | @Test 21 | public void homepageRendersSuccessfully() 22 | { 23 | //start and render the test page 24 | tester.startPage(HomePage.class); 25 | 26 | //assert rendered page class 27 | tester.assertRenderedPage(HomePage.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /wicket-sparelinks/src/test/resources/keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiern70/antilia-bits/91bc2639099b3455dece70358b8d796e6d5f7457/wicket-sparelinks/src/test/resources/keystore --------------------------------------------------------------------------------