Skip to content

Commit

Permalink
Finished StackedPanelAdder
Browse files Browse the repository at this point in the history
  • Loading branch information
lukflug committed Mar 16, 2021
1 parent 7ead5f0 commit 7574e3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public ChildUtil (int width, Supplier<Animation> animation, IPopupPositioner pop
this.popupHeight=popupHeight;
}

protected <T> void addContainer (ILabeled label, IComponent title, VerticalContainer container, Supplier<T> state, Class<T> stateClass, VerticalContainer parent, IComponentAdder gui, ITheme theme, int logicalLevel, int graphicalLevel, ChildMode mode) {
DraggableComponent<FixedComponent<ClosableComponent<ComponentProxy<IComponent>,ScrollBarComponent<Void,VerticalContainer>>>> popup;
protected <T> void addContainer (ILabeled label, IComponent title, IComponent container, Supplier<T> state, Class<T> stateClass, VerticalContainer parent, IComponentAdder gui, ITheme theme, int logicalLevel, int graphicalLevel, ChildMode mode) {
DraggableComponent<FixedComponent<ClosableComponent<ComponentProxy<IComponent>,ScrollBarComponent<Void,IComponent>>>> popup;
IToggleable toggle;
boolean drawTitle=mode==ChildMode.DRAG_POPUP;
switch (mode) {
case DOWN:
parent.addComponent(new ClosableComponent<IComponent,VerticalContainer>(title,container,state,new SimpleToggleable(false),animation.get(),theme.getPanelRenderer(stateClass,logicalLevel,graphicalLevel)));
parent.addComponent(new ClosableComponent<IComponent,IComponent>(title,container,state,new SimpleToggleable(false),animation.get(),theme.getPanelRenderer(stateClass,logicalLevel,graphicalLevel)));
break;
case POPUP:
case DRAG_POPUP:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public class SinglePanelAdder implements IComponentAdder {
protected final IContainer<? super IFixedComponent> container;
protected HorizontalContainer title,content;
protected final HorizontalContainer title,content;

public SinglePanelAdder (IContainer<? super IFixedComponent> container, ILabeled label, ITheme theme, Point position, int width, Supplier<Animation> animation) {
this.container=container;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,30 @@
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<? super IFixedComponent> container;
protected VerticalContainer content;
protected final ChildMode mode;
protected final VerticalContainer content;
protected final ChildUtil util;

public StackedPanelAdder (IContainer<? super IFixedComponent> container, ILabeled label, ITheme theme, Point position, int width, Supplier<Animation> animation, IPopupPositioner popupPos) {
public StackedPanelAdder (IContainer<? super IFixedComponent> container, ILabeled label, ITheme theme, Point position, int width, Supplier<Animation> 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);
}

@Override
public <S extends IComponent,T extends IComponent> void addComponent(S title, T content, ITheme theme, int logicalLevel, int graphicalLevel, Point position, int width, Supplier<Animation> animation) {
this.content.addComponent(new ClosableComponent<S,T>(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
Expand Down

0 comments on commit 7574e3d

Please sign in to comment.