Java Map Sort sortingHelperSessions(String column, Map sortParams)

Here you can find the source of sortingHelperSessions(String column, Map sortParams)

Description

sorting Helper Sessions

License

Apache License

Declaration

public static String sortingHelperSessions(String column,
            Map<String, String> sortParams) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Map;

public class Main {
    public static String sortingHelperSessions(String column,
            Map<String, String> sortParams) {
        String link_beginning = "<a href=\"gojara-activeSessions.jsp?sortby=";
        return helpMe(column, sortParams, link_beginning);
    }// w  w w . ja v a  2s .  c om

    private static String helpMe(String column,
            Map<String, String> sortParams, String link_beginning) {
        String image_asc = "<img alt=\"sorted ASC\" src=\"/images/sort_ascending.gif\">";
        String image_desc = "<img alt=\"sorted DESC\" src=\"/images/sort_descending.gif\">";

        String ending = "";
        if (column.equals("username"))
            ending = "User Name:";
        else if (column.equals("transport"))
            ending = "Resource:";
        else if (column.equals("lastActivity"))
            ending = "Last Login was at:";
        else if (column.equals("loginTime"))
            ending = "Login Time:";
        else
            ending = "i dont want to be here";
        ending += "</a>";

        String sortinglink = "";
        if (sortParams.containsValue(column)) {
            if (sortParams.containsValue("ASC")) {
                sortinglink = image_asc + link_beginning + column
                        + "&sortorder=DESC\">" + ending;
            } else if (sortParams.containsValue("DESC")) {
                sortinglink = image_desc + link_beginning + column
                        + "&sortorder=ASC\">" + ending;
            }
        } else {
            // This is not the currently sorted colum so we want to sort with it, Ascending.
            sortinglink = link_beginning + column + "&sortorder=ASC\">"
                    + ending;
        }
        return sortinglink;
    }
}

Related

  1. sortedString(Map c)
  2. sortedTable(Map map)
  3. sortedView(Map original, int numItems)
  4. sortEntries(Map map, Comparator> comparator)
  5. sortHashMapByValuesD(HashMap passedMap)
  6. sortKeysByValue(final Map m)
  7. sortKeysDesc(HashMap> hash)
  8. sortKeyValuePairByValue( Map map)
  9. sortMap(final Map map, final Comparator> comparator)