Java Code Examples for com.vaadin.flow.component.orderedlayout.HorizontalLayout#setAlignItems()

The following examples show how to use com.vaadin.flow.component.orderedlayout.HorizontalLayout#setAlignItems() . 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: TopNavigationLink.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public TopNavigationLink(String caption, Component icon, Class<? extends Component> className) {
    super();
    this.className = className;
    HorizontalLayout wrapper = new HorizontalLayout();
    if (icon != null){
        wrapper.add(icon);
    }
    if(caption != null){
        wrapper.add(new Label(caption));
    }
    wrapper.setAlignItems(FlexComponent.Alignment.CENTER);
    wrapper.setHeight("100%");
    add(wrapper);
    UpNavigationHelper.registerNavigationRoute(className);
    setRoute(UI.getCurrent().getRouter(), className);
    setHighlightCondition((routerLink, event) -> UpNavigationHelper.shouldHighlight(className, event.getLocation()));
}
 
Example 2
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public AbstractView() {

        HorizontalLayout layout = new HorizontalLayout();
        layout.setSizeFull();
        layout.setMargin(false);
        layout.add(new Label("< " + getViewName() + " >"));
        layout.setAlignItems(Alignment.CENTER);
        layout.setJustifyContentMode(JustifyContentMode.CENTER);

        add(layout);
        setMargin(false);
        setSizeFull();
        getElement()
                .getStyle()
                .set("overflow", "auto");
    }
 
Example 3
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public AbstractView() {

        HorizontalLayout layout = new HorizontalLayout();
        layout.setSizeFull();
        layout.setMargin(false);
        layout.add(new Label("< " + getViewName() + " >"));
        layout.setAlignItems(Alignment.CENTER);
        layout.setJustifyContentMode(JustifyContentMode.CENTER);

        add(layout);
        setMargin(false);
        setSizeFull();
        getElement()
                .getStyle()
                .set("overflow", "auto");
    }
 
Example 4
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 6 votes vote down vote up
public AbstractView() {

        HorizontalLayout layout = new HorizontalLayout();
        layout.setSizeFull();
        layout.setMargin(false);
        layout.add(new Label("< " + getViewName() + " >"));
        layout.setAlignItems(Alignment.CENTER);
        layout.setJustifyContentMode(JustifyContentMode.CENTER);

        add(layout);
        setMargin(false);
        setSizeFull();
        getElement()
                .getStyle()
                .set("overflow", "auto");
    }
 
Example 5
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public AbstractView() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    setMargin(false);
    Label label = new Label("< " + getViewName() + " >");
    layout.add(label);
    layout.setAlignItems(Alignment.CENTER);
    add(layout);
    setSizeFull();
    getElement().getStyle().set("overflow", "auto");
}
 
Example 6
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public AbstractView() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    setMargin(false);
    Label label = new Label("< " + getViewName() + " >");
    layout.add(label);
    layout.setAlignItems(Alignment.CENTER);
    layout.setJustifyContentMode(JustifyContentMode.CENTER);
    add(layout);
    setSizeFull();
    getElement().getStyle().set("overflow", "auto");
}
 
Example 7
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public AbstractView() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    setMargin(false);
    Label label = new Label("< " + getViewName() + " >");
    layout.add(label);
    layout.setAlignItems(Alignment.CENTER);
    layout.setJustifyContentMode(JustifyContentMode.CENTER);
    add(layout);
    setSizeFull();
    getElement().getStyle().set("overflow", "auto");
}
 
Example 8
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public AbstractView() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    setMargin(false);
    Label label = new Label("< " + getViewName() + " >");
    layout.add(label);
    layout.setAlignItems(Alignment.CENTER);
    layout.setJustifyContentMode(JustifyContentMode.CENTER);
    add(layout);
    setSizeFull();
    getElement().getStyle().set("overflow", "auto");
}
 
Example 9
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public AbstractView() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    setMargin(false);
    Label label = new Label("< " + getViewName() + " >");
    layout.add(label);
    layout.setAlignItems(Alignment.CENTER);
    layout.setJustifyContentMode(JustifyContentMode.CENTER);
    add(layout);
    setSizeFull();
    getElement().getStyle().set("overflow", "auto");
}
 
Example 10
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public AbstractView() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    setMargin(false);
    Label label = new Label("< " + getViewName() + " >");
    layout.add(label);
    layout.setAlignItems(Alignment.CENTER);
    layout.setJustifyContentMode(JustifyContentMode.CENTER);
    add(layout);
    setSizeFull();
    getElement().getStyle().set("overflow", "auto");
}
 
Example 11
Source File: AbstractView.java    From vaadin-app-layout with Apache License 2.0 5 votes vote down vote up
public AbstractView() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.setMargin(false);
    setMargin(false);
    Label label = new Label("< " + getViewName() + " >");
    layout.add(label);
    layout.setAlignItems(Alignment.CENTER);
    layout.setJustifyContentMode(JustifyContentMode.CENTER);
    add(layout);
    setSizeFull();
    getElement().getStyle().set("overflow", "auto");
}
 
Example 12
Source File: DashboardView.java    From alibaba-rsocket-broker with Apache License 2.0 4 votes vote down vote up
public DashboardView(@Autowired RSocketBrokerHandlerRegistry handlerRegistry,
                     @Autowired ServiceRoutingSelector serviceRoutingSelector,
                     @Autowired RSocketBrokerManager rSocketBrokerManager) {
    this.handlerRegistry = handlerRegistry;
    this.serviceRoutingSelector = serviceRoutingSelector;
    this.rSocketBrokerManager = rSocketBrokerManager;
    setAlignItems(Alignment.CENTER);
    //---- top
    HorizontalLayout top = new HorizontalLayout();
    top.setAlignItems(Alignment.CENTER);
    add(top);
    // brokers panel
    Panel brokersPanel = new Panel("Brokers");
    brokersPanel.add(brokersCount);
    top.add(brokersPanel);
    // apps panel
    Panel appsPanel = new Panel("Apps");
    appsPanel.add(appsCount);
    top.add(appsPanel);
    // services panel
    Panel servicePanel = new Panel("Services");
    servicePanel.add(servicesCount);
    top.add(servicePanel);
    // connections panel
    Panel connectionPanel = new Panel("Connections");
    connectionPanel.add(connectionsCount);
    top.add(connectionPanel);
    // requests count panel
    Panel requestsPanel = new Panel("Requests");
    requestsPanel.add(requestsCounter);
    top.add(requestsPanel);
    //--- last ten apps
    Div div2 = new Div();
    div2.add(new H3("Last apps"));
    appMetadataGrid.addColumn(AppMetadata::getName).setHeader("App Name");
    appMetadataGrid.addColumn(AppMetadata::getIp).setHeader("IP");
    appMetadataGrid.addColumn(AppMetadata::getConnectedAt).setHeader("Timestamp");
    appMetadataGrid.setWidth("1024px");
    div2.add(appMetadataGrid);
    add(div2);
}
 
Example 13
Source File: NotificationView.java    From vaadin-app-layout with Apache License 2.0 4 votes vote down vote up
public NotificationView(T info, NotificationHolder<T> holder, NotificationListener listener, boolean isNotification) {
    this.info = info;
    this.holder = holder;
    this.isNotification = isNotification;
    setWidth("100%");
    setAlignItems(Alignment.CENTER);
    Label title = new Label(info.getTitle());
    title.getElement().getStyle()
            .set("font-size", "15px")
            .set("font-weight", "500");

    Label dot = new Label("ยท");
    dot.getElement().getStyle()
            .set("margin-left", "5px");

    Label timeAgo = new Label(holder.getDateTimeFormatter().apply(info));
    timeAgo.getElement().getStyle()
            .set("font-size", "13px")
            .set("margin-left", "5px")
            .set("font-weight", "300");

    Label description = new Label(info.getDescription());
    description.setWidth("100%");
    description.getElement().getStyle()
            .set("font-size", "15px")
            .set("font-weight", "400")
            .set("white-space", "nowrap")
            .set("text-overflow", "ellipsis")
            .set("overflow", "hidden");

    HorizontalLayout descriptionWrapper = new HorizontalLayout(description);

    descriptionWrapper.setWidth("100%");
    if (info.getImage() != null) {
        RoundImage image = new RoundImage(info.getImage());
        descriptionWrapper.add(image);
    }
    if (!isNotification) {
        setHighlightBorder(!info.isRead());
    }
    HorizontalLayout headerLine = new HorizontalLayout(title, dot, timeAgo);
    headerLine.setSpacing(false);
    headerLine.setAlignItems(FlexComponent.Alignment.CENTER);
    wrapper = new VerticalLayout(headerLine, descriptionWrapper);
    wrapper.setMargin(false);
    wrapper.setPadding(false);
    wrapper.setSpacing(false);
    wrapper.getElement().setAttribute("theme", "spacing-s");
    wrapper.getStyle().set("overflow", "hidden");
    add(wrapper);

    setNotificationListener(listener);
    if (!isNotification) {
        if (info.isDismissable()) {
            dismissButton = new IconButton(VaadinIcon.CLOSE_SMALL.create(), paperIconButtonClickEvent -> {
                if (listener != null) {
                    listener.onDismiss();
                }
            });
            dismissButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
            dismissButton.setSizeUndefined();
            add(dismissButton);
            getElement().getStyle().set("padding-right", "0");
        }
    }
}