You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pa...@apache.org on 2020/02/10 20:44:43 UTC

[wicket] branch csp-examples updated: WICKET-6737: moved inline styling to css files

This is an automated email from the ASF dual-hosted git repository.

papegaaij pushed a commit to branch csp-examples
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/csp-examples by this push:
     new 7bb1813  WICKET-6737: moved inline styling to css files
7bb1813 is described below

commit 7bb181340384e0185182af8fdd3a5e9439400d84
Author: Emond Papegaaij <em...@topicus.nl>
AuthorDate: Mon Feb 10 21:42:42 2020 +0100

    WICKET-6737: moved inline styling to css files
---
 .../examples/ajax/builtin/AjaxDownloadPage.html    | 17 ------
 .../examples/ajax/builtin/AutoCompletePage.html    | 19 -------
 .../wicket/examples/ajax/builtin/ClockPage.html    |  2 +-
 .../examples/ajax/builtin/EditableLabelPage.html   |  5 --
 .../wicket/examples/ajax/builtin/EffectsPage.html  | 13 -----
 .../wicket/examples/ajax/builtin/EffectsPage.java  |  7 +++
 .../examples/ajax/builtin/FileUploadPage.html      | 15 ------
 .../wicket/examples/ajax/builtin/LinksPage.html    | 10 ----
 .../wicket/examples/ajax/builtin/LinksPage.java    | 10 ++++
 .../wicket/examples/ajax/builtin/TodoList.html     | 18 -------
 .../wicket/examples/ajax/builtin/TodoList.java     | 11 ++++
 .../examples/ajax/builtin/WorldClockPage.html      | 10 ++--
 .../apache/wicket/examples/ajax/builtin/todo.css   | 34 ++++++++++++
 .../resources/org/apache/wicket/examples/style.css | 60 ++++++++++++++++++++++
 14 files changed, 128 insertions(+), 103 deletions(-)

diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AjaxDownloadPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AjaxDownloadPage.html
index dd7e3ab..0ac79df 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AjaxDownloadPage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AjaxDownloadPage.html
@@ -1,23 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns:wicket="http://wicket.apache.org">
 <head>
-<wicket:head>
-    <style>
-    	.download-veil {
-    		position: absolute;
-    		left: 20%;
-    		right: 20%;
-    		color: white;
-    		background-color: darkorange;
-    		font-size: 40px;
-    		text-align: center;
-    	}
-
-    	.download-veil span {
-    		line-height: 128px;
-    	}
-    </style>
-</wicket:head>
 </head>
 <body>
 <wicket:extend>
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.html
index d61961d..8a20c5c 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/AutoCompletePage.html
@@ -1,24 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns:wicket="http://wicket.apache.org">
-	<head>
-		<wicket:head>
-			<style>
-				div.wicket-aa {
-					font-family: "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana;
-					font-size: 12px;
-					background-color: white;
-					border-width: 1px;
-					border-color: #cccccc;
-					border-style: solid;
-					padding: 2px;
-					margin: 1px 0 0 0;
-					text-align:left;
-				}
-				div.wicket-aa ul { list-style:none; padding: 2px; margin:0; }
-				div.wicket-aa ul li.selected { background-color: #FFFF00; padding: 2px; margin:0; }
-			</style>
-		</wicket:head>
-	</head>
 	<body>
 
 		<wicket:extend>
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/ClockPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/ClockPage.html
index 0a1334e..694fd1f 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/ClockPage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/ClockPage.html
@@ -6,6 +6,6 @@ This behavior can be attached to any component to make it update itself every x
 The clock below is updated every five seconds.
 
 <br/><br/>
-The server time now is: <span wicket:id="clock" style="border: 3px solid red; padding: 10px;">[clock]</span>
+The server time now is: <span wicket:id="clock" class="dotted-box">[clock]</span>
 
 </wicket:extend>
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EditableLabelPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EditableLabelPage.html
index caf1c18..86913e8 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EditableLabelPage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EditableLabelPage.html
@@ -1,10 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <wicket:extend xmlns:wicket="http://wicket.apache.org">
-<style>
-	span.inline-edit { border: 1px solid green; padding: 4px; }
-	span.inline-edit input { border:0; margin:0; padding:0; }
-</style>
-
 <form wicket:id="form">
 
 <p>
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.html
index d875cea..44bc8f8 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.html
@@ -1,19 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns:wicket="http://wicket.apache.org">
-<head>
-	<wicket:head>
-		<script language="JavaScript" type="text/javascript" src="jquery-ui-1.10.3.custom.js"></script>
-	</wicket:head>
-</head>
 <wicket:extend>
-<style>
-	div.container { font-size: 14pt; }
-	
-	/* make effects work nicely with inline elements */
-    .ui-effects-wrapper {
-        display:inline;
-    }
-</style>
 <div class="container">
 	<div>
 		<p>
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.java
index b0749ff..2cfae8a 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/EffectsPage.java
@@ -24,7 +24,9 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
 import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.markup.head.CssHeaderItem;
 import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
 import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.model.PropertyModel;
@@ -176,7 +178,12 @@ public class EffectsPage extends BasePage
 	public void renderHead(IHeaderResponse response)
 	{
 		super.renderHead(response);
+		response.render(JavaScriptHeaderItem.forUrl("jquery-ui-1.10.3.custom.js"));
 		response.render(OnDomReadyHeaderItem.forScript("jQuery.noConflict();"));
+		// make effects work nicely with inline elements 
+		response.render(CssHeaderItem.forCSS(
+			"div.container { font-size: 14pt; } .ui-effects-wrapper { display:inline; }",
+			"effects"));
 	}
 
 }
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FileUploadPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FileUploadPage.html
index 18d2bfb..3d54b24 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FileUploadPage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/FileUploadPage.html
@@ -1,20 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns:wicket="http://wicket.apache.org">
-<head>
-	<wicket:head>
-		<style>
-			.drop-zone {
-				border: 1px dotted #FF9925;
-				width:200px;
-				height:200px;
-			}
-			.drop-zone.drag-over {
-				background: #FF9925;
-				color: #ffffff;
-			}
-		</style>
-	</wicket:head>
-</head>
 <body>
 <wicket:extend xmlns:wicket="http://wicket.apache.org">
 
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.html
index 574ebf3..a06e00c 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.html
@@ -1,15 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <html xmlns:wicket="http://wicket.apache.org">
-<wicket:head>
-
-<style>
-
-	span.wicket-ajax-indicator { margin:0; padding:0; padding-left: 2px; }
-	
-</style>
-
-</wicket:head>
-
 <wicket:extend>
 
 
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java
index e65b25f..8da4ab5 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/LinksPage.java
@@ -29,6 +29,8 @@ import org.apache.wicket.ajax.attributes.IAjaxCallListener;
 import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.settings.ExceptionSettings;
@@ -225,4 +227,12 @@ public class LinksPage extends BasePage
 			}
 		});
 	}
+	
+	@Override
+	public void renderHead(IHeaderResponse response)
+	{
+		super.renderHead(response);
+		response.render(CssHeaderItem.forCSS(
+			"span.wicket-ajax-indicator { margin:0; padding:0; padding-left: 2px; }", "indicator"));
+	}
 }
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.html
index 017d059..61b27bb 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.html
@@ -2,24 +2,6 @@
 <html xmlns:wicket="http://wicket.apache.org">
 <head>
   <title>Wicket Examples - Ajax - Todo list</title>
-  <wicket:head>
-    <style type="text/css">
-		div {
-			aborder : 1px solid red;
-		}
-		.item {
-		}
-		.itemCheck {
-			float : left;
-			width : 50px;
-			text-align : right;
-			padding-right : 10px;
-		}
-		.itemText {
-			width : auto;
-		}
-    </style>
-  </wicket:head>
 </head>
 <body>
   <wicket:extend>
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java
index d04c5e8..6e4012f 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/TodoList.java
@@ -24,6 +24,8 @@ import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
 import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Form;
@@ -32,6 +34,7 @@ import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.resource.CssResourceReference;
 import org.apache.wicket.util.io.IClusterable;
 
 /**
@@ -421,4 +424,12 @@ public class TodoList extends BasePage
 		// add the add container for the todo items.
 		add(new AddItemsContainer("addItems"));
 	}
+	
+	@Override
+	public void renderHead(IHeaderResponse response)
+	{
+		super.renderHead(response);
+		response.render(
+			CssHeaderItem.forReference(new CssResourceReference(TodoList.class, "todo.css")));
+	}
 }
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/WorldClockPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/WorldClockPage.html
index 5f2fd4f..694ad6f 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/WorldClockPage.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/WorldClockPage.html
@@ -8,23 +8,23 @@ Within this callback it is very simple to update any number of components via aj
 <br/><br/>
 <table cellspacing="0" cellpadding="2">
 <tr>
-	<td style="align:right;">Los Angeles:</td>
+	<td class="text-right">Los Angeles:</td>
 	<td><span wicket:id="la">[la clock]</span></td>
 </tr>
 <tr>
-	<td style="align:right;">New York:</td>
+	<td class="text-right">New York:</td>
 	<td><span wicket:id="ny">[ny clock]</span></td>
 </tr>
 <tr>
-	<td style="align:right;">London:</td>
+	<td class="text-right">London:</td>
 	<td><span wicket:id="london">[london clock]</span></td>
 </tr>
 <tr>
-	<td style="align:right;">Prague:</td>
+	<td class="text-right">Prague:</td>
 	<td><span wicket:id="prague">[prague clock]</span></td>
 </tr>
 <tr>
-	<td style="align:right;">Moscow:</td>
+	<td class="text-right">Moscow:</td>
 	<td><span wicket:id="moscow">[moscow clock]</span></td>
 </tr>
 </table>
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/todo.css b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/todo.css
new file mode 100644
index 0000000..324cece
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/todo.css
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+div {
+	aborder: 1px solid red;
+}
+
+.item {
+	
+}
+
+.itemCheck {
+	float: left;
+	width: 50px;
+	text-align: right;
+	padding-right: 10px;
+}
+
+.itemText {
+	width: auto;
+}
diff --git a/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css b/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css
index 1705208..e02eac0 100644
--- a/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css
+++ b/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css
@@ -1322,4 +1322,64 @@ div.tabpanel4 div.tab-row a:hover {
 
 .color-red {
 	color: red;
+}
+
+span.inline-edit {
+	border: 1px solid green;
+	padding: 4px;
+}
+
+span.inline-edit input {
+	border: 0;
+	margin: 0;
+	padding: 0;
+}
+
+div.wicket-aa {
+	font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana;
+	font-size: 12px;
+	background-color: white;
+	border-width: 1px;
+	border-color: #cccccc;
+	border-style: solid;
+	padding: 2px;
+	margin: 1px 0 0 0;
+	text-align: left;
+}
+
+div.wicket-aa ul {
+	list-style: none;
+	padding: 2px;
+	margin: 0;
+}
+
+div.wicket-aa ul li.selected {
+	background-color: #FFFF00;
+	padding: 2px;
+	margin: 0;
+}
+
+.drop-zone {
+	border: 1px dotted #FF9925;
+	width: 200px;
+	height: 200px;
+}
+
+.drop-zone.drag-over {
+	background: #FF9925;
+	color: #ffffff;
+}
+
+.download-veil {
+	position: absolute;
+	left: 20%;
+	right: 20%;
+	color: white;
+	background-color: darkorange;
+	font-size: 40px;
+	text-align: center;
+}
+
+.download-veil span {
+	line-height: 128px;
 }
\ No newline at end of file