Package de.lessvoid.nifty.builder

Examples of de.lessvoid.nifty.builder.PanelBuilder


    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");
          }});
        }});

        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          width("100%");
          height("1px");
          backgroundColor("#0008");
        }});
        panel(builders.vspacer());
        control(new RadioGroupBuilder("RadioGroup-1")); // the RadioGroup id is used to link radiobuttons logical together so that only one of them can be active at a certain time
        panel(new PanelBuilder() {{
          control(builders.createLabel("Radio Buttons"));
          childLayoutHorizontal();
          panel(new PanelBuilder() {{
            childLayoutVertical();
            backgroundColor("#8001");
            paddingLeft("7px");
            paddingRight("7px");
            paddingTop("4px");
            paddingBottom("4px");
            width("105px");
            onActiveEffect(new EffectBuilder("border") {{
              effectParameter("color", "#0008");
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 1", "60px"));
              control(new RadioButtonBuilder("option-1") {{
                group("RadioGroup-1");
              }});
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 2", "60px"));
              control(new RadioButtonBuilder("option-2") {{
                group("RadioGroup-1");
              }});
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 3", "60px"));
              control(new RadioButtonBuilder("option-3") {{
                group("RadioGroup-1");
              }});
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 4", "60px"));
              control(new RadioButtonBuilder("option-4") {{
                group("RadioGroup-1");
              }});
            }});
          }});
          panel(builders.hspacer("10px"));
          panel(new PanelBuilder() {{
            childLayoutVertical();
            backgroundColor("#8001");
            paddingLeft("7px");
            paddingRight("7px");
            paddingTop("4px");
            paddingBottom("4px");
            onActiveEffect(new EffectBuilder("border") {{
              effectParameter("color", "#0008");
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 1 Event:"));
              control(new LabelBuilder("option-1-changed") {{
                width("*");
                alignLeft();
                textVAlignCenter();
                textHAlignLeft();
              }});
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 2 Event:"));
              control(new LabelBuilder("option-2-changed") {{
                width("*");
                alignLeft();
                textVAlignCenter();
                textHAlignLeft();
              }});
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 3 Event:"));
              control(new LabelBuilder("option-3-changed") {{
                width("*");
                alignLeft();
                textVAlignCenter();
                textHAlignLeft();
              }});
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Option 4 Event:"));
              control(new LabelBuilder("option-4-changed") {{
                width("*");
                alignLeft();
                textVAlignCenter();
                textHAlignLeft();
              }});
            }});
          }});
        }});
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Group Event:"));
          control(new LabelBuilder("RadioGroup-1-changed") {{
            width("*");
            alignLeft();
            textVAlignCenter();
            textHAlignLeft();
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Allow Deselect:"));
          control(new CheckboxBuilder("radioGroupAllowDeselection") {{
            checked(false);
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Disable:"));
          control(new CheckboxBuilder("radioGroupDisable") {{
            checked(false);
          }});
View Full Code Here


      control(new ControlBuilder(DialogPanelControlDefinition.NAME) {{
        control(new LabelBuilder("dragAndDropDescription", "Drop the Key on the Chest to open it.") {{
          width("100%");
          textHAlignCenter();
        }});
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(new DroppableBuilder("chest") {{
            width("101px");
            height("171px");
            panel(new PanelBuilder() {{
              childLayoutOverlay();
              image(new ImageBuilder("chest-image") {{
                filename("dragndrop/Chest Open.png");
              }});
              image(new ImageBuilder("chest-open") {{
                filename("dragndrop/Chest Lid.png");
                onCustomEffect(new EffectBuilder("move") {{
                  effectParameter("mode", "toOffset");
                  effectParameter("offsetY", "-100");
                  length(250);
                  customKey("switchOpen");
                  neverStopRendering(true);
                }});
                onCustomEffect(new EffectBuilder("fade") {{
                  effectParameter("start", "#f");
                  effectParameter("end", "#0");
                  length(250);
                  customKey("switchOpen");
                  neverStopRendering(true);
                }});
              }});
            }});
          }});
          panel(new PanelBuilder() {{
            width("*");
          }});
          control(new DroppableBuilder("key-initial") {{
            width("101px");
            height("171px");
            onActiveEffect(new EffectBuilder("border") {{
              effectParameter("color", "#0003");
            }});
            control(new DraggableBuilder("key") {{
              childLayoutCenter();
              image(new ImageBuilder() {{
                filename("dragndrop/Key.png");
              }});
            }});
          }});
        }});
        panel(new PanelBuilder() {{
          width("100%");
          childLayoutVertical();
          text(new TextBuilder() {{
            style("base-font-link");
            text("\"Danc's Miraculously Flexible Game Prototyping Tiles\"");
            set("action", "openLink(http://www.lostgarden.com/2007/05/dancs-miraculously-flexible-game.html)");
            textHAlignRight();
            alignRight();
          }});
        }});
        panel(new PanelBuilder() {{
          width("100%");
          childLayoutVertical();
          text(new TextBuilder() {{
            style("base-font");
            text("art by Daniel Cook (Lostgarden.com)");
            textHAlignRight();
            alignRight();
          }});
        }});
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          width("100%");
          childLayoutVertical();
          control(new ButtonBuilder("resetButton", "Reset") {{
            alignCenter();
          }});
View Full Code Here

    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

  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("*");
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Color:"));
          height("35%");
          panel(new PanelBuilder() {{
            childLayoutVertical();
            width("23px");
            control(new SliderBuilder("sliderR", true));
            control(new LabelBuilder() {{
              alignCenter();
              text("R");
              width("100%");
            }});
          }});
          panel(builders.hspacer("5px"));
          panel(new PanelBuilder() {{
            childLayoutVertical();
            control(new SliderBuilder("sliderG", true));
            width("23px");
            control(new LabelBuilder() {{
              alignCenter();
              text("G");
              width("100%");
            }});
          }});
          panel(builders.hspacer("5px"));
          panel(new PanelBuilder() {{
            childLayoutVertical();
            control(new SliderBuilder("sliderB", true));
            width("23px");
            control(new LabelBuilder() {{
              alignCenter();
              text("B");
              width("100%");
            }});
          }});
          panel(builders.hspacer("35px"));
          panel(new PanelBuilder() {{
            valignCenter();
            childLayoutVertical();
            width("20%");
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Red:", "50px"));
              panel(builders.hspacer("5px"));
              control(builders.createLabel("redLabel", "", "50px"));
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Green:", "50px"));
              panel(builders.hspacer("5px"));
              control(builders.createLabel("greenLabel", "", "50px"));
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Blue:", "50px"));
              panel(builders.hspacer("5px"));
              control(builders.createLabel("blueLabel", "", "50px"));
            }});
            panel(new PanelBuilder() {{
              childLayoutHorizontal();
              control(builders.createLabel("Alpha:", "50px"));
              panel(builders.hspacer("5px"));
              control(builders.createLabel("alphaLabel", "", "50px"));
            }});
          }});
          panel(builders.hspacer("15px"));
          panel(new PanelBuilder() {{
            valignTop();
            childLayoutCenter();
            width("20%");
            panel(new PanelBuilder("color") {{
              alignCenter();
              valignCenter();
              width("50px");
              height("50px");
              backgroundColor("#ffff");
            }});
          }});
          panel(builders.hspacer("9px"));
        }});
        panel(builders.vspacer());
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Horizontal:"));
          control(new ScrollbarBuilder("scrollbarH", false) {{
            width("*");
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Current Value:"));
          control(new TextFieldBuilder("scrollbarH_CurrentValue_Textfield") {{
            width("50px");
          }});
          panel(builders.hspacer("20px"));
          control(new LabelBuilder() {{
            text("World Max:");
            alignLeft();
            textVAlignCenter();
            textHAlignLeft();
            width("70px");
          }});
          panel(builders.hspacer("15px"));
          control(new TextFieldBuilder("scrollbarH_WorldMax_Textfield") {{
            width("50px");
          }});
          panel(builders.hspacer("20px"));
          control(new LabelBuilder() {{
            text("Page Size:");
            alignLeft();
            textVAlignCenter();
            textHAlignLeft();
          }});
          panel(builders.hspacer("15px"));
          control(new TextFieldBuilder("scrollbarH_ViewMax_Textfield") {{
            width("50px");
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Button Step:"));
          control(new TextFieldBuilder("scrollbarH_ButtonStepSize_Textfield") {{
            width("50px");
          }});
View Full Code Here

   */
  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"));
          control(new TextFieldBuilder("maxLengthTextField") {{
            width("50px");
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Changed Event:"));
          control(new LabelBuilder("textChangedLabel") {{
            width("*");
            alignLeft();
            textVAlignCenter();
            textHAlignLeft();
          }});
        }});
        panel(builders.vspacer());
        panel(new PanelBuilder() {{
          childLayoutHorizontal();
          control(builders.createLabel("Key Event:"));
          control(new LabelBuilder("keyEventLabel") {{
            width("120px");
            alignLeft();
View Full Code Here

      inherit(true);
    }};
  }

  public PanelBuilder vspacer() {
    return new PanelBuilder() {{
      childLayoutHorizontal();
      height("9px");
      width("0px");
    }};
  }
View Full Code Here

      width("0px");
    }};
  }

  public PanelBuilder vspacer(final String height) {
    return new PanelBuilder() {{
      childLayoutHorizontal();
      height(height);
      width("100%");
    }};
  }
View Full Code Here

      width("100%");
    }};
  }

  public PanelBuilder hspacer(final String width) {
    return new PanelBuilder() {{
      width(width);
      height("0px");
    }};
  }
View Full Code Here

  private static final String PARAMETER_HINT = "menuButtonHint";

  public static void register(final Nifty nifty) {
    new ControlDefinitionBuilder(NAME) {{
      controller(new MenuButtonController());
      panel(new PanelBuilder() {{
        backgroundColor("#800a");
        width("123px");
        alignCenter();
        valignCenter();
        childLayoutCenter();
View Full Code Here

  private static CommonBuilders builders = new CommonBuilders();

  public static void register(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%");
View Full Code Here

TOP

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

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.