From wiki.ginstr.com
Jump to: navigation, search
(Text read only option)
Line 7: Line 7:
 
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:
+
Widget id, ${widgetID}:
 
<pre>
 
<pre>
 
see variants
 
see variants
Line 21: Line 21:
 
* ${pageName} - name of the page to which widgets are added
 
* ${pageName} - name of the page to which widgets are added
  
==== Prompts ====
+
==== Properties panel ====
User enters this data when widget is dropped to screen:
+
User will configure this data in properties panel of selected widget:
  
* ${widgetName} - name of the widget user added to the screen
+
GENERAL:
 +
* ${widgetLabel} - label of the widget user added to the screen
 
* ${hintText} - hint text
 
* ${hintText} - hint text
 
== Widget references ==
 
If widget is added via app composer autogenerated ids will be created according to table below.<br>
 
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
|-
 
! scope="col" | Control
 
! scope="col" | Attribute
 
! scope="col" | Value
 
|-
 
| title="Widget" | GnTextView
 
| title="Attribute" | android:id
 
| title="Value" | @+id/${pageName}${widgetName}Label
 
|-
 
| title="Widget" | GnTextView
 
| title="Attribute" | android:text
 
| title="Value" | @string/${pageName}_${widgetName}
 
|-
 
| title="Widget" | GnEditText
 
| title="Attribute" | android:id
 
| title="Value" | @+id/${pageName}${widgetName}Input
 
|-
 
| title="Widget" | GnEditText
 
| title="Attribute" | gn:s_hint
 
| title="Value" | @string/${pageName}_${widgetName}Hint
 
|-
 
| title="Widget" | GnTextView
 
| title="Attribute" | gn:style
 
| title="Value" | @style/${widgetID}Label
 
|-
 
| title="Widget" | GnEditText
 
| title="Attribute" | gn:style
 
| title="Value" | @style/${widgetID}Input
 
|}
 
  
 
== Code snippets ==
 
== Code snippets ==
Line 65: Line 33:
 
<pre>
 
<pre>
 
<com.ginstr.widgets.GnTextView
 
<com.ginstr.widgets.GnTextView
     android:id="@+id/${pageName}${widgetName}Label"
+
     android:id="@+id/${pageName}_${widgetLabel}_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}_${widgetName}"
+
     android:text="@string/${pageName}_${widgetLabel}"
     gn:style="@style/${widgetID}Label"/>
+
     gn:style="@style/${widgetID}_label"/>
  
 
<com.ginstr.widgets.GnEditText
 
<com.ginstr.widgets.GnEditText
     android:id="@+id/${pageName}${widgetName}Input"
+
     android:id="@+id/${pageName}_${widgetLabel}_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}_${widgetName}Hint"
+
     gn:s_hint="@string/${pageName}_${widgetLabel}Hint"
 
     gn:dataType="text"
 
     gn:dataType="text"
     gn:style="@style/${widgetID}Input"/>
+
     gn:style="@style/${widgetID}_input"/>
 
</pre>
 
</pre>
 
<section end=text.Source />
 
<section end=text.Source />
Line 86: Line 54:
 
<section begin=text.Strings.En />
 
<section begin=text.Strings.En />
 
<pre>
 
<pre>
<string name="${pageName}_${widgetName}">${widgetName}</string>
+
<string name="${pageName}_${widgetLabel}">${widgetLabel}</string>
<string name="${pageName}_${widgetName}Hint">${hintText}</string>
+
<string name="${pageName}_${widgetLabel}Hint">${hintText}</string>
 
</pre>
 
</pre>
 
<section end=text.Strings.En />
 
<section end=text.Strings.En />
Line 94: Line 62:
 
<section begin=text.Strings.De />
 
<section begin=text.Strings.De />
 
<pre>
 
<pre>
<string name="${pageName}_${widgetName}">${widgetName}</string>
+
<string name="${pageName}_${widgetLabel}">${widgetLabel}</string>
<string name="${pageName}_${widgetName}Hint">${hintText}</string>
+
<string name="${pageName}_${widgetLabel}Hint">${hintText}</string>
 
</pre>
 
</pre>
 
<section end=text.Strings.De />
 
<section end=text.Strings.De />
Line 141: Line 109:
 
<section end=Number.Variant.Qr.Attributes  />
 
<section end=Number.Variant.Qr.Attributes  />
 
<br /><hr />
 
<br /><hr />
 +
 
=== Options ===
 
=== Options ===
 
Options can be used in combination with variants. i.e. field can be editableText with option required
 
Options can be used in combination with variants. i.e. field can be editableText with option required
Line 158: Line 127:
 
</pre>
 
</pre>
 
<section end=Number.Variant.ReadOnly.Attributes  />
 
<section end=Number.Variant.ReadOnly.Attributes  />
 
<hr />
 
 
==== <span id="textRequired">Text required</span> option====
 
Widget id:
 
<pre>
 
Id of variant is used
 
</pre>
 
Required is property of widget.
 
=====autogenerated content=====
 
====== Widget code ======
 
<pre>
 
    gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}Required]"
 
</pre>
 
app composer will use from $defaultApp:
 
<pre>
 
    gn:act_validate="[name:RequiredValidator],[message=@string/defaultRequiredValidator]"
 
</pre>
 
strings.xml
 
<pre>
 
<string name="defaultRequiredValidator">entering the %1$s is required</string>
 
</pre>
 
 
app composer will produce:
 
strings.xml
 
<pre>
 
<string name="${pageName}_${widgetName}Required">entering the ${widgetName} is required</string>
 
</pre>
 
 
=====user changed autogenerated content=====
 
====== Widget code ======
 
<pre>
 
    gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}Required]"
 
</pre>
 
strings.xml
 
<pre>
 
<string name="${pageName}_${widgetName}Required">${userInput}</string>
 
</pre>
 

Revision as of 13:58, 2 November 2016

Text

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

Widget id, ${widgetID}:

see variants

Back to ginstr app composer reference

Predefined user data

PreLoaded

AutoLoaded data which is known:

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

Properties panel

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

GENERAL:

  • ${widgetLabel} - label of the widget user added to the screen
  • ${hintText} - hint text

Code snippets

Common widget code

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

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


strings.xml

Lines to be added for EN language

<string name="${pageName}_${widgetLabel}">${widgetLabel}</string>
<string name="${pageName}_${widgetLabel}Hint">${hintText}</string>


Lines to be added for DE language

<string name="${pageName}_${widgetLabel}">${widgetLabel}</string>
<string name="${pageName}_${widgetLabel}Hint">${hintText}</string>




Variants



Text editable variant

Widget id:

textEditable
Widget code
    gn:s_sourceType="input"




Nfc variant

Widget id:

nfc
Widget code
    gn:s_sourceType="nfc"




Barcode variant

Widget id:

qr
Widget code
    gn:s_sourceType="qr"



Options

Options can be used in combination with variants. i.e. field can be editableText with option required



Text read only option

Widget id:

textReadOnly

Read only is property of widget. When checked data can not be input into widget by user.

Widget code
    gn:s_sourceType="input"
    gn:focusable="false"
    android:background="#00000000"