List of usage examples for com.vaadin.ui DragAndDropWrapper setId
@Override public void setId(String id)
From source file:org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons.java
License:Open Source License
private DragAndDropWrapper createDragAndDropWrapper(final Button tagButton, final String name, final Long id) { final DragAndDropWrapper bsmBtnWrapper = new DragAndDropWrapper(tagButton); bsmBtnWrapper.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_VERTICAL_DRAG_HINTS); bsmBtnWrapper.addStyleName(ValoTheme.DRAG_AND_DROP_WRAPPER_NO_HORIZONTAL_DRAG_HINTS); bsmBtnWrapper.addStyleName(SPUIStyleDefinitions.FILTER_BUTTON_WRAPPER); if (getButtonWrapperData() != null) { if (id == null) { bsmBtnWrapper.setData(getButtonWrapperData()); } else {// w w w.ja va 2 s . c o m bsmBtnWrapper.setData(getButtonWrapperData().concat("" + id)); } } bsmBtnWrapper.setId(getButttonWrapperIdPrefix().concat(name)); bsmBtnWrapper.setDragStartMode(DragStartMode.WRAPPER); bsmBtnWrapper.setDropHandler(getFilterButtonDropHandler()); return bsmBtnWrapper; }
From source file:org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout.java
License:Open Source License
private DragAndDropWrapper createDeleteWrapperLayout() { final Button dropToDelete = new Button(i18n.getMessage("label.components.drop.area")); dropToDelete.setCaptionAsHtml(true); dropToDelete.setIcon(FontAwesome.TRASH_O); dropToDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS); dropToDelete.addStyleName("drop-to-delete-button"); dropToDelete.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON); dropToDelete.addStyleName(SPUIStyleDefinitions.DEL_ACTION_BUTTON); dropToDelete.addStyleName("delete-icon"); final DragAndDropWrapper wrapper = new DragAndDropWrapper(dropToDelete); wrapper.setStyleName(ValoTheme.BUTTON_PRIMARY); wrapper.setId(getDeleteAreaId()); wrapper.setDropHandler(this); wrapper.addStyleName("delete-button-border"); return wrapper; }
From source file:org.eclipse.hawkbit.ui.common.table.AbstractTableHeader.java
License:Open Source License
private void buildLayout() { final HorizontalLayout titleFilterIconsLayout = createHeaderFilterIconLayout(); titleFilterIconsLayout.addComponents(headerCaption, searchField, searchResetIcon, showFilterButtonLayout); titleFilterIconsLayout.setComponentAlignment(headerCaption, Alignment.TOP_LEFT); titleFilterIconsLayout.setComponentAlignment(searchField, Alignment.TOP_RIGHT); titleFilterIconsLayout.setComponentAlignment(searchResetIcon, Alignment.TOP_RIGHT); titleFilterIconsLayout.setComponentAlignment(showFilterButtonLayout, Alignment.TOP_RIGHT); if (hasCreatePermission() && isAddNewItemAllowed()) { titleFilterIconsLayout.addComponent(addIcon); titleFilterIconsLayout.setComponentAlignment(addIcon, Alignment.TOP_RIGHT); }//from ww w . ja va2 s . com if (hasCreatePermission() && isBulkUploadAllowed()) { titleFilterIconsLayout.addComponent(bulkUploadIcon); titleFilterIconsLayout.setComponentAlignment(bulkUploadIcon, Alignment.TOP_RIGHT); } titleFilterIconsLayout.addComponent(maxMinIcon); titleFilterIconsLayout.setComponentAlignment(maxMinIcon, Alignment.TOP_RIGHT); titleFilterIconsLayout.setExpandRatio(headerCaption, 0.4F); titleFilterIconsLayout.setExpandRatio(searchField, 0.6F); addComponent(titleFilterIconsLayout); final HorizontalLayout dropHintDropFilterLayout = new HorizontalLayout(); dropHintDropFilterLayout.addStyleName("filter-drop-hint-layout"); dropHintDropFilterLayout.setWidth(100, Unit.PERCENTAGE); if (isDropFilterRequired()) { filterDroppedInfo = new HorizontalLayout(); filterDroppedInfo.setImmediate(true); filterDroppedInfo.setStyleName("target-dist-filter-info"); filterDroppedInfo.setHeightUndefined(); filterDroppedInfo.setSizeUndefined(); displayFilterDropedInfoOnLoad(); final DragAndDropWrapper dropFilterLayout = new DragAndDropWrapper(filterDroppedInfo); dropFilterLayout.setId(getDropFilterId()); dropFilterLayout.setDropHandler(getDropFilterHandler()); dropHintDropFilterLayout.addComponent(dropFilterLayout); dropHintDropFilterLayout.setComponentAlignment(dropFilterLayout, Alignment.TOP_CENTER); dropHintDropFilterLayout.setExpandRatio(dropFilterLayout, 1.0F); } addComponent(dropHintDropFilterLayout); setComponentAlignment(dropHintDropFilterLayout, Alignment.TOP_CENTER); addStyleName("bordered-layout"); addStyleName("no-border-bottom"); }
From source file:org.lucidj.browser.AbstractCell.java
License:Apache License
private Component build_left_panel() { left_panel = new CssLayout(); left_panel.setWidth(32, Sizeable.Unit.PIXELS); left_panel.addStyleName("cell-panel-left"); left_panel.setHeight(100, Sizeable.Unit.PERCENTAGE); String icon_url = "/VAADIN/~/formulas/impossible.png"; String icon_title = "The Unknown"; ComponentInterface component_interface = Aggregate.adapt(ComponentInterface.class, source_object); if (component_interface != null) { // If it is a valid component, displays its icon on the top left corner of the cell ComponentDescriptor descriptor = (ComponentDescriptor) component_interface .getProperty(ComponentDescriptor.DESCRIPTOR); if (descriptor != null) { icon_url = descriptor.getIconUrl(); icon_title = descriptor.getIconTitle(); }/*from w w w .j a v a 2 s.c o m*/ } String component_icon_html = "<img class='component-icon' src='" + icon_url + "' title='" + SafeHtmlUtils.htmlEscape(icon_title) + "'/>"; component_icon = new Label(component_icon_html, ContentMode.HTML); left_panel.addComponent(component_icon); // Put the component in a D&D wrapper and allow dragging it final DragAndDropWrapper panel_dd_wrap = new DragAndDropWrapper(left_panel); panel_dd_wrap.setDragStartMode(DragAndDropWrapper.DragStartMode.COMPONENT_OTHER); panel_dd_wrap.setDragImageComponent(component_icon); panel_dd_wrap.addStyleName("no-horizontal-drag-hints"); panel_dd_wrap.addStyleName("no-box-drag-hints"); // Set the wrapper to wrap tightly around the component panel_dd_wrap.setHeight(100, Sizeable.Unit.PERCENTAGE); panel_dd_wrap.setWidthUndefined(); panel_dd_wrap.setId("test"); // Setup DD handlers for component insertion panel_dd_wrap.setData(this); panel_dd_wrap.setDropHandler(this); // While left_panel is kept in order to be customized, here we return D&D wrapper return (panel_dd_wrap); }
From source file:org.lucidj.browser.ComponentPalette.java
License:Apache License
private boolean add_component_to_palette(ComponentDescriptor component) { String canonical_name = component.getComponentClass(); String icon_title = component.getIconTitle(); log.info("*** => ADDING component {} ({})", canonical_name, component); int base_width = 6; int margin_h_size_px = base_width / 2; int margin_v_size_px = base_width; int icon_size_px = base_width * 6; int font_size_px = 2 * base_width + 2; int icon_box_width_px = base_width * 12; String icon_html = "<div style='text-align: center; height:auto; display:inline-block; " + "margin:" + margin_v_size_px + "px " + margin_h_size_px + "px;" + "width:" + icon_box_width_px + "px; line-height:1.1em;'>" + "<img src='" + component.getIconUrl() + "' " + "width='" + icon_size_px + "px' height='" + icon_size_px + "px' />" + "<div style='white-space:normal; word-wrap:break-word; font-weight: 400;" + "font-size:" + font_size_px + "px;'>" + icon_title + "</div>" + "</div>"; Label icon_label = new Label(icon_html, ContentMode.HTML); icon_label.setWidthUndefined();/*from ww w . jav a2 s . c o m*/ // Put the component in a D&D wrapper and allow dragging it final DragAndDropWrapper icon_dd_wrap = new DragAndDropWrapper(icon_label); icon_dd_wrap.setDragStartMode(DragAndDropWrapper.DragStartMode.COMPONENT); // Set the wrapper to wrap tightly around the component icon_dd_wrap.setSizeUndefined(); icon_dd_wrap.setData(component); // Set canonical_name for drag-drop AND on the Label for double-click icon_dd_wrap.setId(canonical_name); icon_label.setId(canonical_name); // Remember this association component_to_vaadin.put(component, icon_dd_wrap); // Add the wrapper, not the component, to the layout self.addComponent(icon_dd_wrap); return (true); }
From source file:org.lucidj.iconlist.renderer.IconListRenderer.java
License:Apache License
private AbstractComponent create_icon(Map<String, Object> component) { String icon_title = (String) component.get("iconTitle"); if (icon_title == null) { icon_title = "No title"; }/*from w w w .j a v a 2 s .c o m*/ Resource icon_resource = iconHelper.getIcon((String) component.get("iconUrl"), 32); Button button_icon = new Button(icon_title); button_icon.setIcon(icon_resource); button_icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); button_icon.addStyleName(ValoTheme.BUTTON_SMALL); button_icon.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); button_icon.addStyleName("x-icon-button"); button_icon.addStyleName("icon-size-32"); button_icon.addClickListener(this); button_icon.setWidthUndefined(); button_caption_wrap(button_icon); // Put the component in a D&D wrapper and allow dragging it final DragAndDropWrapper icon_dd_wrap = new DragAndDropWrapper(button_icon); icon_dd_wrap.setDragStartMode(DragAndDropWrapper.DragStartMode.COMPONENT); // Set the wrapper to wrap tightly around the component icon_dd_wrap.setSizeUndefined(); icon_dd_wrap.setData(component); // Set ID for drag-drop AND on the Label for double-click if (component.containsKey("entryId")) { String entryId = (String) component.get("entryId"); icon_dd_wrap.setId(entryId); button_icon.setId(entryId); } // Component data is the map itself button_icon.setData(component); // Remember this association component_to_vaadin.put(component, icon_dd_wrap); return (icon_dd_wrap); }