Example usage for com.vaadin.ui VerticalLayout setSpacing

List of usage examples for com.vaadin.ui VerticalLayout setSpacing

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setSpacing.

Prototype

@Override
    public void setSpacing(boolean spacing) 

Source Link

Usage

From source file:com.jiangyifen.ec2.ui.mgr.usermanage.EditUser.java

/**
 * User//from  w  w w  .  j a v  a 2  s. co m
 * @param project
 */
public EditUser(UserManagement userManagement) {
    this.center();
    this.setModal(true);
    this.userManagement = userManagement;

    domain = SpringContextHolder.getDomain();
    loginUser = SpringContextHolder.getLoginUser();

    //Service?
    userService = SpringContextHolder.getBean("userService");
    departmentService = SpringContextHolder.getBean("departmentService");
    roleService = SpringContextHolder.getBean("roleService");
    queueService = SpringContextHolder.getBean("queueService");
    queueMemberRelationService = SpringContextHolder.getBean("queueMemberRelationService");
    phone2PhoneSettingService = SpringContextHolder.getBean("phone2PhoneSettingService");
    userQueueService = SpringContextHolder.getBean("userQueueService");

    //WindowLayout
    VerticalLayout windowContent = new VerticalLayout();
    windowContent.setSizeUndefined();
    windowContent.setMargin(false, true, true, true);
    windowContent.setSpacing(true);
    windowContent.setStyleName(StyleConfig.VERTICAL_STYLE);
    this.setContent(windowContent);

    //From
    form = new Form();
    form.setValidationVisibleOnCommit(true);
    form.setValidationVisible(false);
    form.addStyleName("chb");
    //Form?????
    allRoles = roleService.getAll(domain);
    form.setFormFieldFactory(new MyFieldFactory());
    form.setFooter(buildButtonsLayout());
    windowContent.addComponent(form);
}

From source file:com.klwork.explorer.project.MyCalendarView.java

License:Apache License

private void createCalendarEventPopup() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//  ww w. j av  a2  s  . co  m
    layout.setSpacing(true);

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    layout.addComponent(scheduleEventFieldLayout);

    applyEventButton = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                commitCalendarEvent();
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button cancel = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addCloseListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(Window.CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(applyEventButton);
    buttons.addComponent(cancel);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}

From source file:com.klwork.explorer.ui.base.AbstractSecondMainPage.java

License:Apache License

protected void addSelectComponent() {
    VerticalLayout secondMenuLayout = new VerticalLayout();
    secondMenuLayout.addStyleName("sidebar");
    secondMenuLayout.addStyleName("menu");
    //secondMenuLayout.setMargin(new MarginInfo(true,false,false,false));
    secondMenuLayout.setSpacing(true);
    secondMenuLayout.setSizeFull();/*  ww w .j  av a  2s. c  o m*/

    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    tableHeadLayout.setStyleName("tableHead");
    tableHeadLayout.setHeight("20px");
    Label nameLabel = new Label("hello,word");
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.BOTTOM_CENTER);

    secondMenuLayout.addComponent(tableHeadLayout);
    //secondMenuLayout.setExpandRatio(tableHeadLayout, 0.1f);
    //table
    AbstractSelect select = createSelectComponent();
    secondMenuLayout.addComponent(select);
    secondMenuLayout.setExpandRatio(select, 1.0f);
    if (select != null) {
        grid.addComponent(secondMenuLayout, 0, 0);
    }
}

From source file:com.klwork.explorer.ui.business.project.MyCalendarView.java

License:Apache License

private void createCalendarEventPopup() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from  w w w . j  a v a2  s  . c o  m*/
    layout.setSpacing(true);
    layout.addStyleName("social");

    scheduleEventPopup = new Window(null, layout);
    scheduleEventPopup.setWidth("400px");
    scheduleEventPopup.setModal(true);
    scheduleEventPopup.center();

    layout.addComponent(scheduleEventFieldLayout);

    applyEventButton = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                commitCalendarEvent();
            } catch (CommitException e) {
                e.printStackTrace();
            }
        }
    });
    Button cancel = new Button("?", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            discardCalendarEvent();
        }
    });
    deleteEventButton = new Button("", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            deleteCalendarEvent();
        }
    });
    scheduleEventPopup.addCloseListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void windowClose(Window.CloseEvent e) {
            discardCalendarEvent();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.addComponent(deleteEventButton);
    buttons.addComponent(applyEventButton);
    buttons.addComponent(cancel);
    layout.addComponent(buttons);
    layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
}

From source file:com.klwork.explorer.ui.content.file.ImageAttachmentRenderer.java

License:Apache License

@Override
public Component getDetailComponent(Attachment attachment) {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeUndefined();/*ww  w .j a  v a2  s.  c  o  m*/
    verticalLayout.setSpacing(true);
    verticalLayout.setMargin(true);

    Label description = new Label(attachment.getDescription());
    description.setSizeUndefined();
    verticalLayout.addComponent(description);

    // Image
    TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();

    String mimeType = extractMineType(attachment.getType());

    InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()),
            mimeType, 900, 550);
    Resource resource = new StreamResource(new InputStreamStreamSource(imageStream),
            attachment.getName() + extractExtention(attachment.getType()));
    Embedded image = new Embedded(null, resource);
    verticalLayout.addComponent(image);

    // Linke
    HorizontalLayout LinkLayout = new HorizontalLayout();
    LinkLayout.setSpacing(true);
    verticalLayout.addComponent(LinkLayout);
    verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER);

    Label fullSizeLabel = new Label(
            ViewToolManager.getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE));
    LinkLayout.addComponent(fullSizeLabel);

    Link link = null;
    if (attachment.getUrl() != null) {
        link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
    } else {
        taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
        Resource res = new StreamResource(
                new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())),
                attachment.getName() + extractExtention(attachment.getType()));

        link = new Link(attachment.getName(), res);
    }

    link.setIcon(Images.RELATED_CONTENT_PICTURE);
    link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
    LinkLayout.addComponent(link);

    return verticalLayout;
}

From source file:com.klwork.explorer.ui.content.GenericAttachmentRenderer.java

License:Apache License

public Component getDetailComponent(Attachment attachment) {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeUndefined();//from w  ww  .  jav a2s.c  om
    verticalLayout.setSpacing(true);
    verticalLayout.setMargin(true);

    Label description = new Label(attachment.getDescription());
    description.setSizeUndefined();
    verticalLayout.addComponent(description);

    HorizontalLayout linkLayout = new HorizontalLayout();
    linkLayout.setSpacing(true);
    verticalLayout.addComponent(linkLayout);

    // Image
    linkLayout.addComponent(new Embedded(null, getImage(attachment)));

    // Link
    Link link = null;
    if (attachment.getUrl() != null) {
        link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
    } else {
        TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
        Resource res = new StreamResource(
                new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())),
                attachment.getName() + extractExtention(attachment.getType()));

        link = new Link(attachment.getName(), res);
    }

    // Set generic image and external window 
    link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
    linkLayout.addComponent(link);

    return verticalLayout;
}

From source file:com.klwork.explorer.ui.content.url.UrlAttachmentRenderer.java

License:Apache License

public Component getDetailComponent(Attachment attachment) {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSpacing(true);
    verticalLayout.setMargin(true);//from  ww w.  j a  v  a  2  s. c  o m

    verticalLayout.addComponent(new Label(attachment.getDescription()));

    HorizontalLayout linkLayout = new HorizontalLayout();
    linkLayout.setSpacing(true);
    verticalLayout.addComponent(linkLayout);

    // Icon
    linkLayout.addComponent(new Embedded(null, Images.RELATED_CONTENT_URL));

    // Link
    Link link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
    link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
    linkLayout.addComponent(link);

    return verticalLayout;
}

From source file:com.klwork.explorer.ui.main.views.AuthenticatedView.java

License:Apache License

@PostConstruct
public void PostConstruct() {
    setSizeFull();//from   w w  w .  j a  v a2 s  .  c  om
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);

    layout.addComponent(new Label("@RequiresAuthentication"));
    layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME)));

    setContent(layout);
}

From source file:com.klwork.explorer.ui.main.views.GuestView.java

License:Apache License

@PostConstruct
public void PostConstruct() {
    setSizeFull();//from   www . j a v a  2 s. c  o m
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);

    layout.addComponent(new Label("@RequiresGuest"));
    layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME)));

    setContent(layout);
}

From source file:com.klwork.explorer.ui.main.views.RoleAdminView.java

License:Apache License

@PostConstruct
public void PostConstruct() {
    setSizeFull();/* w w  w  .j  a  va2 s.  c o m*/
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);

    layout.addComponent(new Label("@RequiresRoles(\"admin\")"));
    layout.addComponent(new Link("Go back", new ExternalResource("#!" + MainView.NAME)));

    setContent(layout);
}