<?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
<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
</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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
+++ /dev/null
-/*\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
\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
# 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
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
\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
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
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
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
\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
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
--- /dev/null
+<!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
--- /dev/null
+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
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
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
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
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
color: #ddd;\r
background-color: #000070;\r
padding: 7px;\r
+ border-radius: 3px;\r
}\r
\r
div.page_nav a {\r
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
--- /dev/null
+/*\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