
de.lessvoid.nifty.examples.defaultcontrols.common.DialogPanelControlDefinition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nifty-examples Show documentation
Show all versions of nifty-examples Show documentation
Lots of Nifty example code! You can find the source for nearly all demos/tutorials in here.
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