]> source.dussan.org Git - gitblit.git/commitdiff
Support Markdown rendering. Use Wicket GoogleCharts from Maven.
authorJames Moger <james.moger@gitblit.com>
Thu, 21 Apr 2011 00:16:31 +0000 (20:16 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 21 Apr 2011 00:16:31 +0000 (20:16 -0400)
44 files changed:
.classpath
build.xml
contrib/com/codecommit/wicket/AbstractChartData.java [deleted file]
contrib/com/codecommit/wicket/AreaFillType.java [deleted file]
contrib/com/codecommit/wicket/AxisAlignment.java [deleted file]
contrib/com/codecommit/wicket/Chart.java [deleted file]
contrib/com/codecommit/wicket/ChartAxis.java [deleted file]
contrib/com/codecommit/wicket/ChartAxisType.java [deleted file]
contrib/com/codecommit/wicket/ChartDataEncoding.java [deleted file]
contrib/com/codecommit/wicket/ChartGrid.java [deleted file]
contrib/com/codecommit/wicket/ChartProvider.java [deleted file]
contrib/com/codecommit/wicket/ChartType.java [deleted file]
contrib/com/codecommit/wicket/FillArea.java [deleted file]
contrib/com/codecommit/wicket/IChartAxis.java [deleted file]
contrib/com/codecommit/wicket/IChartData.java [deleted file]
contrib/com/codecommit/wicket/IChartFill.java [deleted file]
contrib/com/codecommit/wicket/IChartGrid.java [deleted file]
contrib/com/codecommit/wicket/IChartProvider.java [deleted file]
contrib/com/codecommit/wicket/IFillArea.java [deleted file]
contrib/com/codecommit/wicket/ILineStyle.java [deleted file]
contrib/com/codecommit/wicket/ILinearGradientFill.java [deleted file]
contrib/com/codecommit/wicket/ILinearStripesFill.java [deleted file]
contrib/com/codecommit/wicket/IRangeMarker.java [deleted file]
contrib/com/codecommit/wicket/IShapeMarker.java [deleted file]
contrib/com/codecommit/wicket/ISolidFill.java [deleted file]
contrib/com/codecommit/wicket/LineStyle.java [deleted file]
contrib/com/codecommit/wicket/LinearGradientFill.java [deleted file]
contrib/com/codecommit/wicket/LinearStripesFill.java [deleted file]
contrib/com/codecommit/wicket/MarkerType.java [deleted file]
contrib/com/codecommit/wicket/Range.java [deleted file]
contrib/com/codecommit/wicket/RangeMarker.java [deleted file]
contrib/com/codecommit/wicket/RangeType.java [deleted file]
contrib/com/codecommit/wicket/ShapeMarker.java [deleted file]
contrib/com/codecommit/wicket/SolidFill.java [deleted file]
gitblit.properties
src/com/gitblit/Build.java
src/com/gitblit/wicket/GitBlitWebApp.java
src/com/gitblit/wicket/GitBlitWebApp.properties
src/com/gitblit/wicket/pages/BlobPage.java
src/com/gitblit/wicket/pages/MarkdownPage.html [new file with mode: 0644]
src/com/gitblit/wicket/pages/MarkdownPage.java [new file with mode: 0644]
src/com/gitblit/wicket/pages/SummaryPage.java
src/com/gitblit/wicket/resources/gitblit.css
src/com/gitblit/wicket/resources/markdown.css [new file with mode: 0644]

index f4a6cb60fe4824236c8ef7775a8051c662ccb32f..70505fff0ef30c0a49a1e9b20d45043b08f6d1ac 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <classpath>\r
        <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="src" path="contrib"/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
        <classpathentry kind="lib" path="ext/log4j-1.2.16.jar"/>\r
        <classpathentry kind="lib" path="ext/servlet-api-2.5.jar"/>\r
@@ -15,5 +14,7 @@
        <classpathentry kind="lib" path="ext/wicket-extensions-1.4.17.jar"/>\r
        <classpathentry kind="lib" path="lib/jgit-0.11.3.jar"/>\r
        <classpathentry kind="lib" path="lib/jgit-http-0.11.3.jar"/>\r
+       <classpathentry kind="lib" path="ext/markdownpapers-core-1.0.0.jar"/>\r
+       <classpathentry kind="lib" path="ext/googlecharts-1.4.17.jar"/>\r
        <classpathentry kind="output" path="bin"/>\r
 </classpath>\r
index 524a1789662af447eaebd0dd316ef0ee22183131..08de19b2344b97ab8daac8dbeded19189f9abd79 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -32,7 +32,6 @@
                </path>\r
                <javac destdir="${project.build.dir}">\r
                        <src path="${basedir}/src" />\r
-                       <src path="${basedir}/contrib" />\r
                        <classpath refid="master-classpath" />\r
                </javac>\r
                <copy todir="${project.build.dir}">\r
diff --git a/contrib/com/codecommit/wicket/AbstractChartData.java b/contrib/com/codecommit/wicket/AbstractChartData.java
deleted file mode 100644 (file)
index 73c0092..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.io.Serializable;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public abstract class AbstractChartData implements IChartData, Serializable {\r
-       \r
-       private static final long serialVersionUID = 1L;\r
-\r
-       private ChartDataEncoding encoding;\r
-       private double max;\r
-       \r
-       public AbstractChartData() {\r
-               this(62);\r
-       }\r
-       \r
-       public AbstractChartData(double max) {\r
-               this(ChartDataEncoding.SIMPLE, max);\r
-       }\r
-       \r
-       public AbstractChartData(ChartDataEncoding encoding, double max) {\r
-               this.encoding = encoding;\r
-               this.max = max;\r
-       }\r
-\r
-       public ChartDataEncoding getEncoding() {\r
-               return encoding;\r
-       }\r
-       \r
-       public double getMax() {\r
-               return max;\r
-       }\r
-       \r
-       public void setEncoding(ChartDataEncoding encoding) {\r
-               this.encoding = encoding;\r
-       }\r
-       \r
-       public void setMax(double max) {\r
-               this.max = max;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/AreaFillType.java b/contrib/com/codecommit/wicket/AreaFillType.java
deleted file mode 100644 (file)
index 76ed1a1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public enum AreaFillType {\r
-       BETWEEN("b"),\r
-       DOWN("B");\r
-       \r
-       private final String rendering;\r
-       \r
-       private AreaFillType(String rendering) {\r
-               this.rendering = rendering;\r
-       }\r
-       \r
-       public String getRendering() {\r
-               return rendering;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/AxisAlignment.java b/contrib/com/codecommit/wicket/AxisAlignment.java
deleted file mode 100644 (file)
index 0f15ec0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public enum AxisAlignment {\r
-       LEFT(-1),\r
-       CENTER(0),\r
-       RIGHT(1);\r
-       \r
-       private final int rendering;\r
-       \r
-       private AxisAlignment(int rendering) {\r
-               this.rendering = rendering;\r
-       }\r
-       \r
-       public int getRendering() {\r
-               return rendering;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/Chart.java b/contrib/com/codecommit/wicket/Chart.java
deleted file mode 100644 (file)
index 95461cf..0000000
+++ /dev/null
@@ -1,602 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-import java.awt.Dimension;\r
-import java.lang.reflect.InvocationTargetException;\r
-import java.util.concurrent.locks.ReadWriteLock;\r
-import java.util.concurrent.locks.ReentrantReadWriteLock;\r
-\r
-import org.apache.wicket.markup.ComponentTag;\r
-import org.apache.wicket.markup.html.WebComponent;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class Chart extends WebComponent {\r
-       private static final long serialVersionUID = 1L;\r
-\r
-       private IChartProvider provider;\r
-       \r
-       private StringBuilder url;\r
-       private final ReadWriteLock lock = new ReentrantReadWriteLock();\r
-       \r
-       public Chart(String id, IChartProvider provider) {\r
-               super(id);\r
-               \r
-               this.provider = provider;\r
-       }\r
-       \r
-       @Override\r
-       public boolean getStatelessHint() {\r
-               return false;\r
-       }\r
-       \r
-       public void invalidate() {\r
-               lock.writeLock().lock();\r
-               try {\r
-                       url = null;\r
-               } finally {\r
-                       lock.writeLock().unlock();\r
-               }\r
-       }\r
-       \r
-       public CharSequence constructURL() {\r
-               lock.writeLock().lock();\r
-               try {\r
-                       if (url != null) {\r
-                               return url;\r
-                       }\r
-                       \r
-                       url = new StringBuilder("http://chart.apis.google.com/chart?");\r
-                       \r
-                       addParameter(url, "chs", render(provider.getSize()));\r
-                       addParameter(url, "chd", render(provider.getData()));\r
-                       addParameter(url, "cht", render(provider.getType()));\r
-                       addParameter(url, "chbh", render(provider.getBarWidth(), provider.getBarGroupSpacing()));\r
-                       addParameter(url, "chtt", render(provider.getTitle()));\r
-                       addParameter(url, "chdl", render(provider.getLegend()));\r
-                       addParameter(url, "chco", render(provider.getColors()));\r
-                       \r
-                       IChartFill bgFill = provider.getBackgroundFill();\r
-                       IChartFill fgFill = provider.getChartFill();\r
-       \r
-                       StringBuilder fillParam = new StringBuilder();\r
-       \r
-                       if (bgFill != null) {\r
-                               fillParam.append("bg,").append(render(bgFill));\r
-                       }\r
-       \r
-                       if (fgFill != null) {\r
-                               if (fillParam.length() > 0) {\r
-                                       fillParam.append('|');\r
-                               }\r
-       \r
-                               fillParam.append("c,").append(render(fgFill));\r
-                       }\r
-                       \r
-                       if (fillParam.toString().trim().equals("")) {\r
-                               fillParam = null;\r
-                       }\r
-       \r
-                       addParameter(url, "chf", fillParam);\r
-       \r
-                       IChartAxis[] axes = provider.getAxes();\r
-                       addParameter(url, "chxt", renderTypes(axes));\r
-                       addParameter(url, "chxl", renderLabels(axes));\r
-                       addParameter(url, "chxp", renderPositions(axes));\r
-                       addParameter(url, "chxr", renderRanges(axes));\r
-                       addParameter(url, "chxs", renderStyles(axes));\r
-                       \r
-                       addParameter(url, "chg", render(provider.getGrid()));\r
-                       addParameter(url, "chm", render(provider.getShapeMarkers()));\r
-                       addParameter(url, "chm", render(provider.getRangeMarkers()));\r
-                       addParameter(url, "chls", render(provider.getLineStyles()));\r
-                       addParameter(url, "chm", render(provider.getFillAreas()));\r
-                       addParameter(url, "chl", render(provider.getPieLabels()));\r
-       \r
-                       return url;\r
-               } finally {\r
-                       lock.writeLock().unlock();\r
-               }\r
-       }\r
-       \r
-       private void addParameter(StringBuilder url, CharSequence param, CharSequence value) {\r
-               if (value == null || value.length() == 0) {\r
-                       return;\r
-               }\r
-               \r
-               if (url.charAt(url.length() - 1) != '?') {\r
-                       url.append('&');\r
-               }\r
-               \r
-               url.append(param).append('=').append(value);\r
-       }\r
-       \r
-       private CharSequence render(Dimension dim) {\r
-               if (dim == null) {\r
-                       return null;\r
-               }\r
-               \r
-               return new StringBuilder().append(dim.width).append('x').append(dim.height);\r
-       }\r
-       \r
-       private CharSequence render(IChartData data) {\r
-               if (data == null) {\r
-                       return null;\r
-               }\r
-\r
-               ChartDataEncoding encoding = data.getEncoding();\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               back.append(render(encoding)).append(':');\r
-               \r
-               for (double[] set : data.getData()) {\r
-                       if (set == null || set.length == 0) {\r
-                               back.append(encoding.convert(-1, data.getMax()));\r
-                       } else {\r
-                               for (double value : set) {\r
-                                       back.append(encoding.convert(value, data.getMax())).append(encoding.getValueSeparator());\r
-                               }\r
-                               \r
-                               if (back.substring(back.length() - encoding.getValueSeparator().length(), \r
-                                               back.length()).equals(encoding.getValueSeparator())) {\r
-                                       back.setLength(back.length() - encoding.getValueSeparator().length());\r
-                               }\r
-                       }\r
-                       \r
-                       back.append(encoding.getSetSeparator());\r
-               }\r
-               \r
-               if (back.substring(back.length() - encoding.getSetSeparator().length(), \r
-                               back.length()).equals(encoding.getSetSeparator())) {\r
-                       back.setLength(back.length() - encoding.getSetSeparator().length());\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(Enum<?> value) {\r
-               if (value == null) {\r
-                       return null;\r
-               }\r
-               \r
-               try {\r
-                       Object back = value.getClass().getMethod("getRendering").invoke(value);\r
-                       \r
-                       if (back != null) {\r
-                               return back.toString();\r
-                       }\r
-               } catch (IllegalArgumentException e) {\r
-               } catch (SecurityException e) {\r
-               } catch (IllegalAccessException e) {\r
-               } catch (InvocationTargetException e) {\r
-               } catch (NoSuchMethodException e) {\r
-               }\r
-               \r
-               return null;\r
-       }\r
-       \r
-       private CharSequence render(int barWidth, int groupSpacing) {\r
-               if (barWidth == -1) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder(barWidth);\r
-               \r
-               if (groupSpacing >= 0) {\r
-                       back.append(',').append(groupSpacing);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(String[] values) {\r
-               if (values == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (String value : values) {\r
-                       CharSequence toRender = render(value);\r
-                       if (toRender == null) {\r
-                               toRender = "";\r
-                       }\r
-                       \r
-                       back.append(toRender).append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(String value) {\r
-               if (value == null) {\r
-                       return value;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (char c : value.toCharArray()) {\r
-                       if (c == ' ') {\r
-                               back.append('+');\r
-                       } else {\r
-                               back.append(c);\r
-                       }\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(Color[] values) {\r
-               if (values == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (Color value : values) {\r
-                       CharSequence toRender = render(value);\r
-                       if (toRender == null) {\r
-                               continue;\r
-                       }\r
-                       char delimiter = ',';\r
-                       switch(provider.getType()) {\r
-                       case PIE:\r
-                       case PIE_3D:\r
-                       case BAR_VERTICAL_SET:\r
-                               delimiter = '|';\r
-                               break;\r
-                       }\r
-                       back.append(toRender).append(delimiter);\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(Color value) {\r
-               if (value == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               {\r
-                       String toPad = Integer.toHexString(value.getRed());\r
-                       \r
-                       if (toPad.length() == 1) {\r
-                               back.append(0);\r
-                       }\r
-                       back.append(toPad);\r
-               }\r
-               \r
-               {\r
-                       String toPad = Integer.toHexString(value.getGreen());\r
-                       \r
-                       if (toPad.length() == 1) {\r
-                               back.append(0);\r
-                       }\r
-                       back.append(toPad);\r
-               }\r
-               \r
-               {\r
-                       String toPad = Integer.toHexString(value.getBlue());\r
-                       \r
-                       if (toPad.length() == 1) {\r
-                               back.append(0);\r
-                       }\r
-                       back.append(toPad);\r
-               }\r
-               \r
-               {\r
-                       String toPad = Integer.toHexString(value.getAlpha());\r
-                       \r
-                       if (toPad.length() == 1) {\r
-                               back.append(0);\r
-                       }\r
-                       back.append(toPad);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(IChartFill fill) {\r
-               if (fill == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               if (fill instanceof ISolidFill) {\r
-                       ISolidFill solidFill = (ISolidFill) fill;\r
-                       \r
-                       back.append("s,");\r
-                       back.append(render(solidFill.getColor()));\r
-               } else if (fill instanceof ILinearGradientFill) {\r
-                       ILinearGradientFill gradientFill = (ILinearGradientFill) fill;\r
-                       \r
-                       back.append("lg,").append(gradientFill.getAngle()).append(',');\r
-                       \r
-                       Color[] colors = gradientFill.getColors();\r
-                       double[] offsets = gradientFill.getOffsets();\r
-                       for (int i = 0; i < colors.length; i++) {\r
-                               back.append(render(colors[i])).append(',').append(offsets[i]).append(',');\r
-                       }\r
-                       \r
-                       back.setLength(back.length() - 1);\r
-               } else if (fill instanceof ILinearStripesFill) {\r
-                       ILinearStripesFill stripesFill = (ILinearStripesFill) fill;\r
-                       \r
-                       back.append("ls,").append(stripesFill.getAngle()).append(',');\r
-                       \r
-                       Color[] colors = stripesFill.getColors();\r
-                       double[] widths = stripesFill.getWidths();\r
-                       for (int i = 0; i < colors.length; i++) {\r
-                               back.append(render(colors[i])).append(',').append(widths[i]).append(',');\r
-                       }\r
-                       \r
-                       back.setLength(back.length() - 1);\r
-               } else {\r
-                       return null;\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence renderTypes(IChartAxis[] axes) {\r
-               if (axes == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (IChartAxis axis : axes) {\r
-                       back.append(render(axis.getType())).append(',');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence renderLabels(IChartAxis[] axes) {\r
-               if (axes == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (int i = 0; i < axes.length; i++) {\r
-                       if (axes[i] == null || axes[i].getLabels() == null) {\r
-                               continue;\r
-                       }\r
-                       \r
-                       back.append(i).append(":|");\r
-                       \r
-                       for (String label : axes[i].getLabels()) {\r
-                               if (label == null) {\r
-                                       back.append('|');\r
-                                       continue;\r
-                               }\r
-                               \r
-                               back.append(render(label)).append('|');\r
-                       }\r
-                       \r
-                       if (i == axes.length - 1) {\r
-                               back.setLength(back.length() - 1);\r
-                       }\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence renderPositions(IChartAxis[] axes) {\r
-               if (axes == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (int i = 0; i < axes.length; i++) {\r
-                       if (axes[i] == null || axes[i].getPositions() == null) {\r
-                               continue;\r
-                       }\r
-                       \r
-                       back.append(i).append(',');\r
-                       \r
-                       for (double position : axes[i].getPositions()) {\r
-                               back.append(position).append(',');\r
-                       }\r
-                       \r
-                       back.setLength(back.length() - 1);\r
-                       \r
-                       back.append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence renderRanges(IChartAxis[] axes) {\r
-               if (axes == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (int i = 0; i < axes.length; i++) {\r
-                       if (axes[i] == null || axes[i].getRange() == null) {\r
-                               continue;\r
-                       }\r
-                       \r
-                       back.append(i).append(',');\r
-                       \r
-                       Range range = axes[i].getRange();\r
-                       back.append(range.getStart()).append(',').append(range.getEnd()).append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence renderStyles(IChartAxis[] axes) {\r
-               if (axes == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (int i = 0; i < axes.length; i++) {\r
-                       if (axes[i] == null || axes[i].getColor() == null \r
-                                       || axes[i].getFontSize() < 0 || axes[i].getAlignment() == null) {\r
-                               continue;\r
-                       }\r
-                       \r
-                       back.append(i).append(',');\r
-                       back.append(render(axes[i].getColor())).append(',');\r
-                       back.append(axes[i].getFontSize()).append(',');\r
-                       back.append(render(axes[i].getAlignment())).append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(IChartGrid grid) {\r
-               if (grid == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               back.append(grid.getXStepSize()).append(',');\r
-               back.append(grid.getYStepSize());\r
-               \r
-               if (grid.getSegmentLength() >= 0) {\r
-                       back.append(',').append(grid.getSegmentLength());\r
-                       back.append(',').append(grid.getBlankLength());\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(IShapeMarker[] markers) {\r
-               if (markers == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (IShapeMarker marker : markers) {\r
-                       back.append(render(marker.getType())).append(',');\r
-                       back.append(render(marker.getColor())).append(',');\r
-                       back.append(marker.getIndex()).append(',');\r
-                       back.append(marker.getPoint()).append(',');\r
-                       back.append(marker.getSize()).append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(IRangeMarker[] markers) {\r
-               if (markers == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (IRangeMarker marker : markers) {\r
-                       back.append(render(marker.getType())).append(',');\r
-                       back.append(render(marker.getColor())).append(',');\r
-                       back.append(0).append(',');\r
-                       back.append(marker.getStart()).append(',');\r
-                       back.append(marker.getEnd()).append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(IFillArea[] areas) {\r
-               if (areas == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (IFillArea area : areas) {\r
-                       back.append(render(area.getType())).append(',');\r
-                       back.append(render(area.getColor())).append(',');\r
-                       back.append(area.getStartIndex()).append(',');\r
-                       back.append(area.getEndIndex()).append(',');\r
-                       back.append(0).append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       private CharSequence render(ILineStyle[] styles) {\r
-               if (styles == null) {\r
-                       return null;\r
-               }\r
-               \r
-               StringBuilder back = new StringBuilder();\r
-               \r
-               for (ILineStyle style : styles) {\r
-                       if (style == null) {\r
-                               back.append('|');\r
-                               continue;\r
-                       }\r
-                       \r
-                       back.append(style.getThickness()).append(',');\r
-                       back.append(style.getSegmentLength()).append(',');\r
-                       back.append(style.getBlankLength()).append('|');\r
-               }\r
-               \r
-               if (back.length() > 0) {\r
-                       back.setLength(back.length() - 1);\r
-               }\r
-               \r
-               return back;\r
-       }\r
-       \r
-       @Override\r
-       protected void onComponentTag(ComponentTag tag) {\r
-               checkComponentTag(tag, "img");\r
-               super.onComponentTag(tag);\r
-               \r
-               tag.put("src", constructURL());\r
-       }\r
-}
\ No newline at end of file
diff --git a/contrib/com/codecommit/wicket/ChartAxis.java b/contrib/com/codecommit/wicket/ChartAxis.java
deleted file mode 100644 (file)
index 641007c..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-import java.io.Serializable;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class ChartAxis implements IChartAxis, Serializable {\r
-\r
-       private static final long serialVersionUID = 1L;\r
-       \r
-       private AxisAlignment alignment;\r
-       private Color color;\r
-       private int fontSize = -1;\r
-       private String[] labels;\r
-       private double[] positions;\r
-       private Range range;\r
-       private ChartAxisType type;\r
-       \r
-       public ChartAxis(ChartAxisType type) {\r
-               this.type = type;\r
-       }\r
-\r
-       public AxisAlignment getAlignment() {\r
-               return alignment;\r
-       }\r
-\r
-       public Color getColor() {\r
-               return color;\r
-       }\r
-\r
-       public int getFontSize() {\r
-               return fontSize;\r
-       }\r
-\r
-       public String[] getLabels() {\r
-               return labels;\r
-       }\r
-\r
-       public double[] getPositions() {\r
-               return positions;\r
-       }\r
-\r
-       public Range getRange() {\r
-               return range;\r
-       }\r
-\r
-       public ChartAxisType getType() {\r
-               return type;\r
-       }\r
-\r
-       public void setAlignment(AxisAlignment alignment) {\r
-               this.alignment = alignment;\r
-       }\r
-\r
-       public void setColor(Color color) {\r
-               this.color = color;\r
-       }\r
-\r
-       public void setFontSize(int fontSize) {\r
-               this.fontSize = fontSize;\r
-       }\r
-\r
-       public void setLabels(String[] labels) {\r
-               this.labels = labels;\r
-       }\r
-\r
-       public void setPositions(double[] positions) {\r
-               this.positions = positions;\r
-       }\r
-\r
-       public void setRange(Range range) {\r
-               this.range = range;\r
-       }\r
-\r
-       public void setType(ChartAxisType type) {\r
-               this.type = type;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ChartAxisType.java b/contrib/com/codecommit/wicket/ChartAxisType.java
deleted file mode 100644 (file)
index 8246654..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public enum ChartAxisType {\r
-       BOTTOM("x"),\r
-       TOP("t"),\r
-       \r
-       LEFT("y"),\r
-       RIGHT("r");\r
-       \r
-       private final String rendering;\r
-       \r
-       private ChartAxisType(String rendering) {\r
-               this.rendering = rendering;\r
-       }\r
-       \r
-       public String getRendering() {\r
-               return rendering;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ChartDataEncoding.java b/contrib/com/codecommit/wicket/ChartDataEncoding.java
deleted file mode 100644 (file)
index 15677f4..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public enum ChartDataEncoding {\r
-       SIMPLE("s", "", ",") {\r
-               CharSequence convert(double value, double max) {\r
-                       if (value < 0) {\r
-                               return "_";\r
-                       }\r
-                       \r
-                       value = Math.round((CHARS.length() - 1) * value / max);\r
-                       \r
-                       if (value > CHARS.length() - 1) {\r
-                               throw new IllegalArgumentException(value + " is out of range for SIMPLE encoding");\r
-                       }\r
-                       \r
-                       return Character.toString(CHARS.charAt((int) value));\r
-               }\r
-       },\r
-       TEXT("t", ",", "|") {\r
-               CharSequence convert(double value, double max) {\r
-                       if (value < 0) {\r
-                               value = -1;\r
-                       }\r
-                       \r
-                       if (value > 100) {\r
-                               throw new IllegalArgumentException(value + " is out of range for TEXT encoding");\r
-                       }\r
-                       \r
-                       return Double.toString(value);\r
-               }\r
-       },\r
-       EXTENDED("e", "", ",") {\r
-               CharSequence convert(double value, double max) {\r
-                       if (value < 0) {\r
-                               return "__";\r
-                       }\r
-                       \r
-                       value = Math.round(value);\r
-                       \r
-                       if (value > (EXT_CHARS.length() - 1) * (EXT_CHARS.length() - 1)) {\r
-                               throw new IllegalArgumentException(value + " is out of range for EXTENDED encoding");\r
-                       }\r
-                       \r
-                       int rem = (int) (value % EXT_CHARS.length());\r
-                       int exp = (int) (value / EXT_CHARS.length());\r
-                       \r
-                       return new StringBuilder().append(EXT_CHARS.charAt(exp)).append(EXT_CHARS.charAt(rem));\r
-               }\r
-       };\r
-       \r
-       private static final String CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";\r
-       private static final String EXT_CHARS = CHARS + "-_.";\r
-       \r
-       private final String rendering, valueSeparator, setSeparator;\r
-       \r
-       private ChartDataEncoding(String rendering, String valueSeparator, String setSeparator) {\r
-               this.rendering = rendering;\r
-               this.valueSeparator = valueSeparator;\r
-               this.setSeparator = setSeparator;\r
-       }\r
-       \r
-       public String getRendering() {\r
-               return rendering;\r
-       }\r
-       \r
-       public String getValueSeparator() {\r
-               return valueSeparator;\r
-       }\r
-       \r
-       public String getSetSeparator() {\r
-               return setSeparator;\r
-       }\r
-       \r
-       abstract CharSequence convert(double value, double max);\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ChartGrid.java b/contrib/com/codecommit/wicket/ChartGrid.java
deleted file mode 100644 (file)
index 9fdee20..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class ChartGrid implements IChartGrid {\r
-       private int blankLength = -1;\r
-       private int segmentLength = -1;\r
-       private int xStepSize = -1;\r
-       private int yStepSize = -1;\r
-       \r
-       public ChartGrid(int xStepSize, int yStepSize) {\r
-               this.xStepSize = xStepSize;\r
-               this.yStepSize = yStepSize;\r
-       }\r
-\r
-       public int getBlankLength() {\r
-               return blankLength;\r
-       }\r
-\r
-       public int getSegmentLength() {\r
-               return segmentLength;\r
-       }\r
-\r
-       public double getXStepSize() {\r
-               return xStepSize;\r
-       }\r
-\r
-       public double getYStepSize() {\r
-               return yStepSize;\r
-       }\r
-\r
-       public void setBlankLength(int blankLength) {\r
-               this.blankLength = blankLength;\r
-       }\r
-\r
-       public void setSegmentLength(int segmentLength) {\r
-               this.segmentLength = segmentLength;\r
-       }\r
-\r
-       public void setXStepSize(int stepSize) {\r
-               xStepSize = stepSize;\r
-       }\r
-\r
-       public void setYStepSize(int stepSize) {\r
-               yStepSize = stepSize;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ChartProvider.java b/contrib/com/codecommit/wicket/ChartProvider.java
deleted file mode 100644 (file)
index 4e69bfc..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-import java.awt.Dimension;\r
-import java.io.Serializable;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class ChartProvider implements IChartProvider, Serializable {\r
-       private static final long serialVersionUID = 1L;\r
-       private List<IChartAxis> axes = new ArrayList<IChartAxis>();\r
-       private IChartFill backgroundFill;\r
-       private int barGroupSpacing = -1;\r
-       private int barWidth = -1;\r
-       private IChartFill chartFill;\r
-       private Color[] colors;\r
-       private List<IFillArea> fillAreas = new ArrayList<IFillArea>();\r
-       private IChartGrid grid;\r
-       private String[] legend;\r
-       private ILineStyle[] lineStyles;\r
-       private String[] pieLabels;\r
-       private List<IRangeMarker> rangeMarkers = new ArrayList<IRangeMarker>();\r
-       private List<IShapeMarker> shapeMarkers = new ArrayList<IShapeMarker>();\r
-       private Dimension size;\r
-       private String title;\r
-       private ChartType type;\r
-       private IChartData data;\r
-       \r
-       public ChartProvider(Dimension size, ChartType type, IChartData data) {\r
-               this.size = size;\r
-               this.type = type;\r
-               this.data = data;\r
-       }\r
-       \r
-       public IChartAxis[] getAxes() {\r
-               return axes.toArray(new IChartAxis[axes.size()]);\r
-       }\r
-\r
-       public IChartFill getBackgroundFill() {\r
-               return backgroundFill;\r
-       }\r
-\r
-       public int getBarGroupSpacing() {\r
-               return barGroupSpacing;\r
-       }\r
-\r
-       public int getBarWidth() {\r
-               return barWidth;\r
-       }\r
-\r
-       public IChartFill getChartFill() {\r
-               return chartFill;\r
-       }\r
-\r
-       public Color[] getColors() {\r
-               return colors;\r
-       }\r
-\r
-       public IFillArea[] getFillAreas() {\r
-               return fillAreas.toArray(new IFillArea[fillAreas.size()]);\r
-       }\r
-\r
-       public IChartGrid getGrid() {\r
-               return grid;\r
-       }\r
-\r
-       public String[] getLegend() {\r
-               return legend;\r
-       }\r
-\r
-       public ILineStyle[] getLineStyles() {\r
-               return lineStyles;\r
-       }\r
-\r
-       public String[] getPieLabels() {\r
-               return pieLabels;\r
-       }\r
-\r
-       public IRangeMarker[] getRangeMarkers() {\r
-               return rangeMarkers.toArray(new IRangeMarker[rangeMarkers.size()]);\r
-       }\r
-\r
-       public IShapeMarker[] getShapeMarkers() {\r
-               return shapeMarkers.toArray(new IShapeMarker[shapeMarkers.size()]);\r
-       }\r
-\r
-       public Dimension getSize() {\r
-               return size;\r
-       }\r
-\r
-       public String getTitle() {\r
-               return title;\r
-       }\r
-\r
-       public ChartType getType() {\r
-               return type;\r
-       }\r
-       \r
-       public void addFillArea(IFillArea fillArea) {\r
-               fillAreas.add(fillArea);\r
-       }\r
-\r
-       public void addAxis(IChartAxis axis) {\r
-               axes.add(axis);\r
-       }\r
-\r
-       public void setBackgroundFill(IChartFill backgroundFill) {\r
-               this.backgroundFill = backgroundFill;\r
-       }\r
-\r
-       public void setBarGroupSpacing(int barGroupSpacing) {\r
-               this.barGroupSpacing = barGroupSpacing;\r
-       }\r
-\r
-       public void setBarWidth(int barWidth) {\r
-               this.barWidth = barWidth;\r
-       }\r
-\r
-       public void setChartFill(IChartFill chartFill) {\r
-               this.chartFill = chartFill;\r
-       }\r
-\r
-       public void setColors(Color[] colors) {\r
-               this.colors = colors;\r
-       }\r
-\r
-       public void setGrid(IChartGrid grid) {\r
-               this.grid = grid;\r
-       }\r
-\r
-       public void setLegend(String[] legend) {\r
-               this.legend = legend;\r
-       }\r
-\r
-       public void setLineStyles(ILineStyle[] lineStyles) {\r
-               this.lineStyles = lineStyles;\r
-       }\r
-\r
-       public void setPieLabels(String[] pieLabels) {\r
-               this.pieLabels = pieLabels;\r
-       }\r
-\r
-       public void addRangeMarker(IRangeMarker rangeMarker) {\r
-               rangeMarkers.add(rangeMarker);\r
-       }\r
-\r
-       public void addShapeMarker(IShapeMarker shapeMarker) {\r
-               shapeMarkers.add(shapeMarker);\r
-       }\r
-\r
-       public void setSize(Dimension size) {\r
-               this.size = size;\r
-       }\r
-\r
-       public void setTitle(String title) {\r
-               this.title = title;\r
-       }\r
-\r
-       public void setType(ChartType type) {\r
-               this.type = type;\r
-       }\r
-\r
-       public IChartData getData() {\r
-               return data;\r
-       }\r
-\r
-       public void setData(IChartData data) {\r
-               this.data = data;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ChartType.java b/contrib/com/codecommit/wicket/ChartType.java
deleted file mode 100644 (file)
index 3d25d42..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public enum ChartType {\r
-       LINE("lc"),\r
-       LINE_XY("lxy"),\r
-       \r
-       BAR_HORIZONTAL_SET("bhs"),\r
-       BAR_VERTICAL_SET("bvs"),\r
-       BAR_HORIZONTAL_GROUP("bhg"),\r
-       BAR_VERTICAL_GROUP("bvg"),\r
-       \r
-       PIE("p"),\r
-       PIE_3D("p3"),\r
-       \r
-       VENN("v"),\r
-       \r
-       SCATTER("s");\r
-       \r
-       private final String rendering;\r
-       \r
-       private ChartType(String rendering) {\r
-               this.rendering = rendering;\r
-       }\r
-       \r
-       public String getRendering() {\r
-               return rendering;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/FillArea.java b/contrib/com/codecommit/wicket/FillArea.java
deleted file mode 100644 (file)
index 2ab5ef3..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class FillArea implements IFillArea {\r
-       private Color color;\r
-       private int endIndex = -1;\r
-       private int startIndex = -1;\r
-       private AreaFillType type = AreaFillType.BETWEEN;\r
-       \r
-       public FillArea(Color color, int startIndex, int endIndex) {\r
-               this.color = color;\r
-               this.startIndex = startIndex;\r
-               this.endIndex = endIndex;\r
-       }\r
-\r
-       public Color getColor() {\r
-               return color;\r
-       }\r
-\r
-       public int getEndIndex() {\r
-               return endIndex;\r
-       }\r
-\r
-       public int getStartIndex() {\r
-               return startIndex;\r
-       }\r
-\r
-       public AreaFillType getType() {\r
-               return type;\r
-       }\r
-\r
-       public void setColor(Color color) {\r
-               this.color = color;\r
-       }\r
-\r
-       public void setEndIndex(int endIndex) {\r
-               this.endIndex = endIndex;\r
-       }\r
-\r
-       public void setStartIndex(int startIndex) {\r
-               this.startIndex = startIndex;\r
-       }\r
-\r
-       public void setType(AreaFillType type) {\r
-               this.type = type;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IChartAxis.java b/contrib/com/codecommit/wicket/IChartAxis.java
deleted file mode 100644 (file)
index c7c83dc..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IChartAxis {\r
-       \r
-       public ChartAxisType getType();\r
-       \r
-       public String[] getLabels();\r
-       \r
-       public double[] getPositions();\r
-       \r
-       public Range getRange();\r
-       \r
-       public Color getColor();\r
-       \r
-       public int getFontSize();\r
-       \r
-       public AxisAlignment getAlignment();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IChartData.java b/contrib/com/codecommit/wicket/IChartData.java
deleted file mode 100644 (file)
index c4f6ec7..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IChartData {\r
-       \r
-       public ChartDataEncoding getEncoding();\r
-       \r
-       public double[][] getData();\r
-       \r
-       public double getMax();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IChartFill.java b/contrib/com/codecommit/wicket/IChartFill.java
deleted file mode 100644 (file)
index 2ccb1d6..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IChartFill {\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IChartGrid.java b/contrib/com/codecommit/wicket/IChartGrid.java
deleted file mode 100644 (file)
index 05f4c5f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IChartGrid {\r
-       \r
-       public double getXStepSize();\r
-       \r
-       public double getYStepSize();\r
-       \r
-       public int getSegmentLength();\r
-       \r
-       public int getBlankLength();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IChartProvider.java b/contrib/com/codecommit/wicket/IChartProvider.java
deleted file mode 100644 (file)
index 76e7fa6..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-import java.awt.Dimension;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IChartProvider {\r
-       \r
-       public Dimension getSize();\r
-       \r
-       public IChartData getData();\r
-       \r
-       public ChartType getType();\r
-       \r
-       public int getBarWidth();\r
-       \r
-       public int getBarGroupSpacing();\r
-       \r
-       public String getTitle();\r
-       \r
-       public String[] getLegend();\r
-       \r
-       public Color[] getColors();\r
-       \r
-       public IChartFill getChartFill();\r
-       \r
-       public IChartFill getBackgroundFill();\r
-       \r
-       public String[] getPieLabels();\r
-       \r
-       public IChartAxis[] getAxes();\r
-       \r
-       public ILineStyle[] getLineStyles();\r
-       \r
-       public IChartGrid getGrid();\r
-       \r
-       public IShapeMarker[] getShapeMarkers();\r
-       \r
-       public IRangeMarker[] getRangeMarkers();\r
-       \r
-       public IFillArea[] getFillAreas();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IFillArea.java b/contrib/com/codecommit/wicket/IFillArea.java
deleted file mode 100644 (file)
index 3ba7f0a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IFillArea {\r
-       \r
-       public AreaFillType getType();\r
-       \r
-       public Color getColor();\r
-       \r
-       public int getStartIndex();\r
-       \r
-       // unnecessary if BOTTOM\r
-       public int getEndIndex();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ILineStyle.java b/contrib/com/codecommit/wicket/ILineStyle.java
deleted file mode 100644 (file)
index 873debe..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface ILineStyle {\r
-       \r
-       public int getThickness();\r
-       \r
-       public int getSegmentLength();\r
-       \r
-       public int getBlankLength();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ILinearGradientFill.java b/contrib/com/codecommit/wicket/ILinearGradientFill.java
deleted file mode 100644 (file)
index 8ed51de..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface ILinearGradientFill extends IChartFill {\r
-       \r
-       public int getAngle();\r
-       \r
-       public Color[] getColors();\r
-       \r
-       public double[] getOffsets();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ILinearStripesFill.java b/contrib/com/codecommit/wicket/ILinearStripesFill.java
deleted file mode 100644 (file)
index 534896f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface ILinearStripesFill extends IChartFill {\r
-       \r
-       public int getAngle();\r
-       \r
-       public Color[] getColors();\r
-       \r
-       public double[] getWidths();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IRangeMarker.java b/contrib/com/codecommit/wicket/IRangeMarker.java
deleted file mode 100644 (file)
index 1cc3040..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IRangeMarker {\r
-\r
-       public RangeType getType();\r
-       \r
-       public Color getColor();\r
-       \r
-       public double getStart();\r
-       \r
-       public double getEnd();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/IShapeMarker.java b/contrib/com/codecommit/wicket/IShapeMarker.java
deleted file mode 100644 (file)
index 626eccb..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface IShapeMarker {\r
-       \r
-       public MarkerType getType();\r
-       \r
-       public Color getColor();\r
-       \r
-       public int getIndex();\r
-       \r
-       public double getPoint();\r
-       \r
-       public int getSize();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ISolidFill.java b/contrib/com/codecommit/wicket/ISolidFill.java
deleted file mode 100644 (file)
index f97b064..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public interface ISolidFill extends IChartFill {\r
-       public Color getColor();\r
-}\r
diff --git a/contrib/com/codecommit/wicket/LineStyle.java b/contrib/com/codecommit/wicket/LineStyle.java
deleted file mode 100644 (file)
index ef53c5b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.io.Serializable;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class LineStyle implements ILineStyle, Serializable {\r
-\r
-       private static final long serialVersionUID = 1L;\r
-       \r
-       private int blankLength = -1;\r
-       private int segmentLength = -1;\r
-       private int thickness = -1;\r
-       \r
-       public LineStyle(int thickness, int segmentLength, int blankLength) {\r
-               this.thickness = thickness;\r
-               this.segmentLength = segmentLength;\r
-               this.blankLength = blankLength;\r
-       }\r
-       \r
-       public int getBlankLength() {\r
-               return blankLength;\r
-       }\r
-\r
-       public int getSegmentLength() {\r
-               return segmentLength;\r
-       }\r
-\r
-       public int getThickness() {\r
-               return thickness;\r
-       }\r
-\r
-       public void setBlankLength(int blankLength) {\r
-               this.blankLength = blankLength;\r
-       }\r
-\r
-       public void setSegmentLength(int segmentLength) {\r
-               this.segmentLength = segmentLength;\r
-       }\r
-\r
-       public void setThickness(int thickness) {\r
-               this.thickness = thickness;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/LinearGradientFill.java b/contrib/com/codecommit/wicket/LinearGradientFill.java
deleted file mode 100644 (file)
index 090a9a8..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class LinearGradientFill implements ILinearGradientFill {\r
-       private int angle = -1;\r
-       private Color[] colors;\r
-       private double[] offsets;\r
-       \r
-       public LinearGradientFill(int angle, Color[] colors, double[] offsets) {\r
-               if (colors.length != offsets.length) {\r
-                       throw new IllegalArgumentException("Must be same number of colors as offsets");\r
-               }\r
-               \r
-               this.angle = angle;\r
-               this.colors = colors;\r
-               this.offsets = offsets;\r
-       }\r
-\r
-       public int getAngle() {\r
-               return angle;\r
-       }\r
-\r
-       public Color[] getColors() {\r
-               return colors;\r
-       }\r
-\r
-       public double[] getOffsets() {\r
-               return offsets;\r
-       }\r
-\r
-       public void setAngle(int angle) {\r
-               this.angle = angle;\r
-       }\r
-\r
-       public void setColors(Color[] colors) {\r
-               this.colors = colors;\r
-       }\r
-\r
-       public void setOffsets(double[] offsets) {\r
-               this.offsets = offsets;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/LinearStripesFill.java b/contrib/com/codecommit/wicket/LinearStripesFill.java
deleted file mode 100644 (file)
index 52b6f1e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class LinearStripesFill implements ILinearStripesFill {\r
-       private int angle = -1;\r
-       private Color[] colors;\r
-       private double[] widths;\r
-       \r
-       public LinearStripesFill(int angle, Color[] colors, double[] widths) {\r
-               if (colors.length != widths.length) {\r
-                       throw new IllegalArgumentException("Must be same number of colors as widths");\r
-               }\r
-               \r
-               this.angle = angle;\r
-               this.colors = colors;\r
-               this.widths = widths;\r
-       }\r
-       \r
-       public int getAngle() {\r
-               return angle;\r
-       }\r
-\r
-       public Color[] getColors() {\r
-               return colors;\r
-       }\r
-\r
-       public double[] getWidths() {\r
-               return widths;\r
-       }\r
-\r
-       public void setAngle(int angle) {\r
-               this.angle = angle;\r
-       }\r
-\r
-       public void setColors(Color[] colors) {\r
-               this.colors = colors;\r
-       }\r
-\r
-       public void setWidths(double[] widths) {\r
-               this.widths = widths;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/MarkerType.java b/contrib/com/codecommit/wicket/MarkerType.java
deleted file mode 100644 (file)
index 2b22794..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.io.Serializable;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public enum MarkerType implements Serializable {\r
-       ARROW("a"),\r
-       CROSS("c"),\r
-       DIAMOND("d"),\r
-       CIRCLE("o"),\r
-       SQUARE("s"),\r
-       \r
-       VERTICAL_TO_DATA("v"),\r
-       VERTICAL_TO_TOP("V"),\r
-       HORIZONTAL_ACROSS("h"),\r
-       \r
-       X("x");\r
-       \r
-       private final String rendering;\r
-       \r
-       private MarkerType(String rendering) {\r
-               this.rendering = rendering;\r
-       }\r
-       \r
-       public String getRendering() {\r
-               return rendering;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/Range.java b/contrib/com/codecommit/wicket/Range.java
deleted file mode 100644 (file)
index d5b7eb6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class Range {\r
-       private double start, end;\r
-       \r
-       public Range(double start, double end) {\r
-               this.start = start;\r
-               this.end = end;\r
-       }\r
-\r
-       public double getStart() {\r
-               return start;\r
-       }\r
-\r
-       public void setStart(double start) {\r
-               this.start = start;\r
-       }\r
-\r
-       public double getEnd() {\r
-               return end;\r
-       }\r
-\r
-       public void setEnd(double end) {\r
-               this.end = end;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/RangeMarker.java b/contrib/com/codecommit/wicket/RangeMarker.java
deleted file mode 100644 (file)
index a44c95c..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class RangeMarker implements IRangeMarker {\r
-       private Color color;\r
-       private double end = -1;\r
-       private double start = -1;\r
-       private RangeType type;\r
-       \r
-       public RangeMarker(RangeType type, Color color, double start, double end) {\r
-               this.type = type;\r
-               this.color = color;\r
-               this.start = start;\r
-               this.end = end;\r
-       }\r
-       \r
-       public Color getColor() {\r
-               return color;\r
-       }\r
-\r
-       public double getEnd() {\r
-               return end;\r
-       }\r
-\r
-       public double getStart() {\r
-               return start;\r
-       }\r
-\r
-       public RangeType getType() {\r
-               return type;\r
-       }\r
-\r
-       public void setColor(Color color) {\r
-               this.color = color;\r
-       }\r
-\r
-       public void setEnd(double end) {\r
-               this.end = end;\r
-       }\r
-\r
-       public void setStart(double start) {\r
-               this.start = start;\r
-       }\r
-\r
-       public void setType(RangeType type) {\r
-               this.type = type;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/RangeType.java b/contrib/com/codecommit/wicket/RangeType.java
deleted file mode 100644 (file)
index 7a86d41..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public enum RangeType {\r
-       HORIZONTAL("r"),\r
-       VERTICAL("R");\r
-       \r
-       private final String rendering;\r
-       \r
-       private RangeType(String rendering) {\r
-               this.rendering = rendering;\r
-       }\r
-       \r
-       public String getRendering() {\r
-               return rendering;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/ShapeMarker.java b/contrib/com/codecommit/wicket/ShapeMarker.java
deleted file mode 100644 (file)
index 3b42cfb..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-import java.io.Serializable;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class ShapeMarker implements IShapeMarker, Serializable {\r
-       \r
-       private static final long serialVersionUID = 1L;\r
-       \r
-       private Color color;\r
-       private int index = -1;\r
-       private double point = -1;\r
-       private int size = -1;\r
-       private MarkerType type;\r
-       \r
-       public ShapeMarker(MarkerType type, Color color, int index, double point, int size) {\r
-               this.type = type;\r
-               this.color = color;\r
-               this.index = index;\r
-               this.point = point;\r
-               this.size = size;\r
-       }\r
-       \r
-       public Color getColor() {\r
-               return color;\r
-       }\r
-\r
-       public int getIndex() {\r
-               return index;\r
-       }\r
-\r
-       public double getPoint() {\r
-               return point;\r
-       }\r
-\r
-       public int getSize() {\r
-               return size;\r
-       }\r
-\r
-       public MarkerType getType() {\r
-               return type;\r
-       }\r
-\r
-       public void setColor(Color color) {\r
-               this.color = color;\r
-       }\r
-\r
-       public void setIndex(int index) {\r
-               this.index = index;\r
-       }\r
-\r
-       public void setPoint(double point) {\r
-               this.point = point;\r
-       }\r
-\r
-       public void setSize(int size) {\r
-               this.size = size;\r
-       }\r
-\r
-       public void setType(MarkerType type) {\r
-               this.type = type;\r
-       }\r
-}\r
diff --git a/contrib/com/codecommit/wicket/SolidFill.java b/contrib/com/codecommit/wicket/SolidFill.java
deleted file mode 100644 (file)
index dac8734..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*\r
- * Created on Dec 11, 2007\r
- */\r
-package com.codecommit.wicket;\r
-\r
-import java.awt.Color;\r
-\r
-/**\r
- * @author Daniel Spiewak\r
- */\r
-public class SolidFill implements ISolidFill {\r
-       private Color color;\r
-       \r
-       public SolidFill(Color color) {\r
-               this.color = color;\r
-       }\r
-\r
-       public Color getColor() {\r
-               return color;\r
-       }\r
-       \r
-       public void setColor(Color color) {\r
-               this.color = color;\r
-       }\r
-}\r
index 27a9fff9c3bd54598d0eaa0cff748241d14cb021..ae3866d2ed1b114b24fe23023031ac6e0d424d35 100644 (file)
@@ -48,7 +48,7 @@ web.allowAdministration = true
 \r
 # This is the message display above the repositories table.\r
 # This can point to a file with HTML content.\r
-web.repositoriesMessage = Welcome to Git:Blit!<br>A quick and easy way to host your own Git repositories.<br>Built with <a href="http://eclipse.org/jgit">JGit</a>, <a href="http://wicket.apache.org">Wicket</a>, <a href="http://eclipse.org/jetty">Jetty</a>, <a href="http://www.slf4j.org">SLF4J</a>, <a href="http://logging.apache.org/log4j">Log4j</a>, <a href="http://code.google.com/p/google-code-prettify/">google-code-prettify</a>, and <a href="http://jcommander.org">JCommander</a>.\r
+web.repositoriesMessage = Welcome to Git:Blit!<br>A quick and easy way to host your own Git repositories.<br>Built with <a href="http://eclipse.org/jgit">JGit</a>, <a href="http://wicket.apache.org">Wicket</a>, <a href="http://https://github.com/wicketstuff/core/wiki/GoogleCharts">WicketStuff googlecharts</a>, <a href="http://markdown.tautua.org">MarkdownPapers</a>, <a href="http://eclipse.org/jetty">Jetty</a>, <a href="http://www.slf4j.org">SLF4J</a>, <a href="http://logging.apache.org/log4j">Log4j</a>, <a href="http://code.google.com/p/google-code-prettify/">google-code-prettify</a>, and <a href="http://jcommander.org">JCommander</a>.\r
 \r
 # Use the client timezone when formatting dates.\r
 # This uses AJAX to determine the browser's timezone and enables Wicket \r
@@ -78,6 +78,9 @@ web.logPageCommitCount = 50
 # Registered extensions for google-code-prettify\r
 web.prettyPrintExtensions = c cpp cs css htm html java js php pl prefs properties py rb sh sql xml vb\r
 \r
+# Registered extensions for markdown transformation\r
+web.markdownExtensions = md mkd markdown\r
+\r
 # Image extensions\r
 web.imageExtensions = bmp jpg gif png \r
 \r
index b12d44ed47c5ca4d8cc1160458e7e328b3957c8b..604ee08fd55996245ee8187975235aae905e2f7f 100644 (file)
@@ -36,6 +36,8 @@ public class Build {
                downloadFromMaven(MavenObject.WICKET);\r
                downloadFromMaven(MavenObject.WICKET_EXT);\r
                downloadFromMaven(MavenObject.WICKET_AUTH_ROLES);\r
+               downloadFromMaven(MavenObject.WICKET_GOOGLE_CHARTS);\r
+               downloadFromMaven(MavenObject.MARKDOWNPAPERS);\r
        }\r
 \r
        public static void compiletime() {\r
@@ -192,8 +194,12 @@ public class Build {
 \r
                public static final MavenObject WICKET_AUTH_ROLES = new MavenObject("Apache Wicket Auth Roles", "org/apache/wicket", "wicket-auth-roles", "1.4.17", "86d20ff32f62d3026213ff11a78555da643bc676");\r
 \r
+               public static final MavenObject WICKET_GOOGLE_CHARTS = new MavenObject("Apache Wicket Google Charts Add-On", "org/wicketstuff", "googlecharts", "1.4.17", "c567b98b0c5efe4147e77ef2d0d3c2d45c49dea5");\r
+\r
                public static final MavenObject JUNIT = new MavenObject("JUnit", "junit", "junit", "3.8.2", "07e4cde26b53a9a0e3fe5b00d1dbbc7cc1d46060");\r
 \r
+               public static final MavenObject MARKDOWNPAPERS = new MavenObject("MarkdownPapers", "org/tautua/markdownpapers", "markdownpapers-core", "1.0.0", "feda63bd149f3315da210e397d45d02277038ad5");\r
+\r
                public final String name;\r
                public final String group;\r
                public final String artifact;\r
index 106981e3b9431c373f1549ae6244f8b2c2cebe03..e3c41cd647dbf0675bd55febabc1fc48719f7cfe 100644 (file)
@@ -17,6 +17,7 @@ import com.gitblit.wicket.pages.CommitDiffPage;
 import com.gitblit.wicket.pages.CommitPage;\r
 import com.gitblit.wicket.pages.HistoryPage;\r
 import com.gitblit.wicket.pages.LogPage;\r
+import com.gitblit.wicket.pages.MarkdownPage;\r
 import com.gitblit.wicket.pages.PatchPage;\r
 import com.gitblit.wicket.pages.RawPage;\r
 import com.gitblit.wicket.pages.RepositoriesPage;\r
@@ -67,6 +68,9 @@ public class GitBlitWebApp extends WebApplication {
                mount(new MixedParamUrlCodingStrategy("/tickets", TicketsPage.class, new String[] { "r" }));\r
                mount(new MixedParamUrlCodingStrategy("/ticket", TicketPage.class, new String[] { "r", "h", "f" }));\r
 \r
+               // setup the markdown urls\r
+               mount(new MixedParamUrlCodingStrategy("/markdown", MarkdownPage.class, new String[] { "r", "h", "f" }));\r
+               \r
                // setup login/logout urls, if we are using authentication\r
                if (useAuthentication) {\r
                        mount(new MixedParamUrlCodingStrategy("/login", LoginPage.class, new String[] {}));\r
index f063858692bbfadd4849646cbd18c99bd22da60c..a2e51d112b6da40cf0939c00d1fd25c31daa809c 100644 (file)
@@ -55,4 +55,5 @@ gb.addition = addition
 gb.modification = modification\r
 gb.deletion = deletion\r
 gb.rename = rename\r
-gb.stats = stats
\ No newline at end of file
+gb.stats = stats\r
+gb.markdown = markdown
\ No newline at end of file
index e535199adcca1e384b3ac84e46064e62119decdd..335d25a19b9ec58cd791d215e8b422ada1a4db8b 100644 (file)
@@ -26,6 +26,20 @@ public class BlobPage extends RepositoryPage {
 \r
                final String blobPath = WicketUtils.getPath(params);\r
 \r
+               String extension = null;\r
+               if (blobPath.lastIndexOf('.') > -1) {\r
+                       extension = blobPath.substring(blobPath.lastIndexOf('.') + 1).toLowerCase();\r
+               }\r
+               \r
+               // see if we should redirect to the markdown page\r
+               for (String ext : GitBlit.self().settings().getStrings(Keys.web.markdownExtensions)) {\r
+                       if (ext.equals(extension)) {\r
+                               setResponsePage(MarkdownPage.class, params);\r
+                               return;\r
+                       }\r
+               }\r
+               \r
+               // standard blob view\r
                Repository r = getRepository();\r
                RevCommit commit = JGitUtils.getCommit(r, objectId);\r
 \r
@@ -38,10 +52,6 @@ public class BlobPage extends RepositoryPage {
                add(new LinkPanel("shortlog", "title", commit.getShortMessage(), CommitPage.class, newCommitParameter()));\r
 \r
                add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId));\r
-               String extension = null;\r
-               if (blobPath.lastIndexOf('.') > -1) {\r
-                       extension = blobPath.substring(blobPath.lastIndexOf('.') + 1);\r
-               }\r
 \r
                // Map the extensions to types\r
                Map<String, Integer> map = new HashMap<String, Integer>();\r
diff --git a/src/com/gitblit/wicket/pages/MarkdownPage.html b/src/com/gitblit/wicket/pages/MarkdownPage.html
new file mode 100644 (file)
index 0000000..9b00934
--- /dev/null
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml"  \r
+      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"  \r
+      xml:lang="en"  \r
+      lang="en">\r
+      \r
+<!-- contribute markdown css to the page header -->\r
+<wicket:head>\r
+  <wicket:link>\r
+       <link href="/com/gitblit/wicket/resources/markdown.css" type="text/css" rel="stylesheet" />\r
+  </wicket:link>\r
+</wicket:head>\r
+\r
+<body>\r
+<wicket:extend>\r
+               <!-- page nav links --> \r
+               <div wicket:id="pageLinks">[page links]</div>\r
+       \r
+               <!-- markdown nav links -->     \r
+               <div class="page_nav2">\r
+                       <span wicket:id="blameLink">[blame link]</span> | <a wicket:id="historyLink"><wicket:message key="gb.history"></wicket:message></a> | <a wicket:id="rawLink"><wicket:message key="gb.raw"></wicket:message></a> | <a wicket:id="headLink"><wicket:message key="gb.head"></wicket:message></a>\r
+               </div>  \r
+       \r
+               <!--  markdown content -->\r
+               <div class="markdown" wicket:id="markdownText">[markdown content]</div>\r
+</wicket:extend>\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/src/com/gitblit/wicket/pages/MarkdownPage.java b/src/com/gitblit/wicket/pages/MarkdownPage.java
new file mode 100644 (file)
index 0000000..83083ab
--- /dev/null
@@ -0,0 +1,60 @@
+package com.gitblit.wicket.pages;\r
+\r
+import java.io.StringReader;\r
+import java.io.StringWriter;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.basic.Label;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+import org.eclipse.jgit.lib.Constants;\r
+import org.eclipse.jgit.lib.Repository;\r
+import org.eclipse.jgit.revwalk.RevCommit;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.tautua.markdownpapers.Markdown;\r
+import org.tautua.markdownpapers.parser.ParseException;\r
+\r
+import com.gitblit.utils.JGitUtils;\r
+import com.gitblit.wicket.RepositoryPage;\r
+import com.gitblit.wicket.WicketUtils;\r
+\r
+public class MarkdownPage extends RepositoryPage {\r
+       \r
+       private final Logger logger = LoggerFactory.getLogger(MarkdownPage.class);\r
+\r
+       public MarkdownPage(PageParameters params) {\r
+               super(params);\r
+\r
+               final String markdownPath = WicketUtils.getPath(params);\r
+\r
+               Repository r = getRepository();\r
+               RevCommit commit = JGitUtils.getCommit(r, objectId);\r
+\r
+               // markdown page links\r
+               add(new Label("blameLink", getString("gb.blame")));\r
+               add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class, WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));\r
+               add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, WicketUtils.newPathParameter(repositoryName, objectId, markdownPath)));\r
+               add(new BookmarkablePageLink<Void>("headLink", MarkdownPage.class, WicketUtils.newPathParameter(repositoryName, Constants.HEAD, markdownPath)));\r
+\r
+               // Read raw markdown content and transform it to html\r
+               String htmlText = "";\r
+               try {\r
+                       String rawText = JGitUtils.getRawContentAsString(r, commit, markdownPath);\r
+                       StringReader reader = new StringReader(rawText);\r
+                       StringWriter writer = new StringWriter();\r
+                       Markdown md = new Markdown();\r
+                       md.transform(reader, writer);\r
+                       htmlText = writer.toString();\r
+               } catch (ParseException p) {\r
+                       logger.error("Failed to parse markdown text from " + markdownPath, p);\r
+               }\r
+               \r
+               // Add the html to the page\r
+               add(new Label("markdownText", htmlText).setEscapeModelStrings(false));\r
+       }\r
+\r
+       @Override\r
+       protected String getPageName() {\r
+               return getString("gb.markdown");\r
+       }\r
+}\r
index 53a684b57bc57dee444e7f9006bf2343f568588b..b20dc64395785b8fb5cc7ca98118b94ce80a1932 100644 (file)
@@ -10,16 +10,16 @@ import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.image.ContextImage;\r
 import org.eclipse.jgit.lib.Repository;\r
 \r
-import com.codecommit.wicket.AbstractChartData;\r
-import com.codecommit.wicket.Chart;\r
-import com.codecommit.wicket.ChartAxis;\r
-import com.codecommit.wicket.ChartAxisType;\r
-import com.codecommit.wicket.ChartProvider;\r
-import com.codecommit.wicket.ChartType;\r
-import com.codecommit.wicket.IChartData;\r
-import com.codecommit.wicket.LineStyle;\r
-import com.codecommit.wicket.MarkerType;\r
-import com.codecommit.wicket.ShapeMarker;\r
+import org.wicketstuff.googlecharts.AbstractChartData;\r
+import org.wicketstuff.googlecharts.Chart;\r
+import org.wicketstuff.googlecharts.ChartAxis;\r
+import org.wicketstuff.googlecharts.ChartAxisType;\r
+import org.wicketstuff.googlecharts.ChartProvider;\r
+import org.wicketstuff.googlecharts.ChartType;\r
+import org.wicketstuff.googlecharts.IChartData;\r
+import org.wicketstuff.googlecharts.LineStyle;\r
+import org.wicketstuff.googlecharts.MarkerType;\r
+import org.wicketstuff.googlecharts.ShapeMarker;\r
 import com.gitblit.GitBlit;\r
 import com.gitblit.Keys;\r
 import com.gitblit.utils.JGitUtils;\r
index d3d68b7a10cd46b87e640f5b91d8a13c555a37f2..3c5aca8b3c71b043c989ed7cd540d041cdd81c78 100644 (file)
@@ -4,7 +4,7 @@
 html, body, table, dl, dt, dd, ol, ul, li, form, a, span, tr, th, td, div, em {\r
        font-family: verdana, sans-serif;\r
        font-size: 12px;\r
-       line-height: 15px;\r
+       line-height: 1.35em;\r
        margin: 0;\r
        padding: 0;\r
        border: 0;\r
@@ -22,7 +22,7 @@ body {
     padding: 0px;\r
 }\r
 \r
-pre, pre.prettyprint, pre.plainprint {\r
+pre, code, pre.prettyprint, pre.plainprint {\r
        color: black;\r
        font-family: monospace;\r
        font-size:12px;\r
@@ -75,6 +75,7 @@ div.header {
        background-color: #D2C3AF;\r
        padding: 3px;\r
        border: 1px solid #808080;\r
+       border-radius: 3px 3px 0 0;\r
 }\r
 \r
 div.header a {\r
@@ -146,6 +147,7 @@ div.page_nav {
        color: #ddd;\r
        background-color: #000070;\r
        padding: 7px;\r
+       border-radius: 3px;\r
 }\r
 \r
 div.page_nav a {\r
@@ -169,7 +171,7 @@ div.search {
        color:yellow;\r
        text-align:right;\r
        float:right;\r
-       padding:3px 4px 3px 3px;        \r
+       padding:4px 4px 3px 3px;        \r
 }\r
 \r
 .repositories_message {\r
diff --git a/src/com/gitblit/wicket/resources/markdown.css b/src/com/gitblit/wicket/resources/markdown.css
new file mode 100644 (file)
index 0000000..ce48cef
--- /dev/null
@@ -0,0 +1,54 @@
+/*\r
+ * Git:Blit Markdown CSS definition.\r
+ */\r
+\r
+div.markdown {\r
+}\r
+\r
+div.markdown h1,\r
+div.markdown h2, \r
+div.markdown h3, \r
+div.markdown h4, \r
+div.markdown h5, \r
+div.markdown h6 {\r
+    border: 0 none !important;\r
+}\r
+\r
+div.markdown h1 {    \r
+    margin-top: 1em;\r
+    margin-bottom: 0.5em;\r
+    padding-bottom: 0.5em;\r
+    border-bottom: 2px solid #000080 !important;\r
+}\r
+\r
+div.markdown h2 {\r
+    margin-top: 1em;\r
+    margin-bottom: 0.5em;    \r
+    padding-bottom: 0.5em;\r
+       border-bottom: 2px solid #000080 !important;    \r
+}\r
+\r
+div.markdown pre {\r
+       background-color: #f8f8f8;    \r
+    border: 1px solid #2f6fab;\r
+    border-radius: 3px;\r
+    overflow: auto;\r
+    padding: 5px;\r
+}\r
+\r
+div.markdown pre code {\r
+    background-color: inherit;\r
+    border: none;    \r
+    padding: 0;\r
+}\r
+\r
+div.markdown code {\r
+       background-color: #ffffe0;\r
+    border: 1px solid orange;\r
+    border-radius: 3px;\r
+    padding: 0 0.2em;\r
+}\r
+\r
+div.markdown a {\r
+       text-decoration: underline;     \r
+}
\ No newline at end of file