From wiki.ginstr.com
Jump to: navigation, search
(Predefined user data)
(horizonal layout)
 
(5 intermediate revisions by one other user not shown)
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, <code>${gbamID}</code>
+
Widget id, <code>${gbamID}</code>:<br>
<pre>
+
see <code>[[Text#GENERAL|alignment]]</code>
textEditable
 
</pre>
 
  
 
Back to [[ginstr_app_composer_reference#Widgets_table|GBAM widgets table]]
 
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.
 +
  
 
== Predefined user data ==
 
== Predefined user data ==
Line 34: Line 37:
 
     <multiline>true</multiline>
 
     <multiline>true</multiline>
 
</columnText>
 
</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>
 
</syntaxhighlight>
  
Line 63: Line 73:
 
* "is part of database", checkbox option by default is set as checked. When checked database column is created for this widget.
 
* "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":
 
* "additional ginstr web column settings":
** "align text", radio button options with values: "left", "middle", "right", add to configuration.xml:
+
:* "align text", radio button options with values: "left", "middle", "right", add to configuration.xml:
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
<columnText>
 
<columnText>
Line 69: Line 79:
 
</columnText>
 
</columnText>
 
</syntaxhighlight>
 
</syntaxhighlight>
** "list of allowed values" array with list of allowed values, add to configuration.xml:
+
:* "list of allowed values" array with list of allowed values, add to configuration.xml:
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
<columnText>
 
<columnText>
Line 78: Line 88:
 
</columnText>
 
</columnText>
 
</syntaxhighlight>
 
</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 ==
 
=== GBAM Code Variables ===
 
=== GBAM Code Variables ===
Line 86: Line 116:
 
* <code>[[GBAMRulesForIDGeneration#WIDGET_ID.27S_.24.7BwidgetID.7D|${widgetID}]]</code>
 
* <code>[[GBAMRulesForIDGeneration#WIDGET_ID.27S_.24.7BwidgetID.7D|${widgetID}]]</code>
  
=== Common widget code===
+
=== Available layouts ===
 +
==== vertical layout ====
 +
 
 
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
 
<com.ginstr.widgets.GnTextView
 
<com.ginstr.widgets.GnTextView
Line 103: Line 135:
 
     gn:s_sourceType="input"
 
     gn:s_sourceType="input"
 
     gn:autoAdjustHeight="true"
 
     gn:autoAdjustHeight="true"
 +
    ${isMasked}
 
     gn:style="@style/textEditable_input"/>
 
     gn:style="@style/textEditable_input"/>
 +
</syntaxhighlight>
 +
 +
==== horizonal layout ====
 +
 +
<syntaxhighlight lang="xml">
 +
<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>
 
</syntaxhighlight>
 
</syntaxhighlight>
  

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>