Example usage for com.vaadin.ui Label setSizeUndefined

List of usage examples for com.vaadin.ui Label setSizeUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui Label setSizeUndefined.

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:net.sf.gazpachoquest.questionnaires.views.QuestionnaireView.java

License:Open Source License

private HorizontalLayout createHeader() {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth("100%");
    layout.setMargin(true);//from  www  . j  a  v  a  2s  .c  o m
    layout.setSpacing(true);
    final Label title = new Label("Activiti + Vaadin - A Match Made in Heaven");
    title.addStyleName(Reindeer.LABEL_H1);
    layout.addComponent(title);
    layout.setExpandRatio(title, 1.0f);

    Label currentUser = new Label();
    currentUser.setSizeUndefined();
    layout.addComponent(currentUser);
    layout.setComponentAlignment(currentUser, Alignment.MIDDLE_RIGHT);

    Button logout = new Button("Logout");
    logout.addStyleName(Reindeer.BUTTON_SMALL);
    // logout.addListener(createLogoutButtonListener());
    layout.addComponent(logout);
    layout.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT);

    return layout;
}

From source file:org.accelerators.activiti.admin.ui.MainView.java

License:Open Source License

public MainView(AdminApp application) {

    // Set application
    this.app = application;

    // Setup main layout
    setStyleName(Reindeer.LAYOUT_WHITE);
    setMargin(false);/*  www . j  a v a  2 s  .c  o  m*/
    setSpacing(false);
    setSizeFull();

    // Add header
    GridLayout header = new GridLayout(2, 1);
    header.setWidth("100%");
    header.setHeight("34px");
    addComponent(header);

    // Add header styles
    header.addStyleName(Consts.HEADER);
    header.addStyleName("header");
    header.setSpacing(true);

    // Add title to header
    GridLayout logoGrid = new GridLayout(1, 1);
    header.addComponent(logoGrid, 0, 0);
    header.setComponentAlignment(logoGrid, Alignment.MIDDLE_LEFT);

    Embedded logoImage = new Embedded(null, new ThemeResource("img/header-logo.png"));
    logoImage.setType(Embedded.TYPE_IMAGE);
    logoImage.addStyleName("header-image");
    logoGrid.addComponent(logoImage, 0, 0);
    logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER);

    // Add logout button to header
    GridLayout logoutGrid = new GridLayout(2, 1);
    Label userLabel = new Label("Signed in as: " + app.getUser().toString());
    userLabel.addStyleName("user");
    logout.setStyleName(Reindeer.BUTTON_LINK);
    logout.addStyleName("logout");
    logoutGrid.addComponent(userLabel, 0, 0);
    logoutGrid.addComponent(logout, 1, 0);
    header.addComponent(logoutGrid, 1, 0);
    header.setComponentAlignment(logoutGrid, Alignment.TOP_RIGHT);

    // Create tab sheet
    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();

    // Add tab styles
    tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabs.addStyleName(Reindeer.LAYOUT_WHITE);

    // Add task view tab
    tabs.addTab(new UserTab(app));
    tabs.addTab(new GroupTab(app));

    // Add tab sheet to layout
    addComponent(tabs);
    setExpandRatio(tabs, 1.0F);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    addComponent(footerText);
    setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

}

From source file:org.activiti.administrator.ui.LoginView.java

License:Apache License

@SuppressWarnings("serial")
public LoginView(AdminApp application) {

    // Set application reference
    this.app = application;

    // Init window caption
    app.getMainWindow().setCaption(app.getMessage(Messages.Title));

    // Set style/*from www .  j  av  a 2  s . c  o m*/
    setStyleName(Reindeer.LAYOUT_WHITE);

    // Set layout to full size
    setSizeFull();

    // Create main layout
    VerticalLayout mainLayout = new VerticalLayout();

    // Add layout styles
    mainLayout.setStyleName(Reindeer.LAYOUT_WHITE);
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");
    mainLayout.setMargin(false);
    mainLayout.setSpacing(false);

    // Add layout
    addComponent(mainLayout);
    setComponentAlignment(mainLayout, Alignment.TOP_LEFT);

    // Add field and button layout
    VerticalLayout buttonLayout = new VerticalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setMargin(true);
    buttonLayout.setWidth("200px");
    buttonLayout.setStyleName("login-form");

    // Add username field
    username = new TextField(app.getMessage(Messages.Username));
    username.setWidth("100%");
    buttonLayout.addComponent(username);

    // Add password field
    password = new PasswordField(app.getMessage(Messages.Password));
    password.setWidth("100%");
    buttonLayout.addComponent(password);

    // Add Login button
    buttonLayout.addComponent(login);
    buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_LEFT);

    // Add button layout
    mainLayout.addComponent(buttonLayout);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    footerText.addStyleName("footer");
    mainLayout.addComponent(footerText);
    mainLayout.setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

    // Set focus to this component
    username.focus();

    // Add shortcut to login button
    login.setClickShortcut(KeyCode.ENTER);

    login.addListener(new Button.ClickListener() {

        public void buttonClick(Button.ClickEvent event) {
            try {

                // Athenticate the user
                authenticate((String) username.getValue(), (String) password.getValue());

                // Switch to the main view
                app.switchView(MainView.class.getName(), new MainView(app));

            } catch (Exception e) {
                getWindow().showNotification(e.toString());
            }
        }
    });

}

From source file:org.activiti.administrator.ui.MainView.java

License:Apache License

public MainView(AdminApp application) {

    // Set application
    this.app = application;

    // Setup main layout
    setStyleName(Reindeer.LAYOUT_WHITE);
    setMargin(false);/*from  www . ja va2 s  .c  o  m*/
    setSpacing(false);
    setSizeFull();

    // Create tab sheet
    TabSheet tabs = new TabSheet();
    tabs.setSizeFull();

    // Add tab styles
    tabs.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    tabs.addStyleName(Reindeer.LAYOUT_WHITE);

    // Add task view tab
    tabs.addTab(new UserTab(app));
    tabs.addTab(new GroupTab(app));

    // Add tab sheet to layout
    addComponent(tabs);
    setExpandRatio(tabs, 1.0F);

    // Add footer text
    Label footerText = new Label(app.getMessage(Messages.Footer));
    footerText.setSizeUndefined();
    footerText.setStyleName(Reindeer.LABEL_SMALL);
    footerText.addStyleName("footer");
    addComponent(footerText);
    setComponentAlignment(footerText, Alignment.BOTTOM_CENTER);

}

From source file:org.activiti.explorer.ui.content.file.ImageAttachmentRenderer.java

License:Apache License

@Override
public Component getDetailComponent(Attachment attachment) {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeUndefined();/*  w  w w. j a  v a  2 s . co  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()), ExplorerApp.get());
    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(
            ExplorerApp.get().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()), ExplorerApp.get());

        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:org.activiti.explorer.ui.content.GenericAttachmentRenderer.java

License:Apache License

public Component getDetailComponent(Attachment attachment) {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeUndefined();//from   w  w w .  ja v  a  2 s  .  c  o  m
    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()), ExplorerApp.get());

        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:org.activiti.explorer.ui.custom.UploadComponent.java

License:Apache License

protected void addDropPanel() {
    Panel dropPanel = new Panel();
    DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPanel);
    dragAndDropWrapper.setDropHandler(this);
    dragAndDropWrapper.setWidth("80%");
    addComponent(dragAndDropWrapper);/*from w w  w  .  ja va 2 s .c o  m*/
    setComponentAlignment(dragAndDropWrapper, Alignment.MIDDLE_CENTER);

    Label dropLabel = new Label(i18nManager.getMessage(Messages.UPLOAD_DROP));
    dropLabel.setSizeUndefined();
    dropPanel.addComponent(dropLabel);
    ((VerticalLayout) dropPanel.getContent()).setComponentAlignment(dropLabel, Alignment.MIDDLE_CENTER);
}

From source file:org.activiti.explorer.ui.management.admin.AdminCompletedInstancesPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);/*from   w ww.j a v a 2  s  .c o m*/
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded groupImage = new Embedded(null, Images.PROCESS_50);
    layout.addComponent(groupImage);

    Label groupName = new Label(i18nManager.getMessage(Messages.ADMIN_COMPLETED_TITLE));
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);
}

From source file:org.activiti.explorer.ui.management.admin.AdminDatabaseSettingsPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);/*  w  w  w . jav a2s  . co  m*/
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
    layout.addComponent(databaseImage);

    Label groupName = new Label(i18nManager.getMessage(Messages.DATABASE_TITLE));
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);
}

From source file:org.activiti.explorer.ui.management.admin.AdminRunningInstancesPanel.java

License:Apache License

protected void initPageTitle() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setWidth(100, UNITS_PERCENTAGE);
    layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    layout.setSpacing(true);/*from w  w w . ja  v a 2  s.  co  m*/
    layout.setMargin(false, false, true, false);
    addDetailComponent(layout);

    Embedded groupImage = new Embedded(null, Images.PROCESS_50);
    layout.addComponent(groupImage);

    Label groupName = new Label(i18nManager.getMessage(Messages.ADMIN_RUNNING_TITLE));
    groupName.setSizeUndefined();
    groupName.addStyleName(Reindeer.LABEL_H2);
    layout.addComponent(groupName);
    layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(groupName, 1.0f);
}