本文整理汇总了Java中com.vaadin.ui.DragAndDropWrapper类的典型用法代码示例。如果您正苦于以下问题:Java DragAndDropWrapper类的具体用法?Java DragAndDropWrapper怎么用?Java DragAndDropWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DragAndDropWrapper类属于com.vaadin.ui包,在下文中一共展示了DragAndDropWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDragAndDropWrapper
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
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 {
bsmBtnWrapper.setData(getButtonWrapperData().concat("" + id));
}
}
bsmBtnWrapper.setId(getButttonWrapperIdPrefix().concat(name));
bsmBtnWrapper.setDragStartMode(DragStartMode.WRAPPER);
bsmBtnWrapper.setDropHandler(getFilterButtonDropHandler());
return bsmBtnWrapper;
}
示例2: buildPalette
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private Component buildPalette() {
HorizontalLayout paletteLayout = new HorizontalLayout();
paletteLayout.setSpacing(true);
paletteLayout.setWidthUndefined();
paletteLayout.addStyleName("palette");
paletteLayout.addComponent(buildPaletteItem(PaletteItemType.TEXT));
paletteLayout.addComponent(buildPaletteItem(PaletteItemType.TABLE));
paletteLayout.addComponent(buildPaletteItem(PaletteItemType.CHART));
paletteLayout.addLayoutClickListener(new LayoutClickListener() {
@Override
public void layoutClick(final LayoutClickEvent event) {
if (event.getChildComponent() != null) {
PaletteItemType data = (PaletteItemType) ((DragAndDropWrapper) event
.getChildComponent()).getData();
addWidget(data, null);
}
}
});
return paletteLayout;
}
示例3: prepareModeler
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private void prepareModeler() {
processModelLayout.setProcessEditor(this);
final DragAndDropWrapper pane = new DragAndDropWrapper(processModelLayout);
pane.setDragStartMode(DragAndDropWrapper.DragStartMode.NONE);
pane.setDropHandler(processModelLayout.dropHandler);
processModelLayout.setProcessModel(processModel);
processModelLayout.initUI();
cssLayout.addComponent(pane);
cssLayout.addStyleName("process-editor");
cssLayout.setSizeFull();
editorBackground.setSizeFull();
editorBackground.setMargin(false);
editorBackground.setSpacing(false);
editorBackground.addComponent(cssLayout);
mainPanel.setContent(editorBackground);
}
示例4: validateDragAndDropWrapper
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
@Override
protected boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource) {
final String tagName = HawkbitCommonUtil.removePrefix(wrapperSource.getId(),
SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
if (wrapperSource.getId().startsWith(SPUIDefinitions.TARGET_TAG_ID_PREFIXS)) {
if ("NO TAG".equals(tagName)) {
notification.displayValidationError(i18n.getMessage(ACTION_NOT_ALLOWED_MSG));
return false;
}
} else {
notification.displayValidationError(i18n.getMessage(ACTION_NOT_ALLOWED_MSG));
return false;
}
return true;
}
示例5: deleteDistributionTag
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private void deleteDistributionTag(final Component source) {
final String tagName = HawkbitCommonUtil.removePrefix(source.getId(),
SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);
if (managementUIState.getDistributionTableFilters().getDistSetTags().contains(tagName)) {
notification.displayValidationError(i18n.getMessage("message.tag.delete", new Object[] { tagName }));
} else {
distributionSetTagManagement.delete(tagName);
if (source instanceof DragAndDropWrapper) {
final Long id = DeleteActionsLayoutHelper.getDistributionTagId((DragAndDropWrapper) source);
eventBus.publish(this,
new DistributionSetTagTableEvent(BaseEntityEventType.REMOVE_ENTITY, Arrays.asList(id)));
}
notification.displaySuccess(i18n.getMessage("message.delete.success", new Object[] { tagName }));
}
}
示例6: addGeneratedCell
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private DragAndDropWrapper addGeneratedCell(final Object itemId) {
final Item item = getItem(itemId);
final Long id = (Long) item.getItemProperty(SPUILabelDefinitions.VAR_ID).getValue();
final String name = (String) item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
final String desc = HawkbitCommonUtil
.trimAndNullIfEmpty((String) item.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue()) != null
? item.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue().toString() : null;
final String color = HawkbitCommonUtil
.trimAndNullIfEmpty((String) item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue()) != null
? item.getItemProperty(SPUILabelDefinitions.VAR_COLOR).getValue().toString() : DEFAULT_GREEN;
final Button typeButton = createFilterButton(id, name, desc, color, itemId);
typeButton.addClickListener(event -> filterButtonClickBehaviour.processFilterButtonClick(event));
if ((NO_TAG_BUTTON_ID.equals(typeButton.getData()) && isNoTagStateSelected())
|| (id != null && isClickedByDefault(name))) {
filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
}
return createDragAndDropWrapper(typeButton, name, id);
}
示例7: getTableDropHandler
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private DropHandler getTableDropHandler() {
return new DropHandler() {
private static final long serialVersionUID = 1L;
@Override
public AcceptCriterion getAcceptCriterion() {
return getDropAcceptCriterion();
}
@Override
public void drop(final DragAndDropEvent event) {
if (!isDropValid(event)) {
return;
}
if (event.getTransferable().getSourceComponent() instanceof Table) {
onDropEventFromTable(event);
} else if (event.getTransferable().getSourceComponent() instanceof DragAndDropWrapper) {
onDropEventFromWrapper(event);
}
}
};
}
示例8: isDropValid
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
protected boolean isDropValid(final DragAndDropEvent dragEvent) {
final Transferable transferable = dragEvent.getTransferable();
final Component compsource = transferable.getSourceComponent();
if (!hasDropPermission()) {
notification.displayValidationError(i18n.getMessage("message.permission.insufficient"));
return false;
}
if (compsource instanceof Table) {
return validateTable((Table) compsource)
&& validateDropList(getDraggedTargetList((TableTransferable) transferable, (Table) compsource));
}
if (compsource instanceof DragAndDropWrapper) {
return validateDragAndDropWrapper((DragAndDropWrapper) compsource)
&& validateDropList(getDraggedTargetList(dragEvent));
}
notification.displayValidationError(i18n.getMessage(ACTION_NOT_ALLOWED_MSG));
return false;
}
示例9: createDeleteWrapperLayout
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
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;
}
示例10: addItemToFlowPanelSection
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
protected void addItemToFlowPanelSection(String labelName, String componentType, VerticalLayout componentLayout, StreamResource icon,
String componentId) {
FlowPaletteItem paletteItem = new FlowPaletteItem(labelName);
if (componentId != null) {
paletteItem.setShared(true);
paletteItem.setComponentId(componentId);
} else {
paletteItem.setComponentType(componentType);
paletteItem.setShared(false);
}
paletteItem.setIcon(icon);
paletteItem.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
paletteItem.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
paletteItem.addStyleName("leftAligned");
paletteItem.setWidth(100, Unit.PERCENTAGE);
DragAndDropWrapper wrapper = new DragAndDropWrapper(paletteItem);
wrapper.setSizeUndefined();
wrapper.setDragStartMode(DragStartMode.WRAPPER);
componentLayout.addComponent(wrapper);
componentLayout.setComponentAlignment(wrapper, Alignment.TOP_CENTER);
}
示例11: buildPaletteItem
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private Component buildPaletteItem(final PaletteItemType type) {
Label caption = new Label(type.getIcon().getHtml() + type.getTitle(),
ContentMode.HTML);
caption.setSizeUndefined();
DragAndDropWrapper ddWrap = new DragAndDropWrapper(caption);
ddWrap.setSizeUndefined();
ddWrap.setDragStartMode(DragStartMode.WRAPPER);
ddWrap.setData(type);
return ddWrap;
}
示例12: ElementModelLayout
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
public ElementModelLayout(TaskModel taskModel, ProcessModelLayout processModelLayout) {
super(null);
setCompositionRoot(button);
setSizeUndefined();
setDragStartMode(DragAndDropWrapper.DragStartMode.WRAPPER);
this.taskModel = taskModel;
this.processModelLayout = processModelLayout;
button.setCaption(taskModel.getTitle());
button.setWidth(taskModel.getWidth(), Unit.PIXELS);
button.setHeight(taskModel.getHeight(), Unit.PIXELS);
button.addStyleName("process-element");
setStyleSelected(false);
}
示例13: buildLayout
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private void buildLayout() {
final Upload upload = new Upload();
final UploadHandler uploadHandler = new UploadHandler(null, 0, this, multipartConfigElement.getMaxFileSize(),
upload, null, null, softwareModuleManagement);
upload.setButtonCaption(i18n.getMessage("upload.file"));
upload.setImmediate(true);
upload.setReceiver(uploadHandler);
upload.addSucceededListener(uploadHandler);
upload.addFailedListener(uploadHandler);
upload.addFinishedListener(uploadHandler);
upload.addProgressListener(uploadHandler);
upload.addStartedListener(uploadHandler);
upload.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
upload.addStyleName("no-border");
fileUploadLayout = new HorizontalLayout();
fileUploadLayout.setSpacing(true);
fileUploadLayout.addStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
fileUploadLayout.addComponent(upload);
fileUploadLayout.setComponentAlignment(upload, Alignment.MIDDLE_LEFT);
fileUploadLayout.addComponent(processBtn);
fileUploadLayout.setComponentAlignment(processBtn, Alignment.MIDDLE_RIGHT);
fileUploadLayout.addComponent(discardBtn);
fileUploadLayout.setComponentAlignment(discardBtn, Alignment.MIDDLE_RIGHT);
fileUploadLayout.addComponent(uploadStatusButton);
fileUploadLayout.setComponentAlignment(uploadStatusButton, Alignment.MIDDLE_RIGHT);
setMargin(false);
/* create drag-drop wrapper for drop area */
dropAreaWrapper = new DragAndDropWrapper(createDropAreaLayout());
dropAreaWrapper.setDropHandler(new DropAreahandler());
setSizeFull();
setSpacing(true);
}
示例14: validateDragAndDropWrapper
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
@Override
protected boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource) {
final String tagData = wrapperSource.getData().toString();
if (wrapperSource.getId().startsWith(SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS)) {
return !isNoTagButton(tagData, SPUIDefinitions.DISTRIBUTION_TAG_BUTTON);
} else if (wrapperSource.getId().startsWith(SPUIDefinitions.TARGET_TAG_ID_PREFIXS)) {
return !isNoTagButton(tagData, SPUIDefinitions.TARGET_TAG_BUTTON);
}
notification.displayValidationError(notAllowedMsg);
return false;
}
示例15: isNoTagAssigned
import com.vaadin.ui.DragAndDropWrapper; //导入依赖的package包/类
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
if (tagName.equals(SPUIDefinitions.TARGET_TAG_BUTTON)) {
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
return false;
}
return true;
}