/** * Adds a new row in the view for the given symbol (if one does not already exist). * * @param symbol symbol to add to view */ public void addSymbol(final Equity symbol) { if (mItemMap.containsKey(symbol)) { PhotonPlugin.getMainConsoleLogger().warn(DUPLICATE_SYMBOL.getText(symbol)); } else { busyRun( new Runnable() { @Override public void run() { MarketDataViewItem item = new MarketDataViewItem(mMarketDataManager.getMarketData(), symbol); mItemMap.put(symbol, item); mItems.add(item); } }); } }
@Override protected void setValue(Object element, Object value) { if (StringUtils.isBlank(value.toString())) return; final MarketDataViewItem item = (MarketDataViewItem) element; final Equity equity = item.getEquity(); if (equity.getSymbol().equals(value)) return; final Equity newEquity = new Equity(value.toString()); if (mItemMap.containsKey(newEquity)) { PhotonPlugin.getMainConsoleLogger().warn(DUPLICATE_SYMBOL.getText(newEquity.getSymbol())); return; } busyRun( new Runnable() { @Override public void run() { mItemMap.remove(equity); item.setEquity(newEquity); mItemMap.put(newEquity, item); } }); }