feat: make stats and last rendered frame panels collapsible

The visual footprint of the client is quite big (520x800 px). This PR allows the use to collapse/expand any of the Global stats, Session infos and Last uploaded frame panels to reduce the vertical visual footprint.

Fixed the wrong size detection at client start issue found by Clou.
This commit is contained in:
Luis Uguina
2020-10-29 22:06:00 +11:00
parent 7c798e6364
commit b21e5c5a2c
4 changed files with 35 additions and 18 deletions

View File

@@ -28,6 +28,8 @@ import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import com.sheepit.client.standalone.swing.activity.Activity;
public class CollapsibleJPanel extends JPanel {
private boolean isCompnentsVisible = true;
@@ -35,10 +37,12 @@ public class CollapsibleJPanel extends JPanel {
private String borderTitle = "";
private int COLLAPSED_HEIGHT = 22;
private boolean[] originalVisibilty;
private Activity parent;
public CollapsibleJPanel(LayoutManager layoutManager) {
public CollapsibleJPanel(LayoutManager layoutManager, Activity parent) {
setLayout(layoutManager);
addMouseListener(new onClickHandler());
this.parent = parent;
}
public void setCollapsed(boolean aFlag) {
@@ -134,6 +138,9 @@ public class CollapsibleJPanel extends JPanel {
if (e.getPoint().y < COLLAPSED_HEIGHT) { // Only if click is on top of panel
((CollapsibleJPanel) e.getComponent()).toggleCollapsed();
}
// Recalculate the proper window size
parent.resizeWindow();
}
@Override public void mouseEntered(MouseEvent e) {