Removed Sort By in security terminal.

This commit is contained in:
AlgorithmX2 2014-02-05 23:08:05 -06:00
parent 071c10f94b
commit 084d45530d
5 changed files with 66 additions and 9 deletions

View file

@ -13,6 +13,7 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.me.InternalSlotME;
import appeng.client.me.ItemRepo;
import appeng.container.implementations.ContainerMEMonitorable;
@ -24,7 +25,7 @@ import appeng.parts.reporting.PartTerminal;
import appeng.tile.misc.TileSecurity;
import appeng.util.Platform;
public class GuiMEMonitorable extends AEBaseMEGui
public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource
{
GuiTextField searchField;
@ -36,6 +37,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
int perRow = 9;
int reservedSpace = 0;
int lowerTextureOffset = 0;
boolean customSortOrder = true;
int rows = 0;
int maxRows = Integer.MAX_VALUE;
@ -48,7 +50,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
super( c );
myScrollBar = new GuiScrollbar();
repo = new ItemRepo( myScrollBar );
repo = new ItemRepo( myScrollBar, this );
xSize = 195;
ySize = 204;
@ -111,8 +113,15 @@ public class GuiMEMonitorable extends AEBaseMEGui
this.ySize = magicNumber + rows * 18 + reservedSpace;
this.guiTop = top;
buttonList.add( new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.SORT_BY, Configuration.instance.settings.getSetting( Settings.SORT_BY ) ) );
buttonList.add( new GuiImgButton( this.guiLeft - 18, guiTop + 28, Settings.SORT_DIRECTION, Configuration.instance.settings
int offset = guiTop + 8;
if ( customSortOrder )
{
buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_BY, Configuration.instance.settings.getSetting( Settings.SORT_BY ) ) );
offset += 20;
}
buttonList.add( new GuiImgButton( this.guiLeft - 18, offset, Settings.SORT_DIRECTION, Configuration.instance.settings
.getSetting( Settings.SORT_DIRECTION ) ) );
searchField = new GuiTextField( this.fontRenderer, this.guiLeft + Math.max( 82, xoffset ), this.guiTop + 6, 89, this.fontRenderer.FONT_HEIGHT );
@ -195,4 +204,16 @@ public class GuiMEMonitorable extends AEBaseMEGui
fontRenderer.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
}
@Override
public Enum getSortBy()
{
return Configuration.instance.settings.getSetting( Settings.SORT_BY );
}
@Override
public Enum getSortDir()
{
return Configuration.instance.settings.getSetting( Settings.SORT_DIRECTION );
}
}

View file

@ -9,17 +9,20 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.implementations.guiobjects.INetworkTool;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.me.ItemRepo;
import appeng.client.me.SlotME;
import appeng.container.implementations.ContainerNetworkStatus;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class GuiNetworkStatus extends AEBaseGui
public class GuiNetworkStatus extends AEBaseGui implements ISortSource
{
ItemRepo repo;
@ -31,7 +34,7 @@ public class GuiNetworkStatus extends AEBaseGui
this.ySize = 125;
this.xSize = 195;
myScrollBar = new GuiScrollbar();
repo = new ItemRepo( myScrollBar );
repo = new ItemRepo( myScrollBar, this );
repo.rowSize = 5;
}
@ -245,4 +248,16 @@ public class GuiNetworkStatus extends AEBaseGui
}
super.drawItemStackTooltip( stack, x, y );
}
@Override
public Enum getSortBy()
{
return SortOrder.NAME;
}
@Override
public Enum getSortDir()
{
return SortDir.ASCENDING;
}
}

View file

@ -4,6 +4,7 @@ import java.io.IOException;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.SortOrder;
import appeng.api.storage.IStorageMonitorable;
import appeng.client.gui.widgets.GuiToggleButton;
import appeng.container.implementations.ContainerSecurity;
@ -16,6 +17,7 @@ public class GuiSecurity extends GuiMEMonitorable
public GuiSecurity(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
customSortOrder = false;
reservedSpace = 33;
xSize += 50;
}
@ -95,4 +97,10 @@ public class GuiSecurity extends GuiMEMonitorable
fontRenderer.drawString( GuiText.SecurityCardEditor.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 );
}
@Override
public Enum getSortBy()
{
return SortOrder.NAME;
}
}

View file

@ -0,0 +1,10 @@
package appeng.client.gui.widgets;
public interface ISortSource
{
Enum getSortBy();
Enum getSortDir();
}

View file

@ -11,6 +11,7 @@ import appeng.api.config.YesNo;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.Configuration;
import appeng.util.ItemSorters;
import appeng.util.Platform;
@ -23,13 +24,15 @@ public class ItemRepo
final private ArrayList<IAEItemStack> view = new ArrayList();
final private ArrayList<ItemStack> dsp = new ArrayList();
final private IScrollSource src;
final private ISortSource sortSrc;
public int rowSize = 9;
public String searchString = "";
public ItemRepo(IScrollSource src) {
public ItemRepo(IScrollSource src, ISortSource sortSrc) {
this.src = src;
this.sortSrc = sortSrc;
}
public IAEItemStack getRefrenceItem(int idx)
@ -125,8 +128,8 @@ public class ItemRepo
*/
}
Enum SortBy = Configuration.instance.settings.getSetting( Settings.SORT_BY );
Enum SortDir = Configuration.instance.settings.getSetting( Settings.SORT_DIRECTION );
Enum SortBy = sortSrc.getSortBy();
Enum SortDir = sortSrc.getSortDir();
ItemSorters.Direction = (appeng.api.config.SortDir) SortDir;