Skip to content
Steve Hannah edited this page Jul 13, 2021 · 34 revisions

CodeRAD

An MVC framework for building native mobile apps in Codename One

This wiki includes reference documentation for the models, views, and controllers provided by CodeRAD.

Getting Started

If you are new to CodeRAD, you should start by reading at least the Getting Started section of the CodeRAD developers guide.

Javadocs

EntityViews

Buttons <buttons>

Renders a menu of buttons based on the actions in an action category.

EntityListView <entityList>

Renders a list of entities.

LabelEntityView <labelEntityView>

Renders an entity in a label.

ProfileAvatarsTitleComponent <profileAvatarsTitleComponent>

Renders a set of user profile avatars in a title component.

ProfileAvatarView <profileAvatarView>

A view that shows a profile’s avatar filled in a circle.

ProfileListView <profileListView>

A list view that can show a list of profiles.

TabsEntityView <tabsEntityView>

A Tabs component that is backed by a view model.

PropertyViews

ButtonListPropertyView <radButtonList>

Renders a property as a ButtonList

CheckBoxPropertyView <radCheckBox>

Renders a property as a CheckBox.

ComboBoxPropertyView <radComboBox>

Renders a property as a ComboBox

ImageContainerPropertyView <radImageContainer>

Renders a property as an ImageContainer.

PickerPropertyView <radPicker>, <radStringPicker>, <radDatePicker>, <radDateTimePicker>, <radTimePicker>, <radCalendarPicker>, <radDurationPicker>, <radDurationHoursPicker>, <radDurationMinutesPicker>

Renders a property as a Picker of the appropriate type.

RadioPropertyView <radRadio>

Renders a property as a RadioButton.

SpanLabelPropertyView <radSpanLabel>

Renders a property as a SpanLabel.

SwitchPropertyView <radSwitch>

Renders a property as a Switch.

TablePropertyView <radTable>

Renders a property as a table.

TextAreaPropertyView <radTextArea>

Renders a property as a TextArea.

TextFieldPropertyView <radTextField>

Renders a property as a TextField.

Other UI Components

CollapsibleHeaderContainer <collapsibleHeader>

A pane that includes a title bar that will hide when scrolling down the page, and reveal when scrolling back up the page.

CollapsibleSideBarContainer <sideBar>

A Pane that includes a side bar and main content, which the sidebar would "overlap".

HelpButton <helpButton>

A button that, when clicked on, displays some help text in a popup bubble.

InternalFrame

An internal frame, which is used inside the TabbedDocumentView

OverflowContainer

A container that can provide some "overflow" content when the user swipes left.

PopupMenu

A popup-menu with commands that the user can click on.

SideTabs

A Tabs component that displays the tab buttons on the left side.

TabbedDocumentView

A frame for keeping multiple documents opened in separate tabs.

TagEditor

A component for editing tags.

Table

A Table UI component similar to swing’s JTable. Supports row selection, column selection, cell selection, and editing.

ActionSheet

A sheet with buttons for a set of options. Rendered based on a set of actions.

PopupActionsMenu

A popupmenu to select between a set of actions.

Slot <define-slot>, <fill-slot>

A placeholder that can be inserted into a View, that will be filled at activation time by a Slot.

Core Codename One Components

You can use any Codename One component in a RAD view, but we have included some dedicated Wiki pages for some of these core components to demonstrate their usage within CodeRAD.

Containers

The following tags are aliases that create Conatiners with specific layout managers.

border

A container with BorderLayout.

borderAbsolute

A container with BorderLayout, with absolute center behaviour.

center

A container with FlowLayout, centered.

flow

A container with FlowLayout, aligned left. Same as left.

grid

A container with GridLayout.

layered

A container with https://www.codenameone.com/javadoc/com/codename1/ui/layouts/LayeredLayout.html

left

A container with FlowLayout, aligned left.

right

A container with FlowLayout aligned right.

x

A container with BoxLayout (x-axis).

y

A container with BoxLayout (y-axis).

Models

Entity

The base interface implemented by models CodeRAD models.

BaseEntity

Default implementation of Entity.

EntityWrapper

A wrapper class that allows interacting with one Entity using the API of another Entity.

EntityType

Encapsulates an entity "type" for an Entity class.

Controllers

ApplicationController

The main application controller.

AppSectionController

A controller for a section of an app.

FormController

A controller for handling application logic related to a Form.

ViewController

A controller class that handles application logic for a view.

Special View XML Tags

The following are tags with special meaning when used in RAD views.

<define-slot>

Creates a placeholder in the view whose contents can be overridden by a controller or containing view.

<fill-slot>

Fills a slot that is defined in a view.

<title>

A tag that allows you to manipulate the contents and behaviour of the title bar of forms in which the view is included.

<script>

Embeds java code that is executed inside the view in the current context.

<import>

Allows you to include java import statements to add classes and packages to the view’s namespace.

<use-taglib>

Specifies that the view uses a specified tag library, which will automatically add a set of imports to the view.

<define-tag>

Defines a property in the view model for this view.

<define-category>

Defines an action category in this view that will allow controllers to inject actions into it.

<var>

Defines a variable that can be used throughout the view.

<bind-action>

Binds the parent component to a given action specified by category. This is typically placed inside a <button> tag.

Special XML Attributes

The following are XML attributes with special meaning in CodeRAD views.

layout-constraint

Set the layout constraint used to add the component to its parent. Required when components appear inside containers with layouts, like BorderLayout, that require a layout constraint.

layout-rows

Used only with the <grid> tag. Specifies the number of rows in the grid.

layout-columns

Used only with the <grid> tag. Specifies the number of columns in the grid.

rad-transition

Specifies transitions that should be used when properties change due to bindings. Used in conjunction with bind-* attributes or rad-href attribute.

rad-leadComponent

Specifies the lead component for a container, using ComponentSelector query syntax.

rad-implements

Used only in the root tag. A comma-delimited list of interfaces that the view should implement.

rad-href

Specifies a location to "go to", when an action occurs on the component. Typically used with the <button> component to navigate to a new form, but can be used with any view in conjunction with the rad-href-trigger attribute.

rad-href-trigger

Specifies the action that triggers a rad-href navigation.

rad-var

Creates a variable reference to this component so that it can be accessed via Java expressions in the view.

rad-condition

A java expression that returns a boolean, which decides whether the component should be rendered. The expression is run at the time the view is created.