Difference between revisions of "Nebula TipOfTheDay"
(Created page with "==Introduction== File:Totd1.png File:Totd2.png File:Totd3.png ==Usage== This component is a widget that displays a "Tip of The Day". It contains the area to d...") |
m (→Example) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Nebula|< Back to Nebula Main Page]] | ||
+ | |||
==Introduction== | ==Introduction== | ||
Line 6: | Line 8: | ||
[[File:Totd3.png]] | [[File:Totd3.png]] | ||
+ | |||
+ | __TOC__ | ||
==Usage== | ==Usage== | ||
− | This component is a widget that displays a | + | This component is a widget that displays a '''Tip of The Day'''. It contains the area to display the tip, buttons to navigate through the list of tips, a close button and optionnaly a checkbox "show tips on startup". |
The first thing to do if to create an instance of TipOfTheDay and add tips : | The first thing to do if to create an instance of TipOfTheDay and add tips : | ||
− | + | ||
− | + | final TipOfTheDay tip = new TipOfTheDay(); | |
− | final TipOfTheDay tip = new TipOfTheDay(); | + | tip.addTip("<nowiki>This is the first tip<br/></nowiki> " + |
− | tip.addTip("This is the first tip<br/> " + "<b>This is the first tip</b> " + "<u>This is the first tip</u> " + "<i>This is the first tip</i> " + "This is the first tip " + "This is the first tip<br/>" + "This is the first tip " | + | "<nowiki><b>This is the first tip</b></nowiki> " + |
− | + | "<nowiki><u>This is the first tip</u></nowiki> " + | |
− | tip.addTip("This is the second tip<br/> " + "<b>This is the second tip</b> " + "<u>This is the second tip</u> <br/>" + "<i>This is the second tip</i> " + "This is the second tip " + "This is the second tip <br/>" + "This is the second tip " | + | "<nowiki><i>This is the first tip</i></nowiki> " + |
− | + | "This is the first tip " + | |
− | + | "<nowiki>This is the first tip<br/></nowiki>" + | |
+ | "This is the first tip " + | ||
+ | "This is the first tip"); | ||
+ | |||
+ | tip.addTip("<nowiki>This is the second tip<br/></nowiki> " + | ||
+ | "<nowiki><b>This is the second tip</b></nowiki> " + | ||
+ | "<nowiki><u>This is the second tip</u><br/></nowiki> " + | ||
+ | "<nowiki><i>This is the second tip</i></nowiki> " + | ||
+ | "This is the second tip " + | ||
+ | "<nowiki>This is the second tip <br/></nowiki>" + | ||
+ | "This is the second tip " + | ||
+ | "This is the second tip"); | ||
Line 28: | Line 43: | ||
* <code><nowiki><u>...</u></nowiki></code> to render text in underline | * <code><nowiki><u>...</u></nowiki></code> to render text in underline | ||
* <code><nowiki><b>...</b></nowiki></code> to render text in bold | * <code><nowiki><b>...</b></nowiki></code> to render text in bold | ||
− | * <code><nowiki><size>...</size> to increase/decrease text size. You can use the following syntaxes : <code><nowiki><size=10> (10px), <size=+4>, <size=-4></nowiki></code> | + | * <code><nowiki><size>...</size></nowiki></code> to increase/decrease text size. You can use the following syntaxes : <code><nowiki><size=10> (10px), <size=+4>, <size=-4></nowiki></code> |
* <code><nowiki><color>...</color></nowiki></code> to change foreground color. You can use the following syntaxes : <code><nowiki><color=#FFCCAA></nowiki></code> (HTML color code), <code><nowiki><color=9,255,10></nowiki></code> (RGB values) and <code><nowiki><color=aliceblue</nowiki></code>> (HTML color code) | * <code><nowiki><color>...</color></nowiki></code> to change foreground color. You can use the following syntaxes : <code><nowiki><color=#FFCCAA></nowiki></code> (HTML color code), <code><nowiki><color=9,255,10></nowiki></code> (RGB values) and <code><nowiki><color=aliceblue</nowiki></code>> (HTML color code) | ||
* <code><nowiki><backgroundcolor>...</backgroundcolor></nowiki></code> to change background color. You can use the following syntaxes : <code><nowiki><backgroundcolor=#FFCCAA></nowiki></code> (HTML color code), <code><nowiki><backgroundcolor=9,255,10></nowiki></code> (RGB values) and <code><nowiki><backgroundcolor=aliceblue></nowiki></code> (HTML color code) | * <code><nowiki><backgroundcolor>...</backgroundcolor></nowiki></code> to change background color. You can use the following syntaxes : <code><nowiki><backgroundcolor=#FFCCAA></nowiki></code> (HTML color code), <code><nowiki><backgroundcolor=9,255,10></nowiki></code> (RGB values) and <code><nowiki><backgroundcolor=aliceblue></nowiki></code> (HTML color code) | ||
Line 48: | Line 63: | ||
An example called TipOfTheDaySnippet is available in the plugin '''org.eclipse.nebula.widgets.opal.tipoftheday.snippets''' | An example called TipOfTheDaySnippet is available in the plugin '''org.eclipse.nebula.widgets.opal.tipoftheday.snippets''' | ||
− | You can also have a look here : https:// | + | You can also have a look here : [https://github.com/eclipse/nebula/blob/master/widgets/opal/tipoftheday/org.eclipse.nebula.widgets.opal.tipoftheday.snippets/src/org/eclipse/nebula/widgets/opal/tipoftheday/snippets/TipOfTheDaySnippet.java TipOfTheDaySnippet.java] |
Latest revision as of 08:03, 19 March 2020
Introduction
Contents
Usage
This component is a widget that displays a Tip of The Day. It contains the area to display the tip, buttons to navigate through the list of tips, a close button and optionnaly a checkbox "show tips on startup".
The first thing to do if to create an instance of TipOfTheDay and add tips :
final TipOfTheDay tip = new TipOfTheDay(); tip.addTip("This is the first tip<br/> " + "<b>This is the first tip</b> " + "<u>This is the first tip</u> " + "<i>This is the first tip</i> " + "This is the first tip " + "This is the first tip<br/>" + "This is the first tip " + "This is the first tip");
tip.addTip("This is the second tip<br/> " + "<b>This is the second tip</b> " + "<u>This is the second tip</u><br/> " + "<i>This is the second tip</i> " + "This is the second tip " + "This is the second tip <br/>" + "This is the second tip " + "This is the second tip");
Please notice that tips can contain pseudo-HTML code for formatting :
-
<br/>
for adding a line break -
<i>...</i>
to render text in italic -
<u>...</u>
to render text in underline -
<b>...</b>
to render text in bold -
<size>...</size>
to increase/decrease text size. You can use the following syntaxes :<size=10> (10px), <size=+4>, <size=-4>
-
<color>...</color>
to change foreground color. You can use the following syntaxes :<color=#FFCCAA>
(HTML color code),<color=9,255,10>
(RGB values) and<color=aliceblue
> (HTML color code) -
<backgroundcolor>...</backgroundcolor>
to change background color. You can use the following syntaxes :<backgroundcolor=#FFCCAA>
(HTML color code),<backgroundcolor=9,255,10>
(RGB values) and<backgroundcolor=aliceblue>
(HTML color code)
You can set the style and customize the image :
tip.setStyle(TipStyle.TWO_COLUMNS_LARGE); tip.setImage(myImage);
Finally, you open the window :
tip.open(mainShell);
You can get the status of the checkbox "show tip on startup" by calling the method showOnStartup()
.
Example
An example called TipOfTheDaySnippet is available in the plugin org.eclipse.nebula.widgets.opal.tipoftheday.snippets
You can also have a look here : TipOfTheDaySnippet.java