-
Notifications
You must be signed in to change notification settings - Fork 9
Pages
Being able to split your user interface up into different sections is often advantageous. JISA
allows you to do this by use of the Pages
container. Each element added to a Pages
is added as its own tabbed page.
The first step is to create a Pages
object like so:
Java
Pages pages = new Pages("Title");
Kotlin
val pages = Pages("Title")
Python
pages = Pages("Title")
Then if we called pages.show()
we will see something like this:
This is an empty Pages
element, where the dark section on the left is where the tabs for each page will go and the light section on the right is where the currently selected page will be displayed.
You can then add elements to it by use of the add(...)
or addAll(...)
methods.
To add elements to a Pages
object, simply use the add(...)
or addAll(...)
methods (common to all Container
elements) like so:
Java
Plot plot = new Plot("Plot", "X", "Y");
Table table = new Table("Table");
Pages pages = new Pages("Title")
plot.setIcon(Icon.PLOT);
table.setIcon(Icon.DATA);
pages.addAll(plot,table);
pages.show();
Kotlin
val plot = Plot("Plot", "X", "Y")
val table = Table("Table")
val pages = Pages("Title")
plot.setIcon(Icon.PLOT)
table.setIcon(Icon.DATA)
pages.addAll(table, plot)
pages.show()
Python
plot = Plot("Plot", "X", "Y")
table = Table("Table")
pages = Pages("Title")
plot.setIcon(Icon.PLOT)
table.setIcon(Icon.DATA)
pages.addAll(table, plot)
pages.show()
Note than on any Element
you can set its icon using setIcon(...)
as shown above. This will set what icon appears in its titlebar if shown using show()
as well as what icon is used when part of a Pages
element.
The above examples will result in the following:
Alternatively, you can specify elements to add when instantiating a Pages
object like so:
Kotlin
val plot = Plot("Plot", "X", "Y")
val table = Table("Table")
plot.setIcon(Icon.PLOT)
table.setIcon(Icon.DATA)
val pages = Pages("Title", table, plot)
pages.show()
which will produce the same result.
The user can select which page is shown by clicking on the relevant tab on the left but this can also be done programmatically by use of select(...)
. You can either provide it with the index of the page (ie 0
for first, n-1
for nth) or with the Element
object used to create the page.
Java
Plot plot = new Plot("Plot", "X", "Y");
Table table = new Table("Table");
Pages pages = new Pages("Title", table, plot);
// To select the plot
pages.select(1);
// or
pages.select(plot);
// To select the table:
pages.select(0);
// or
pages.select(table);
Kotlin
val plot = new Plot("Plot", "X", "Y")
val table = new Table("Table")
val pages = new Pages("Title", table, plot)
// To select the plot
pages.select(1)
// or
pages.select(plot)
// To select the table:
pages.select(0)
// or
pages.select(table)
Python
plot = new Plot("Plot", "X", "Y")
table = new Table("Table")
pages = new Pages("Title", table, plot)
# To select the plot
pages.select(1)
# or
pages.select(plot)
# To select the table:
pages.select(0)
# or
pages.select(table)
Sometimes you will want to separate items on the sidebar into sections. This can be done by use of the addSeparator()
method. For instance:
Java / Kotlin / Python
pages.addAll(element1, element2);
pages.addSeparator();
pages.addAll(element3, element4);
the result will look something like this:
Optionally, you can provide a separator with text to produce headings like so:
Java / Kotlin / Python
pages.addSeparator("Section A");
pages.addAll(element1, element2);
pages.addSeparator("Section B");
pages.addAll(element3, element4);
which will result in:
- Getting Started
- Object Orientation
- Choosing a Language
- Using JISA in Java
- Using JISA in Python
- Using JISA in Kotlin
- Exceptions
- Functions as Objects
- Instrument Basics
- SMUs
- Thermometers (and old TCs)
- PID and Temperature Controllers
- Lock-Ins
- Power Supplies
- Pre-Amplifiers
- Writing New Drivers