org.nakedobjects.plugins.html.component.html.BreadCrumbs Maven / Gradle / Ivy
package org.nakedobjects.plugins.html.component.html;
import java.io.PrintWriter;
import org.nakedobjects.plugins.html.component.ComponentAbstract;
public class BreadCrumbs extends ComponentAbstract {
private final String[] names;
private final boolean[] isLinked;
public BreadCrumbs(final String[] names, final boolean[] isLinked) {
this.names = names;
this.isLinked = isLinked;
}
public void write(final PrintWriter writer) {
writer.println("");
final int length = names.length;
for (int i = 0; i < length; i++) {
if (i > 0) {
writer.print(" > ");
}
if (isLinked[i]) {
writer.print("");
writer.print(names[i]);
writer.print("");
} else if (!(i == length - 1 && names[i] == null)) {
writer.print("");
writer.print(names[i]);
writer.print("");
}
}
writer.print("");
}
}
// Copyright (c) Naked Objects Group Ltd.