mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Support clicking sort drop down item a second time to reverse sort
This commit is contained in:
@@ -187,7 +187,7 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
|
||||
|
||||
sortCols.clear();
|
||||
if (cbxSortOptions != null) {
|
||||
cbxSortOptions.setChangedHandler(null);
|
||||
cbxSortOptions.setDropDownItemTap(null);
|
||||
cbxSortOptions.removeAllItems();
|
||||
}
|
||||
|
||||
@@ -226,10 +226,10 @@ public abstract class ItemManager<T extends InventoryItem> extends FContainer im
|
||||
}
|
||||
|
||||
if (cbxSortOptions != null) {
|
||||
cbxSortOptions.setChangedHandler(new FEventHandler() {
|
||||
cbxSortOptions.setDropDownItemTap(new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
model.getCascadeManager().add(cbxSortOptions.getSelectedItem(), false);
|
||||
model.getCascadeManager().add((ItemColumn)e.getArgs(), false);
|
||||
model.refreshSort();
|
||||
ItemManagerConfig.save();
|
||||
updateView(true, null);
|
||||
|
||||
@@ -17,7 +17,7 @@ public class FComboBox<T> extends FTextField implements IComboBox<T> {
|
||||
private final List<T> items = new ArrayList<T>();
|
||||
private T selectedItem;
|
||||
private final DropDown dropDown = new DropDown();
|
||||
private FEventHandler dropDownChangeHandler;
|
||||
private FEventHandler dropDownItemTap, dropDownChangeHandler;
|
||||
|
||||
public FComboBox() {
|
||||
initialize();
|
||||
@@ -134,6 +134,13 @@ public class FComboBox<T> extends FTextField implements IComboBox<T> {
|
||||
return false; //don't allow editing text
|
||||
}
|
||||
|
||||
public FEventHandler getDropDownItemTap() {
|
||||
return dropDownItemTap;
|
||||
}
|
||||
public void setDropDownItemTap(FEventHandler itemTap0) {
|
||||
dropDownItemTap = itemTap0;
|
||||
}
|
||||
|
||||
public FEventHandler getDropDownChangeHandler() {
|
||||
return dropDownChangeHandler;
|
||||
}
|
||||
@@ -193,6 +200,9 @@ public class FComboBox<T> extends FTextField implements IComboBox<T> {
|
||||
FMenuItem menuItem = new FMenuItem(item.toString(), new FEventHandler() {
|
||||
@Override
|
||||
public void handleEvent(FEvent e) {
|
||||
if (dropDownItemTap != null) {
|
||||
dropDownItemTap.handleEvent(new FEvent(FComboBox.this, FEventType.TAP, item));
|
||||
}
|
||||
if (item != selectedItem) {
|
||||
setSelectedItem(item);
|
||||
if (dropDownChangeHandler != null) {
|
||||
|
||||
Reference in New Issue
Block a user