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:
@@ -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.bo.ControlRenderingBo;
|
||||
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.UiControlEvent;
|
||||
import de.extio.game_engine.renderer.work.RenderingBoPool;
|
||||
@@ -132,9 +133,7 @@ public class ScrollArea implements WindowComponent {
|
||||
if (needsVerticalScrollbar) {
|
||||
final var verticalScrollbar = this.renderingBoPool.acquire(this.verticalScrollbarName, ControlRenderingBo.class)
|
||||
.setType(SliderControl.class)
|
||||
.setCustomData(Boolean.FALSE)
|
||||
.setCustomData2(this.scrollPositionVertical)
|
||||
.setCustomData3(this.scrollPositionVertical)
|
||||
.setControlData(new SliderData(false, this.scrollPositionVertical, this.scrollPositionVertical, null))
|
||||
.setEnabled(true)
|
||||
.setVisible(true)
|
||||
.withDimensionAbsolute(SCROLLBAR_WIDTH, this.relativeArea.getDimension().getY() - SCROLLBAR_WIDTH)
|
||||
@@ -149,9 +148,7 @@ public class ScrollArea implements WindowComponent {
|
||||
if (needsHorizontalScrollbar) {
|
||||
final var horizontalScrollbar = this.renderingBoPool.acquire(this.horizontalScrollbarName, ControlRenderingBo.class)
|
||||
.setType(SliderControl.class)
|
||||
.setCustomData(Boolean.TRUE)
|
||||
.setCustomData2(this.scrollPositionHorizontal)
|
||||
.setCustomData3(this.scrollPositionHorizontal)
|
||||
.setControlData(new SliderData(true, this.scrollPositionHorizontal, this.scrollPositionHorizontal, null))
|
||||
.setEnabled(true)
|
||||
.setVisible(true)
|
||||
.withDimensionAbsolute(this.relativeArea.getDimension().getX() - SCROLLBAR_WIDTH, SCROLLBAR_WIDTH)
|
||||
|
||||
@@ -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.WindowCloseButtonControl;
|
||||
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.VerticalAlignment;
|
||||
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)
|
||||
.setType(WindowPanelControl.class)
|
||||
.setCustomData(true)
|
||||
.setControlData(new WindowPanelData(true, null))
|
||||
.setEnabled(true)
|
||||
.setVisible(true)
|
||||
.withDimensionAbsolute(this.area.getDimension())
|
||||
@@ -258,7 +260,7 @@ public class Window extends AbstractClientModule implements InitializingBean {
|
||||
this.closeButtonName = this.id + "_CloseButton";
|
||||
final var closeButtonBo = this.renderingBoPool.acquire(this.closeButtonName, ControlRenderingBo.class)
|
||||
.setType(WindowCloseButtonControl.class)
|
||||
.setCustomData(true)
|
||||
.setControlData(new WindowCloseButtonData(true))
|
||||
.setEnabled(true)
|
||||
.setVisible(true)
|
||||
.withDimensionAbsolute(this.area.getDimension())
|
||||
|
||||
@@ -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.RenderingBoLayer;
|
||||
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.model.Area2;
|
||||
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 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;
|
||||
|
||||
@@ -104,26 +113,37 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
|
||||
}
|
||||
|
||||
@Override
|
||||
public ControlRenderingBo setCustomData(final Object data) {
|
||||
this.customData = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ControlRenderingBo setCustomData2(final Object data) {
|
||||
this.customData2 = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ControlRenderingBo setCustomData3(final Object data) {
|
||||
this.customData3 = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ControlRenderingBo setCustomData4(final Object data) {
|
||||
this.customData4 = data;
|
||||
public ControlRenderingBo setControlData(final Object data) {
|
||||
if (data instanceof final LabelData labelData) {
|
||||
this.labelData = labelData;
|
||||
}
|
||||
else if (data instanceof final ButtonData buttonData) {
|
||||
this.buttonData = buttonData;
|
||||
}
|
||||
else if (data instanceof final ToggleButtonData toggleButtonData) {
|
||||
this.toggleButtonData = toggleButtonData;
|
||||
}
|
||||
else if (data instanceof final SwitchData switchData) {
|
||||
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;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -224,8 +244,8 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
|
||||
.setControlGroup(this.controlGroup)
|
||||
.setRendererData(this.rendererData)
|
||||
.setControlId(this.id);
|
||||
if (this.clazz == TextfieldControl.class && this.customData instanceof Boolean) {
|
||||
((TextfieldControl) control).setMultiLine(((Boolean) this.customData).booleanValue());
|
||||
if (this.clazz == TextfieldControl.class && this.textfieldData != null) {
|
||||
((TextfieldControl) control).setCustomData(this.textfieldData);
|
||||
}
|
||||
this.setControlProps(control, scaleFactor);
|
||||
|
||||
@@ -251,7 +271,6 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
|
||||
control.render();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setControlProps(final G2DBaseControlImpl control, final double scaleFactor) {
|
||||
control.setScaleFactor(scaleFactor);
|
||||
control.setX((int) (this.x * scaleFactor));
|
||||
@@ -271,90 +290,35 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
|
||||
(int) (this.visibleAreaWidth * scaleFactor),
|
||||
(int) (this.visibleAreaHeight * scaleFactor));
|
||||
|
||||
if (this.clazz == LabelControl.class) {
|
||||
((LabelControl) control).setForegroundColor(this.color);
|
||||
if (this.customData instanceof RgbaColor) {
|
||||
((LabelControl) control).setBackgroundColor((RgbaColor) this.customData);
|
||||
}
|
||||
if (this.customData2 instanceof HorizontalAlignment) {
|
||||
((LabelControl) control).setTextAlignment((HorizontalAlignment) this.customData2);
|
||||
}
|
||||
if (this.clazz == LabelControl.class && this.labelData != null) {
|
||||
((LabelControl) control).setCustomData(this.labelData);
|
||||
}
|
||||
else if (this.clazz == ToggleButtonControl.class) {
|
||||
((ButtonControl) control).setBackgroundColor(this.color);
|
||||
if (this.customData instanceof Boolean) {
|
||||
((ToggleButtonControl) control).setToggled(((Boolean) this.customData).booleanValue());
|
||||
}
|
||||
if (this.customData2 instanceof StaticResource) {
|
||||
((ButtonControl) control).setIconResource((StaticResource) this.customData2);
|
||||
}
|
||||
else if (this.clazz == ToggleButtonControl.class && this.toggleButtonData != null) {
|
||||
((ToggleButtonControl) control).setCustomData(this.toggleButtonData);
|
||||
}
|
||||
else if (this.clazz == SwitchControl.class) {
|
||||
((ButtonControl) control).setBackgroundColor(this.color);
|
||||
if (this.customData instanceof Boolean) {
|
||||
((SwitchControl) control).setToggled(((Boolean) this.customData).booleanValue());
|
||||
}
|
||||
if (this.customData2 instanceof StaticResource) {
|
||||
((ButtonControl) control).setIconResource((StaticResource) this.customData2);
|
||||
}
|
||||
if (this.customData4 instanceof Boolean) {
|
||||
((SwitchControl) control).setDrawBorder(((Boolean) this.customData4).booleanValue());
|
||||
}
|
||||
else if (this.clazz == SwitchControl.class && this.switchData != null) {
|
||||
((SwitchControl) control).setCustomData(this.switchData);
|
||||
}
|
||||
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 == ButtonControl.class && this.buttonData != null) {
|
||||
((ButtonControl) control).setCustomData(this.buttonData);
|
||||
}
|
||||
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 == WindowCloseButtonControl.class && this.windowCloseButtonData != null) {
|
||||
((WindowCloseButtonControl) control).setCustomData(this.windowCloseButtonData);
|
||||
}
|
||||
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 == WindowPanelControl.class && this.windowPanelData != null) {
|
||||
((WindowPanelControl) control).setCustomData(this.windowPanelData);
|
||||
}
|
||||
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 == SliderControl.class && this.sliderData != null) {
|
||||
((SliderControl) control).setCustomData(this.sliderData);
|
||||
}
|
||||
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 == TableControl.class && this.tableData != null) {
|
||||
((TableControl) control).setCustomData(this.tableData);
|
||||
}
|
||||
else if (this.clazz == SetFocusControl.class) {
|
||||
if (this.customData instanceof String) {
|
||||
((SetFocusControl) control).setFocusId((String) this.customData);
|
||||
}
|
||||
else if (this.clazz == SetFocusControl.class && this.setFocusData != null) {
|
||||
((SetFocusControl) control).setCustomData(this.setFocusData);
|
||||
}
|
||||
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.controlGroup = o.controlGroup;
|
||||
this.fontSize = o.fontSize;
|
||||
this.customData = o.customData;
|
||||
this.customData2 = o.customData2;
|
||||
this.customData3 = o.customData3;
|
||||
this.customData4 = o.customData4;
|
||||
this.labelData = o.labelData;
|
||||
this.buttonData = o.buttonData;
|
||||
this.toggleButtonData = o.toggleButtonData;
|
||||
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.enabled = o.enabled;
|
||||
this.tooltip = o.tooltip;
|
||||
@@ -389,10 +359,16 @@ public class G2DDrawControl extends G2DAbstractRenderingBo implements ControlRen
|
||||
this.caption = null;
|
||||
this.controlGroup = null;
|
||||
this.fontSize = G2DDrawFont.FONT_SIZE_DEFAULT;
|
||||
this.customData = null;
|
||||
this.customData2 = null;
|
||||
this.customData3 = null;
|
||||
this.customData4 = null;
|
||||
this.labelData = null;
|
||||
this.buttonData = null;
|
||||
this.toggleButtonData = 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.enabled = true;
|
||||
this.tooltip = null;
|
||||
|
||||
@@ -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.SwitchControl;
|
||||
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;
|
||||
|
||||
public abstract class G2DAbstractToggleButtonControlImpl extends G2DButtonControlImpl implements ToggleButtonControl, SwitchControl {
|
||||
|
||||
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
|
||||
public void performAction() {
|
||||
if (this.enabled) {
|
||||
@@ -18,26 +35,22 @@ public abstract class G2DAbstractToggleButtonControlImpl extends G2DButtonContro
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isToggled() {
|
||||
private boolean isToggled() {
|
||||
return this.control.isToggled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToggled(final boolean toggled) {
|
||||
private void setToggled(final boolean toggled) {
|
||||
if (this.control != null && toggled != this.control.isToggled()) {
|
||||
this.control.setToggled(toggled);
|
||||
this.manageCtrlGroupToggleState();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDrawBorder() {
|
||||
private boolean isDrawBorder() {
|
||||
return this.drawBorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrawBorder(final boolean draw) {
|
||||
private void setDrawBorder(final boolean draw) {
|
||||
this.modified |= draw != this.drawBorder;
|
||||
this.drawBorder = draw;
|
||||
}
|
||||
|
||||
@@ -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.theme.G2DThemeManager;
|
||||
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.event.UiControlEvent;
|
||||
import de.extio.game_engine.resource.StaticResource;
|
||||
@@ -19,6 +20,14 @@ public class G2DButtonControlImpl extends G2DBaseControlImpl implements ButtonCo
|
||||
|
||||
private RgbaColor backgroundColor;
|
||||
|
||||
@Override
|
||||
public void setCustomData(final ButtonData data) {
|
||||
if (data != null) {
|
||||
this.setBackgroundColor(data.backgroundColor());
|
||||
this.setIconResource(data.iconResource());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
super.build();
|
||||
@@ -92,24 +101,20 @@ public class G2DButtonControlImpl extends G2DBaseControlImpl implements ButtonCo
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIconResource(final StaticResource iconResource) {
|
||||
protected void setIconResource(final StaticResource iconResource) {
|
||||
this.modified |= !Objects.equals(this.iconResource, iconResource);
|
||||
this.iconResource = iconResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticResource getIconResource() {
|
||||
private StaticResource getIconResource() {
|
||||
return this.iconResource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RgbaColor getBackgroundColor() {
|
||||
private RgbaColor getBackgroundColor() {
|
||||
return this.backgroundColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(final RgbaColor backgroundColor) {
|
||||
private void setBackgroundColor(final RgbaColor backgroundColor) {
|
||||
this.modified |= !Objects.equals(this.backgroundColor, backgroundColor);
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
|
||||
@@ -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.model.bo.HorizontalAlignment;
|
||||
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.event.UiControlEvent;
|
||||
|
||||
@@ -18,34 +19,37 @@ public class G2DLabelControlImpl extends G2DBaseControlImpl implements LabelCont
|
||||
protected HorizontalAlignment textAlignment;
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(final RgbaColor color) {
|
||||
private void setBackgroundColor(final RgbaColor color) {
|
||||
this.modified |= (color == null) ? this.backgroundColor != null : !color.equals(this.backgroundColor);
|
||||
this.backgroundColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RgbaColor getForegroundColor() {
|
||||
private RgbaColor getForegroundColor() {
|
||||
return this.foregroundColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForegroundColor(final RgbaColor color) {
|
||||
private void setForegroundColor(final RgbaColor color) {
|
||||
this.modified |= (color != null) && !color.equals(this.foregroundColor);
|
||||
this.foregroundColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HorizontalAlignment getTextAlignment() {
|
||||
private HorizontalAlignment getTextAlignment() {
|
||||
return this.textAlignment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextAlignment(final HorizontalAlignment alignment) {
|
||||
private void setTextAlignment(final HorizontalAlignment alignment) {
|
||||
this.modified |= alignment != this.textAlignment;
|
||||
this.textAlignment = alignment;
|
||||
}
|
||||
|
||||
@@ -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.model.bo.ControlRenderingBo.SetFocusControl;
|
||||
import de.extio.game_engine.renderer.model.bo.ControlRenderingBo.SetFocusData;
|
||||
|
||||
public class G2DSetFocusControl extends G2DBaseControlImpl implements SetFocusControl {
|
||||
|
||||
protected String focusId;
|
||||
|
||||
@Override
|
||||
public String getFocusId() {
|
||||
public void setCustomData(final SetFocusData data) {
|
||||
if (data != null) {
|
||||
this.setFocusId(data.focusId());
|
||||
}
|
||||
}
|
||||
|
||||
private String getFocusId() {
|
||||
return this.focusId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocusId(final String id) {
|
||||
private void setFocusId(final String id) {
|
||||
this.focusId = id;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.theme.G2DThemeManager;
|
||||
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.event.UiControlEvent;
|
||||
|
||||
@@ -23,6 +24,16 @@ public class G2DSliderControlImpl extends G2DBaseControlImpl implements SliderCo
|
||||
|
||||
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() {
|
||||
|
||||
}
|
||||
@@ -31,46 +42,38 @@ public class G2DSliderControlImpl extends G2DBaseControlImpl implements SliderCo
|
||||
this.actionConsumer = actionConsumer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RgbaColor getColor() {
|
||||
RgbaColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(final RgbaColor color) {
|
||||
void setColor(final RgbaColor color) {
|
||||
this.modified |= (color != null) && !color.equals(this.color);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getValue() {
|
||||
double getValue() {
|
||||
return this.lastValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final double value) {
|
||||
void setValue(final double value) {
|
||||
this.modified |= value != this.lastValue;
|
||||
this.lastValue = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getValue2() {
|
||||
double getValue2() {
|
||||
return this.lastValue2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue2(final double value2) {
|
||||
void setValue2(final double value2) {
|
||||
this.modified |= value2 != this.lastValue2;
|
||||
this.lastValue2 = value2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHorizontal() {
|
||||
boolean isHorizontal() {
|
||||
return this.horizontal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHorizontal(final boolean horizontal) {
|
||||
void setHorizontal(final boolean horizontal) {
|
||||
this.modified |= horizontal != this.horizontal;
|
||||
this.horizontal = horizontal;
|
||||
}
|
||||
|
||||
@@ -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.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 {
|
||||
|
||||
@Override
|
||||
public void setCustomData(final SwitchData data) {
|
||||
this.applySwitchData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomData(final ToggleButtonData data) {
|
||||
// Not used in Switch
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createControl() {
|
||||
this.control = new CustomSwitch(true, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager());
|
||||
|
||||
@@ -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.model.bo.ControlRenderingBo.BaseControl;
|
||||
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.event.UiControlEvent;
|
||||
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
|
||||
public void build() {
|
||||
super.build();
|
||||
@@ -247,45 +258,37 @@ public class G2DTableControlImpl extends G2DBaseControlImpl implements TableCont
|
||||
return super.setControlId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> getData() {
|
||||
private List<Object> getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(final List<Object> data) {
|
||||
private void setData(final List<Object> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRows() {
|
||||
private int getRows() {
|
||||
return this.rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRows(final int rows) {
|
||||
private void setRows(final int rows) {
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getVersion() {
|
||||
private long getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVersion(final long version) {
|
||||
private void setVersion(final long version) {
|
||||
this.modified |= version != this.version;
|
||||
this.dataModified |= version != this.version;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFirstColDoubleSize() {
|
||||
private boolean isFirstColDoubleSize() {
|
||||
return this.firstColDoubleSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFirstColDoubleSize(final boolean firstColDoubleSize) {
|
||||
private void setFirstColDoubleSize(final boolean firstColDoubleSize) {
|
||||
this.firstColDoubleSize = firstColDoubleSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.model.bo.ControlRenderingBo.BaseControl;
|
||||
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.event.UiControlEvent;
|
||||
|
||||
@@ -26,12 +27,19 @@ public class G2DTextfieldControlImpl extends G2DBaseControlImpl implements Textf
|
||||
private String lastText;
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultiLine(final boolean multiLine) {
|
||||
private void setMultiLine(final boolean multiLine) {
|
||||
if (this.textComponent != null) {
|
||||
throw new UnsupportedOperationException("Multiline property is read-only after initial control creation");
|
||||
}
|
||||
@@ -165,23 +173,19 @@ public class G2DTextfieldControlImpl extends G2DBaseControlImpl implements Textf
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RgbaColor getBackgroundColor() {
|
||||
private RgbaColor getBackgroundColor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(final RgbaColor color) {
|
||||
private void setBackgroundColor(final RgbaColor color) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadonly() {
|
||||
private boolean isReadonly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadonly(final boolean readonly) {
|
||||
private void setReadonly(final boolean readonly) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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.model.bo.ControlRenderingBo.BaseControl;
|
||||
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.event.UiControlEvent;
|
||||
|
||||
@@ -42,43 +43,46 @@ public class G2DTextfieldControlImpl2 extends G2DBaseControlImpl implements Text
|
||||
|
||||
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() {
|
||||
this.scrollbar = new G2DSliderControlImpl(value -> {
|
||||
this.onScroll(value.doubleValue());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public RgbaColor getBackgroundColor() {
|
||||
private RgbaColor getBackgroundColor() {
|
||||
return this.backgroundColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(final RgbaColor color) {
|
||||
private void setBackgroundColor(final RgbaColor color) {
|
||||
this.modified |= (color == null) ? this.backgroundColor != null : !color.equals(this.backgroundColor);
|
||||
this.backgroundColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiLine() {
|
||||
private boolean isMultiLine() {
|
||||
return this.multiLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultiLine(final boolean multiLine) {
|
||||
private void setMultiLine(final boolean multiLine) {
|
||||
if (this.textComponent != null) {
|
||||
throw new UnsupportedOperationException("Multiline property is read-only after initial control creation");
|
||||
}
|
||||
this.multiLine = multiLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadonly() {
|
||||
private boolean isReadonly() {
|
||||
return this.readonly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadonly(final boolean readonly) {
|
||||
private void setReadonly(final boolean readonly) {
|
||||
this.modified |= readonly != this.readonly;
|
||||
this.readonly = readonly;
|
||||
}
|
||||
|
||||
@@ -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.control.components.CustomButton;
|
||||
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 {
|
||||
|
||||
@Override
|
||||
public void setCustomData(final ToggleButtonData data) {
|
||||
this.applyToggleButtonData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomData(final SwitchData data) {
|
||||
// Not used in ToggleButton
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createControl() {
|
||||
this.control = new CustomButton(true, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager());
|
||||
|
||||
@@ -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.theme.G2DThemeManager;
|
||||
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 {
|
||||
|
||||
@@ -11,6 +12,13 @@ public class G2DWindowCloseButtonControlImpl extends G2DButtonControlImpl implem
|
||||
|
||||
private boolean thickBorder;
|
||||
|
||||
@Override
|
||||
public void setCustomData(final WindowCloseButtonData data) {
|
||||
if (data != null) {
|
||||
this.setThickBorder(data.thickBorder());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createControl() {
|
||||
this.control = new CustomWindowCloseButton(false, event -> this.performAction(), (G2DThemeManager) this.rendererData.getThemeManager());
|
||||
@@ -65,13 +73,11 @@ public class G2DWindowCloseButtonControlImpl extends G2DButtonControlImpl implem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isThickBorder() {
|
||||
private boolean isThickBorder() {
|
||||
return this.thickBorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThickBorder(final boolean thickBorder) {
|
||||
private void setThickBorder(final boolean thickBorder) {
|
||||
this.thickBorder = thickBorder;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.theme.G2DThemeManager;
|
||||
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;
|
||||
|
||||
public class G2DWindowPanelControlImpl extends G2DBaseControlImpl implements WindowPanelControl {
|
||||
@@ -15,23 +16,27 @@ public class G2DWindowPanelControlImpl extends G2DBaseControlImpl implements Win
|
||||
protected RgbaColor color;
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThickBorder(final boolean thickBorder) {
|
||||
private void setThickBorder(final boolean thickBorder) {
|
||||
this.modified |= thickBorder != this.thickBorder;
|
||||
this.thickBorder = thickBorder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RgbaColor getColor() {
|
||||
private RgbaColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(final RgbaColor color) {
|
||||
private void setColor(final RgbaColor color) {
|
||||
this.modified |= (color == null) ? this.color != null : !color.equals(this.color);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,26 @@ import de.extio.game_engine.resource.StaticResource;
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@@ -26,25 +46,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
|
||||
ControlRenderingBo setFontSize(int size);
|
||||
|
||||
/**
|
||||
* 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 setControlData(Object data);
|
||||
|
||||
ControlRenderingBo setVisible(boolean visible);
|
||||
|
||||
@@ -99,17 +101,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface LabelControl extends BaseControl {
|
||||
|
||||
RgbaColor getBackgroundColor();
|
||||
|
||||
void setBackgroundColor(RgbaColor color);
|
||||
|
||||
RgbaColor getForegroundColor();
|
||||
|
||||
void setForegroundColor(RgbaColor color);
|
||||
|
||||
HorizontalAlignment getTextAlignment();
|
||||
|
||||
void setTextAlignment(HorizontalAlignment alignment);
|
||||
void setCustomData(LabelData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -118,13 +110,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface ButtonControl extends BaseControl {
|
||||
|
||||
RgbaColor getBackgroundColor();
|
||||
|
||||
void setBackgroundColor(RgbaColor backgroundColor);
|
||||
|
||||
void setIconResource(StaticResource iconResource);
|
||||
|
||||
StaticResource getIconResource();
|
||||
void setCustomData(ButtonData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -133,9 +119,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface ToggleButtonControl extends ButtonControl {
|
||||
|
||||
boolean isToggled();
|
||||
|
||||
void setToggled(boolean toggled);
|
||||
void setCustomData(ToggleButtonData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -144,13 +128,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface SwitchControl extends ButtonControl {
|
||||
|
||||
boolean isToggled();
|
||||
|
||||
void setToggled(boolean toggled);
|
||||
|
||||
boolean isDrawBorder();
|
||||
|
||||
void setDrawBorder(boolean draw);
|
||||
void setCustomData(SwitchData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -159,9 +137,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface WindowCloseButtonControl extends ButtonControl {
|
||||
|
||||
boolean isThickBorder();
|
||||
|
||||
void setThickBorder(boolean thickBorder);
|
||||
void setCustomData(WindowCloseButtonData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -170,13 +146,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface WindowPanelControl extends BaseControl {
|
||||
|
||||
boolean isThickBorder();
|
||||
|
||||
void setThickBorder(boolean thickBorder);
|
||||
|
||||
RgbaColor getColor();
|
||||
|
||||
void setColor(RgbaColor color);
|
||||
void setCustomData(WindowPanelData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -185,17 +155,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface TextfieldControl extends BaseControl {
|
||||
|
||||
RgbaColor getBackgroundColor();
|
||||
|
||||
void setBackgroundColor(RgbaColor color);
|
||||
|
||||
boolean isMultiLine();
|
||||
|
||||
void setMultiLine(boolean multiLine);
|
||||
|
||||
boolean isReadonly();
|
||||
|
||||
void setReadonly(boolean readonly);
|
||||
void setCustomData(TextfieldData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -204,21 +164,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface SliderControl extends BaseControl {
|
||||
|
||||
RgbaColor getColor();
|
||||
|
||||
void setColor(RgbaColor color);
|
||||
|
||||
double getValue();
|
||||
|
||||
void setValue(double value);
|
||||
|
||||
double getValue2();
|
||||
|
||||
void setValue2(double value2);
|
||||
|
||||
boolean isHorizontal();
|
||||
|
||||
void setHorizontal(boolean horizontal);
|
||||
void setCustomData(SliderData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -227,21 +173,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface TableControl extends BaseControl {
|
||||
|
||||
List<Object> getData();
|
||||
|
||||
void setData(List<Object> data);
|
||||
|
||||
int getRows();
|
||||
|
||||
void setRows(int rows);
|
||||
|
||||
long getVersion();
|
||||
|
||||
void setVersion(long version);
|
||||
|
||||
void setFirstColDoubleSize(boolean bool);
|
||||
|
||||
boolean isFirstColDoubleSize();
|
||||
void setCustomData(TableData data);
|
||||
|
||||
}
|
||||
|
||||
@@ -250,9 +182,7 @@ public interface ControlRenderingBo extends RenderingBoHasDimension {
|
||||
*/
|
||||
public static interface SetFocusControl extends BaseControl {
|
||||
|
||||
String getFocusId();
|
||||
|
||||
void setFocusId(String id);
|
||||
void setCustomData(SetFocusData data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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.bo.ControlRenderingBo;
|
||||
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.LabelData;
|
||||
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.DrawEffectRenderingBo;
|
||||
@@ -238,7 +240,7 @@ public class DemoModule extends AbstractClientModule {
|
||||
.setTooltip(this.localizationService.translate("test-7"))
|
||||
.setVisible(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)
|
||||
.withPositionRelative(buttonX, buttonY);
|
||||
this.mainWindow.putRenderingBo(bo);
|
||||
@@ -487,7 +489,7 @@ public class DemoModule extends AbstractClientModule {
|
||||
.setCaption("Item " + (i + 1) + "")
|
||||
.setFontSize(28)
|
||||
.setType(LabelControl.class)
|
||||
.setCustomData2(HorizontalAlignment.LEFT)
|
||||
.setControlData(new LabelData(null, null, HorizontalAlignment.LEFT))
|
||||
.setVisible(true)
|
||||
.setEnabled(true)
|
||||
.withDimensionAbsolute(100, 60)
|
||||
|
||||
Reference in New Issue
Block a user