[rkward-cvs] SF.net SVN: rkward-code:[4807] trunk/rkward

tfry at users.sf.net tfry at users.sf.net
Sat Sep 6 14:40:32 UTC 2014


Revision: 4807
          http://sourceforge.net/p/rkward/code/4807
Author:   tfry
Date:     2014-09-06 14:40:32 +0000 (Sat, 06 Sep 2014)
Log Message:
-----------
Document valueselector, select, and valueslot (along with some minor modifications for consistency)

Modified Paths:
--------------
    trunk/rkward/doc/rkwardplugins/index.docbook
    trunk/rkward/rkward/plugin/rkvalueselector.cpp
    trunk/rkward/rkward/plugins/testing/valueselect1.js
    trunk/rkward/rkward/plugins/testing/valueselect1.xml

Modified: trunk/rkward/doc/rkwardplugins/index.docbook
===================================================================
--- trunk/rkward/doc/rkwardplugins/index.docbook	2014-09-05 11:30:35 UTC (rev 4806)
+++ trunk/rkward/doc/rkwardplugins/index.docbook	2014-09-06 14:40:32 UTC (rev 4807)
@@ -2584,6 +2584,22 @@
 </varlistentry>
 
 <varlistentry>
+<term><valueselector></term>
+<listitem><para>Provides a list of available strings (not R objects) to be selected in one or more accompanying <valueslot>s. String options can be defined using <option>-tags as direct children (see below), or set using dynamic <link linkend="elementproperties">properties</link>. Attributes:
+	<variablelist>
+	<varlistentry>
+	<term><parameter>label</parameter></term>
+	<listitem><para>Label for the valueselector (optional, defaults to no label)</para></listitem>
+	</varlistentry>
+	</variablelist></para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><valueslot></term>
+<listitem><para>Used in conjunction with a <valueselector> to allow the user to select one or more string items. This element is mostly identical to <varslot>, and shares the same attributes, except for those which refer to properties of the acceptable items (i.e. classes, types, num_dimensions, min_length, max_length).</para></listitem>
+</varlistentry>
+
+<varlistentry>
 <term><radio></term>
 <listitem><para>Defines a group of radio-exclusive buttons (only one can be selected at a time). Requires at least two <option>-tags as direct children. No other tags are allowed as children. Attributes:
 	<variablelist>
@@ -2606,8 +2622,19 @@
 </varlistentry>
 
 <varlistentry>
+<term><select></term>
+<listitem><para>Provides a list of available strings from which the user can select an arbitrary number. String options can be defined using <option>-tags as direct children (see below), or set using dynamic <link linkend="elementproperties">properties</link>. Attributes:
+	<variablelist>
+	<varlistentry>
+	<term><parameter>label</parameter></term>
+	<listitem><para>Label for the <select> (optional, defaults to no label)</para></listitem>
+	</varlistentry>
+	</variablelist></para></listitem>
+</varlistentry>
+
+<varlistentry>
 <term><option></term>
-<listitem><para>Can only be used as a direct child of a <radio> or <dropdown> element. Represents one selectable option in a radio control or dropdown list. Specifying the "id" parameter for the <option> elements is optional (and in fact it's recommended, not to set an "id", unless you plan to really use it to disable single options). Only the parent element (<radio> or <dropdown>) needs one. Attributes:
+<listitem><para>Can only be used as a direct child of a <radio>, <dropdown>, <valueslot> or <select> element. Represents one selectable option in a radio control or dropdown list. Specifying the "id" parameter for the <option> elements is optional (and in fact it's recommended, not to set an "id", unless you plan to really use it to disable single options; <valueslot> and <select> options do not currently support ids). Only the parent element (<radio> or <dropdown> or <valueslot> or <select>) needs one. Attributes:
 	<variablelist>
 	<varlistentry>
 	<term><parameter>label</parameter></term>
@@ -2619,7 +2646,7 @@
 	</varlistentry>
 	<varlistentry>
 	<term><parameter>checked</parameter></term>
-	<listitem><para>Whether the option should be checked/selected by default "true" or "false". Only one button in a <radio> may be set to <parameter>checked=</parameter><replaceable>"true"</replaceable>. If no option is set to checked, the first option in the parent element will be checked/selected automatically. (optional, default to "false")</para></listitem>
+	<listitem><para>Whether the option should be checked/selected by default "true" or "false". In a <radio> or <dropdown>, only one option may be set to <parameter>checked=</parameter><replaceable>"true"</replaceable>, and if no option is set to checked, the first option in the parent element will be checked/selected automatically. In a <select>, any number of options may be set to checked. (optional, default to "false")</para></listitem>
 	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
@@ -3169,22 +3196,31 @@
 </varlistentry>
 
 <varlistentry>
-<term><radio></term>
-<listitem><para>Default property is "string"
+<term><valueselector></term>
+<listitem><para>Default property is "selected"
 	<variablelist>
 	<varlistentry>
-	<term>string</term>
-	<listitem><para>The value of the currently selected option (string)</para></listitem>
+	<term>selected</term>
+	<listitem><para>The strings currently selected. Modifier "labeled" to retrieve the corresponding labels. In a <valueselector> you probably do not want to use this, directly (only in a <select>). (read/write StringList)</para></listitem>
 	</varlistentry>
 	<varlistentry>
-	<term>number</term>
-	<listitem><para>The number of the currently selected option (options are numbered top-to-bottom, starting at 0) (integer)</para></listitem>
+	<term>available</term>
+	<listitem><para>The list of string values to select from. (read/write StringList)</para></listitem>
 	</varlistentry>
+	<varlistentry>
+	<term>labels</term>
+	<listitem><para>Labels to display for the string values. (read/write StringList)</para></listitem>
+	</varlistentry>
 	</variablelist></para></listitem>
 </varlistentry>
 
 <varlistentry>
-<term><dropdown></term>
+<term><valueslot></term>
+<listitem><para>Same as <varslot>, but the properties are lists of strings, instead of RObjects.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><radio></term>
 <listitem><para>Default property is "string"
 	<variablelist>
 	<varlistentry>
@@ -3199,8 +3235,18 @@
 </varlistentry>
 
 <varlistentry>
+<term><dropdown></term>
+<listitem><para>Same as <radio></para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term><select></term>
+<listitem><para>Same as <valueselector></para></listitem>
+</varlistentry>
+
+<varlistentry>
 <term><option></term>
-<listitem><para>No default property. "enabled" is the *only* property. It does not have the "visible" or "required" properties.
+<listitem><para>No default property. "enabled" is the *only* property, and it is not currenlty available for options inside a <select> or <valueselector>. <option> does not have the "visible" or "required" properties.
 	<variablelist>
 	<varlistentry>
 	<term>enabled</term>

Modified: trunk/rkward/rkward/plugin/rkvalueselector.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkvalueselector.cpp	2014-09-05 11:30:35 UTC (rev 4806)
+++ trunk/rkward/rkward/plugin/rkvalueselector.cpp	2014-09-06 14:40:32 UTC (rev 4807)
@@ -73,7 +73,7 @@
 			const QDomElement &child = options[i];
 			QString v = xml->getStringAttribute (child, "value", QString (), DL_WARNING);
 			QString l = xml->getStringAttribute (child, "label", v, DL_INFO);
-			if (xml->getBoolAttribute (child, "selected", false, DL_INFO)) selected_list.append (v);
+			if (xml->getBoolAttribute (child, "checked", false, DL_INFO)) selected_list.append (v);
 			labels_list.append (l);
 			values_list.append (v);
 		}
@@ -173,7 +173,7 @@
 QVariant RKValueSelector::value (const QString& modifier) {
 	RK_TRACE (PLUGIN);
 
-	if (modifier == "labelled") {
+	if (modifier == "labeled") {
 		QStringList selected_labels;
 		for (int i = 0; i < selected->listLength (); ++i) {
 			int index = available->values ().indexOf (selected->valueAt (i));

Modified: trunk/rkward/rkward/plugins/testing/valueselect1.js
===================================================================
--- trunk/rkward/rkward/plugins/testing/valueselect1.js	2014-09-05 11:30:35 UTC (rev 4806)
+++ trunk/rkward/rkward/plugins/testing/valueselect1.js	2014-09-06 14:40:32 UTC (rev 4807)
@@ -1,7 +1,7 @@
 function calculate () {
 	echo (getList ("select").join ("\n"));
 	echo ("\n\n");
-	echo (getList ("valueselect.labelled").join ("\n"));
+	echo (getList ("valueselect.labeled").join ("\n"));
 	echo ("\n\n");
 	echo (getList ("valueselect.selected").join ("\n"));
 	echo ("\n\n");

Modified: trunk/rkward/rkward/plugins/testing/valueselect1.xml
===================================================================
--- trunk/rkward/rkward/plugins/testing/valueselect1.xml	2014-09-05 11:30:35 UTC (rev 4806)
+++ trunk/rkward/rkward/plugins/testing/valueselect1.xml	2014-09-06 14:40:32 UTC (rev 4807)
@@ -10,9 +10,9 @@
 		<tabbook>
 			<tab label="<select>">
 				<select id="select">
-					<option value="test1" label="first" selected="true"/>
+					<option value="test1" label="first" checked="true"/>
 					<option value="test2" label="second"/>
-					<option value="test3" label="third" selected="true"/>
+					<option value="test3" label="third" checked="true"/>
 				</select>
 				<stretch/>
 			</tab>





More information about the rkward-tracker mailing list