Package de.lessvoid.nifty.builder

Examples of de.lessvoid.nifty.builder.ControlBuilder


  private static CommonBuilders builders = new CommonBuilders();

  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new DropDownDialogController());
      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{

        // here is the drop down control
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("DropDown:"));
          control(new DropDownBuilder("dropDown") {{
            width("*");
          }});
        }});

        // and the append button to add more items to the drop down
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Append:"));
          control(new ControlBuilder("addDropDownItemText", "textfield"));
          panel(builders.hspacer("9px"));
          control(new ButtonBuilder("addDropDownItemButton", "Append"));
        }});

        // the changed event and the remove item button
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Changed Event:"));
          control(new LabelBuilder("selectedItem") {{
            width("*");
            alignLeft();
            textVAlignCenter();
            textHAlignLeft();
          }});
          panel(builders.hspacer("9px"));
          control(new ButtonBuilder("removeDropDownItemButton", "Remove"));
        }});

        // and additionally the index of the selected item
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Current Sel. Idx.:"));
          control(new ControlBuilder("#selectedIndices", "label") {{
            alignLeft();
            textHAlignLeft();
            width("250px");
          }});
        }});
View Full Code Here


  private static CommonBuilders builders = new CommonBuilders();

  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new ListBoxDialogController());
      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{

        // the actual list box panel at the top
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("ListBox:"));
          control(new ListBoxBuilder("listBox") {{
            displayItems(4);
            selectionModeSingle();
            showVerticalScrollbar();
            showHorizontalScrollbar();
            width("*");
          }});
        }});

        // the panel for the append button
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Append:"));
          control(new ControlBuilder("addTextField", "textfield"));
          panel(builders.hspacer("9px"));
          control(new ButtonBuilder("appendButton", "Append"));
        }});

        // the panel for the checkbox to select multi selection and stuff
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Multi Selection:"));
          control(new CheckboxBuilder("multiSelectionCheckBox") {{
            checked(false);
          }});
          panel(builders.hspacer("17px"));
          control(builders.createShortLabel("Force Selection:"));
          panel(builders.hspacer("9px"));
          control(new CheckboxBuilder("forceSelectionCheckBox") {{
            checked(false);
          }});
          panel(builders.hspacer("17px"));
          control(builders.createShortLabel("Disable Selection:"));
          panel(builders.hspacer("9px"));
          control(new CheckboxBuilder("disableSelectionCheckBox") {{
            checked(false);
          }});
        }});

        // another listbox to display the current selection
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Current Sel.:"));
          control(new ListBoxBuilder("selectionListBox") {{
            displayItems(4);
            selectionModeDisabled();
            hideHorizontalScrollbar();
            hideVerticalScrollbar();
            width("*");
            childLayoutVertical();
            optionalHorizontalScrollbar();
            optionalVerticalScrollbar();
          }});
        }});

        // a simple label to display the new item index feature for selections
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Current Sel. Idx.:"));
          control(new ControlBuilder("selectedIndices", "label") {{
            alignLeft();
            textHAlignLeft();
            width("250px");
          }});
        }});

        // the remove selection button
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Remove Sel.:"));
          control(new ControlBuilder("removeSelectionButton", "button") {{
            set("label", "Remove Selection From ListBox");
            width("250px");
          }});
        }});
      }});
View Full Code Here

  private static CommonBuilders builders = new CommonBuilders();

  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new SliderAndScrollbarDialogController());
      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Alpha:"));
          control(new SliderBuilder("sliderA", false) {{
            width("*");
 
View Full Code Here

   * @param nifty
   */
  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new TextFieldDialogController());
      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Textfield:"));
          control(new TextFieldBuilder("mainTextField") {{
            width("*");
          }});
        }});
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Password Mode:"));
          control(new ControlBuilder("passwordCharCheckBox", "checkbox") {{
            set("checked", "false"); // start with uncheck
          }});
          panel(builders.hspacer("20px"));
          control(builders.createShortLabel("Char:", "40px"));
          panel(builders.hspacer("10px"));
          control(new TextFieldBuilder("passwordCharTextField", "*") {{
            maxLength(1);
            width("20px");
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Enable Length:"));
          control(new ControlBuilder("maxLengthEnableCheckBox", "checkbox") {{
            set("checked", "false");
          }});
          panel(builders.hspacer("20px"));
          control(builders.createShortLabel("Max:", "40px"));
          panel(builders.hspacer("10px"));
View Full Code Here

      }});
    }}.registerControlDefintion(nifty);
  }

  public static ControlBuilder getControlBuilder(final String id, final String text, final String hintText) {
    return new ControlBuilder(id, NAME) {{
      parameter(PARAMETER_LABEL, text);
      parameter(PARAMETER_HINT, hintText);
    }};
  }
View Full Code Here

      parameter(PARAMETER_HINT, hintText);
    }};
  }

  public static ControlBuilder getControlBuilder(final String id, final String text, final String hintText, final String width) {
    return new ControlBuilder(id, NAME) {{
      parameter(PARAMETER_LABEL, text);
      parameter(PARAMETER_HINT, hintText);
      width(width);
    }};
  }
View Full Code Here

  private static CommonBuilders builders = new CommonBuilders();

  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new ScrollPanelDialogController());
      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("ScrollPanel:"));
          control(new ScrollPanelBuilder("scrollPanel") {{
            width("*");
 
View Full Code Here

  private static CommonBuilders builders = new CommonBuilders();

  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new DragAndDropDialogController());
      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{
        control(new LabelBuilder("dragAndDropDescription", "Drop the Key on the Chest to open it.") {{
          width("100%");
          textHAlignCenter();
        }});
        panel(new PanelBuilder() {{
View Full Code Here

        panel(new PanelBuilder("dialogParent") {{
          childLayoutOverlay();
          width("100%");
          alignCenter();
          valignCenter();
          control(new ControlBuilder("dialogListBox", ListBoxDialogControlDefinition.NAME));
          control(new ControlBuilder("dialogTextField", TextFieldDialogControlDefinition.NAME));
          control(new ControlBuilder("dialogSliderAndScrollbar", SliderAndScrollbarDialogControlDefinition.NAME));
          control(new ControlBuilder("dialogDropDown", DropDownDialogControlDefinition.NAME));
          control(new ControlBuilder("dialogScrollPanel", ScrollPanelDialogControlDefinition.NAME));
          control(new ControlBuilder("dialogChatControl", ChatControlDialogDefinition.NAME));
          control(new ControlBuilder("dialogDragAndDrop", DragAndDropDialogDefinition.NAME));
        }});
      }});
      layer(new LayerBuilder() {{
        childLayoutVertical();
        panel(new PanelBuilder() {{
View Full Code Here

  public static String NAME = "chatControlDialogControl";

  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new ChatControlDialogController());
      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{
        control(new ChatBuilder("chat", 13) {{
          sendLabel("Send Message");
        }});
      }});
    }}.registerControlDefintion(nifty);
View Full Code Here

TOP

Related Classes of de.lessvoid.nifty.builder.ControlBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.