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