📄 menusequencecomparator.java
字号:
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file. */package org.butor.web.menu;import org.butor.comparator.SortComparator;/** * Comparator for menu based on field "sequence". * * @author Nguyen The Hung */public class MenuSequenceComparator extends SortComparator { /** * Constructor for MenuSequenceComparator. */ public MenuSequenceComparator() { super(); } /** * Compare two MenuItem objects. (Overriding the parent class method). * @param o1 java.lang.Object * @param o2 java.lang.Object * @return int */ public int compare(Object o1, Object o2) { return compareElements(o1, o2); } /** * Compare two MenuItem objects. * @param o1 java.lang.Object * @param o2 java.lang.Object * @return int * Example : ASC & if o1 < o2 => <0 * & if o1 = o2 => 0 * & if o1 > o2 => >0 */ public int compareElements(Object o1, Object o2) { MenuItem node1 = (MenuItem) o1; MenuItem node2 = (MenuItem) o2; int dif = node1.getSequence() - node2.getSequence(); if (f_order == SORT_ASC) { return dif; } else { return dif * -1; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -