com.atlassian.jira.plugin.keyboardshortcut
Class KeyboardShortcut

java.lang.Object
  extended by com.atlassian.jira.plugin.keyboardshortcut.KeyboardShortcut
All Implemented Interfaces:
Comparable<KeyboardShortcut>

@PublicApi
public final class KeyboardShortcut
extends Object
implements Comparable<KeyboardShortcut>

Defines a keyboard shortcut. A shortcut consists of the keys required for the shortcut (could be multiples for the same shortcut such as gh or gd), a context (some shortcuts only apply on the view issue page), the operation and a parameter for the operation (generally a jQuery selector, but can be anything really.).

Since:
v4.1

Constructor Summary
KeyboardShortcut(String moduleKey, KeyboardShortcutManager.Context context, KeyboardShortcutManager.Operation operation, String parameter, int order, Set<List<String>> shortcuts, String descriptionI18nKey, boolean hidden)
           
KeyboardShortcut(String moduleKey, KeyboardShortcutManager.Context context, KeyboardShortcutManager.Operation operation, String parameter, int order, Set<List<String>> shortcuts, String descriptionI18nKey, boolean hidden, com.atlassian.plugin.web.Condition condition)
           
 
Method Summary
 int compareTo(KeyboardShortcut shortcut)
           
 com.atlassian.plugin.web.Condition getCondition()
           
 KeyboardShortcutManager.Context getContext()
           
 String getDescriptionI18nKey()
           
 String getModuleKey()
           
 KeyboardShortcutManager.Operation getOperation()
           
 int getOrder()
           
 String getParameter()
           
 String getPrettyShortcut(I18nHelper i18nHelper)
          Given a set of shortcuts (such as ["gh", "gd"]), this method will produce a pretty internationalized HTML string such as
 Set<List<String>> getShortcuts()
           
 boolean isHidden()
           
 boolean shouldDisplay(Map<String,Object> context)
          Returns whether the user can use the keyboard shortcut.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyboardShortcut

public KeyboardShortcut(String moduleKey,
                        KeyboardShortcutManager.Context context,
                        KeyboardShortcutManager.Operation operation,
                        String parameter,
                        int order,
                        Set<List<String>> shortcuts,
                        String descriptionI18nKey,
                        boolean hidden)

KeyboardShortcut

public KeyboardShortcut(String moduleKey,
                        KeyboardShortcutManager.Context context,
                        KeyboardShortcutManager.Operation operation,
                        String parameter,
                        int order,
                        Set<List<String>> shortcuts,
                        String descriptionI18nKey,
                        boolean hidden,
                        com.atlassian.plugin.web.Condition condition)
Method Detail

getModuleKey

public String getModuleKey()

getContext

public KeyboardShortcutManager.Context getContext()

getOperation

public KeyboardShortcutManager.Operation getOperation()

getParameter

public String getParameter()

getOrder

public int getOrder()

getShortcuts

public Set<List<String>> getShortcuts()

getDescriptionI18nKey

public String getDescriptionI18nKey()

isHidden

public boolean isHidden()

getCondition

public com.atlassian.plugin.web.Condition getCondition()

shouldDisplay

public boolean shouldDisplay(Map<String,Object> context)
Returns whether the user can use the keyboard shortcut.

Parameters:
context - the context to be passed to the condition
Returns:
whether the user can use the keyboard shortcut.
See Also:
Condition.shouldDisplay(java.util.Map)

getPrettyShortcut

public String getPrettyShortcut(I18nHelper i18nHelper)
Given a set of shortcuts (such as ["gh", "gd"]), this method will produce a pretty internationalized HTML string such as

<kbd>g</kbd> then <kbd>h</kbd>

or

<kbd>g</kbd> then <kbd>d</kbd>

Parameters:
i18nHelper - the i18nHelper to user for translations.
Returns:
pretty printed shortcut.

compareTo

public int compareTo(KeyboardShortcut shortcut)
Specified by:
compareTo in interface Comparable<KeyboardShortcut>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2014 Atlassian. All Rights Reserved.