You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/06/14 18:15:42 UTC

svn commit: r547290 - in /incubator/wicket/trunk/jdk-1.5/wicket-examples: ./ src/main/java/org/apache/wicket/examples/ src/main/java/org/apache/wicket/examples/source/

Author: almaw
Date: Thu Jun 14 09:15:41 2007
New Revision: 547290

URL: http://svn.apache.org/viewvc?view=rev&rev=547290
Log:
WICKET-638 - The wicket-examples source code view is not resizable.
Also add some syntax highlighting.

Modified:
    incubator/wicket/trunk/jdk-1.5/wicket-examples/pom.xml
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.html
    incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.java

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/pom.xml?view=diff&rev=547290&r1=547289&r2=547290
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/pom.xml (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/pom.xml Thu Jun 14 09:15:41 2007
@@ -72,6 +72,11 @@
 			<version>1.4</version>
 		</dependency>		
 		<dependency>
+			<groupId>com.uwyn</groupId>
+			<artifactId>jhighlight</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
 			<groupId>httpunit</groupId>
 			<artifactId>httpunit</artifactId>
 		</dependency>

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java?view=diff&rev=547290&r1=547289&r2=547290
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/WicketExampleHeader.java Thu Jun 14 09:15:41 2007
@@ -57,7 +57,7 @@
 		};
 		add(link);
 
-		PopupSettings settings = new PopupSettings(PageMap.forName("sources"));
+		PopupSettings settings = new PopupSettings(PageMap.forName("sources"), PopupSettings.RESIZABLE);
 		settings.setWidth(800);
 		settings.setHeight(600);
 		settings.setWindowName("sources");

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.html?view=diff&rev=547290&r1=547289&r2=547290
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.html (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.html Thu Jun 14 09:15:41 2007
@@ -7,41 +7,34 @@
 	<script language="JavaScript" type="text/javascript" src="scriptaculous.js"></script>
 	<script language="JavaScript" type="text/javascript" src="effects.js"></script>
 	<style type="text/css">
-		#content {
-		    width : 800px;
-			height : 600px;
+		body {
+			padding: 0;
+			margin: 0;
 		}
-		#header {
+		.left {
+			width : 220px;
 		}
-		.header {
-			height : 20px;
+		#header {
+			height: 20px;
 			background-color : #888;
 			color : #fff;
-			position : absolute;
-			top : 0px;
-			text-align : center;
 		}
-		.body {
+		#body .left,
+		#body .right {
 			position : absolute;
 			top : 20px;
-			height : 490px;
-			overflow : scroll;
-			border-bottom : 1px solid #aaa;
-		}
-		.left {
-			width : 220px;
-			left : 0px;
-		}
-		.left{
-			border-right : 1px solid #aaa;
+			bottom: 90px;
 		}
-		.right {
-			width : 579px;
-			left : 221px;
-		}
-		.body.right {
+		#body .left {
+			overflow: auto;
+			border-right: 1px solid #aaa;
+		}
+		#body .right {
+			right: 0;
+			left: 221px;
 			padding-left : 5px;
-			width : 574px;
+			overflow: auto;
+			line-height: normal;
 		}
 		#footer {
 		    text-align : center;
@@ -49,41 +42,102 @@
 		    bottom : 0;
 		    height : 90px;
 		    width : 100%;
-		}
-		pre {
-			line-height : 14px;
-			font-size : 11px;
-			font-family : Lucida Console, Monospace, Courier New, Courier, Fixed;
+		    border-top: 1px solid #aaa;
 		}
 		ul {
 			list-style-type : none;
 			margin : 0px;
 			padding : 10px;
 		}
+		
+		code {
+			color: rgb(0,0,0);
+			white-space: nowrap;
+			font-size : 11px;
+			font-family : Lucida Console, Monospace, Courier New, Courier, Fixed;
+		}
+		.java_type {
+			color: rgb(0,44,221);
+		}
+		.java_comment {
+			color: rgb(147,147,147); background-color: rgb(247,247,247);
+		}
+		.java_operator {
+			color: rgb(0,124,31);
+		}
+		.java_separator {
+			color: rgb(0,33,255);
+		}
+		.java_plain {
+			color: rgb(0,0,0);
+		}
+		.java_javadoc_comment {
+			color: rgb(147,147,147); background-color: rgb(247,247,247); font-style: italic;
+		}
+		.java_keyword {
+			color: rgb(0,0,0); font-weight: bold;
+		}
+		.java_literal {
+			color: rgb(188,0,0);
+		}
+		.java_javadoc_tag {
+			color: rgb(147,147,147); background-color: rgb(247,247,247); font-style: italic; font-weight: bold;
+		}
+		
+		e {
+			color: rgb(0,0,0); font-family: monospace; font-size: 12px; white-space: nowrap;
+		}
+		.xml_tag_symbols {
+			color: rgb(0,59,255);
+		}
+		.xml_rife_tag {
+			color: rgb(0,0,0); background-color: rgb(228,230,160);
+		}
+		.xml_plain {
+			color: rgb(0,0,0);
+		}
+		.xml_comment {
+			color: rgb(147,147,147); background-color: rgb(247,247,247);
+		}
+		.xml_attribute_name {
+			color: rgb(0,0,0); font-weight: bold;
+		}
+		.xml_tag_name {
+			color: rgb(0,55,255);
+		}
+		.xml_char_data {
+			color: rgb(0,0,0);
+		}
+		.xml_processing_instruction {
+			color: rgb(0,0,0); font-weight: bold; font-style: italic;
+		}
+		.xml_attribute_value {
+			color: rgb(193,0,0);
+		}
+		.xml_rife_name {
+			color: rgb(0,0,196); background-color: rgb(228,230,160);
+		}
 	</style>
 </head>
 <body>
-<div id="content">
 	<div id="header">
-		<div class="left header">Files</div>
-		<div class="right header">Code for <span wicket:id="filename"></span></div>
+		<div class="left">Files</div>
+		<div class="right">Code for <span wicket:id="filename"></span></div>
 	</div>
 	<div id="body">
-		<div class="left body" wicket:id="filespanel">
+		<div class="left" wicket:id="filespanel">
 			<ul>
 				<li wicket:id="file">
 					<a href="#" wicket:id="link"><span wicket:id="name"></span></a>
 				</li>
 			</ul>
 		</div>
-		<div class="right body" wicket:id="codepanel">
-			<pre wicket:id="code"></pre>
+		<div class="right" wicket:id="codepanel">
+			<code wicket:id="code"></code>
 		</div>
 	</div>
 	<div id="footer">
-		<a href="#" wicket:id="close">[close]</a>
+		[<a href="#" wicket:id="close">Close</a>]
 	</div>
-</div>
-
 </body>
 </html>

Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.java?view=diff&rev=547290&r1=547289&r2=547290
==============================================================================
--- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.java (original)
+++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/source/SourcesPage.java Thu Jun 14 09:15:41 2007
@@ -52,6 +52,9 @@
 import org.apache.wicket.util.string.AppendingStringBuffer;
 import org.apache.wicket.util.string.Strings;
 
+import com.uwyn.jhighlight.renderer.Renderer;
+import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
+
 
 /**
  * Displays the resources in a packages directory in a browsable format.
@@ -104,7 +107,17 @@
 					sb.append(br.readLine());
 					sb.append("\n");
 				}
-				return sb.toString();
+				int lastDot = name.lastIndexOf('.');
+				if (lastDot != -1)
+				{
+					String type = name.substring(lastDot + 1);
+					Renderer renderer = XhtmlRendererFactory.getRenderer(type);
+					if (renderer != null)
+					{
+						return renderer.highlight(name, sb.toString(), "UTF-8", true);
+					}
+				}
+				return Strings.escapeMarkup(sb.toString(), false, true).toString().replaceAll("\n", "<br />");
 			}
 			catch (IOException e)
 			{
@@ -381,7 +394,7 @@
 		{
 			super(id);
 			Label code = new Label("code", new SourceModel());
-			code.setEscapeModelStrings(true);
+			code.setEscapeModelStrings(false);
 			code.setOutputMarkupId(true);
 			add(code);
 		}



Re: svn commit: r547290 - in /incubator/wicket/trunk/jdk-1.5/wicket-examples: ./ src/main/java/org/apache/wicket/examples/ src/main/java/org/apache/wicket/examples/source/

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* almaw@apache.org:
> Author: almaw
> Date: Thu Jun 14 09:15:41 2007
> New Revision: 547290
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=547290
> Log:
> WICKET-638 - The wicket-examples source code view is not resizable.
> Also add some syntax highlighting.

Syntax highlighting in the examples, woohooo!!!  Thanks a lot
AlMaw, you're my hero of the day ;-)
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/