Transpiled version (15733L) is out of date.
persistable sclass CollapsibleNorthPanel > MetaWithChangeListeners is Swingable { settableWithVar volatile bool expanded; settable double defaultSplitPoint = 0.5; settableWithVar volatile transient S sidePanelName; transient gettable JComponent sideComponent; transient gettable JComponent mainComponent; transient JSplitPane splitPane; transient SingleComponentPanel scp = singleComponentPanel(); *(bool *expanded) {} *(bool *expanded, S *sidePanelName, JComponent *sideComponent, JComponent *mainComponent) { } void init(S sidePanelName, JComponent sideComponent, JComponent mainComponent) { this.sideComponent = sideComponent; this.mainComponent = mainComponent; sidePanelName(sidePanelName); } void expand { setExpanded(true); } void collapse { setExpanded(false); } void toggle { setExpanded(!expanded); } scaffolded void updateScp() swing { if (expanded) { splitPane().setTopComponent(wrappedSideComponent()); splitPane().setBottomComponent(mainComponent); scp.set(splitPane()); } else { scp.set(northAndCenterWithMargin( collapsedSidePanel(), mainComponent)); } } JComponent expandButton() { print("Making expandButton"); ret jClickableImage_instantToolTip(#1103076, "Expand " + sidePanelName, r expand); } JComponent collapseButton() { print("Making collapseButton"); ret jClickableImage_instantToolTip(#1103104, "Collapse " + sidePanelName, r collapse); } // side component plus heading in expanded view swappable JComponent wrappedSideComponent() { var c = northAndCenterWithMargin( sidePanelHeading(), sideComponent ); ret sidePanelMargins(c); } swappable JComponent collapsedSidePanel() { ret sidePanelMargins(sidePanelHeading()); } JComponent expandOrCollapseButton() { ret expanded ? collapseButton() : expandButton(); } JComponent sidePanelHeading() { ret rightAlignedLineWithSpacing(5, onLeftClick(r toggle, liveValueLabel(varSidePanelName())), expandOrCollapseButton()); } JSplitPane splitPane() { if (splitPane == null) { splitPane = jvsplit_minZero(defaultSplitPoint(), wrappedSideComponent(), null); varExpanded().onChangeAndNow(r updateScp); } ret splitPane; } swappable JComponent sidePanelMargins(JComponent c) { ret c; } visualize { splitPane(); ret scp; } }
Began life as a copy of #1034544
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034942 |
Snippet name: | CollapsibleNorthPanel - collapsible panel at the north of component |
Eternal ID of this version: | #1034942/18 |
Text MD5: | d36521ca68f8c2fac10dd1d7954c4db9 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-12-11 14:35:50 |
Source code size: | 2539 bytes / 85 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 201 / 367 |
Version history: | 17 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |