Example usage for com.vaadin.ui Embedded setSource

List of usage examples for com.vaadin.ui Embedded setSource

Introduction

In this page you can find the example usage for com.vaadin.ui Embedded setSource.

Prototype

public void setSource(Resource source) 

Source Link

Document

Sets the object source resource.

Usage

From source file:org.hip.vif.skin.green.Skin.java

License:Open Source License

@Override
public Component getHeader(final String inAppName) {
    final HorizontalLayout outLayout = new HorizontalLayout();
    outLayout.setWidth("100%");
    outLayout.setHeight(115, Unit.PIXELS);
    outLayout.setStyleName("vif-green-head");

    final Embedded lImage = new Embedded();
    lImage.setSource(new ThemeResource("images/head.jpg"));
    outLayout.addComponent(lImage);/*w ww .ja v  a2  s.  c o  m*/
    outLayout.setComponentAlignment(lImage, Alignment.TOP_LEFT);

    final Label lTitle = new Label("VIF - Virtual Discussion Forum");
    lTitle.setStyleName("vif-head-title");
    lTitle.setWidth(700, Unit.PIXELS);
    outLayout.addComponent(lTitle);

    return outLayout;
}

From source file:org.processbase.ui.servlet.MainWindow.java

License:Open Source License

Layout getHeader() {
    HorizontalLayout header = new HorizontalLayout();
    header.setWidth("100%");
    header.setMargin(false);/* w  w w. jav a2 s.  co  m*/
    header.setSpacing(true);

    ThemeResource themeResource = new ThemeResource("icons/processbase.png");
    Embedded logo = new Embedded();
    logo.setSource(themeResource);
    logo.setType(Embedded.TYPE_IMAGE);

    header.addComponent(logo);
    header.setExpandRatio(logo, 1.0f);

    Label helloUser = new Label("Welcome, " + user.getFirstName() + " " + user.getLastName());
    //        helloUser.setStyleName(Runo.LABEL_H2);
    header.addComponent(helloUser);
    header.setComponentAlignment(helloUser, Alignment.MIDDLE_RIGHT);
    header.setExpandRatio(helloUser, 1.0f);

    Button profile = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnProfile"),
            new Button.ClickListener() {

                public void buttonClick(ClickEvent event) {
                    openProfileWindow();
                }
            });
    profile.setStyleName(Runo.BUTTON_LINK);
    header.addComponent(profile);
    header.setComponentAlignment(profile, Alignment.MIDDLE_RIGHT);

    Button logout = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnLogout"),
            new Button.ClickListener() {

                public void buttonClick(ClickEvent event) {
                    openLogoutWindow();
                }
            });
    logout.setStyleName(Runo.BUTTON_LINK);
    header.addComponent(logout);
    header.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT);

    return header;
}

From source file:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java

License:Mozilla Public License

private void addImageUploadControls(final DetailsData detailsData) {
    final Embedded img = new Embedded("Icon", EditorIcon.VERTEX.getIconImage());
    final FileReceiver receiver = new FileReceiver();
    final Upload upload = new Upload("", receiver);

    upload.addListener(new Upload.FinishedListener() {

        public void uploadFinished(final FinishedEvent event) {
            final String imgContent = receiver.getBase64ContentString();
            final byte[] imgData = SerializerHolder.getS23MInstanceSerializer(SerializationType.XML)
                    .decodeBase64StringToByteArray(imgContent);
            DataOutputStream os = null;
            try {
                final String id = detailsData.getInstance().identity().identifier().toString();
                final String resourcePath = File.createTempFile(id, "").getAbsolutePath();
                os = new DataOutputStream(new FileOutputStream(resourcePath));
                os.write(imgData);/*w w w  . java  2s  . c o m*/
                img.setSource(new FileResource(new File(resourcePath), application));
            } catch (final IOException e) {
                e.printStackTrace();
            } finally {
                try {
                    if (os != null) {
                        os.close();
                    }
                } catch (final IOException e) {
                }
            }
            receiver.clearCache();
        }

    });
    detailsForm.getLayout().addComponent(img);
    detailsForm.getLayout().addComponent(upload);
}

From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java

License:Apache License

/**
 * Sample content for panel/*from ww w  . j a  v  a2 s  .  c o  m*/
 * 
 * @return
 */
private ComponentContainer createPanelContentA() {

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setMargin(true);
    layout.setSpacing(true);

    Label label = new Label(LOREM_STR);
    layout.addComponent(label);

    Embedded image = new Embedded();
    image.setSource(new ExternalResource("http://misc.siika.fi/fancy-demo1.jpg"));
    image.setWidth("500px");
    image.setHeight("281px");
    layout.addComponent(image);

    return layout;

}

From source file:org.vaadin.alump.fancylayouts.demo.PanelDemo.java

License:Apache License

/**
 * Sample content with more stuff//from   ww  w. j a  v  a  2s. co  m
 * 
 * @return
 */
private ComponentContainer createPanelContentB() {

    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setMargin(true);
    layout.setSpacing(true);

    Label label = new Label(BECON_STR);
    layout.addComponent(label);

    Embedded image = new Embedded();
    image.setSource(new ExternalResource("http://misc.siika.fi/kaljanhimo.jpg"));
    image.setWidth("300px");
    image.setHeight("187px");
    layout.addComponent(image);
    layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);

    Label label2 = new Label(BECON_STR);
    layout.addComponent(label2);

    return layout;

}