use of games.rednblack.editor.view.ui.validator.StringNameValidator in project HyperLap2D by rednblackgames.
the class ValueParamBoxProducer method createValuePart.
private GraphBoxPartImpl<T> createValuePart(Skin skin, String name) {
final VisValidatableTextField v1Input = new VisValidatableTextField(new StringNameValidator()) {
@Override
public float getPrefWidth() {
return 80;
}
};
v1Input.setText(name);
v1Input.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
v1Input.fire(new GraphChangedEvent(false, true));
}
});
HorizontalGroup horizontalGroup = new HorizontalGroup();
horizontalGroup.addActor(new Label("Name: ", skin));
horizontalGroup.addActor(v1Input);
GraphBoxPartImpl<T> colorPart = new GraphBoxPartImpl<T>(horizontalGroup, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(Map<String, String> object) {
object.put("v", v1Input.getText());
}
});
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("value"));
return colorPart;
}
use of games.rednblack.editor.view.ui.validator.StringNameValidator in project HyperLap2D by rednblackgames.
the class EventActionBoxProducer method createValuePart.
private GraphBoxPartImpl<T> createValuePart(Skin skin, String name) {
final VisValidatableTextField v1Input = new VisValidatableTextField(new StringNameValidator()) {
@Override
public float getPrefWidth() {
return 80;
}
};
v1Input.setText(name);
v1Input.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
v1Input.fire(new GraphChangedEvent(false, true));
}
});
HorizontalGroup horizontalGroup = new HorizontalGroup();
horizontalGroup.addActor(new Label("Name: ", skin));
horizontalGroup.addActor(v1Input);
GraphBoxPartImpl<T> colorPart = new GraphBoxPartImpl<T>(horizontalGroup, new GraphBoxPartImpl.Callback() {
@Override
public void serialize(Map<String, String> object) {
object.put("v", v1Input.getText());
}
});
colorPart.setOutputConnector(GraphBoxOutputConnector.Side.Right, configuration.getNodeOutputs().get("action"));
return colorPart;
}
use of games.rednblack.editor.view.ui.validator.StringNameValidator in project HyperLap2D by rednblackgames.
the class DuplicateLibraryAction method doAction.
@Override
public void doAction() {
String libraryActionName = notification.getBody();
ProjectManager projectManager = HyperLap2DFacade.getInstance().retrieveProxy(ProjectManager.NAME);
HashMap<String, GraphVO> libraryActions = projectManager.currentProjectInfoVO.libraryActions;
GraphVO actionToDuplicate = libraryActions.get(libraryActionName);
Dialogs.showInputDialog(Sandbox.getInstance().getUIStage(), "Duplicate " + libraryActionName, "New name : ", false, new StringNameValidator(), new InputDialogListener() {
@Override
public void finished(String input) {
if (input == null || input.equals("")) {
return;
}
Json json = HyperJson.getJson();
GraphVO duplicated = json.fromJson(GraphVO.class, json.toJson(actionToDuplicate));
Object[] payload = AddToLibraryAction.getPayload(input, duplicated);
HyperLap2DFacade.getInstance().sendNotification(MsgAPI.ACTION_ADD_TO_LIBRARY_ACTION, payload);
}
@Override
public void canceled() {
cancel();
}
});
}
use of games.rednblack.editor.view.ui.validator.StringNameValidator in project HyperLap2D by rednblackgames.
the class UISceneBoxMediator method handleNotification.
@Override
public void handleNotification(INotification notification) {
super.handleNotification(notification);
Sandbox sandbox = Sandbox.getInstance();
switch(notification.getName()) {
case ProjectManager.PROJECT_OPENED:
case MsgAPI.SCENE_LOADED:
viewComponent.update();
break;
case UISceneBox.CHANGE_SCENE_BTN_CLICKED:
facade.sendNotification(MsgAPI.CHECK_EDITS_ACTION, (Runnable) () -> sandbox.loadScene(notification.getBody()));
break;
case UISceneBox.CREATE_NEW_SCENE_BTN_CLICKED:
Dialogs.showInputDialog(sandbox.getUIStage(), "Create New Scene", "Scene Name : ", false, new StringNameValidator(), new InputDialogListener() {
@Override
public void finished(String input) {
if (input == null || input.equals("")) {
viewComponent.setCurrentScene();
return;
}
SceneDataManager sceneDataManager = facade.retrieveProxy(SceneDataManager.NAME);
sceneDataManager.createNewScene(input);
facade.sendNotification(MsgAPI.CHECK_EDITS_ACTION, (Runnable) () -> sandbox.loadScene(input));
}
@Override
public void canceled() {
viewComponent.setCurrentScene();
}
});
break;
case UISceneBox.DELETE_CURRENT_SCENE_BTN_CLICKED:
Dialogs.showConfirmDialog(sandbox.getUIStage(), "Delete Scene", "Do you really want to delete '" + notification.getBody() + "' scene?", new String[] { "Cancel", "Delete" }, new Integer[] { 0, 1 }, result -> {
if (result == 1) {
SceneDataManager sceneDataManager = facade.retrieveProxy(SceneDataManager.NAME);
sceneDataManager.deleteCurrentScene();
sandbox.loadScene("MainScene");
}
}).padBottom(20).pack();
break;
default:
break;
}
}
Aggregations