Skip to content

Commit

Permalink
minis: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seb committed Apr 7, 2011
1 parent ecda19c commit 1c3dbf4
Showing 1 changed file with 7 additions and 43 deletions.
Expand Up @@ -42,7 +42,7 @@
public class StyleSwitcher extends AbstractBehavior
{
/**
* Javascript access methods
* JavaScript access methods
*
* @author Igor Vaynberg (ivaynberg at apache dot org)
*
Expand All @@ -67,32 +67,11 @@ private static class TitledResourceReferenceTuple implements IClusterable
private final String title;
private final ResourceReference reference;

/**
* @param name
* @param reference
*/
public TitledResourceReferenceTuple(final String name, final ResourceReference reference)
public TitledResourceReferenceTuple(final String title, final ResourceReference reference)
{
super();
title = name;
this.title = title;
this.reference = reference;
}

/**
* @return reference
*/
public ResourceReference getReference()
{
return reference;
}

/**
* @return title
*/
public String getTitle()
{
return title;
}
}

private static final long serialVersionUID = 1L;
Expand All @@ -102,15 +81,6 @@ public String getTitle()

private final List<TitledResourceReferenceTuple> stylesheets = new ArrayList<TitledResourceReferenceTuple>();

/**
* Construct.
*
*/
public StyleSwitcher()
{
super();
}

/**
* Adds stylesheet to this stylesheet switcher
*
Expand All @@ -125,22 +95,16 @@ public void addStylesheet(final String title, final ResourceReference reference)
}

/**
* @see org.apache.wicket.behavior.AbstractBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse)
* {@inheritDoc}
*/
@Override
public void renderHead(final IHeaderResponse response)
{
response.renderJavascriptReference(SS_JS);

for (final TitledResourceReferenceTuple stylesheet : stylesheets)
{
final StringBuilder link = new StringBuilder(128);
link.append("<link rel=\"alternate stylesheet\" type=\"text/css\" href=\"");
link.append(RequestCycle.get().urlFor(stylesheet.getReference()));
link.append("\" title=\"");
link.append(stylesheet.getTitle());
link.append("\"/>");
response.renderString(link.toString());
}
response.renderString("<link rel=\"alternate stylesheet\" type=\"text/css\" href=\"" +
RequestCycle.get().urlFor(stylesheet.reference, null) + "\" title=\"" +
stylesheet.title + "\"/>");
}
}

0 comments on commit 1c3dbf4

Please sign in to comment.