[yast-commit] r56516 - in /trunk/yast2/library/cwm/doc: cwm.xml cwm_table.xml
Author: jreidinger
Date: Tue Mar 31 19:27:09 2009
New Revision: 56516
URL: http://svn.opensuse.org/viewcvs/yast?rev=56516&view=rev
Log:
add documentation to cwm table
Added:
trunk/yast2/library/cwm/doc/cwm_table.xml
Modified:
trunk/yast2/library/cwm/doc/cwm.xml
Modified: trunk/yast2/library/cwm/doc/cwm.xml
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/cwm/doc/cwm.xml?rev=56516&r1=56515&r2=56516&view=diff
==============================================================================
--- trunk/yast2/library/cwm/doc/cwm.xml (original)
+++ trunk/yast2/library/cwm/doc/cwm.xml Tue Mar 31 19:27:09 2009
@@ -8,6 +8,7 @@
<!ENTITY concept SYSTEM "concept.xml">
<!ENTITY advanced SYSTEM "advanced.xml">
<!ENTITY widgets SYSTEM "widgets.xml">
+<!ENTITY cwm_table SYSTEM "cwm_table.xml">
<!ENTITY table_popup SYSTEM "table_popup.xml">
<!ENTITY dialog_tree SYSTEM "dialog_tree.xml">
<!ENTITY cwm_tab SYSTEM "cwm_tab.xml">
@@ -16,7 +17,7 @@
<!ENTITY terminology SYSTEM "terminology.xml">
<!ENTITY tutor SYSTEM "tutor.xml">
-<!ENTITY date "June 2003">
+<!ENTITY date "March 2009">
]>
<book id="cwm">
@@ -85,6 +86,7 @@
&concept;
&advanced;
&widgets;
+&cwm_table;
&table_popup;
&dialog_tree;
&cwm_tab;
Added: trunk/yast2/library/cwm/doc/cwm_table.xml
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/cwm/doc/cwm_table.xml?rev=56516&view=auto
==============================================================================
--- trunk/yast2/library/cwm/doc/cwm_table.xml (added)
+++ trunk/yast2/library/cwm/doc/cwm_table.xml Tue Mar 31 19:27:09 2009
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml-stylesheet href="/usr/share/xml/docbook/stylesheet/css/current/driver.css" type="text/css"?>
+<chapter id="cwr_table">
+ <title>CWM Table concept</title>
+
+ <para> Table widget and manupulation with data in this widget need same
+ behavior across whole YaST. </para>
+
+ <para> The CWM Table widget exists in order to make development of modules
+ using this UI concept consistent. It contains few most used buttons and few
+ automatic manipulation features. </para>
+
+ <para>
+ The CWM Table widget allows Add/delete buttons, Edit button,
+ Up/down reorder buttons and custom button, which developer set to what they need.
+ Automatic edit action after double-click on table collumn. After reorder is still
+ selected same item, even if is moved. Reordering handlers is called only if cell really
+ can move in choosed direction. Whole table Enable/Disable and automatic enable/disable
+ reordering button on collums which doesn't allow move in that direction.
+ </para>
+
+
+ <section>
+ <title>Simple example for CWM Table</title>
+
+ <para> This example show basic features of CWM table and also basic how
+ to use. </para>
+
+ <example id="tw_basic">
+ <title>Usage of the CWM Table widget - basic case</title>
+
+ <screen>
+{
+ import "CWM";
+ import "CWMTable";
+ import "Popup";
+ import "Wizard";
+
+ list<string> items = [];
+ integer counter =0;
+
+ void redraw_table(list<string> values){
+ list<term> table_items = maplist(string s, values, {
+ return `item(`id(s),s);
+ });
+ UI::ChangeWidget(`id(`_tw_table),`Items, table_items);
+ }
+
+ symbol add_handle(string key, map event){
+ counter = counter +1;
+ items = add(items,sformat("item %1",counter));
+ redraw_table(items);
+ return nil;
+ }
+
+ symbol edit_handle(string key, map event){
+ Popup::Warning("edit");
+ return nil;
+ }
+
+ symbol delete_handle(string key, map event){
+ Popup::Warning("delete");
+ return nil;
+ }
+
+ symbol updown_handle(string key, map event, boolean up, integer index){
+ integer second = up ? (index-1):(index+1);
+ y2milestone("updown with up %1 and index %2 and second %3",up,index,second);
+ string value = items[second]:"";
+ items[second] = items[index]:"";
+ items[index] = value;
+ redraw_table(items);
+ return nil;
+ }
+
+ symbol custom_handle(string key, map event){
+ Popup::Warning("Custom button");
+ return nil;
+ }
+
+ map<string,any> table = CWMTable::CreateTableDescr(
+ $[
+ "add_delete_buttons" : true,
+ "edit_button" : true,
+ "up_down_buttons" : true,
+ "custom_button" : true,
+ "custom_button_name" : "Additional button",
+ "custom_handle" : custom_handle,
+ "header" : `header("id"),
+ "edit":edit_handle,
+ "delete":delete_handle,
+ "add" : add_handle,
+ "updown" : updown_handle,
+ ],
+ $[
+ "help" : "",
+ ]
+ );
+
+ Wizard::CreateDialog();
+ symbol ret = CWM::ShowAndRun($[
+ "widget_names" : ["table"],
+ "widget_descr" : $[ "table" : table],
+ "contents" : `VBox("table"),
+ "caption" : "test"
+ ]);
+}
+
+ </screen>
+ </example>
+
+ <section id="create_cwr_table">
+ <title>Creating the table container </title>
+
+ <para> For getting the initial map the function map<string,any>
+ CWMTable::CreateTableDescr () can be used. It takes as a parameters a map
+ specifying the attributes of the table and a map specifying additional
+ settings that will be merged to the description map (see below).
+ Currently supported attributes are: <itemizedlist>
+ <listitem id="add_delete_buttons">
+ <para> "add_delete_buttons" : boolean - if the Add and Delete
+ buttons are wanted, set to true. If false, they will not be shown.
+ Default (if key not present) is true. </para>
+ </listitem>
+
+ <listitem id="edit_button">
+ <para> "edit_button" : boolean - if the Edit button is wanted, set
+ to true. If false, it will not be shown. Default (if key not
+ present) is true. </para>
+ </listitem>
+
+ <listitem id="up_down_buttons">
+ <para> "up_down_buttons" : boolean - if the Up and Down (reorder)
+ buttons are wanted, set to true. Otherwise, they will not be
+ shown. Default (if not present) is false. </para>
+ </listitem>
+
+ <listitem id="custom_button">
+ <para> "custom_button" : boolean - if the Custom button
+ are wanted, set to true. Otherwise, they will not be shown.
+ Default (if not present) is false. </para>
+ </listitem>
+
+ <listitem id="custom_button_name">
+ <para> "custom_button_name" : string - label for the Custom button.
+ Default (if not present) is "Custom button". </para>
+ </listitem>
+
+ <listitem id="custom_handle">
+ <para> "custom_handle" : symbol(string,map) - handler for the Custom button.
+ Default (if not present) is empty handler (do nothing). </para>
+ </listitem>
+
+ <listitem id="add">
+ <para> "add" : symbol(string,map) - handler for the Add button.
+ Default (if not present) is empty handler (do nothing). </para>
+ </listitem>
+
+ <listitem id="delete">
+ <para> "delete" : symbol(string,map) - handler for the Delete button.
+ Default (if not present) is empty handler (do nothing). </para>
+ </listitem>
+
+ <listitem id="edit">
+ <para> "edit" : symbol(string,map) - handler for the Edit button.
+ Default (if not present) is empty handler (do nothing). </para>
+ </listitem>
+
+ <listitem id="updown">
+ <para> "updown" : symbol(string,map, boolean, integer) - handler for the Updown button.
+ Extra parameters is boolean if button is Up button and index of selected table collumn.
+ Default (if not present) is empty handler (do nothing). </para>
+ </listitem>
+
+ <listitem id="header">
+ <para> "header" : term - header term for table. It is mandatory key for CWM Table.
+ Default (if not present) is nil and fail of widget. </para>
+ </listitem>
+ </itemizedlist> </para>
+
+ <para> For id of the widgets related to the table see
participants (1)
-
jreidinger@svn.opensuse.org