use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class LabelListeners method labelTextAlignmentListener.
public static EventListener labelTextAlignmentListener(final DialogSceneComposerEvents events, final SimActor simActor) {
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ESCAPE, popTable::hide);
}
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
update();
}
public void update() {
var simLabel = (DialogSceneComposerModel.SimLabel) simActor;
var popTable = getPopTable();
popTable.clearChildren();
var table = new Table();
popTable.add(table);
var label = new Label("Text Alignment:", skin, "scene-label-colored");
table.add(label).colspan(3);
table.row();
table.defaults().space(10).left().uniformX();
var buttonGroup = new ButtonGroup<ImageTextButton>();
var imageTextButton = new ImageTextButton("Top-Left", skin, "scene-checkbox-colored");
var topLeft = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the top left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.topLeft);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Top", skin, "scene-checkbox-colored");
var top = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the top center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.top);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Top-Right", skin, "scene-checkbox-colored");
var topRight = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the top right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.topRight);
}
});
buttonGroup.add(imageTextButton);
table.row();
imageTextButton = new ImageTextButton("Left", skin, "scene-checkbox-colored");
var left = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the middle left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.left);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Center", skin, "scene-checkbox-colored");
var center = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.center);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Right", skin, "scene-checkbox-colored");
var right = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the middle right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.right);
}
});
buttonGroup.add(imageTextButton);
table.row();
imageTextButton = new ImageTextButton("Bottom-Left", skin, "scene-checkbox-colored");
var bottomLeft = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label the bottom left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.bottomLeft);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Bottom", skin, "scene-checkbox-colored");
var bottom = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the bottom center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.bottom);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Bottom-Right", skin, "scene-checkbox-colored");
var bottomRight = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the text of the label to the bottom right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.labelAlignment(Align.bottomRight);
}
});
buttonGroup.add(imageTextButton);
switch(simLabel.textAlignment) {
case Align.topLeft:
topLeft.setChecked(true);
break;
case Align.top:
top.setChecked(true);
break;
case Align.topRight:
topRight.setChecked(true);
break;
case Align.right:
right.setChecked(true);
break;
case Align.bottomRight:
bottomRight.setChecked(true);
break;
case Align.bottom:
bottom.setChecked(true);
break;
case Align.bottomLeft:
bottomLeft.setChecked(true);
break;
case Align.left:
left.setChecked(true);
break;
case Align.center:
center.setChecked(true);
break;
}
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class CheckBoxListeners method checkBoxDisabledListener.
public static EventListener checkBoxDisabledListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simCheckBox = (DialogSceneComposerModel.SimCheckBox) simActor;
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ESCAPE, popTable::hide);
}
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
update();
}
public void update() {
var popTable = getPopTable();
popTable.clearChildren();
var label = new Label("Disabled:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
var textButton = new TextButton(simCheckBox.disabled ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simCheckBox.disabled);
popTable.add(textButton).minWidth(100);
textButton.addListener(handListener);
textButton.addListener(new TextTooltip("Whether the CheckBox is disabled initially.", tooltipManager, skin, "scene"));
textButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
events.checkBoxDisabled(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class HorizontalGroupListeners method horizontalGroupExpandFillGrowListener.
public static EventListener horizontalGroupExpandFillGrowListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simHorizontalGroup = (DialogSceneComposerModel.SimHorizontalGroup) simActor;
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ESCAPE, popTable::hide);
}
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
update();
}
public void update() {
var popTable = getPopTable();
popTable.clearChildren();
var expand = new ImageTextButton("Expand", skin, "scene-checkbox-colored");
var fill = new ImageTextButton("Fill", skin, "scene-checkbox-colored");
var grow = new ImageTextButton("Grow", skin, "scene-checkbox-colored");
var changeListener = new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupExpand(expand.isChecked());
events.horizontalGroupFill(fill.isChecked());
}
};
var table = new Table();
popTable.add(table);
table.defaults().left().spaceRight(5);
expand.setChecked(simHorizontalGroup.expand);
expand.setProgrammaticChangeEvents(false);
table.add(expand);
expand.addListener(handListener);
expand.addListener(new TextTooltip("Set the widgets to expand to the available space.", tooltipManager, skin, "scene"));
expand.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (expand.isChecked() && fill.isChecked()) {
grow.setChecked(true);
} else {
grow.setChecked(false);
}
}
});
expand.addListener(changeListener);
table.row();
fill.setChecked(simHorizontalGroup.fill);
fill.setProgrammaticChangeEvents(false);
table.add(fill);
fill.addListener(handListener);
fill.addListener(new TextTooltip("Sets the widgets to fill the entire space.", tooltipManager, skin, "scene"));
fill.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (expand.isChecked() && fill.isChecked()) {
grow.setChecked(true);
} else {
grow.setChecked(false);
}
}
});
fill.addListener(changeListener);
table.row();
grow.setChecked(simHorizontalGroup.expand && simHorizontalGroup.fill);
grow.setProgrammaticChangeEvents(false);
table.add(grow);
grow.addListener(handListener);
grow.addListener(new TextTooltip("Sets the widgets to expand and fill.", tooltipManager, skin, "scene"));
grow.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
expand.setChecked(grow.isChecked());
fill.setChecked(grow.isChecked());
}
});
grow.addListener(changeListener);
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class HorizontalGroupListeners method horizontalGroupRowAlignmentListener.
public static EventListener horizontalGroupRowAlignmentListener(final DialogSceneComposerEvents events, final SimActor simActor) {
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ESCAPE, popTable::hide);
}
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
update();
}
public void update() {
var simHorizontalGroup = (DialogSceneComposerModel.SimHorizontalGroup) simActor;
var popTable = getPopTable();
popTable.clearChildren();
var table = new Table();
popTable.add(table);
var label = new Label("Alignment:", skin, "scene-label-colored");
table.add(label).colspan(3);
table.row();
table.defaults().space(10).left().uniformX();
var buttonGroup = new ButtonGroup<ImageTextButton>();
var imageTextButton = new ImageTextButton("Top-Left", skin, "scene-checkbox-colored");
var topLeft = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the top left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.topLeft);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Top", skin, "scene-checkbox-colored");
var top = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the top center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.top);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Top-Right", skin, "scene-checkbox-colored");
var topRight = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the top right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.topRight);
}
});
buttonGroup.add(imageTextButton);
table.row();
imageTextButton = new ImageTextButton("Left", skin, "scene-checkbox-colored");
var left = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the middle left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.left);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Center", skin, "scene-checkbox-colored");
var center = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.center);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Right", skin, "scene-checkbox-colored");
var right = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the middle right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.right);
}
});
buttonGroup.add(imageTextButton);
table.row();
imageTextButton = new ImageTextButton("Bottom-Left", skin, "scene-checkbox-colored");
var bottomLeft = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the bottom left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.bottomLeft);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Bottom", skin, "scene-checkbox-colored");
var bottom = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the bottom center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.bottom);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Bottom-Right", skin, "scene-checkbox-colored");
var bottomRight = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the widgets to the bottom right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.horizontalGroupRowAlignment(Align.bottomRight);
}
});
buttonGroup.add(imageTextButton);
switch(simHorizontalGroup.alignment) {
case Align.topLeft:
topLeft.setChecked(true);
break;
case Align.top:
top.setChecked(true);
break;
case Align.topRight:
topRight.setChecked(true);
break;
case Align.right:
right.setChecked(true);
break;
case Align.bottomRight:
bottomRight.setChecked(true);
break;
case Align.bottom:
bottom.setChecked(true);
break;
case Align.bottomLeft:
bottomLeft.setChecked(true);
break;
case Align.left:
left.setChecked(true);
break;
case Align.center:
center.setChecked(true);
break;
}
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class SplitPaneListeners method splitPaneOrientationListener.
public static EventListener splitPaneOrientationListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simSplitPane = (DialogSceneComposerModel.SimSplitPane) simActor;
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ESCAPE, popTable::hide);
}
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
update();
}
public void update() {
var popTable = getPopTable();
popTable.clearChildren();
popTable.pad(10);
var table = new Table();
popTable.add(table).space(5);
table.defaults().left().expandX();
ButtonGroup buttonGroup = new ButtonGroup();
var imageTextButton = new ImageTextButton("Horizontal", skin, "scene-checkbox-colored");
imageTextButton.setProgrammaticChangeEvents(false);
imageTextButton.setChecked(!simSplitPane.vertical);
table.add(imageTextButton);
buttonGroup.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Horizontal orientation of the widgets.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (true)
events.splitPaneVertical(false);
}
});
table.row();
imageTextButton = new ImageTextButton("Vertical", skin, "scene-checkbox-colored");
imageTextButton.setProgrammaticChangeEvents(false);
imageTextButton.setChecked(simSplitPane.vertical);
table.add(imageTextButton);
buttonGroup.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Vertical orientation of the widgets.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (true)
events.splitPaneVertical(true);
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations