Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Riena/Snippets"

(Snippets)
(Subheaders and table of contents)
Line 19: Line 19:
 
== Snippets ==
 
== Snippets ==
  
 +
=== HelloWorld ===
 
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetHelloWorld.java?root=RT_Project&view=co '''Hello World''']
 
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetHelloWorld.java?root=RT_Project&view=co '''Hello World''']
  
* '''LabelRidget'''
+
=== LabelRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetLabelRidget001.java?root=RT_Project&view=co LabelRidget with text property bound to a changing model value (like a time)]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetLabelRidget001.java?root=RT_Project&view=co LabelRidget with text property bound to a changing model value (like a time)]
** LabelRidget with icons
+
* LabelRidget with icons
** LabelRidget with a tooltip
+
* LabelRidget with a tooltip
  
* '''TextRidget'''
+
=== TextRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget001.java?root=RT_Project&view=co TextRidget with minimum length validation rule and direct writing]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget001.java?root=RT_Project&view=co TextRidget with minimum length validation rule and direct writing]
** TextRidget with and without direct writing
+
* TextRidget with and without direct writing
** TextRidget with 'on edit' validation
+
* TextRidget with 'on edit' validation
** TextRidget with 'on update' validation
+
* TextRidget with 'on update' validation
** TextRidget with mandatory marker (user input required)
+
* TextRidget with mandatory marker (user input required)
** TextRidget with disabled marker
+
* TextRidget with disabled marker
** TextRidget with error marker
+
* TextRidget with error marker
** TextRidget with error marker and error message
+
* TextRidget with error marker and error message
** TextRidget with output marker (read only)
+
* TextRidget with output marker (read only)
** Toggle visibility of a TextRidget
+
* Toggle visibility of a TextRidget
** TextRidget with conversion rule (IConverter)
+
* TextRidget with conversion rule (IConverter)
** Blocked TextRidget
+
* Blocked TextRidget
** Non-focusable TextRidget
+
* Non-focusable TextRidget
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget002.java?root=RT_Project&view=co TextRidgets using a TooltipMessageMarkerViewer for showing error messages in their tooltip]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget002.java?root=RT_Project&view=co TextRidgets using a TooltipMessageMarkerViewer for showing error messages in their tooltip]
  
* '''NumericTextRidget'''
+
=== NumericTextRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetNumericTextRidget001.java?root=RT_Project&view=co Numeric text field ridget with 6 digit maximum number length rule]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetNumericTextRidget001.java?root=RT_Project&view=co Numeric text field ridget with 6 digit maximum number length rule]
  
* '''DecimalTextRidget'''
+
=== DecimalTextRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDecimalTextRidget001.java?root=RT_Project&view=co Decimal text field ridget with 9 decimal digits, 4 fraction digits and optional sign prefix ('-')]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDecimalTextRidget001.java?root=RT_Project&view=co Decimal text field ridget with 9 decimal digits, 4 fraction digits and optional sign prefix ('-')]
  
* '''DateTextRidget'''
+
=== DateTextRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTextRidget001.java?root=RT_Project&view=co Date text field ridget width a 'dd.MM.yyyy' pattern.]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTextRidget001.java?root=RT_Project&view=co Date text field ridget width a 'dd.MM.yyyy' pattern.]
  
* '''SingleChoiceRidget / ChoiceComposite''' (=Radio Buttons)
+
=== SingleChoiceRidget / ChoiceComposite ===
** Binding a SingleChoiceRidget's input to a model
+
Use this for 'radio' buttons.
** Binding a SingleChoiceRidget's selection to a model
+
* Binding a SingleChoiceRidget's input to a model
** SingleChoiceRidget with mandatory marker
+
* Binding a SingleChoiceRidget's selection to a model
** SingleChoiceRidget with output marker (read only)
+
* SingleChoiceRidget with mandatory marker
 +
* SingleChoiceRidget with output marker (read only)
  
* '''MultipleChoiceRidget / ChoiceComposite''' (=Check Buttons)
+
=== MultipleChoiceRidget / ChoiceComposite ===
** Binding a MultipleChoiceRidget's input to a model
+
Use this for 'check' buttons.
** Binding a MultipleChoiceRidget's selection to a model
+
* Binding a MultipleChoiceRidget's input to a model
** SingleChoiceRidget with mandatory marker
+
* Binding a MultipleChoiceRidget's selection to a model
** SingleChoiceRidget with output marker (read only)
+
* SingleChoiceRidget with mandatory marker
 +
* SingleChoiceRidget with output marker (read only)
  
* '''ActionRidget''' (=Button)
+
=== ActionRidget ===
** ActionRidget with an ActionListener
+
Use this for 'push' buttons.
** ActionRidget with Text, Icon and an ActionListener
+
* ActionRidget with an ActionListener
 +
* ActionRidget with Text, Icon and an ActionListener
  
* '''ToggleButtonRidget'''
+
=== ToggleButtonRidget ===
** ToggleButtonRidget with SWT.PUSH Button and an ActionListener
+
Use this for 'toggle' buttons.
** ToggleButtonRidget with SWT.CHECK Button and an ActionListener (important: use SingleChoiceRidget for a group of check buttons)
+
* ToggleButtonRidget with SWT.PUSH Button and an ActionListener
** ToggleButtonRidget with SWT.RADIO Button and an ActionListener (important: this is supported but does not make sense, use MultipleChoiceRidget instead)
+
* ToggleButtonRidget with SWT.CHECK Button and an ActionListener (important: use SingleChoiceRidget for a group of check buttons)
** ToggleButtonRidget with icon and text
+
* ToggleButtonRidget with SWT.RADIO Button and an ActionListener (important: this is supported but does not make sense, use MultipleChoiceRidget instead)
 +
* ToggleButtonRidget with icon and text
  
* '''ComboRidget'''
+
=== ComboRidget ===
** Binding a ComboRidget's input to a model
+
* Binding a ComboRidget's input to a model
** Binding a ComboRidget's selection to a model
+
* Binding a ComboRidget's selection to a model
** Designate a ''placeholder'' item, that is equivalent to ''no selection''
+
* Designate a ''placeholder'' item, that is equivalent to ''no selection''
  
* '''ListRidget'''
+
=== ListRidget ===
** Binding a ListRidget's input to a model
+
* Binding a ListRidget's input to a model
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetListRidget001.java?root=RT_Project&view=co Binding a ListRidget's selection to a model]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetListRidget001.java?root=RT_Project&view=co Binding a ListRidget's selection to a model]
** A sorted ListRidget  
+
* A sorted ListRidget  
** ListRidget with output marker (read only)
+
* ListRidget with output marker (read only)
  
* '''TableRidget'''
+
=== TableRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget001.java?root=RT_Project&view=co Demonstrates binding a TableRidget to a model.]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget001.java?root=RT_Project&view=co Demonstrates binding a TableRidget to a model.]
 
[[Image:Snippet002TableRidget.png]]
 
[[Image:Snippet002TableRidget.png]]
** Binding a TableRidget's selection to a model
+
* Binding a TableRidget's selection to a model
** TableRidget with column headers
+
* TableRidget with column headers
** TableRidget without column headers
+
* TableRidget without column headers
** TableRidget with moveable columns (user can use drag&drop to reorder the columns)
+
* TableRidget with moveable columns (user can use drag&drop to reorder the columns)
** TableRidget with boolean value in one column (automatically shown as checkbox)
+
* TableRidget with boolean value in one column (automatically shown as checkbox)
** TableRidget with double-click listener
+
* TableRidget with double-click listener
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget002.java?root=RT_Project&view=co TableRidget that allows sorting.]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget002.java?root=RT_Project&view=co TableRidget that allows sorting.]
 
[[Image:Snippet003TableRidgetSorting.png]]
 
[[Image:Snippet003TableRidgetSorting.png]]
** TableRidget with output marker (selection cannot be changed)
+
* TableRidget with output marker (selection cannot be changed)
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget003.java?root=RT_Project&view=co TableRidget with a formatted date column (ColumnFormatter)]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget003.java?root=RT_Project&view=co TableRidget with a formatted date column (ColumnFormatter)]
 
[[Image:TableRidget_ColumnFormatter.png]]
 
[[Image:TableRidget_ColumnFormatter.png]]
  
* '''TreeRidget'''
+
=== CompositeTableRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget001.java?root=RT_Project&view=co Demonstrates binding a TreeRidget to a TreeNode-based model]
+
 
 +
=== TreeRidget ===
 +
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget001.java?root=RT_Project&view=co Demonstrates binding a TreeRidget to a TreeNode-based model]
 
[[Image:Snippet004TreeRidget.png]]
 
[[Image:Snippet004TreeRidget.png]]
** Demonstrates binding a TreeRidget to a ''bean''-based model
+
* Demonstrates binding a TreeRidget to a ''bean''-based model
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget003.java?root=RT_Project&view=co Hiding the root element in a TreeRidget]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget003.java?root=RT_Project&view=co Hiding the root element in a TreeRidget]
** Changing the expanded / collapsed state of a TreeRidget
+
* Changing the expanded / collapsed state of a TreeRidget
** TreeRidget with output marker (selection cannot be changed)
+
* TreeRidget with output marker (selection cannot be changed)
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget002.java?root=RT_Project&view=co Tie the visibility of a tree item to the value of a method]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget002.java?root=RT_Project&view=co Tie the visibility of a tree item to the value of a method]
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget004.java?root=RT_Project&view=co Tie the enablement of a tree item to the value of a method]
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget004.java?root=RT_Project&view=co Tie the enablement of a tree item to the value of a method]
 +
 
 +
=== TreeTableRidget ===
 +
A tree with columns. It can do everything TreeRidget can do and more.
 +
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget001.java?root=RT_Project&view=co Demonstrates binding a TreeTableRidget to a ''bean''-based model]
 +
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget002.java?root=RT_Project&view=co TreeTableRidget that allows sorting]
 +
* TreeTableRidget with grouping (toggling on and off)
 +
* TreeTableRidget with output marker (selection cannot be changed)
 +
 
 +
=== ShellRidget ===
 +
=== StatuslineRidget ===
 +
=== StatuslineNumberRidget ===
 +
 
 +
=== MessageBoxRidget ===
 +
Shows messages to the user in a popup window.
 +
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMessageBoxRidget001.java?root=RT_Project&view=co Demonstrates the usage of a MessageBoxRidget]
  
* '''TreeTableRidget''': A tree with columns. It can do everything TreeRidget can do and more.
+
=== EmbeddedTitleBarRidget (?) ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget001.java?root=RT_Project&view=co Demonstrates binding a TreeTableRidget to a ''bean''-based model]
+
=== ModuleTitleBarRidget (?) ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget002.java?root=RT_Project&view=co TreeTableRidget that allows sorting]
+
** TreeTableRidget with grouping (toggling on and off)
+
** TreeTableRidget with output marker (selection cannot be changed)
+
  
* '''ShellRidget'''
+
=== DialogView ===
* '''StatuslineRidget'''
+
Used to build dialogs that use the Riena concept of views and controllers.
* '''StatuslineNumberRidget'''
+
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDialogView001.java?root=RT_Project&view=co Demonstrates the usage of a DialogView]
* '''MessageBoxRidget''': Shows messages to the user in a popup window.
+
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMessageBoxRidget001.java?root=RT_Project&view=co Demonstrates the usage of a MessageBoxRidget]
+
* '''EmbeddedTitleBarRidget''' (?)
+
* '''ModuleTitleBarRidget''' (?)
+
  
* '''DialogView''': Used to build dialogs that use the Riena concept of views and controllers.
+
=== MasterDetailsRidget ===
** [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDialogView001.java?root=RT_Project&view=co Demonstrates the usage of a DialogView]
+
  
 
[[Category:Riena]]
 
[[Category:Riena]]

Revision as of 01:57, 26 February 2009

Riena Project > Riena Snippets

What are Snippets?

Riena Snippets are small stand-alone programs that demonstrate specific techniques or functionality. Often a small example is the easiest way to understand how to use a particular feature.

To run a snippet:

  • create a new project that depends on org.eclipse.riena.client
  • copy the desired snippet to the clipboard
  • select your project and paste the snippet into your project. The snippet class will be created for you
  • run by selecting the class and then selecting Run > Run As > Java Application

Note that the snippets are edited for brevity rather than completeness. They are intended to guide the reader towards the correct solution, rather than be finished products. They are tested against the HEAD stream and may sometimes reference new API or require bug fixes from there.

Snippets also help isolate problems. The best way to report an Riena bug is to write your own snippet showing the problem and paste it into the bug report. For a snippet template, see the "Hello World" example.

To contribute a new snippet, create a snippet contribution in Bugzilla. Thanks in advance for your contribution!

Snippets

HelloWorld

LabelRidget

TextRidget

NumericTextRidget

DecimalTextRidget

DateTextRidget

SingleChoiceRidget / ChoiceComposite

Use this for 'radio' buttons.

  • Binding a SingleChoiceRidget's input to a model
  • Binding a SingleChoiceRidget's selection to a model
  • SingleChoiceRidget with mandatory marker
  • SingleChoiceRidget with output marker (read only)

MultipleChoiceRidget / ChoiceComposite

Use this for 'check' buttons.

  • Binding a MultipleChoiceRidget's input to a model
  • Binding a MultipleChoiceRidget's selection to a model
  • SingleChoiceRidget with mandatory marker
  • SingleChoiceRidget with output marker (read only)

ActionRidget

Use this for 'push' buttons.

  • ActionRidget with an ActionListener
  • ActionRidget with Text, Icon and an ActionListener

ToggleButtonRidget

Use this for 'toggle' buttons.

  • ToggleButtonRidget with SWT.PUSH Button and an ActionListener
  • ToggleButtonRidget with SWT.CHECK Button and an ActionListener (important: use SingleChoiceRidget for a group of check buttons)
  • ToggleButtonRidget with SWT.RADIO Button and an ActionListener (important: this is supported but does not make sense, use MultipleChoiceRidget instead)
  • ToggleButtonRidget with icon and text

ComboRidget

  • Binding a ComboRidget's input to a model
  • Binding a ComboRidget's selection to a model
  • Designate a placeholder item, that is equivalent to no selection

ListRidget

TableRidget

Snippet002TableRidget.png

  • Binding a TableRidget's selection to a model
  • TableRidget with column headers
  • TableRidget without column headers
  • TableRidget with moveable columns (user can use drag&drop to reorder the columns)
  • TableRidget with boolean value in one column (automatically shown as checkbox)
  • TableRidget with double-click listener
  • TableRidget that allows sorting.

Snippet003TableRidgetSorting.png

TableRidget ColumnFormatter.png

CompositeTableRidget

TreeRidget

Snippet004TreeRidget.png

TreeTableRidget

A tree with columns. It can do everything TreeRidget can do and more.

ShellRidget

StatuslineRidget

StatuslineNumberRidget

MessageBoxRidget

Shows messages to the user in a popup window.

EmbeddedTitleBarRidget (?)

ModuleTitleBarRidget (?)

DialogView

Used to build dialogs that use the Riena concept of views and controllers.

MasterDetailsRidget

Back to the top