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.
Riena/Snippets
{{#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
- LabelRidget with text property bound to a changing model value (like a time)
- LabelRidget with icons
- LabelRidget with a tooltip
TextRidget
- 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
- 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
- TextRidgets using a TooltipMessageMarkerViewer for showing error messages in their tooltip
- TextRidget using a converter to change the user's input before it appears in the ridget.
NumericTextRidget
- A NumericTextRidget with a 6-digit maximum number length rule
- A NumericTextRidget (or DecimalTextRidget) that converts empty values to "0" (or "0,00")
DecimalTextRidget
DateTextRidget
- Date text field ridget width a 'dd.MM.yyyy' pattern, bound against a String value.
- Date text field ridget width a 'dd.MM.yyyy' pattern, bound against a Date value.
- Snippet showing the SWT DateTime widget compared to the Riena DatePickerComposite.
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.
- Showing an IBrowserRidget with it's URL property bound against a text ridget.
- 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.
- 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
- Binding a ComboRidget's input and selection
- Converting an enum to String and back while using a ComboRidget
- Designating a 'placeholder' item that is equivalent to 'no selection'
- Demonstrates how to show an error marker, if the ComboRidget's selection is no longer available
- Demonstrates how to use a combo with autocompletion (CompletionCombo widget)
ListRidget
- Binding a ListRidget's input to a model
- Binding a ListRidget's selection to a model
- A sorted ListRidget
- ListRidget with output marker (read only)
TableRidget
- Binding a table ridget's current selection to a model, and displaying the model state in a label through another binding.
- 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
- Sortable columns (TableRidget that allows sorting)
- Using output markers (selection cannot be changed)
- Using formatted date columns (IColumnFormatter)
CompositeTableRidget
TreeRidget
- Binding to a TreeNode-based model
- Binding to a bean-based model
- Hiding the root element in a TreeRidget
- Changing the expanded / collapsed state of a TreeRidget
- Using output markers (selection cannot be changed)
- Tying the visibility of a tree item to the value of a method
- Tying whether a tree item is enabled/disabled to the value of a method
- Using custom image icons for nodes and leaves.
TreeTableRidget
A tree with columns. It can do everything TreeRidget can do and more.
- Demonstrates binding a TreeTableRidget to a bean-based model
- TreeTableRidget that allows sorting
- TreeTableRidget with grouping (toggling on and off)
- TreeTableRidget with output marker (selection cannot be changed)
- TreeTableRidget with column formatters
- Demonstrates automatic tree column creation and setting the column widths.
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
- Master–detail ridget that applies changes instantly -- IMasterDetailsRidget.setDirectWriting(boolean directWriting)
- Master–details ridget that asks for confirmation before removing an entry -- AbstractMasterDetailsComposite.confirmRemove(Object item)
- Demonstates how to 'suggest' a new item. That item will be editable in the details area and will be added when apply is pressed.
- Demonstrates how to dynamically update the ridget in the detail area depending on the current selection.
- Demonstrates how to update the Apply button enablement, after modifying the details of the current selection programmatically.
- Demonstrates how to update the IMasterDetailsDelegate.isRemovable(Object) to disallow removal of any 'Jackson' family member.
- A read-only master details ridget. It does not have any New, Apply or Remove buttons.
- A master details ridget using two separate types – Person for the master table and the type SimplePerson for the details area.
- Demonstrates the IMasterDetailsRidget#setRemoveCancelsNew(boolean) flag. When enabled the Remove button can be used to abort editing a new entry.