1 /*******************************************************************************
2 * Copyright (c) 2016 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * THTH ry - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.debug.browser.sections;
14 import java.io.PrintWriter;
16 import org.simantics.db.ReadGraph;
17 import org.simantics.db.exception.DatabaseException;
18 import org.simantics.debug.browser.utils.Escapes;
20 public class BreadcrumbSection implements ResourceBrowserSection {
22 public final Node[] breadcrumb;
24 public BreadcrumbSection(Node[] breadcrumb) {
25 this.breadcrumb = breadcrumb;
28 public static class Node {
29 public final String separator;
30 public final String name;
31 public final long resourceId;
33 public Node(String separator, String name, long resourceId) {
34 this.separator = separator;
36 this.resourceId = resourceId;
41 public double getPriority() {
46 public void toHtml(ReadGraph graph, PrintWriter out)
47 throws DatabaseException {
49 if (breadcrumb.length > 0) {
50 out.println("<div class=\"breadcrumbSection\">");
51 for(Node node : breadcrumb) {
52 out.print(node.separator);
53 out.print("<a href=\"");
54 out.print(node.resourceId);
56 out.print(Escapes.html(node.name));
59 out.println("</div>");