diff --git a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java index 45cb8c2..9ca729a 100644 --- a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java +++ b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/ChildUtil.java @@ -33,13 +33,13 @@ public ChildUtil (int width, Supplier animation, IPopupPositioner pop this.popupHeight=popupHeight; } - protected void addContainer (ILabeled label, IComponent title, VerticalContainer container, Supplier state, Class stateClass, VerticalContainer parent, IComponentAdder gui, ITheme theme, int logicalLevel, int graphicalLevel, ChildMode mode) { - DraggableComponent,ScrollBarComponent>>> popup; + protected void addContainer (ILabeled label, IComponent title, IComponent container, Supplier state, Class stateClass, VerticalContainer parent, IComponentAdder gui, ITheme theme, int logicalLevel, int graphicalLevel, ChildMode mode) { + DraggableComponent,ScrollBarComponent>>> popup; IToggleable toggle; boolean drawTitle=mode==ChildMode.DRAG_POPUP; switch (mode) { case DOWN: - parent.addComponent(new ClosableComponent(title,container,state,new SimpleToggleable(false),animation.get(),theme.getPanelRenderer(stateClass,logicalLevel,graphicalLevel))); + parent.addComponent(new ClosableComponent(title,container,state,new SimpleToggleable(false),animation.get(),theme.getPanelRenderer(stateClass,logicalLevel,graphicalLevel))); break; case POPUP: case DRAG_POPUP: diff --git a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/SinglePanelAdder.java b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/SinglePanelAdder.java index 37a83a5..8c4844e 100644 --- a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/SinglePanelAdder.java +++ b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/SinglePanelAdder.java @@ -18,7 +18,7 @@ public class SinglePanelAdder implements IComponentAdder { protected final IContainer container; - protected HorizontalContainer title,content; + protected final HorizontalContainer title,content; public SinglePanelAdder (IContainer container, ILabeled label, ITheme theme, Point position, int width, Supplier animation) { this.container=container; diff --git a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/StackedPanelAdder.java b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/StackedPanelAdder.java index a15f692..d4d953a 100644 --- a/panelstudio/src/main/java/com/lukflug/panelstudio/layout/StackedPanelAdder.java +++ b/panelstudio/src/main/java/com/lukflug/panelstudio/layout/StackedPanelAdder.java @@ -10,18 +10,22 @@ import com.lukflug.panelstudio.component.IFixedComponent; import com.lukflug.panelstudio.container.IContainer; import com.lukflug.panelstudio.container.VerticalContainer; +import com.lukflug.panelstudio.layout.ChildUtil.ChildMode; import com.lukflug.panelstudio.setting.ILabeled; +import com.lukflug.panelstudio.setting.Labeled; import com.lukflug.panelstudio.theme.ITheme; import com.lukflug.panelstudio.widget.Button; import com.lukflug.panelstudio.widget.ClosableComponent; public class StackedPanelAdder implements IComponentAdder { protected final IContainer container; - protected VerticalContainer content; + protected final ChildMode mode; + protected final VerticalContainer content; protected final ChildUtil util; - public StackedPanelAdder (IContainer container, ILabeled label, ITheme theme, Point position, int width, Supplier animation, IPopupPositioner popupPos) { + public StackedPanelAdder (IContainer container, ILabeled label, ITheme theme, Point position, int width, Supplier animation, ChildMode mode, IPopupPositioner popupPos) { this.container=container; + this.mode=mode; content=new VerticalContainer(label,theme.getContainerRenderer(-1,-1,true)); container.addComponent(ClosableComponent.createDraggableComponent(new Button(label,theme.getButtonRenderer(Void.class,-1,-1,true)),content,()->null,new SimpleToggleable(true),animation.get(),theme.getPanelRenderer(Void.class,-1,-1),theme.getScrollBarRenderer(Void.class,-1,-1),theme.getEmptySpaceRenderer(Void.class,-1,-1),this::getScrollHeight,this::getComponentWidth,position,width,false)); util=new ChildUtil(width,animation,popupPos,this::getScrollHeight); @@ -29,8 +33,7 @@ public StackedPanelAdder (IContainer container, ILabele @Override public void addComponent(S title, T content, ITheme theme, int logicalLevel, int graphicalLevel, Point position, int width, Supplier animation) { - this.content.addComponent(new ClosableComponent(title,content,()->null,new SimpleToggleable(false),animation.get(),theme.getPanelRenderer(Void.class,logicalLevel,graphicalLevel))); - //util.addContainer(title, title, null, null, null, null, null, theme, logicalLevel, graphicalLevel, null); + util.addContainer(new Labeled(content.getTitle(),null,()->content.isVisible()),title,content,()->null,Void.class,this.content,this,theme,logicalLevel,graphicalLevel,mode); } @Override