Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title wicket:id="pageTitle">Wicket Examples</title>

<link rel="shortcut icon" href="favicon.ico"
type="image/vnd.microsoft.icon" />
Expand All @@ -23,6 +24,7 @@
Source code
</a>
</div>
<h1 wicket:id="exampleTitle">[example title]</h1>
<div>
<wicket:child/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@
import org.apache.wicket.markup.head.CssHeaderItem;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.link.PopupSettings;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.CssResourceReference;
import org.apache.wicket.util.string.Strings;

/**
* Base class for all example pages.
*
* <p>
* Shows the title of the example as the page heading and in the browser title. The title is
* looked up in the resource bundles under the key {@code <simple class name>.title}, usually in the
* {@code wicket-package.properties} of the example's package, so that an index page linking to
* the example can use the very same text. A page without such a key gets no heading.
*
* @author Jonathan Locke
*/
public class WicketExamplePage extends WebPage
Expand Down Expand Up @@ -96,7 +104,59 @@ public WicketExamplePage(IModel<?> model)
protected void explain()
{
}


@Override
protected void onInitialize()
{
super.onInitialize();

add(new Label("pageTitle", this::getPageTitle));
add(new Label("exampleTitle", this::getExampleTitle)
{
@Override
protected void onConfigure()
{
super.onConfigure();

setVisible(Strings.isEmpty(getExampleTitle()) == false);
}
});
}

/**
* @param page
* an example page
* @return the resource key of the title of the given example page
*/
public static String titleKey(Class<? extends WicketExamplePage> page)
{
return page.getSimpleName() + ".title";
}

/**
* @return the resource key of the title of this example, by default the one given by
* {@link #titleKey(Class)} for this page's class
*/
protected String getExampleTitleKey()
{
return titleKey(getClass());
}

private String getExampleTitle()
{
return getLocalizer().getStringIgnoreSettings(getExampleTitleKey(), this, null, null);
}

private String getPageTitle()
{
String exampleTitle = getExampleTitle();
if (Strings.isEmpty(exampleTitle))
{
return getString("examplesTitle");
}
return new StringResourceModel("pageTitle", this).setParameters(exampleTitle).getString();
}

@Override
public void renderHead(IHeaderResponse response)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
examplesTitle=Wicket Examples
pageTitle=Wicket Examples - {0}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>Wicket Examples - Ajax</title>
</head>
<body>
<wicket:extend>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>Wicket Examples - guestbook</title>
</head>
<body>
<wicket:extend>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<wicket:extend xmlns:wicket="http://wicket.apache.org">

<wicket:link>
<a href="AutoCompletePage.html">Auto-Complete TextField Example</a>: shows a text field with auto complete drop down like google suggest
<wicket:container wicket:id="examples">
<a wicket:id="link"><wicket:container wicket:id="title">[example title]</wicket:container></a>: <wicket:container wicket:id="description">[example description]</wicket:container>
<br/><br/>
<a href="ChoicePage.html">Drop Down Choice Example</a>: demonstrates the linked select boxes usecase
<br/><br/>
<a href="ClockPage.html">Clock Example</a>: demonstrates a self-updating component via AjaxSelfUpdatingTimerBehavior
<br/><br/>
<a href="EditableLabelPage.html">Editable Label Example</a>: shows a label that can be edited inline via ajax
<br/><br/>
<wicket:container wicket:id="effectsSection"><a href="EffectsPage.html">Effects Example</a>: shows how to link wicket component updates with jQuery UI effects
<br/><br/></wicket:container>
<a href="FormPage.html">Form Example</a>: shows ajax form processing
<br/><br/>
<a href="GuestBook.html">Guest book Example</a>: shows how a simple commenting system can be turned into ajax extravaganza.
<br/><br/>
<a href="LazyLoadingPage.html">LazyLoading Example</a>: demonstrates lazy loading of components.
<br/><br/>
<a href="LinksPage.html">Links Example</a>: demonstrates ajax enabled links
<br/><br/>
<a href="FileUploadPage.html">File Upload Example</a>: demonstrates trasnparent ajax handling of a multipart form
<br/><br/>
<a href="modal/ModalDialogPage.html">Modal dialog</a>: javascript modal dialog example
<br/><br/>
<a href="OnChangeAjaxBehaviorPage.html">On Change Ajax Updater Example</a>: demonstrates updating page with ajax when text field value is changed
<br/><br/>
<a href="PageablesPage.html">Pageables Example</a>: shows ajax paging
<br/><br/>
<a href="RatingsPage.html">Ratings example</a>: shows a rating component.
<br/><br/>
<a href="TabbedPanelPage.html">Tabbed Panel Example</a>: demonstrates ajax enabled tabbed panel
<br/><br/>
<a href="TodoList.html">Todo list Example</a>: shows ajax todo list page without writing any JavaScript
<br/><br/>
<a href="WorldClockPage.html">World Clock Example</a>: demonstrates a single component with AjaxTimerBehavior updating multiple components
<br/><br/>
<a href="AjaxDownloadPage.html">Ajax Download</a>: download initiated via Ajax
</wicket:link>
</wicket:container>

</wicket:extend>
</wicket:extend>
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@
*/
package org.apache.wicket.examples.ajax.builtin;

import java.util.List;

import org.apache.wicket.examples.AjaxEngineSelector;
import org.apache.wicket.examples.WicketExamplePage;
import org.apache.wicket.examples.ajax.builtin.modal.ModalDialogPage;
import org.apache.wicket.examples.homepage.HomePage;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.ResourceModel;

/**
* Wicket ajax example index page
Expand All @@ -28,16 +36,42 @@
*/
public class Index extends BasePage
{
private static final List<Class<? extends BasePage>> EXAMPLES = List.of(
AutoCompletePage.class, ChoicePage.class, ClockPage.class, EditableLabelPage.class,
EffectsPage.class, FormPage.class, GuestBook.class, LazyLoadingPage.class,
LinksPage.class, FileUploadPage.class, ModalDialogPage.class,
OnChangeAjaxBehaviorPage.class, PageablesPage.class, RatingsPage.class,
TabbedPanelPage.class, TodoList.class, WorldClockPage.class, AjaxDownloadPage.class);

/**
* Constructor.
*/
public Index()
{
IModel<List<Class<? extends BasePage>>> examples = () -> EXAMPLES.stream()
.filter(Index::isAvailable)
.toList();

add(new ListView<>("examples", examples)
{
@Override
protected void populateItem(ListItem<Class<? extends BasePage>> item)
{
Class<? extends BasePage> page = item.getModelObject();
BookmarkablePageLink<Void> link = new BookmarkablePageLink<>("link", page);
link.add(new Label("title", new ResourceModel(titleKey(page))));
item.add(link);
item.add(new Label("description",
new ResourceModel(page.getSimpleName() + ".description")));
}
});
}

private static boolean isAvailable(Class<? extends BasePage> page)
{
// EffectsPage needs jQuery UI, which the plain JavaScript Ajax engine does not load
WebMarkupContainer effectsSection = new WebMarkupContainer("effectsSection");
effectsSection.setVisible(
AjaxEngineSelector.getEffectiveEngine() == AjaxEngineSelector.Engine.JQUERY);
add(effectsSection);
return page != EffectsPage.class ||
AjaxEngineSelector.getEffectiveEngine() == AjaxEngineSelector.Engine.JQUERY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>ajax-test</title>
</head>

<body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>Wicket Examples - Ajax - Ratings style</title>
</head>
<body>
<wicket:extend>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<title>Wicket Examples - Ajax - Todo list</title>
</head>
<body>
<wicket:extend>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Index.title=Ajax Examples

AutoCompletePage.title=Auto-Complete TextField Example
AutoCompletePage.description=shows a text field with auto complete drop down like google suggest

ChoicePage.title=Drop Down Choice Example
ChoicePage.description=demonstrates the linked select boxes usecase

ClockPage.title=Clock Example
ClockPage.description=demonstrates a self-updating component via AjaxSelfUpdatingTimerBehavior

EditableLabelPage.title=Editable Label Example
EditableLabelPage.description=shows a label that can be edited inline via ajax

EffectsPage.title=Effects Example
EffectsPage.description=shows how to link wicket component updates with jQuery UI effects

FormPage.title=Form Example
FormPage.description=shows ajax form processing

GuestBook.title=Guest book Example
GuestBook.description=shows how a simple commenting system can be turned into ajax extravaganza.

LazyLoadingPage.title=LazyLoading Example
LazyLoadingPage.description=demonstrates lazy loading of components.

LinksPage.title=Links Example
LinksPage.description=demonstrates ajax enabled links

FileUploadPage.title=File Upload Example
FileUploadPage.description=demonstrates transparent ajax handling of a multipart form

ModalDialogPage.title=Modal dialog
ModalDialogPage.description=javascript modal dialog example

OnChangeAjaxBehaviorPage.title=On Change Ajax Updater Example
OnChangeAjaxBehaviorPage.description=demonstrates updating page with ajax when text field value is changed

PageablesPage.title=Pageables Example
PageablesPage.description=shows ajax paging

RatingsPage.title=Ratings example
RatingsPage.description=shows a rating component.

TabbedPanelPage.title=Tabbed Panel Example
TabbedPanelPage.description=demonstrates ajax enabled tabbed panel

TodoList.title=Todo list Example
TodoList.description=shows ajax todo list page without writing any JavaScript

WorldClockPage.title=World Clock Example
WorldClockPage.description=demonstrates a single component with AjaxTimerBehavior updating multiple components

AjaxDownloadPage.title=Ajax Download
AjaxDownloadPage.description=download initiated via Ajax
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<html xmlns:wicket="http://wicket.apache.org">
<wicket:head>
<title>Wicket Examples - Prototype.js / component render</title>
</wicket:head>
<body>
<wicket:extend>
<p>Counting link using Ajax: <a href="#" wicket:id="link">Click me!</a></p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Index.title=AJAX with Prototype.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
<head>
<title>Wicket Examples - hellobrowser</title>
</head>
<body>
<wicket:extend>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
AjaxHelloBrowser.title=Ajax Browser Info
Loading
Loading