本文整理汇总了Java中com.vaadin.server.VaadinRequest类的典型用法代码示例。如果您正苦于以下问题:Java VaadinRequest类的具体用法?Java VaadinRequest怎么用?Java VaadinRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VaadinRequest类属于com.vaadin.server包,在下文中一共展示了VaadinRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
setContent(layout);
Grid grid = new Grid();
initializeGrid(grid);
grid.setWidth("700px");
grid.setHeight("500px");
applyDemoHacks(grid);
layout.addComponent(grid);
}
示例2: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final VerticalLayout root = new VerticalLayout();
root.setSizeFull();
root.setMargin(true);
root.setSpacing(true);
setContent(root);
MHorizontalLayout horizontalLayout = new MHorizontalLayout();
for (MenuEntry menuEntry : menuEntries) {
horizontalLayout.addComponent(new MButton(menuEntry.getName(), event -> {
navigator.navigateTo(menuEntry.getNavigationTarget());
}));
}
root.addComponent(horizontalLayout);
springViewDisplay = new Panel();
springViewDisplay.setSizeFull();
root.addComponent(springViewDisplay);
root.setExpandRatio(springViewDisplay, 1.0f);
}
示例3: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
setNavigator(new Navigator(this, (View view) -> {
tabs.setSelectedTab((Component) view);
}));
registerExample(SvgInVaadin.class);
registerExample(SimplyAsAnImageOrIcon.class);
registerExample(FileExample.class);
registerExample(AnimationExample.class);
registerExample(Java2DExample.class);
registerExample(JungExample.class);
getNavigator().setErrorView(SvgInVaadin.class);
tabs.addSelectedTabChangeListener(e -> {
if (e.isUserOriginated()) {
getNavigator().navigateTo(e.getTabSheet().getSelectedTab().getClass().getSimpleName());
}
});
String state = getNavigator().getState();
getNavigator().navigateTo(state);
tabs.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
setContent(tabs);
}
示例4: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
final VerticalLayout rootLayout = new VerticalLayout();
rootLayout.setSizeFull();
setContent(rootLayout);
final CssLayout navigationBar = new CssLayout();
navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
navigationBar.addComponent(createNavigationButton("Demo View (Default)",
Constants.VIEW_DEFAULT));
navigationBar.addComponent(createNavigationButton("Stream View",
Constants.VIEW_STREAM));
rootLayout.addComponent(navigationBar);
springViewDisplay = new Panel();
springViewDisplay.setSizeFull();
rootLayout.addComponent(springViewDisplay);
rootLayout.setExpandRatio(springViewDisplay, 1.0f);
}
示例5: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
// crate a binder for a form, specifying the data class that will be used in binding
Binder<ImageData> binder = new Binder<>(ImageData.class);
// specify explicit binding in order to add validation and converters
binder.forMemberField(imageSize)
// input should not be null or empty
.withValidator(string -> string != null && !string.isEmpty(), "Input values should not be empty")
// convert String to Integer, throw ValidationException if String is in incorrect format
.withConverter(new StringToIntegerConverter("Input value should be an integer"))
// validate converted integer: it should be positive
.withValidator(integer -> integer > 0, "Input value should be a positive integer");
// tell binder to bind use all fields from the current class, but considering already existing bindings
binder.bindInstanceFields(this);
// crate data object with predefined imageName and imageSize
ImageData imageData = new ImageData("Lorem ipsum", 2);
// fill form with predefined data from data object and
// make binder to automatically update the object from the form, if no validation errors are present
binder.setBean(imageData);
binder.addStatusChangeListener(e -> {
// the real image drawing will not be considered in this article
if (e.hasValidationErrors() || !e.getBinder().isValid()) {
Notification.show("Form contains validation errors, no image will be drawn");
} else {
Notification.show(String.format("I will draw image with \"%s\" text and width %d\n",
imageData.getText(), imageData.getSize()));
}
});
// add a form to layout
setContent(new VerticalLayout(text, imageSize));
}
示例6: handleConnectorRequest
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
public boolean handleConnectorRequest(VaadinRequest request,
VaadinResponse response, String path) throws IOException {
final BusyIndicatorWindow busyIndicatorWindow = new BusyIndicatorWindow();
final UI ui = UI.getCurrent();
ui.access(() -> ui.addWindow(busyIndicatorWindow));
try {
//on charge le fichier
getStreamSource().loadOndemandFile();
if (getStreamSource().getStream()==null){
return true;
}
getResource().setFilename(getStreamSource().getFileName());
return super.handleConnectorRequest(request, response, path);
}catch(Exception e){
return true;
}
finally {
busyIndicatorWindow.close();
}
}
示例7: handleConnectorRequest
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
public boolean handleConnectorRequest(VaadinRequest request,
VaadinResponse response, String path) throws IOException {
final BusyIndicatorWindow busyIndicatorWindow = new BusyIndicatorWindow();
final UI ui = UI.getCurrent();
ui.access(() -> ui.addWindow(busyIndicatorWindow));
try {
getStreamSource().loadOndemandFile();
if (getStreamSource().getStream()==null){
return true;
}
getDownloadStreamSource().setMIMEType("application/pdf");
getDownloadStreamSource().getStream().setParameter(
"Content-Disposition",
"attachment; filename="+getStreamSource().getFileName());
return super.handleConnectorRequest(request, response, path);
}catch(Exception e){
return true;
}finally {
busyIndicatorWindow.close();
}
}
示例8: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
VaadinSession.getCurrent().getSession().setMaxInactiveInterval(-1);
Page.getCurrent().setTitle("Tiny Pounder (" + VERSION + ")");
setupLayout();
addKitControls();
updateKitControls();
initVoltronConfigLayout();
initVoltronControlLayout();
initRuntimeLayout();
addExitCloseTab();
updateServerGrid();
// refresh consoles if any
consoleRefresher = scheduledExecutorService.scheduleWithFixedDelay(
() -> access(() -> runningServers.values().forEach(RunningServer::refreshConsole)),
2, 2, TimeUnit.SECONDS);
}
示例9: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
root = new CssLayout(appBar, navigationDrawer, content);
root.setPrimaryStyleName("root");
root.setSizeFull();
Responsive.makeResponsive(root);
setContent(root);
appBar.getNaviIcon().addClickListener(event -> navigationDrawer.toggle());
content.setPrimaryStyleName("content");
content.setSizeFull();
initNavigationItems();
initDummyContent();
}
示例10: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
rootLayout = getRootLayout();
setContent(rootLayout);
Label title = getTitleLabel();
StepperPropertiesLayout layout = new StepperPropertiesLayout();
layout.addStepperCreateListener(this);
layout.setWidth(300, Unit.PIXELS);
Spacer spacer = new Spacer();
spacer.setWidth(100, Unit.PIXELS);
rootLayout.addComponent(title, 0, 0, 2, 0);
rootLayout.addComponent(spacer, 1, 1);
rootLayout.addComponent(layout, 0, 1);
rootLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);
layout.start();
}
示例11: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout contentArea = new VerticalLayout();
contentArea.setMargin(false);
setContent(contentArea);
final Navigator navigator = new Navigator(this, contentArea);
navigator.addProvider(viewProvider);
navigator.setErrorView(InaccessibleErrorView.class);
String defaultView = Page.getCurrent().getUriFragment();
if (defaultView == null || defaultView.trim().isEmpty()) {
defaultView = SecureView.VIEW_NAME;
}
if (isUserAuthenticated(vaadinRequest)) {
navigator.navigateTo(defaultView);
} else {
navigator.navigateTo(LoginView.VIEW_NAME + "/" + defaultView);
}
}
示例12: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
setSizeFull();
VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
layout.setMargin(true);
testGrid.setSizeFull();
testGrid.getEditor().setEnabled(true);
testGrid.setItems(getCustomers());
layout.addComponent(testGrid);
setContent(layout);
}
示例13: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest vaadinRequest) {
final VerticalLayout layout = new VerticalLayout();
final TextField name = new TextField();
name.setCaption("Type your name here:");
Button button = new Button("Click Me");
button.addClickListener(e -> {
layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!"));
});
layout.addComponents(name, button);
setContent(layout);
}
示例14: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(VaadinRequest request) {
Label title = new Label("Live Image Editor add-on for Vaadin");
title.addStyleName(ValoTheme.LABEL_H2);
title.addStyleName(ValoTheme.LABEL_COLORED);
instructions.setContentMode(ContentMode.HTML);
instructions.setWidth(600, Unit.PIXELS);
upload.addSucceededListener(this::uploadSucceeded);
imageEditor.setWidth(100, Unit.PERCENTAGE);
imageEditor.setBackgroundColor(0, 52, 220);
VerticalLayout layout = new VerticalLayout(title, upload, instructions, imageEditor, send, result, editedImage);
layout.setSizeUndefined();
layout.setMargin(true);
layout.setSpacing(true);
setContent(layout);
setupUploadStep();
}
示例15: init
import com.vaadin.server.VaadinRequest; //导入依赖的package包/类
@Override
protected void init(final VaadinRequest request) {
setLocale(Locale.US);
DashboardEventBus.register(this);
Responsive.makeResponsive(this);
addStyleName(ValoTheme.UI_WITH_MENU);
updateContent();
// Some views need to be aware of browser resize events so a
// BrowserResizeEvent gets fired to the event bus on every occasion.
Page.getCurrent().addBrowserWindowResizeListener(
new BrowserWindowResizeListener() {
@Override
public void browserWindowResized(
final BrowserWindowResizeEvent event) {
DashboardEventBus.post(new BrowserResizeEvent());
}
});
}