A button containing graphical information about CPU and RAM usage aswell as logged in users
This is a button containing some graphical information about the CPU load and RAM usage aswell as the logged in users. The constructor takes a boolean which distinguishes between horizontal and vertical layout.
The methos setServerName takes a string parameter which identifies the server by a name in case multiple buttons are used.
The method setMaxRam takes an int Parameter which defines the max ram the server can use
The method The method updateServerInfo takes 3 parameters: #1(String) the ammount of logged in users #2(double) value < 1 which inidcates the CPU usage #3(int) the amount of RAM which is used. This value should be from the same unit as the value which is set using the method setMaxRam. The unit is not displayed.
Following Styles can be adjusted:
The button itself: server-state-button The name: server-state-server-name The caption of the bars and the users: server-state-caption The label of the logged in users: server-state-users The borders of the bars: bar-border
final ServerStateButton navButton = new ServerStateButton(true); navButton.setServerName("Speedy"); navButton.setMaxRam(4096); navButton.updateServerInfo(5, 0.35, 2699); navButton.setWidth(135, Unit.PIXELS); navButton.setHeight(135, Unit.PIXELS); navButton.addClickListener(event -> navigator.navigateTo(name));
Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.
- Apache License 2.0
- Vaadin 7.6+