public class NewsModel extends Object implements Runnable
NewsModel model = new NewsModel(endpoint); model.getNewsList().addListener(new ObservableListModelListener<NewsEvent>() { public void modelChanged(Change<? extends NewsEvent> change) { for (NewsEvent news : change.getSource()) System.out.println(news.getSourceId() + ": " + news.getTitle()); } }); model.setFilter(NewsFilter.newBuilder().withSources("Business Wire").withLimit(5).build()); model.setLive(true);
Listeners are invoked in the context of the corresponding RMIEndpoint
executor
and the corresponding notification
is guaranteed to never be concurrent, even though it may happen from different
threads if executor is multi-threaded.
Constructor and Description |
---|
NewsModel(com.devexperts.rmi.RMIEndpoint endpoint)
Creates model with the specified RMI endpoint.
|
Modifier and Type | Method and Description |
---|---|
NewsFilter |
getFilter()
Returns currently active news filter.
|
com.dxfeed.model.ObservableListModel<NewsEvent> |
getNewsList()
Returns an observable list of news which is updated on news updates.
|
boolean |
isLive()
Returns whether news model is "live", i.e.
|
void |
run() |
void |
setFilter(NewsFilter filter)
Sets news filter.
|
void |
setLive(boolean live)
Sets news model "live" status of the model.
|
public NewsModel(com.devexperts.rmi.RMIEndpoint endpoint)
endpoint
- RMI endpoint to connect topublic NewsFilter getFilter()
public void setFilter(NewsFilter filter)
filter
- news filter to usepublic boolean isLive()
public void setLive(boolean live)
live
- flag, indicating "live" status of the model.public com.dxfeed.model.ObservableListModel<NewsEvent> getNewsList()
Copyright © 2024 Devexperts. All rights reserved.