// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. part of swarmlib; /** * An informational dialog that shows keyboard shortcuts and provides a * link to the Dart language webpage. */ //TODO(efortuna): fix DialogView so it doesn't require the HTML passed to // the constructor. class HelpDialog extends DialogView { CompositeView _parent; Function _doneHandler; HelpDialog(this._parent, this._doneHandler) : super('Information', '', makeContent()); void onDone() { _doneHandler(); } static View makeContent() { return new View.html('''

Keyboard shortcuts: ${generateTableHtml()}

'''); } static String generateTableHtml() { String cellStart = ''''''; return ''' ${cellStart} Shortcut Key ${cellStart} Action ${cellStart} j, <down arrow> ${cellStart} Next Article ${cellStart} k, <up arrow> ${cellStart} Previous Article ${cellStart} o, <enter> ${cellStart} Open Article ${cellStart} <esc>, <delete> ${cellStart} Back ${cellStart} a, h, <left arrow> ${cellStart} Left ${cellStart} d, l, <right arrow> ${cellStart} Right ${cellStart} n ${cellStart} Next Category ${cellStart} p ${cellStart} Previous Category
'''; } }