Class ToolbarButton
- java.lang.Object
-
- org.eclipse.nebula.widgets.richtext.toolbar.ToolbarButton
-
public abstract class ToolbarButton extends java.lang.ObjectRepresentation of a toolbar button that should be added to the toolbar of the underlying CKEditor. Can be used to either execute Javascript or Java via callbacks.To execute Javascript in the browser, override
getJavascriptToExecute()to return the Javascript code as String, that should be interpreted by the browser.To execute Java via callback, override
execute()and ensure thatgetJavascriptToExecute()returnsnull.The available toolbars a button can be added to are configured via
ToolbarConfiguration.getToolbarGroupConfiguration(). It is possible to specify the position of the button in the toolbar group via comma separated index, e.g. other,1 will place a new button at the first position of the toolbar group with the name other.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringbuttonLabelprivate java.lang.StringbuttonNameprivate java.lang.StringcommandNameprivate java.net.URLiconURLprivate java.lang.Stringtoolbar
-
Constructor Summary
Constructors Constructor Description ToolbarButton(java.lang.String buttonName, java.lang.String commandName, java.lang.String buttonLabel, java.lang.String toolbar, java.net.URL iconURL)Create aToolbarButtonwith the given information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectexecute()The code that should be executed via Javascript callback when this button is pressed.java.lang.StringgetButtonLabel()java.lang.StringgetButtonName()java.lang.StringgetCommandName()java.net.URLgetIconURL()java.lang.StringgetJavascriptToExecute()This method can be used to specify Javascript calls that should be executed.java.lang.StringgetToolbar()
-
-
-
Constructor Detail
-
ToolbarButton
public ToolbarButton(java.lang.String buttonName, java.lang.String commandName, java.lang.String buttonLabel, java.lang.String toolbar, java.net.URL iconURL)Create aToolbarButtonwith the given information.- Parameters:
buttonName- The unique name of the dynamically created CKEditor button.commandName- The unique name of the dynamically created CKEditor command that is called by pressing this button.buttonLabel- The textual part of the button (if visible) and its tooltip.toolbar- The toolbar group into which the button will be added. An optional index value (separated by a comma) determines the button position within the group.iconURL- TheURLof the image that should be show as button icon.
-
-
Method Detail
-
getButtonName
public java.lang.String getButtonName()
- Returns:
- The unique name of the dynamically created CKEditor button.
-
getCommandName
public java.lang.String getCommandName()
- Returns:
- The unique name of the dynamically created CKEditor command that is called by pressing this button.
-
getButtonLabel
public java.lang.String getButtonLabel()
- Returns:
- The textual part of the button (if visible) and its tooltip.
-
getToolbar
public java.lang.String getToolbar()
- Returns:
- The toolbar group into which the button will be added. An optional index value (separated by a comma) determines the button position within the group.
-
getIconURL
public java.net.URL getIconURL()
- Returns:
- The
URLof the image that should be show as button icon.
-
getJavascriptToExecute
public java.lang.String getJavascriptToExecute()
This method can be used to specify Javascript calls that should be executed. If this method does not returnnull, the specified Javascript code is evaluated. Otherwise the Java code specified inexecute()is executed via Javascript callback.- Returns:
- The Javascript to execute or
nullto execute the callback.
-
execute
public java.lang.Object execute()
The code that should be executed via Javascript callback when this button is pressed.- Returns:
- A possible return value.
-
-