From e529062fbbb5594b90489ac2abd60b3d41c12e5b Mon Sep 17 00:00:00 2001 From: GoldenGnu Date: Fri, 20 Dec 2024 10:41:07 +0100 Subject: [PATCH 1/2] Code: Optimized JCustomFileChooser Reduced startup time --- .../dialogs/account/AccountImportDialog.java | 2 +- .../dialogs/settings/SoundsSettingsPanel.java | 2 +- .../shared/components/JCustomFileChooser.java | 152 +++++++++++++----- .../gui/shared/components/JTextDialog.java | 2 +- .../gui/shared/filter/ExportDialog.java | 4 +- .../gui/tabs/loadout/LoadoutsTab.java | 4 +- .../gui/tabs/routing/RoutingTab.java | 2 +- .../gui/tabs/stockpile/StockpileTab.java | 8 +- .../gui/tabs/tracker/TrackerTab.java | 4 +- 9 files changed, 122 insertions(+), 58 deletions(-) diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountImportDialog.java b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountImportDialog.java index 7bd1087d2..132dee084 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountImportDialog.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountImportDialog.java @@ -176,7 +176,7 @@ public AccountImportDialog(final AccountManagerDialog apiManager, final Program this.getDialog().addWindowFocusListener(listener); - jFileChooser = JCustomFileChooser.createFileChooser(getDialog(), "txt"); + jFileChooser = new JCustomFileChooser("txt"); jFileChooser.setMultiSelectionEnabled(false); jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/SoundsSettingsPanel.java b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/SoundsSettingsPanel.java index 3711f124f..0c2fff499 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/SoundsSettingsPanel.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/SoundsSettingsPanel.java @@ -101,7 +101,7 @@ public SoundsSettingsPanel(final Program program, final SettingsDialog settingsD ListenerClass listener = new ListenerClass(); - jFileChooser = JCustomFileChooser.createFileChooser(settingsDialog.getDialog(), "mp3"); + jFileChooser = new JCustomFileChooser("mp3"); jFileChooser.setMultiSelectionEnabled(false); jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JCustomFileChooser.java b/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JCustomFileChooser.java index d1c9953b9..3880f7e81 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JCustomFileChooser.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JCustomFileChooser.java @@ -21,7 +21,8 @@ package net.nikr.eve.jeveasset.gui.shared.components; -import java.awt.Window; +import java.awt.Component; +import java.awt.HeadlessException; import java.io.File; import java.util.Collections; import java.util.HashSet; @@ -36,70 +37,87 @@ import net.nikr.eve.jeveasset.io.shared.FileUtil; -public final class JCustomFileChooser extends JFileChooser { +public final class JCustomFileChooser { - private final Window window; - private List extensions; + public static final int APPROVE_OPTION = JFileChooser.APPROVE_OPTION; + private static OverwriteFileChooser FILE_CHOOSER = null; - public static JCustomFileChooser createFileChooser(final Window window, final String extension) { - return createFileChooser(window, Collections.singletonList(extension)); - } + private List extensions; + private File file = null; + private boolean multiSelection = false; + private int fileSelectionMode = JFileChooser.FILES_ONLY; + private File currentDirectory = null; - public static JCustomFileChooser createFileChooser(final Window window, final List extensions) { - //XXX - Workaround for https://bugs.openjdk.java.net/browse/JDK-8179014 - UIManager.put("FileChooser.useSystemExtensionHiding", false); - JCustomFileChooser jCustomFileChooser = new JCustomFileChooser(window, extensions); - jCustomFileChooser.setExtensions(extensions); - jCustomFileChooser.setAcceptAllFileFilterUsed(false); - return jCustomFileChooser; + public JCustomFileChooser(String extension) { + this(Collections.singletonList(extension)); } - private JCustomFileChooser(final Window window, final List extensions) { - this.window = window; + public JCustomFileChooser(List extensions) { + this.extensions = extensions; + if (FILE_CHOOSER == null) { + //XXX - Workaround for https://bugs.openjdk.java.net/browse/JDK-8179014 + UIManager.put("FileChooser.useSystemExtensionHiding", false); + FILE_CHOOSER = new OverwriteFileChooser(); + } } - @Override public void setSelectedFile(File file) { - if (getDialogType() != OPEN_DIALOG && file != null) { + if (FILE_CHOOSER.getDialogType() != JFileChooser.OPEN_DIALOG && file != null) { String filename = file.getAbsolutePath(); if (filename.matches("(?i).*\\.\\w{0,4}$")) { //Already got a extension - remove it int end = filename.lastIndexOf("."); filename = filename.substring(0, end); } filename = filename + "." + extensions.get(0); - super.setSelectedFile(new File(filename)); - } else { - super.setSelectedFile(file); + file = new File(filename); } + this.file = file; } - public final void setExtension(final String extension) { - setExtensions(Collections.singletonList(extension)); + private void loadSettings() { + FILE_CHOOSER.setSelectedFile(file); + FILE_CHOOSER.resetChoosableFileFilters(); + FILE_CHOOSER.addChoosableFileFilter(new CustomFileFilter(extensions)); + FILE_CHOOSER.setMultiSelectionEnabled(multiSelection); + FILE_CHOOSER.setFileSelectionMode(fileSelectionMode); + FILE_CHOOSER.setCurrentDirectory(currentDirectory); } - public final void setExtensions(final List extensions) { - this.extensions = extensions; - this.resetChoosableFileFilters(); - this.addChoosableFileFilter(new CustomFileFilter(extensions)); + public File getSelectedFile() { + file = FILE_CHOOSER.getSelectedFile(); + return file; } - @Override - public void approveSelection() { - File selectedFile = this.getSelectedFile(); - //Confirm Overwrite file - if (getDialogType() != OPEN_DIALOG && selectedFile != null && selectedFile.exists()) { - int nReturn = JOptionPane.showConfirmDialog( - window, - GuiShared.get().overwrite(), - GuiShared.get().overwriteFile(), - JOptionPane.YES_NO_OPTION, - JOptionPane.PLAIN_MESSAGE - ); - if (nReturn == JOptionPane.NO_OPTION) { - return; - } - } - super.approveSelection(); + public int showDialog(Component parent, String approveButtonText) throws HeadlessException { + loadSettings(); + return FILE_CHOOSER.showDialog(parent, approveButtonText); + } + + public int showSaveDialog(Component parent) throws HeadlessException { + loadSettings(); + return FILE_CHOOSER.showSaveDialog(parent); + } + + public int showOpenDialog(Component parent) throws HeadlessException { + loadSettings(); + return FILE_CHOOSER.showOpenDialog(parent); + } + + public void setExtension(String extension) { + extensions = Collections.singletonList(extension); + } + + public void setMultiSelectionEnabled(boolean b) { + this.multiSelection = b; + } + + public void setFileSelectionMode(int mode) { + this.fileSelectionMode = mode; + } + + public void setCurrentDirectory(File dir) { + this.currentDirectory = dir; + } public static class CustomFileFilter extends FileFilter { @@ -162,4 +180,50 @@ public boolean equals(Object obj) { return true; } } + + private static class OverwriteFileChooser extends JFileChooser { + + private Component parent; + + public OverwriteFileChooser() { + setAcceptAllFileFilterUsed(false); + } + + @Override + public int showDialog(Component parent, String approveButtonText) throws HeadlessException { + this.parent = parent; + return super.showDialog(parent, approveButtonText); + } + + @Override + public int showSaveDialog(Component parent) throws HeadlessException { + this.parent = parent; + return super.showSaveDialog(parent); + } + + @Override + public int showOpenDialog(Component parent) throws HeadlessException { + this.parent = parent; + return super.showOpenDialog(parent); + } + + @Override + public void approveSelection() { + File selectedFile = this.getSelectedFile(); + //Confirm Overwrite file + if (getDialogType() != JFileChooser.OPEN_DIALOG && selectedFile != null && selectedFile.exists()) { + int nReturn = JOptionPane.showConfirmDialog( + parent, + GuiShared.get().overwrite(), + GuiShared.get().overwriteFile(), + JOptionPane.YES_NO_OPTION, + JOptionPane.PLAIN_MESSAGE + ); + if (nReturn == JOptionPane.NO_OPTION) { + return; + } + } + super.approveSelection(); + } + } } diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JTextDialog.java b/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JTextDialog.java index 7a1d52278..53f63b07e 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JTextDialog.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/shared/components/JTextDialog.java @@ -69,7 +69,7 @@ private enum TextDialogAction { public JTextDialog(Window window) { super(null, "", window, null); - jFileChooser = JCustomFileChooser.createFileChooser(window, "txt"); + jFileChooser = new JCustomFileChooser("txt"); jFileChooser.setMultiSelectionEnabled(false); jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/shared/filter/ExportDialog.java b/src/main/java/net/nikr/eve/jeveasset/gui/shared/filter/ExportDialog.java index 2603f366e..2b984ad39 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/shared/filter/ExportDialog.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/shared/filter/ExportDialog.java @@ -136,7 +136,7 @@ public ExportDialog(final JFrame jFrame, final String toolName, ColumnCache c ListenerClass listener = new ListenerClass(); layout.setAutoCreateContainerGaps(false); - jFileChooser = JCustomFileChooser.createFileChooser(jFrame, Settings.get().getExportSettings(toolName).getExportFormat().getExtension()); + jFileChooser = new JCustomFileChooser(Settings.get().getExportSettings(toolName).getExportFormat().getExtension()); //Format JPanel jFormatPanel = new JPanel(); jFormatPanel.setBorder(BorderFactory.createTitledBorder(DialoguesExport.get().format())); @@ -463,7 +463,7 @@ private boolean browse() { jFileChooser.setSelectedFile(new File(Settings.get().getExportSettings(toolName).getDefaultFilename())); } int bFound = jFileChooser.showDialog(getDialog(), DialoguesExport.get().ok()); - if (bFound == JFileChooser.APPROVE_OPTION) { + if (bFound == JCustomFileChooser.APPROVE_OPTION) { file = jFileChooser.getSelectedFile(); Settings.get().getExportSettings(toolName).setFilename(file.getAbsolutePath()); return true; diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutsTab.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutsTab.java index 010b52698..725053cea 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutsTab.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutsTab.java @@ -131,7 +131,7 @@ public LoadoutsTab(final Program program) { ListenerClass listener = new ListenerClass(); - jXmlFileChooser = JCustomFileChooser.createFileChooser(program.getMainWindow().getFrame(), "xml"); + jXmlFileChooser = new JCustomFileChooser("xml"); jEftDialog = new JTextDialog(program.getMainWindow().getFrame()); @@ -325,7 +325,7 @@ private String browse() { jXmlFileChooser.setCurrentDirectory(new File(FileUtil.getUserDirectory())); } int bFound = jXmlFileChooser.showSaveDialog(program.getMainWindow().getFrame()); - if (bFound == JFileChooser.APPROVE_OPTION) { + if (bFound == JCustomFileChooser.APPROVE_OPTION) { File file = jXmlFileChooser.getSelectedFile(); return file.getAbsolutePath(); } else { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/routing/RoutingTab.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/routing/RoutingTab.java index d085fdd12..401cee099 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/routing/RoutingTab.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/routing/RoutingTab.java @@ -239,7 +239,7 @@ public RoutingTab(final Program program) { jManageRoutesDialog = new JRouteManageDialog(this, program); jRouteEditDialog = new JRouteEditDialog(program); jRouteSelectionDialog = new JMultiSelectionDialog<>(program, TabsRouting.get().resultSelectRoutes()); - jFileChooser = JCustomFileChooser.createFileChooser(program.getMainWindow().getFrame(), "xml"); + jFileChooser = new JCustomFileChooser("xml"); jFileChooser.setMultiSelectionEnabled(false); jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); jImportDialog = new JImportDialog(program, new JImportDialog.ImportOptions() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTab.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTab.java index 1eeb450cb..1b5a56cd8 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTab.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTab.java @@ -324,7 +324,7 @@ protected boolean isEmpty(String t) { } }; - jFileChooser = JCustomFileChooser.createFileChooser(program.getMainWindow().getFrame(), "xml"); + jFileChooser = new JCustomFileChooser("xml"); jFileChooser.setMultiSelectionEnabled(false); jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1213,7 +1213,7 @@ private void removeStockpiles(List stockpiles) { private void importEveXml() { jFileChooser.setSelectedFile(new File("")); int value = jFileChooser.showOpenDialog(program.getMainWindow().getFrame()); - if (value != JFileChooser.APPROVE_OPTION) { + if (value != JCustomFileChooser.APPROVE_OPTION) { return; //Cancel } Map> fits = EveFittingReader.load(jFileChooser.getSelectedFile().getAbsolutePath()); @@ -1367,7 +1367,7 @@ public boolean action(Map data, OptionEnum xmlOptions) { private void importXml() { jFileChooser.setSelectedFile(new File("")); int value = jFileChooser.showOpenDialog(program.getMainWindow().getFrame()); - if (value == JFileChooser.APPROVE_OPTION) { + if (value == JCustomFileChooser.APPROVE_OPTION) { List stockpiles = SettingsReader.loadStockpile(jFileChooser.getSelectedFile().getAbsolutePath()); if (stockpiles != null) { importStockpiles(stockpiles); @@ -1530,7 +1530,7 @@ private void exportXml() { if (stockpiles != null) { jFileChooser.setSelectedFile(new File("")); int value = jFileChooser.showSaveDialog(program.getMainWindow().getFrame()); - if (value == JFileChooser.APPROVE_OPTION) { + if (value == JCustomFileChooser.APPROVE_OPTION) { SettingsWriter.saveStockpiles(stockpiles, jFileChooser.getSelectedFile().getAbsolutePath()); } } diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerTab.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerTab.java index 96372b217..5430bd720 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerTab.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerTab.java @@ -278,7 +278,7 @@ public TrackerTab(Program program) { extensions.add("zip"); extensions.add("json"); extensions.add("backup"); - jFileChooser = JCustomFileChooser.createFileChooser(program.getMainWindow().getFrame(), extensions); + jFileChooser = new JCustomFileChooser(extensions); jFileChooser.setMultiSelectionEnabled(false); jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -1694,7 +1694,7 @@ public void actionPerformed(ActionEvent e) { } else if (TrackerAction.IMPORT_FILE.name().equals(e.getActionCommand())) { jFileChooser.setCurrentDirectory(new File(FileUtil.getPathDataDirectory())); int value = jFileChooser.showOpenDialog(program.getMainWindow().getFrame()); - if (value != JFileChooser.APPROVE_OPTION) { + if (value != JCustomFileChooser.APPROVE_OPTION) { return; //Cancel } jLockWindow.show(TabsTracker.get().importFileImport(), new ImportFileLockWorker(jFileChooser.getSelectedFile())); From 921a1f04c23ee307591f888bcb905a3a442c2b1d Mon Sep 17 00:00:00 2001 From: GoldenGnu Date: Fri, 20 Dec 2024 12:51:46 +0100 Subject: [PATCH 2/2] Bug Fix: Made string columns sorting case insensitive (Issue #506) --- .../data/settings/PriceHistoryDatabase.java | 32 +++--- .../dialogs/account/AccountTableFormat.java | 51 +++++---- .../dialogs/settings/ColorsTableFormat.java | 15 ++- .../gui/shared/table/EnumTableColumn.java | 21 ++++ .../gui/tabs/assets/AssetTableFormat.java | 101 +++++++++--------- .../tabs/contracts/ContractsTableFormat.java | 85 ++++++++------- .../gui/tabs/items/ItemTableFormat.java | 31 +++--- .../gui/tabs/jobs/IndustryJobTableFormat.java | 55 +++++----- .../gui/tabs/journal/JournalTableFormat.java | 35 +++--- .../loadout/LoadoutExtendedTableFormat.java | 13 ++- .../gui/tabs/loadout/LoadoutTableFormat.java | 9 +- .../MaterialExtendedTableFormat.java | 9 +- .../tabs/materials/MaterialTableFormat.java | 15 ++- .../tabs/mining/ExtractionsTableFormat.java | 15 ++- .../gui/tabs/mining/MiningTableFormat.java | 43 ++++---- .../gui/tabs/orders/MarketTableFormat.java | 90 ++++++++-------- .../tabs/overview/OverviewTableFormat.java | 27 +++-- .../gui/tabs/prices/PriceChangesTab.java | 2 +- .../tabs/prices/PriceChangesTableFormat.java | 23 ++-- .../ReprocessedExtendedTableFormat.java | 13 ++- .../reprocessed/ReprocessedTableFormat.java | 23 ++-- .../gui/tabs/skills/SkillsTableFormat.java | 15 ++- .../gui/tabs/slots/SlotsTableFormat.java | 59 +++++----- .../StockpileExtendedTableFormat.java | 15 ++- .../tabs/stockpile/StockpileTableFormat.java | 67 ++++++------ .../TrackerSkillPointsFilterTableFormat.java | 11 +- .../transaction/TransactionTableFormat.java | 51 +++++---- .../gui/tabs/tree/TreeTableFormat.java | 101 +++++++++--------- .../gui/tabs/values/ValueTableFormat.java | 67 ++++++------ .../jeveasset/gui/tabs/TableFormatTest.java | 52 ++++++++- 30 files changed, 588 insertions(+), 558 deletions(-) diff --git a/src/main/java/net/nikr/eve/jeveasset/data/settings/PriceHistoryDatabase.java b/src/main/java/net/nikr/eve/jeveasset/data/settings/PriceHistoryDatabase.java index ede03e339..1eb16bfd4 100644 --- a/src/main/java/net/nikr/eve/jeveasset/data/settings/PriceHistoryDatabase.java +++ b/src/main/java/net/nikr/eve/jeveasset/data/settings/PriceHistoryDatabase.java @@ -460,25 +460,19 @@ private Set selectPriceChanges(Map typeIDs, boolean priceData.setBuyAvg(rs.getDouble("buyavg")); priceData.setBuyMedian(rs.getDouble("buymedian")); priceData.setBuyMin(rs.getDouble("buymin")); - try { - PriceChange priceChange = data.get(typeID); - double price = PriceMode.getDefaultPrice(priceData, priceMode); - if (priceChange == null) { - Item item = ApiIdConverter.getItem(typeID); - priceChange = new PriceChange(typeID, item, typeIDs.getOrDefault(typeID, 0L)); - data.put(typeID, priceChange); - } - if (date.equals(fromString)) { - priceChange.setPriceFrom(price); - } else if (date.equals(toString)) { - priceChange.setPriceTo(price); - } else { - LOG.warn("Date is don't equals to or from???"); - } - - - } catch (ParseException ex) { - //Ignore + PriceChange priceChange = data.get(typeID); + double price = PriceMode.getDefaultPrice(priceData, priceMode); + if (priceChange == null) { + Item item = ApiIdConverter.getItem(typeID); + priceChange = new PriceChange(typeID, item, typeIDs.getOrDefault(typeID, 0L)); + data.put(typeID, priceChange); + } + if (date.equals(fromString)) { + priceChange.setPriceFrom(price); + } else if (date.equals(toString)) { + priceChange.setPriceTo(price); + } else { + LOG.warn("Date is don't equals to or from???"); } } } catch (SQLException ex) { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountTableFormat.java index 0b3ed5e11..676a52428 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/account/AccountTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.dialogs.account; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.data.api.accounts.OwnerType; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; @@ -31,7 +30,7 @@ public enum AccountTableFormat implements EnumTableColumn { - SHOW_ASSETS(Boolean.class, GlazedLists.comparableComparator()) { + SHOW_ASSETS(Boolean.class) { @Override public String getColumnName() { return ""; @@ -60,7 +59,7 @@ public boolean setColumnValue(final Object baseObject, final Object editedValue) return false; } }, - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatName(); @@ -70,7 +69,7 @@ public Object getColumnValue(final OwnerType from) { return from.getOwnerName(); } }, - CORPORATION(YesNo.class, GlazedLists.comparableComparator()) { + CORPORATION(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatCorporation(); @@ -80,7 +79,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isCorporation()); } }, - ASSET_LIST(YesNo.class, GlazedLists.comparableComparator()) { + ASSET_LIST(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatAssetList(); @@ -90,7 +89,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isAssetList()); } }, - ACCOUNT_BALANCE(YesNo.class, GlazedLists.comparableComparator()) { + ACCOUNT_BALANCE(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatAccountBalance(); @@ -100,7 +99,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isAccountBalance()); } }, - INDUSTRY_JOBS(YesNo.class, GlazedLists.comparableComparator()) { + INDUSTRY_JOBS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatIndustryJobs(); @@ -110,7 +109,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isIndustryJobs()); } }, - MARKET_ORDERS(YesNo.class, GlazedLists.comparableComparator()) { + MARKET_ORDERS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatMarketOrders(); @@ -120,7 +119,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isMarketOrders()); } }, - TRANSACTIONS(YesNo.class, GlazedLists.comparableComparator()) { + TRANSACTIONS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatTransactions(); @@ -130,7 +129,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isTransactions()); } }, - JOURNAL(YesNo.class, GlazedLists.comparableComparator()) { + JOURNAL(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatJournal(); @@ -140,7 +139,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isJournal()); } }, - CONTRACTS(YesNo.class, GlazedLists.comparableComparator()) { + CONTRACTS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatContracts(); @@ -150,7 +149,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isContracts()); } }, - LOCATIONS(YesNo.class, GlazedLists.comparableComparator()) { + LOCATIONS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatLocations(); @@ -160,7 +159,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isLocations()); } }, - STRUCTURES(YesNo.class, GlazedLists.comparableComparator()) { + STRUCTURES(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatStructures(); @@ -170,7 +169,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isStructures()); } }, - MARKET_STRUCTURES(YesNo.class, GlazedLists.comparableComparator()) { + MARKET_STRUCTURES(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatMarketStructures(); @@ -180,7 +179,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isMarketStructures()); } }, - BOOKMARKS(YesNo.class, GlazedLists.comparableComparator()) { + BOOKMARKS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatBookmarks(); @@ -190,7 +189,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isBookmarks()); } }, - BLUEPRINTS(YesNo.class, GlazedLists.comparableComparator()) { + BLUEPRINTS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatBlueprints(); @@ -200,7 +199,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isBlueprints()); } }, - DIVISIONS(YesNo.class, GlazedLists.comparableComparator()) { + DIVISIONS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatDivisions(); @@ -210,7 +209,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isDivisions()); } }, - SHIP(YesNo.class, GlazedLists.comparableComparator()) { + SHIP(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatShip(); @@ -220,7 +219,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isShip()); } }, - PLANETARY_INTERACTION(YesNo.class, GlazedLists.comparableComparator()) { + PLANETARY_INTERACTION(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatPlanetaryInteraction(); @@ -230,7 +229,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isPlanetaryInteraction()); } }, - OPEN_WINDOWS(YesNo.class, GlazedLists.comparableComparator()) { + OPEN_WINDOWS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatOpenWindows(); @@ -240,7 +239,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isOpenWindows()); } }, - AUTOPILOT(YesNo.class, GlazedLists.comparableComparator()) { + AUTOPILOT(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatAutopilot(); @@ -250,7 +249,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isAutopilot()); } }, - SKILLS(YesNo.class, GlazedLists.comparableComparator()) { + SKILLS(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatSkills(); @@ -260,7 +259,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isSkills()); } }, - MINING(YesNo.class, GlazedLists.comparableComparator()) { + MINING(YesNo.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatMining(); @@ -270,7 +269,7 @@ public Object getColumnValue(final OwnerType from) { return new YesNo(from.isMining()); } }, - EXPIRES(ExpirerDate.class, GlazedLists.comparableComparator()) { + EXPIRES(ExpirerDate.class) { @Override public String getColumnName() { return DialoguesAccount.get().tableFormatExpires(); @@ -283,9 +282,9 @@ public Object getColumnValue(final OwnerType from) { private final Class type; private final Comparator comparator; - private AccountTableFormat(final Class type, final Comparator comparator) { + private AccountTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/ColorsTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/ColorsTableFormat.java index 39ec57b0a..f9ee025ed 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/ColorsTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/dialogs/settings/ColorsTableFormat.java @@ -20,7 +20,6 @@ */ package net.nikr.eve.jeveasset.gui.dialogs.settings; -import ca.odell.glazedlists.GlazedLists; import java.awt.Color; import java.util.Comparator; import net.nikr.eve.jeveasset.data.settings.ColorSettings.ColorRow; @@ -28,7 +27,7 @@ import net.nikr.eve.jeveasset.i18n.DialoguesSettings; public enum ColorsTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return DialoguesSettings.get().columnName(); @@ -38,7 +37,7 @@ public Object getColumnValue(final ColorRow from) { return from.getColorEntry().getDescription(); } }, - BACKGROUND(Color.class, GlazedLists.comparableComparator()) { + BACKGROUND(Color.class) { @Override public String getColumnName() { return DialoguesSettings.get().columnBackground(); @@ -48,7 +47,7 @@ public Object getColumnValue(final ColorRow from) { return from.getBackground(); } }, - FOREGROUND(Color.class, GlazedLists.comparableComparator()) { + FOREGROUND(Color.class) { @Override public String getColumnName() { return DialoguesSettings.get().columnForeground(); @@ -58,7 +57,7 @@ public Object getColumnValue(final ColorRow from) { return from.getForeground(); } }, - PREVIEW(String.class, GlazedLists.comparableComparator()) { + PREVIEW(String.class) { @Override public String getColumnName() { return DialoguesSettings.get().columnPreview(); @@ -68,7 +67,7 @@ public Object getColumnValue(final ColorRow from) { return DialoguesSettings.get().testText(); } }, - SELECTED(String.class, GlazedLists.comparableComparator()) { + SELECTED(String.class) { @Override public String getColumnName() { return DialoguesSettings.get().columnSelected(); @@ -82,9 +81,9 @@ public Object getColumnValue(final ColorRow from) { private final Class type; private final Comparator comparator; - private ColorsTableFormat(final Class type, final Comparator comparator) { + private ColorsTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/shared/table/EnumTableColumn.java b/src/main/java/net/nikr/eve/jeveasset/gui/shared/table/EnumTableColumn.java index 15f056ca9..a8644b31b 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/shared/table/EnumTableColumn.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/shared/table/EnumTableColumn.java @@ -21,7 +21,12 @@ package net.nikr.eve.jeveasset.gui.shared.table; +import ca.odell.glazedlists.GlazedLists; +import java.awt.Color; +import java.awt.Component; import java.util.Comparator; +import net.nikr.eve.jeveasset.gui.shared.table.containers.ISK; +import net.nikr.eve.jeveasset.gui.shared.table.containers.ModulePriceValue; /** * @@ -47,4 +52,20 @@ public default String getColumnToolTip() { return null; } + public static Comparator getComparator(final Class type) { + if (type.equals(String.class)) { + return GlazedLists.caseInsensitiveComparator(); + } else if (Comparable.class.isAssignableFrom(type)) { + return GlazedLists.comparableComparator(); + } else if (Component.class.isAssignableFrom(type) + || ModulePriceValue.class.isAssignableFrom(type) + || ISK.class.isAssignableFrom(type) + || Color.class.isAssignableFrom(type) + ) { + return null; //Not sortable + } else { + throw new RuntimeException(type.getName() + " is not comparable"); + } + } + } diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/assets/AssetTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/assets/AssetTableFormat.java index b75df3939..d4f60b5aa 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/assets/AssetTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/assets/AssetTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.assets; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import java.util.Date; import net.nikr.eve.jeveasset.data.api.my.MyAsset; @@ -37,7 +36,7 @@ public enum AssetTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnName(); @@ -47,7 +46,7 @@ public Object getColumnValue(final MyAsset from) { return from.getName(); } }, - NAME_TYPE(String.class, GlazedLists.comparableComparator()) { + NAME_TYPE(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnNameType(); @@ -61,7 +60,7 @@ public boolean isShowDefault() { return false; } }, - NAME_CUSTOM(String.class, GlazedLists.comparableComparator()) { + NAME_CUSTOM(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnNameCustom(); @@ -75,7 +74,7 @@ public boolean isShowDefault() { return false; } }, - TAGS(Tags.class, GlazedLists.comparableComparator()) { + TAGS(Tags.class) { @Override public String getColumnName() { return TabsAssets.get().columnTags(); @@ -85,7 +84,7 @@ public Object getColumnValue(final MyAsset from) { return from.getTags(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnGroup(); @@ -95,7 +94,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getGroup(); } }, - CATEGORY(String.class, GlazedLists.comparableComparator()) { + CATEGORY(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnCategory(); @@ -105,7 +104,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getCategory(); } }, - SLOT(String.class, GlazedLists.comparableComparator()) { + SLOT(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnSlot(); @@ -115,7 +114,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getSlot(); } }, - CHARGE_SIZE(String.class, GlazedLists.comparableComparator()) { + CHARGE_SIZE(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnChargeSize(); @@ -125,7 +124,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getChargeSize(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnOwner(); @@ -135,7 +134,7 @@ public Object getColumnValue(final MyAsset from) { return from.getOwnerName(); } }, - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnLocation(); @@ -145,7 +144,7 @@ public Object getColumnValue(final MyAsset from) { return from.getLocation().getLocation(); } }, - SECURITY(Security.class, GlazedLists.comparableComparator()) { + SECURITY(Security.class) { @Override public String getColumnName() { return TabsAssets.get().columnSecurity(); @@ -155,7 +154,7 @@ public Object getColumnValue(final MyAsset from) { return from.getLocation().getSecurityObject(); } }, - SYSTEM(String.class, GlazedLists.comparableComparator()) { + SYSTEM(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnSystem(); @@ -165,7 +164,7 @@ public Object getColumnValue(final MyAsset from) { return from.getLocation().getSystem(); } }, - CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnConstellation(); @@ -175,7 +174,7 @@ public Object getColumnValue(final MyAsset from) { return from.getLocation().getConstellation(); } }, - REGION(String.class, GlazedLists.comparableComparator()) { + REGION(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnRegion(); @@ -185,7 +184,7 @@ public Object getColumnValue(final MyAsset from) { return from.getLocation().getRegion(); } }, - FACTION_WARFARE_SYSTEM_OWNER(String.class, GlazedLists.comparableComparator()) { + FACTION_WARFARE_SYSTEM_OWNER(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnFactionWarfareSystemOwner(); @@ -199,7 +198,7 @@ public Object getColumnValue(final MyAsset from) { return from.getLocation().getFactionWarfareSystemOwner(); } }, - CONTAINER(AssetContainer.class, GlazedLists.comparableComparator()) { + CONTAINER(AssetContainer.class) { @Override public String getColumnName() { return TabsAssets.get().columnContainer(); @@ -209,7 +208,7 @@ public Object getColumnValue(final MyAsset from) { return from.getAssetContainer(); } }, - FLAG(String.class, GlazedLists.comparableComparator()) { + FLAG(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnFlag(); @@ -219,7 +218,7 @@ public Object getColumnValue(final MyAsset from) { return from.getFlagName(); } }, - PRICE(Double.class, GlazedLists.comparableComparator()) { + PRICE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPrice(); @@ -233,7 +232,7 @@ public Object getColumnValue(final MyAsset from) { return from.getDynamicPrice(); } }, - PRICE_SELL_MIN(Double.class, GlazedLists.comparableComparator()) { + PRICE_SELL_MIN(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceSellMin(); @@ -247,7 +246,7 @@ public Object getColumnValue(final MyAsset from) { return from.getPriceSellMin(); } }, - PRICE_BUY_MAX(Double.class, GlazedLists.comparableComparator()) { + PRICE_BUY_MAX(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceBuyMax(); @@ -261,7 +260,7 @@ public Object getColumnValue(final MyAsset from) { return from.getPriceBuyMax(); } }, - PRICE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceReprocessed(); @@ -275,7 +274,7 @@ public Object getColumnValue(final MyAsset from) { return from.getPriceReprocessed(); } }, - PRICE_MANUFACTURING(Double.class, GlazedLists.comparableComparator()) { + PRICE_MANUFACTURING(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceManufacturing(); @@ -289,7 +288,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getPriceManufacturing(); } }, - TRANSACTION_PRICE_LATEST(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_LATEST(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceLatest(); @@ -303,7 +302,7 @@ public Object getColumnValue(final MyAsset from) { return from.getMarketPriceData().getLatest(); } }, - TRANSACTION_PRICE_AVERAGE(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_AVERAGE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceAverage(); @@ -317,7 +316,7 @@ public Object getColumnValue(final MyAsset from) { return from.getMarketPriceData().getAverage(); } }, - TRANSACTION_PRICE_MAXIMUM(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_MAXIMUM(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceMaximum(); @@ -331,7 +330,7 @@ public Object getColumnValue(final MyAsset from) { return from.getMarketPriceData().getMaximum(); } }, - TRANSACTION_PRICE_MINIMUM(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_MINIMUM(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceMinimum(); @@ -345,7 +344,7 @@ public Object getColumnValue(final MyAsset from) { return from.getMarketPriceData().getMinimum(); } }, - PRICE_BASE(Double.class, GlazedLists.comparableComparator()) { + PRICE_BASE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceBase(); @@ -359,7 +358,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getPriceBase(); } }, - VALUE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + VALUE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnValueReprocessed(); @@ -373,7 +372,7 @@ public Object getColumnValue(final MyAsset from) { return from.getValueReprocessed(); } }, - VALUE(Double.class, GlazedLists.comparableComparator()) { + VALUE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnValue(); @@ -387,7 +386,7 @@ public Object getColumnValue(final MyAsset from) { return from.getValue(); } }, - PRICE_REPROCESSED_DIFFERENCE(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED_DIFFERENCE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceReprocessedDifference(); @@ -401,7 +400,7 @@ public Object getColumnValue(final MyAsset from) { return from.getPriceReprocessedDifference(); } }, - PRICE_REPROCESSED_PERCENT(Percent.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED_PERCENT(Percent.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceReprocessedPercent(); @@ -415,7 +414,7 @@ public Object getColumnValue(final MyAsset from) { return Percent.create(from.getPriceReprocessedPercent()); } }, - COUNT(Long.class, GlazedLists.comparableComparator()) { + COUNT(Long.class) { @Override public String getColumnName() { return TabsAssets.get().columnCount(); @@ -425,7 +424,7 @@ public Object getColumnValue(final MyAsset from) { return from.getCount(); } }, - COUNT_TYPE(Long.class, GlazedLists.comparableComparator()) { + COUNT_TYPE(Long.class) { @Override public String getColumnName() { return TabsAssets.get().columnTypeCount(); @@ -439,7 +438,7 @@ public Object getColumnValue(final MyAsset from) { return from.getTypeCount(); } }, - META(Integer.class, GlazedLists.comparableComparator()) { + META(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnMeta(); @@ -449,7 +448,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getMeta(); } }, - TECH(String.class, GlazedLists.comparableComparator()) { + TECH(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnTech(); @@ -459,7 +458,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getTech(); } }, - VOLUME(Float.class, GlazedLists.comparableComparator()) { + VOLUME(Float.class) { @Override public String getColumnName() { return TabsAssets.get().columnVolume(); @@ -469,7 +468,7 @@ public Object getColumnValue(final MyAsset from) { return from.getVolume(); } }, - VOLUME_TOTAL(Float.class, GlazedLists.comparableComparator()) { + VOLUME_TOTAL(Float.class) { @Override public String getColumnName() { return TabsAssets.get().columnVolumeTotal(); @@ -483,7 +482,7 @@ public Object getColumnValue(final MyAsset from) { return from.getVolumeTotal(); } }, - VOLUME_PACKAGED(Float.class, GlazedLists.comparableComparator()) { + VOLUME_PACKAGED(Float.class) { @Override public String getColumnName() { return TabsAssets.get().columnVolumePackaged(); @@ -497,7 +496,7 @@ public Object getColumnValue(final MyAsset from) { return from.getItem().getVolumePackaged(); } }, - VALUE_PER_VOLUME(Double.class, GlazedLists.comparableComparator()) { + VALUE_PER_VOLUME(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnValuePerVolume(); @@ -507,7 +506,7 @@ public Object getColumnValue(final MyAsset from) { return from.getValuePerVolume(); } }, - SINGLETON(String.class, GlazedLists.comparableComparator()) { + SINGLETON(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnSingleton(); @@ -517,7 +516,7 @@ public Object getColumnValue(final MyAsset from) { return from.getSingleton(); } }, - ADDED(Date.class, GlazedLists.comparableComparator()) { + ADDED(Date.class) { @Override public String getColumnName() { return TabsAssets.get().columnAdded(); @@ -535,7 +534,7 @@ public boolean isShowDefault() { return false; } }, - MATERIAL_EFFICIENCY(Integer.class, GlazedLists.comparableComparator()) { + MATERIAL_EFFICIENCY(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnMaterialEfficiency(); @@ -549,7 +548,7 @@ public Object getColumnValue(final MyAsset from) { return from.getMaterialEfficiency(); } }, - TIME_EFFICIENCY(Integer.class, GlazedLists.comparableComparator()) { + TIME_EFFICIENCY(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnTimeEfficiency(); @@ -563,7 +562,7 @@ public Object getColumnValue(final MyAsset from) { return from.getTimeEfficiency(); } }, - RUNS(Runs.class, GlazedLists.comparableComparator()) { + RUNS(Runs.class) { @Override public String getColumnName() { return TabsAssets.get().columnRuns(); @@ -577,7 +576,7 @@ public Object getColumnValue(final MyAsset from) { return new Runs(from.getRuns()); } }, - CITADEL(YesNo.class, GlazedLists.comparableComparator()) { + CITADEL(YesNo.class) { @Override public String getColumnName() { return TabsAssets.get().columnStructure(); @@ -595,7 +594,7 @@ public boolean isShowDefault() { return false; } }, - ITEM_ID(LongInt.class, GlazedLists.comparableComparator()) { + ITEM_ID(LongInt.class) { @Override public String getColumnName() { return TabsAssets.get().columnItemID(); @@ -609,7 +608,7 @@ public Object getColumnValue(final MyAsset from) { return new LongInt(from.getItemID()); } }, - LOCATION_ID(LongInt.class, GlazedLists.comparableComparator()) { + LOCATION_ID(LongInt.class) { @Override public String getColumnName() { return TabsAssets.get().columnLocationID(); @@ -623,7 +622,7 @@ public Object getColumnValue(final MyAsset from) { return new LongInt(from.getLocationID()); } }, - TYPE_ID(Integer.class, GlazedLists.comparableComparator()) { + TYPE_ID(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnTypeID(); @@ -641,9 +640,9 @@ public Object getColumnValue(final MyAsset from) { private final Class type; private final Comparator comparator; - private AssetTableFormat(final Class type, final Comparator comparator) { + private AssetTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/contracts/ContractsTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/contracts/ContractsTableFormat.java index 8da7d6b14..cafb3b058 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/contracts/ContractsTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/contracts/ContractsTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.contracts; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import java.util.Date; import net.nikr.eve.jeveasset.data.api.my.MyContractItem; @@ -33,7 +32,7 @@ public enum ContractsTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator(), false) { + NAME(String.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnName(); @@ -43,7 +42,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getName(); } }, - TITLE(String.class, GlazedLists.comparableComparator(), true) { + TITLE(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnTitle(); @@ -53,7 +52,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getTitle(); } }, - TYPE(String.class, GlazedLists.comparableComparator(), true) { + TYPE(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnType(); @@ -63,7 +62,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getTypeName(); } }, - STATUS(String.class, GlazedLists.comparableComparator(), true) { + STATUS(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnStatus(); @@ -73,7 +72,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getStatusFormatted(); } }, - AVAILABILITY(String.class, GlazedLists.comparableComparator(), true) { + AVAILABILITY(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnAvailability(); @@ -83,7 +82,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getAvailabilityFormatted(); } }, - INCLUDED(String.class, GlazedLists.comparableComparator(), false) { + INCLUDED(String.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnIncluded(); @@ -93,7 +92,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getIncluded(); } }, - QUANTITY(Long.class, GlazedLists.comparableComparator(), false) { + QUANTITY(Long.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnQuantity(); @@ -103,7 +102,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getQuantity(); } }, - SINGLETON(String.class, GlazedLists.comparableComparator(), false) { + SINGLETON(String.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnSingleton(); @@ -113,7 +112,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getSingleton(); } }, - TYPE_ID(Integer.class, GlazedLists.comparableComparator(), false) { + TYPE_ID(Integer.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnTypeID(); @@ -123,7 +122,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getTypeID(); } }, - VOLUME(Double.class, GlazedLists.comparableComparator(), true) { + VOLUME(Double.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnVolume(); @@ -133,7 +132,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getVolume(); } }, - Runs(Runs.class, GlazedLists.comparableComparator(), false) { + Runs(Runs.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnRuns(); @@ -147,7 +146,7 @@ public Object getColumnValue(final MyContractItem from) { return new Runs(from.getRuns()); } }, - ME(Integer.class, GlazedLists.comparableComparator(), false) { + ME(Integer.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnMaterialEfficiency(); @@ -161,7 +160,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getME(); } }, - TE(Integer.class, GlazedLists.comparableComparator(), false) { + TE(Integer.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnTimeEfficiency(); @@ -175,7 +174,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getTE(); } }, - MARKET_PRICE(Double.class, GlazedLists.comparableComparator(), false) { + MARKET_PRICE(Double.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnMarketPrice(); @@ -185,7 +184,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getDynamicPrice(); } }, - PRICE_REPROCESSED(Double.class, GlazedLists.comparableComparator(), false) { + PRICE_REPROCESSED(Double.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnPriceReprocessed(); @@ -199,7 +198,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getItem().getPriceReprocessed(); } }, - PRICE_MANUFACTURING(Double.class, GlazedLists.comparableComparator(), false) { + PRICE_MANUFACTURING(Double.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnPriceManufacturing(); @@ -213,7 +212,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getItem().getPriceManufacturing(); } }, - MARKET_VALUE(Double.class, GlazedLists.comparableComparator(), false) { + MARKET_VALUE(Double.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnMarketValue(); @@ -227,7 +226,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getDynamicPrice() * from.getQuantity(); } }, - REPROCESSED_VALUE(Double.class, GlazedLists.comparableComparator(), false) { + REPROCESSED_VALUE(Double.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnValueReprocessed(); @@ -241,7 +240,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getItem().getPriceReprocessed() * from.getQuantity(); } }, - MANUFACTURING_VALUE(Double.class, GlazedLists.comparableComparator(), false) { + MANUFACTURING_VALUE(Double.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnValueManufacturing(); @@ -255,7 +254,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getItem().getPriceManufacturing() * from.getQuantity(); } }, - PRICE(Double.class, GlazedLists.comparableComparator(), true) { + PRICE(Double.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnPrice(); @@ -265,7 +264,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getPrice(); } }, - BUYOUT(Double.class, GlazedLists.comparableComparator(), true) { + BUYOUT(Double.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnBuyout(); @@ -275,7 +274,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getBuyout(); } }, - COLLATERAL(Double.class, GlazedLists.comparableComparator(), true) { + COLLATERAL(Double.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnCollateral(); @@ -285,7 +284,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getCollateral(); } }, - NUM_DAYS(Integer.class, GlazedLists.comparableComparator(), true) { + NUM_DAYS(Integer.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnNumDays(); @@ -295,7 +294,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getDaysToComplete(); } }, - REWARD(Double.class, GlazedLists.comparableComparator(), true) { + REWARD(Double.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnReward(); @@ -305,7 +304,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getReward(); } }, - FOR_CORP(YesNo.class, GlazedLists.comparableComparator(), true) { + FOR_CORP(YesNo.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnForCorp(); @@ -315,7 +314,7 @@ public Object getColumnValue(final MyContractItem from) { return new YesNo(from.getContract().isForCorp()); } }, - ISSUER(String.class, GlazedLists.comparableComparator(), true) { + ISSUER(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnIssuer(); @@ -325,7 +324,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getIssuer(); } }, - ISSUER_CORP(String.class, GlazedLists.comparableComparator(), true) { + ISSUER_CORP(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnIssuerCorp(); @@ -335,7 +334,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getIssuerCorp(); } }, - ASSIGNEE(String.class, GlazedLists.comparableComparator(), true) { + ASSIGNEE(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnAssignee(); @@ -345,7 +344,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getAssignee(); } }, - ACCEPTOR(String.class, GlazedLists.comparableComparator(), true) { + ACCEPTOR(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnAcceptor(); @@ -355,7 +354,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getAcceptor(); } }, - OWNED(YesNo.class, GlazedLists.comparableComparator(), true) { + OWNED(YesNo.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnOwned(); @@ -369,7 +368,7 @@ public Object getColumnValue(final MyContractItem from) { return new YesNo(from.getContract().isOwned()); } }, - START_STATION(String.class, GlazedLists.comparableComparator(), true) { + START_STATION(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnStartStation(); @@ -379,7 +378,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getStartLocation(); } }, - END_STATION(String.class, GlazedLists.comparableComparator(), true) { + END_STATION(String.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnEndStation(); @@ -389,7 +388,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getEndLocation(); } }, - ISSUED_DATE(Date.class, GlazedLists.comparableComparator(), true) { + ISSUED_DATE(Date.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnIssued(); @@ -399,7 +398,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getDateIssued(); } }, - EXPIRED_DATE(Date.class, GlazedLists.comparableComparator(), true) { + EXPIRED_DATE(Date.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnExpired(); @@ -409,7 +408,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getDateExpired(); } }, - ACCEPTED_DATE(Date.class, GlazedLists.comparableComparator(), true) { + ACCEPTED_DATE(Date.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnAccepted(); @@ -419,7 +418,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getDateAccepted(); } }, - COMPLETED_DATE(Date.class, GlazedLists.comparableComparator(), true) { + COMPLETED_DATE(Date.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnCompleted(); @@ -429,7 +428,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getDateCompleted(); } }, - CONTRACT_ID(Integer.class, GlazedLists.comparableComparator(), true) { + CONTRACT_ID(Integer.class, true) { @Override public String getColumnName() { return TabsContracts.get().columnContractID(); @@ -439,7 +438,7 @@ public Object getColumnValue(final MyContractItem from) { return from.getContract().getContractID(); } }, - RECORD_ID(LongInt.class, GlazedLists.comparableComparator(), false) { + RECORD_ID(LongInt.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnRecordID(); @@ -449,7 +448,7 @@ public Object getColumnValue(final MyContractItem from) { return new LongInt(from.getRecordID()); } }, - ITEM_ID(LongInt.class, GlazedLists.comparableComparator(), false) { + ITEM_ID(LongInt.class, false) { @Override public String getColumnName() { return TabsContracts.get().columnItemID(); @@ -461,13 +460,13 @@ public Object getColumnValue(final MyContractItem from) { }; private final Class type; - private final Comparator comparator; private final boolean contract; + private final Comparator comparator; - private ContractsTableFormat(final Class type, final Comparator comparator, boolean contract) { + private ContractsTableFormat(final Class type, boolean contract) { this.type = type; - this.comparator = comparator; this.contract = contract; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/items/ItemTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/items/ItemTableFormat.java index 3b489d264..f6e8e8bbe 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/items/ItemTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/items/ItemTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.items; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.data.sde.Item; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; @@ -29,7 +28,7 @@ public enum ItemTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsItems.get().columnName(); @@ -39,7 +38,7 @@ public Object getColumnValue(final Item from) { return from.getTypeName(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsItems.get().columnGroup(); @@ -49,7 +48,7 @@ public Object getColumnValue(final Item from) { return from.getGroup(); } }, - CATEGORY(String.class, GlazedLists.comparableComparator()) { + CATEGORY(String.class) { @Override public String getColumnName() { return TabsItems.get().columnCategory(); @@ -59,7 +58,7 @@ public Object getColumnValue(final Item from) { return from.getCategory(); } }, - SLOT(String.class, GlazedLists.comparableComparator()) { + SLOT(String.class) { @Override public String getColumnName() { return TabsItems.get().columnSlot(); @@ -69,7 +68,7 @@ public Object getColumnValue(final Item from) { return from.getSlot(); } }, - CHARGE_SIZE(String.class, GlazedLists.comparableComparator()) { + CHARGE_SIZE(String.class) { @Override public String getColumnName() { return TabsItems.get().columnChargeSize(); @@ -79,7 +78,7 @@ public Object getColumnValue(final Item from) { return from.getChargeSize(); } }, - PRICE_BASE(Double.class, GlazedLists.comparableComparator()) { + PRICE_BASE(Double.class) { @Override public String getColumnName() { return TabsItems.get().columnPriceBase(); @@ -89,7 +88,7 @@ public Object getColumnValue(final Item from) { return from.getPriceBase(); } }, - PRICE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsItems.get().columnPriceReprocessed(); @@ -99,7 +98,7 @@ public Object getColumnValue(final Item from) { return from.getPriceReprocessed(); } }, - PRICE_MANUFACTURING(Double.class, GlazedLists.comparableComparator()) { + PRICE_MANUFACTURING(Double.class) { @Override public String getColumnName() { return TabsItems.get().columnPriceManufacturing(); @@ -113,7 +112,7 @@ public Object getColumnValue(final Item from) { return from.getItem().getPriceManufacturing(); } }, - META(Integer.class, GlazedLists.comparableComparator()) { + META(Integer.class) { @Override public String getColumnName() { return TabsItems.get().columnMeta(); @@ -123,7 +122,7 @@ public Object getColumnValue(final Item from) { return from.getMeta(); } }, - TECH(String.class, GlazedLists.comparableComparator()) { + TECH(String.class) { @Override public String getColumnName() { return TabsItems.get().columnTech(); @@ -133,7 +132,7 @@ public Object getColumnValue(final Item from) { return from.getTech(); } }, - VOLUME(Float.class, GlazedLists.comparableComparator()) { + VOLUME(Float.class) { @Override public String getColumnName() { return TabsItems.get().columnVolume(); @@ -143,7 +142,7 @@ public Object getColumnValue(final Item from) { return from.getVolume(); } }, - VOLUME_PACKAGED(Float.class, GlazedLists.comparableComparator()) { + VOLUME_PACKAGED(Float.class) { @Override public String getColumnName() { return TabsItems.get().columnVolumePackaged(); @@ -153,7 +152,7 @@ public Object getColumnValue(final Item from) { return from.getVolumePackaged(); } }, - TYPE_ID(Integer.class, GlazedLists.comparableComparator()) { + TYPE_ID(Integer.class) { @Override public String getColumnName() { return TabsItems.get().columnTypeID(); @@ -165,9 +164,9 @@ public Object getColumnValue(final Item from) { }; private final Class type; private final Comparator comparator; - private ItemTableFormat(final Class type, final Comparator comparator) { + private ItemTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/jobs/IndustryJobTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/jobs/IndustryJobTableFormat.java index d80579c1f..298e8cb5a 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/jobs/IndustryJobTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/jobs/IndustryJobTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.jobs; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import java.util.Date; import net.nikr.eve.jeveasset.data.api.my.MyIndustryJob; @@ -31,7 +30,7 @@ public enum IndustryJobTableFormat implements EnumTableColumn { - STATE(String.class, GlazedLists.comparableComparator()) { + STATE(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnState(); @@ -41,7 +40,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getStatusFormatted(); } }, - ACTIVITY(String.class, GlazedLists.comparableComparator()) { + ACTIVITY(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnActivity(); @@ -51,7 +50,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getActivity(); } }, - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnName(); @@ -61,7 +60,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getName(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnOwner(); @@ -71,7 +70,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getOwnerName(); } }, - INSTALLER(String.class, GlazedLists.comparableComparator()) { + INSTALLER(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnInstaller(); @@ -81,7 +80,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getInstaller(); } }, - OWNED(YesNo.class, GlazedLists.comparableComparator()) { + OWNED(YesNo.class) { @Override public String getColumnName() { return TabsJobs.get().columnOwned(); @@ -95,7 +94,7 @@ public Object getColumnValue(final MyIndustryJob from) { return new YesNo(from.isOwned()); } }, - COMPLETED_CHARACTER(String.class, GlazedLists.comparableComparator()) { + COMPLETED_CHARACTER(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnCompletedCharacter(); @@ -105,7 +104,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getCompletedCharacter(); } }, - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnLocation(); @@ -115,7 +114,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getLocation().getLocation(); } }, - SYSTEM(String.class, GlazedLists.comparableComparator()) { + SYSTEM(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnSystem(); @@ -125,7 +124,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getLocation().getSystem(); } }, - CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnConstellation(); @@ -135,7 +134,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getLocation().getConstellation(); } }, - REGION(String.class, GlazedLists.comparableComparator()) { + REGION(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnRegion(); @@ -145,7 +144,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getLocation().getRegion(); } }, - START_DATE(Date.class, GlazedLists.comparableComparator()) { + START_DATE(Date.class) { @Override public String getColumnName() { return TabsJobs.get().columnStartDate(); @@ -155,7 +154,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getStartDate(); } }, - END_DATE(Date.class, GlazedLists.comparableComparator()) { + END_DATE(Date.class) { @Override public String getColumnName() { return TabsJobs.get().columnEndDate(); @@ -165,7 +164,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getEndDate(); } }, - COMPLETED_DATE(Date.class, GlazedLists.comparableComparator()) { + COMPLETED_DATE(Date.class) { @Override public String getColumnName() { return TabsJobs.get().columnCompletedDate(); @@ -175,7 +174,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getCompletedDate(); } }, - PAUSE_DATE(Date.class, GlazedLists.comparableComparator()) { + PAUSE_DATE(Date.class) { @Override public String getColumnName() { return TabsJobs.get().columnPauseDate(); @@ -185,7 +184,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getPauseDate(); } }, - RUNS(Integer.class, GlazedLists.comparableComparator()) { + RUNS(Integer.class) { @Override public String getColumnName() { return TabsJobs.get().columnRuns(); @@ -195,7 +194,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getRuns(); } }, - OUTPUT_COUNT(Integer.class, GlazedLists.comparableComparator()) { + OUTPUT_COUNT(Integer.class) { @Override public String getColumnName() { return TabsJobs.get().columnOutputCount(); @@ -205,7 +204,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getOutputCount(); } }, - OUTPUT_VALUE(Double.class, GlazedLists.comparableComparator()) { + OUTPUT_VALUE(Double.class) { @Override public String getColumnName() { return TabsJobs.get().columnOutputValue(); @@ -215,7 +214,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getOutputValue(); } }, - OUTPUT_VOLUME(Double.class, GlazedLists.comparableComparator()) { + OUTPUT_VOLUME(Double.class) { @Override public String getColumnName() { return TabsJobs.get().columnOutputVolume(); @@ -229,7 +228,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getOutputVolume(); } }, - OUTPUT_TYPE(String.class, GlazedLists.comparableComparator()) { + OUTPUT_TYPE(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnOutputType(); @@ -239,7 +238,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getOutputType(); } }, - BPO(String.class, GlazedLists.comparableComparator()) { + BPO(String.class) { @Override public String getColumnName() { return TabsJobs.get().columnBPO(); @@ -253,7 +252,7 @@ public Object getColumnValue(final MyIndustryJob from) { } } }, - MATERIAL_EFFICIENCY(Integer.class, GlazedLists.comparableComparator()) { + MATERIAL_EFFICIENCY(Integer.class) { @Override public String getColumnName() { return TabsJobs.get().columnMaterialEfficiency(); @@ -263,7 +262,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getMaterialEfficiency(); } }, - TIME_EFFICIENCY(Integer.class, GlazedLists.comparableComparator()) { + TIME_EFFICIENCY(Integer.class) { @Override public String getColumnName() { return TabsJobs.get().columnTimeEfficiency(); @@ -273,7 +272,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getTimeEfficiency(); } }, - COST(Double.class, GlazedLists.comparableComparator()) { + COST(Double.class) { @Override public String getColumnName() { return TabsJobs.get().columnCost(); @@ -283,7 +282,7 @@ public Object getColumnValue(final MyIndustryJob from) { return from.getCost(); } }, - JOB_ID(Integer.class, GlazedLists.comparableComparator()) { + JOB_ID(Integer.class) { @Override public String getColumnName() { return TabsJobs.get().columnJobID(); @@ -300,9 +299,9 @@ public boolean isShowDefault() { private final Class type; private final Comparator comparator; - private IndustryJobTableFormat(final Class type, final Comparator comparator) { + private IndustryJobTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/journal/JournalTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/journal/JournalTableFormat.java index f52bd7446..6333865b3 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/journal/JournalTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/journal/JournalTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.journal; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import java.util.Date; import net.nikr.eve.jeveasset.data.api.my.MyJournal; @@ -32,7 +31,7 @@ public enum JournalTableFormat implements EnumTableColumn { - DATE(Date.class, GlazedLists.comparableComparator()) { + DATE(Date.class) { @Override public String getColumnName() { return TabsJournal.get().columnDate(); @@ -42,7 +41,7 @@ public Object getColumnValue(final MyJournal from) { return from.getDate(); } }, - TAGS(Tags.class, GlazedLists.comparableComparator()) { + TAGS(Tags.class) { @Override public String getColumnName() { return TabsJournal.get().columnTags(); @@ -52,7 +51,7 @@ public Object getColumnValue(final MyJournal from) { return from.getTags(); } }, - ADDED(Date.class, GlazedLists.comparableComparator()) { + ADDED(Date.class) { @Override public String getColumnName() { return TabsJournal.get().columnAdded(); @@ -66,7 +65,7 @@ public Object getColumnValue(final MyJournal from) { return from.getAdded(); } }, - REF_TYPE(String.class, GlazedLists.comparableComparator()) { + REF_TYPE(String.class) { @Override public String getColumnName() { return TabsJournal.get().columnRefType(); @@ -76,7 +75,7 @@ public Object getColumnValue(final MyJournal from) { return from.getRefTypeFormatted(); } }, - AMOUNT(Double.class, GlazedLists.comparableComparator()) { + AMOUNT(Double.class) { @Override public String getColumnName() { return TabsJournal.get().columnAmount(); @@ -86,7 +85,7 @@ public Object getColumnValue(final MyJournal from) { return from.getAmount(); } }, - BALANCE(Double.class, GlazedLists.comparableComparator()) { + BALANCE(Double.class) { @Override public String getColumnName() { return TabsJournal.get().columnBalance(); @@ -96,7 +95,7 @@ public Object getColumnValue(final MyJournal from) { return from.getBalance(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsJournal.get().columnOwner(); @@ -106,7 +105,7 @@ public Object getColumnValue(final MyJournal from) { return from.getOwnerName(); } }, - OWNER_NAME_1(String.class, GlazedLists.comparableComparator()) { + OWNER_NAME_1(String.class) { @Override public String getColumnName() { return TabsJournal.get().columnOwnerName1(); @@ -116,7 +115,7 @@ public Object getColumnValue(final MyJournal from) { return from.getFirstPartyName(); } }, - OWNER_NAME_2(String.class, GlazedLists.comparableComparator()) { + OWNER_NAME_2(String.class) { @Override public String getColumnName() { return TabsJournal.get().columnOwnerName2(); @@ -126,7 +125,7 @@ public Object getColumnValue(final MyJournal from) { return from.getSecondPartyName(); } }, - ACCOUNT_KEY(Integer.class, GlazedLists.comparableComparator()) { + ACCOUNT_KEY(Integer.class) { @Override public String getColumnName() { return TabsJournal.get().columnAccountKey(); @@ -136,7 +135,7 @@ public Object getColumnValue(final MyJournal from) { return from.getAccountKeyFormatted(); } }, - TAX_AMOUNT(Double.class, GlazedLists.comparableComparator()) { + TAX_AMOUNT(Double.class) { @Override public String getColumnName() { return TabsJournal.get().columnTaxAmount(); @@ -146,7 +145,7 @@ public Object getColumnValue(final MyJournal from) { return from.getTaxAmount(); } }, - REASON(String.class, GlazedLists.comparableComparator()) { + REASON(String.class) { @Override public String getColumnName() { return TabsJournal.get().columnReason(); @@ -156,7 +155,7 @@ public Object getColumnValue(final MyJournal from) { return from.getReason(); } }, - CONTEXT_NAME(String.class, GlazedLists.comparableComparator()) { + CONTEXT_NAME(String.class) { @Override public String getColumnName() { return TabsJournal.get().columnContextName(); @@ -166,7 +165,7 @@ public Object getColumnValue(final MyJournal from) { return from.getContext(); } }, - CONTEXT_TYPE(String.class, GlazedLists.comparableComparator()) { + CONTEXT_TYPE(String.class) { @Override public String getColumnName() { return TabsJournal.get().columnContextType(); @@ -180,7 +179,7 @@ public boolean isShowDefault() { return false; } }, - CONTEXT_ID(LongInt.class, GlazedLists.comparableComparator()) { + CONTEXT_ID(LongInt.class) { @Override public String getColumnName() { return TabsJournal.get().columnContextID(); @@ -196,9 +195,9 @@ public boolean isShowDefault() { }; private final Class type; private final Comparator comparator; - private JournalTableFormat(final Class type, final Comparator comparator) { + private JournalTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutExtendedTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutExtendedTableFormat.java index 8d0b82895..0ac600c78 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutExtendedTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutExtendedTableFormat.java @@ -21,14 +21,13 @@ package net.nikr.eve.jeveasset.gui.tabs.loadout; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.i18n.TabsLoadout; public enum LoadoutExtendedTableFormat implements EnumTableColumn { - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsLoadout.get().columnLocation(); @@ -38,7 +37,7 @@ public Object getColumnValue(final Loadout from) { return from.getLocation().getLocation(); } }, - SLOT(String.class, GlazedLists.comparableComparator()) { + SLOT(String.class) { @Override public String getColumnName() { return TabsLoadout.get().columnSlot(); @@ -48,7 +47,7 @@ public Object getColumnValue(final Loadout from) { return from.getFlag(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsLoadout.get().columnOwner(); @@ -58,7 +57,7 @@ public Object getColumnValue(final Loadout from) { return from.getOwnerName(); } }, - SHIP(String.class, GlazedLists.comparableComparator()) { + SHIP(String.class) { @Override public String getColumnName() { return TabsLoadout.get().columnShip(); @@ -71,9 +70,9 @@ public Object getColumnValue(final Loadout from) { private final Class type; private final Comparator comparator; - private LoadoutExtendedTableFormat(final Class type, final Comparator comparator) { + private LoadoutExtendedTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutTableFormat.java index a8444b0ea..debc34288 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/loadout/LoadoutTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.loadout; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.gui.shared.table.containers.ModulePriceValue; @@ -32,7 +31,7 @@ * @author Candle */ public enum LoadoutTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsLoadout.get().columnName(); @@ -42,7 +41,7 @@ public Object getColumnValue(final Loadout from) { return from.getName(); } }, - VALUE(ModulePriceValue.class, GlazedLists.comparableComparator()) { + VALUE(ModulePriceValue.class) { @Override public String getColumnName() { return TabsLoadout.get().columnValue(); @@ -55,9 +54,9 @@ public Object getColumnValue(final Loadout from) { private final Class type; private final Comparator comparator; - private LoadoutTableFormat(final Class type, final Comparator comparator) { + private LoadoutTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialExtendedTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialExtendedTableFormat.java index c754c7e1f..703593836 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialExtendedTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialExtendedTableFormat.java @@ -21,14 +21,13 @@ package net.nikr.eve.jeveasset.gui.tabs.materials; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.i18n.TabsMaterials; public enum MaterialExtendedTableFormat implements EnumTableColumn { - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsMaterials.get().columnLocation(); @@ -38,7 +37,7 @@ public Object getColumnValue(final Material from) { return from.getHeader(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsMaterials.get().columnGroup(); @@ -51,9 +50,9 @@ public Object getColumnValue(final Material from) { private final Class type; private final Comparator comparator; - private MaterialExtendedTableFormat(final Class type, final Comparator comparator) { + private MaterialExtendedTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialTableFormat.java index f05479c51..7e997bee4 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/materials/MaterialTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.materials; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.Formatter; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; @@ -30,7 +29,7 @@ public enum MaterialTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsMaterials.get().columnName(); @@ -40,7 +39,7 @@ public Object getColumnValue(final Material from) { return from.getName(); } }, - COUNT(Long.class, GlazedLists.comparableComparator()) { + COUNT(Long.class) { @Override public String getColumnName() { return TabsMaterials.get().columnCount(); @@ -50,7 +49,7 @@ public Object getColumnValue(final Material from) { return from.getCount(); } }, - PRICE(ISK.class, GlazedLists.comparableComparator()) { + PRICE(ISK.class) { @Override public String getColumnName() { return TabsMaterials.get().columnPrice(); @@ -64,7 +63,7 @@ public Object getColumnValue(final Material from) { } } }, - VALUE(ISK.class, GlazedLists.comparableComparator()) { + VALUE(ISK.class) { @Override public String getColumnName() { return TabsMaterials.get().columnValue(); @@ -74,7 +73,7 @@ public Object getColumnValue(final Material from) { return new ISK(Formatter.iskFormat(from.getValue()), from.getValue()); } }, - TYPE_ID(Integer.class, GlazedLists.comparableComparator()) { + TYPE_ID(Integer.class) { @Override public String getColumnName() { return TabsMaterials.get().columnTypeID(); @@ -92,9 +91,9 @@ public boolean isShowDefault() { private final Class type; private final Comparator comparator; - private MaterialTableFormat(final Class type, final Comparator comparator) { + private MaterialTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/ExtractionsTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/ExtractionsTableFormat.java index 0df105809..b61bfa06b 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/ExtractionsTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/ExtractionsTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.mining; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import java.util.Date; import net.nikr.eve.jeveasset.data.api.my.MyExtraction; @@ -30,7 +29,7 @@ public enum ExtractionsTableFormat implements EnumTableColumn { - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsMining.get().columnLocation(); @@ -40,7 +39,7 @@ public Object getColumnValue(final MyExtraction from) { return from.getLocation().getLocation(); } }, - MOON(String.class, GlazedLists.comparableComparator()) { + MOON(String.class) { @Override public String getColumnName() { return TabsMining.get().columnMoon(); @@ -50,7 +49,7 @@ public Object getColumnValue(final MyExtraction from) { return from.getMoon().getLocation(); } }, - START(Date.class, GlazedLists.comparableComparator()) { + START(Date.class) { @Override public String getColumnName() { return TabsMining.get().columnExtractionStartTime(); @@ -60,7 +59,7 @@ public Object getColumnValue(final MyExtraction from) { return from.getExtractionStartTime(); } }, - ARRIVAL(Date.class, GlazedLists.comparableComparator()) { + ARRIVAL(Date.class) { @Override public String getColumnName() { return TabsMining.get().columnChunkArrivalTime(); @@ -70,7 +69,7 @@ public Object getColumnValue(final MyExtraction from) { return from.getChunkArrivalTime(); } }, - DECAY(Date.class, GlazedLists.comparableComparator()) { + DECAY(Date.class) { @Override public String getColumnName() { return TabsMining.get().columnNaturalDecayTime(); @@ -84,9 +83,9 @@ public Object getColumnValue(final MyExtraction from) { private final Class type; private final Comparator comparator; - private ExtractionsTableFormat(final Class type, final Comparator comparator) { + private ExtractionsTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/MiningTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/MiningTableFormat.java index 445715460..9e2d967c2 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/MiningTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/mining/MiningTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.mining; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.data.api.my.MyMining; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; @@ -30,7 +29,7 @@ public enum MiningTableFormat implements EnumTableColumn { - DATE(DateOnly.class, GlazedLists.comparableComparator()) { + DATE(DateOnly.class) { @Override public String getColumnName() { return TabsMining.get().columnDate(); @@ -40,7 +39,7 @@ public Object getColumnValue(final MyMining from) { return from.getDateOnly(); } }, - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsMining.get().columnName(); @@ -50,7 +49,7 @@ public Object getColumnValue(final MyMining from) { return from.getItem().getTypeName(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsMining.get().columnGroup(); @@ -60,7 +59,7 @@ public Object getColumnValue(final MyMining from) { return from.getItem().getGroup(); } }, - CATEGORY(String.class, GlazedLists.comparableComparator()) { + CATEGORY(String.class) { @Override public String getColumnName() { return TabsMining.get().columnCategory(); @@ -70,7 +69,7 @@ public Object getColumnValue(final MyMining from) { return from.getItem().getCategory(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsMining.get().columnOwner(); @@ -80,7 +79,7 @@ public Object getColumnValue(final MyMining from) { return from.getCharacterName(); } }, - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsMining.get().columnLocation(); @@ -90,7 +89,7 @@ public Object getColumnValue(final MyMining from) { return from.getLocation().getLocation(); } }, - COUNT(Long.class, GlazedLists.comparableComparator()) { + COUNT(Long.class) { @Override public String getColumnName() { return TabsMining.get().columnCount(); @@ -100,7 +99,7 @@ public Object getColumnValue(final MyMining from) { return from.getCount(); } }, - PRICE_ORE(Double.class, GlazedLists.comparableComparator()) { + PRICE_ORE(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnPriceOre(); @@ -110,7 +109,7 @@ public Object getColumnValue(final MyMining from) { return from.getDynamicPrice(); } }, - PRICE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnPriceReprocessed(); @@ -124,7 +123,7 @@ public Object getColumnValue(final MyMining from) { return from.getPriceReprocessed(); } }, - PRICE_REPROCESSED_MAX(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED_MAX(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnPriceReprocessedMax(); @@ -138,7 +137,7 @@ public Object getColumnValue(final MyMining from) { return from.getPriceReprocessedMax(); } }, - VALUE_ORE(Double.class, GlazedLists.comparableComparator()) { + VALUE_ORE(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnValueOre(); @@ -148,7 +147,7 @@ public Object getColumnValue(final MyMining from) { return from.getValue(); } }, - VALUE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + VALUE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnValueReprocessed(); @@ -163,7 +162,7 @@ public Object getColumnValue(final MyMining from) { } }, - VALUE_REPROCESSED_MAX(Double.class, GlazedLists.comparableComparator()) { + VALUE_REPROCESSED_MAX(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnValueReprocessedMax(); @@ -177,7 +176,7 @@ public Object getColumnValue(final MyMining from) { return from.getValueReprocessedMax(); } }, - VOLUME(Double.class, GlazedLists.comparableComparator()) { + VOLUME(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnVolume(); @@ -187,7 +186,7 @@ public Object getColumnValue(final MyMining from) { return from.getVolumeTotal(); } }, - VALUE_PER_VOLUME_ORE(Double.class, GlazedLists.comparableComparator()) { + VALUE_PER_VOLUME_ORE(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnValuePerVolumeOre(); @@ -197,7 +196,7 @@ public Object getColumnValue(final MyMining from) { return from.getValuePerVolumeOre(); } }, - VALUE_PER_VOLUME_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + VALUE_PER_VOLUME_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnValuePerVolumeReprocessed(); @@ -211,7 +210,7 @@ public Object getColumnValue(final MyMining from) { return from.getValuePerVolumeReprocessed(); } }, - VALUE_PER_VOLUME_REPROCESSED_MAX(Double.class, GlazedLists.comparableComparator()) { + VALUE_PER_VOLUME_REPROCESSED_MAX(Double.class) { @Override public String getColumnName() { return TabsMining.get().columnValuePerVolumeReprocessedMax(); @@ -225,7 +224,7 @@ public Object getColumnValue(final MyMining from) { return from.getValuePerVolumeReprocessedMax(); } }, - CORPORATION(String.class, GlazedLists.comparableComparator()) { + CORPORATION(String.class) { @Override public String getColumnName() { return TabsMining.get().columnCorporation(); @@ -235,7 +234,7 @@ public Object getColumnValue(final MyMining from) { return from.getCorporationName(); } }, - FOR_CORPORATION(String.class, GlazedLists.comparableComparator()) { + FOR_CORPORATION(String.class) { @Override public String getColumnName() { return TabsMining.get().columnForCorporation(); @@ -249,9 +248,9 @@ public Object getColumnValue(final MyMining from) { private final Class type; private final Comparator comparator; - private MiningTableFormat(final Class type, final Comparator comparator) { + private MiningTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/MarketTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/MarketTableFormat.java index 0c2b3b0ff..aa94e3d05 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/MarketTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/orders/MarketTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.orders; -import ca.odell.glazedlists.GlazedLists; import java.awt.Component; import java.util.Comparator; import java.util.Date; @@ -34,7 +33,7 @@ public enum MarketTableFormat implements EnumTableColumn { - ORDER_TYPE(String.class, GlazedLists.comparableComparator()) { + ORDER_TYPE(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnOrderType(); @@ -48,7 +47,7 @@ public Object getColumnValue(final MyMarketOrder from) { } } }, - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnName(); @@ -58,7 +57,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getItem().getTypeName(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnGroup(); @@ -68,7 +67,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getItem().getGroup(); } }, - QUANTITY(Integer.class, GlazedLists.comparableComparator()) { + QUANTITY(Integer.class) { @Override public String getColumnName() { return TabsOrders.get().columnVolumeRemain(); @@ -78,7 +77,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getVolumeRemain(); } }, - QUANTITY_ENTERED(Integer.class, GlazedLists.comparableComparator()) { + QUANTITY_ENTERED(Integer.class) { @Override public String getColumnName() { return TabsOrders.get().columnVolumeTotal(); @@ -88,7 +87,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getVolumeTotal(); } }, - PRICE(Double.class, GlazedLists.comparableComparator()) { + PRICE(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnPrice(); @@ -98,7 +97,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getPrice(); } }, - OUTBID_PRICE(Double.class, GlazedLists.comparableComparator()) { + OUTBID_PRICE(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnOutbidPrice(); @@ -112,7 +111,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getOutbidPrice(); } }, - OUTBID_COUNT(Long.class, GlazedLists.comparableComparator()) { + OUTBID_COUNT(Long.class) { @Override public String getColumnName() { return TabsOrders.get().columnOutbidCount(); @@ -126,7 +125,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getOutbidCount(); } }, - OUTBID_DELTA(Double.class, GlazedLists.comparableComparator()) { + OUTBID_DELTA(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnOutbidDelta(); @@ -140,7 +139,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getOutbidDelta(); } }, - EVE_UI(Component.class, GlazedLists.comparableComparator()) { + EVE_UI(Component.class) { @Override public String getColumnName() { return TabsOrders.get().columnEveUi(); @@ -153,13 +152,12 @@ public String getColumnToolTip() { public boolean isColumnEditable(Object baseObject) { return true; } - @Override public Object getColumnValue(final MyMarketOrder from) { return from.getButton(); } }, - BROKERS_FEE(Double.class, GlazedLists.comparableComparator()) { + BROKERS_FEE(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnBrokersFee(); @@ -173,7 +171,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getBrokersFee(); } }, - EDITS(Integer.class, GlazedLists.comparableComparator()) { + EDITS(Integer.class) { @Override public String getColumnName() { return TabsOrders.get().columnEdits(); @@ -187,7 +185,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getEdits(); } }, - PRICE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnPriceReprocessed(); @@ -197,7 +195,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getPriceReprocessed(); } }, - PRICE_MANUFACTURING(Double.class, GlazedLists.comparableComparator()) { + PRICE_MANUFACTURING(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnPriceManufacturing(); @@ -211,7 +209,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getItem().getPriceManufacturing(); } }, - ISSUED(Date.class, GlazedLists.comparableComparator()) { + ISSUED(Date.class) { @Override public String getColumnName() { return TabsOrders.get().columnIssued(); @@ -225,7 +223,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getIssued(); } }, - ISSUED_FIRST(Date.class, GlazedLists.comparableComparator()) { + ISSUED_FIRST(Date.class) { @Override public String getColumnName() { return TabsOrders.get().columnIssuedFirst(); @@ -239,7 +237,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getCreatedOrIssued(); } }, - EXPIRES(Date.class, GlazedLists.comparableComparator()) { + EXPIRES(Date.class) { @Override public String getColumnName() { return TabsOrders.get().columnExpires(); @@ -249,7 +247,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getExpires(); } }, - CHANGED(Date.class, GlazedLists.comparableComparator()) { + CHANGED(Date.class) { @Override public String getColumnName() { return TabsOrders.get().columnChanged(); @@ -263,7 +261,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getChanged(); } }, - RANGE(String.class, GlazedLists.comparableComparator()) { + RANGE(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnRange(); @@ -273,7 +271,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getRange().toString(); } }, - STATUS(String.class, GlazedLists.comparableComparator()) { + STATUS(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnStatus(); @@ -283,7 +281,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getStateFormatted(); } }, - MIN_VOLUME(Integer.class, GlazedLists.comparableComparator()) { + MIN_VOLUME(Integer.class) { @Override public String getColumnName() { return TabsOrders.get().columnMinimumQuantity(); @@ -293,7 +291,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getMinVolume(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnOwner(); @@ -303,7 +301,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getOwnerName(); } }, - ISSUED_BY(String.class, GlazedLists.comparableComparator()) { + ISSUED_BY(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnIssuedBy(); @@ -313,7 +311,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getIssuedByName(); } }, - OWNED(YesNo.class, GlazedLists.comparableComparator()) { + OWNED(YesNo.class) { @Override public String getColumnName() { return TabsOrders.get().columnOwned(); @@ -327,7 +325,7 @@ public Object getColumnValue(final MyMarketOrder from) { return new YesNo(from.isOwned()); } }, - WalletDivision(Integer.class, GlazedLists.comparableComparator()) { + WalletDivision(Integer.class) { @Override public String getColumnName() { return TabsOrders.get().columnWalletDivision(); @@ -337,7 +335,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getWalletDivision(); } }, - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnLocation(); @@ -347,7 +345,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getLocation().getLocation(); } }, - SYSTEM(String.class, GlazedLists.comparableComparator()) { + SYSTEM(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnSystem(); @@ -357,7 +355,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getLocation().getSystem(); } }, - CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnConstellation(); @@ -367,7 +365,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getLocation().getConstellation(); } }, - REGION(String.class, GlazedLists.comparableComparator()) { + REGION(String.class) { @Override public String getColumnName() { return TabsOrders.get().columnRegion(); @@ -377,7 +375,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getLocation().getRegion(); } }, - VALUE(Double.class, GlazedLists.comparableComparator()) { + VALUE(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnRemainingValue(); @@ -387,7 +385,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getVolumeRemain() * from.getPrice(); } }, - TRANSACTION_PRICE(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnTransactionPrice(); @@ -401,7 +399,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getTransactionPrice(); } }, - TRANSACTION_MARGIN(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_MARGIN(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnTransactionMargin(); @@ -415,7 +413,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getTransactionMargin(); } }, - TRANSACTION_PROFIT(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PROFIT(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnTransactionProfitDifference(); @@ -429,7 +427,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getTransactionProfitDifference(); } }, - TRANSACTION_PROFIT_PERCENT(Percent.class, GlazedLists.comparableComparator()) { + TRANSACTION_PROFIT_PERCENT(Percent.class) { @Override public String getColumnName() { return TabsOrders.get().columnTransactionProfitPercent(); @@ -443,7 +441,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getTransactionProfitPercent(); } }, - MARKET_PRICE(Double.class, GlazedLists.comparableComparator()) { + MARKET_PRICE(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnMarketPrice(); @@ -457,7 +455,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getDynamicPrice(); } }, - MARKET_PRICE_SELL_MIN(Double.class, GlazedLists.comparableComparator()) { + MARKET_PRICE_SELL_MIN(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnMarketPriceSellMin(); @@ -471,7 +469,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getPriceSellMin(); } }, - MARKET_PRICE_BUY_MAX(Double.class, GlazedLists.comparableComparator()) { + MARKET_PRICE_BUY_MAX(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnMarketPriceBuyMax(); @@ -485,7 +483,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getPriceBuyMax(); } }, - MARKET_MARGIN(Percent.class, GlazedLists.comparableComparator()) { + MARKET_MARGIN(Percent.class) { @Override public String getColumnName() { return TabsOrders.get().columnMarketMargin(); @@ -499,7 +497,7 @@ public Object getColumnValue(final MyMarketOrder from) { return Percent.create(from.getMarketMargin()); } }, - MARKET_PROFIT(Double.class, GlazedLists.comparableComparator()) { + MARKET_PROFIT(Double.class) { @Override public String getColumnName() { return TabsOrders.get().columnMarketProfit(); @@ -513,7 +511,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getMarketProfit(); } }, - VOLUME(Float.class, GlazedLists.comparableComparator()) { + VOLUME(Float.class) { @Override public String getColumnName() { return TabsOrders.get().columnVolume(); @@ -523,7 +521,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getItem().getVolumePackaged(); } }, - TYPE_ID(Integer.class, GlazedLists.comparableComparator()) { + TYPE_ID(Integer.class) { @Override public String getColumnName() { return TabsOrders.get().columnTypeID(); @@ -533,7 +531,7 @@ public Object getColumnValue(final MyMarketOrder from) { return from.getTypeID(); } }, - ORDER_ID(LongInt.class, GlazedLists.comparableComparator()) { + ORDER_ID(LongInt.class) { @Override public String getColumnName() { return TabsOrders.get().columnOrderID(); @@ -551,9 +549,9 @@ public boolean isShowDefault() { private final Class type; private final Comparator comparator; - private MarketTableFormat(final Class type, final Comparator comparator) { + private MarketTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/overview/OverviewTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/overview/OverviewTableFormat.java index efb15919d..51ce44149 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/overview/OverviewTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/overview/OverviewTableFormat.java @@ -22,7 +22,6 @@ package net.nikr.eve.jeveasset.gui.tabs.overview; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.gui.shared.table.containers.Security; @@ -30,7 +29,7 @@ public enum OverviewTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsOverview.get().columnName(); @@ -40,7 +39,7 @@ public Object getColumnValue(final Overview from) { return from.getName(); } }, - SYSTEM(String.class, GlazedLists.comparableComparator()) { + SYSTEM(String.class) { @Override public String getColumnName() { return TabsOverview.get().columnSystem(); @@ -50,7 +49,7 @@ public Object getColumnValue(final Overview from) { return from.getLocation().getSystem(); } }, - CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsOverview.get().columnConstellation(); @@ -60,7 +59,7 @@ public Object getColumnValue(final Overview from) { return from.getLocation().getConstellation(); } }, - REGION(String.class, GlazedLists.comparableComparator()) { + REGION(String.class) { @Override public String getColumnName() { return TabsOverview.get().columnRegion(); @@ -70,7 +69,7 @@ public Object getColumnValue(final Overview from) { return from.getLocation().getRegion(); } }, - SECURITY(Security.class, GlazedLists.comparableComparator()) { + SECURITY(Security.class) { @Override public String getColumnName() { return TabsOverview.get().columnSecurity(); @@ -80,7 +79,7 @@ public Object getColumnValue(final Overview from) { return from.getLocation().getSecurityObject(); } }, - VOLUME(Double.class, GlazedLists.comparableComparator()) { + VOLUME(Double.class) { @Override public String getColumnName() { return TabsOverview.get().columnVolume(); @@ -90,7 +89,7 @@ public Object getColumnValue(final Overview from) { return from.getVolumeTotal(); } }, - VALUE(Double.class, GlazedLists.comparableComparator()) { + VALUE(Double.class) { @Override public String getColumnName() { return TabsOverview.get().columnValue(); @@ -100,7 +99,7 @@ public Object getColumnValue(final Overview from) { return from.getValue(); } }, - VALUE_PER_VOLUME(Double.class, GlazedLists.comparableComparator()) { + VALUE_PER_VOLUME(Double.class) { @Override public String getColumnName() { return TabsOverview.get().columnValuePerVolume(); @@ -110,7 +109,7 @@ public Object getColumnValue(final Overview from) { return from.getValuePerVolume(); } }, - COUNT(Long.class, GlazedLists.comparableComparator()) { + COUNT(Long.class) { @Override public String getColumnName() { return TabsOverview.get().columnCount(); @@ -120,7 +119,7 @@ public Object getColumnValue(final Overview from) { return from.getCount(); } }, - AVERAGE_VALUE(Double.class, GlazedLists.comparableComparator()) { + AVERAGE_VALUE(Double.class) { @Override public String getColumnName() { return TabsOverview.get().columnAverageValue(); @@ -130,7 +129,7 @@ public Object getColumnValue(final Overview from) { return from.getAverageValue(); } }, - REPROCESSED_VALUE(Double.class, GlazedLists.comparableComparator()) { + REPROCESSED_VALUE(Double.class) { @Override public String getColumnName() { return TabsOverview.get().columnReprocessedValue(); @@ -142,9 +141,9 @@ public Object getColumnValue(final Overview from) { }; private final Class type; private final Comparator comparator; - private OverviewTableFormat(final Class type, final Comparator comparator) { + private OverviewTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTab.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTab.java index 08105e796..315da21ec 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTab.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTab.java @@ -415,7 +415,7 @@ public static class PriceChange implements ItemType, EditablePriceType, Comparab private double priceTo; - public PriceChange(int typeID, Item item, Long count) throws ParseException { + public PriceChange(int typeID, Item item, Long count) { this.typeID = typeID; this.item = item; this.count = count; diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTableFormat.java index 9f70155da..2db6efd23 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/prices/PriceChangesTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.prices; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.gui.shared.table.containers.Percent; @@ -30,7 +29,7 @@ public enum PriceChangesTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnName(); @@ -40,7 +39,7 @@ public Object getColumnValue(final PriceChange from) { return from.getItem().getTypeName(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnGroup(); @@ -50,7 +49,7 @@ public Object getColumnValue(final PriceChange from) { return from.getItem().getGroup(); } }, - CATEGORY(String.class, GlazedLists.comparableComparator()) { + CATEGORY(String.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnCategory(); @@ -60,7 +59,7 @@ public Object getColumnValue(final PriceChange from) { return from.getItem().getCategory(); } }, - COUNT(Long.class, GlazedLists.comparableComparator()) { + COUNT(Long.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnCount(); @@ -74,7 +73,7 @@ public Object getColumnValue(final PriceChange from) { return from.getItemCount(); } }, - PRICE_FROM(Double.class, GlazedLists.comparableComparator()) { + PRICE_FROM(Double.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnPriceFrom(); @@ -84,7 +83,7 @@ public Object getColumnValue(final PriceChange from) { return from.getPriceFrom(); } }, - PRICE_TO(Double.class, GlazedLists.comparableComparator()) { + PRICE_TO(Double.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnPriceTo(); @@ -94,7 +93,7 @@ public Object getColumnValue(final PriceChange from) { return from.getPriceTo(); } }, - PRICE_CHANGE_PERCENT(Percent.class, GlazedLists.comparableComparator()) { + PRICE_CHANGE_PERCENT(Percent.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnChangePercent(); @@ -108,7 +107,7 @@ public Object getColumnValue(final PriceChange from) { return from.getChangePercent(); } }, - PRICE_CHANGE(Double.class, GlazedLists.comparableComparator()) { + PRICE_CHANGE(Double.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnChange(); @@ -122,7 +121,7 @@ public Object getColumnValue(final PriceChange from) { return from.getChange(); } }, - PRICE_TOTAL(Double.class, GlazedLists.comparableComparator()) { + PRICE_TOTAL(Double.class) { @Override public String getColumnName() { return TabsPriceChanges.get().columnTotal(); @@ -142,9 +141,9 @@ public Object getColumnValue(final PriceChange from) { private final Class type; private final Comparator comparator; - private PriceChangesTableFormat(final Class type, final Comparator comparator) { + private PriceChangesTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedExtendedTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedExtendedTableFormat.java index 1eee65ece..2add3b285 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedExtendedTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedExtendedTableFormat.java @@ -21,14 +21,13 @@ package net.nikr.eve.jeveasset.gui.tabs.reprocessed; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.i18n.TabsReprocessed; public enum ReprocessedExtendedTableFormat implements EnumTableColumn { - TOTAL_NAME(String.class, GlazedLists.comparableComparator()) { + TOTAL_NAME(String.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnTotalName(); @@ -38,7 +37,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getTotal().getTypeName(); } }, - TOTAL_PRICE(Double.class, GlazedLists.comparableComparator()) { + TOTAL_PRICE(Double.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnTotalPrice(); @@ -48,7 +47,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getTotal().getSellPrice(); } }, - TOTAL_VALUE(Double.class, GlazedLists.comparableComparator()) { + TOTAL_VALUE(Double.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnTotalValue(); @@ -58,7 +57,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getTotal().getValue(); } }, - TOTAL_BATCH(Long.class, GlazedLists.comparableComparator()) { + TOTAL_BATCH(Long.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnTotalBatch(); @@ -71,9 +70,9 @@ public Object getColumnValue(final ReprocessedInterface from) { private final Class type; private final Comparator comparator; - private ReprocessedExtendedTableFormat(final Class type, final Comparator comparator) { + private ReprocessedExtendedTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedTableFormat.java index 6f9f54dab..732649ec0 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/reprocessed/ReprocessedTableFormat.java @@ -21,14 +21,13 @@ package net.nikr.eve.jeveasset.gui.tabs.reprocessed; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.i18n.TabsReprocessed; public enum ReprocessedTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnName(); @@ -38,7 +37,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getName(); } }, - QUANTITY_100(Long.class, GlazedLists.comparableComparator()) { + QUANTITY_100(Long.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnQuantity100(); @@ -52,7 +51,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getQuantity100(); } }, - QUANTITY_MAX(Long.class, GlazedLists.comparableComparator()) { + QUANTITY_MAX(Long.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnQuantityMax(); @@ -66,7 +65,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getQuantityMax(); } }, - QUANTITY_SKILL(Long.class, GlazedLists.comparableComparator()) { + QUANTITY_SKILL(Long.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnQuantitySkill(); @@ -80,7 +79,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getQuantitySkill(); } }, - PRICE(Double.class, GlazedLists.comparableComparator()) { + PRICE(Double.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnPrice(); @@ -90,7 +89,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getDynamicPrice(); } }, - VALUE_MAX(Double.class, GlazedLists.comparableComparator()) { + VALUE_MAX(Double.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnValueMax(); @@ -100,7 +99,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getValueMax(); } }, - VALUE_SKILL(Double.class, GlazedLists.comparableComparator()) { + VALUE_SKILL(Double.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnValueSkill(); @@ -110,7 +109,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getValueSkill(); } }, - VALUE_DIFFERENCE(Double.class, GlazedLists.comparableComparator()) { + VALUE_DIFFERENCE(Double.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnValueDifference(); @@ -120,7 +119,7 @@ public Object getColumnValue(final ReprocessedInterface from) { return from.getValueDifference(); } }, - TYPE_ID(Integer.class, GlazedLists.comparableComparator()) { + TYPE_ID(Integer.class) { @Override public String getColumnName() { return TabsReprocessed.get().columnTypeID(); @@ -133,9 +132,9 @@ public Object getColumnValue(final ReprocessedInterface from) { private final Class type; private final Comparator comparator; - private ReprocessedTableFormat(final Class type, final Comparator comparator) { + private ReprocessedTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/skills/SkillsTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/skills/SkillsTableFormat.java index eb47ce595..657fdec27 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/skills/SkillsTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/skills/SkillsTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.skills; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.data.api.my.MySkill; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; @@ -29,7 +28,7 @@ public enum SkillsTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsSkills.get().columnSkill(); @@ -39,7 +38,7 @@ public Object getColumnValue(final MySkill from) { return from.getName(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsSkills.get().columnGroup(); @@ -49,7 +48,7 @@ public Object getColumnValue(final MySkill from) { return from.getItem().getGroup(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsSkills.get().columnCharacter(); @@ -59,7 +58,7 @@ public Object getColumnValue(final MySkill from) { return from.getOwnerName(); } }, - ACTIVE(Integer.class, GlazedLists.comparableComparator()) { + ACTIVE(Integer.class) { @Override public String getColumnName() { return TabsSkills.get().columnActive(); @@ -69,7 +68,7 @@ public Object getColumnValue(final MySkill from) { return from.getActiveSkillLevel(); } }, - TRAINED(Integer.class, GlazedLists.comparableComparator()) { + TRAINED(Integer.class) { @Override public String getColumnName() { return TabsSkills.get().columnTrained(); @@ -83,9 +82,9 @@ public Object getColumnValue(final MySkill from) { private final Class type; private final Comparator comparator; - private SkillsTableFormat(final Class type, final Comparator comparator) { + private SkillsTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/slots/SlotsTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/slots/SlotsTableFormat.java index 8b31cad3f..c4ab3c163 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/slots/SlotsTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/slots/SlotsTableFormat.java @@ -21,14 +21,13 @@ package net.nikr.eve.jeveasset.gui.tabs.slots; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.i18n.TabsSlots; public enum SlotsTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsSlots.get().columnOwner(); @@ -38,7 +37,7 @@ public Object getColumnValue(final Slots from) { return from.getName(); } }, - MANUFACTURING_DONE(Integer.class, GlazedLists.comparableComparator()) { + MANUFACTURING_DONE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnManufacturingDone(); @@ -52,7 +51,7 @@ public Object getColumnValue(final Slots from) { return from.getManufacturingDone(); } }, - MANUFACTURING_FREE(Integer.class, GlazedLists.comparableComparator()) { + MANUFACTURING_FREE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnManufacturingFree(); @@ -66,7 +65,7 @@ public Object getColumnValue(final Slots from) { return from.getManufacturingFree(); } }, - MANUFACTURING_ACTIVE(Integer.class, GlazedLists.comparableComparator()) { + MANUFACTURING_ACTIVE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnManufacturingActive(); @@ -80,7 +79,7 @@ public Object getColumnValue(final Slots from) { return from.getManufacturingActive(); } }, - MANUFACTURING_MAX(Integer.class, GlazedLists.comparableComparator()) { + MANUFACTURING_MAX(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnManufacturingMax(); @@ -94,7 +93,7 @@ public Object getColumnValue(final Slots from) { return from.getManufacturingMax(); } }, - RESEARCH_DONE(Integer.class, GlazedLists.comparableComparator()) { + RESEARCH_DONE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnResearchDone(); @@ -108,7 +107,7 @@ public Object getColumnValue(final Slots from) { return from.getResearchDone(); } }, - RESEARCH_FREE(Integer.class, GlazedLists.comparableComparator()) { + RESEARCH_FREE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnResearchFree(); @@ -122,7 +121,7 @@ public Object getColumnValue(final Slots from) { return from.getResearchFree(); } }, - RESEARCH_ACTIVE(Integer.class, GlazedLists.comparableComparator()) { + RESEARCH_ACTIVE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnResearchActive(); @@ -136,7 +135,7 @@ public Object getColumnValue(final Slots from) { return from.getResearchActive(); } }, - RESEARCH_MAX(Integer.class, GlazedLists.comparableComparator()) { + RESEARCH_MAX(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnResearchMax(); @@ -150,7 +149,7 @@ public Object getColumnValue(final Slots from) { return from.getResearchMax(); } }, - REACTIONS_DONE(Integer.class, GlazedLists.comparableComparator()) { + REACTIONS_DONE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnReactionsDone(); @@ -164,7 +163,7 @@ public Object getColumnValue(final Slots from) { return from.getReactionsDone(); } }, - REACTIONS_FREE(Integer.class, GlazedLists.comparableComparator()) { + REACTIONS_FREE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnReactionsFree(); @@ -178,7 +177,7 @@ public Object getColumnValue(final Slots from) { return from.getReactionsFree(); } }, - REACTIONS_ACTIVE(Integer.class, GlazedLists.comparableComparator()) { + REACTIONS_ACTIVE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnReactionsActive(); @@ -192,7 +191,7 @@ public Object getColumnValue(final Slots from) { return from.getReactionsActive(); } }, - REACTIONS_MAX(Integer.class, GlazedLists.comparableComparator()) { + REACTIONS_MAX(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnReactionsMax(); @@ -206,7 +205,7 @@ public Object getColumnValue(final Slots from) { return from.getReactionsMax(); } }, - MARKET_ORDERS_FREE(Integer.class, GlazedLists.comparableComparator()) { + MARKET_ORDERS_FREE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnMarketOrdersFree(); @@ -220,7 +219,7 @@ public Object getColumnValue(final Slots from) { return from.getMarketOrdersFree(); } }, - MARKET_ORDERS_ACTIVE(Integer.class, GlazedLists.comparableComparator()) { + MARKET_ORDERS_ACTIVE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnMarketOrdersActive(); @@ -234,7 +233,7 @@ public Object getColumnValue(final Slots from) { return from.getMarketOrdersActive(); } }, - MARKET_ORDERS_MAX(Integer.class, GlazedLists.comparableComparator()) { + MARKET_ORDERS_MAX(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnMarketOrdersMax(); @@ -248,7 +247,7 @@ public Object getColumnValue(final Slots from) { return from.getMarketOrdersMax(); } }, - CONTRACT_CHARACTER_FREE(Integer.class, GlazedLists.comparableComparator()) { + CONTRACT_CHARACTER_FREE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnContractCharacterFree(); @@ -262,7 +261,7 @@ public Object getColumnValue(final Slots from) { return from.getContractCharacterFree(); } }, - CONTRACT_CHARACTER_ACTIVE(Integer.class, GlazedLists.comparableComparator()) { + CONTRACT_CHARACTER_ACTIVE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnContractCharacterActive(); @@ -276,7 +275,7 @@ public Object getColumnValue(final Slots from) { return from.getContractCharacterActive(); } }, - CONTRACT_CHARACTER_MAX(Integer.class, GlazedLists.comparableComparator()) { + CONTRACT_CHARACTER_MAX(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnContractCharacterMax(); @@ -290,7 +289,7 @@ public Object getColumnValue(final Slots from) { return from.getContractCharacterMax(); } }, - CONTRACT_CORPORATION_FREE(Integer.class, GlazedLists.comparableComparator()) { + CONTRACT_CORPORATION_FREE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnContractCorporationFree(); @@ -304,7 +303,7 @@ public Object getColumnValue(final Slots from) { return from.getContractCorporationFree(); } }, - CONTRACT_CORPORATION_ACTIVE(Integer.class, GlazedLists.comparableComparator()) { + CONTRACT_CORPORATION_ACTIVE(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnContractCorporationActive(); @@ -318,7 +317,7 @@ public Object getColumnValue(final Slots from) { return from.getContractCorporationActive(); } }, - CONTRACT_CORPORATION_MAX(Integer.class, GlazedLists.comparableComparator()) { + CONTRACT_CORPORATION_MAX(Integer.class) { @Override public String getColumnName() { return TabsSlots.get().columnContractCorporationMax(); @@ -332,7 +331,7 @@ public Object getColumnValue(final Slots from) { return from.getContractCorporationMax(); } }, - CURRENT_SHIP(String.class, GlazedLists.comparableComparator()) { + CURRENT_SHIP(String.class) { @Override public String getColumnName() { return TabsSlots.get().columnCurrentShip(); @@ -342,7 +341,7 @@ public Object getColumnValue(final Slots from) { return from.getActiveShip(); } }, - CURRENT_STATION(String.class, GlazedLists.comparableComparator()) { + CURRENT_STATION(String.class) { @Override public String getColumnName() { return TabsSlots.get().columnCurrentStation(); @@ -352,7 +351,7 @@ public Object getColumnValue(final Slots from) { return from.getCurrentStation(); } }, - CURRENT_SYSTEM(String.class, GlazedLists.comparableComparator()) { + CURRENT_SYSTEM(String.class) { @Override public String getColumnName() { return TabsSlots.get().columnCurrentSystem(); @@ -362,7 +361,7 @@ public Object getColumnValue(final Slots from) { return from.getCurrentSystem(); } }, - CURRENT_CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CURRENT_CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsSlots.get().columnCurrentConstellation(); @@ -372,7 +371,7 @@ public Object getColumnValue(final Slots from) { return from.getCurrentConstellation(); } }, - CURRENT_REGION(String.class, GlazedLists.comparableComparator()) { + CURRENT_REGION(String.class) { @Override public String getColumnName() { return TabsSlots.get().columnCurrentRegion(); @@ -386,9 +385,9 @@ public Object getColumnValue(final Slots from) { private final Class type; private final Comparator comparator; - private SlotsTableFormat(final Class type, final Comparator comparator) { + private SlotsTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileExtendedTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileExtendedTableFormat.java index ff3a8860b..12aff2f57 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileExtendedTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileExtendedTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.stockpile; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.gui.tabs.stockpile.Stockpile.StockpileItem; @@ -29,7 +28,7 @@ public enum StockpileExtendedTableFormat implements EnumTableColumn { - STOCKPILE_NAME(String.class, GlazedLists.comparableComparator()) { + STOCKPILE_NAME(String.class) { @Override public String getColumnName() { return TabsStockpile.get().getFilterStockpileName(); @@ -39,7 +38,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getStockpile().getName(); } }, - STOCKPILE_OWNER(String.class, GlazedLists.comparableComparator()) { + STOCKPILE_OWNER(String.class) { @Override public String getColumnName() { return TabsStockpile.get().getFilterStockpileOwner(); @@ -49,7 +48,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getStockpile().getOwnerName(); } }, - STOCKPILE_LOCATION(String.class, GlazedLists.comparableComparator()) { + STOCKPILE_LOCATION(String.class) { @Override public String getColumnName() { return TabsStockpile.get().getFilterStockpileLocation(); @@ -59,7 +58,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getStockpile().getLocationName(); } }, - STOCKPILE_FLAG(String.class, GlazedLists.comparableComparator()) { + STOCKPILE_FLAG(String.class) { @Override public String getColumnName() { return TabsStockpile.get().getFilterStockpileFlag(); @@ -69,7 +68,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getStockpile().getFlagName(); } }, - STOCKPILE_CONTAINER(String.class, GlazedLists.comparableComparator()) { + STOCKPILE_CONTAINER(String.class) { @Override public String getColumnName() { return TabsStockpile.get().getFilterStockpileContainer(); @@ -82,9 +81,9 @@ public Object getColumnValue(final StockpileItem from) { private final Class type; private final Comparator comparator; - private StockpileExtendedTableFormat(final Class type, final Comparator comparator) { + private StockpileExtendedTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTableFormat.java index 51a9302ed..f37b58381 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/stockpile/StockpileTableFormat.java @@ -20,7 +20,6 @@ */ package net.nikr.eve.jeveasset.gui.tabs.stockpile; -import ca.odell.glazedlists.GlazedLists; import java.awt.Component; import java.util.Comparator; import net.nikr.eve.jeveasset.data.settings.tag.Tags; @@ -33,7 +32,7 @@ public enum StockpileTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsStockpile.get().columnName(); @@ -43,7 +42,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getName(); } }, - TAGS(Tags.class, GlazedLists.comparableComparator()) { + TAGS(Tags.class) { @Override public String getColumnName() { return TabsStockpile.get().columnTags(); @@ -53,7 +52,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getTags(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsStockpile.get().columnGroup(); @@ -63,7 +62,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getItem().getGroup(); } }, - CATEGORY(String.class, GlazedLists.comparableComparator()) { + CATEGORY(String.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCategory(); @@ -73,7 +72,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getItem().getCategory(); } }, - SLOT(String.class, GlazedLists.comparableComparator()) { + SLOT(String.class) { @Override public String getColumnName() { return TabsStockpile.get().columnSlot(); @@ -83,7 +82,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getItem().getSlot(); } }, - CHARGE_SIZE(String.class, GlazedLists.comparableComparator()) { + CHARGE_SIZE(String.class) { @Override public String getColumnName() { return TabsStockpile.get().columnChargeSize(); @@ -93,7 +92,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getItem().getChargeSize(); } }, - META(Integer.class, GlazedLists.comparableComparator()) { + META(Integer.class) { @Override public String getColumnName() { return TabsStockpile.get().columnMeta(); @@ -103,7 +102,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getMeta(); } }, - COUNT_MINIMUM(Double.class, GlazedLists.comparableComparator()) { + COUNT_MINIMUM(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountMinimum(); @@ -131,7 +130,7 @@ public boolean setColumnValue(final Object baseObject, final Object editedValue) return false; } }, - COUNT_MINIMUM_MULTIPLIED(Long.class, GlazedLists.comparableComparator()) { + COUNT_MINIMUM_MULTIPLIED(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountMinimumMultiplied(); @@ -141,7 +140,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getCountMinimumMultiplied(); } }, - COUNT_NOW(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNow(); @@ -151,7 +150,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getCountNow(); } }, - COUNT_NEEDED(Long.class, GlazedLists.comparableComparator()) { + COUNT_NEEDED(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNeeded(); @@ -161,7 +160,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getCountNeeded(); } }, - PERCENT_NEEDED(Percent.class, GlazedLists.comparableComparator()) { + PERCENT_NEEDED(Percent.class) { @Override public String getColumnName() { return TabsStockpile.get().columnPercentNeeded(); @@ -171,7 +170,7 @@ public Object getColumnValue(final StockpileItem from) { return Percent.create(from.getPercentNeeded()); } }, - COUNT_NOW_INVENTORY(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_INVENTORY(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowInventory(); @@ -181,7 +180,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getInventoryCountNow(); } }, - COUNT_NOW_BUY_ORDERS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_BUY_ORDERS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowBuyOrders(); @@ -191,7 +190,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getBuyOrdersCountNow(); } }, - COUNT_NOW_SELL_ORDERS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_SELL_ORDERS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowSellOrders(); @@ -201,7 +200,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getSellOrdersCountNow(); } }, - COUNT_NOW_BUY_TRANSACTIONS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_BUY_TRANSACTIONS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowBuyTransactions(); @@ -211,7 +210,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getBuyTransactionsCountNow(); } }, - COUNT_NOW_SELL_TRANSACTIONS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_SELL_TRANSACTIONS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowSellTransactions(); @@ -221,7 +220,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getSellTransactionsCountNow(); } }, - COUNT_NOW_JOBS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_JOBS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowJobs(); @@ -231,7 +230,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getJobsCountNow(); } }, - COUNT_NOW_BUYING_CONTRACTS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_BUYING_CONTRACTS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowBuyingContracts(); @@ -241,7 +240,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getBuyingContractsCountNow(); } }, - COUNT_NOW_BOUGHT_CONTRACTS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_BOUGHT_CONTRACTS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowBoughtContracts(); @@ -251,7 +250,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getBoughtContractsCountNow(); } }, - COUNT_NOW_SELLING_CONTRACTS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_SELLING_CONTRACTS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowSellingContracts(); @@ -261,7 +260,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getSellingContractsCountNow(); } }, - COUNT_NOW_SOLD_CONTRACTS(Long.class, GlazedLists.comparableComparator()) { + COUNT_NOW_SOLD_CONTRACTS(Long.class) { @Override public String getColumnName() { return TabsStockpile.get().columnCountNowSoldContracts(); @@ -271,7 +270,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getSoldContractsCountNow(); } }, - PRICE(Double.class, GlazedLists.comparableComparator()) { + PRICE(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnPrice(); @@ -285,7 +284,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getDynamicPrice(); } }, - PRICE_SELL_MIN(Double.class, GlazedLists.comparableComparator()) { + PRICE_SELL_MIN(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnPriceSellMin(); @@ -299,7 +298,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getPriceSellMin(); } }, - PRICE_BUY_MAX(Double.class, GlazedLists.comparableComparator()) { + PRICE_BUY_MAX(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnPriceBuyMax(); @@ -313,7 +312,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getPriceBuyMax(); } }, - PRICE_TRANSACTION_AVERAGE(Double.class, GlazedLists.comparableComparator()) { + PRICE_TRANSACTION_AVERAGE(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnPriceTransactionAverage(); @@ -328,7 +327,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getTransactionAveragePrice(); } }, - EVE_UI(Component.class, GlazedLists.comparableComparator()) { + EVE_UI(Component.class) { @Override public String getColumnName() { return TabsStockpile.get().columnEveUi(); @@ -349,7 +348,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getButton(); } }, - VALUE_NOW(Double.class, GlazedLists.comparableComparator()) { + VALUE_NOW(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnValueNow(); @@ -359,7 +358,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getValueNow(); } }, - VALUE_NEEDED(Double.class, GlazedLists.comparableComparator()) { + VALUE_NEEDED(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnValueNeeded(); @@ -369,7 +368,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getValueNeeded(); } }, - VOLUME_NOW(Double.class, GlazedLists.comparableComparator()) { + VOLUME_NOW(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnVolumeNow(); @@ -379,7 +378,7 @@ public Object getColumnValue(final StockpileItem from) { return from.getVolumeNow(); } }, - VOLUME_NEEDED(Double.class, GlazedLists.comparableComparator()) { + VOLUME_NEEDED(Double.class) { @Override public String getColumnName() { return TabsStockpile.get().columnVolumeNeeded(); @@ -393,9 +392,9 @@ public Object getColumnValue(final StockpileItem from) { private final Class type; private final Comparator comparator; - private StockpileTableFormat(final Class type, final Comparator comparator) { + private StockpileTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerSkillPointsFilterTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerSkillPointsFilterTableFormat.java index fd9a12f02..a6a0d1243 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerSkillPointsFilterTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tracker/TrackerSkillPointsFilterTableFormat.java @@ -21,14 +21,13 @@ package net.nikr.eve.jeveasset.gui.tabs.tracker; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.i18n.TabsTracker; public enum TrackerSkillPointsFilterTableFormat implements EnumTableColumn { - ENABLED(Boolean.class, GlazedLists.comparableComparator()) { + ENABLED(Boolean.class) { @Override public String getColumnName() { return TabsTracker.get().columnShow(); @@ -53,7 +52,7 @@ public boolean setColumnValue(final Object baseObject, final Object editedValue) return false; } }, - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsTracker.get().columnName(); @@ -63,7 +62,7 @@ public Object getColumnValue(final TrackerSkillPointFilter from) { return from.getName(); } }, - MINIMUM(Long.class, GlazedLists.comparableComparator()) { + MINIMUM(Long.class) { @Override public String getColumnName() { return TabsTracker.get().columnMinimum(); @@ -94,9 +93,9 @@ public boolean setColumnValue(final Object baseObject, final Object editedValue) private final Class type; private final Comparator comparator; - private TrackerSkillPointsFilterTableFormat(final Class type, final Comparator comparator) { + private TrackerSkillPointsFilterTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/transaction/TransactionTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/transaction/TransactionTableFormat.java index d5ed92fcc..b0e73d92f 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/transaction/TransactionTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/transaction/TransactionTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.transaction; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import java.util.Date; import net.nikr.eve.jeveasset.data.api.my.MyTransaction; @@ -33,7 +32,7 @@ public enum TransactionTableFormat implements EnumTableColumn { - DATE(Date.class, GlazedLists.comparableComparator()) { + DATE(Date.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionDate(); @@ -43,7 +42,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getDate(); } }, - TAGS(Tags.class, GlazedLists.comparableComparator()) { + TAGS(Tags.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTags(); @@ -53,7 +52,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTags(); } }, - ADDED(Date.class, GlazedLists.comparableComparator()) { + ADDED(Date.class) { @Override public String getColumnName() { return TabsTransaction.get().columnAdded(); @@ -67,7 +66,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getAdded(); } }, - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnName(); @@ -77,7 +76,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getItem().getTypeName(); } }, - QUANTITY(Integer.class, GlazedLists.comparableComparator()) { + QUANTITY(Integer.class) { @Override public String getColumnName() { return TabsTransaction.get().columnQuantity(); @@ -87,7 +86,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getQuantity(); } }, - PRICE(Double.class, GlazedLists.comparableComparator()) { + PRICE(Double.class) { @Override public String getColumnName() { return TabsTransaction.get().columnPrice(); @@ -97,7 +96,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getPrice(); } }, - TAX(Double.class, GlazedLists.comparableComparator()) { + TAX(Double.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTax(); @@ -107,7 +106,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTax(); } }, - VALUE(Double.class, GlazedLists.comparableComparator()) { + VALUE(Double.class) { @Override public String getColumnName() { return TabsTransaction.get().columnValue(); @@ -117,7 +116,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getValue(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnOwner(); @@ -127,7 +126,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getOwnerName(); } }, - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnStationName(); @@ -137,7 +136,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getLocation(); } }, - SYSTEM(String.class, GlazedLists.comparableComparator()) { + SYSTEM(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnSystem(); @@ -147,7 +146,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getLocation().getSystem(); } }, - CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnConstellation(); @@ -157,7 +156,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getLocation().getConstellation(); } }, - REGION(String.class, GlazedLists.comparableComparator()) { + REGION(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnRegion(); @@ -167,7 +166,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getLocation().getRegion(); } }, - TRANSACTION_PRICE(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE(Double.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionPrice(); @@ -181,7 +180,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTransactionPrice(); } }, - TRANSACTION_MARGIN(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_MARGIN(Double.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionMargin(); @@ -195,7 +194,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTransactionMargin(); } }, - TRANSACTION_PROFIT(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PROFIT(Double.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionProfitDifference(); @@ -209,7 +208,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTransactionProfitDifference(); } }, - TRANSACTION_PROFIT_PERCENT(Percent.class, GlazedLists.comparableComparator()) { + TRANSACTION_PROFIT_PERCENT(Percent.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionProfitPercent(); @@ -223,7 +222,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTransactionProfitPercent(); } }, - CLIENT(String.class, GlazedLists.comparableComparator()) { + CLIENT(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnClientName(); @@ -233,7 +232,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getClientName(); } }, - TYPE(String.class, GlazedLists.comparableComparator()) { + TYPE(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionType(); @@ -243,7 +242,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTransactionTypeFormatted(); } }, - TRANSACTION_FOR(String.class, GlazedLists.comparableComparator()) { + TRANSACTION_FOR(String.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionFor(); @@ -253,7 +252,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getTransactionForFormatted(); } }, - ACCOUNT_KEY(Integer.class, GlazedLists.comparableComparator()) { + ACCOUNT_KEY(Integer.class) { @Override public String getColumnName() { return TabsTransaction.get().columnAccountKey(); @@ -263,7 +262,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getAccountKeyFormatted(); } }, - VOLUME(Float.class, GlazedLists.comparableComparator()) { + VOLUME(Float.class) { @Override public String getColumnName() { return TabsTransaction.get().columnVolume(); @@ -273,7 +272,7 @@ public Object getColumnValue(final MyTransaction from) { return from.getItem().getVolumePackaged(); } }, - TRANSACTION_ID(LongInt.class, GlazedLists.comparableComparator()) { + TRANSACTION_ID(LongInt.class) { @Override public String getColumnName() { return TabsTransaction.get().columnTransactionID(); @@ -291,9 +290,9 @@ public boolean isShowDefault() { private final Class type; private final Comparator comparator; - private TransactionTableFormat(final Class type, final Comparator comparator) { + private TransactionTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tree/TreeTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tree/TreeTableFormat.java index 9541e8616..3e975d80a 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tree/TreeTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/tree/TreeTableFormat.java @@ -21,7 +21,6 @@ package net.nikr.eve.jeveasset.gui.tabs.tree; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import java.util.Date; import net.nikr.eve.jeveasset.data.settings.tag.Tags; @@ -36,7 +35,7 @@ public enum TreeTableFormat implements EnumTableColumn { - NAME(HierarchyColumn.class, GlazedLists.comparableComparator()) { + NAME(HierarchyColumn.class) { @Override public String getColumnName() { return TabsAssets.get().columnName(); @@ -46,7 +45,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getHierarchyColumn(); } }, - NAME_TYPE(String.class, GlazedLists.comparableComparator()) { + NAME_TYPE(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnNameType(); @@ -60,7 +59,7 @@ public boolean isShowDefault() { return false; } }, - NAME_CUSTOM(String.class, GlazedLists.comparableComparator()) { + NAME_CUSTOM(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnNameCustom(); @@ -74,7 +73,7 @@ public boolean isShowDefault() { return false; } }, - TAGS(Tags.class, GlazedLists.comparableComparator()) { + TAGS(Tags.class) { @Override public String getColumnName() { return TabsAssets.get().columnTags(); @@ -84,7 +83,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTags(); } }, - GROUP(String.class, GlazedLists.comparableComparator()) { + GROUP(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnGroup(); @@ -94,7 +93,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getItem().getGroup(); } }, - CATEGORY(String.class, GlazedLists.comparableComparator()) { + CATEGORY(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnCategory(); @@ -104,7 +103,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getItem().getCategory(); } }, - SLOT(String.class, GlazedLists.comparableComparator()) { + SLOT(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnSlot(); @@ -114,7 +113,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getItem().getSlot(); } }, - CHARGE_SIZE(String.class, GlazedLists.comparableComparator()) { + CHARGE_SIZE(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnChargeSize(); @@ -124,7 +123,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getItem().getChargeSize(); } }, - OWNER(String.class, GlazedLists.comparableComparator()) { + OWNER(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnOwner(); @@ -134,7 +133,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getOwnerName(); } }, - LOCATION(String.class, GlazedLists.comparableComparator()) { + LOCATION(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnLocation(); @@ -144,7 +143,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getLocation().getLocation(); } }, - SECURITY(String.class, GlazedLists.comparableComparator()) { + SECURITY(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnSecurity(); @@ -154,7 +153,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getSecurity(); } }, - SYSTEM(String.class, GlazedLists.comparableComparator()) { + SYSTEM(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnSystem(); @@ -164,7 +163,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getLocation().getSystem(); } }, - CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnConstellation(); @@ -174,7 +173,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getLocation().getConstellation(); } }, - REGION(String.class, GlazedLists.comparableComparator()) { + REGION(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnRegion(); @@ -184,7 +183,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getLocation().getRegion(); } }, - FACTION_WARFARE_SYSTEM_OWNER(String.class, GlazedLists.comparableComparator()) { + FACTION_WARFARE_SYSTEM_OWNER(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnFactionWarfareSystemOwner(); @@ -198,7 +197,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getLocation().getFactionWarfareSystemOwner(); } }, - CONTAINER(AssetContainer.class, GlazedLists.comparableComparator()) { + CONTAINER(AssetContainer.class) { @Override public String getColumnName() { return TabsAssets.get().columnContainer(); @@ -208,7 +207,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAssetContainer(); } }, - FLAG(String.class, GlazedLists.comparableComparator()) { + FLAG(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnFlag(); @@ -218,7 +217,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getFlagName(); } }, - PRICE(Double.class, GlazedLists.comparableComparator()) { + PRICE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPrice(); @@ -232,7 +231,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - PRICE_SELL_MIN(Double.class, GlazedLists.comparableComparator()) { + PRICE_SELL_MIN(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceSellMin(); @@ -246,7 +245,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - PRICE_BUY_MAX(Double.class, GlazedLists.comparableComparator()) { + PRICE_BUY_MAX(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceBuyMax(); @@ -260,7 +259,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - PRICE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceReprocessed(); @@ -274,7 +273,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - PRICE_MANUFACTURING(Double.class, GlazedLists.comparableComparator()) { + PRICE_MANUFACTURING(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceManufacturing(); @@ -288,7 +287,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getItem().getPriceManufacturing(); } }, - TRANSACTION_PRICE_LATEST(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_LATEST(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceLatest(); @@ -302,7 +301,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - TRANSACTION_PRICE_AVERAGE(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_AVERAGE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceAverage(); @@ -316,7 +315,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - TRANSACTION_PRICE_MAXIMUM(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_MAXIMUM(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceMaximum(); @@ -330,7 +329,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - TRANSACTION_PRICE_MINIMUM(Double.class, GlazedLists.comparableComparator()) { + TRANSACTION_PRICE_MINIMUM(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnTransactionPriceMinimum(); @@ -344,7 +343,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - PRICE_BASE(Double.class, GlazedLists.comparableComparator()) { + PRICE_BASE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceBase(); @@ -358,7 +357,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - VALUE_REPROCESSED(Double.class, GlazedLists.comparableComparator()) { + VALUE_REPROCESSED(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnValueReprocessed(); @@ -372,7 +371,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTotal(this); } }, - VALUE(Double.class, GlazedLists.comparableComparator()) { + VALUE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnValue(); @@ -386,7 +385,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTotal(this); } }, - PRICE_REPROCESSED_DIFFERENCE(Double.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED_DIFFERENCE(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceReprocessedDifference(); @@ -400,7 +399,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTotal(this); } }, - PRICE_REPROCESSED_PERCENT(Percent.class, GlazedLists.comparableComparator()) { + PRICE_REPROCESSED_PERCENT(Percent.class) { @Override public String getColumnName() { return TabsAssets.get().columnPriceReprocessedPercent(); @@ -414,7 +413,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - COUNT(Long.class, GlazedLists.comparableComparator()) { + COUNT(Long.class) { @Override public String getColumnName() { return TabsAssets.get().columnCount(); @@ -424,7 +423,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTotal(this); } }, - COUNT_TYPE(Long.class, GlazedLists.comparableComparator()) { + COUNT_TYPE(Long.class) { @Override public String getColumnName() { return TabsAssets.get().columnTypeCount(); @@ -438,7 +437,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTypeCount(); } }, - META(Integer.class, GlazedLists.comparableComparator()) { + META(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnMeta(); @@ -448,7 +447,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getMeta(); } }, - TECH(String.class, GlazedLists.comparableComparator()) { + TECH(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnTech(); @@ -458,7 +457,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getItem().getTech(); } }, - VOLUME(Float.class, GlazedLists.comparableComparator()) { + VOLUME(Float.class) { @Override public String getColumnName() { return TabsAssets.get().columnVolume(); @@ -468,7 +467,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - VOLUME_TOTAL(Double.class, GlazedLists.comparableComparator()) { + VOLUME_TOTAL(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnVolumeTotal(); @@ -482,7 +481,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTotal(this); } }, - VOLUME_PACKAGED(Float.class, GlazedLists.comparableComparator()) { + VOLUME_PACKAGED(Float.class) { @Override public String getColumnName() { return TabsAssets.get().columnVolumePackaged(); @@ -496,7 +495,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getItem().getVolumePackaged(); } }, - VALUE_PER_VOLUME(Double.class, GlazedLists.comparableComparator()) { + VALUE_PER_VOLUME(Double.class) { @Override public String getColumnName() { return TabsAssets.get().columnValuePerVolume(); @@ -506,7 +505,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getAverage(this); } }, - SINGLETON(String.class, GlazedLists.comparableComparator()) { + SINGLETON(String.class) { @Override public String getColumnName() { return TabsAssets.get().columnSingleton(); @@ -516,7 +515,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getSingleton(); } }, - ADDED(Date.class, GlazedLists.comparableComparator()) { + ADDED(Date.class) { @Override public String getColumnName() { return TabsAssets.get().columnAdded(); @@ -534,7 +533,7 @@ public boolean isShowDefault() { return false; } }, - MATERIAL_EFFICIENCY(Integer.class, GlazedLists.comparableComparator()) { + MATERIAL_EFFICIENCY(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnMaterialEfficiency(); @@ -548,7 +547,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getMaterialEfficiency(); } }, - TIME_EFFICIENCY(Integer.class, GlazedLists.comparableComparator()) { + TIME_EFFICIENCY(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnTimeEfficiency(); @@ -562,7 +561,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTimeEfficiency(); } }, - RUNS(Runs.class, GlazedLists.comparableComparator()) { + RUNS(Runs.class) { @Override public String getColumnName() { return TabsAssets.get().columnRuns(); @@ -576,7 +575,7 @@ public Object getColumnValue(final TreeAsset from) { return from.getTotal(this); } }, - CITADEL(YesNo.class, GlazedLists.comparableComparator()) { + CITADEL(YesNo.class) { @Override public String getColumnName() { return TabsAssets.get().columnStructure(); @@ -594,7 +593,7 @@ public boolean isShowDefault() { return false; } }, - ITEM_ID(LongInt.class, GlazedLists.comparableComparator()) { + ITEM_ID(LongInt.class) { @Override public String getColumnName() { return TabsAssets.get().columnItemID(); @@ -608,7 +607,7 @@ public Object getColumnValue(final TreeAsset from) { return new LongInt(from.getItemID()); } }, - LOCATION_ID(LongInt.class, GlazedLists.comparableComparator()) { + LOCATION_ID(LongInt.class) { @Override public String getColumnName() { return TabsAssets.get().columnLocationID(); @@ -622,7 +621,7 @@ public Object getColumnValue(final TreeAsset from) { return new LongInt(from.getLocationID()); } }, - TYPE_ID(Integer.class, GlazedLists.comparableComparator()) { + TYPE_ID(Integer.class) { @Override public String getColumnName() { return TabsAssets.get().columnTypeID(); @@ -640,9 +639,9 @@ public Object getColumnValue(final TreeAsset from) { private final Class type; private final Comparator comparator; - private TreeTableFormat(final Class type, final Comparator comparator) { + private TreeTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/values/ValueTableFormat.java b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/values/ValueTableFormat.java index afebc3998..10db7233c 100644 --- a/src/main/java/net/nikr/eve/jeveasset/gui/tabs/values/ValueTableFormat.java +++ b/src/main/java/net/nikr/eve/jeveasset/gui/tabs/values/ValueTableFormat.java @@ -21,14 +21,13 @@ package net.nikr.eve.jeveasset.gui.tabs.values; -import ca.odell.glazedlists.GlazedLists; import java.util.Comparator; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; import net.nikr.eve.jeveasset.i18n.TabsValues; public enum ValueTableFormat implements EnumTableColumn { - NAME(String.class, GlazedLists.comparableComparator()) { + NAME(String.class) { @Override public String getColumnName() { return TabsValues.get().columnOwner(); @@ -38,7 +37,7 @@ public Object getColumnValue(final Value from) { return from.getName(); } }, - TOTAL(Double.class, GlazedLists.comparableComparator()) { + TOTAL(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnTotal(); @@ -48,7 +47,7 @@ public Object getColumnValue(final Value from) { return from.getTotal(); } }, - BALANCE(Double.class, GlazedLists.comparableComparator()) { + BALANCE(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletBalance(); @@ -58,7 +57,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceTotal(); } }, - DIVISION_1(Double.class, GlazedLists.comparableComparator()) { + DIVISION_1(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletDivision1(); @@ -68,7 +67,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceFilter().get("1"); } }, - DIVISION_2(Double.class, GlazedLists.comparableComparator()) { + DIVISION_2(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletDivision2(); @@ -78,7 +77,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceFilter().get("2"); } }, - DIVISION_3(Double.class, GlazedLists.comparableComparator()) { + DIVISION_3(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletDivision3(); @@ -88,7 +87,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceFilter().get("3"); } }, - DIVISION_4(Double.class, GlazedLists.comparableComparator()) { + DIVISION_4(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletDivision4(); @@ -98,7 +97,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceFilter().get("4"); } }, - DIVISION_5(Double.class, GlazedLists.comparableComparator()) { + DIVISION_5(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletDivision5(); @@ -108,7 +107,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceFilter().get("5"); } }, - DIVISION_6(Double.class, GlazedLists.comparableComparator()) { + DIVISION_6(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletDivision6(); @@ -118,7 +117,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceFilter().get("6"); } }, - DIVISION_7(Double.class, GlazedLists.comparableComparator()) { + DIVISION_7(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnWalletDivision7(); @@ -128,7 +127,7 @@ public Object getColumnValue(final Value from) { return from.getBalanceFilter().get("7"); } }, - ASSETS(Double.class, GlazedLists.comparableComparator()) { + ASSETS(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnAssets(); @@ -138,7 +137,7 @@ public Object getColumnValue(final Value from) { return from.getAssetsTotal(); } }, - SELL_ORDERS(Double.class, GlazedLists.comparableComparator()) { + SELL_ORDERS(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnSellOrders(); @@ -148,7 +147,7 @@ public Object getColumnValue(final Value from) { return from.getSellOrders(); } }, - ESCROWS(Double.class, GlazedLists.comparableComparator()) { + ESCROWS(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnEscrows(); @@ -158,7 +157,7 @@ public Object getColumnValue(final Value from) { return from.getEscrows(); } }, - ESCROWS_TO_COVER(Double.class, GlazedLists.comparableComparator()) { + ESCROWS_TO_COVER(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnEscrowsToCover(); @@ -168,7 +167,7 @@ public Object getColumnValue(final Value from) { return from.getEscrowsToCover(); } }, - MANUFACTURING(Double.class, GlazedLists.comparableComparator()) { + MANUFACTURING(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnManufacturing(); @@ -178,7 +177,7 @@ public Object getColumnValue(final Value from) { return from.getManufacturing(); } }, - CONTRACT_COLLATERAL(Double.class, GlazedLists.comparableComparator()) { + CONTRACT_COLLATERAL(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnContractCollateral(); @@ -188,7 +187,7 @@ public Object getColumnValue(final Value from) { return from.getContractCollateral(); } }, - CONTRACT_VALUE(Double.class, GlazedLists.comparableComparator()) { + CONTRACT_VALUE(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnContractValue(); @@ -198,7 +197,7 @@ public Object getColumnValue(final Value from) { return from.getContractValue(); } }, - SKILL_POINT_VALUE(Double.class, GlazedLists.comparableComparator()) { + SKILL_POINT_VALUE(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnSkillPointValue(); @@ -208,7 +207,7 @@ public Object getColumnValue(final Value from) { return from.getSkillPointValue(); } }, - BEST_ASSET_NAME(String.class, GlazedLists.comparableComparator()) { + BEST_ASSET_NAME(String.class) { @Override public String getColumnName() { return TabsValues.get().columnBestAsset(); @@ -218,7 +217,7 @@ public Object getColumnValue(final Value from) { return from.getBestAssetName(); } }, - BEST_ASSET_VALUE(Double.class, GlazedLists.comparableComparator()) { + BEST_ASSET_VALUE(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnBestAsset(); @@ -228,7 +227,7 @@ public Object getColumnValue(final Value from) { return from.getBestAssetValue(); } }, - BEST_SHIP_FITTED_NAME(String.class, GlazedLists.comparableComparator()) { + BEST_SHIP_FITTED_NAME(String.class) { @Override public String getColumnName() { return TabsValues.get().columnBestShipFitted(); @@ -238,7 +237,7 @@ public Object getColumnValue(final Value from) { return from.getBestShipFittedName(); } }, - BEST_SHIP_FITTED_VALUE(Double.class, GlazedLists.comparableComparator()) { + BEST_SHIP_FITTED_VALUE(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnBestShipFitted(); @@ -248,7 +247,7 @@ public Object getColumnValue(final Value from) { return from.getBestShipFittedValue(); } }, - BEST_SHIP_NAME(String.class, GlazedLists.comparableComparator()) { + BEST_SHIP_NAME(String.class) { @Override public String getColumnName() { return TabsValues.get().columnBestShip(); @@ -258,7 +257,7 @@ public Object getColumnValue(final Value from) { return from.getBestShipName(); } }, - BEST_SHIP_VALUE(Double.class, GlazedLists.comparableComparator()) { + BEST_SHIP_VALUE(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnBestShip(); @@ -268,7 +267,7 @@ public Object getColumnValue(final Value from) { return from.getBestShipValue(); } }, - BEST_MODULE_NAME(String.class, GlazedLists.comparableComparator()) { + BEST_MODULE_NAME(String.class) { @Override public String getColumnName() { return TabsValues.get().columnBestModule(); @@ -278,7 +277,7 @@ public Object getColumnValue(final Value from) { return from.getBestModuleName(); } }, - BEST_MODULE_VALUE(Double.class, GlazedLists.comparableComparator()) { + BEST_MODULE_VALUE(Double.class) { @Override public String getColumnName() { return TabsValues.get().columnBestModule(); @@ -288,7 +287,7 @@ public Object getColumnValue(final Value from) { return from.getBestModuleValue(); } }, - CURRENT_SHIP(String.class, GlazedLists.comparableComparator()) { + CURRENT_SHIP(String.class) { @Override public String getColumnName() { return TabsValues.get().columnCurrentShip(); @@ -298,7 +297,7 @@ public Object getColumnValue(final Value from) { return from.getActiveShip(); } }, - CURRENT_STATION(String.class, GlazedLists.comparableComparator()) { + CURRENT_STATION(String.class) { @Override public String getColumnName() { return TabsValues.get().columnCurrentStation(); @@ -308,7 +307,7 @@ public Object getColumnValue(final Value from) { return from.getCurrentStation(); } }, - CURRENT_SYSTEM(String.class, GlazedLists.comparableComparator()) { + CURRENT_SYSTEM(String.class) { @Override public String getColumnName() { return TabsValues.get().columnCurrentSystem(); @@ -318,7 +317,7 @@ public Object getColumnValue(final Value from) { return from.getCurrentSystem(); } }, - CURRENT_CONSTELLATION(String.class, GlazedLists.comparableComparator()) { + CURRENT_CONSTELLATION(String.class) { @Override public String getColumnName() { return TabsValues.get().columnCurrentConstellation(); @@ -328,7 +327,7 @@ public Object getColumnValue(final Value from) { return from.getCurrentConstellation(); } }, - CURRENT_REGION(String.class, GlazedLists.comparableComparator()) { + CURRENT_REGION(String.class) { @Override public String getColumnName() { return TabsValues.get().columnCurrentRegion(); @@ -342,9 +341,9 @@ public Object getColumnValue(final Value from) { private final Class type; private final Comparator comparator; - private ValueTableFormat(final Class type, final Comparator comparator) { + private ValueTableFormat(final Class type) { this.type = type; - this.comparator = comparator; + this.comparator = EnumTableColumn.getComparator(type); } @Override public Class getType() { diff --git a/src/test/java/net/nikr/eve/jeveasset/gui/tabs/TableFormatTest.java b/src/test/java/net/nikr/eve/jeveasset/gui/tabs/TableFormatTest.java index 029754a2a..9d3873d5a 100644 --- a/src/test/java/net/nikr/eve/jeveasset/gui/tabs/TableFormatTest.java +++ b/src/test/java/net/nikr/eve/jeveasset/gui/tabs/TableFormatTest.java @@ -20,9 +20,13 @@ */ package net.nikr.eve.jeveasset.gui.tabs; +import ca.odell.glazedlists.GlazedLists; +import java.awt.Color; +import java.awt.Component; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.Date; import javax.swing.JComponent; import net.nikr.eve.jeveasset.TestUtil; @@ -47,6 +51,8 @@ import net.nikr.eve.jeveasset.gui.shared.table.ColumnManager.FormulaColumn; import net.nikr.eve.jeveasset.gui.shared.table.ColumnManager.JumpColumn; import net.nikr.eve.jeveasset.gui.shared.table.EnumTableColumn; +import net.nikr.eve.jeveasset.gui.shared.table.containers.ISK; +import net.nikr.eve.jeveasset.gui.shared.table.containers.ModulePriceValue; import net.nikr.eve.jeveasset.gui.tabs.assets.AssetTableFormat; import net.nikr.eve.jeveasset.gui.tabs.contracts.ContractsTableFormat; import net.nikr.eve.jeveasset.gui.tabs.items.ItemTableFormat; @@ -63,6 +69,8 @@ import net.nikr.eve.jeveasset.gui.tabs.orders.MarketTableFormat; import net.nikr.eve.jeveasset.gui.tabs.overview.Overview; import net.nikr.eve.jeveasset.gui.tabs.overview.OverviewTableFormat; +import net.nikr.eve.jeveasset.gui.tabs.prices.PriceChangesTab.PriceChange; +import net.nikr.eve.jeveasset.gui.tabs.prices.PriceChangesTableFormat; import net.nikr.eve.jeveasset.gui.tabs.reprocessed.ReprocessedExtendedTableFormat; import net.nikr.eve.jeveasset.gui.tabs.reprocessed.ReprocessedInterface; import net.nikr.eve.jeveasset.gui.tabs.reprocessed.ReprocessedItem; @@ -83,6 +91,7 @@ import net.nikr.eve.jeveasset.io.shared.ConverterTestOptions; import net.nikr.eve.jeveasset.io.shared.ConverterTestOptionsGetter; import net.nikr.eve.jeveasset.io.shared.ConverterTestUtil; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -185,6 +194,12 @@ public void testTableFormatClass() { for (OverviewTableFormat tableFormat : OverviewTableFormat.values()) { test(tableFormat, tableFormat.getType(), tableFormat.getColumnValue(overview)); } + //Price Change + test(PriceChangesTableFormat.class); + PriceChange priceChange = new PriceChange(INTEGER_VALUE, item, LONG_VALUE); + for (PriceChangesTableFormat tableFormat : PriceChangesTableFormat.values()) { + test(tableFormat, tableFormat.getType(), tableFormat.getColumnValue(priceChange)); + } //Reprocessed test(ReprocessedTableFormat.class); ReprocessedMaterial reprocessedMaterial = new ReprocessedMaterial(INTEGER_VALUE, INTEGER_VALUE, INTEGER_VALUE); @@ -244,17 +259,44 @@ public void testTableFormatClass() { test(tableFormat, tableFormat.getType(), tableFormat.getColumnValue(sub)); } //Tables - test(FormulaColumn.class); - test(JumpColumn.class); - test(AllColumn.class); + testClass(FormulaColumn.class); + testClass(JumpColumn.class); + testClass(AllColumn.class); //Tests - test(TestEnum.class); + testClass(TestEnum.class); + } + } + + private void testClass(Class tableFormat) { + try { + assertTrue(tableFormat + " does not implement toString", tableFormat.getMethod("toString").getDeclaringClass() == tableFormat); + } catch (NoSuchMethodException | SecurityException ex) { + fail(ex.getMessage()); } } - private void test(Class tableFormat) { + private & EnumTableColumn, Q> void test(Class tableFormat) { try { assertTrue(tableFormat + " does not implement toString", tableFormat.getMethod("toString").getDeclaringClass() == tableFormat); + //Test Comparator + for (EnumTableColumn enumColumn : tableFormat.getEnumConstants()) { + Comparator comparator = enumColumn.getComparator(); + Class type = enumColumn.getType(); + assertNotNull(enumColumn.getClass().getName() + "." + enumColumn.name() + " -> is null", type); + if (String.class.isAssignableFrom(type)) { + assertEquals(GlazedLists.caseInsensitiveComparator(), comparator); + } else if (Comparable.class.isAssignableFrom(type)) { + assertEquals(GlazedLists.comparableComparator(), comparator); + } else if (Component.class.isAssignableFrom(type) + || ModulePriceValue.class.isAssignableFrom(type) + || ISK.class.isAssignableFrom(type) + || Color.class.isAssignableFrom(type) + ) { + assertEquals(null, comparator); + } else { + fail(enumColumn.getClass().getName() + "." + enumColumn.name() + " -> " + type.getName() + " is not comparable"); + } + } } catch (NoSuchMethodException | SecurityException ex) { fail(ex.getMessage()); }