use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class ContainerListeners method containerPaddingListener.
public static EventListener containerPaddingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simContainer = (DialogSceneComposerModel.SimContainer) simActor;
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ENTER, popTable::hide);
getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
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 changeListener = new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Spinner paddingLeft = popTable.findActor("padding-left");
Spinner paddingRight = popTable.findActor("padding-right");
Spinner paddingTop = popTable.findActor("padding-top");
Spinner paddingBottom = popTable.findActor("padding-bottom");
events.containerPadding((float) paddingLeft.getValue(), (float) paddingRight.getValue(), (float) paddingTop.getValue(), (float) paddingBottom.getValue());
}
};
var table = new Table();
popTable.add(table);
var label = new Label("Padding:", skin, "scene-label-colored");
table.add(label).colspan(2);
table.row();
table.defaults().right().spaceRight(5);
label = new Label("Left:", skin, "scene-label-colored");
table.add(label);
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simContainer.padLeft);
spinner.setName("padding-left");
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the left of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
label = new Label("Right:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simContainer.padRight);
spinner.setName("padding-right");
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the right of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
label = new Label("Top:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simContainer.padTop);
spinner.setName("padding-top");
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the top of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
label = new Label("Bottom:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simContainer.padBottom);
spinner.setName("padding-bottom");
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the bottom of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class ContainerListeners method containerSizeListener.
public static EventListener containerSizeListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simContainer = (DialogSceneComposerModel.SimContainer) simActor;
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ENTER, popTable::hide);
getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
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 table = new Table();
popTable.add(table);
var changeListener = new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Spinner minimumWidth = popTable.findActor("minimum-width");
Spinner minimumHeight = popTable.findActor("minimum-height");
Spinner maximumWidth = popTable.findActor("maximum-width");
Spinner maximumHeight = popTable.findActor("maximum-height");
Spinner preferredWidth = popTable.findActor("preferred-width");
Spinner preferredHeight = popTable.findActor("preferred-height");
events.containerSize((float) minimumWidth.getValue(), (float) minimumHeight.getValue(), (float) maximumWidth.getValue(), (float) maximumHeight.getValue(), (float) preferredWidth.getValue(), (float) preferredHeight.getValue());
}
};
var label = new Label("Minimum:", skin, "scene-label-colored");
table.add(label).colspan(2);
table.row();
table.defaults().right().spaceRight(5);
label = new Label("Width:", skin, "scene-label-colored");
table.add(label);
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("minimum-width");
spinner.setValue(simContainer.minWidth);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The minimum width of the contents of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
label = new Label("Height:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("minimum-height");
spinner.setValue(simContainer.minHeight);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The minimum height of the contents of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
var image = new Image(skin, "scene-menu-divider");
popTable.add(image).space(10).growY();
table = new Table();
popTable.add(table);
label = new Label("Maximum:", skin, "scene-label-colored");
table.add(label).colspan(2);
table.row();
table.defaults().right().spaceRight(5);
label = new Label("Width:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("maximum-width");
spinner.setValue(simContainer.maxWidth);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The maximum width of the contents of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
label = new Label("Height:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("maximum-height");
spinner.setValue(simContainer.maxHeight);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The maximum height of the contents of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
image = new Image(skin, "scene-menu-divider");
popTable.add(image).space(10).growY();
table = new Table();
popTable.add(table);
label = new Label("Preferred:", skin, "scene-label-colored");
table.add(label).colspan(2);
table.row();
table.defaults().right().spaceRight(5);
label = new Label("Width:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("preferred-width");
spinner.setValue(simContainer.preferredWidth);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The preferred width of the contents of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
label = new Label("Height:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("preferred-height");
spinner.setValue(simContainer.preferredHeight);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The preferred height of the contents of the container.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class ButtonListeners method buttonPaddingListener.
public static EventListener buttonPaddingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simButton = (DialogSceneComposerModel.SimButton) simActor;
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ENTER, popTable::hide);
getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
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 changeListener = new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Spinner padLeft = popTable.findActor("pad-left");
Spinner padRight = popTable.findActor("pad-right");
Spinner padTop = popTable.findActor("pad-top");
Spinner padBottom = popTable.findActor("pad-bottom");
events.buttonPadding((float) padLeft.getValue(), (float) padRight.getValue(), (float) padTop.getValue(), (float) padBottom.getValue());
}
};
var label = new Label("Padding:", skin, "scene-label-colored");
popTable.add(label).colspan(2);
popTable.row();
popTable.defaults().right().spaceRight(5);
label = new Label("Left:", skin, "scene-label-colored");
popTable.add(label);
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-left");
spinner.setValue(simButton.padLeft);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the left of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
popTable.row();
label = new Label("Right:", skin, "scene-label-colored");
popTable.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-right");
spinner.setValue(simButton.padRight);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the right of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
popTable.row();
label = new Label("Top:", skin, "scene-label-colored");
popTable.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-top");
spinner.setValue(simButton.padTop);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the top of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
popTable.row();
label = new Label("Bottom:", skin, "scene-label-colored");
popTable.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-bottom");
spinner.setValue(simButton.padBottom);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the bottom of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class CheckBoxListeners method checkBoxPaddingListener.
public static EventListener checkBoxPaddingListener(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 changeListener = new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Spinner padLeft = popTable.findActor("pad-left");
Spinner padRight = popTable.findActor("pad-right");
Spinner padTop = popTable.findActor("pad-top");
Spinner padBottom = popTable.findActor("pad-bottom");
events.checkBoxPadding((float) padLeft.getValue(), (float) padRight.getValue(), (float) padTop.getValue(), (float) padBottom.getValue());
}
};
var label = new Label("Padding:", skin, "scene-label-colored");
popTable.add(label).colspan(2);
popTable.row();
popTable.defaults().right().spaceRight(5);
label = new Label("Left:", skin, "scene-label-colored");
popTable.add(label);
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-left");
spinner.setValue(simCheckBox.padLeft);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the left of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
popTable.row();
label = new Label("Right:", skin, "scene-label-colored");
popTable.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-right");
spinner.setValue(simCheckBox.padRight);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the right of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
popTable.row();
label = new Label("Top:", skin, "scene-label-colored");
popTable.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-top");
spinner.setValue(simCheckBox.padTop);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the top of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
popTable.row();
label = new Label("Bottom:", skin, "scene-label-colored");
popTable.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-bottom");
spinner.setValue(simCheckBox.padBottom);
popTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The padding on the bottom of the contents.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class TextAreaListeners method textAreaPreferredRowsListener.
public static EventListener textAreaPreferredRowsListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simTextArea = (DialogSceneComposerModel.SimTextArea) simActor;
var popTableClickListener = new PopTableClickListener(skin) {
{
getPopTable().key(Keys.ENTER, popTable::hide);
getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
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 table = new Table();
popTable.add(table);
var label = new Label("Preferred Rows:", skin, "scene-label-colored");
table.add(label).right();
var valueSpinner = new Spinner(simTextArea.preferredRows, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
valueSpinner.setMinimum(1);
table.add(valueSpinner).width(100).left();
valueSpinner.getTextField().addListener(ibeamListener);
valueSpinner.getButtonMinus().addListener(handListener);
valueSpinner.getButtonPlus().addListener(handListener);
valueSpinner.addListener(new TextTooltip("The number of lines of text to help determine preferred height.", tooltipManager, skin, "scene"));
valueSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.textAreaPreferredRows(valueSpinner.getValueAsInt());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations