Search in sources :

Example 26 with CssLayout

use of com.vaadin.ui.CssLayout in project jmix by jmix-framework.

the class WindowBreadCrumbs method createEnclosingLayout.

protected Layout createEnclosingLayout() {
    Layout enclosingLayout = new CssLayout();
    enclosingLayout.setPrimaryStyleName("jmix-breadcrumbs-container");
    return enclosingLayout;
}
Also used : CssLayout(com.vaadin.ui.CssLayout) CssLayout(com.vaadin.ui.CssLayout) Layout(com.vaadin.ui.Layout)

Example 27 with CssLayout

use of com.vaadin.ui.CssLayout in project catma by forTEXT.

the class JoinProjectCard method initComponents.

private void initComponents() {
    addStyleName("projectlist__newproject");
    CssLayout newproject = new CssLayout();
    newproject.addStyleName("projectlist__newproject__link");
    Label labelDesc = new Label("join project");
    labelDesc.setWidth("100%");
    newproject.addComponents(labelDesc);
    newproject.addLayoutClickListener(evt -> {
        new JoinProjectDialog(currentUser, eventBus).show();
    });
    addComponent(newproject);
    HorizontalFlexLayout descriptionBar = new HorizontalFlexLayout();
    descriptionBar.addStyleName("projectlist__card__descriptionbar");
    descriptionBar.setAlignItems(FlexLayout.AlignItems.BASELINE);
    descriptionBar.setWidth("100%");
    addComponents(descriptionBar);
}
Also used : CssLayout(com.vaadin.ui.CssLayout) Label(com.vaadin.ui.Label) HorizontalFlexLayout(de.catma.ui.layout.HorizontalFlexLayout)

Example 28 with CssLayout

use of com.vaadin.ui.CssLayout in project catma by forTEXT.

the class ProjectCard method initComponents.

protected void initComponents() {
    addStyleName("projectlist__card");
    CssLayout preview = new CssLayout();
    preview.addStyleName("projectlist__card__preview");
    descriptionLabel = new Label(projectReference.getDescription());
    descriptionLabel.setWidth("100%");
    preview.addComponents(descriptionLabel);
    preview.addLayoutClickListener(evt -> handleOpenProjectRequest());
    addComponent(preview);
    HorizontalFlexLayout descriptionBar = new HorizontalFlexLayout();
    descriptionBar.addStyleName("projectlist__card__descriptionbar");
    descriptionBar.setAlignItems(FlexLayout.AlignItems.BASELINE);
    descriptionBar.setWidth("100%");
    nameLabel = new Label(projectReference.getName());
    nameLabel.setWidth("100%");
    descriptionBar.addComponent(nameLabel);
    IconButton btnRemove = new IconButton(VaadinIcons.TRASH);
    descriptionBar.addComponents(btnRemove);
    btnRemove.addClickListener((event -> {
        ConfirmDialog.show(UI.getCurrent(), "Delete Project", "Do you want to delete the whole Project '" + projectReference.getName() + "'?", "OK", "Cancel", (evt) -> {
            try {
                if (evt.isConfirmed()) {
                    projectManager.delete(projectReference.getProjectId());
                    eventBus.post(new ProjectChangedEvent(projectReference.getProjectId()));
                }
            } catch (Exception e) {
                errorLogger.showAndLogError("can't delete Project " + projectReference.getName(), e);
            }
        });
    }));
    IconButton btnEdit = new IconButton(VaadinIcons.PENCIL);
    btnEdit.addClickListener(click -> {
        new EditProjectDialog(projectReference, projectManager, result -> {
            try {
                projectManager.updateProject(result);
                descriptionLabel.setValue(result.getDescription());
                nameLabel.setValue(result.getName());
            } catch (IOException e) {
                errorLogger.showAndLogError("Failed to update Project", e);
                eventBus.post(new ProjectChangedEvent());
            }
        }).show();
    });
    descriptionBar.addComponent(btnEdit);
    IconButton btnLeave = new IconButton(VaadinIcons.EXIT);
    btnLeave.addClickListener((event -> {
        ConfirmDialog.show(UI.getCurrent(), "Leave Project", "Do you want to leave '" + projectReference.getName() + "'?", "OK", "Cancel", (evt) -> {
            try {
                if (evt.isConfirmed()) {
                    projectManager.leaveProject(projectReference.getProjectId());
                }
            } catch (Exception e) {
                errorLogger.showAndLogError("can't leave project " + projectReference.getName(), e);
            }
            eventBus.post(new ProjectChangedEvent());
        });
    }));
    descriptionBar.addComponent(btnLeave);
    rbacEnforcer.register(RBACConstraint.ifNotAuthorized((role) -> (rbacManager.hasPermission(role, RBACPermission.PROJECT_EDIT)), () -> {
        btnEdit.setVisible(false);
        btnEdit.setEnabled(false);
    }));
    rbacEnforcer.register(RBACConstraint.ifNotAuthorized((role) -> (rbacManager.hasPermission(role, RBACPermission.PROJECT_DELETE)), () -> {
        btnRemove.setVisible(false);
        btnRemove.setEnabled(false);
    }));
    rbacEnforcer.register(RBACConstraint.ifNotAuthorized((role) -> rbacManager.hasPermission(role, RBACPermission.PROJECT_LEAVE) && !rbacManager.hasPermission(role, RBACPermission.PROJECT_DELETE), () -> {
        btnLeave.setVisible(false);
        btnLeave.setEnabled(false);
    }));
    // IconButton buttonAction = new IconButton(VaadinIcons.ELLIPSIS_DOTS_V);
    // descriptionBar.addComponents(buttonAction);
    addComponents(descriptionBar);
}
Also used : FlexLayout(de.catma.ui.layout.FlexLayout) ProjectManager(de.catma.project.ProjectManager) RouteToProjectEvent(de.catma.ui.events.routing.RouteToProjectEvent) UI(com.vaadin.ui.UI) VerticalFlexLayout(de.catma.ui.layout.VerticalFlexLayout) RBACConstraint(de.catma.rbac.RBACConstraint) IOException(java.io.IOException) ConfirmDialog(org.vaadin.dialogs.ConfirmDialog) CssLayout(com.vaadin.ui.CssLayout) RBACRole(de.catma.rbac.RBACRole) ProjectReference(de.catma.project.ProjectReference) Objects(java.util.Objects) EventBus(com.google.common.eventbus.EventBus) HorizontalFlexLayout(de.catma.ui.layout.HorizontalFlexLayout) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Label(com.vaadin.ui.Label) IRBACManager(de.catma.rbac.IRBACManager) RBACConstraintEnforcer(de.catma.rbac.RBACConstraintEnforcer) VaadinIcons(com.vaadin.icons.VaadinIcons) IconButton(de.catma.ui.component.IconButton) RBACPermission(de.catma.rbac.RBACPermission) ProjectChangedEvent(de.catma.ui.events.ProjectChangedEvent) CssLayout(com.vaadin.ui.CssLayout) IconButton(de.catma.ui.component.IconButton) Label(com.vaadin.ui.Label) IOException(java.io.IOException) HorizontalFlexLayout(de.catma.ui.layout.HorizontalFlexLayout) IOException(java.io.IOException) ProjectChangedEvent(de.catma.ui.events.ProjectChangedEvent)

Example 29 with CssLayout

use of com.vaadin.ui.CssLayout in project catma by forTEXT.

the class CreateProjectCard method initComponents.

private void initComponents() {
    addStyleName("projectlist__newproject");
    CssLayout newproject = new CssLayout();
    newproject.addStyleName("projectlist__newproject__link");
    Label labelDesc = new Label("create new project");
    labelDesc.setWidth("100%");
    newproject.addComponents(labelDesc);
    newproject.addLayoutClickListener(evt -> {
        new CreateProjectDialog(projectManager, result -> eventBus.post(new ProjectChangedEvent())).show();
    });
    addComponent(newproject);
    HorizontalFlexLayout descriptionBar = new HorizontalFlexLayout();
    descriptionBar.addStyleName("projectlist__card__descriptionbar");
    descriptionBar.setAlignItems(FlexLayout.AlignItems.BASELINE);
    descriptionBar.setWidth("100%");
    addComponents(descriptionBar);
}
Also used : Objects(java.util.Objects) EventBus(com.google.common.eventbus.EventBus) FlexLayout(de.catma.ui.layout.FlexLayout) ProjectManager(de.catma.project.ProjectManager) HorizontalFlexLayout(de.catma.ui.layout.HorizontalFlexLayout) Label(com.vaadin.ui.Label) VerticalFlexLayout(de.catma.ui.layout.VerticalFlexLayout) CssLayout(com.vaadin.ui.CssLayout) ProjectChangedEvent(de.catma.ui.events.ProjectChangedEvent) CssLayout(com.vaadin.ui.CssLayout) Label(com.vaadin.ui.Label) HorizontalFlexLayout(de.catma.ui.layout.HorizontalFlexLayout) ProjectChangedEvent(de.catma.ui.events.ProjectChangedEvent)

Example 30 with CssLayout

use of com.vaadin.ui.CssLayout in project cuba by cuba-platform.

the class CubaCurrencyField method initLayout.

protected void initLayout() {
    container = new CssLayout();
    container.setSizeFull();
    container.setPrimaryStyleName(CURRENCYFIELD_LAYOUT_STYLENAME);
    container.addComponent(currencyLabel);
    if (useWrapper()) {
        ie9InputWrapper = new CssLayout(textField);
        ie9InputWrapper.setSizeFull();
        ie9InputWrapper.setPrimaryStyleName(IE9_INPUT_WRAP_STYLENAME);
        container.addComponent(ie9InputWrapper);
    } else {
        container.addComponent(textField);
    }
    setFocusDelegate(textField);
}
Also used : CssLayout(com.vaadin.ui.CssLayout)

Aggregations

CssLayout (com.vaadin.ui.CssLayout)57 Label (com.vaadin.ui.Label)18 Button (com.vaadin.ui.Button)12 VerticalLayout (com.vaadin.ui.VerticalLayout)8 Component (com.vaadin.ui.Component)7 ClickEvent (com.vaadin.ui.Button.ClickEvent)6 ClickListener (com.vaadin.ui.Button.ClickListener)6 HorizontalLayout (com.vaadin.ui.HorizontalLayout)5 LayoutClickEvent (com.vaadin.event.LayoutEvents.LayoutClickEvent)3 LayoutClickListener (com.vaadin.event.LayoutEvents.LayoutClickListener)3 Page (com.vaadin.server.Page)3 MarginInfo (com.vaadin.shared.ui.MarginInfo)3 Image (com.vaadin.ui.Image)3 Link (com.vaadin.ui.Link)3 TextField (com.vaadin.ui.TextField)3 HorizontalFlexLayout (de.catma.ui.layout.HorizontalFlexLayout)3 Path (java.nio.file.Path)3 EventBus (com.google.common.eventbus.EventBus)2 TokenList (com.haulmont.cuba.gui.components.TokenList)2 ExternalResource (com.vaadin.server.ExternalResource)2