Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Add space to a menu with embedded components

    How to add space after the final element in a menu with embedded components?

    I have the following menu:
    Click image for larger version

Name:	Bildschirmfoto 2016-08-09 um 16.58.11.png
Views:	138
Size:	53.7 KB
ID:	239588

    Which is created with this code:

    Code:
    private IMenuButton createBearbeitenButton() {
            final Menu menu = new Menu();
            menu.setWidth(570);
            menu.setAutoDraw(false);
    
            /* Erstellen-Bereich. */
            IButton newPersonButton = new IButton(Kids.getConstants().person());
            newPersonButton.setIcon(KidsIcons.NEW.getFilename());
            newPersonButton.setWidth(150);
            newPersonButton.setHeight(28);
            newPersonButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
    
                }
            });
    
            IButton newEinrichtungBeziehungButton = new IButton(Kids.getConstants().personalbeziehung());
            newEinrichtungBeziehungButton.setIcon(KidsIcons.NEW.getFilename());
            newEinrichtungBeziehungButton.setWidth(150);
            newEinrichtungBeziehungButton.setHeight(28);
            newEinrichtungBeziehungButton.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
    
                }
            });
    
            final HStack erstellenButtons = new HStack(3);
            erstellenButtons.setDefaultLayoutAlign(VerticalAlignment.CENTER);
            erstellenButtons.setSnapTo("TR");
            erstellenButtons.setHeight(35);
            erstellenButtons.setAutoDraw(false);
            erstellenButtons.setMembers(newPersonButton, newEinrichtungBeziehungButton);
    
            final MenuItem erstellenMenuItem = new MenuItem(Kids.getConstants().erstellen());
            erstellenMenuItem.setShowRollOver(false);
            erstellenMenuItem.setEmbeddedComponentFields("key");
            erstellenMenuItem.setEmbeddedComponent(erstellenButtons);
            erstellenMenuItem.setIcon(KidsIcons.NEW.getFilename());
    
            /* Bearbeiten-Bereich. */
            IButton editPersonButton = new IButton(Kids.getConstants().person());
            editPersonButton.setIcon(KidsIcons.EDIT.getFilename());
            editPersonButton.setWidth(150);
            editPersonButton.setHeight(28);
            editPersonButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                   
                }
            });
    
            IButton editBeziehungButton = new IButton(Kids.getConstants().personalbeziehung());
            editBeziehungButton.setIcon(KidsIcons.EDIT.getFilename());
            editBeziehungButton.setWidth(150);
            editBeziehungButton.setHeight(28);
            editBeziehungButton.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
                   
                }
            });
    
            final HStack editButtons = new HStack(3);
            editButtons.setDefaultLayoutAlign(VerticalAlignment.CENTER);
            editButtons.setSnapTo("TR");
            editButtons.setHeight(35);
            editButtons.setAutoDraw(false);
            editButtons.setMembers(editPersonButton, editBeziehungButton);
    
            final MenuItem editMenuItem = new MenuItem(Kids.getConstants().aendern());
            editMenuItem.setShowRollOver(false);
            editMenuItem.setEmbeddedComponentFields("key");
            editMenuItem.setEmbeddedComponent(editButtons);
            editMenuItem.setIcon(KidsIcons.EDIT.getFilename());
    
            menu.setData(new MenuItemSeparator(), erstellenMenuItem, new MenuItemSeparator(), editMenuItem);
    
            final IMenuButton erstellenButton = new IMenuButton(Kids.getConstants().bearbeiten(), menu);
            erstellenButton.setWidth(100);
            erstellenButton.setAutoDraw(false);
            erstellenButton.setBaseStyle("buttonRounded");
            erstellenButton.setHeight(28);
    
            return erstellenButton;
        }
    Of course, I could add another separator to menu.setData(new MenuItemSeparator(), erstellenMenuItem, new MenuItemSeparator(), editMenuItem); , but this would create an unnecessary separator. I just want to add some space at the bottom part of the menu, as you can see in the screenshot.

    Using smartgwt 6.0p power

    #2
    Add bottom padding to either your embedded component or to the Menu as a whole, depending on how you want it to look.

    Comment

    Working...
    X