/** * Sets the index to the passed argument for selection * * @param index the index to be selected */ @SimpleProperty( description = "Specifies the position of the selected item in the ListView. " + "This could be used to retrieve" + "the text at the chosen position. If an attempt is made to set this to a " + "number less than 1 or greater than the number of items in the ListView, SelectionIndex " + "will be set to 0, and Selection will be set to the empty text.", category = PropertyCategory.BEHAVIOR) public void SelectionIndex(int index) { selectionIndex = ElementsUtil.selectionIndex(index, items); // Now, we need to change Selection to correspond to SelectionIndex. selection = ElementsUtil.setSelectionFromIndex(index, items); }
/** Selection property setter method. */ @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "") @SimpleProperty public void Selection(String value) { selection = value; // Now, we need to change SelectionIndex to correspond to Selection. selectionIndex = ElementsUtil.setSelectedIndexFromValue(value, items); }
/** * Set a list of text elements to build a ListView * * @param itemsList a YailList containing the strings to be added to the ListView */ @SimpleProperty( description = "List of text elements to show in the ListView. This will" + "signal an error if the elements are not text strings.", category = PropertyCategory.BEHAVIOR) public void Elements(YailList itemsList) { items = ElementsUtil.elements(itemsList, "Listview"); setAdapterData(); }
/** * Specifies the text elements of the ListView. * * @param itemstring a string containing a comma-separated list of the strings to be picked from */ @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_STRING, defaultValue = "") @SimpleProperty( description = "The TextView elements specified as a string with the " + "items separated by commas " + "such as: Cheese,Fruit,Bacon,Radish. Each word before the comma will be an element in the " + "list.", category = PropertyCategory.BEHAVIOR) public void ElementsFromString(String itemstring) { items = ElementsUtil.elementsFromString(itemstring); setAdapterData(); }