Refactor control rendering data handling

- Replaced multiple custom data fields in G2DDrawControl with specific data classes for each control type (LabelData, ButtonData, ToggleButtonData, etc.).
- Updated setCustomData methods to setControlData, allowing for type-safe handling of control-specific data.
- Modified control implementations (e.g., G2DButtonControlImpl, G2DLabelControlImpl) to utilize the new data classes.
- Adjusted the ControlRenderingBo interface to reflect the new data structure and removed deprecated custom data methods.
- Updated demo module to use the new control data structure for button and label controls.
This commit is contained in:
extio-de
2026-01-03 19:29:59 +01:00
parent ca3c908620
commit 712e49d7aa
17 changed files with 304 additions and 320 deletions

View File

@@ -15,6 +15,7 @@ import de.extio.game_engine.renderer.model.RenderingBoHasDimension;
import de.extio.game_engine.renderer.model.RenderingBoLayer; import de.extio.game_engine.renderer.model.RenderingBoLayer;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SliderControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SliderControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SliderData;
import de.extio.game_engine.renderer.model.event.MouseClickEvent; import de.extio.game_engine.renderer.model.event.MouseClickEvent;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
import de.extio.game_engine.renderer.work.RenderingBoPool; import de.extio.game_engine.renderer.work.RenderingBoPool;
@@ -132,9 +133,7 @@ public class ScrollArea implements WindowComponent {
if (needsVerticalScrollbar) { if (needsVerticalScrollbar) {
final var verticalScrollbar = this.renderingBoPool.acquire(this.verticalScrollbarName, ControlRenderingBo.class) final var verticalScrollbar = this.renderingBoPool.acquire(this.verticalScrollbarName, ControlRenderingBo.class)
.setType(SliderControl.class) .setType(SliderControl.class)
.setCustomData(Boolean.FALSE) .setControlData(new SliderData(false, this.scrollPositionVertical, this.scrollPositionVertical, null))
.setCustomData2(this.scrollPositionVertical)
.setCustomData3(this.scrollPositionVertical)
.setEnabled(true) .setEnabled(true)
.setVisible(true) .setVisible(true)
.withDimensionAbsolute(SCROLLBAR_WIDTH, this.relativeArea.getDimension().getY() - SCROLLBAR_WIDTH) .withDimensionAbsolute(SCROLLBAR_WIDTH, this.relativeArea.getDimension().getY() - SCROLLBAR_WIDTH)
@@ -149,9 +148,7 @@ public class ScrollArea implements WindowComponent {
if (needsHorizontalScrollbar) { if (needsHorizontalScrollbar) {
final var horizontalScrollbar = this.renderingBoPool.acquire(this.horizontalScrollbarName, ControlRenderingBo.class) final var horizontalScrollbar = this.renderingBoPool.acquire(this.horizontalScrollbarName, ControlRenderingBo.class)
.setType(SliderControl.class) .setType(SliderControl.class)
.setCustomData(Boolean.TRUE) .setControlData(new SliderData(true, this.scrollPositionHorizontal, this.scrollPositionHorizontal, null))
.setCustomData2(this.scrollPositionHorizontal)
.setCustomData3(this.scrollPositionHorizontal)
.setEnabled(true) .setEnabled(true)
.setVisible(true) .setVisible(true)
.withDimensionAbsolute(this.relativeArea.getDimension().getX() - SCROLLBAR_WIDTH, SCROLLBAR_WIDTH) .withDimensionAbsolute(this.relativeArea.getDimension().getX() - SCROLLBAR_WIDTH, SCROLLBAR_WIDTH)

View File

@@ -22,6 +22,8 @@ import de.extio.game_engine.renderer.model.RenderingBoLayer;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowCloseButtonControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowCloseButtonControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowPanelControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowPanelControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowPanelData;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowCloseButtonData;
import de.extio.game_engine.renderer.model.bo.HorizontalAlignment; import de.extio.game_engine.renderer.model.bo.HorizontalAlignment;
import de.extio.game_engine.renderer.model.bo.VerticalAlignment; import de.extio.game_engine.renderer.model.bo.VerticalAlignment;
import de.extio.game_engine.renderer.model.event.MouseClickEvent; import de.extio.game_engine.renderer.model.event.MouseClickEvent;
@@ -245,7 +247,7 @@ public class Window extends AbstractClientModule implements InitializingBean {
final var windowPanel = this.renderingBoPool.acquire(this.id + "_WindowPanel", ControlRenderingBo.class) final var windowPanel = this.renderingBoPool.acquire(this.id + "_WindowPanel", ControlRenderingBo.class)
.setType(WindowPanelControl.class) .setType(WindowPanelControl.class)
.setCustomData(true) .setControlData(new WindowPanelData(true, null))
.setEnabled(true) .setEnabled(true)
.setVisible(true) .setVisible(true)
.withDimensionAbsolute(this.area.getDimension()) .withDimensionAbsolute(this.area.getDimension())
@@ -258,7 +260,7 @@ public class Window extends AbstractClientModule implements InitializingBean {
this.closeButtonName = this.id + "_CloseButton"; this.closeButtonName = this.id + "_CloseButton";
final var closeButtonBo = this.renderingBoPool.acquire(this.closeButtonName, ControlRenderingBo.class) final var closeButtonBo = this.renderingBoPool.acquire(this.closeButtonName, ControlRenderingBo.class)
.setType(WindowCloseButtonControl.class) .setType(WindowCloseButtonControl.class)
.setCustomData(true) .setControlData(new WindowCloseButtonData(true))
.setEnabled(true) .setEnabled(true)
.setVisible(true) .setVisible(true)
.withDimensionAbsolute(this.area.getDimension()) .withDimensionAbsolute(this.area.getDimension())

View File

@@ -29,9 +29,6 @@ import de.extio.game_engine.renderer.g2d.control.impl.G2DWindowPanelControlImpl;
import de.extio.game_engine.renderer.model.RenderingBo; import de.extio.game_engine.renderer.model.RenderingBo;
import de.extio.game_engine.renderer.model.RenderingBoLayer; import de.extio.game_engine.renderer.model.RenderingBoLayer;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo;
import de.extio.game_engine.renderer.model.bo.HorizontalAlignment;
import de.extio.game_engine.renderer.model.color.RgbaColor;
import de.extio.game_engine.resource.StaticResource;
import de.extio.game_engine.spatial2.SpatialUtils2; import de.extio.game_engine.spatial2.SpatialUtils2;
import de.extio.game_engine.spatial2.model.Area2; import de.extio.game_engine.spatial2.model.Area2;
import de.extio.game_engine.spatial2.model.ImmutableCoordI2; import de.extio.game_engine.spatial2.model.ImmutableCoordI2;
@@ -55,13 +52,25 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
private int fontSize = G2DDrawFont.FONT_SIZE_DEFAULT; private int fontSize = G2DDrawFont.FONT_SIZE_DEFAULT;
private Object customData; private LabelData labelData;
private Object customData2; private ButtonData buttonData;
private Object customData3; private ToggleButtonData toggleButtonData;
private Object customData4; private SwitchData switchData;
private WindowCloseButtonData windowCloseButtonData;
private WindowPanelData windowPanelData;
private TextfieldData textfieldData;
private SliderData sliderData;
private TableData tableData;
private SetFocusData setFocusData;
private boolean visible; private boolean visible;
@@ -104,26 +113,37 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
} }
@Override @Override
public ControlRenderingBo setCustomData(final Object data) { public ControlRenderingBo setControlData(final Object data) {
this.customData = data; if (data instanceof final LabelData labelData) {
return this; this.labelData = labelData;
} }
else if (data instanceof final ButtonData buttonData) {
@Override this.buttonData = buttonData;
public ControlRenderingBo setCustomData2(final Object data) {
this.customData2 = data;
return this;
} }
else if (data instanceof final ToggleButtonData toggleButtonData) {
@Override this.toggleButtonData = toggleButtonData;
public ControlRenderingBo setCustomData3(final Object data) { }
this.customData3 = data; else if (data instanceof final SwitchData switchData) {
return this; this.switchData = switchData;
}
else if (data instanceof final WindowCloseButtonData windowCloseButtonData) {
this.windowCloseButtonData = windowCloseButtonData;
}
else if (data instanceof final WindowPanelData windowPanelData) {
this.windowPanelData = windowPanelData;
}
else if (data instanceof final TextfieldData textfieldData) {
this.textfieldData = textfieldData;
}
else if (data instanceof final SliderData sliderData) {
this.sliderData = sliderData;
}
else if (data instanceof final TableData tableData) {
this.tableData = tableData;
}
else if (data instanceof final SetFocusData setFocusData) {
this.setFocusData = setFocusData;
} }
@Override
public ControlRenderingBo setCustomData4(final Object data) {
this.customData4 = data;
return this; return this;
} }
@@ -224,8 +244,8 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
.setControlGroup(this.controlGroup) .setControlGroup(this.controlGroup)
.setRendererData(this.rendererData) .setRendererData(this.rendererData)
.setControlId(this.id); .setControlId(this.id);
if (this.clazz == TextfieldControl.class && this.customData instanceof Boolean) { if (this.clazz == TextfieldControl.class && this.textfieldData != null) {
((TextfieldControl) control).setMultiLine(((Boolean) this.customData).booleanValue()); ((TextfieldControl) control).setCustomData(this.textfieldData);
} }
this.setControlProps(control, scaleFactor); this.setControlProps(control, scaleFactor);
@@ -251,7 +271,6 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
control.render(); control.render();
} }
@SuppressWarnings("unchecked")
private void setControlProps(final G2DBaseControlImpl control, final double scaleFactor) { private void setControlProps(final G2DBaseControlImpl control, final double scaleFactor) {
control.setScaleFactor(scaleFactor); control.setScaleFactor(scaleFactor);
control.setX((int) (this.x * scaleFactor)); control.setX((int) (this.x * scaleFactor));
@@ -271,90 +290,35 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
(int) (this.visibleAreaWidth * scaleFactor), (int) (this.visibleAreaWidth * scaleFactor),
(int) (this.visibleAreaHeight * scaleFactor)); (int) (this.visibleAreaHeight * scaleFactor));
if (this.clazz == LabelControl.class) { if (this.clazz == LabelControl.class && this.labelData != null) {
((LabelControl) control).setForegroundColor(this.color); ((LabelControl) control).setCustomData(this.labelData);
if (this.customData instanceof RgbaColor) {
((LabelControl) control).setBackgroundColor((RgbaColor) this.customData);
} }
if (this.customData2 instanceof HorizontalAlignment) { else if (this.clazz == ToggleButtonControl.class && this.toggleButtonData != null) {
((LabelControl) control).setTextAlignment((HorizontalAlignment) this.customData2); ((ToggleButtonControl) control).setCustomData(this.toggleButtonData);
} }
else if (this.clazz == SwitchControl.class && this.switchData != null) {
((SwitchControl) control).setCustomData(this.switchData);
} }
else if (this.clazz == ToggleButtonControl.class) { else if (this.clazz == ButtonControl.class && this.buttonData != null) {
((ButtonControl) control).setBackgroundColor(this.color); ((ButtonControl) control).setCustomData(this.buttonData);
if (this.customData instanceof Boolean) {
((ToggleButtonControl) control).setToggled(((Boolean) this.customData).booleanValue());
} }
if (this.customData2 instanceof StaticResource) { else if (this.clazz == WindowCloseButtonControl.class && this.windowCloseButtonData != null) {
((ButtonControl) control).setIconResource((StaticResource) this.customData2); ((WindowCloseButtonControl) control).setCustomData(this.windowCloseButtonData);
} }
else if (this.clazz == WindowPanelControl.class && this.windowPanelData != null) {
((WindowPanelControl) control).setCustomData(this.windowPanelData);
} }
else if (this.clazz == SwitchControl.class) { else if (this.clazz == SliderControl.class && this.sliderData != null) {
((ButtonControl) control).setBackgroundColor(this.color); ((SliderControl) control).setCustomData(this.sliderData);
if (this.customData instanceof Boolean) {
((SwitchControl) control).setToggled(((Boolean) this.customData).booleanValue());
} }
if (this.customData2 instanceof StaticResource) { else if (this.clazz == TableControl.class && this.tableData != null) {
((ButtonControl) control).setIconResource((StaticResource) this.customData2); ((TableControl) control).setCustomData(this.tableData);
} }
if (this.customData4 instanceof Boolean) { else if (this.clazz == SetFocusControl.class && this.setFocusData != null) {
((SwitchControl) control).setDrawBorder(((Boolean) this.customData4).booleanValue()); ((SetFocusControl) control).setCustomData(this.setFocusData);
}
}
else if (this.clazz == ButtonControl.class) {
((ButtonControl) control).setBackgroundColor(this.color);
if (this.customData2 instanceof StaticResource) {
((ButtonControl) control).setIconResource((StaticResource) this.customData2);
}
}
else if (this.clazz == WindowCloseButtonControl.class) {
((ButtonControl) control).setBackgroundColor(this.color);
if (this.customData instanceof Boolean) {
((WindowCloseButtonControl) control).setThickBorder(((Boolean) this.customData).booleanValue());
}
}
else if (this.clazz == WindowPanelControl.class) {
((WindowPanelControl) control).setColor(this.color);
if (this.customData instanceof Boolean) {
((WindowPanelControl) control).setThickBorder(((Boolean) this.customData).booleanValue());
}
}
else if (this.clazz == SliderControl.class) {
((SliderControl) control).setColor(this.color);
if (this.customData instanceof Boolean) {
((SliderControl) control).setHorizontal(((Boolean) this.customData).booleanValue());
}
if (this.customData2 instanceof Double) {
((SliderControl) control).setValue(((Double) this.customData2).doubleValue());
}
if (this.customData3 instanceof Double) {
((SliderControl) control).setValue2(((Double) this.customData3).doubleValue());
}
}
else if (this.clazz == TableControl.class) {
if (this.customData instanceof List) {
((TableControl) control).setData((List<Object>) this.customData);
}
if (this.customData2 instanceof Integer) {
((TableControl) control).setRows((Integer) this.customData2);
}
if (this.customData3 instanceof Long) {
((TableControl) control).setVersion((Long) this.customData3);
}
if (this.customData4 instanceof Boolean) { // This parameter could be changed to a more generic way to set column sizing
((TableControl) control).setFirstColDoubleSize((Boolean) this.customData4);
}
}
else if (this.clazz == SetFocusControl.class) {
if (this.customData instanceof String) {
((SetFocusControl) control).setFocusId((String) this.customData);
}
}
else if (this.clazz == TextfieldControl.class) {
((TextfieldControl) control).setBackgroundColor(this.color);
if (this.customData2 instanceof Boolean) {
((TextfieldControl) control).setReadonly((Boolean) this.customData2);
} }
else if (this.clazz == TextfieldControl.class && this.textfieldData != null) {
((TextfieldControl) control).setCustomData(this.textfieldData);
} }
} }
@@ -368,10 +332,16 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
this.caption = o.caption; this.caption = o.caption;
this.controlGroup = o.controlGroup; this.controlGroup = o.controlGroup;
this.fontSize = o.fontSize; this.fontSize = o.fontSize;
this.customData = o.customData; this.labelData = o.labelData;
this.customData2 = o.customData2; this.buttonData = o.buttonData;
this.customData3 = o.customData3; this.toggleButtonData = o.toggleButtonData;
this.customData4 = o.customData4; this.switchData = o.switchData;
this.windowCloseButtonData = o.windowCloseButtonData;
this.windowPanelData = o.windowPanelData;
this.textfieldData = o.textfieldData;
this.sliderData = o.sliderData;
this.tableData = o.tableData;
this.setFocusData = o.setFocusData;
this.visible = o.visible; this.visible = o.visible;
this.enabled = o.enabled; this.enabled = o.enabled;
this.tooltip = o.tooltip; this.tooltip = o.tooltip;
@@ -389,10 +359,16 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
this.caption = null; this.caption = null;
this.controlGroup = null; this.controlGroup = null;
this.fontSize = G2DDrawFont.FONT_SIZE_DEFAULT; this.fontSize = G2DDrawFont.FONT_SIZE_DEFAULT;
this.customData = null; this.labelData = null;
this.customData2 = null; this.buttonData = null;
this.customData3 = null; this.toggleButtonData = null;
this.customData4 = null; this.switchData = null;
this.windowCloseButtonData = null;
this.windowPanelData = null;
this.textfieldData = null;
this.sliderData = null;
this.tableData = null;
this.setFocusData = null;
this.visible = false; this.visible = false;
this.enabled = true; this.enabled = true;
this.tooltip = null; this.tooltip = null;

View File

@@ -4,12 +4,29 @@ import de.extio.game_engine.renderer.g2d.control.G2DDrawControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SwitchControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SwitchControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ToggleButtonControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ToggleButtonControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ToggleButtonData;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SwitchData;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
public abstract class G2DAbstractToggleButtonControlImpl extends G2DButtonControlImpl implements ToggleButtonControl, SwitchControl { public abstract class G2DAbstractToggleButtonControlImpl extends G2DButtonControlImpl implements ToggleButtonControl, SwitchControl {
protected boolean drawBorder = true; protected boolean drawBorder = true;
protected void applyToggleButtonData(final ToggleButtonData data) {
if (data != null) {
this.setToggled(data.toggled());
this.setIconResource(data.iconResource());
}
}
protected void applySwitchData(final SwitchData data) {
if (data != null) {
this.setToggled(data.toggled());
this.setIconResource(data.iconResource());
this.setDrawBorder(data.drawBorder());
}
}
@Override @Override
public void performAction() { public void performAction() {
if (this.enabled) { if (this.enabled) {
@@ -18,26 +35,22 @@ public abstract class G2DAbstractToggleButtonControlImpl extends G2DButtonContro
} }
} }
@Override private boolean isToggled() {
public boolean isToggled() {
return this.control.isToggled(); return this.control.isToggled();
} }
@Override private void setToggled(final boolean toggled) {
public void setToggled(final boolean toggled) {
if (this.control != null && toggled != this.control.isToggled()) { if (this.control != null && toggled != this.control.isToggled()) {
this.control.setToggled(toggled); this.control.setToggled(toggled);
this.manageCtrlGroupToggleState(); this.manageCtrlGroupToggleState();
} }
} }
@Override private boolean isDrawBorder() {
public boolean isDrawBorder() {
return this.drawBorder; return this.drawBorder;
} }
@Override private void setDrawBorder(final boolean draw) {
public void setDrawBorder(final boolean draw) {
this.modified |= draw != this.drawBorder; this.modified |= draw != this.drawBorder;
this.drawBorder = draw; this.drawBorder = draw;
} }

View File

@@ -7,6 +7,7 @@ import de.extio.game_engine.renderer.g2d.control.components.CustomAbstractButton
import de.extio.game_engine.renderer.g2d.control.components.CustomButton; import de.extio.game_engine.renderer.g2d.control.components.CustomButton;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ButtonControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ButtonControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ButtonData;
import de.extio.game_engine.renderer.model.color.RgbaColor; import de.extio.game_engine.renderer.model.color.RgbaColor;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
import de.extio.game_engine.resource.StaticResource; import de.extio.game_engine.resource.StaticResource;
@@ -19,6 +20,14 @@ public class G2DButtonControlImpl extends G2DBaseControlImpl implements ButtonCo
private RgbaColor backgroundColor; private RgbaColor backgroundColor;
@Override
public void setCustomData(final ButtonData data) {
if (data != null) {
this.setBackgroundColor(data.backgroundColor());
this.setIconResource(data.iconResource());
}
}
@Override @Override
public void build() { public void build() {
super.build(); super.build();
@@ -92,24 +101,20 @@ public class G2DButtonControlImpl extends G2DBaseControlImpl implements ButtonCo
} }
} }
@Override protected void setIconResource(final StaticResource iconResource) {
public void setIconResource(final StaticResource iconResource) {
this.modified |= !Objects.equals(this.iconResource, iconResource); this.modified |= !Objects.equals(this.iconResource, iconResource);
this.iconResource = iconResource; this.iconResource = iconResource;
} }
@Override private StaticResource getIconResource() {
public StaticResource getIconResource() {
return this.iconResource; return this.iconResource;
} }
@Override private RgbaColor getBackgroundColor() {
public RgbaColor getBackgroundColor() {
return this.backgroundColor; return this.backgroundColor;
} }
@Override private void setBackgroundColor(final RgbaColor backgroundColor) {
public void setBackgroundColor(final RgbaColor backgroundColor) {
this.modified |= !Objects.equals(this.backgroundColor, backgroundColor); this.modified |= !Objects.equals(this.backgroundColor, backgroundColor);
this.backgroundColor = backgroundColor; this.backgroundColor = backgroundColor;
} }

View File

@@ -4,6 +4,7 @@ import de.extio.game_engine.renderer.g2d.G2DRenderer;
import de.extio.game_engine.renderer.g2d.control.components.CustomLabel; import de.extio.game_engine.renderer.g2d.control.components.CustomLabel;
import de.extio.game_engine.renderer.model.bo.HorizontalAlignment; import de.extio.game_engine.renderer.model.bo.HorizontalAlignment;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.LabelControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.LabelControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.LabelData;
import de.extio.game_engine.renderer.model.color.RgbaColor; import de.extio.game_engine.renderer.model.color.RgbaColor;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
@@ -18,34 +19,37 @@ public class G2DLabelControlImpl extends G2DBaseControlImpl implements LabelCont
protected HorizontalAlignment textAlignment; protected HorizontalAlignment textAlignment;
@Override @Override
public RgbaColor getBackgroundColor() { public void setCustomData(final LabelData data) {
if (data != null) {
this.setBackgroundColor(data.backgroundColor());
this.setForegroundColor(data.foregroundColor());
this.setTextAlignment(data.textAlignment());
}
}
private RgbaColor getBackgroundColor() {
return this.backgroundColor; return this.backgroundColor;
} }
@Override private void setBackgroundColor(final RgbaColor color) {
public void setBackgroundColor(final RgbaColor color) {
this.modified |= (color == null) ? this.backgroundColor != null : !color.equals(this.backgroundColor); this.modified |= (color == null) ? this.backgroundColor != null : !color.equals(this.backgroundColor);
this.backgroundColor = color; this.backgroundColor = color;
} }
@Override private RgbaColor getForegroundColor() {
public RgbaColor getForegroundColor() {
return this.foregroundColor; return this.foregroundColor;
} }
@Override private void setForegroundColor(final RgbaColor color) {
public void setForegroundColor(final RgbaColor color) {
this.modified |= (color != null) && !color.equals(this.foregroundColor); this.modified |= (color != null) && !color.equals(this.foregroundColor);
this.foregroundColor = color; this.foregroundColor = color;
} }
@Override private HorizontalAlignment getTextAlignment() {
public HorizontalAlignment getTextAlignment() {
return this.textAlignment; return this.textAlignment;
} }
@Override private void setTextAlignment(final HorizontalAlignment alignment) {
public void setTextAlignment(final HorizontalAlignment alignment) {
this.modified |= alignment != this.textAlignment; this.modified |= alignment != this.textAlignment;
this.textAlignment = alignment; this.textAlignment = alignment;
} }

View File

@@ -2,18 +2,24 @@ package de.extio.game_engine.renderer.g2d.control.impl;
import de.extio.game_engine.renderer.g2d.G2DRenderer; import de.extio.game_engine.renderer.g2d.G2DRenderer;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SetFocusControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SetFocusControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SetFocusData;
public class G2DSetFocusControl extends G2DBaseControlImpl implements SetFocusControl { public class G2DSetFocusControl extends G2DBaseControlImpl implements SetFocusControl {
protected String focusId; protected String focusId;
@Override @Override
public String getFocusId() { public void setCustomData(final SetFocusData data) {
if (data != null) {
this.setFocusId(data.focusId());
}
}
private String getFocusId() {
return this.focusId; return this.focusId;
} }
@Override private void setFocusId(final String id) {
public void setFocusId(final String id) {
this.focusId = id; this.focusId = id;
} }

View File

@@ -6,6 +6,7 @@ import de.extio.game_engine.renderer.g2d.G2DRenderer;
import de.extio.game_engine.renderer.g2d.control.components.CustomSlider; import de.extio.game_engine.renderer.g2d.control.components.CustomSlider;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SliderControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SliderControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SliderData;
import de.extio.game_engine.renderer.model.color.RgbaColor; import de.extio.game_engine.renderer.model.color.RgbaColor;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
@@ -23,6 +24,16 @@ public class G2DSliderControlImpl extends G2DBaseControlImpl implements SliderCo
protected Consumer<Double> actionConsumer; protected Consumer<Double> actionConsumer;
@Override
public void setCustomData(final SliderData data) {
if (data != null) {
this.setColor(data.color());
this.setHorizontal(data.horizontal());
this.setValue(data.value());
this.setValue2(data.value2());
}
}
public G2DSliderControlImpl() { public G2DSliderControlImpl() {
} }
@@ -31,46 +42,38 @@ public class G2DSliderControlImpl extends G2DBaseControlImpl implements SliderCo
this.actionConsumer = actionConsumer; this.actionConsumer = actionConsumer;
} }
@Override RgbaColor getColor() {
public RgbaColor getColor() {
return this.color; return this.color;
} }
@Override void setColor(final RgbaColor color) {
public void setColor(final RgbaColor color) {
this.modified |= (color != null) && !color.equals(this.color); this.modified |= (color != null) && !color.equals(this.color);
this.color = color; this.color = color;
} }
@Override double getValue() {
public double getValue() {
return this.lastValue; return this.lastValue;
} }
@Override void setValue(final double value) {
public void setValue(final double value) {
this.modified |= value != this.lastValue; this.modified |= value != this.lastValue;
this.lastValue = value; this.lastValue = value;
} }
@Override double getValue2() {
public double getValue2() {
return this.lastValue2; return this.lastValue2;
} }
@Override void setValue2(final double value2) {
public void setValue2(final double value2) {
this.modified |= value2 != this.lastValue2; this.modified |= value2 != this.lastValue2;
this.lastValue2 = value2; this.lastValue2 = value2;
} }
@Override boolean isHorizontal() {
public boolean isHorizontal() {
return this.horizontal; return this.horizontal;
} }
@Override void setHorizontal(final boolean horizontal) {
public void setHorizontal(final boolean horizontal) {
this.modified |= horizontal != this.horizontal; this.modified |= horizontal != this.horizontal;
this.horizontal = horizontal; this.horizontal = horizontal;
} }

View File

@@ -2,9 +2,21 @@ package de.extio.game_engine.renderer.g2d.control.impl;
import de.extio.game_engine.renderer.g2d.control.components.CustomSwitch; import de.extio.game_engine.renderer.g2d.control.components.CustomSwitch;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SwitchData;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ToggleButtonData;
public class G2DSwitchControlImpl extends G2DAbstractToggleButtonControlImpl { public class G2DSwitchControlImpl extends G2DAbstractToggleButtonControlImpl {
@Override
public void setCustomData(final SwitchData data) {
this.applySwitchData(data);
}
@Override
public void setCustomData(final ToggleButtonData data) {
// Not used in Switch
}
@Override @Override
protected void createControl() { protected void createControl() {
this.control = new CustomSwitch(true, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager()); this.control = new CustomSwitch(true, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager());

View File

@@ -22,6 +22,7 @@ import de.extio.game_engine.renderer.g2d.control.components.CustomTable;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TableControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TableControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TableData;
import de.extio.game_engine.renderer.model.color.RgbaColor; import de.extio.game_engine.renderer.model.color.RgbaColor;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
import de.extio.game_engine.spatial2.model.ImmutableCoordI2; import de.extio.game_engine.spatial2.model.ImmutableCoordI2;
@@ -52,6 +53,16 @@ public class G2DTableControlImpl extends G2DBaseControlImpl implements TableCont
}); });
} }
@Override
public void setCustomData(final TableData data) {
if (data != null) {
this.setData(data.data());
this.setRows(data.rows());
this.setVersion(data.version());
this.setFirstColDoubleSize(data.firstColDoubleSize());
}
}
@Override @Override
public void build() { public void build() {
super.build(); super.build();
@@ -247,45 +258,37 @@ public class G2DTableControlImpl extends G2DBaseControlImpl implements TableCont
return super.setControlId(id); return super.setControlId(id);
} }
@Override private List<Object> getData() {
public List<Object> getData() {
return this.data; return this.data;
} }
@Override private void setData(final List<Object> data) {
public void setData(final List<Object> data) {
this.data = data; this.data = data;
} }
@Override private int getRows() {
public int getRows() {
return this.rows; return this.rows;
} }
@Override private void setRows(final int rows) {
public void setRows(final int rows) {
this.rows = rows; this.rows = rows;
} }
@Override private long getVersion() {
public long getVersion() {
return this.version; return this.version;
} }
@Override private void setVersion(final long version) {
public void setVersion(final long version) {
this.modified |= version != this.version; this.modified |= version != this.version;
this.dataModified |= version != this.version; this.dataModified |= version != this.version;
this.version = version; this.version = version;
} }
@Override private boolean isFirstColDoubleSize() {
public boolean isFirstColDoubleSize() {
return this.firstColDoubleSize; return this.firstColDoubleSize;
} }
@Override private void setFirstColDoubleSize(final boolean firstColDoubleSize) {
public void setFirstColDoubleSize(final boolean firstColDoubleSize) {
this.firstColDoubleSize = firstColDoubleSize; this.firstColDoubleSize = firstColDoubleSize;
} }

View File

@@ -14,6 +14,7 @@ import de.extio.game_engine.renderer.g2d.control.components.CustomTextField;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TextfieldControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TextfieldControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TextfieldData;
import de.extio.game_engine.renderer.model.color.RgbaColor; import de.extio.game_engine.renderer.model.color.RgbaColor;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
@@ -26,12 +27,19 @@ public class G2DTextfieldControlImpl extends G2DBaseControlImpl implements Textf
private String lastText; private String lastText;
@Override @Override
public boolean isMultiLine() { public void setCustomData(final TextfieldData data) {
if (data != null) {
this.setMultiLine(data.multiLine());
this.setReadonly(data.readonly());
this.setBackgroundColor(data.backgroundColor());
}
}
private boolean isMultiLine() {
return this.multiLine; return this.multiLine;
} }
@Override private void setMultiLine(final boolean multiLine) {
public void setMultiLine(final boolean multiLine) {
if (this.textComponent != null) { if (this.textComponent != null) {
throw new UnsupportedOperationException("Multiline property is read-only after initial control creation"); throw new UnsupportedOperationException("Multiline property is read-only after initial control creation");
} }
@@ -165,23 +173,19 @@ public class G2DTextfieldControlImpl extends G2DBaseControlImpl implements Textf
} }
} }
@Override private RgbaColor getBackgroundColor() {
public RgbaColor getBackgroundColor() {
return null; return null;
} }
@Override private void setBackgroundColor(final RgbaColor color) {
public void setBackgroundColor(final RgbaColor color) {
} }
@Override private boolean isReadonly() {
public boolean isReadonly() {
return false; return false;
} }
@Override private void setReadonly(final boolean readonly) {
public void setReadonly(final boolean readonly) {
} }

View File

@@ -17,6 +17,7 @@ import de.extio.game_engine.renderer.g2d.control.components.CustomJTextField;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.BaseControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TextfieldControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TextfieldControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.TextfieldData;
import de.extio.game_engine.renderer.model.color.RgbaColor; import de.extio.game_engine.renderer.model.color.RgbaColor;
import de.extio.game_engine.renderer.model.event.UiControlEvent; import de.extio.game_engine.renderer.model.event.UiControlEvent;
@@ -42,43 +43,46 @@ public class G2DTextfieldControlImpl2 extends G2DBaseControlImpl implements Text
private double scrollPositionPerc = 0.0; private double scrollPositionPerc = 0.0;
@Override
public void setCustomData(final TextfieldData data) {
if (data != null) {
this.setMultiLine(data.multiLine());
this.setReadonly(data.readonly());
this.setBackgroundColor(data.backgroundColor());
}
}
public G2DTextfieldControlImpl2() { public G2DTextfieldControlImpl2() {
this.scrollbar = new G2DSliderControlImpl(value -> { this.scrollbar = new G2DSliderControlImpl(value -> {
this.onScroll(value.doubleValue()); this.onScroll(value.doubleValue());
}); });
} }
@Override private RgbaColor getBackgroundColor() {
public RgbaColor getBackgroundColor() {
return this.backgroundColor; return this.backgroundColor;
} }
@Override private void setBackgroundColor(final RgbaColor color) {
public void setBackgroundColor(final RgbaColor color) {
this.modified |= (color == null) ? this.backgroundColor != null : !color.equals(this.backgroundColor); this.modified |= (color == null) ? this.backgroundColor != null : !color.equals(this.backgroundColor);
this.backgroundColor = color; this.backgroundColor = color;
} }
@Override private boolean isMultiLine() {
public boolean isMultiLine() {
return this.multiLine; return this.multiLine;
} }
@Override private void setMultiLine(final boolean multiLine) {
public void setMultiLine(final boolean multiLine) {
if (this.textComponent != null) { if (this.textComponent != null) {
throw new UnsupportedOperationException("Multiline property is read-only after initial control creation"); throw new UnsupportedOperationException("Multiline property is read-only after initial control creation");
} }
this.multiLine = multiLine; this.multiLine = multiLine;
} }
@Override private boolean isReadonly() {
public boolean isReadonly() {
return this.readonly; return this.readonly;
} }
@Override private void setReadonly(final boolean readonly) {
public void setReadonly(final boolean readonly) {
this.modified |= readonly != this.readonly; this.modified |= readonly != this.readonly;
this.readonly = readonly; this.readonly = readonly;
} }

View File

@@ -3,9 +3,21 @@ package de.extio.game_engine.renderer.g2d.control.impl;
import de.extio.game_engine.renderer.g2d.G2DRenderer; import de.extio.game_engine.renderer.g2d.G2DRenderer;
import de.extio.game_engine.renderer.g2d.control.components.CustomButton; import de.extio.game_engine.renderer.g2d.control.components.CustomButton;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ToggleButtonData;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SwitchData;
public class G2DToggleButtonControlImpl extends G2DAbstractToggleButtonControlImpl { public class G2DToggleButtonControlImpl extends G2DAbstractToggleButtonControlImpl {
@Override
public void setCustomData(final ToggleButtonData data) {
this.applyToggleButtonData(data);
}
@Override
public void setCustomData(final SwitchData data) {
// Not used in ToggleButton
}
@Override @Override
protected void createControl() { protected void createControl() {
this.control = new CustomButton(true, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager()); this.control = new CustomButton(true, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager());

View File

@@ -4,6 +4,7 @@ import de.extio.game_engine.renderer.g2d.G2DRenderer;
import de.extio.game_engine.renderer.g2d.control.components.CustomWindowCloseButton; import de.extio.game_engine.renderer.g2d.control.components.CustomWindowCloseButton;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowCloseButtonControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowCloseButtonControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowCloseButtonData;
public class G2DWindowCloseButtonControlImpl extends G2DButtonControlImpl implements WindowCloseButtonControl { public class G2DWindowCloseButtonControlImpl extends G2DButtonControlImpl implements WindowCloseButtonControl {
@@ -11,6 +12,13 @@ public class G2DWindowCloseButtonControlImpl extends G2DButtonControlImpl implem
private boolean thickBorder; private boolean thickBorder;
@Override
public void setCustomData(final WindowCloseButtonData data) {
if (data != null) {
this.setThickBorder(data.thickBorder());
}
}
@Override @Override
protected void createControl() { protected void createControl() {
this.control = new CustomWindowCloseButton(false, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager()); this.control = new CustomWindowCloseButton(false, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager());
@@ -65,13 +73,11 @@ public class G2DWindowCloseButtonControlImpl extends G2DButtonControlImpl implem
} }
} }
@Override private boolean isThickBorder() {
public boolean isThickBorder() {
return this.thickBorder; return this.thickBorder;
} }
@Override private void setThickBorder(final boolean thickBorder) {
public void setThickBorder(final boolean thickBorder) {
this.thickBorder = thickBorder; this.thickBorder = thickBorder;
} }

View File

@@ -4,6 +4,7 @@ import de.extio.game_engine.renderer.g2d.G2DRenderer;
import de.extio.game_engine.renderer.g2d.control.components.CustomWindowPanel; import de.extio.game_engine.renderer.g2d.control.components.CustomWindowPanel;
import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager; import de.extio.game_engine.renderer.g2d.theme.G2DThemeManager;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowPanelControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowPanelControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.WindowPanelData;
import de.extio.game_engine.renderer.model.color.RgbaColor; import de.extio.game_engine.renderer.model.color.RgbaColor;
public class G2DWindowPanelControlImpl extends G2DBaseControlImpl implements WindowPanelControl { public class G2DWindowPanelControlImpl extends G2DBaseControlImpl implements WindowPanelControl {
@@ -15,23 +16,27 @@ public class G2DWindowPanelControlImpl extends G2DBaseControlImpl implements Win
protected RgbaColor color; protected RgbaColor color;
@Override @Override
public boolean isThickBorder() { public void setCustomData(final WindowPanelData data) {
if (data != null) {
this.setThickBorder(data.thickBorder());
this.setColor(data.color());
}
}
private boolean isThickBorder() {
return this.thickBorder; return this.thickBorder;
} }
@Override private void setThickBorder(final boolean thickBorder) {
public void setThickBorder(final boolean thickBorder) {
this.modified |= thickBorder != this.thickBorder; this.modified |= thickBorder != this.thickBorder;
this.thickBorder = thickBorder; this.thickBorder = thickBorder;
} }
@Override private RgbaColor getColor() {
public RgbaColor getColor() {
return this.color; return this.color;
} }
@Override private void setColor(final RgbaColor color) {
public void setColor(final RgbaColor color) {
this.modified |= (color == null) ? this.color != null : !color.equals(this.color); this.modified |= (color == null) ? this.color != null : !color.equals(this.color);
this.color = color; this.color = color;
} }

View File

@@ -12,6 +12,26 @@ import de.extio.game_engine.resource.StaticResource;
*/ */
public interface ControlRenderingBo extends RenderingBoHasDimension { public interface ControlRenderingBo extends RenderingBoHasDimension {
record LabelData(RgbaColor backgroundColor, RgbaColor foregroundColor, HorizontalAlignment textAlignment) {}
record ButtonData(RgbaColor backgroundColor, StaticResource iconResource) {}
record ToggleButtonData(boolean toggled, StaticResource iconResource) {}
record SwitchData(boolean toggled, StaticResource iconResource, boolean drawBorder) {}
record WindowCloseButtonData(boolean thickBorder) {}
record WindowPanelData(boolean thickBorder, RgbaColor color) {}
record TextfieldData(boolean multiLine, boolean readonly, RgbaColor backgroundColor) {}
record SliderData(boolean horizontal, double value, double value2, RgbaColor color) {}
record TableData(List<Object> data, int rows, long version, boolean firstColDoubleSize) {}
record SetFocusData(String focusId) {}
/** /**
* Sets the type of the control. See class tree of BaseControl * Sets the type of the control. See class tree of BaseControl
*/ */
@@ -26,25 +46,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
ControlRenderingBo setFontSize(int size); ControlRenderingBo setFontSize(int size);
/** ControlRenderingBo setControlData(Object data);
* Custom data a specific to the type of the control. Best is to search for code examples in shipped groovy mods to see what can be set
*/
ControlRenderingBo setCustomData(Object data);
/**
* Custom data a specific to the type of the control. Best is to search for code examples in shipped groovy mods to see what can be set
*/
ControlRenderingBo setCustomData2(Object data);
/**
* Custom data a specific to the type of the control. Best is to search for code examples in shipped groovy mods to see what can be set
*/
ControlRenderingBo setCustomData3(Object data);
/**
* Custom data a specific to the type of the control. Best is to search for code examples in shipped groovy mods to see what can be set
*/
ControlRenderingBo setCustomData4(Object data);
ControlRenderingBo setVisible(boolean visible); ControlRenderingBo setVisible(boolean visible);
@@ -99,17 +101,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface LabelControl extends BaseControl { public static interface LabelControl extends BaseControl {
RgbaColor getBackgroundColor(); void setCustomData(LabelData data);
void setBackgroundColor(RgbaColor color);
RgbaColor getForegroundColor();
void setForegroundColor(RgbaColor color);
HorizontalAlignment getTextAlignment();
void setTextAlignment(HorizontalAlignment alignment);
} }
@@ -118,13 +110,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface ButtonControl extends BaseControl { public static interface ButtonControl extends BaseControl {
RgbaColor getBackgroundColor(); void setCustomData(ButtonData data);
void setBackgroundColor(RgbaColor backgroundColor);
void setIconResource(StaticResource iconResource);
StaticResource getIconResource();
} }
@@ -133,9 +119,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface ToggleButtonControl extends ButtonControl { public static interface ToggleButtonControl extends ButtonControl {
boolean isToggled(); void setCustomData(ToggleButtonData data);
void setToggled(boolean toggled);
} }
@@ -144,13 +128,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface SwitchControl extends ButtonControl { public static interface SwitchControl extends ButtonControl {
boolean isToggled(); void setCustomData(SwitchData data);
void setToggled(boolean toggled);
boolean isDrawBorder();
void setDrawBorder(boolean draw);
} }
@@ -159,9 +137,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface WindowCloseButtonControl extends ButtonControl { public static interface WindowCloseButtonControl extends ButtonControl {
boolean isThickBorder(); void setCustomData(WindowCloseButtonData data);
void setThickBorder(boolean thickBorder);
} }
@@ -170,13 +146,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface WindowPanelControl extends BaseControl { public static interface WindowPanelControl extends BaseControl {
boolean isThickBorder(); void setCustomData(WindowPanelData data);
void setThickBorder(boolean thickBorder);
RgbaColor getColor();
void setColor(RgbaColor color);
} }
@@ -185,17 +155,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface TextfieldControl extends BaseControl { public static interface TextfieldControl extends BaseControl {
RgbaColor getBackgroundColor(); void setCustomData(TextfieldData data);
void setBackgroundColor(RgbaColor color);
boolean isMultiLine();
void setMultiLine(boolean multiLine);
boolean isReadonly();
void setReadonly(boolean readonly);
} }
@@ -204,21 +164,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface SliderControl extends BaseControl { public static interface SliderControl extends BaseControl {
RgbaColor getColor(); void setCustomData(SliderData data);
void setColor(RgbaColor color);
double getValue();
void setValue(double value);
double getValue2();
void setValue2(double value2);
boolean isHorizontal();
void setHorizontal(boolean horizontal);
} }
@@ -227,21 +173,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface TableControl extends BaseControl { public static interface TableControl extends BaseControl {
List<Object> getData(); void setCustomData(TableData data);
void setData(List<Object> data);
int getRows();
void setRows(int rows);
long getVersion();
void setVersion(long version);
void setFirstColDoubleSize(boolean bool);
boolean isFirstColDoubleSize();
} }
@@ -250,9 +182,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
*/ */
public static interface SetFocusControl extends BaseControl { public static interface SetFocusControl extends BaseControl {
String getFocusId(); void setCustomData(SetFocusData data);
void setFocusId(String id);
} }

View File

@@ -19,7 +19,9 @@ import de.extio.game_engine.renderer.container.Window;
import de.extio.game_engine.renderer.model.RenderingBoLayer; import de.extio.game_engine.renderer.model.RenderingBoLayer;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ButtonControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ButtonControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ButtonData;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.LabelControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.LabelControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.LabelData;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SwitchControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SwitchControl;
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ToggleButtonControl; import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.ToggleButtonControl;
import de.extio.game_engine.renderer.model.bo.DrawEffectRenderingBo; import de.extio.game_engine.renderer.model.bo.DrawEffectRenderingBo;
@@ -238,7 +240,7 @@ public class DemoModule extends AbstractClientModule {
.setTooltip(this.localizationService.translate("test-7")) .setTooltip(this.localizationService.translate("test-7"))
.setVisible(true) .setVisible(true)
.setEnabled(true) .setEnabled(true)
.setCustomData2(new StaticResource(List.of("gfx"), "settings.png")) .setControlData(new ButtonData(null, new StaticResource(List.of("gfx"), "settings.png")))
.withDimensionAbsolute(64, 64) .withDimensionAbsolute(64, 64)
.withPositionRelative(buttonX, buttonY); .withPositionRelative(buttonX, buttonY);
this.mainWindow.putRenderingBo(bo); this.mainWindow.putRenderingBo(bo);
@@ -487,7 +489,7 @@ public class DemoModule extends AbstractClientModule {
.setCaption("Item " + (i + 1) + "") .setCaption("Item " + (i + 1) + "")
.setFontSize(28) .setFontSize(28)
.setType(LabelControl.class) .setType(LabelControl.class)
.setCustomData2(HorizontalAlignment.LEFT) .setControlData(new LabelData(null, null, HorizontalAlignment.LEFT))
.setVisible(true) .setVisible(true)
.setEnabled(true) .setEnabled(true)
.withDimensionAbsolute(100, 60) .withDimensionAbsolute(100, 60)