本文整理汇总了Java中com.vaadin.ui.Window.setPositionX方法的典型用法代码示例。如果您正苦于以下问题:Java Window.setPositionX方法的具体用法?Java Window.setPositionX怎么用?Java Window.setPositionX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Window
的用法示例。
在下文中一共展示了Window.setPositionX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: placeWindow
import com.vaadin.ui.Window; //导入方法依赖的package包/类
protected void placeWindow(Window window) {
window.setPositionX(xCurrent);
window.setPositionY(yCurrent);
xCurrent += 30;
yCurrent += 30;
if(xCurrent >= 400) {
xCurrent = xStart;
}
if(yCurrent >= 300) {
yCurrent = yStart;
}
}
示例2: buttonClick
import com.vaadin.ui.Window; //导入方法依赖的package包/类
@Override
public void buttonClick(final ClickEvent event) {
final SetGoogleAuthenticatorCredentialResponse response = (SetGoogleAuthenticatorCredentialResponse) ApplicationMangerAccess.getApplicationManager().service(googleAuthRequest);
if (ServiceResult.SUCCESS == response.getResult()) {
try {
final URI keyUri = new URI(response.getOtpAuthTotpURL());
final QRCode qrCode = new QRCode(QR_CODE, keyUri.toASCIIString());
qrCode.setHeight(QR_CODE_IMAGE_SIZE);
qrCode.setWidth(QR_CODE_IMAGE_SIZE);
final Window mywindow = new Window(GOOGLE_AUTHENTICATOR_QR_CODE);
mywindow.setHeight(MODAL_WINDOW_SIZE);
mywindow.setWidth(MODAL_WINDOW_SIZE);
mywindow.setPositionX(WINDOW_POSITION);
mywindow.setPositionY(WINDOW_POSITION);
final VerticalLayout panelContent = new VerticalLayout();
mywindow.setContent(panelContent);
panelContent.addComponent(qrCode);
mywindow.setModal(true);
UI.getCurrent().addWindow(mywindow);
} catch (final URISyntaxException e) {
LOGGER.warn(PROBLEM_DISPLAYING_QR_CODE,e);
Notification.show(PROBLEM_DISPLAYING_QR_CODE,
ERROR_MESSAGE,
Notification.Type.WARNING_MESSAGE);
}
} else {
Notification.show(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR,
ERROR_MESSAGE,
Notification.Type.WARNING_MESSAGE);
LOGGER.info(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR_SESSIONID,googleAuthRequest.getSessionId());
}
}
示例3: getGraph
import com.vaadin.ui.Window; //导入方法依赖的package包/类
/**
* Get a Vaadin Window element that contains the corresponding R plot
* generated by submitting and evaluating the RPlotCall String. The
* imageName corresponds to the downloadable .png image name. The full name
* of the images shown in the browser are of the format
* {@code imageName_ISODate_runningId_[sessionId].png}, e.g.
* 'Image_2012-08-29_001_[bmgolmfgvk].png' to keep them chronologically
* ordered.
*
* @param RPlotCall
* the String to be evaluated by R
* @param width
* the width of the graphical image
* @param height
* the height of the graphical image
* @param imageName
* the image name attached to the right-click downloadable file
* @param windowName
* the title name of the Vaadin window element
* @return Vaadin Window object
*/
public Window getGraph(final String RPlotCall, final int width,
final int height, final String imageName, String windowName) {
/* Construct a Window to show the graphics */
Window RGraphics = new Window(windowName);
HorizontalLayout root = new HorizontalLayout();
root.setMargin(true);
RGraphics.setContent(root);
RGraphics.setSizeUndefined();
/* Control the image position */
final int imageXoffset = 180;
final int imageYoffset = 60;
int imageYpos = rand.nextInt(50);
int imageXpos = rand.nextInt(90);
RGraphics.setPositionX(imageXoffset + imageXpos);
RGraphics.setPositionY(imageYoffset + imageYpos);
/* Call R for the graphics */
Embedded rPlot = getEmbeddedGraph(RPlotCall, width, height, imageName);
root.addComponent(rPlot);
/*
* Button bar to generate PDF (and for other options in the future)
*/
if (showButtonsInGraph) {
final HorizontalLayout buttonLayout = new HorizontalLayout();
Button open = new Button("PDF");
open.setStyleName(Reindeer.BUTTON_SMALL);
buttonLayout.addComponent(open);
Button.ClickListener openClicked = new Button.ClickListener() {
private static final long serialVersionUID = 1L;
@Override
public void buttonClick(ClickEvent event) {
StreamResource s = getImageResource(RPlotCall, width
/ screen_dpi, height / screen_dpi, imageName, "pdf");
Link pdfLink = new Link("Open pdf", s);
pdfLink.setTargetName("_blank");
buttonLayout.removeAllComponents();
buttonLayout.addComponent(pdfLink);
}
};
open.addClickListener(openClicked);
root.addComponent(buttonLayout);
}
return RGraphics;
}