use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class TextAreaListeners method textAreaMaxLengthListener.
public static EventListener textAreaMaxLengthListener(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("Max Length:", skin, "scene-label-colored");
table.add(label).right();
var valueSpinner = new Spinner(simTextArea.maxLength, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
valueSpinner.setMinimum(0);
table.add(valueSpinner).width(100).left();
valueSpinner.getTextField().addListener(ibeamListener);
valueSpinner.getButtonMinus().addListener(handListener);
valueSpinner.getButtonPlus().addListener(handListener);
valueSpinner.addListener(new TextTooltip("The maximum length of characters allowed in the TextArea.", tooltipManager, skin, "scene"));
valueSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.textAreaMaxLength(valueSpinner.getValueAsInt());
}
});
table.row();
label = new Label("(Set to 0 to show as many as possible)", skin, "scene-label-colored");
table.add(label).colspan(2);
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class ProgressBarListeners method progressBarAnimationListener.
public static EventListener progressBarAnimationListener(final DialogSceneComposer dialogSceneComposer) {
var simProgressBar = (DialogSceneComposerModel.SimProgressBar) dialogSceneComposer.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 table = new Table();
popTable.add(table);
table.defaults().spaceRight(5);
var textButton = new TextButton("Animate Interpolation", skin, "scene-med");
table.add(textButton).uniformX().fillX().colspan(2);
textButton.addListener(handListener);
textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.progressBarAnimateInterpolation(selection)));
table.row();
textButton = new TextButton("Visual Interpolation", skin, "scene-med");
table.add(textButton).uniformX().fillX().colspan(2);
textButton.addListener(handListener);
textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.progressBarVisualInterpolation(selection)));
table.row();
var label = new Label("Animation Duration:", skin, "scene-label-colored");
table.add(label).right();
var durationSpinner = new Spinner(simProgressBar.animationDuration, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
durationSpinner.setMinimum(0);
table.add(durationSpinner).left();
durationSpinner.getTextField().addListener(ibeamListener);
durationSpinner.getButtonMinus().addListener(handListener);
durationSpinner.getButtonPlus().addListener(handListener);
durationSpinner.addListener(new TextTooltip("The animation duration of the ProgressBar as the value changes.", tooltipManager, skin, "scene"));
durationSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
dialogSceneComposer.events.progressBarAnimationDuration((float) durationSpinner.getValue());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class TreeListeners method treePaddingListener.
public static EventListener treePaddingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simTree = (SimTree) 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 tableShown(Event event) {
var popTable = getPopTable();
popTable.clearChildren();
var table = new Table();
popTable.add(table);
table.defaults().right().spaceRight(5);
var 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(simTree.padLeft);
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 Tree.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.treePadLeft((float) ((Spinner) actor).getValue());
}
});
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(simTree.padRight);
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 Tree.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.treePadLeft((float) ((Spinner) actor).getValue());
}
});
}
};
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class TreeListeners method treeSpacingListener.
public static EventListener treeSpacingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simTree = (SimTree) 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 tableShown(Event event) {
var popTable = getPopTable();
popTable.clearChildren();
var table = new Table();
popTable.add(table);
table.defaults().right().spaceRight(5);
var label = new Label("Icon Space Left:", skin, "scene-label-colored");
table.add(label);
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simTree.iconSpaceLeft);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The spacing on the left of the icon.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.treeIconSpaceLeft((float) ((Spinner) actor).getValue());
}
});
table.row();
label = new Label("Icon Space Right:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simTree.iconSpaceRight);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The spacing on the right of the icon.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.treeIconSpaceRight((float) ((Spinner) actor).getValue());
}
});
table.row();
label = new Label("Indent Spacing:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simTree.indentSpacing);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The indentation space for each indented node.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.treeIndentSpacing((float) ((Spinner) actor).getValue());
}
});
table.row();
label = new Label("Y Spacing:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simTree.ySpacing);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The vertical spacing between each node.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.treeYSpacing((float) ((Spinner) actor).getValue());
}
});
}
};
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class CellListeners method cellSizeListener.
public static EventListener cellSizeListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simCell = (DialogSceneComposerModel.SimCell) 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 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");
Button link = popTable.findActor("link");
if (!link.isChecked()) {
events.cellSize((float) minimumWidth.getValue(), (float) minimumHeight.getValue(), (float) maximumWidth.getValue(), (float) maximumHeight.getValue(), (float) preferredWidth.getValue(), (float) preferredHeight.getValue());
} else if (actor != link) {
var val = 0.0f;
if (actor == minimumWidth)
val = (float) minimumWidth.getValue();
else if (actor == minimumHeight)
val = (float) minimumHeight.getValue();
else if (actor == maximumWidth)
val = (float) maximumWidth.getValue();
else if (actor == maximumHeight)
val = (float) maximumHeight.getValue();
else if (actor == preferredWidth)
val = (float) preferredWidth.getValue();
else if (actor == preferredHeight)
val = (float) preferredHeight.getValue();
events.cellSize(val, val, val, val, val, val);
minimumWidth.setValue(val);
minimumHeight.setValue(val);
maximumWidth.setValue(val);
maximumHeight.setValue(val);
preferredWidth.setValue(val);
preferredHeight.setValue(val);
}
}
};
var label = new Label("Set to negative to disable", skin, "scene-label-colored");
popTable.add(label).colspan(5);
popTable.row();
var table = new Table();
popTable.add(table);
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(simCell.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 cell.", 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(simCell.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 cell.", 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(simCell.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 cell.", 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(simCell.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 cell.", 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(simCell.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 cell.", 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(simCell.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 cell.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
popTable.row();
var button = new Button(skin, "scene-link");
button.setName("link");
popTable.add(button).colspan(5).right();
button.addListener(Main.handListener);
button.addListener(changeListener);
button.addListener(new TextTooltip("Click to modify all values at once.", tooltipManager, skin, "scene"));
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations