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

Checkbox

Widget is represented by a text and checkbox right aligned. Data that is saved to database is of datatype "status".

Widget id, ${gbamID}:

checkbox

Back to GBAM widgets table

Datatypes

Value is stored from widget to database as status datatype.

Predefined user data

PreLoaded

Properties panel

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

GENERAL
  • "label", ${widgetLabel}
  • "is checked", checkbox if checked, checkbox will be checked, by default it's unchecked. If checkbox is selected following code is added to widget. ${isCheched}=

android:checked="true"

VALIDATIONS
  • -
ACTION
  • -
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":
  • "unique", check uniqueness when widget gets saved into db, having "is part of database" checked, add to configuration.xml:
    <columnStatus unique="true|false"></columnStatus>

Code snippets

GBAM Code Variables

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

Common widget code

<RelativeLayout
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
        gn:style="@style/checkbox_container" >  

	<com.ginstr.widgets.GnTextView        
		android:id="@+id/${widgetID}_label"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:layout_toLeftOf="@+id/${widgetID}_input" 
		android:text="@string/${widgetID}"
                gn:style="@style/checkbox_text" />

	<com.ginstr.widgets.GnCheckBox  
		android:id="@+id/${widgetID}_input"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
                gn:dataType="status"
                ${isCheched}
                gn:style="@style/checkbox_checkbox" />
</RelativeLayout>  

strings.xml

Lines to be added for each language.

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