Java Code Examples for com.vaadin.flow.component.html.Div#setHeight()

The following examples show how to use com.vaadin.flow.component.html.Div#setHeight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DnDCustomComponentView.java    From flow with Apache License 2.0 7 votes vote down vote up
public DraggableItem(EffectAllowed effectAllowed) {
    dragHandle = new Div();
    dragHandle.setHeight("50px");
    dragHandle.setWidth("80px");
    dragHandle.getStyle().set("background", "#000 ");
    dragHandle.getStyle().set("margin", "5 10px");
    dragHandle.getStyle().set("display", "inline-block");

    setDraggable(true);
    setDragData(effectAllowed);
    addDragStartListener(DnDCustomComponentView.this::onDragStart);
    addDragEndListener(DnDCustomComponentView.this::onDragEnd);

    setHeight("50px");
    setWidth("200px");
    getStyle().set("border", "1px solid black");
    getStyle().set("display", "inline-block");

    add(dragHandle, new Span(effectAllowed.toString()));
}
 
Example 2
Source File: LeftAppMenuBuilder.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public Component build() {
    components.addAll(header);
    LeftMenuComponentWrapper menu = new LeftMenuComponentWrapper();
    components.addAll(body);
    if (sticky) {
        menu.getMenu().getStyle().set("display", "flex");
        Div div = new Div();
        div.setWidth("100%");
        div.setHeight("0px");
        div.getStyle().set("flex", "1 1");
        components.add(div);
    }
    components.addAll(footer);
    menu.add(components.toArray(new Component[0]));
    return menu;
}
 
Example 3
Source File: TopLayouts.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public Top() {
    contentPanel.setSizeFull();
    getElement().getClassList().addAll(Arrays.asList("app-layout-behaviour-" + getStyleName(), "app-layout"));
    appBar.add(titleWrapper, paperTabWrapper, appBarElementWrapper);
    paperTabWrapper.setFlexGrow(1.0, titleWrapper);
    paperTabWrapper.setWidth("100%");
    paperTabWrapper.setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
    appBar.setWidth("100%");
    appBar.setHeight("100%");

    appBarElements = new Div();
    appBarElements.setHeight("100%");
    appBarElements.getElement().setAttribute("slot", "app-bar-content");
    contentHolder = new Div();
    contentHolder.setHeight("100%");
    contentHolder.setWidth("100%");
    contentHolder.getElement().setAttribute("slot", "application-content");

    appBarElements.add(appBar);
    appBarElementWrapper.setSpacing(false);
    appBarElementWrapper.add(appBarElementContainer);
    appBarElementContainer.setHeight("100%");
    appBarElementWrapper.setAlignItems(FlexComponent.Alignment.START);
    titleWrapper.setHeight("100%");
    titleWrapper.setAlignItems(FlexComponent.Alignment.CENTER);
    menuButton.setIcon(VaadinIcon.ARROW_LEFT.create());
    menuButton.addThemeNames(ButtonVariant.LUMO_TERTIARY.getVariantName(), ButtonVariant.LUMO_ICON.getVariantName(), ButtonVariant.LUMO_LARGE.getVariantName());
    getElement().appendChild(appBarElements.getElement(), contentHolder.getElement());
}
 
Example 4
Source File: DnDView.java    From flow with Apache License 2.0 5 votes vote down vote up
private Div createBox(String identifier) {
    Div box = new Div();
    box.setText(identifier);
    box.setWidth("100px");
    box.setHeight("60px");
    box.getStyle().set("border", "1px solid").set("margin", "10px");
    box.setId("box-" + identifier);
    return box;
}
 
Example 5
Source File: DnDDisabledView.java    From flow with Apache License 2.0 5 votes vote down vote up
private Div createBox(String identifier) {
    Div box = new Div();
    box.setText(identifier);
    box.setWidth("100px");
    box.setHeight("60px");
    box.getStyle().set("border", "1px solid").set("margin", "10px");
    box.setId("box-" + identifier);
    return box;
}
 
Example 6
Source File: DnDCustomComponentView.java    From flow with Apache License 2.0 5 votes vote down vote up
public DnDCustomComponentView() {
    Stream.of(EffectAllowed.values()).map(DraggableItem::new)
            .forEach(this::add);

    dropTarget = new Div();
    dropTarget.add(new Text("Drop Here"));
    dropTarget.setWidth("200px");
    dropTarget.setHeight("200px");
    dropTarget.getStyle().set("border", "solid 1px pink");
    add(dropTarget);

    DropTarget.create(dropTarget).addDropListener(event -> event.getSource()
            .add(new Span(event.getDragData().get().toString())));
}
 
Example 7
Source File: ScrollView.java    From flow with Apache License 2.0 4 votes vote down vote up
static Div createSpacerDiv(int heightPx) {
    Div spacer = new Div();
    spacer.setHeight(heightPx + "px");
    return spacer;
}