-
Notifications
You must be signed in to change notification settings - Fork 88
Paginated Pane
Languages: Dutch (Nederlands)
Paginated Pane is a little different from the other panes in the sense that it takes in other panes, instead of items like Static Pane and Outline Pane. This pane, like the name suggests, allows you to have multiple pages and cycle between each of them. This is useful for lists which may exceed the maximum size of a GUI.
To create a Paginated Pane just call the constructor for it:
PaginatedPane pane = new PaginatedPane(0, 0, 9, 6);
Now to add panes to the pages, you simply call:
pane.addPane(0, myOtherPane);
Where 0
is the page (pages are zero-indexed) and the pane you want to add (in this case myOtherPane
). Note that the pages don't necessarily have to follow each other up; you can add a fifth page (index four) without having a fourth page (index three), or you can have negative pages, such as -1, -2, etc. however this is heavily discouraged. What you can do however is add multiple panes to the same page. For example calling the same piece of code again, but with a different pane, will add that pane alongside the original pane you added.
If you want to place a pane into a new page, you can use addPage
which will automatically place it in the page after the last existing page.
pane.addPage(myOtherPane);
Panes are relative to the parent pane, so if you position your Paginated Pane at position (1,1) and add a pane which is at position (0,0), the pane will ultimately end up at position (1,1).
You can also set the page the pane should be showing by simply calling setPage
:
pane.setPage(1);
The PaginatedPane
doesn't update itself, however, so to apply the update, you still need to make sure to update the gui as follows:
gui.update();
If you don't need control about each individual pane inside the paginated pane, you can make use of the populateWithItemStacks
and populateWithNames
methods. The populateWithItemStacks
method will fill the entire pane with the items passed, adding pages when needed. The populateWithNames
will fill the entire pane with the same material, but will add the specified name to each ItemStack as presented in the list. It will fill the pane with the same amount of items as there are names in the list passed.
Everything shown at Panes can be used on the Paginated Pane as well.
The element name for a Paginated Pane is paginatedpane
so use that when you want a Paginated Pane inside your XML file.
<paginatedpane x="0" y="0" length="9" height="6"/>
To add a page to the pane, first add a child element called page
.
<paginatedpane x="0" y="0" length="9" height="6">
<page/>
</paginatedpane>
Inside this page, you can add any and all panes you want.
<paginatedpane x="0" y="0" length="9" height="6">
<page>
<staticpane x="0" y="0" length="9" height="6"/>
</page>
</paginatedpane>
Of course you can have multiple pages:
<paginatedpane x="0" y="0" length="9" height="6">
<page>
<staticpane x="0" y="0" length="9" height="6"/>
</page>
<page>
<outlinepane x="0" y="0" length="9" height="6"/>
</page>
</paginatedpane>
Note that the first page you have is page zero, then the page after that is page one, etc. You can't skip any pages, or go into the negative pages when working with XML.