mirror of
https://github.com/zDevelopers/ImageOnMap.git
synced 2024-11-29 05:26:18 +01:00
Updated explorer GUI to support manually placed data sets (with coordinates).
* NEW: updated the way the data emptiness is determined to avoid a GUI with manually placed data being considered as empty.
This commit is contained in:
parent
58abd17205
commit
e5c7ece41f
@ -71,8 +71,8 @@ abstract public class ExplorerGui<T> extends ActionGui
|
|||||||
private int currentPageX = 0;
|
private int currentPageX = 0;
|
||||||
private int currentPageY = 0;
|
private int currentPageY = 0;
|
||||||
|
|
||||||
private int dataHeight;
|
private int dataHeight = 0;
|
||||||
private int dataWidth;
|
private int dataWidth = 0;
|
||||||
|
|
||||||
private int pageCountX;
|
private int pageCountX;
|
||||||
private int pageCountY;
|
private int pageCountY;
|
||||||
@ -126,6 +126,17 @@ abstract public class ExplorerGui<T> extends ActionGui
|
|||||||
setData(data, 0);
|
setData(data, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this GUI contains data, either with the data entry or through
|
||||||
|
* {@link #getViewItem(int, int)} and {@link #setDataShape(int, int)}.
|
||||||
|
*
|
||||||
|
* @return {@code true} if this GUI contains some data.
|
||||||
|
*/
|
||||||
|
protected boolean hasData()
|
||||||
|
{
|
||||||
|
return (data == null || data.length == 0) && (dataWidth == 0 && dataHeight == 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populate(Inventory inventory)
|
protected void populate(Inventory inventory)
|
||||||
{
|
{
|
||||||
@ -141,7 +152,7 @@ abstract public class ExplorerGui<T> extends ActionGui
|
|||||||
updateAction("down", getPageItem("down", canGoDown()));
|
updateAction("down", getPageItem("down", canGoDown()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data != null && data.length > 0)
|
if(hasData())
|
||||||
{
|
{
|
||||||
if (!isData2D)
|
if (!isData2D)
|
||||||
{
|
{
|
||||||
@ -206,7 +217,7 @@ abstract public class ExplorerGui<T> extends ActionGui
|
|||||||
// The user clicked in the GUI
|
// The user clicked in the GUI
|
||||||
if(affectsGui(event))
|
if(affectsGui(event))
|
||||||
{
|
{
|
||||||
if(data != null && data.length > 0)
|
if(hasData())
|
||||||
{
|
{
|
||||||
switch (event.getAction())
|
switch (event.getAction())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user