I'm creating a kiosk style application which displays custom ScheduleItem components (extends BorderPane) in a VBox.
I plan to provide the controller with a List<ScheduleItem> fullSchedule which it will use to populate the VBox.
What I need to do is check that the next item will fit in the remaining free space of the VBox before I add it, and if not, remember the position in the list and start from there when the scene is refreshed.
This will potentially run on both landscape and portrait screens, so I need a way to dynamically calculate the number of possible events per page.
The ScheduleItem components differ slightly in height depending on content of each item, so ideally the calculation will be performed for each item to be added.
This would throw a spanner in the works for my pagination system being able to calculate total number of pages based on total number of events. If one page displays 5 events, and another displays 4 etc.
The user does not interact, but ideally i'll be able to display the current page number and total number of pages.
I haven't yet looked into any type of pagination, so if this is something that is better handled by the Pagination system, please let me know and I'll remove this question. I haven't been able to find anything related in my searches, other than trying to fill the remaining empty space. I'd just like to calculate it.
Note: I've previously managed this in a PHP/JS application by populating a hidden container and comparing its size to the target container's size. If it exceeds the maximum visible height, don't add the event. I was hoping there might be a simple way with Java FX, as this is difficult to integrate with the pagination system.
Cheers!
Related
How can I have a varying number of buttons with androidstudio? So lets say there is a list and for each (not null) element in this list a button is shown to a particular user. Other users might add or remove elements in this list, i.e. the number of buttons displayed needs to be able to change over time.
I just ask for a hint to an appropriate libary/approach/... to this (google doesnt give good results for this)... the rest i try to figure myself then.
Any help is apprechiated!
I need to test an application through UI where there are two panels.
One being available items and the other is selected items
These panes can contain thousands of items
Each available item has a checkbox used to select it and then the add button will add it to the selected pane.
My problem is there is virtual scrolling implemented on the panels.
Meaning I can only ever access a maximum of 16 items at a time,
(I've tried scrolling down to the bottom - but still, css selectors only work for the items I can see on the screen)
My Question is what is the best way to test this in terms of moving items from one panel to the next?
Possible approaches:
1) Move available items over to the selected items list (16 at a time) and assert they 16 got moved correctly ?
2) Move items over one by one asserting as I go they moved ok
3) Save all available items to a list then add them all over and compared the selected items to the saved list.
Could threading be an option?
Arquillian, Drone and Graphene are used so tests are done with page objects using Java
I'll keep this short. I am creating an Android program to allow users to create test mech builds outside of a video game in order to determine if their build is possible in game before dropping money.
Currently, a user can click "add modules" to choose between a list of items in a dialog to populate the list view. Each mech is limited to certain variables. Such as weight, slots open, hard points, etc. Once your mech weighs so much for instance, the part cannot be added.
I am looking for a way to populate the list and change variables depending on the part chosen (I'm pretty sure a simple if/else statement will work here) and more importantly I am looking for a way to allow the user to click a list item and remove it from list along with removing the added change to the variables (weight, slots, etc). (example: Part A increases tonnage from 0/100 to 10/100 tons. User removes part A and tonnage drops to 0/100 again).
Thanks in advance!
Visual:
Screenshot I do not have the rep to post images.
So I've been developing web applications for 10 years, but have fond memories of working on small swing applications that related to an introductory programming curriculum I was paid to help with before that. I generally like building swing/java UI especially with a decent UI builder. However, in the intervening time I've become very accustomed to providing clear, red error messages of variable length and number when the data on a form is invalid. Sometimes with icons, sometimes with markers on the field etc. Very common stuff that's easy to do in the web world, and is really helpful and improves usability.
Today I was trying to find a way to display a nice list of error messages at the top or bottom of my swing form, icons and field markers can come later, but for now I just want a nice variable sized list of things that need to be corrected, in a red color.
At first blush this seems like it would be easy, but..
JLabel doesn't wrap, so long text is hidden, or you have to make the form ultra wide
JText Area has the same issue unless you define a number of columns, and I want to fill the space available. A set number of columns won't resize.
JTextPane wraps but as far as I can tell it won't turn red unless you get into the whole way over complicated StyledDocument bit. I don't want to do anything more complicated than change the text color so this seems like overkill.
There's also the minor issue of pushing outside the window space, and one can call pack(), but Id like to only increase the height of the form and wrap the text not change the dialog to the width of the message (creating lots of strained layout and dead space if a single long message doubles the width)
I also don't really want to have scroll bars either for the message area or the form as a whole.
This surely is a wheel that's already been invented, so what's the right way to show a list of red (but otherwise unformatted) error messages in a swing form?
Label doesn't wrap, so long text is hidden, or you have to make the
form ultra wide
use HTML
JText Area has the same issue unless you define a number of columns,
and I want to fill the space available. A set number of columns won't
resize.
use word and line wrap
A set number of columns won't resize. and together with "I also don't really want to have scroll bars"
put JTextArea to JScrollPane, to disable JScrollBars, set null for Borders from JScrollPane
JTextPane wraps but as far as I can tell it won't turn red unless you
get into the whole way over complicated StyledDocument bit. I don't
want to do anything more complicated than change the text color so
this seems like overkill.
use HighLighter, but nothing clear from posted description about your issue with StyledDocument
I am trying to make a "Oregon Trail" like game with JAVA for my Computer Science class. It's all going well so far, but I would like some suggestions on ways of doing the following:
The words at the bottom "Health", "Stats", etc are buttons. I was wondering what the best way of making those buttons present information would be. Is there a way I could show them in that information in one of the bottom squares, and when a different button is clicked change the info to that one? Or would it be best to have popup frames to display the information?
IMHO, I'd go with display the content or info of the button in the panels above.
It keeps the information together in a single place and generally makes it easier to manage, no disappearing windows behind other windows for example.
You have any number of options depending on the information you want to display. You could simply use a none editable JTextArea if the information is just text, or a JList if you want to list items if the data is more structured, a JTable and even a JTree if you want to group the data into some kind of groupable hierarchy.
You could use combinations of each, based on your needs