From wiki.ginstr.com
Jump to: navigation, search

Radio group

Widget is represented by a label and group of radio buttons horizontally ordered. Data that is saved to database is of datatype "text".

Widget id, ${gbamID}:

radioGroup

Back to GBAM widgets table

Datatypes

Value is stored from widget to database as text datatype.

Predefined user data

PreLoaded

Properties panel

User will configure this data in properties panels of selected widget:

GENERAL
VALIDATIONS
    <columnText required="true|false"></columnText>
ACTION
  • "radio buttons", ${radioButtonsList} = list of ${radioButton} - repeats to how many radio button items were entered by user
  • ${radioButton} - single "radio button" item ${buttonValue} entered by user
ACTION MESSAGES
  • -
DATABASE
  • "is part of database", checkbox option by default is set as checked. When checked database column is created for this widget.
  • "additional ginstr web column settings":
  • "align text", radio button options with values: "left", "middle", "right", add to configuration.xml:
<columnText>
    <horizontalAlignment>left|center|right</horizontalAlignment>
</columnText>
  • "list of allowed values" array with list of allowed values, add to configuration.xml:
<columnText>
  <valuesList>
    <value>val1</value>
    <value>val2</value>
  </valuesList>
</columnText>
  • "pattern", add to configuration.xml:
<columnText>
    <pattern errorMessage="invalidTextTableValue">[0-9A-Z]{3}</pattern>
</columnText>
  • "related unique columns", add to configuration.xml:
<columnText>
    <uniqueInsideList>
        <reference>
          <table>refTableId1</table>
          <column>refColumnField1</column>
        </reference>
        <reference>
          <table>refTableId2</table>
          <column>refColumnField2</column>
        </reference>
    </uniqueInsideList>
</columnText>

Code snippets

GBAM Code Variables

Variables which are used in code snippet below but not defined in user modifiable inputs.

  • ${widgetID}
  • ${radioButton} radio button repeats depending on how many options user wrote in the action panel:
<com.ginstr.widgets.GnRadioButton
    android:id="@+id/${widgetID}_button_${buttonValue}" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="@string/${widgetID}_${buttonValue}"
    gn:style="@style/radioGroup_button"/>

Common widget code

<com.ginstr.widgets.GnTextView     
    android:id="@+id/${widgetID}_label"   
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:text="@string/${widgetID}"
    gn:style="@style/radioGroup_label" /> 
		
<com.ginstr.widgets.GnRadioGroup 
    android:id="@+id/${widgetID}_input" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"
    gn:dataType="text" 
    gn:style="@style/radioGroup_input">

    ${radioButtonsList}
</com.ginstr.widgets.GnRadioGroup>  

strings.xml

Lines to be added for each language.

<string name="${widgetID}">${widgetLabel}</string>
<string name="${widgetID}_${buttonValue}">${buttonValue}</string>