📄 uicellsorter.java
字号:
/*
* Created on 2003-4-11
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package net.sf.pim.view;
import java.util.Arrays;
import net.sf.pim.UiCore;
import net.sf.pim.model.psp.WorkComparator;
import net.sf.util.persistence.IEntry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
/**
* @author lzhang
* <p/>
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class UiCellSorter implements Listener {
UiCore uc;
public UiCellSorter(UiCore parent) {
uc = parent;
}
public void handleEvent(Event e) {
if (uc.isMulti()) {
IEntry[] list = uc.getData().getWorks();
Table table = uc.getTv().getTable();
TableColumn tc=(TableColumn) e.widget;
boolean asc = true;
asc =table.getSortDirection() == SWT.DOWN ? true:false;
Arrays.sort(list, new WorkComparator((String) tc.getData(),asc));
uc.getTv().setInput(list);
table.setSortColumn(tc);
table.setSortDirection(asc ? SWT.TOP : SWT.DOWN);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -