use of name.abuchen.portfolio.online.QuoteFeed in project portfolio by buchen.
the class AbstractQuoteProviderPage method onFeedProviderChanged.
private void onFeedProviderChanged(SelectionChangedEvent event) {
String previousExchangeId = null;
if (comboExchange != null) {
Exchange exchange = (Exchange) ((IStructuredSelection) comboExchange.getSelection()).getFirstElement();
if (exchange != null)
previousExchangeId = exchange.getId();
}
if (previousExchangeId == null && model.getTickerSymbol() != null) {
previousExchangeId = model.getTickerSymbol();
}
QuoteFeed feed = (QuoteFeed) ((IStructuredSelection) event.getSelection()).getFirstElement();
createDetailDataWidgets(feed);
if (comboExchange != null) {
List<Exchange> exchanges = cacheExchanges.get(feed);
comboExchange.setInput(exchanges);
// select exchange if other provider supports same exchange id
// (yahoo close vs. yahoo adjusted close)
boolean exchangeSelected = false;
if (exchanges != null && previousExchangeId != null) {
for (Exchange e : exchanges) {
if (e.getId().equals(previousExchangeId)) {
comboExchange.setSelection(new StructuredSelection(e));
exchangeSelected = true;
break;
}
}
}
if (!exchangeSelected)
comboExchange.setSelection(null);
setStatus(exchangeSelected ? null : MessageFormat.format(Messages.MsgErrorExchangeMissing, getTitle()));
} else if (textFeedURL != null) {
boolean hasURL = getFeedURL() != null && getFeedURL().length() > 0;
if (hasURL)
textFeedURL.setText(getFeedURL());
setStatus(hasURL ? null : MessageFormat.format(Messages.EditWizardQuoteFeedMsgErrorMissingURL, getTitle()));
} else {
// get sample quotes?
if (feed != null) {
showSampleQuotes(feed, null);
} else {
clearSampleQuotes();
}
setStatus(null);
}
}
use of name.abuchen.portfolio.online.QuoteFeed in project portfolio by buchen.
the class AbstractQuoteProviderPage method beforePage.
@Override
public void beforePage() {
if (!Objects.equals(tickerSymbol, model.getTickerSymbol())) {
this.tickerSymbol = model.getTickerSymbol();
// clear caches
cacheExchanges = new HashMap<>();
reinitCaches();
new LoadExchangesJob().schedule();
QuoteFeed feed = (QuoteFeed) ((IStructuredSelection) comboProvider.getSelection()).getFirstElement();
if (feed.getId() != null && feed.getId().indexOf(HTML) >= 0) {
if (getFeedURL() == null || getFeedURL().length() == 0)
clearSampleQuotes();
else
showSampleQuotes(feed, null);
}
}
}
use of name.abuchen.portfolio.online.QuoteFeed in project portfolio by buchen.
the class LatestQuoteProviderPage method getAvailableFeeds.
@Override
protected List<QuoteFeed> getAvailableFeeds() {
List<QuoteFeed> feeds = new ArrayList<>();
feeds.add(EMTPY_QUOTE_FEED);
for (QuoteFeed feed : Factory.getQuoteFeedProvider()) {
// adjusted close are only relevant for historical quotes)
if (// $NON-NLS-1$
feed.getId().equals("YAHOO-ADJUSTEDCLOSE"))
continue;
feeds.add(feed);
}
return feeds;
}
Aggregations