diff --git a/src/main/java/net/nikr/eve/jeveasset/data/api/my/MyMarketOrder.java b/src/main/java/net/nikr/eve/jeveasset/data/api/my/MyMarketOrder.java index b09c37399..89951c12a 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/api/my/MyMarketOrder.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/api/my/MyMarketOrder.java @@ -60,6 +60,7 @@ public class MyMarketOrder extends RawMarketOrder implements Comparable 0; } + public boolean isOutbidOwned() { + return outbidOwned; + } + + public void setOutbidOwned(boolean outbidOwned) { + this.outbidOwned = outbidOwned; + } + public boolean haveOutbid() { return outbid != null; } diff --git a/src/main/java/net/nikr/eve/jeveasset/data/profile/ProfileData.java b/src/main/java/net/nikr/eve/jeveasset/data/profile/ProfileData.java index 150196726..6357e69bc 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/profile/ProfileData.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/profile/ProfileData.java @@ -22,6 +22,7 @@ import ca.odell.glazedlists.EventList; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -334,6 +335,7 @@ public void updateMarketOrders(OutbidProcesserOutput output) { } } } + updateOutbidOwned(marketOrdersList); AddedData.getMarketOrders().commitQueue(); Program.ensureEDT(new Runnable() { @Override @@ -601,6 +603,7 @@ public synchronized void updateEventLists(Date addedDate) { order.setChanged(AddedData.getMarketOrders().getAdd(marketOrdersAdded, order.getOrderID(), changed)); } } + updateOutbidOwned(marketOrders); AddedData.getMarketOrders().commitQueue(); //Update IndustryJobs dynamic values for (MyIndustryJob industryJob : industryJobs) { @@ -942,6 +945,41 @@ public static void updatePrices(EventLi updateList(eventList, found); } + private void updateOutbidOwned(Collection marketOrders) { + Map> lowestBuy = new HashMap<>(); + Map> lowestSell = new HashMap<>(); + for (MyMarketOrder order : marketOrders) { //Find lowest + if (order.isActive() && order.haveOutbid() && !order.isOutbid()) { //Lowest + Map> lowest; + if (order.isBuyOrder()) { + lowest = lowestBuy; + } else { + lowest = lowestSell; + } + Set orderIDs = lowest.get(order.getTypeID()); + if (orderIDs == null) { + orderIDs = new HashSet<>(); + lowest.put(order.getTypeID(), orderIDs); + } + orderIDs.add(order.getOrderID()); + } + } + for (MyMarketOrder order : marketOrders) { //Set owned + if (!order.isActive()) { + order.setOutbidOwned(false); + continue; + } + Map> lowest; + if (order.isBuyOrder()) { + lowest = lowestBuy; + } else { + lowest = lowestSell; + } + Set orderIDs = lowest.get(order.getTypeID()); + order.setOutbidOwned(orderIDs != null && !orderIDs.contains(order.getOrderID())); //Not null and not one of the lowest orders + } + } + private void updateIndustryJobPrices(EventList eventList, Set typeIDs) { if (typeIDs == null || typeIDs.isEmpty()) { return; diff --git a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorEntry.java b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorEntry.java index 8080ad87d..3bcad21d8 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorEntry.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorEntry.java @@ -47,6 +47,7 @@ public enum ColorEntry { STOCKPILE_TABLE_OVER_THRESHOLD(ColorEntryGroup.STOCKPILE, DataColors.get().stockpileTableOverThreshold()), STOCKPILE_ICON_OVER_THRESHOLD(ColorEntryGroup.STOCKPILE, DataColors.get().stockpileIconOverThreshold(), Background.EDITABLE_AND_NOT_NULL, Foreground.NOT_EDITABLE), MARKET_ORDERS_OUTBID_NOT_BEST(ColorEntryGroup.MARKET_ORDERS, DataColors.get().marketOrdersOutbidNotBest()), + MARKET_ORDERS_OUTBID_NOT_BEST_OWNED(ColorEntryGroup.MARKET_ORDERS, DataColors.get().marketOrdersOutbidNotBestOwned()), MARKET_ORDERS_OUTBID_BEST(ColorEntryGroup.MARKET_ORDERS, DataColors.get().marketOrdersOutbidBest()), MARKET_ORDERS_OUTBID_UNKNOWN(ColorEntryGroup.MARKET_ORDERS, DataColors.get().marketOrdersOutbidUnknown()), MARKET_ORDERS_EXPIRED(ColorEntryGroup.MARKET_ORDERS, DataColors.get().marketOrdersExpired()), diff --git a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeColorblind.java b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeColorblind.java index 049c902b2..df0874826 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeColorblind.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeColorblind.java @@ -62,6 +62,7 @@ protected void createColors(Map colors) { colors.put(ColorEntry.STOCKPILE_TABLE_OVER_THRESHOLD, new ColorThemeEntry(Colors.COLORBLIND_YELLOW)); colors.put(ColorEntry.STOCKPILE_ICON_OVER_THRESHOLD, new ColorThemeEntry(Colors.COLORBLIND_YELLOW)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST, new ColorThemeEntry(Colors.COLORBLIND_MAGENTA)); + colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST_OWNED, new ColorThemeEntry(Colors.COLORBLIND_ORANGE)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_BEST, new ColorThemeEntry(Colors.COLORBLIND_YELLOW)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_UNKNOWN, new ColorThemeEntry(Colors.COLORBLIND_GRAY)); colors.put(ColorEntry.MARKET_ORDERS_EXPIRED, new ColorThemeEntry(Colors.COLORBLIND_MAGENTA)); diff --git a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDark.java b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDark.java index a04063718..d7b8974df 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDark.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDark.java @@ -62,6 +62,7 @@ protected void createColors(Map colors) { colors.put(ColorEntry.STOCKPILE_TABLE_OVER_THRESHOLD, new ColorThemeEntry(Colors.DARK_GREEN)); colors.put(ColorEntry.STOCKPILE_ICON_OVER_THRESHOLD, new ColorThemeEntry(Colors.LIGHT_GREEN)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST, new ColorThemeEntry(Colors.DARK_RED)); + colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST_OWNED, new ColorThemeEntry(Colors.DARK_ORANGE)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_BEST, new ColorThemeEntry(Colors.DARK_GREEN)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_UNKNOWN, new ColorThemeEntry(Colors.DARK_GRAY)); colors.put(ColorEntry.MARKET_ORDERS_EXPIRED, new ColorThemeEntry(Colors.DARK_RED)); diff --git a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDefault.java b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDefault.java index 65ad2343f..593981fa7 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDefault.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeDefault.java @@ -62,6 +62,7 @@ protected void createColors(Map colors) { colors.put(ColorEntry.STOCKPILE_TABLE_OVER_THRESHOLD, new ColorThemeEntry(Colors.LIGHT_GREEN)); colors.put(ColorEntry.STOCKPILE_ICON_OVER_THRESHOLD, new ColorThemeEntry(Colors.LIGHT_GREEN)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST, new ColorThemeEntry(Colors.LIGHT_RED)); + colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST_OWNED, new ColorThemeEntry(Colors.LIGHT_ORANGE)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_BEST, new ColorThemeEntry(Colors.LIGHT_GREEN)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_UNKNOWN, new ColorThemeEntry(Colors.LIGHT_GRAY)); colors.put(ColorEntry.MARKET_ORDERS_EXPIRED, new ColorThemeEntry(Colors.LIGHT_RED)); diff --git a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeStrong.java b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeStrong.java index 7a9bbe8f7..63ea13e6e 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeStrong.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/settings/ColorThemeStrong.java @@ -62,6 +62,7 @@ protected void createColors(Map colors) { colors.put(ColorEntry.STOCKPILE_TABLE_OVER_THRESHOLD, new ColorThemeEntry(Colors.STRONG_GREEN)); colors.put(ColorEntry.STOCKPILE_ICON_OVER_THRESHOLD, new ColorThemeEntry(Colors.STRONG_GREEN)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST, new ColorThemeEntry(Colors.STRONG_RED)); + colors.put(ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST_OWNED, new ColorThemeEntry(Colors.STRONG_ORANGE)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_BEST, new ColorThemeEntry(Colors.STRONG_GREEN)); colors.put(ColorEntry.MARKET_ORDERS_OUTBID_UNKNOWN, new ColorThemeEntry(Colors.STRONG_GRAY)); colors.put(ColorEntry.MARKET_ORDERS_EXPIRED, new ColorThemeEntry(Colors.STRONG_RED)); diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/JMarketOrdersTable.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/JMarketOrdersTable.java index 349c1dc32..4d4585c5b 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/JMarketOrdersTable.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/JMarketOrdersTable.java @@ -58,7 +58,11 @@ public Component prepareRenderer(final TableCellRenderer renderer, final int row if (columnName.equals(MarketTableFormat.OUTBID_PRICE.getColumnName())) { if (marketOrder.haveOutbid()) { if (marketOrder.isOutbid()) { - ColorSettings.configCell(component, ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST, isSelected); + if (marketOrder.isOutbidOwned()) { + ColorSettings.configCell(component, ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST_OWNED, isSelected); + } else { + ColorSettings.configCell(component, ColorEntry.MARKET_ORDERS_OUTBID_NOT_BEST, isSelected); + } } else { ColorSettings.configCell(component, ColorEntry.MARKET_ORDERS_OUTBID_BEST, isSelected); } diff --git a/src/main/java/net/nikr/eve/jeveasset/i18n/DataColors.java b/src/main/java/net/nikr/eve/jeveasset/i18n/DataColors.java index 8e91c7851..d4f3ffbbd 100644 --- a/src/main/java/net/nikr/eve/jeveasset/i18n/DataColors.java +++ b/src/main/java/net/nikr/eve/jeveasset/i18n/DataColors.java @@ -57,6 +57,7 @@ public DataColors(final Locale locale) { public abstract String stockpileTableOverThreshold(); public abstract String stockpileIconOverThreshold(); public abstract String marketOrdersOutbidNotBest(); + public abstract String marketOrdersOutbidNotBestOwned(); public abstract String marketOrdersOutbidBest(); public abstract String marketOrdersOutbidUnknown(); public abstract String marketOrdersExpired(); diff --git a/src/main/resources/net/nikr/eve/jeveasset/i18n/DataColors.properties b/src/main/resources/net/nikr/eve/jeveasset/i18n/DataColors.properties index 17368ab88..54f17f1fc 100644 --- a/src/main/resources/net/nikr/eve/jeveasset/i18n/DataColors.properties +++ b/src/main/resources/net/nikr/eve/jeveasset/i18n/DataColors.properties @@ -27,6 +27,7 @@ stockpileTableOverThreshold=Over Threshold: Table stockpileIconOverThreshold=Over Threshold: Icon #Market Orders marketOrdersOutbidNotBest=Outbid: Not Best +marketOrdersOutbidNotBestOwned=Outbid: Not Best (Best Owned) marketOrdersOutbidBest=Outbid: Best marketOrdersOutbidUnknown=Outbid: Unknown marketOrdersExpired=Expired