mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Prevent unnecessary refresh when setting up Image View groupBy/pileBy
This commit is contained in:
@@ -294,8 +294,8 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
|||||||
}
|
}
|
||||||
public void setup(final Map<ColumnDef, ItemColumn> cols, GroupDef groupBy, ColumnDef pileBy) {
|
public void setup(final Map<ColumnDef, ItemColumn> cols, GroupDef groupBy, ColumnDef pileBy) {
|
||||||
this.listView.setup(cols);
|
this.listView.setup(cols);
|
||||||
this.imageView.setGroupBy(groupBy);
|
this.imageView.setGroupBy(groupBy, true);
|
||||||
this.imageView.setPileBy(pileBy);
|
this.imageView.setPileBy(pileBy, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViewIndex(int index) {
|
public void setViewIndex(int index) {
|
||||||
|
|||||||
@@ -148,12 +148,16 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
groups.add(new Group("")); //add default group
|
groups.add(new Group("")); //add default group
|
||||||
|
getScroller().setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupDef getGroupBy() {
|
public GroupDef getGroupBy() {
|
||||||
return groupBy;
|
return groupBy;
|
||||||
}
|
}
|
||||||
public void setGroupBy(GroupDef groupBy0) {
|
public void setGroupBy(GroupDef groupBy0) {
|
||||||
|
setGroupBy(groupBy, false);
|
||||||
|
}
|
||||||
|
public void setGroupBy(GroupDef groupBy0, boolean forSetup) {
|
||||||
if (groupBy == groupBy0) { return; }
|
if (groupBy == groupBy0) { return; }
|
||||||
groupBy = groupBy0;
|
groupBy = groupBy0;
|
||||||
|
|
||||||
@@ -168,19 +172,23 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!forSetup) {
|
||||||
refresh(this.getSelectedItems(), this.getSelectedIndex());
|
refresh(this.getSelectedItems(), this.getSelectedIndex());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ColumnDef getPileBy() {
|
public ColumnDef getPileBy() {
|
||||||
return pileBy;
|
return pileBy;
|
||||||
}
|
}
|
||||||
public void setPileBy(ColumnDef pileBy0) {
|
public void setPileBy(ColumnDef pileBy0) {
|
||||||
pileBy = pileBy0;
|
setPileBy(pileBy0, false);
|
||||||
if (pileBy == null) {
|
|
||||||
getScroller().setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
|
||||||
}
|
}
|
||||||
else {
|
public void setPileBy(ColumnDef pileBy0, boolean forSetup) {
|
||||||
getScroller().setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
if (pileBy == pileBy0) { return; }
|
||||||
|
pileBy = pileBy0;
|
||||||
|
|
||||||
|
if (!forSetup) {
|
||||||
|
refresh(this.getSelectedItems(), this.getSelectedIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user