Difference between revisions of "Riena/Snippets"

From Eclipsepedia

Jump to: navigation, search
m (LabelRidget)
m
 
Line 32: Line 32:
  
 
=== 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://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget001.java 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
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget003.java?root=RT_Project&view=co TextRidget with mandatory marker (user input required)]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget003.java TextRidget with mandatory marker (user input required)]
 
* TextRidget with disabled marker
 
* TextRidget with disabled marker
 
* TextRidget with error marker
 
* TextRidget with error marker
Line 45: Line 45:
 
* 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://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget002.java 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/SnippetTextRidget004.java?root=RT_Project&view=co TextRidget using a converter to change the user's input before it appears in the ridget.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTextRidget004.java TextRidget using a converter to change the user's input before it appears in the ridget.]
  
 
=== 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 A NumericTextRidget with a 6-digit maximum number length rule]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetNumericTextRidget001.java A NumericTextRidget with a 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/SnippetNumericTextRidget002.java?root=RT_Project&view=co A NumericTextRidget (or DecimalTextRidget) that converts empty values to "0" (or "0,00")]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetNumericTextRidget002.java A NumericTextRidget (or DecimalTextRidget) that converts empty values to "0" (or "0,00")]
  
 
=== 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://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDecimalTextRidget001.java 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, bound against a String value.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTextRidget001.java Date text field ridget width a 'dd.MM.yyyy' pattern, bound against a String value.]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTextRidget002.java?root=RT_Project&view=co Date text field ridget width a 'dd.MM.yyyy' pattern, bound against a Date value.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTextRidget002.java Date text field ridget width a 'dd.MM.yyyy' pattern, bound against a Date value.]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTextRidget003.java?root=RT_Project&view=co Snippet showing the SWT DateTime widget compared to the Riena DatePickerComposite.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTextRidget003.java Snippet showing the SWT DateTime widget compared to the Riena DatePickerComposite.]
  
 
=== DateTimeRidget ===
 
=== DateTimeRidget ===
 
This ridget wraps a DateTime widget for editing time or date.
 
This ridget wraps a DateTime widget for editing time or date.
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTimeRidget001.java?root=RT_Project&view=co Bind a java.util.Date to two IDateTimeRidgets.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDateTimeRidget001.java Bind a java.util.Date to two IDateTimeRidgets.]
  
 
=== LinkRidget ===
 
=== LinkRidget ===
 
This ridget wraps a Link widget for showing clickable, underlined, pieces of text.
 
This ridget wraps a Link widget for showing clickable, underlined, pieces of text.
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetLinkRidget001.java?root=RT_Project&view=co Shows how to use ILinkRidgets.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetLinkRidget001.java Shows how to use ILinkRidgets.]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetLinkRidget002.java?root=RT_Project&view=co Shows binding a LinkRidget to an arbitrary data object.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetLinkRidget002.java Shows binding a LinkRidget to an arbitrary data object.]
  
 
=== BrowserRidget ===
 
=== BrowserRidget ===
 
This ridget wraps a Browser widget for showing HTML content.
 
This ridget wraps a Browser widget for showing HTML content.
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetBrowserRidget001.java?root=RT_Project&view=co Showing an IBrowserRidget with it's URL property bound against a text ridget.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetBrowserRidget001.java Showing an IBrowserRidget with it's URL property bound against a text ridget.]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetBrowserRidget002.java?root=RT_Project&view=co A BrowserRidget in output only mode. This will prevent the user from leaving the page (i.e. following a link is not possible).]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetBrowserRidget002.java A BrowserRidget in output only mode. This will prevent the user from leaving the page (i.e. following a link is not possible).]
  
 
=== SingleChoiceRidget / ChoiceComposite ===
 
=== SingleChoiceRidget / ChoiceComposite ===
 
Use this for 'radio' buttons.
 
Use this for 'radio' buttons.
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetSingleChoiceRidget001.java?root=RT_Project&view=co Binding a SingleChoiceRidget's selection to a model]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetSingleChoiceRidget001.java Binding a SingleChoiceRidget's selection to a model]
 
[[Image:Riena-snippet-singlechoiceridget.png]]
 
[[Image:Riena-snippet-singlechoiceridget.png]]
 
* SingleChoiceRidget with mandatory marker
 
* SingleChoiceRidget with mandatory marker
Line 101: Line 101:
  
 
=== ComboRidget ===
 
=== ComboRidget ===
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget001.java?root=RT_Project&view=co Binding a ComboRidget's input and selection]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget001.java Binding a ComboRidget's input and selection]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget002.java?root=RT_Project&view=co Converting an enum to String and back while using a ComboRidget]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget002.java Converting an enum to String and back while using a ComboRidget]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget003.java?root=RT_Project&view=co Designating a 'placeholder' item that is equivalent to 'no selection']
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget003.java Designating a 'placeholder' item that is equivalent to 'no selection']
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget004.java?root=RT_Project&view=co Demonstrates how to show an error marker, if the ComboRidget's selection is no longer available]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget004.java Demonstrates how to show an error marker, if the ComboRidget's selection is no longer available]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget005.java?root=RT_Project&view=co Demonstrates how to use a combo with autocompletion (CompletionCombo widget)]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetComboRidget005.java Demonstrates how to use a combo with autocompletion (CompletionCombo widget)]
  
 
=== 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://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetListRidget001.java 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 Binding a TableRidget to a model.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget001.java Binding a TableRidget to a model.]
 
[[Image:Snippet002TableRidget.png|250x250px]]
 
[[Image:Snippet002TableRidget.png|250x250px]]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget005.java?root=RT_Project&view=co Binding a table ridget's current selection to a model, and displaying the model state in a label through another binding.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget005.java Binding a table ridget's current selection to a model, and displaying the model state in a label through another binding.]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget006.java?root=RT_Project&view=co Binding a table ridget's current selection to a model, with the output label ridget's text property serving as the model.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget006.java Binding a table ridget's current selection to a model, with the output label ridget's text property serving as the model.]
 
* TableRidget with column headers
 
* TableRidget with column headers
 
* TableRidget without column headers
 
* TableRidget without column headers
Line 123: Line 123:
 
* 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 Sortable columns (TableRidget that allows sorting)]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget002.java Sortable columns (TableRidget that allows sorting)]
 
[[Image:Snippet003TableRidgetSorting.png|250x250px]]
 
[[Image:Snippet003TableRidgetSorting.png|250x250px]]
 
* Using output markers (selection cannot be changed)
 
* Using output markers (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 Using formatted date columns (IColumnFormatter)]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget003.java Using formatted date columns (IColumnFormatter)]
 
[[Image:TableRidget_ColumnFormatter.png|250x250px]]
 
[[Image:TableRidget_ColumnFormatter.png|250x250px]]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget004.java?root=RT_Project&view=co Automatic table column creation and setting the column widths]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget004.java Automatic table column creation and setting the column widths]
 
[[Image:RienaSnippetTableRidget004.png|250x250px]]
 
[[Image:RienaSnippetTableRidget004.png|250x250px]]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget007.java?root=RT_Project&view=co Demostrates how to use a RowErrorMessageMarker to mark errors in the rows of the table ridget.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget007.java Demostrates how to use a RowErrorMessageMarker to mark errors in the rows of the table ridget.]
 
[[Image:RienaSnippetTableRidget007.png|250x250px]]
 
[[Image:RienaSnippetTableRidget007.png|250x250px]]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget008.java?root=RT_Project&view=co Demostrates how to use an IClickListener to react to a click of a specific column.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTableRidget008.java Demostrates how to use an IClickListener to react to a click of a specific column.]
  
 
=== CompositeTableRidget ===
 
=== CompositeTableRidget ===
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetCompositeTableRidget001.java?root=RT_Project&view=co A composite table ridget with a row of text fields]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetCompositeTableRidget001.java A composite table ridget with a row of text fields]
 
** [[Image:SnippetCompositeTableRidget001.png|250x250px]]
 
** [[Image:SnippetCompositeTableRidget001.png|250x250px]]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetCompositeTableRidget002.java?root=RT_Project&view=co A composite table ridget with sortable columns]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetCompositeTableRidget002.java A composite table ridget with sortable columns]
 
** [[Image:SnippetCompositeTableRidget002.png|250x250px]]
 
** [[Image:SnippetCompositeTableRidget002.png|250x250px]]
  
 
=== TreeRidget ===
 
=== 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 Binding to a TreeNode-based model]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget001.java Binding to a TreeNode-based model]
 
** [[Image:Snippet004TreeRidget.png|150x150px]]
 
** [[Image:Snippet004TreeRidget.png|150x150px]]
 
* Binding to a ''bean''-based model
 
* Binding 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://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget003.java Hiding the root element in a TreeRidget]
 
* Changing the expanded / collapsed state of a TreeRidget
 
* Changing the expanded / collapsed state of a TreeRidget
 
* Using output markers (selection cannot be changed)
 
* Using output markers (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 Tying the visibility of a tree item to the value of a method]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget002.java Tying 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 Tying whether a tree item is enabled/disabled to the value of a method]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget004.java Tying whether a tree item is enabled/disabled 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/SnippetTreeRidget005.java?root=RT_Project&view=co Using custom image icons for nodes and leaves.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeRidget005.java Using custom image icons for nodes and leaves.]
 
** [[Image:RienaSnippetTreeRidget005.png|200x200px]]
 
** [[Image:RienaSnippetTreeRidget005.png|200x200px]]
  
 
=== TreeTableRidget ===
 
=== TreeTableRidget ===
 
A tree with columns. It can do everything TreeRidget can do and more.
 
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://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget001.java 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]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget002.java TreeTableRidget that allows sorting]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget004.java?root=RT_Project&view=co TreeTableRidget with grouping (toggling on and off)]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget004.java TreeTableRidget with grouping (toggling on and off)]
 
** [[Image:riena_tree_table_with_grouping.png|300x300px]]
 
** [[Image:riena_tree_table_with_grouping.png|300x300px]]
 
* TreeTableRidget with output marker (selection cannot be changed)
 
* TreeTableRidget 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/SnippetTreeTableRidget003.java?root=RT_Project&view=co TreeTableRidget with column formatters]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget003.java TreeTableRidget with column formatters]
 
** [[Image:riena_tree_table_with_formatters.png|200x200px]]
 
** [[Image:riena_tree_table_with_formatters.png|200x200px]]
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget005.java?root=RT_Project&view=co Demonstrates automatic tree column creation and setting the column widths.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTreeTableRidget005.java Demonstrates automatic tree column creation and setting the column widths.]
 
** [[Image:RienaSnippetTreeTableRidget005.png|250x250px]]
 
** [[Image:RienaSnippetTreeTableRidget005.png|250x250px]]
  
Line 168: Line 168:
 
This ridget has a numeric value that can be manipulated by the user. It is mapped to SWT Slider, Scale or Spinner controls.
 
This ridget has a numeric value that can be manipulated by the user. It is mapped to SWT Slider, Scale or Spinner controls.
  
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTraverseRidget001.java?root=RT_Project&view=co Example of the ITraverseRidget used with SWT's Slider, Scale and Spinner controls.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetTraverseRidget001.java Example of the ITraverseRidget used with SWT's Slider, Scale and Spinner controls.]
 
** [[Image:Riena_traverse_ridgets.png|200x200px]]
 
** [[Image:Riena_traverse_ridgets.png|200x200px]]
  
Line 177: Line 177:
 
=== MessageBoxRidget ===
 
=== MessageBoxRidget ===
 
Shows messages to the user in a popup window.
 
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]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMessageBoxRidget001.java Demonstrates the usage of a MessageBoxRidget]
  
 
=== EmbeddedTitleBarRidget (?) ===
 
=== EmbeddedTitleBarRidget (?) ===
Line 184: Line 184:
 
=== AbstractDialogView ===
 
=== AbstractDialogView ===
 
Used to build dialogs that use the Riena concept of views and controllers.
 
Used to build dialogs that use the Riena concept of views and controllers.
* [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 an AbstractDialogView]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDialogView001.java Demonstrates the usage of an AbstractDialogView]
  
 
=== MasterDetailsRidget ===
 
=== MasterDetailsRidget ===
Line 205: Line 205:
  
 
=== Detached Views ===
 
=== Detached Views ===
* [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDetachedView001.java?root=RT_Project&view=co Shows how to use the DetachedViewsManager to open / hide / close another view in a separate window.]
+
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetDetachedView001.java Shows how to use the DetachedViewsManager to open / hide / close another view in a separate window.]
 
[[Image:SnippetDetachedView001.png]]
 
[[Image:SnippetDetachedView001.png]]
  
 
[[Category:Riena]] [[Category:Snippets]]
 
[[Category:Riena]] [[Category:Snippets]]

Latest revision as of 11:31, 4 January 2013

Contents

[edit] 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!

[edit] Snippets

[edit] HelloWorld

[edit] LabelRidget

[edit] TextRidget

[edit] NumericTextRidget

[edit] DecimalTextRidget

[edit] DateTextRidget

[edit] DateTimeRidget

This ridget wraps a DateTime widget for editing time or date.

[edit] LinkRidget

This ridget wraps a Link widget for showing clickable, underlined, pieces of text.

[edit] BrowserRidget

This ridget wraps a Browser widget for showing HTML content.

[edit] SingleChoiceRidget / ChoiceComposite

Use this for 'radio' buttons.

Riena-snippet-singlechoiceridget.png

  • SingleChoiceRidget with mandatory marker
  • SingleChoiceRidget with output marker (read only)

[edit] 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)

[edit] ActionRidget

Use this for 'push' buttons.

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

[edit] ToggleButtonRidget

Use this for 'toggle' buttons.

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

[edit] ComboRidget

[edit] ListRidget

[edit] TableRidget

Snippet002TableRidget.png

Snippet003TableRidgetSorting.png

TableRidget ColumnFormatter.png

RienaSnippetTableRidget004.png

RienaSnippetTableRidget007.png

[edit] CompositeTableRidget

[edit] TreeRidget

[edit] TreeTableRidget

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

[edit] TraverseRidget

This ridget has a numeric value that can be manipulated by the user. It is mapped to SWT Slider, Scale or Spinner controls.

[edit] ShellRidget

[edit] StatuslineRidget

[edit] StatuslineNumberRidget

[edit] MessageBoxRidget

Shows messages to the user in a popup window.

[edit] EmbeddedTitleBarRidget (?)

[edit] ModuleTitleBarRidget (?)

[edit] AbstractDialogView

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

[edit] MasterDetailsRidget

This ridget automatically binds a table ("master" area) to a set of widgets ("details" area).
See also: IMasterDetailsRidget, IMasterDetailsDelegate, AbstractMasterDetailsComposite

Riena master details 001.png

Riena master details auto apply.png

Riena master details confirm removal.png

[edit] Detached Views

SnippetDetachedView001.png