All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.lessvoid.nifty.examples.defaultcontrols.common.DialogPanelControlDefinition Maven / Gradle / Ivy

Go to download

Lots of Nifty example code! You can find the source for nearly all demos/tutorials in here.

There is a newer version: 1.4.3
Show newest version
package de.lessvoid.nifty.examples.defaultcontrols.common;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.builder.ControlDefinitionBuilder;
import de.lessvoid.nifty.builder.PanelBuilder;

import javax.annotation.Nonnull;

/**
 * This registers a special Panel control with Nifty we later use as the parent control/panel
 * for Dialogs. With it we can change the look and feel as well as the attached effect in
 * one place.
 *
 * @author void
 */
public class DialogPanelControlDefinition {
  @Nonnull
  public static final String NAME = "dialogPanel";
  @Nonnull
  private static final CommonBuilders builders = new CommonBuilders();

  public static void register(@Nonnull final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      set("childRootId", "#effectPanel");
      panel(new PanelBuilder() {{
        visible(false);
        childLayoutCenter();
        panel(new PanelBuilder("#effectPanel") {{
          style("nifty-panel");
          childLayoutVertical();
          alignCenter();
          valignCenter();
          width("50%");
          height("60%");
          padding("14px,20px,26px,19px");
          onShowEffect(builders.createMoveEffect("in", "left", 500));
          onHideEffect(builders.createMoveEffect("out", "right", 500));
          onHideEffect(builders.createFadeEffect());
        }});
      }});
    }}.registerControlDefintion(nifty);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy