From wiki.ginstr.com
Jump to: navigation, search
(Text read only variant)
(horizonal layout)
 
(45 intermediate revisions by one other user not shown)
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:
+
Widget id, <code>${gbamID}</code>:<br>
<pre>
+
see <code>[[Text#GENERAL|alignment]]</code>
text
+
 
</pre>
+
Back to [[ginstr_app_composer_reference#Widgets_table|GBAM widgets table]]
 +
 
 +
== Datatypes ==
 +
 
 +
Value is stored from widget to database as [[:Category:Datatypes#text|<code>text</code>]] datatype.
  
Back to [[ginstr app composer reference]]
 
  
 
== Predefined user data ==
 
== Predefined user data ==
  
 
==== PreLoaded ====
 
==== PreLoaded ====
AutoLoaded data which is known:
+
* [[GBAMRulesForIDGeneration#.24.7BscreenLabel.7D|<code>${screenLabel}</code>]]
 +
 
 +
==== Properties panel ====
 +
User will configure this data in properties panels of selected widget:
 +
 
 +
=====GENERAL=====
 +
* "label", [[GBAMRulesForIDGeneration#.24.7BwidgetLabel.7D|<code>${widgetLabel}</code>]]
 +
* "hint", [[GBAMRulesForIDGeneration#STRING_RESOURCE_ID.27S_.40string.2F|<code>${widgetHint}</code>]]
 +
* "multiline" , checkbox option by default is set as unchecked. When checked
 +
to widget <code>@+id/${widgetID}_input</code> and <code>@+id/${widgetID}_label</code> is replaced style:
 +
<br>from <code>textEditable_label</code> to <code>textEditableMultiline_label</code>
 +
<br>from <code>textEditable_input</code> to <code>textEditableMultiline_input</code>
 +
<br>add to configuration.xml:
 +
<syntaxhighlight lang="xml">
 +
<columnText>
 +
    <multiline>true</multiline>
 +
</columnText>
 +
</syntaxhighlight>
 +
* "alignment", represented by dropdown with two options
 +
** "vertical", <code>${gbamID}</code>:<code>textEditable</code> when selected UI should show label above the input field, <code>[[Text#vertical_layout|vertical]]</code> xml should be used
 +
** "horizontal", <code>${gbamID}</code>:<code>textEditableHorizontal</code> when selected UI should show label to right of input field in same line, <code>[[Text#horizonal_layout|horizontal]]</code> xml should be used
 +
* "is masked" checkbox if selected,  the value in input field is masked, by default it's unchecked. If checkbox is selected following code is added to widget. ${isMasked}=
 +
<syntaxhighlight lang="xml">
 +
gn:isMasked="true"
 +
</syntaxhighlight>
  
* ${pageName} - name of the page to which widgets are added
+
=====VALIDATIONS=====
 +
* "required", [[RequiredValidator]], add to configuration.xml:
 +
<syntaxhighlight lang="xml">
 +
    <columnText required="true|false"></columnText>
 +
</syntaxhighlight>
 +
* "min length", [[TextValidator#minLength]]
 +
* "max length", [[TextValidator#maxLength]], add to configuration.xml:
 +
<syntaxhighlight lang="xml">
 +
<columnText>
 +
    <len>null|>=0|<=10000</len>
 +
</columnText>
 +
</syntaxhighlight>
 +
* "unique", check uniqueness when widget gets saved into db, having "is part of database" checked, add to configuration.xml:
 +
<syntaxhighlight lang="xml">
 +
    <columnText unique="true|false"></columnText>
 +
</syntaxhighlight>
  
==== Prompts ====
 
User enters this data when widget is dropped to screen:
 
  
* ${widgetName} - name of the widget user added to the screen
+
=====ACTION=====
* ${hintText} - hint text
+
* -
  
== Widget references ==
+
======ACTION MESSAGES======
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" | TextView
 
| title="Attribute" | android:id
 
| title="Value" | @+id/${pageName}${widgetName}Label
 
|-
 
| title="Widget" | TextView
 
| title="Attribute" | android:text
 
| title="Value" | @string/${pageName}${widgetName}Label
 
|-
 
| 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" | TextView
 
| title="Attribute" | gn:style
 
| title="Value" | @style/textLabel
 
|-
 
| title="Widget" | GnEditText
 
| title="Attribute" | gn:style
 
| title="Value" | @style/textInput
 
|}
 
  
 +
=====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:
 +
<syntaxhighlight lang="xml">
 +
<columnText>
 +
    <horizontalAlignment>left|center|right</horizontalAlignment>
 +
</columnText>
 +
</syntaxhighlight>
 +
:* "list of allowed values" array with list of allowed values, add to configuration.xml:
 +
<syntaxhighlight lang="xml">
 +
<columnText>
 +
  <valuesList>
 +
    <value>val1</value>
 +
    <value>val2</value>
 +
  </valuesList>
 +
</columnText>
 +
</syntaxhighlight>
 +
:* "pattern", add to configuration.xml:
 +
<syntaxhighlight lang="xml">
 +
<columnText>
 +
    <pattern errorMessage="invalidTextTableValue">[0-9A-Z]{3}</pattern>
 +
</columnText>
 +
</syntaxhighlight>
 +
:* "related unique columns", add to configuration.xml:
 +
<syntaxhighlight lang="xml">
 +
<columnText>
 +
    <uniqueInsideList>
 +
        <reference>
 +
          <table>refTableId1</table>
 +
          <column>refColumnField1</column>
 +
        </reference>
 +
        <reference>
 +
          <table>refTableId2</table>
 +
          <column>refColumnField2</column>
 +
        </reference>
 +
    </uniqueInsideList>
 +
</columnText>
 +
</syntaxhighlight>
 
== Code snippets ==
 
== Code snippets ==
=== Common widget code===
+
=== GBAM Code Variables ===
<section begin=text.Source />
+
 
<pre>
+
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>
 +
 
 +
=== Available layouts ===
 +
==== vertical layout ====
 +
 
 +
<syntaxhighlight lang="xml">
 
<com.ginstr.widgets.GnTextView
 
<com.ginstr.widgets.GnTextView
     android:id="@+id/${pageName}${widgetName}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}${widgetName}"
+
     android:text="@string/${widgetID}"
     gn:style="@style/textLabel"/>
+
     gn:style="@style/textEditable_label"/>
  
 
<com.ginstr.widgets.GnEditText
 
<com.ginstr.widgets.GnEditText
     android:id="@+id/${pageName}${widgetName}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}${widgetName}Hint"
+
     gn:s_hint="@string/${widgetID}Hint"
     gn:data_type="text"
+
     gn:dataType="text"
    gn:style="@style/textInput"/>
 
</pre>
 
<section end=text.Source />
 
 
 
=== strings.xml ===
 
 
 
Lines to be added for <b>EN</b> language
 
<section begin=text.Strings.En />
 
<pre>
 
<string name="${pageName}${widgetName}Label">${widgetName}</string>
 
<string name="${pageName}${widgetName}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}${widgetName}Label">${widgetName}</string>
 
<string name="${pageName}${widgetName}Hint">${hintText}</string>
 
</pre>
 
<section end=text.Strings.De />
 
 
 
<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"
 
     gn:s_sourceType="input"
</pre>
+
    gn:autoAdjustHeight="true"
<section end=Number.Variant.Editable.Attributes  />
+
    ${isMasked}
 +
    gn:style="@style/textEditable_input"/>
 +
</syntaxhighlight>
  
<br /><hr />
+
==== horizonal layout ====
  
=== <span id="textReadOnly">Text read only</span> option===
+
<syntaxhighlight lang="xml">
Widget id:
+
<LinearLayout
<pre>
+
android:layout_width="match_parent"
Id of variant is used
+
android:layout_height="wrap_content"
</pre>
+
        android:weightSum="100"
Read only is property of widget. When checked data can not be input into widget by user.
+
        android:orientation="horizontal">
==== Widget code ====
+
<com.ginstr.widgets.GnTextView
<section begin=text.Variant.ReadOnly.Attributes />
+
android:id="@+id/${widgetID}_label"
<pre>
+
android:layout_width="0dp"
    gn:s_sourceType="input"
+
                android:layout_weight="66"
    gn:focusable="false"
+
android:layout_height="wrap_content"
</pre>
+
android:text="@string/${widgetID}"
<section end=Number.Variant.ReadOnly.Attributes  />
+
gn:style="@style/textEditableHorizontal_label"/>
  
<hr />
+
<com.ginstr.widgets.GnEditText
 +
android:id="@+id/${widgetID}_input"
 +
android:layout_width="0dp"
 +
android:layout_height="wrap_content"
 +
                android:layout_weight="34"
 +
                gn:s_hint="@string/${widgetID}Hint"
 +
gn:dataType="text"
 +
gn:s_sourceType="input"
 +
                ${isMasked}
 +
gn:style="@style/textEditableHorizontal_input"/>
 +
</LinearLayout>
 +
</syntaxhighlight>
  
=== <span id="textRequired">Text required</span> option===
+
=== strings.xml ===
Widget id:
+
Lines to be added for each language.
<pre>
+
<syntaxhighlight lang="xml">
Id of variant is used
+
<string name="${widgetID}">${widgetLabel}</string>
</pre>
+
<string name="${widgetID}Hint">${widgetHint}</string>
Required is property of widget.
+
</syntaxhighlight>
==== Widget code ====
 
====$defaultApp user did not change content====
 
<pre>
 
    gn:act_validate="[name:RequiredValidator],[message=@string/requiredField]"
 
</pre>
 
====user changed the content====
 
<pre>
 
    gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}${widgetName}requiredField]"
 
</pre>
 
strings.xml
 
<pre>
 
<string name="${pageName}${widgetName}requiredField">${userInput}</string>
 
</pre>
 
 
 
=== <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  />
 

Latest revision as of 09:38, 2 January 2020

Text editable

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

Widget id, ${gbamID}:
see alignment

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

to widget @+id/${widgetID}_input and @+id/${widgetID}_label is replaced style:
from textEditable_label to textEditableMultiline_label
from textEditable_input to textEditableMultiline_input
add to configuration.xml:

<columnText>
    <multiline>true</multiline>
</columnText>
  • "alignment", represented by dropdown with two options
    • "vertical", ${gbamID}:textEditable when selected UI should show label above the input field, vertical xml should be used
    • "horizontal", ${gbamID}:textEditableHorizontal when selected UI should show label to right of input field in same line, horizontal xml should be used
  • "is masked" checkbox if selected, the value in input field is masked, by default it's unchecked. If checkbox is selected following code is added to widget. ${isMasked}=
gn:isMasked="true"
VALIDATIONS
    <columnText required="true|false"></columnText>
<columnText>
    <len>null|>=0|<=10000</len>
</columnText>
  • "unique", check uniqueness when widget gets saved into db, having "is part of database" checked, add to configuration.xml:
    <columnText unique="true|false"></columnText>


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":
  • "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.

Available layouts

vertical layout

<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:s_sourceType="input"
    gn:autoAdjustHeight="true"
    ${isMasked}
    gn:style="@style/textEditable_input"/>

horizonal layout

<LinearLayout
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
        android:weightSum="100"
        android:orientation="horizontal">
	<com.ginstr.widgets.GnTextView
		android:id="@+id/${widgetID}_label"
		android:layout_width="0dp"
                android:layout_weight="66"
		android:layout_height="wrap_content"
		android:text="@string/${widgetID}"
		gn:style="@style/textEditableHorizontal_label"/>

	<com.ginstr.widgets.GnEditText
		android:id="@+id/${widgetID}_input"
		android:layout_width="0dp"
		android:layout_height="wrap_content"
                android:layout_weight="34"
                gn:s_hint="@string/${widgetID}Hint"
		gn:dataType="text"
		gn:s_sourceType="input"	
                ${isMasked}
		gn:style="@style/textEditableHorizontal_input"/>
</LinearLayout>

strings.xml

Lines to be added for each language.

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