Java 类com.vaadin.ui.DragAndDropWrapper 实例源码
项目:hawkbit
文件:AbstractFilterButtons.java
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;
}
项目:vaadin-vertx-samples
文件:ReportEditor.java
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;
}
项目:hybridbpm
文件:ProcessEditor.java
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);
}
项目:hawkbit
文件:TargetTable.java
@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;
}
项目:hawkbit
文件:DeleteActionsLayout.java
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 }));
}
}
项目:hawkbit
文件:AbstractFilterButtons.java
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);
}
项目:hawkbit
文件:AbstractTable.java
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);
}
}
};
}
项目:hawkbit
文件:AbstractTable.java
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;
}
项目:hawkbit
文件:AbstractDeleteActionsLayout.java
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;
}
项目:metl
文件:EditFlowPalette.java
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);
}
项目:vaadin-vertx-samples
文件:ReportEditor.java
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;
}
项目:hybridbpm
文件:ElementModelLayout.java
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);
}
项目:hawkbit
文件:UploadLayout.java
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);
}
项目:hawkbit
文件:DistributionTable.java
@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;
}
项目:hawkbit
文件:TargetTagFilterButtons.java
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;
}
项目:hawkbit
文件:TargetTable.java
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
final String tagName = ((DragAndDropWrapper) (event.getTransferable().getSourceComponent())).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;
}
项目:hawkbit
文件:DistributionTagDropEvent.java
private Boolean isNoTagAssigned(final DragAndDropEvent event) {
final String tagName = ((DragAndDropWrapper) (event.getTargetDetails().getTarget())).getData().toString();
if (tagName.equals(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON)) {
notification.displayValidationError(i18n.getMessage("message.tag.cannot.be.assigned",
new Object[] { i18n.getMessage("label.no.tag.assigned") }));
return false;
}
return true;
}
项目:hawkbit
文件:DeleteActionsLayoutHelper.java
static boolean isTargetTag(final Component source) {
if (source instanceof DragAndDropWrapper) {
final String wrapperData = ((DragAndDropWrapper) source).getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.TARGET_TAG_BUTTON, "");
if (wrapperData.contains(SPUIDefinitions.TARGET_TAG_BUTTON) && !id.trim().isEmpty()) {
return true;
}
}
return false;
}
项目:hawkbit
文件:DeleteActionsLayoutHelper.java
static boolean isDistributionTag(final Component source) {
if (source instanceof DragAndDropWrapper) {
final String wrapperData = ((DragAndDropWrapper) source).getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON, "");
return wrapperData.contains(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON) && !id.trim().isEmpty();
}
return false;
}
项目:hawkbit
文件:DeleteActionsLayout.java
private void deleteTargetTag(final Component source) {
final String tagName = HawkbitCommonUtil.removePrefix(source.getId(), SPUIDefinitions.TARGET_TAG_ID_PREFIXS);
if (managementUIState.getTargetTableFilters().getClickedTargetTags().contains(tagName)) {
notification.displayValidationError(i18n.getMessage("message.tag.delete", new Object[] { tagName }));
} else {
targetTagManagement.delete(tagName);
if (source instanceof DragAndDropWrapper) {
final Long id = DeleteActionsLayoutHelper.getTargetTagId((DragAndDropWrapper) source);
eventBus.publish(this, new TargetTagTableEvent(BaseEntityEventType.REMOVE_ENTITY, Arrays.asList(id)));
}
notification.displaySuccess(i18n.getMessage("message.delete.success", new Object[] { tagName }));
}
}
项目:SecureBPMN
文件:UploadComponent.java
protected void addDropPanel() {
Panel dropPanel = new Panel();
DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPanel);
dragAndDropWrapper.setDropHandler(this);
dragAndDropWrapper.setWidth("80%");
addComponent(dragAndDropWrapper);
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);
}
项目:FiWare-Template-Handler
文件:UploadComponent.java
protected void addDropPanel() {
Panel dropPanel = new Panel();
DragAndDropWrapper dragAndDropWrapper = new DragAndDropWrapper(dropPanel);
dragAndDropWrapper.setDropHandler(this);
dragAndDropWrapper.setWidth("80%");
addComponent(dragAndDropWrapper);
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);
}
项目:vaadin-diagram
文件:Toolbar.java
private Component createDragEntry(final ToolbarItem item) {
Entry entry = new Entry(item);
DragAndDropWrapper drag = new DragAndDropWrapper(entry) {
@Override
public Transferable getTransferable(final Map<String, Object> variables) {
variables.put("component-type", item.getName());
return super.getTransferable(variables);
}
};
drag.setSizeUndefined();
drag.setDragStartMode(DragStartMode.COMPONENT);
return drag;
}
项目:vaadin-vertx-samples
文件:DashboardMenu.java
private Component buildMenuItems() {
CssLayout menuItemsLayout = new CssLayout();
menuItemsLayout.addStyleName("valo-menuitems");
for (final DashboardViewType view : DashboardViewType.values()) {
Component menuItemComponent = new ValoMenuItemButton(view);
if (view == DashboardViewType.REPORTS) {
// Add drop target to reports button
DragAndDropWrapper reports = new DragAndDropWrapper(
menuItemComponent);
reports.setSizeUndefined();
reports.setDragStartMode(DragStartMode.NONE);
reports.setDropHandler(new DropHandler() {
@Override
public void drop(final DragAndDropEvent event) {
UI.getCurrent()
.getNavigator()
.navigateTo(
DashboardViewType.REPORTS.getViewName());
Table table = (Table) event.getTransferable()
.getSourceComponent();
DashboardEventBus.post(new TransactionReportEvent(
(Collection<Transaction>) table.getValue()));
}
@Override
public AcceptCriterion getAcceptCriterion() {
return AcceptItem.ALL;
}
});
menuItemComponent = reports;
}
if (view == DashboardViewType.DASHBOARD) {
notificationsBadge = new Label();
notificationsBadge.setId(NOTIFICATIONS_BADGE_ID);
menuItemComponent = buildBadgeWrapper(menuItemComponent,
notificationsBadge);
}
if (view == DashboardViewType.REPORTS) {
reportsBadge = new Label();
reportsBadge.setId(REPORTS_BADGE_ID);
menuItemComponent = buildBadgeWrapper(menuItemComponent,
reportsBadge);
}
menuItemsLayout.addComponent(menuItemComponent);
}
return menuItemsLayout;
}
项目:hawkbit
文件:UploadLayout.java
public DragAndDropWrapper getDropAreaWrapper() {
return dropAreaWrapper;
}
项目:hawkbit
文件:DeleteActionsLayoutHelper.java
static Long getDistributionTagId(final DragAndDropWrapper source) {
final String wrapperData = source.getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.DISTRIBUTION_TAG_BUTTON, "");
return Long.valueOf(id.trim());
}
项目:hawkbit
文件:DeleteActionsLayoutHelper.java
static Long getTargetTagId(final DragAndDropWrapper source) {
final String wrapperData = source.getData().toString();
final String id = wrapperData.replace(SPUIDefinitions.TARGET_TAG_BUTTON, "");
return Long.valueOf(id.trim());
}
项目:hawkbit
文件:AbstractTableHeader.java
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);
}
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");
}
项目:hawkbit
文件:AbstractNamedVersionTable.java
@Override
protected boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource) {
return false;
}
项目:metl
文件:EditFlowPanel.java
public EditFlowPanel(ApplicationContext context, String flowId, DesignNavigator designNavigator, TabbedPanel tabs) {
this.configurationService = context.getConfigurationService();
this.flow = configurationService.findFlow(flowId);
this.readOnly = context.isReadOnly(configurationService.findProjectVersion(flow.getProjectVersionId()), Privilege.DESIGN);
this.context = context;
this.tabs = tabs;
this.designNavigator = designNavigator;
this.propertySheet = new PropertySheet(context, tabs, readOnly);
this.propertySheet.setListener((components) -> {
List<FlowStep> steps = new ArrayList<FlowStep>();
for (Component c : components) {
steps.add(EditFlowPanel.this.flow.findFlowStepWithComponentId(c.getId()));
}
refreshStepOnDiagram(steps);
});
propertySheet.setCaption("Property Sheet");
componentPalette = new EditFlowPalette(this, context, flow.getProjectVersionId());
addComponent(componentPalette);
rightLayout = new VerticalLayout();
rightLayout.setSizeFull();
rightLayout.addComponent(buildButtonBar());
// Create two different layouts for the user to toggle between.
vSplit = new VerticalSplitPanel();
vSplit.setSizeFull();
vSplit.setSplitPosition(MAX_PANEL_POSITION, Unit.PERCENTAGE);
hSplit = new HorizontalSplitPanel();
hSplit.setSizeFull();
hSplit.setSplitPosition(MAX_PANEL_POSITION, Unit.PERCENTAGE);
diagramLayout = new VerticalLayout();
diagramLayout.setWidth(10000, Unit.PIXELS);
diagramLayout.setHeight(10000, Unit.PIXELS);
DragAndDropWrapper wrapper = new DragAndDropWrapper(diagramLayout);
wrapper.setSizeUndefined();
wrapper.setDropHandler(new DropHandler());
flowPanel = new Panel();
flowPanel.setSizeFull();
flowPanel.addStyleName(ValoTheme.PANEL_WELL);
flowPanel.setContent(wrapper);
if (isVerticalView()) {
vSplit.addComponent(flowPanel);
vSplit.addComponent(propertySheet);
rightLayout.addComponent(vSplit);
rightLayout.setExpandRatio(vSplit, 1);
} else {
hSplit.addComponent(flowPanel);
hSplit.addComponent(propertySheet);
rightLayout.addComponent(hSplit);
rightLayout.setExpandRatio(hSplit, 1);
}
addComponent(rightLayout);
setExpandRatio(rightLayout, 1);
redrawFlow();
}
项目:konekti
文件:CalendarCardView.java
@Override
public void saveButtonClick(CalendarToolbar.ClickNavigationEvent event) {
List<CalendarCard> newCalendarCards = new ArrayList<CalendarCard>();
for (int i = 0; i < 4; i++) {
for(int j = 0; j < 3; j++) {
DragAndDropWrapper dragAndDropWrapperCard = (DragAndDropWrapper)gridLayoutCalendar.getComponent(i, j);
Panel panelCard = (Panel) dragAndDropWrapperCard.getComponentIterator().next();
String calendarCode = Integer.toString(i) + Integer.toString(j);
// check if exist any calendar card in the cell grid layout
if (panelCard.getComponentIterator().hasNext()) {
// get calendar style component from calendar card
HorizontalLayout layoutCard = (HorizontalLayout) panelCard.getComponentIterator().next();
StyleCalendar styleCalendar = (StyleCalendar) layoutCard.getComponentIterator().next();
// get year&month from calendar card and get the calendar card entity if exist
java.util.Calendar c = java.util.Calendar.getInstance();
c.setTime(styleCalendar.getShowingDate());
int year = c.get(java.util.Calendar.YEAR);
int month = c.get(java.util.Calendar.MONTH);
// create a new calendar card from year&month
CalendarCard calendarCard = new CalendarCard();
calendarCard.setCalendar(calendar);
calendarCard.setCode(calendarCode);
calendarCard.setYear(year);
calendarCard.setMonth(month);
newCalendarCards.add(calendarCard);
// check group dates from calendarcard
java.util.Calendar ch = java.util.Calendar.getInstance();
Iterator<String> it = groupDays.keySet().iterator();
while(it.hasNext()) {
String selector = (String) it.next();
DateGroupColor dg = (DateGroupColor) groupDays.get(selector);
for(Date date : dg.getDates()) {
ch.setTime(date);
if (ch.get(java.util.Calendar.YEAR) == year && ch.get(java.util.Calendar.MONTH) == month) {
CalendarDetail calendarDetail = new CalendarDetail();
calendarDetail.setCalendarCard(calendarCard);
calendarDetail.setDate(date);
calendarDetail.setCalendarGroup(dg.getCalendarGroup());
calendarCard.addCalendarDetail(calendarDetail);
}
}
}
}
}
}
try {
// save the last calendar
calendarKnowledgeService.setCalendar(calendar, newCalendarCards);
calendar = calendarService.get(calendar.getCalendarId());
} catch (Exception e) {
throw new RuntimeException("¡No se pudo grabar el calendario!", e);
}
}
项目:hawkbit
文件:AbstractTable.java
protected abstract boolean validateDragAndDropWrapper(final DragAndDropWrapper wrapperSource);