本文整理汇总了Java中com.vaadin.ui.Window.setDraggable方法的典型用法代码示例。如果您正苦于以下问题:Java Window.setDraggable方法的具体用法?Java Window.setDraggable怎么用?Java Window.setDraggable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Window
的用法示例。
在下文中一共展示了Window.setDraggable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLayout
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void createLayout() {
final HorizontalLayout footer = new HorizontalLayout();
footer.setSizeUndefined();
footer.addStyleName("confirmation-window-footer");
footer.setSpacing(true);
footer.setMargin(false);
footer.addComponents(closeBtn);
footer.setComponentAlignment(closeBtn, Alignment.TOP_CENTER);
final VerticalLayout uploadResultDetails = new VerticalLayout();
uploadResultDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
uploadResultDetails.addStyleName("confirmation-popup");
uploadResultDetails.addComponent(uploadResultTable);
uploadResultDetails.setComponentAlignment(uploadResultTable, Alignment.MIDDLE_CENTER);
uploadResultDetails.addComponent(footer);
uploadResultDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);
uploadResultsWindow = new Window();
uploadResultsWindow.setContent(uploadResultDetails);
uploadResultsWindow.setResizable(Boolean.FALSE);
uploadResultsWindow.setClosable(Boolean.FALSE);
uploadResultsWindow.setDraggable(Boolean.TRUE);
uploadResultsWindow.setModal(true);
uploadResultsWindow.setCaption(SPUILabelDefinitions.UPLOAD_RESULT);
uploadResultsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}
示例2: buildLayout
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void buildLayout() {
final HorizontalLayout footer = getFooterLayout();
uploadArtifactDetails = new VerticalLayout();
uploadArtifactDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
uploadArtifactDetails.addStyleName("confirmation-popup");
uploadArtifactDetails.addComponent(uploadDetailsTable);
uploadArtifactDetails.setComponentAlignment(uploadDetailsTable, Alignment.MIDDLE_CENTER);
uploadArtifactDetails.addComponent(footer);
uploadArtifactDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);
window = new Window();
window.setContent(uploadArtifactDetails);
window.setResizable(Boolean.FALSE);
window.setClosable(Boolean.TRUE);
window.setDraggable(Boolean.TRUE);
window.setModal(true);
window.addCloseListener(event -> onPopupClose());
window.setCaption(i18n.getMessage("header.caption.upload.details"));
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}
示例3: decorateWindow
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void decorateWindow(final Window window) {
if (id != null) {
window.setId(id);
}
if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
window.setDraggable(false);
window.setClosable(true);
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
} else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setDraggable(true);
window.setClosable(true);
}
}
示例4: createNotificationWindow
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private void createNotificationWindow() {
notificationsWindow = new Window();
notificationsWindow.setWidth(300.0F, Unit.PIXELS);
notificationsWindow.addStyleName(STYLE_POPUP);
notificationsWindow.addStyleName(STYLE_NO_CLOSEBOX);
notificationsWindow.setClosable(true);
notificationsWindow.setResizable(false);
notificationsWindow.setDraggable(false);
notificationsWindow.setId(UIComponentIdProvider.NOTIFICATION_UNREAD_POPUP_ID);
notificationsWindow.addCloseListener(event -> refreshCaption());
notificationsWindow.addBlurListener(this::closeWindow);
}
示例5: getDeleteConfirmWindow
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private Window getDeleteConfirmWindow(DeviceDTO deviceDTO) {
final String[] exportFileName = {""};
Window confirmWindow = new Window("Delete");
confirmWindow.setResizable(false);
confirmWindow.setModal(true);
confirmWindow.setDraggable(false);
confirmWindow.setClosable(true);
confirmWindow.addCloseListener(e -> {
if (!exportFileName[0].isEmpty()) {
new File(exportFileName[0]).delete();
}
});
Label areYouSureLabel = new Label("Are you sure you want to delete the device?");
Label ifWantExport = new Label("If you wish, you can export all recorded data for the device.");
VerticalLayout contentLayout = new VerticalLayout(areYouSureLabel, ifWantExport);
Button saveAndDeleteButton = new Button("Export and Delete", event -> {
exportFileName[0] =
statisticDeviceDataService
.exportDataToCsv(deviceDTO.getDevId(), deviceDTO.getType(), deviceDTO.getName());
if (!exportFileName[0].isEmpty()) {
contentLayout.addComponent(new Link("Download export, click before exiting!",
new FileResource(new File(exportFileName[0]))));
deleteDevice(deviceDTO);
} else {
contentLayout.addComponent(
new Label("Export failed, please try again! The device has not been deleted."));
}
});
Button deleteOnly = new Button("Delete only", event -> {
deleteDevice(deviceDTO);
confirmWindow.close();
});
confirmWindow.setContent(
new VerticalLayout(contentLayout, new HorizontalLayout(saveAndDeleteButton, deleteOnly)));
return confirmWindow;
}
示例6: getExportWindow
import com.vaadin.ui.Window; //导入方法依赖的package包/类
private Window getExportWindow() {
final String[] fileName = {""};
Window selectWindow = new Window("Export data");
selectWindow.setClosable(true);
selectWindow.setDraggable(false);
selectWindow.setModal(true);
selectWindow.setResizable(false);
selectWindow.setWidth(300, Unit.PIXELS);
selectWindow.addCloseListener(e -> {
if (!fileName[0].isEmpty()) {
new File(fileName[0]).delete();
}
});
VerticalLayout windowRoot = new VerticalLayout();
ComboBox devicesComboBox = new ComboBox("Devices");
devicesComboBox.setWidth(100, Unit.PERCENTAGE);
devicesComboBox.setNullSelectionItemId(false);
devicesComboBox.setContainerDataSource(
new BeanItemContainer<>(
DeviceViewDTO.class,
deviceSetupService.getAllDeviceDtos().stream()
.map(deviceDTO ->
new DeviceViewDTO(deviceDTO.getDevId(), deviceDTO.getType(),
deviceDTO.getName()))
.collect(Collectors.toList())
)
);
windowRoot.addComponent(devicesComboBox);
Button toExportButton = new Button("Export", event -> {
DeviceViewDTO selectedDto = (DeviceViewDTO) devicesComboBox.getValue();
fileName[0] =
statisticDeviceDataService.exportDataToCsv(selectedDto.getDevId(), selectedDto.getType(),
selectedDto.getName());
if (!fileName[0].isEmpty()) {
windowRoot
.addComponent(new Link("Download CSV", new FileResource(new File(fileName[0]))));
} else {
windowRoot.addComponent(new Label("Export failed! Please Try again!"));
}
});
windowRoot.addComponent(toExportButton);
selectWindow.setContent(windowRoot);
return selectWindow;
}
示例7: showAddProjectDialog
import com.vaadin.ui.Window; //导入方法依赖的package包/类
/**
* Zeige das Projekt-Hinzufuegen-Dialogfenster, bei dem ein Eingabefeld fuer
* den Namen des Projekts und ein Hinzfuege-Button vorhanden ist. Funktion
* bei geklicktem Button siehe Clicklistener in dieser Klasse. Das
* horizontale Layout zur Darstellung besitzt ein Formlayout und den Button,
* die nebeneinander dargestellt werden.
*
* @author Christian Scherer, Mirko Göpfrich
*/
@Override
public void showAddProjectDialog() {
addDialog = new Window("Projekt hinzufügen");
addDialog.setModal(true);
addDialog.setWidth(410, UNITS_PIXELS);
addDialog.setResizable(false);
addDialog.setDraggable(false);
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(false);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
//TextFeld für Name dem Formular hinzufügen
tfName = new TextField("Name wählen:");
tfName.setRequired(true);
tfName.addValidator(new StringLengthValidator(
"Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2,
20, false));
tfName.setRequiredError("Pflichtfeld");
tfName.setSizeFull();
formLayout.addComponent(tfName);
//TextArea für Beschreibung dem Formular hinzufügen
taDescription = new TextArea("Beschreibung wählen");
taDescription.setSizeFull();
formLayout.addComponent(taDescription);
//Formular dem Layout hinzufügen
layout.addComponent(formLayout);
//Hinzufüge-Button erstllen und dem Layout hinzufügen
dialogAddBtn = new Button("Hinzufügen", this);
layout.addComponent(dialogAddBtn);
//Layout dem Dialog-Fenster hinzufügen
addDialog.addComponent(layout);
//Dialog dem Hauptfenster hinzufügen
getWindow().addWindow(addDialog);
logger.debug("Hinzufuege-Dialog erzeugt");
}
示例8: showEditProjectDialog
import com.vaadin.ui.Window; //导入方法依赖的package包/类
/**Methode zur Implementierung des Dialogfensters für Projekt-Änderungen.
*
*/
@Override
public void showEditProjectDialog(Project project) {
editDialog = new Window("Projekt bearbeiten");
editDialog.setModal(true);
editDialog.setWidth(410, UNITS_PIXELS);
editDialog.setResizable(false);
editDialog.setDraggable(false);
VerticalLayout layout = new VerticalLayout();
layout.setSpacing(true);
FormLayout formLayout = new FormLayout();
formLayout.setMargin(true);
formLayout.setSpacing(true);
//TextFeld für Name dem Formular hinzufügen
tfName = new TextField("Name ändern:", project.getName());
tfName.setRequired(true);
tfName.addValidator(new StringLengthValidator(
"Der Projektname muss zwischen 2 und 20 Zeichen lang sein.", 2,
20, false));
tfName.setRequiredError("Pflichtfeld");
tfName.setSizeFull();
formLayout.addComponent(tfName);
//TextArea für Beschreibung dem Formular hinzufügen
taDescription = new TextArea("Beschreibung ändern:", project.getDescription());
taDescription.setSizeFull();
formLayout.addComponent(taDescription);
//Formular dem Layout hinzufügen
layout.addComponent(formLayout);
//Speichern-Button erstllen und dem Layout hinzufügen
//TODO: ist das korrekt? Gute Frage, I have no idea what u r doing
dialogEditBtn = new Button("Speichern");
layout.addComponent(dialogEditBtn);
dialogEditBtn.addListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (tfName.isValid()) {
boolean succed = presenter.editProject(projects.get(indexEditBtn), (String) tfName.getValue(), (String) taDescription.getValue());
if (succed) {
getWindow().removeWindow(editDialog);
logger.debug("Projekt-bearbeiten Dialog geschlossen");
}
} else {
getWindow().showNotification(
"",
"Projektname ist ein Pflichtfeld. Bitte geben Sie einen Projektnamen an",
Notification.TYPE_ERROR_MESSAGE);
}
}
});
//Layout dem Dialog-Fenster hinzufügen
editDialog.addComponent(layout);
//Dialog dem Hauptfenster hinzufügen
getWindow().addWindow(editDialog);
logger.debug("Bearbeiten-Dialog erzeugt");
}