- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- javafx.collections.ObservableListBase<E>
-
- javafx.collections.ModifiableObservableListBase<E>
-
- com.gluonhq.connect.GluonObservableList<E>
-
- Type Parameters:
E
- the type of the elements inside this list
- All Implemented Interfaces:
GluonObservable
,Iterable<E>
,Collection<E>
,List<E>
,Observable
,ObservableList<E>
,EventTarget
- Direct Known Subclasses:
GluonObservableListImpl
,GluonObservableRemoteFunctionChunkedListImpl
,GluonObservableRemoteFunctionListImpl
public class GluonObservableList<E> extends ModifiableObservableListBase<E> implements GluonObservable, ObservableList<E>
A GluonObservableList is an ObservableList that is linked with a data source.
-
-
Property Summary
Properties Type Property Description ReadOnlyObjectProperty<Throwable>
exception
Holds the exception that was thrown when a synchronization operation failed.ReadOnlyBooleanProperty
initialized
A boolean property that is true when the observable has been initialized successfully after its initial retrieval.ReadOnlyObjectProperty<ConnectState>
state
Holds the current state of this observable.
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description GluonObservableList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventDispatchChain
buildEventDispatchChain(EventDispatchChain tail)
protected void
doAdd(int index, E element)
Adds theelement
to the List at the position ofindex
.protected E
doRemove(int index)
Removes the element at position ofindex
.protected E
doSet(int index, E element)
Sets theelement
in the List at the position ofindex
.ReadOnlyObjectProperty<Throwable>
exceptionProperty()
Holds the exception that was thrown when a synchronization operation failed.E
get(int index)
Returns the element at the specified position in this list.Throwable
getException()
Gets the value of the property exception.ConnectState
getState()
Gets the value of the property state.ReadOnlyBooleanProperty
initializedProperty()
A boolean property that is true when the observable has been initialized successfully after its initial retrieval.boolean
isInitialized()
Gets the value of the property initialized.void
setException(Throwable exception)
Sets the value of the property exception.void
setOnCancelled(EventHandler<ConnectStateEvent> value)
The onCancelled event handler is called whenever the GluonObservable state transitions to the CANCELLED state.void
setOnFailed(EventHandler<ConnectStateEvent> value)
The onFailed event handler is called whenever the GluonObservable state transitions to the FAILED state.void
setOnReady(EventHandler<ConnectStateEvent> value)
The onReady event handler is called whenever the GluonObservable state transitions to the READY state.void
setOnRemoved(EventHandler<ConnectStateEvent> value)
The onRemoved event handler is called whenever the GluonObservable state transitions to the REMOVED state.void
setOnRunning(EventHandler<ConnectStateEvent> value)
The onRunning event handler is called whenever the GluonObservable state transitions to the RUNNING state.void
setOnSucceeded(EventHandler<ConnectStateEvent> value)
The onSucceeded event handler is called whenever the GluonObservable state transitions to the SUCCEEDED state.void
setState(ConnectState state)
Sets the value of the property state.int
size()
Returns the number of elements in this list.ReadOnlyObjectProperty<ConnectState>
stateProperty()
Holds the current state of this observable.-
Methods inherited from class javafx.collections.ModifiableObservableListBase
add, addAll, addAll, remove, remove, removeAll, removeRange, retainAll, set, setAll, subList
-
Methods inherited from class javafx.collections.ObservableListBase
addAll, addListener, addListener, beginChange, endChange, fireChange, hasListeners, nextAdd, nextPermutation, nextRemove, nextRemove, nextReplace, nextSet, nextUpdate, remove, removeAll, removeListener, removeListener, retainAll, setAll
-
Methods inherited from class java.util.AbstractList
add, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator
-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
-
Methods inherited from interface javafx.beans.Observable
addListener, removeListener
-
Methods inherited from interface javafx.collections.ObservableList
addAll, addListener, filtered, remove, removeAll, removeListener, retainAll, setAll, setAll, sorted, sorted
-
-
-
-
Property Detail
-
initialized
public ReadOnlyBooleanProperty initializedProperty
- Specified by:
initializedProperty
in interfaceGluonObservable
- See Also:
isInitialized()
-
state
public ReadOnlyObjectProperty<ConnectState> stateProperty
- Specified by:
stateProperty
in interfaceGluonObservable
- See Also:
getState()
,setState(ConnectState)
-
exception
public ReadOnlyObjectProperty<Throwable> exceptionProperty
- Specified by:
exceptionProperty
in interfaceGluonObservable
- See Also:
getException()
,setException(Throwable)
-
-
Method Detail
-
isInitialized
public boolean isInitialized()
Gets the value of the property initialized.- Specified by:
isInitialized
in interfaceGluonObservable
- Property description:
- Returns:
- true when the observable is initialized; false otherwise.
-
initializedProperty
public ReadOnlyBooleanProperty initializedProperty()
Description copied from interface:GluonObservable
A boolean property that is true when the observable has been initialized successfully after its initial retrieval.- Specified by:
initializedProperty
in interfaceGluonObservable
- See Also:
isInitialized()
-
getState
public ConnectState getState()
Gets the value of the property state.- Specified by:
getState
in interfaceGluonObservable
- Property description:
- Returns:
- the current state
-
setState
public void setState(ConnectState state)
Sets the value of the property state.- Property description:
-
stateProperty
public ReadOnlyObjectProperty<ConnectState> stateProperty()
Description copied from interface:GluonObservable
Holds the current state of this observable. This property can be used to listen for changes in the synchronization process.- Specified by:
stateProperty
in interfaceGluonObservable
- See Also:
getState()
,setState(ConnectState)
-
getException
public Throwable getException()
Gets the value of the property exception.- Specified by:
getException
in interfaceGluonObservable
- Property description:
- Returns:
- the exception, if one has occurred; otherwise null.
-
setException
public void setException(Throwable exception)
Sets the value of the property exception.- Property description:
-
exceptionProperty
public ReadOnlyObjectProperty<Throwable> exceptionProperty()
Description copied from interface:GluonObservable
Holds the exception that was thrown when a synchronization operation failed.- Specified by:
exceptionProperty
in interfaceGluonObservable
- See Also:
getException()
,setException(Throwable)
-
setOnReady
public void setOnReady(EventHandler<ConnectStateEvent> value)
Description copied from interface:GluonObservable
The onReady event handler is called whenever the GluonObservable state transitions to the READY state.- Specified by:
setOnReady
in interfaceGluonObservable
- Parameters:
value
- the event handler, can be null to clear it
-
setOnRunning
public void setOnRunning(EventHandler<ConnectStateEvent> value)
Description copied from interface:GluonObservable
The onRunning event handler is called whenever the GluonObservable state transitions to the RUNNING state.- Specified by:
setOnRunning
in interfaceGluonObservable
- Parameters:
value
- the event handler, can be null to clear it
-
setOnFailed
public void setOnFailed(EventHandler<ConnectStateEvent> value)
Description copied from interface:GluonObservable
The onFailed event handler is called whenever the GluonObservable state transitions to the FAILED state.- Specified by:
setOnFailed
in interfaceGluonObservable
- Parameters:
value
- the event handler, can be null to clear it
-
setOnSucceeded
public void setOnSucceeded(EventHandler<ConnectStateEvent> value)
Description copied from interface:GluonObservable
The onSucceeded event handler is called whenever the GluonObservable state transitions to the SUCCEEDED state.- Specified by:
setOnSucceeded
in interfaceGluonObservable
- Parameters:
value
- the event handler, can be null to clear it
-
setOnCancelled
public void setOnCancelled(EventHandler<ConnectStateEvent> value)
Description copied from interface:GluonObservable
The onCancelled event handler is called whenever the GluonObservable state transitions to the CANCELLED state.- Specified by:
setOnCancelled
in interfaceGluonObservable
- Parameters:
value
- the event handler, can be null to clear it
-
setOnRemoved
public void setOnRemoved(EventHandler<ConnectStateEvent> value)
Description copied from interface:GluonObservable
The onRemoved event handler is called whenever the GluonObservable state transitions to the REMOVED state.- Specified by:
setOnRemoved
in interfaceGluonObservable
- Parameters:
value
- the event handler, can be null to clear it
-
get
public E get(int index)
Returns the element at the specified position in this list.
-
size
public int size()
Returns the number of elements in this list.- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classModifiableObservableListBase<E>
- Returns:
- the number of elements in this list
-
doAdd
protected void doAdd(int index, E element)
Adds theelement
to the List at the position ofindex
.For the description of possible exceptions, please refer to the documentation of
AbstractList.add(java.lang.Object)
method.- Specified by:
doAdd
in classModifiableObservableListBase<E>
- Parameters:
index
- the position where to add the elementelement
- the element that will be added- Throws:
ClassCastException
- if the type of the specified element is incompatible with this listNullPointerException
- if the specified arguments contain one or more null elementsIllegalArgumentException
- if some property of this element prevents it from being added to this listIndexOutOfBoundsException
- if the index is out of range(index < 0 || index > size())
-
doSet
protected E doSet(int index, E element)
Sets theelement
in the List at the position ofindex
.For the description of possible exceptions, please refer to the documentation of
ModifiableObservableListBase.set(int, java.lang.Object)
method.- Specified by:
doSet
in classModifiableObservableListBase<E>
- Parameters:
index
- the position where to set the elementelement
- the element that will be set at the specified position- Returns:
- the old element at the specified position
- Throws:
ClassCastException
- if the type of the specified element is incompatible with this listNullPointerException
- if the specified arguments contain one or more null elementsIllegalArgumentException
- if some property of this element prevents it from being added to this listIndexOutOfBoundsException
- if the index is out of range(index < 0 || index >= size())
-
doRemove
protected E doRemove(int index)
Removes the element at position ofindex
.- Specified by:
doRemove
in classModifiableObservableListBase<E>
- Parameters:
index
- the index of the removed element- Returns:
- the removed element
- Throws:
IndexOutOfBoundsException
- if the index is out of range(index < 0 || index >= size())
-
buildEventDispatchChain
public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
- Specified by:
buildEventDispatchChain
in interfaceEventTarget
-
-