use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class ProgressBarListeners method progressBarValueSettingsListener.
public static EventListener progressBarValueSettingsListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simProgressBar = (DialogSceneComposerModel.SimProgressBar) 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);
var label = new Label("Value:", skin, "scene-label-colored");
table.add(label);
var valueSpinner = new Spinner(simProgressBar.value, simProgressBar.increment, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
valueSpinner.setMinimum(simProgressBar.minimum);
valueSpinner.setMaximum(simProgressBar.maximum);
table.add(valueSpinner).width(100).uniformX();
valueSpinner.getTextField().addListener(ibeamListener);
valueSpinner.getButtonMinus().addListener(handListener);
valueSpinner.getButtonPlus().addListener(handListener);
valueSpinner.addListener(new TextTooltip("The value of the ProgressBar.", tooltipManager, skin, "scene"));
valueSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.progressBarValue((float) valueSpinner.getValue());
}
});
table.row();
label = new Label("Minimum:", skin, "scene-label-colored");
table.add(label);
var minimumSpinner = new Spinner(simProgressBar.minimum, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
minimumSpinner.setMaximum(simProgressBar.maximum);
var maximumSpinner = new Spinner(simProgressBar.maximum, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
maximumSpinner.setMinimum(simProgressBar.minimum);
table.add(minimumSpinner).uniformX().fillX();
minimumSpinner.getTextField().addListener(ibeamListener);
minimumSpinner.getButtonMinus().addListener(handListener);
minimumSpinner.getButtonPlus().addListener(handListener);
minimumSpinner.addListener(new TextTooltip("The minimum value of the ProgressBar.", tooltipManager, skin, "scene"));
minimumSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.progressBarMinimum((float) minimumSpinner.getValue());
if (valueSpinner.getValue() < minimumSpinner.getValue()) {
valueSpinner.setValue(simProgressBar.minimum);
}
maximumSpinner.setMinimum(simProgressBar.minimum);
}
});
table.row();
label = new Label("Maximum:", skin, "scene-label-colored");
table.add(label);
maximumSpinner.setValue(simProgressBar.maximum);
table.add(maximumSpinner).uniformX().fillX();
maximumSpinner.getTextField().addListener(ibeamListener);
maximumSpinner.getButtonMinus().addListener(handListener);
maximumSpinner.getButtonPlus().addListener(handListener);
maximumSpinner.addListener(new TextTooltip("The maximum value of the ProgressBar.", tooltipManager, skin, "scene"));
maximumSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.progressBarMaximum((float) maximumSpinner.getValue());
if (valueSpinner.getValue() > maximumSpinner.getValue()) {
valueSpinner.setValue(simProgressBar.maximum);
}
minimumSpinner.setMaximum(simProgressBar.maximum);
}
});
table.row();
label = new Label("Increment:", skin, "scene-label-colored");
table.add(label);
var incrementSpinner = new Spinner(0, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
incrementSpinner.setValue(simProgressBar.increment);
incrementSpinner.setMinimum(.0000000001);
table.add(incrementSpinner).uniformX().fillX();
incrementSpinner.getTextField().addListener(ibeamListener);
incrementSpinner.getButtonMinus().addListener(handListener);
incrementSpinner.getButtonPlus().addListener(handListener);
incrementSpinner.addListener(new TextTooltip("The increment value of the ProgressBar.", tooltipManager, skin, "scene"));
incrementSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.progressBarIncrement((float) incrementSpinner.getValue());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class ProgressBarListeners method progressBarDisabledListener.
public static EventListener progressBarDisabledListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simProgressBar = (DialogSceneComposerModel.SimProgressBar) 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(simProgressBar.disabled ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simProgressBar.disabled);
popTable.add(textButton).minWidth(100);
textButton.addListener(handListener);
textButton.addListener(new TextTooltip("Whether the ProgressBar 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.progressBarDisabled(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class CellListeners method cellColSpanListener.
public static EventListener cellColSpanListener(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 table = new Table();
popTable.add(table);
var label = new Label("Column Span:", skin, "scene-label-colored");
table.add(label).colspan(2);
table.row();
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simCell.colSpan);
spinner.setMinimum(1);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The column span of the cell.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellColSpan(spinner.getValueAsInt());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class CellListeners method cellPaddingSpacingListener.
public static EventListener cellPaddingSpacingListener(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 paddingLeftSpinner = popTable.findActor("padding-left");
Spinner paddingRightSpinner = popTable.findActor("padding-right");
Spinner paddingTopSpinner = popTable.findActor("padding-top");
Spinner paddingBottomSpinner = popTable.findActor("padding-bottom");
Spinner spacingLeftSpinner = popTable.findActor("spacing-left");
Spinner spacingRightSpinner = popTable.findActor("spacing-right");
Spinner spacingTopSpinner = popTable.findActor("spacing-top");
Spinner spacingBottomSpinner = popTable.findActor("spacing-bottom");
Button paddingLinkButton = popTable.findActor("padding-link");
Button spacingLinkButton = popTable.findActor("spacing-link");
if (paddingLinkButton.isChecked() && actor instanceof Spinner) {
var val = (float) ((Spinner) actor).getValue();
paddingLeftSpinner.setValue(val);
paddingRightSpinner.setValue(val);
paddingTopSpinner.setValue(val);
paddingBottomSpinner.setValue(val);
}
if (spacingLinkButton.isChecked() && actor instanceof Spinner) {
var val = (float) ((Spinner) actor).getValue();
spacingLeftSpinner.setValue(val);
spacingRightSpinner.setValue(val);
spacingTopSpinner.setValue(val);
spacingBottomSpinner.setValue(val);
}
var paddingLeft = (float) paddingLeftSpinner.getValue();
var paddingRight = (float) paddingRightSpinner.getValue();
var paddingTop = (float) paddingTopSpinner.getValue();
var paddingBottom = (float) paddingBottomSpinner.getValue();
var spacingLeft = (float) spacingLeftSpinner.getValue();
var spacingRight = (float) spacingRightSpinner.getValue();
var spacingTop = (float) spacingTopSpinner.getValue();
var spacingBottom = (float) spacingBottomSpinner.getValue();
events.cellPaddingSpacing(paddingLeft, paddingRight, paddingTop, paddingBottom, spacingLeft, spacingRight, spacingTop, spacingBottom);
}
};
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(simCell.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 to the left of the cell. Stacks with other cell padding.", 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(simCell.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 to the right of the cell. Stacks with other cell padding.", 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(simCell.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 to the top of the cell. Stacks with other cell padding.", 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(simCell.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 to the bottom of the cell. Stacks with other cell padding.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
var button = new Button(skin, "scene-link");
button.setName("padding-link");
table.add(button).right().colspan(2);
button.addListener(Main.handListener);
button.addListener(changeListener);
button.addListener(new TextTooltip("Click to modify all padding values at once.", tooltipManager, skin, "scene"));
var image = new Image(skin, "scene-menu-divider");
popTable.add(image).space(10).growY();
table = new Table();
popTable.add(table);
label = new Label("Spacing:", 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);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simCell.spaceLeft);
spinner.setName("spacing-left");
spinner.setMinimum(0);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The spacing to the left of the cell. Does not stack with other cell spacing.", 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(simCell.spaceRight);
spinner.setName("spacing-right");
spinner.setMinimum(0);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The spacing to the right of the cell. Does not stack with other cell spacing.", 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(simCell.spaceTop);
spinner.setName("spacing-top");
spinner.setMinimum(0);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The spacing to the top of the cell. Does not stack with other cell spacing.", 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(simCell.spaceBottom);
spinner.setName("spacing-bottom");
spinner.setMinimum(0);
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The spacing to the bottom of the cell. Does not stack with other cell spacing.", tooltipManager, skin, "scene"));
spinner.addListener(changeListener);
table.row();
button = new Button(skin, "scene-link");
button.setName("spacing-link");
table.add(button).right().colspan(2);
button.addListener(Main.handListener);
button.addListener(changeListener);
button.addListener(new TextTooltip("Click to modify all spacing values at once.", tooltipManager, skin, "scene"));
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class CellListeners method cellAddCellListener.
public static EventListener cellAddCellListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simCell = (DialogSceneComposerModel.SimCell) simActor;
var simTable = (SimTable) simActor.parent;
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);
var label = new Label("New Cell", skin, "scene-label-colored");
table.add(label);
table.row();
var subTable = new Table();
table.add(subTable);
subTable.add();
var button = new Button(skin, "scene-add-up");
button.setDisabled(simCell.row == 0);
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new cell at the end of the row above.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellAddCellAbove();
popTable.hide();
}
});
subTable.add();
subTable.row();
button = new Button(skin, "scene-add-left");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new cell to the left of the current one.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellAddCellToLeft();
popTable.hide();
}
});
subTable.add();
button = new Button(skin, "scene-add-right");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new cell to the right of the current one.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellAddCellToRight();
popTable.hide();
}
});
subTable.row();
subTable.add();
button = new Button(skin, "scene-add-down");
button.setDisabled(simCell.row == simTable.getRows() - 1);
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new cell at the end of the row below.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellAddCellBelow();
popTable.hide();
}
});
subTable.add();
table.row();
label = new Label("New Row", skin, "scene-label-colored");
table.add(label);
table.row();
subTable = new Table();
table.add(subTable);
button = new Button(skin, "scene-add-down-row");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new row below and adds a cell to it.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellAddRowBelow();
popTable.hide();
}
});
button = new Button(skin, "scene-add-up-row");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new row above and adds a cell to it.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellAddRowAbove();
popTable.hide();
}
});
var image = new Image(skin, "scene-menu-divider");
popTable.add(image).space(10).growY();
table = new Table();
popTable.add(table);
label = new Label("Duplicate Cell", skin, "scene-label-colored");
table.add(label);
table.row();
subTable = new Table();
table.add(subTable);
subTable.add();
button = new Button(skin, "scene-duplicate-up");
subTable.add(button);
button.setDisabled(simCell.row == 0);
button.addListener(handListener);
button.addListener(new TextTooltip("Duplicates the cell to the row above.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellDuplicateCellAbove();
popTable.hide();
}
});
subTable.add();
subTable.row();
button = new Button(skin, "scene-duplicate-left");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new cell to the left of the current one.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellDuplicateCellLeft();
popTable.hide();
}
});
subTable.add();
button = new Button(skin, "scene-duplicate-right");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new cell to the right of the current one.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellDuplicateCellRight();
popTable.hide();
}
});
subTable.row();
subTable.add();
button = new Button(skin, "scene-duplicate-down");
subTable.add(button);
button.setDisabled(simCell.row == simTable.getRows() - 1);
button.addListener(handListener);
button.addListener(new TextTooltip("Duplicates the cell to the row below.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellDuplicateCellBelow();
popTable.hide();
}
});
subTable.add();
table.row();
label = new Label("Dup. to New Row", skin, "scene-label-colored");
table.add(label);
table.row();
subTable = new Table();
table.add(subTable);
button = new Button(skin, "scene-duplicate-down-row");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new row below and adds a cell to it.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellDuplicateCellNewRowBelow();
popTable.hide();
}
});
button = new Button(skin, "scene-duplicate-up-row");
subTable.add(button);
button.addListener(handListener);
button.addListener(new TextTooltip("Creates a new row below and adds a cell to it.", tooltipManager, skin, "scene"));
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.cellDuplicateCellNewRowAbove();
popTable.hide();
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations