001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Jean-Marc Orliaguet, Chalmers 011 * 012 * $Id$ 013 */ 014 015package org.nuxeo.theme.html.ui; 016 017import java.util.List; 018 019import org.nuxeo.theme.Manager; 020import org.nuxeo.theme.ShortcutType; 021import org.nuxeo.theme.types.Type; 022import org.nuxeo.theme.types.TypeFamily; 023import org.nuxeo.theme.types.TypeRegistry; 024 025public class Accesskeys { 026 027 public static String render() { 028 StringBuilder sb = new StringBuilder(); 029 final TypeRegistry typeRegistry = Manager.getTypeRegistry(); 030 final List<Type> shortcuts = typeRegistry.getTypes(TypeFamily.SHORTCUT); 031 if (shortcuts == null) { 032 return ""; 033 } 034 sb.append("<div>"); 035 for (Type type : shortcuts) { 036 final ShortcutType shortcut = (ShortcutType) type; 037 sb.append(String.format("<a href=\"%s\" accesskey=\"%s\"></a>", shortcut.getTarget(), shortcut.getKey())); 038 } 039 sb.append("</div>"); 040 return sb.toString(); 041 } 042 043}