public AlignmentToolsDialog(ModuleInjector injector, Array<EntityProxy> selectedEntities) {
    injector.injectModules(this);
    this.selectedEntities = selectedEntities;

    setBackground(VisUI.getSkin().getDrawable("window-bg"));
    setTouchable(Touchable.enabled);
    setVisible(false);
    addListener(new EventStopper());

    top().left();
    defaults().left();
    TableUtils.setSpacingDefaults(this);

    VisTable horizontalAlign = new VisTable(true);

    VisImageButton alignLeft =
        new VisImageButton(Icons.ALIGN_LEFT.drawable(), "Align entities at left edge");
    VisImageButton alignRight =
        new VisImageButton(Icons.ALIGN_RIGHT.drawable(), "Align entities at right edge");
    VisImageButton alignCenterX =
        new VisImageButton(Icons.ALIGN_CENTER_X.drawable(), "Center entities at x axis");
    VisImageButton alignTop =
        new VisImageButton(Icons.ALIGN_BOTTOM.drawable(), "Align entities at top edge");
    VisImageButton alignBottom =
        new VisImageButton(Icons.ALIGN_TOP.drawable(), "Align entities at bottom edge");
    VisImageButton alignCenterY =
        new VisImageButton(Icons.ALIGN_CENTER_Y.drawable(), "Center entities at y axis");

    VisImageButton closeButton = new VisImageButton("close-window");

    horizontalAlign.add("Horizontal").width(70);
    horizontalAlign.add(alignLeft);
    horizontalAlign.add(alignRight);
    horizontalAlign.add(alignCenterX);

    VisTable verticalAlign = new VisTable(true);

    verticalAlign.add("Vertical").width(70);
    verticalAlign.add(alignTop);
    verticalAlign.add(alignBottom);
    verticalAlign.add(alignCenterY);

    add(new VisLabel("Alignment", Align.center)).expandX().fillX().top();
    add(closeButton).right().row();
    add(horizontalAlign).padLeft(3).colspan(2).row();
    add(verticalAlign).padLeft(3).colspan(2);

    pack();

    alignLeft.addListener(new VisChangeListener((event, actor) -> alignSelected(Align.left)));
    alignRight.addListener(new VisChangeListener((event, actor) -> alignSelected(Align.right)));
    alignCenterX.addListener(new VisChangeListener((event, actor) -> alignSelectedCenter(false)));
    alignTop.addListener(new VisChangeListener((event, actor) -> alignSelected(Align.top)));
    alignBottom.addListener(new VisChangeListener((event, actor) -> alignSelected(Align.bottom)));
    alignCenterY.addListener(new VisChangeListener((event, actor) -> alignSelectedCenter(true)));

    closeButton.addListener(new VisChangeListener((event, actor) -> setVisible(false)));
  }
  public TestFormValidator() {
    super("form validator");

    TableUtils.setSpacingDefaults(this);
    defaults().padRight(1);
    defaults().padLeft(1);
    columnDefaults(0).left();

    VisTextButton cancelButton = new VisTextButton("cancel");
    VisTextButton acceptButton = new VisTextButton("accept");

    VisValidableTextField firstNameField = new VisValidableTextField();
    VisValidableTextField lastNameField = new VisValidableTextField();
    VisValidableTextField age = new VisValidableTextField();

    VisLabel errorLabel = new VisLabel();
    errorLabel.setColor(Color.RED);

    VisTable buttonTable = new VisTable(true);
    buttonTable.add(errorLabel).expand().fill();
    buttonTable.add(cancelButton);
    buttonTable.add(acceptButton);

    add(new VisLabel("first name: "));
    add(firstNameField).expand().fill();
    row();
    add(new VisLabel("last name: "));
    add(lastNameField).expand().fill();
    row();
    add(new VisLabel("age: "));
    add(age).expand().fill();
    row();
    add(buttonTable).fill().expand().colspan(2).padBottom(3);

    SimpleFormValidator validator; // for GWT compatibility
    validator = new SimpleFormValidator(acceptButton, errorLabel);
    validator.notEmpty(firstNameField, "first name cannot be empty");
    validator.notEmpty(lastNameField, "last name cannot be empty");
    validator.notEmpty(age, "age cannot be empty");
    validator.integerNumber(age, "age must be a number");
    validator.valueGreaterThan(age, "you must be at least 18 years old", 18, true);

    pack();
    setSize(getWidth() + 60, getHeight());
    setPosition(548, 110);
  }
Пример #3
0
  public PluginDetailsDialog(PluginDescriptor descriptor) {
    super("Plugin Details");

    setModal(true);
    addCloseButton();
    closeOnEscape();
    TableUtils.setSpacingDefaults(this);

    VisTable contentTable = new VisTable(false);
    contentTable.defaults().spaceBottom(2).expand().left();

    contentTable.add(new VisLabel("Name: " + descriptor.name + " (" + descriptor.id + ")")).row();
    contentTable.add(new VisLabel("Description: " + descriptor.description)).row();
    contentTable.add(new VisLabel("Provider: " + descriptor.provider)).row();
    contentTable.add(new VisLabel("Version: " + descriptor.version)).row();
    contentTable
        .add(
            new VisLabel(
                "Compatibility: "
                    + descriptor.compatibility
                    + " "
                    + (descriptor.compatibility != App.PLUGIN_COMPATIBILITY_CODE
                        ? "(doesn't matches editor!)"
                        : "(matches editor)")))
        .row();

    VisTextButton okButton;

    add(contentTable).pad(3).expand().fill().row();
    add(okButton = new VisTextButton("OK")).right();

    okButton.addListener(new VisChangeListener((event, actor) -> fadeOut()));
    pack();
    setSize(getWidth(), getHeight());
    centerWindow();
  }
  public DefaultExporterSettingsDialog(
      EditorSettingsIOModule settingsIO, DefaultExporterSettings settings) {
    super("Settings");
    this.settingsIO = settingsIO;
    this.settings = settings;

    TableUtils.setSpacingDefaults(this);
    setModal(true);
    closeOnEscape();
    addCloseButton();

    left();
    defaults().left();

    VisTextButton cancelButton = new VisTextButton("Cancel");
    VisTextButton okButton = new VisTextButton("OK");
    VisTable buttonTable = new VisTable(true);
    buttonTable.add(cancelButton);
    buttonTable.add(okButton);

    skipDefaultCheck = new VisCheckBox("Skip default values");

    VisImage skipDefaultHelpImage = new VisImage(Icons.QUESTION_BIG.drawable());
    new Tooltip.Builder(
            "Reduces output file size by skipping default values like '0' or 'null'.\n"
                + "Typically there is no need to disable it but you can do it if you want to inspect\n"
                + "output scene file.",
            Align.left)
        .target(skipDefaultHelpImage)
        .build();
    add(skipDefaultCheck);
    add(skipDefaultHelpImage).size(22).row();

    minimalOutputCheck = new VisCheckBox("Use minimal output type");
    VisImage minimalOutputHelpImage = new VisImage(Icons.QUESTION_BIG.drawable());
    new Tooltip.Builder(
            "If checked output JSON will use minimal format, unnecessary double quotes\n"
                + "will be skipped unless needed. This format may not be supported by all JSON parsers.\nUncheck"
                + "this to disable minimal format.",
            Align.left)
        .target(minimalOutputHelpImage)
        .build();
    add(minimalOutputCheck);
    add(minimalOutputHelpImage).size(22).row();

    packageSeparateAtlasForEachSceneCheck =
        new VisCheckBox("Package separate atlas for each scene");
    VisImage packageSeparateAtlasForEachSceneHelpImage =
        new VisImage(Icons.QUESTION_BIG.drawable());
    new Tooltip.Builder(
            "If checked each exported scene will have it's own separate texture atlas. This is useful\n"
                + "when you have many texture assets but they are split between scenes.\nNote when this is checked 'master'"
                + "atlas containing all texture will not be created.",
            Align.left)
        .target(packageSeparateAtlasForEachSceneHelpImage)
        .build();
    add(packageSeparateAtlasForEachSceneCheck);
    add(packageSeparateAtlasForEachSceneHelpImage).size(22).row();

    migFilterSelectBox =
        new EnumSelectBox<>(Texture.TextureFilter.class, new DefaultEnumNameProvider<>());
    magFilterSelectBox =
        new EnumSelectBox<>(Texture.TextureFilter.class, new DefaultEnumNameProvider<>());
    add(TableBuilder.build(new VisLabel("Mig Texture Filter"), migFilterSelectBox)).row();
    add(TableBuilder.build(new VisLabel("Mag Texture Filter"), magFilterSelectBox)).row();

    add(buttonTable).right().colspan(2);

    cancelButton.addListener(
        new VisChangeListener(
            (event1, actor1) -> {
              setUIFromSettings();
              fadeOut();
            }));

    okButton.addListener(
        new VisChangeListener(
            (event, actor) -> {
              setToSettings();
              fadeOut();
            }));

    setUIFromSettings();

    pack();
    centerWindow();
  }