Example usage for com.vaadin.ui Embedded Embedded

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

Introduction

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

Prototype

public Embedded(String caption, Resource source) 

Source Link

Document

Creates a new Embedded object whose contents is loaded from given resource.

Usage

From source file:com.foc.vaadin.gui.layouts.FVTableWrapperLayout.java

License:Apache License

private Embedded valo_GetAddEmbedded(boolean isEditable) {
    if (valo_AddEmbedded == null && getTableTreeDelegate().isAddEnabled(isEditable) && !isPrintingUI()) {
        valo_AddEmbedded = new Embedded("",
                FVIconFactory.getInstance().getFVIcon_Small(FVIconFactory.ICON_ADD));
        valo_AddEmbedded.setStyleName(BaseTheme.BUTTON_LINK);
        valo_AddEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_NO_PRINT);
        valo_AddEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_AddEmbedded.setDescription("Add");
        FocXMLGuiComponentStatic.setCaptionMargin_Zero(valo_AddEmbedded);

        valo_AddEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override//from w w w . j  ava  2 s .  co m
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                addItemClickListenerContent();
            }
        });
    }
    return valo_AddEmbedded;
}

From source file:com.foc.vaadin.gui.layouts.FVTableWrapperLayout.java

License:Apache License

private Embedded valo_GetDeleteEmbedded(boolean isEditable) {
    if (valo_DeleteEmbedded == null && getTableTreeDelegate().isDeleteEnabled(isEditable)) {
        valo_DeleteEmbedded = new Embedded("",
                FVIconFactory.getInstance().getFVIcon_Small(FVIconFactory.ICON_DELETE));
        valo_DeleteEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_NO_PRINT);
        valo_DeleteEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_DeleteEmbedded.setDescription("Delete");
        FocXMLGuiComponentStatic.setCaptionMargin_Zero(valo_DeleteEmbedded);

        valo_DeleteEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override/*  w ww . jav a  2  s. c om*/
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                deleteItemClickListenerContent();
            }
        });
    }
    return valo_DeleteEmbedded;
}

From source file:com.foc.vaadin.gui.layouts.FVTableWrapperLayout.java

License:Apache License

private Embedded valo_GetStatusStyleEmbedded() {
    if (getTableTreeDelegate() != null) {
        getTableTreeDelegate().setStatusStyleEnabled(getTableTreeDelegate().isTransactionColorEnabled());
    }/*from  w w w.j  a  v  a2s .co m*/
    if (valo_StatusStyleEmbedded == null && getTableTreeDelegate() != null
            && getTableTreeDelegate().getFocDesc() != null
            && getTableTreeDelegate().getFocDesc().statusHodler_IsStatusHolder()
            && getTableTreeDelegate().isTransactionColorEnabled()) {
        deleteButton = new FVButton("");
        valo_StatusStyleEmbedded = new Embedded("",
                FVIconFactory.getInstance().getFVIcon_Small(FVIconFactory.ICON_PALETTE));
        valo_StatusStyleEmbedded.setCaption(null);
        valo_StatusStyleEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_NO_PRINT);
        valo_StatusStyleEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_StatusStyleEmbedded.setDescription("Toggle Status Color");
        valo_StatusStyleEmbedded.addClickListener(new MouseEvents.ClickListener() {
            @Override
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                statusStyleClickListener();
            }
        });
    }
    return valo_StatusStyleEmbedded;
}

From source file:com.foc.vaadin.gui.layouts.FVTableWrapperLayout.java

License:Apache License

private Embedded valo_GetTransactionFilterEmbedded() {
    if (valo_TransactionFilterEmbedded == null && hasTransactionFilter()) {
        valo_TransactionFilterEmbedded = new Embedded("",
                FVIconFactory.getInstance().getFVIcon_Small(FVIconFactory.ICON_FILTER));
        valo_TransactionFilterEmbedded.setStyleName(BaseTheme.BUTTON_LINK);
        valo_TransactionFilterEmbedded.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
        valo_TransactionFilterEmbedded.setDescription("Transaction filter");

        valo_TransactionFilterEmbedded.addClickListener(new MouseEvents.ClickListener() {

            @Override//from  ww  w. j  a  v  a  2 s.  c  o  m
            public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
                transactionFilterClickListener();
            }
        });
        createTransactionFilter();
    }
    return valo_TransactionFilterEmbedded;
}

From source file:com.hivesys.dashboard.view.repository.DragAndDropBox.java

private void showFile(final String name, final String type, final ByteArrayOutputStream bas) {
    // resource for serving the file contents
    final StreamResource.StreamSource streamSource = () -> {
        if (bas != null) {
            final byte[] byteArray = bas.toByteArray();
            return new ByteArrayInputStream(byteArray);
        }//w w w  .ja v  a 2s .  c o m
        return null;
    };
    final StreamResource resource = new StreamResource(streamSource, name);

    // show the file contents - images only for now
    final Embedded embedded = new Embedded(name, resource);
    showComponent(embedded, name);
}

From source file:com.jain.addon.web.table.JainColumnGenerator.java

License:Apache License

private Component createImage(final Property<?> itemProperty, final Table source) {
    if (itemProperty.getValue() != null) {
        JStreamSource streamSource = new JStreamSource((byte[]) itemProperty.getValue());
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String filename = "myfilename-" + df.format(new Date()) + ".png";
        StreamResource resource = new StreamResource(streamSource, filename);
        Embedded embedded = new Embedded("", resource);
        embedded.setHeight("20px");
        return embedded;
    }// w w  w  .  j  a  v a 2 s. com
    return null;
}

From source file:com.jain.common.header.Header.java

License:Apache License

private void addLogo() {
    Embedded em = new Embedded("", new ThemeResource(IMAGES_LOGO_PNG));
    addComponent(em);//w w  w .j  a  v a2 s.  c  o  m
    setComponentAlignment(em, Alignment.MIDDLE_RIGHT);
    setExpandRatio(em, 1);
}

From source file:com.jorambarrez.PropertyPanel.java

License:Apache License

protected void initTrashIcon() {
    Embedded trashIcon = new Embedded(null, Images.MODELER_TRASH);
    trashIcon.setWidth(63, UNITS_PIXELS);
    trashIcon.setHeight(61, UNITS_PIXELS);
    trashIcon.setType(Embedded.TYPE_IMAGE);

    VerticalLayout trashLayout = new VerticalLayout();
    trashLayout.setWidth(120, UNITS_PIXELS);
    trashLayout.setHeight(120, UNITS_PIXELS);
    trashLayout.addComponent(trashIcon);
    trashLayout.setComponentAlignment(trashIcon, Alignment.MIDDLE_CENTER);

    DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(trashLayout);
    dragAndDropWrapper.setDragStartMode(DragStartMode.NONE);
    dragAndDropWrapper.setSizeUndefined();
    addComponent(dragAndDropWrapper);/*www. jav  a2  s  . com*/
    setComponentAlignment(dragAndDropWrapper, Alignment.BOTTOM_CENTER);

    dragAndDropWrapper.setDropHandler(new DropHandler() {
        private static final long serialVersionUID = 1L;

        public AcceptCriterion getAcceptCriterion() {
            return AcceptAll.get();
        }

        public void drop(DragAndDropEvent event) {
            WrapperTransferable wrapperTransferable = (WrapperTransferable) event.getTransferable();
            Node srcNode = (Node) wrapperTransferable.getSourceComponent();

            // TODO: use eventrouter!
            ModelerApp.get().getFlowEditor().removeNode(srcNode);
        }
    });
}

From source file:com.klwork.explorer.ui.business.flow.act.MyTaskRelatedContentComponent.java

License:Apache License

@SuppressWarnings("unchecked")
protected void addAttachmentsToTable(List<Attachment> attachments) {
    for (Attachment attachment : attachments) {
        AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment);
        Item attachmentItem = table.addItem(attachment.getId());
        attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, this));
        attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment)));
        //?/* w w w  .j av a2 s . c  o  m*/
        if (!readOnly) {
            Embedded deleteButton = new Embedded(null, Images.DELETE);
            deleteButton.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
            //
            deleteButton.addClickListener((ClickListener) new DeleteClickedListener(attachment));
            //delete
            attachmentItem.getItemProperty("delete").setValue(deleteButton);
        }
    }

    if (table.getItemIds().size() > 0) {
        table.setVisible(true);
    }
    table.setPageLength(table.size());
}

From source file:com.klwork.explorer.ui.business.outproject.AbstractFlowManagerPage.java

License:Apache License

@Override
public HorizontalLayout createSelectHead() {
    HorizontalLayout tableHeadLayout = new HorizontalLayout();
    // tableHeadLayout.setSizeFull();
    tableHeadLayout.setSpacing(true);/*from www . j  a va2 s . com*/
    tableHeadLayout.setMargin(true);
    Resource pictureResource = Images.TASK_LIST;
    Embedded picture = new Embedded(null, pictureResource);
    picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE);
    picture.setType(Embedded.TYPE_IMAGE);
    tableHeadLayout.addComponent(picture);
    tableHeadLayout.setComponentAlignment(picture, Alignment.MIDDLE_LEFT);

    Label nameLabel = createTitleLabel();
    nameLabel.addStyleName("taskListLabel");
    // nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
    tableHeadLayout.addComponent(nameLabel);
    tableHeadLayout.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT);
    return tableHeadLayout;
}