Created
April 3, 2018 02:08
-
-
Save pedromartins4/1000c2336f0475ecb49d218db90dc582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void sort(String pColumn, String pSortDirection) { | |
boolean up = true; | |
if (!"u".equals(pSortDirection)) { | |
up = false; | |
} | |
if ("id".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getId(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("orderID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getOrderID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("journalID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getJournalID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("bookDate".equals(pColumn)) { | |
fComparator = new DateComparator(); | |
java.sql.Date[] temp = new java.sql.Date[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getBookDate(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("valueDate".equals(pColumn)) { | |
fComparator = new DateComparator(); | |
java.sql.Date[] temp = new java.sql.Date[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getValueDate(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("ledgerDebit".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getLedgerDebit(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("amountDebit".equals(pColumn)) { | |
fComparator = new BigDecimalComparator(); | |
java.math.BigDecimal[] temp = new java.math.BigDecimal[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getAmountDebit(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("currencyDebitID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
short[] temp = new short[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getCurrencyDebitID(); | |
} | |
fSortOrder = sorter.sortShort(temp, fSortOrder, up); | |
} | |
if ("exchangeRateDebit".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
double[] temp = new double[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getExchangeRateDebit(); | |
} | |
fSortOrder = sorter.sortDouble(temp, fSortOrder, up); | |
} | |
if ("amountDebitReal".equals(pColumn)) { | |
fComparator = new BigDecimalComparator(); | |
java.math.BigDecimal[] temp = new java.math.BigDecimal[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getAmountDebitReal(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("ledgerCredit".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getLedgerCredit(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("amountCredit".equals(pColumn)) { | |
fComparator = new BigDecimalComparator(); | |
java.math.BigDecimal[] temp = new java.math.BigDecimal[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getAmountCredit(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("currencyCreditID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
short[] temp = new short[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getCurrencyCreditID(); | |
} | |
fSortOrder = sorter.sortShort(temp, fSortOrder, up); | |
} | |
if ("exchangeRateCredit".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
double[] temp = new double[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getExchangeRateCredit(); | |
} | |
fSortOrder = sorter.sortDouble(temp, fSortOrder, up); | |
} | |
if ("amountCreditReal".equals(pColumn)) { | |
fComparator = new BigDecimalComparator(); | |
java.math.BigDecimal[] temp = new java.math.BigDecimal[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getAmountCreditReal(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
fSortedColumn = pColumn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment