Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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"

(Create Riena Snippets page)
 
m
 
(116 intermediate revisions by 9 users not shown)
Line 1: Line 1:
Riena Snippets are small easy understandable programming example how to use Ridget API and other parts of Riena. You can find them in CVS [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.riena/org.eclipse.riena.sample.snippets/?root=RT_Project Riena code snippets].
+
{{#eclipseproject:rt.riena}}
  
(Committers, please create new categories alphabetically. Insert new snippets into the appropriate category. Thanks!)
+
{| align="right"
 +
| __TOC__
 +
|}
  
==Hello World==
+
== What are Snippets? ==
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut tincidunt elit quis leo. Donec bibendum feugiat felis. Etiam tincidunt purus eget sem. Vivamus convallis quam quis eros.
+
  
==Text Ridget==
+
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.
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/dialogs/Snippet012DialogWithImageButtons.java?view=markup Snippet012DialogWithImageButtons]===
+
Demonstrates usage of Icons in Buttons of Dialogs
+
  
(work in progress)
+
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''
  
[[Category:Riena]]
+
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, [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Riena&component=UI create a snippet contribution] in Bugzilla. Thanks in advance for your contribution!
 +
 
 +
== Snippets ==
 +
 
 +
=== HelloWorld ===
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetHelloWorld.java '''Hello World''']
 +
 
 +
=== LabelRidget ===
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetLabelRidget001.java LabelRidget with text property bound to a changing model value (like a time)]
 +
* LabelRidget with icons
 +
* LabelRidget with a tooltip
 +
 
 +
=== TextRidget ===
 +
* [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 'on edit' validation
 +
* TextRidget with 'on update' validation
 +
* [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 error marker
 +
* TextRidget with error marker and error message
 +
* TextRidget with output marker (read only)
 +
* Toggle visibility of a TextRidget
 +
* TextRidget with conversion rule (IConverter)
 +
* Blocked TextRidget
 +
* Non-focusable TextRidget
 +
* [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://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 ===
 +
* [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://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 ===
 +
* [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 ===
 +
* [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://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://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 ===
 +
This ridget wraps a DateTime widget for editing time or date.
 +
* [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 ===
 +
This ridget wraps a Link widget for showing clickable, underlined, pieces of text.
 +
* [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://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 ===
 +
This ridget wraps a Browser widget for showing HTML content.
 +
* [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://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 ===
 +
Use this for 'radio' buttons.
 +
* [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]]
 +
* 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 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
 +
 
 +
=== ComboRidget ===
 +
* [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://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://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://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://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 ===
 +
* Binding a ListRidget's input 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
 +
* ListRidget with output marker (read only)
 +
 
 +
=== TableRidget ===
 +
* [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]]
 +
* [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://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 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
 +
* [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]]
 +
* Using output markers (selection cannot be changed)
 +
* [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]]
 +
* [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]]
 +
* [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]]
 +
* [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 ===
 +
* [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]]
 +
* [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]]
 +
 
 +
=== TreeRidget ===
 +
* [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]]
 +
* Binding 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/SnippetTreeRidget003.java Hiding the root element in a TreeRidget]
 +
* Changing the expanded / collapsed state of a TreeRidget
 +
* Using output markers (selection cannot be changed)
 +
* [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://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://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]]
 +
 
 +
=== TreeTableRidget ===
 +
A tree with columns. It can do everything TreeRidget can do and more.
 +
* [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://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://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]]
 +
* TreeTableRidget with output marker (selection cannot be changed)
 +
* [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]]
 +
* [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]]
 +
 
 +
=== TraverseRidget ===
 +
 
 +
This ridget has a numeric value that can be manipulated by the user. It is mapped to SWT Slider, Scale or 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]]
 +
 
 +
=== ShellRidget ===
 +
=== StatuslineRidget ===
 +
=== StatuslineNumberRidget ===
 +
 
 +
=== MessageBoxRidget ===
 +
Shows messages to the user in a popup window.
 +
* [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 (?) ===
 +
=== ModuleTitleBarRidget (?) ===
 +
 
 +
=== AbstractDialogView ===
 +
Used to build dialogs that use the Riena concept of views and controllers.
 +
* [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 ===
 +
This ridget automatically binds a table ("master" area) to a set of widgets ("details" area). <br/>
 +
See also: <tt>[http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.ui.ridgets/src/org/eclipse/riena/ui/ridgets/IMasterDetailsRidget.java IMasterDetailsRidget]</tt>, <tt>[http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.ui.ridgets/src/org/eclipse/riena/ui/ridgets/IMasterDetailsDelegate.java IMasterDetailsDelegate]</tt>, <tt>[http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.ui.swt/src/org/eclipse/riena/ui/swt/AbstractMasterDetailsComposite.java AbstractMasterDetailsComposite]</tt>
 +
 
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget001.java Simple master details ridget: The "master" area is a table of persons. The "detail" area has text controls for editing a person.]
 +
[[Image:riena_master_details_001.png|200x200px]]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget002.java Master–detail ridget that applies changes instantly] -- IMasterDetailsRidget.setDirectWriting(boolean directWriting)
 +
[[Image:riena_master_details_auto_apply.png| 200x200px]]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget003.java Master–details ridget that asks for confirmation before removing an entry] -- AbstractMasterDetailsComposite.confirmRemove(Object item)
 +
[[Image:riena_master_details_confirm_removal.png|250x250px]]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget004.java Demonstates how to 'suggest' a new item. That item will be editable in the details area and will be added when apply is pressed.]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget005.java Demonstrates how to dynamically update the ridget in the detail area depending on the current selection.]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget006.java Demonstrates how to update the Apply button enablement, after modifying the details of the current selection programmatically.]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget007.java Demonstrates how to update the <tt>IMasterDetailsDelegate.isRemovable(Object)</tt> to disallow removal of any 'Jackson' family member.]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget008.java A read-only master details ridget. It does not have any New, Apply or Remove buttons.]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget009.java A master details ridget using two separate types &ndash; <tt>Person</tt> for the master table and the type <tt>SimplePerson</tt> for the details area.]
 +
* [http://git.eclipse.org/c/riena/org.eclipse.riena.git/plain/org.eclipse.riena.sample.snippets/src/org/eclipse/riena/sample/snippets/SnippetMasterDetailsRidget010.java Demonstrates the <tt>IMasterDetailsRidget#setRemoveCancelsNew(boolean)</tt> flag. When enabled the Remove button can be used to abort editing a new entry.]
 +
 
 +
=== Detached Views ===
 +
* [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]]
 +
 
 +
[[Category:Riena]] [[Category:Snippets]]

Latest revision as of 11:31, 4 January 2013

{{#eclipseproject:rt.riena}}

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

DateTimeRidget

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

LinkRidget

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

BrowserRidget

This ridget wraps a Browser widget for showing HTML content.

SingleChoiceRidget / ChoiceComposite

Use this for 'radio' buttons.

Riena-snippet-singlechoiceridget.png

  • 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 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

ComboRidget

ListRidget

TableRidget

Snippet002TableRidget.png

Snippet003TableRidgetSorting.png

TableRidget ColumnFormatter.png

RienaSnippetTableRidget004.png

RienaSnippetTableRidget007.png

CompositeTableRidget

TreeRidget

TreeTableRidget

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

TraverseRidget

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

ShellRidget

StatuslineRidget

StatuslineNumberRidget

MessageBoxRidget

Shows messages to the user in a popup window.

EmbeddedTitleBarRidget (?)

ModuleTitleBarRidget (?)

AbstractDialogView

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

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

Detached Views

SnippetDetachedView001.png

Back to the top