public static String getFullNumberPattern(final CommodityNode node) { DecimalFormat format = (DecimalFormat) getFullNumberFormat(node); String pattern = format.toPattern(); if (pattern.charAt(0) == '\u00A4') { String prefix = node.getPrefix(); // escape any special characters for (String escapeChar : ESCAPE_CHARS) { if (prefix.contains(escapeChar)) { prefix = prefix.replace(escapeChar, "'" + escapeChar + "'"); } } return pattern.replace("\u00A4", prefix); } String suffix = node.getSuffix(); // escape any special characters for (String escapeChar : ESCAPE_CHARS) { if (suffix.contains(escapeChar)) { suffix = suffix.replace(escapeChar, "'" + escapeChar + "'"); } } return pattern.replace("\u00A4", suffix); }
@Override public void messagePosted(final Message event) { final Account a = event.getObject(MessageProperty.ACCOUNT); if (account.equals(a)) { final SecurityNode node = event.getObject(MessageProperty.COMMODITY); EventQueue.invokeLater( () -> { switch (event.getEvent()) { case ACCOUNT_REMOVE: MessageBus.getInstance() .unregisterListener( AccountSecurityComboBox.this, MessageChannel.ACCOUNT, MessageChannel.COMMODITY); model.removeAllElements(); account = null; break; case ACCOUNT_SECURITY_ADD: model.addElement(node); break; case SECURITY_REMOVE: case ACCOUNT_SECURITY_REMOVE: final CommodityNode commodityNode = getSelectedNode(); model.removeElement(node); if (commodityNode != null && node != null) { if (commodityNode.equals(node)) { setSelectedItem(null); } } break; case SECURITY_MODIFY: updateNode(node); break; default: } }); } }
public static String getConversion(final CommodityNode cur1, final CommodityNode cur2) { return getConversion(cur1.getSymbol(), cur2.getSymbol()); }