![JAR search and dependency download from the Maven repository](/logo.png)
net.sf.cuf.ui.table.ContextMenuActionSortColumn Maven / Gradle / Ivy
The newest version!
package net.sf.cuf.ui.table;
/**
* Context menu action to set sorting on a column of a table with a {@link TableSorter} table model.
* The action provides for ascending and descending sorting.
*
* @author Hendrik Wördehoff, sd&m AG
*/
public class ContextMenuActionSortColumn
extends ContextMenuAction
{
private boolean mAscending;
public ContextMenuActionSortColumn(final boolean pAscending)
{
this.mAscending = pAscending;
}
public String getKennung()
{
return mAdapter.getContextMenuKennung()+(mAscending ? "_SORTCOLASC" : "_SORTCOLDESC");
}
/**
* @return true
only if the user clicked on a column
*/
public boolean isEnabled()
{
return mAdapter.getViewColumnIndex() != -1;
}
public void performAction()
{
TableSorter sorter = (TableSorter) mAdapter.getTable().getModel();
sorter.resetColumns();
sorter.sortByColumn(mAdapter.getModelColumnIndex(), mAscending);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy