|
|
 |
Exposed methods are for those who know how to use exposed methods - this
page simply documents and does not aim to train.
The methods listed below are declared as public and therefore accessible.
Every menu item has a look, style, level, action and comment.
All of these can be queried and edited, except the level (hierarchical
position) which can only be queried.
The integer n is a zero-based index reference to the position
of a menu item in the index. The string id is an alternative
method of referencing a menu item using an ID embedded in the menu item.
To embed an ID, write (for example) "TEXT=my menu item;ID=abc" into the index file.
The strings look, actions and comment should be
formatted in the way described here. Methods are
also available for querying the correspondence between integer and ID
references to a menu item. Familiarity with the formatting of the menus
is recommended before attempting to use these methods.
- void load (String indexsource)
- void insert (String item, int n)
- String cut (int n)
- String copy (int n)
- int length ()
- int hasChildren (int n)
- int isChecked (int n)
- void check (int n, int state)
- String getLook (int n)
- String getActions (int n)
- int getStyle (int n)
- int getLevel (int n)
- String getComment (int n)
- void setLook (int n, String look)
- void setActions (int n, String actions)
- void setStyle (int n, int style)
- void setComment (int n, String comment)
- String getID (int n)
- String getLookByID (String id)
- String getActionsByID (String id)
- int getStyleByID (String id)
- int getLevelByID (String id)
- String getCommentByID (String id)
- void setLookByID (String id, String look)
- void setActionsByID (String id, String actions)
- void setStyleByID (String id, int style)
- void setCommentByID (String id, String comment)
- int getRef (String id)
void load(String indexsource)
| | Purpose: loads new content into the menu without reloading the containing page; new content can be taken from any user-specified server-side static or dynamic source, including indirect derivation from a database, or from a preloaded client-side source; zip compression also available. | | Parameters: indexsource: a string with the format specified here | | Returns: - | | Since: 1.20 |
|
| void insert(String item, int n)
| | Purpose: inserts a new menu item at position n in the menu; the item at position n and all items following are pushed up one; if you wish to add an item onto the end of the menu, look up the length of the menu using the length() method and use this value for n; care should be taken with the level specified when using this method - if you specify an inappropriate hierarchical level for the new item, you could significantly disturb the structure of the menu. | | Parameters: item = a |-separated string containing the 5 XIXL-formatted items for creating a menu entry; the 5 items are, in order: look, level, style, actions, comment. (If you are unsure about the format, use the copy() method on an existing menu and it will show you an example).n = zero-based numerical reference to a menu item; if using ID's to identify menu items, use the getRef() method to obtain the numerical reference from the ID. | | Returns: - | | Since: 1.20 |
|
| String cut(int n)
| | Purpose: looks up and extracts the entire raw data for a particular menu item, removing the menu item at the same time; the format in which the menu item is returned is the same as the format used to insert a new menu item using the insert() method; differs from copy() in that it actually cuts out a menu item; cannot be used on folder or parent items (i.e. items which have children or submenus attached) - a harmless error string will be returned if you do this; you cannot damage the menu itself. | | Parameters: n = zero-based numerical reference to a menu item; if using ID's to identify menu items, use the getRef() method to obtain the numerical reference from the ID. | | Returns: a |-separated string containing the 5 XIXL-formatted items for creating a menu entry; the 5 items are, in order: look, level, style, actions, comment. | | Since: 1.20 |
|
| String copy(int n)
| | Purpose: looks up and copies the entire raw data for a particular menu item; the format in which the menu item is returned is the same as the format used to insert a new menu item using the insert() method; differs from cut() in that it does not change the existing menu in any way. | | Parameters: n = zero-based numerical reference to a menu item; if using ID's to identify menu items, use the getRef() method to obtain the numerical reference from the ID. | | Returns: a |-separated string containing the 5 XIXL-formatted items for creating a menu entry; the 5 items are, in order: look, level, style, actions, comment. | | Since: 1.20 |
|
| int length()
| | Purpose: gives the current actual size of the menu; can be useful, for example, if extracting the complete state of the menu - first get the length, then loop through the entire length using the copy() function to extract each line. | | Parameters: - | | Returns: an integer | | Since: 1.20 |
|
| int hasChildren(int n)
| | Purpose: looks up whether a particular menu item is a parent or folder item, or merely a page; can be useful, for example, when cutting items out of a menu, as cutting is impossible when an item has children. | | Parameters: n = zero-based numerical reference to a menu item; if using ID's to identify menu items, use the getRef() method to obtain the numerical reference from the ID. | | Returns: 0 or 1, where 1 indicates that the item has children, and 0 that it does not. | | Since: 1.20 |
|
| int isChecked(int n)
| | Purpose: looks up whether a particular menu item is checked or not. | | Parameters: n = zero-based numerical reference to a menu item; if using ID's to identify menu items, use the getRef() method to obtain the numerical reference from the ID. | | Returns: -1 = error or not a checkbox menu item.0 = not checked.1 = checked. | | Since: 1.30 |
|
| void check(int n, int state)
| | Purpose: if an item is a checkbox menu item, this method can be used to set the state of the checkbox. | | Parameters: n = zero-based numerical reference to a menu item; if using ID's to identify menu items, use the getRef() method to obtain the numerical reference from the ID.state = 0 or 1; 0 for unchecking, 1 for checking. | | Returns: - | | Since: 1.30 |
|
|
| | |