From wiki.ginstr.com
Jump to: navigation, search
Line 3: Line 3:
 
|}
 
|}
  
=Text=
+
=Text editable=
  
 
Widget is used for textual input of data by user. Value will be stored as datatype TEXT.<br>
 
Widget is used for textual input of data by user. Value will be stored as datatype TEXT.<br>
  
Widget id, ${widgetID}:
+
Widget id, ${gbamID}:
 
<pre>
 
<pre>
see variants
+
textEditable
 
</pre>
 
</pre>
  
Line 17: Line 17:
  
 
==== PreLoaded ====
 
==== PreLoaded ====
AutoLoaded data which is known:
+
* [[GBAMRulesForIDGeneration#.24.7BscreenLabel.7D|<code>${screenLabel}</code>]]
  
 
* ${pageName} - name of the page to which widgets are added
 
* ${pageName} - name of the page to which widgets are added
  
 
==== Properties panel ====
 
==== Properties panel ====
User will configure this data in properties panel of selected widget:
+
User will configure this data in properties panels of selected widget:
  
GENERAL:
+
=====GENERAL=====
* ${widgetLabel} - label of the widget user added to the screen
+
* "label", [[GBAMRulesForIDGeneration#.24.7BwidgetLabel.7D|<code>${widgetLabel}</code>]]
* ${hintText} - hint text
+
* "hint", [[GBAMRulesForIDGeneration#STRING_RESOURCE_ID.27S_.40string.2F|<code>${widgetHint}</code>]]
 +
 
 +
=====VALIDATIONS=====
 +
* "required", [[RequiredValidator]]
 +
* "min length", [[TextValidator#minLength]]
 +
* "max length", [[TextValidator#maxLength]]
 +
* "unique", check uniqueness when widget gets saved into db, having "is part of database" checked
 +
 
 +
=====ACTION=====
 +
* -
 +
 
 +
======ACTION MESSAGES======
 +
* -
  
 
== Code snippets ==
 
== Code snippets ==
 +
=== GBAM Code Variables ===
 +
 +
Variables which are used in code snippet below but not defined in user modifiable inputs.
 +
 +
* <code>[[GBAMRulesForIDGeneration#WIDGET_ID.27S_.24.7BwidgetID.7D|${widgetID}]]</code>
 +
 
=== Common widget code===
 
=== Common widget code===
<section begin=text.Source />
+
<syntaxhighlight lang="xml">
<pre>
 
 
<com.ginstr.widgets.GnTextView
 
<com.ginstr.widgets.GnTextView
     android:id="@+id/${pageName}_${widgetLabel}_label"
+
     android:id="@+id/${widgetID}_label"
 
     android:layout_width="match_parent"
 
     android:layout_width="match_parent"
 
     android:layout_height="wrap_content"
 
     android:layout_height="wrap_content"
     android:text="@string/${pageName}_${widgetLabel}"
+
     android:text="@string/${widgetID}"
     gn:style="@style/${widgetID}_label"/>
+
     gn:style="@style/textEditable_label"/>
  
 
<com.ginstr.widgets.GnEditText
 
<com.ginstr.widgets.GnEditText
     android:id="@+id/${pageName}_${widgetLabel}_input"
+
     android:id="@+id/${widgetID}_input"
 
     android:layout_width="match_parent"
 
     android:layout_width="match_parent"
 
     android:layout_height="wrap_content"
 
     android:layout_height="wrap_content"
     gn:s_hint="@string/${pageName}_${widgetLabel}Hint"
+
     gn:s_hint="@string/${widgetID}Hint"
 
     gn:dataType="text"
 
     gn:dataType="text"
     gn:style="@style/${widgetID}_input"/>
+
     gn:style="@style/textEditable_input"/>
</pre>
+
</syntaxhighlight>
<section end=text.Source />
 
  
 
=== strings.xml ===
 
=== strings.xml ===
 
+
Lines to be added for each language.
Lines to be added for <b>EN</b> language
+
<syntaxhighlight lang="xml">
<section begin=text.Strings.En />
+
<string name="${widgetID}">${widgetLabel}</string>
<pre>
+
<string name="${widgetID}Hint">${widgetHint}</string>
<string name="${pageName}_${widgetLabel}">${widgetLabel}</string>
+
</syntaxhighlight>
<string name="${pageName}_${widgetLabel}Hint">${hintText}</string>
 
</pre>
 
<section end=text.Strings.En />
 
 
 
Lines to be added for <b>DE</b> language
 
<section begin=text.Strings.De />
 
<pre>
 
<string name="${pageName}_${widgetLabel}">${widgetLabel}</string>
 
<string name="${pageName}_${widgetLabel}Hint">${hintText}</string>
 
</pre>
 
<section end=text.Strings.De />
 
 
 
<br /><hr />
 
=== Variants ===
 
<br /><hr />
 
==== <span id="textEditable">Text editable</span> variant====
 
Widget id:
 
<pre>
 
textEditable
 
</pre>
 
===== Widget code =====
 
<section begin=text.Variant.Editable.Attributes />
 
<pre>
 
    gn:s_sourceType="input"
 
</pre>
 
<section end=Number.Variant.Editable.Attributes  />
 
 
 
<br /><hr />
 
==== <span id="textNfc">Nfc</span> variant====
 
Widget id:
 
<pre>
 
nfc
 
</pre>
 
===== Widget code =====
 
<section begin=text.Variant.Nfc.Attributes />
 
<pre>
 
    gn:s_sourceType="nfc"
 
</pre>
 
<section end=Number.Variant.Nfc.Attributes  />
 
 
 
<br /><hr />
 
 
 
==== <span id="textBarcode">Barcode</span> variant====
 
Widget id:
 
<pre>
 
qr
 
</pre>
 
===== Widget code =====
 
<section begin=text.Variant.Qr.Attributes />
 
<pre>
 
    gn:s_sourceType="qr"
 
</pre>
 
<section end=Number.Variant.Qr.Attributes  />
 
<br /><hr />
 
 
 
==== <span id="textReadOnly">Text read only variant</span>====
 
Widget id:
 
<pre>
 
textReadOnly
 
</pre>
 
===== Widget code =====
 
<section begin=text.Variant.ReadOnly.Attributes />
 
<pre>
 
    gn:s_sourceType="input"
 
    gn:focusable="false"
 
    android:background="#00000000"
 
</pre>
 
<section end=Number.Variant.ReadOnly.Attributes  />
 

Revision as of 15:39, 9 November 2016

Text editable

Widget is used for textual input of data by user. Value will be stored as datatype TEXT.

Widget id, ${gbamID}:

textEditable

Back to GBAM widgets table

Predefined user data

PreLoaded

  • ${pageName} - name of the page to which widgets are added

Properties panel

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

GENERAL
VALIDATIONS
ACTION
  • -
ACTION MESSAGES
  • -

Code snippets

GBAM Code Variables

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

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/textEditable_label"/>

<com.ginstr.widgets.GnEditText
    android:id="@+id/${widgetID}_input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    gn:s_hint="@string/${widgetID}Hint"
    gn:dataType="text"
    gn:style="@style/textEditable_input"/>

strings.xml

Lines to be added for each language.

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