Class CollectionProperty<T,K>
java.lang.Object
com.codename1.properties.PropertyBase<T,K>
com.codename1.properties.CollectionProperty<T,K>
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
ListProperty, SetProperty
Base class for a property as a collection which can contain multiple elements within
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionProperty(String name) CollectionProperty(String name, Class genericType) -
Method Summary
Modifier and TypeMethodDescriptionabstract KAdds a property value to the collection and fires a change event if collection has changedabstract KaddAll(Collection<? extends T> v) Adds a collection of values to the collection and fires a change event if the collection has changedReturns a copy of the content as a new list but if the value is a PropertyBusinessObject it will be converted to a MapasList()Returns a copy of the content as a new listabstract voidclear()Remove all the elements from the collection and fires a change eventabstract booleanReturns true if the given element is contained in the collection propertyiterator()Iterate over the elements of the propertyabstract Kremove(int offset) Removes the given itemabstract KRemoves the given itemabstract KremoveAll(Collection<? extends T> v) Removes from this collection all of its elements that are contained in the specified collection and fires a change event if the collection has changedabstract Kset(Collection<T> t) Sets the entire content of the propertyabstract intsize()The size of the property collectionMethods inherited from class PropertyBase
addChangeListener, bindGlobalGetListener, bindGlobalSetListener, equals, firePropertyChanged, getClientProperty, getGenericType, getLabel, getName, hashCode, putClientProperty, removeChangeListener, setLabel, stopListening, toString, validateCollectionTypeModifier and TypeMethodDescriptionvoidFires a notification that a property value changed to the given listenerstatic voidbindGlobalGetListener(PropertyChangeListener listener) Binds an event callback for get calls and property readsstatic voidbindGlobalSetListener(PropertyChangeListener listener) Binds an event callback for set calls and property mutationbooleanCompares this property to another propertyprotected voidDelivers the property change event to listeners if applicablegetClientProperty(String key) Returns the client property set to this property nameReturns the generic type of this property if it is known or nullgetLabel()The label of the property defaults to its name but can be changed to anythinggetName()The property name is immutable and can't be changed after creation it should match the parent field name by conventioninthashCode()Returns a hash code value for the object.voidputClientProperty(String key, Object o) Places a property that will apply statically to all instances of this propertyvoidRemoves the property change listener from the list of listenersvoidThe label of the property defaults to its name but can be changed to anything, it can be used when binding a property to UI elementsvoidThis method will work when invoked from a propertyChanged callback and should be similar toremovePropertyChangeListener(this).toString()Default toString that provides easier debug informationprotected final voidvalidateCollectionType(Class elementType) Validates that the collection type is valid and throws an exception otherwiseMethods inherited from class Object
clone, getClass, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()final ClassgetClass()Returns the runtime class of an object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
Constructor Details
-
CollectionProperty
-
CollectionProperty
-
-
Method Details
-
size
public abstract int size()The size of the property collection
Returns
the number of elements
-
set
Sets the entire content of the property
Parameters
t: the collection of elements to set
Returns
the parent object for chaining
-
add
-
addAll
Adds a collection of values to the collection and fires a change event if the collection has changed
Parameters
v: the collection of values to add
-
remove
-
remove
Removes the given item
Parameters
offset: the index
-
removeAll
Removes from this collection all of its elements that are contained in the specified collection and fires a change event if the collection has changed
Parameters
v: the collection of values to remove
-
iterator
-
asList
-
asExplodedList
-
clear
public abstract void clear()Remove all the elements from the collection and fires a change event -
contains
Returns true if the given element is contained in the collection property
Parameters
element: the element
Returns
true if the given element is contained in the collection property
-