Created
April 3, 2018 02:09
-
-
Save pedromartins4/686cc9c6ab143c98a34a8adc2af4301e 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 ("type".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getType(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("salaryPayment".equals(pColumn)) { | |
fComparator = new StringComparator(); | |
String[] temp = new String[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getSalaryPayment(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("referenceNumber".equals(pColumn)) { | |
fComparator = new StringComparator(); | |
String[] temp = new String[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getReferenceNumber(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("debitAccountID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getDebitAccountID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("principalID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getPrincipalID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("currencyID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
short[] temp = new short[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getCurrencyID(); | |
} | |
fSortOrder = sorter.sortShort(temp, fSortOrder, up); | |
} | |
if ("amount".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].getAmount(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("creationDate".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].getCreationDate(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("dueDate".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].getDueDate(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("esrAccountID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getEsrAccountID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("recipientID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getRecipientID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("beneficiaryID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getBeneficiaryID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
if ("esrReferenceNumber".equals(pColumn)) { | |
fComparator = new StringComparator(); | |
String[] temp = new String[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getEsrReferenceNumber(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("esrCorrectionCode".equals(pColumn)) { | |
fComparator = new StringComparator(); | |
String[] temp = new String[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getEsrCorrectionCode(); | |
} | |
sort(temp, 0, temp.length - 1, up); | |
} | |
if ("ordererID".equals(pColumn)) { | |
Sorter sorter = new Sorter(); | |
long[] temp = new long[fTableData.length]; | |
for (int i = 0; i < temp.length; i++) { | |
temp[i] = fTableData[i].getOrdererID(); | |
} | |
fSortOrder = sorter.sortLong(temp, fSortOrder, up); | |
} | |
fSortedColumn = pColumn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment