From wiki.ginstr.com
Revision as of 12:30, 27 May 2020 by Danijel (talk | contribs) (Common widget code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Master data save

Widget represents a master data dropdown which pulls data from database and has a "+" symbol next to it. By pressing "+" symbol user will get on the next page where he can add additional records into master data table which fills dropdown on previous page. When data is filled and user goes back to previous page data added will be shown in dropdown. Information in dropdown is sorted "A-Z".

Widget id, ${gbamID}:

masterDataDropdownSave

Back to GBAM widgets table

Datatypes

Value is stored from widget to database as pointer datatype.

Predefined user data

PreLoaded

Properties panel

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

GENERAL
  • "label", ${widgetLabel}
  • "dropdown selection text", $dropDownZeroItem, by default it's pulled from defaultApp if checkbox is unchecked then user can input his override text
VALIDATIONS
    <columnPointer required="true|false"></columnPointer>
ACTION
  • "save master data template", button which will when clicked will save master data template to complex widgets
  • "choose display column", list of all widgets which are in masterDataScreen. Only widgets which save into database as text,pointer are shown in the list.
ACTION MESSAGES
  • "no data", if $defaultApp resource ${$dropDownNoData}, if we override then it has to be formed {@string/${widgetID}NoData} - message which appears when user clicks on dropdown and no data is loaded into dropdown
  • "no selection text", if $defaultApp resource ${$dropDownZeroItem}, if we override then it has to be formed ${@string/${widgetID}ZeroItem} - text which appears when dropdown is initially loaded and nothing is selected in it. By default first valid widget is selected
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":
  • "filterOnParentSelection", if true, filters table content if parent is selected in another portlet of same workspace, add to configuration.xml:
<columnPointer>
    <filterOnParentSelection>true|false</filterOnParentSelection>
</columnPointer>
  • "fix value", if update of value in reference should be disabled in case referred value was changed. Default: false., add to configuration.xml:
<columnPointer>
    <fixValue>true|false</fixValue>
</columnPointer>

Code snippets

GBAM Code Variables

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

  • ${widgetID}
  • ${widgetsAddedToMasterDataScreen} - when user is "edit master data" screen all widgets that he adds in that screen which have "is part of database" true will have their configuration.xml columns created how it's normally done in main screen

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/masterDataDropdownSave_label" />
	
<LinearLayout
  android:layout_height="wrap_content"
  android:layout_width="match_parent"
  android:weightSum="100"
  android:orientation="horizontal">
  
	<FrameLayout
		android:layout_width="0dp"
		android:layout_height="match_parent"
		gn:style="@style/masterDataDropdownSave_containerLeft">

	<com.ginstr.widgets.GnDropDown
		android:id="@+id/${widgetID}_input"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		gn:s_ZeroItemText="@string/${$dropDownZeroItem}"
		gn:noData="@string/${$dropDownNoData}" 
		gn:s_sourceType="database"
		gn:dataType="pointer"
                gn:s_sortColumn="${widgetID}"
		gn:act_beforeLoad="[gn:act_rawQueryToWidgets]|[${widgetID},${widgetID}_input;${widgetID};@+id/${widgetID}_input]"
		gn:style="@style/masterDataDropdownSave_input"/>

	</FrameLayout>
		
	<FrameLayout
		android:layout_width="0dp"
		android:layout_height="match_parent"
		gn:style="@style/masterDataDropdownSave_containerRight">
		<Button
			android:id="@+id/${widgetID}_plus"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			gn:act_toLayoutClick="@+id/${widgetID}"
			gn:style="@style/masterDataDropdownSave_open"/>
	</FrameLayout>
</LinearLayout>

strings.xml

Lines to be added for each language.

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

queries.xml

Add to queries.xml :

    <query
        id="${widgetID}_input" 
        columns="${screenLabelGenerated}_${widgetLabelGenerated}"/>

configuration.xml

Table configuration for add to configuration.xml node <configuration>:

<tables>
    <table id="${widgetID}" name="${widgetID}">
        ${widgetsAddedToMasterDataScreen}
    </table>
</tables>


Button save modifications

Add to button:

gn:act_backLoad="[gn:act_rawQueryToWidgets]|[${widgetID},${widgetID}_input;${widgetID};@+id/${widgetID}_input]"
[gn:act_cleanWidgets]|[@+id/${widgetID}];

[gn:act_rawQueryToWidgets]|[${widgetID},${widgetID}_input;${widgetID};@+id/${widgetID}_input]


variables.xml

    <variable id="${widgetID}" type="pointer"/>


masterDataScreen

Master data screen should be a Screen scroll which contains Button save at the bottom of screen pre-generated. User should not be allowed to exit master data screen or publish ginstr app if he did not add at least one text or pointer widget.