List of usage examples for com.vaadin.ui Window setPositionX
public void setPositionX(int positionX)
From source file:at.peppol.webgui.app.components.InvoiceTabForm.java
License:Mozilla Public License
private void initElements() { supplierForm = new PartyDetailForm("Supplier", supplier.getParty()); supplierForm.setImmediate(true);/*from w w w. j a va 2 s . c o m*/ customerForm = new PartyDetailForm("Customer", customer.getParty()); customerForm.setImmediate(true); //supplierForm.setSizeFull (); //customerForm.setSizeFull (); final HorizontalLayout footerLayout = new HorizontalLayout(); footerLayout.setSpacing(true); footerLayout.setMargin(true); footerLayout.addComponent(new Button("Save Invoice", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { SetCommonCurrency(); ValidatorHandler vh = new ValidatorHandler(footerLayout); AbstractUBLDocumentMarshaller.setGlobalValidationEventHandler(vh); vh.clearErrors(); clearTabErrorStyles(); boolean invoiceHasErrors = false; List<ValidationError> errors = GlobalValidationsRegistry.runAll(); if (errors.size() > 0) { invoiceHasErrors = true; Window errorWindow = new Window("Errors"); //position and size of the window errorWindow.setPositionX(200); errorWindow.setPositionY(200); errorWindow.setWidth("600px"); errorWindow.setHeight("300px"); //add the error messages String errorMessage = "<ol>"; for (int i = 0; i < errors.size(); i++) { errorMessage += "<li style=\"margin-top: 4px;\"><b>" + errors.get(i).getRuleID() + "</b>: " + errors.get(i).getErrorInfo() + "</li>"; //mark the appropriate Tab as error Tab tab = invTabSheet.getTab(errors.get(i).getMainComponent()); if (tab != null) tab.setStyleName("test111"); } errorMessage += "</ol>"; errorWindow.addComponent(new Label(errorMessage, Label.CONTENT_XHTML)); //show the error window getParent().getWindow().addWindow(errorWindow); errors.clear(); } ValidatorsList.validateListenersNotify(); if (ValidatorsList.validateListeners() == false) { invoiceHasErrors = true; } if (invoiceHasErrors) { getWindow().showNotification("Validation error. Could not save invoice", Notification.TYPE_TRAY_NOTIFICATION); } else { try { if (invoiceFilePath.equals("")) { UBL20DocumentMarshaller.writeInvoice(invoice, new StreamResult(new File(um.getDrafts().getFolder().toString() + System.getProperty("file.separator") + "invoice" + System.currentTimeMillis() + ".xml"))); invoiceFilePath = um.getDrafts().getFolder().toString() + System.getProperty("file.separator") + "invoice" + System.currentTimeMillis() + ".xml"; } else { UBL20DocumentMarshaller.writeInvoice(invoice, new StreamResult(new File(invoiceFilePath))); } getWindow() .showNotification( "Validation passed. Invoice saved in " + um.getDrafts().getName().toUpperCase() + " folder", Notification.TYPE_TRAY_NOTIFICATION); } catch (Exception e) { getWindow().showNotification("Disk access error. Could not save invoice", Notification.TYPE_ERROR_MESSAGE); } } /*PEPPOL validation * final ValidationPyramid vp = new ValidationPyramid (EValidationDocumentType.INVOICE, ValidationTransaction.createUBLTransaction (ETransaction.T10)); final List <ValidationPyramidResultLayer> aResults = vp.applyValidation (new FileSystemResource ("invoice.xml")) .getAllValidationResultLayers (); if (aResults.isEmpty ()) System.out.println (" The document is valid!"); else for (final ValidationPyramidResultLayer aResultLayer : aResults) for (final IResourceError aError : aResultLayer.getValidationErrors ()) System.out.println (" " + aResultLayer.getValidationLevel () + " " + aError.getAsString (Locale.US)); */ /*ValidatorsList.validateListenersNotify(); if (ValidatorsList.validateListeners() == false) { getParent().getWindow().showNotification("Validation error... ",Notification.TYPE_TRAY_NOTIFICATION); } else getParent().getWindow().showNotification("Validation passed! ",Notification.TYPE_TRAY_NOTIFICATION); */ } })); /* footerLayout.addComponent (new Button ("Save Invoice", new Button.ClickListener () { @Override public void buttonClick (final Button.ClickEvent event) { try { SetCommonCurrency (); System.out.println (invoice.getDelivery ().get (0).getDeliveryAddress ().getStreetName ().getValue ()); } catch (final Exception ex) { LOGGER.error ("Error creating files. ", ex); } } })); */ footerLayout.addComponent(new Button("Read Invoice from disk", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { try { SetCommonCurrency(); InvoiceType inv = UBL20DocumentMarshaller .readInvoice(new StreamSource(new FileInputStream(new File("invoice.xml")))); } catch (final Exception ex) { LOGGER.error("Error creating files. ", ex); } } })); getFooter().addComponent(footerLayout); }
From source file:com.expressui.core.view.util.CodePopup.java
License:Open Source License
/** * Opens popup for given classes.//from w w w . ja v a 2 s.c om * * @param classes classes for displaying related source code and Javadoc. If * class is within com.expressui.core or com.expressui.domain, * then Javadoc is displayed, otherwise source code. */ public void open(Class... classes) { Window codeWindow = new Window(); codeWindow.addStyleName("code-popup"); codeWindow.setPositionX(20); codeWindow.setPositionY(40); codeWindow.setWidth("90%"); codeWindow.setHeight("90%"); TabSheet codePopupTabSheet = new TabSheet(); String id = StringUtil.generateDebugId("e", this, codePopupTabSheet, "codePopupTabSheet"); codePopupTabSheet.setDebugId(id); codePopupTabSheet.setSizeFull(); codeWindow.addComponent(codePopupTabSheet); String windowCaption = ""; Set<String> shownUrls = new HashSet<String>(); for (Class clazz : classes) { String tabCaption; String url; if (clazz.getName().startsWith("com.expressui.core") || clazz.getName().startsWith("com.expressui.domain")) { url = applicationProperties.getDocUrl(clazz); if (shownUrls.contains(url)) continue; tabCaption = clazz.getSimpleName() + " API"; Embedded embedded = getEmbeddedDoc(url); codePopupTabSheet.addTab(embedded, tabCaption); } else { url = applicationProperties.getCodeUrl(clazz); if (shownUrls.contains(url)) continue; tabCaption = clazz.getSimpleName() + ".java"; String code = getCodeContents(url); Label label = new CodeLabel(code); codePopupTabSheet.addTab(label, tabCaption); } shownUrls.add(url); if (windowCaption.length() > 0) windowCaption += ", "; windowCaption += tabCaption; } codeWindow.setCaption(windowCaption); MainApplication.getInstance().getMainWindow().addWindow(codeWindow); }
From source file:com.foc.vaadin.gui.layouts.validationLayout.FVStatusLayout.java
License:Apache License
public static void popupCancel(FocCentralPanel mainWindow, FocObject focObject, FVStatusLayout statusLayout, WFTransactionWrapper_Form transactionWrapperForm) { if (focObject != null && focObject.getThisFocDesc() instanceof IWorkflowDesc) { IWorkflowDesc iworkflowDesc = (IWorkflowDesc) focObject.getThisFocDesc(); IWorkflow iworkflow = (IWorkflow) focObject; XMLViewKey xmlKey = new XMLViewKey("IWorkflow", XMLViewKey.TYPE_FORM, WorkflowWebModule.CTXT_CANCEL_TRANSACTION, XMLViewKey.VIEW_DEFAULT); Workflow_Cancel_Form centralPanel = (Workflow_Cancel_Form) XMLViewDictionary.getInstance() .newCentralPanel_NoParsing(mainWindow, xmlKey, (IFocData) iworkflow); // centralPanel.setStatusLayout(statusLayout); // centralPanel.setFocXMLLayout(xmlL); centralPanel.parseXMLAndBuildGui(); FocCentralPanel centralWindow = new FocCentralPanel(); centralWindow.fill();/*www . java 2 s .c om*/ centralWindow.changeCentralPanelContent(centralPanel, false); Window window = centralWindow.newWrapperWindow(); // window.setWidth("500px"); // window.setHeight("300px"); window.setPositionX(200); window.setPositionY(100); FocWebApplication.getInstanceForThread().addWindow(window); } }
From source file:com.foc.vaadin.gui.layouts.validationLayout.FVStatusLayout_ComboBox.java
License:Apache License
public static void popupCancel(FocCentralPanel mainWindow, FocObject focObject, FVStatusLayout_ComboBox statusLayout, WFTransactionWrapper_Form transactionWrapperForm) { if (focObject != null && focObject.getThisFocDesc() instanceof IWorkflowDesc) { IWorkflowDesc iworkflowDesc = (IWorkflowDesc) focObject.getThisFocDesc(); IWorkflow iworkflow = (IWorkflow) focObject; XMLViewKey xmlKey = new XMLViewKey("IWorkflow", XMLViewKey.TYPE_FORM, WorkflowWebModule.CTXT_CANCEL_TRANSACTION, XMLViewKey.VIEW_DEFAULT); Workflow_Cancel_Form centralPanel = (Workflow_Cancel_Form) XMLViewDictionary.getInstance() .newCentralPanel_NoParsing(mainWindow, xmlKey, (IFocData) iworkflow); // centralPanel.setStatusLayout(statusLayout);hadi_13 // centralPanel.setTransactionWrapperForm(transactionWrapperForm); centralPanel.parseXMLAndBuildGui(); FocCentralPanel centralWindow = new FocCentralPanel(); centralWindow.fill();/* w w w. ja v a 2 s . c om*/ centralWindow.changeCentralPanelContent(centralPanel, false); Window window = centralWindow.newWrapperWindow(); // window.setWidth("500px"); // window.setHeight("300px"); window.setPositionX(200); window.setPositionY(100); FocWebApplication.getInstanceForThread().addWindow(window); } }
From source file:com.foc.web.modules.admin.FocUser_HomePage_Form.java
License:Apache License
public static Window popupUserCredintionals(INavigationWindow iNavigationWindow) { XMLViewKey key = new XMLViewKey(FocUserDesc.getInstance().getStorageName(), XMLViewKey.TYPE_FORM, AdminWebModule.CONTEXT_COMPANY_SELECTION, XMLViewKey.VIEW_DEFAULT); if (ConfigInfo.isArabic()) { key.setContext(AdminWebModule.CONTEXT_COMPANY_SELECTION_AR); }//from ww w . j a v a 2 s .co m ICentralPanel centralPanel = XMLViewDictionary.getInstance().newCentralPanel(iNavigationWindow, key, FocWebApplication.getFocUser()); Window window = null; if (FocWebApplication.getInstanceForThread().isMobile()) { iNavigationWindow.changeCentralPanelContent(centralPanel, true); } else { FocCentralPanel centralWindow = new FocCentralPanel(); centralWindow.fill(); centralWindow.changeCentralPanelContent(centralPanel, false); window = centralWindow.newWrapperWindow(); window.setCaption("User Account"); window.setPositionX(300); window.setPositionY(100); FocWebApplication.getInstanceForThread().addWindow(window); } return window; }
From source file:com.foc.web.modules.workflow.UserCompanyRights_Form.java
License:Apache License
@Override public boolean validationCheckData(FVValidationLayout validationLayout) { boolean error = super.validationCheckData(validationLayout); if (!error && getUserCompanyRights() != null && getUserCompanyRights().getCompany() != null && getUserCompanyRights().getCompany().getSiteListSize() > 0) { if (getUserCompanyRights().getCompany().getSiteListSize() == 1) { if (WFTitleDesc.getInstance().getFocList().size() == 1) { WFSite site = (WFSite) getUserCompanyRights().getCompany().getAnySite(); WFTitle title = (WFTitle) WFTitleDesc.getInstance().getFocList().getFocObject(0); WFOperator operator = (WFOperator) site.getOperatorList().newEmptyItem(); operator.setUser(getUserCompanyRights().getUser()); operator.setTitle(title); } else { ArrayList<WFSite> selectedSiteList = new ArrayList<WFSite>(); selectedSiteList.add((WFSite) getUserCompanyRights().getCompany().getAnySite()); FocList focList = WFTitleDesc.getList(FocList.LOAD_IF_NEEDED); XMLViewKey xmlViewKey = new XMLViewKey(WFTitleDesc.getInstance().getStorageName(), XMLViewKey.TYPE_TABLE, WorkflowWebModule.CTXT_TITLE_SELECTION, XMLViewKey.VIEW_DEFAULT); WFTitle_TitleSelection_Table centralPanel = (WFTitle_TitleSelection_Table) XMLViewDictionary .getInstance().newCentralPanel((FocCentralPanel) getMainWindow(), xmlViewKey, focList); centralPanel.setSelectedSiteList(selectedSiteList); centralPanel.setUser(getUserCompanyRights().getUser()); Window titleSelectionWindow = null; FocCentralPanel centralWindow = new FocCentralPanel(); centralWindow.fill();/*from ww w. j a v a 2 s.c o m*/ centralWindow.changeCentralPanelContent(centralPanel, false); titleSelectionWindow = centralWindow.newWrapperWindow(); titleSelectionWindow.setPositionX(300); titleSelectionWindow.setPositionY(100); FocWebApplication.getInstanceForThread().addWindow(titleSelectionWindow); titleSelectionWindow.setModal(true); } } else { if (WFTitleDesc.getInstance().getFocList().size() > 0 && WFTitleDesc.getInstance().getFocList().size() == 1) { popupWorkfloSiteSelectionTable(false); } else { popupWorkfloSiteSelectionTable(true); } } } return error; }
From source file:com.foc.web.modules.workflow.UserCompanyRights_Form.java
License:Apache License
private void popupWorkfloSiteSelectionTable(boolean hasMultipleTitles) { Company companyToFilterOn = getUserCompanyRights().getCompany(); if (companyToFilterOn != null) { //20160107 FocListWrapper wrapper = companyToFilterOn.newFocListWrapperForCurrentCompany(); XMLViewKey xmlViewKey = new XMLViewKey(WFSiteDesc.getInstance().getStorageName(), XMLViewKey.TYPE_TABLE, WorkflowWebModule.CTXT_SITE_SELECTION, XMLViewKey.VIEW_DEFAULT); WFSite_SiteSelection_Table centralPanel = (WFSite_SiteSelection_Table) XMLViewDictionary.getInstance() .newCentralPanel(getMainWindow(), xmlViewKey, wrapper); centralPanel.setFocDataOwner(true); centralPanel.setHasMultipleTitles(hasMultipleTitles); centralPanel.setUser(getUserCompanyRights().getUser()); Window titleSelectionWindow = null; FocCentralPanel centralWindow = new FocCentralPanel(); centralWindow.fill();/*from w w w. ja v a 2s. co m*/ centralWindow.changeCentralPanelContent(centralPanel, false); titleSelectionWindow = centralWindow.newWrapperWindow(); titleSelectionWindow.setPositionX(300); titleSelectionWindow.setPositionY(100); FocWebApplication.getInstanceForThread().addWindow(titleSelectionWindow); titleSelectionWindow.setModal(true); } }
From source file:com.foc.web.modules.workflow.WFSite_SiteSelection_Table.java
License:Apache License
public void insertRowsAfterSelection() { if (isHasMultipleTitles()) { FocList focList = WFTitleDesc.getList(FocList.LOAD_IF_NEEDED); XMLViewKey xmlViewKey = new XMLViewKey(WFTitleDesc.getInstance().getStorageName(), XMLViewKey.TYPE_TABLE, WorkflowWebModule.CTXT_TITLE_SELECTION, XMLViewKey.VIEW_DEFAULT); WFTitle_TitleSelection_Table centralPanel = (WFTitle_TitleSelection_Table) XMLViewDictionary .getInstance().newCentralPanel(getMainWindow(), xmlViewKey, focList); centralPanel.setSelectedSiteList(getSelectedSites()); centralPanel.setUser(getUser()); Window titleSelectionWindow = null; FocCentralPanel centralWindow = new FocCentralPanel(); centralWindow.fill();// ww w . j a v a 2s .c o m centralWindow.changeCentralPanelContent(centralPanel, false); titleSelectionWindow = centralWindow.newWrapperWindow(); titleSelectionWindow.setPositionX(300); titleSelectionWindow.setPositionY(100); FocWebApplication.getInstanceForThread().addWindow(titleSelectionWindow); titleSelectionWindow.setModal(true); } else { WFTitle title = (WFTitle) WFTitleDesc.getInstance().getFocList().getFocObject(0); FocUser user = getUser(); for (int i = 0; i < getSelectedSites().size(); i++) { WFSite site = getSelectedSites().get(i); WFOperator operator = (WFOperator) site.getOperatorList().newEmptyItem(); operator.setTitle(title); operator.setUser(user); site.getOperatorList().add(operator); operator.validate(true); } } }
From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.SetGoogleAuthenticatorCredentialClickListener.java
License:Apache License
@Override public void buttonClick(final ClickEvent event) { final SetGoogleAuthenticatorCredentialResponse response = (SetGoogleAuthenticatorCredentialResponse) applicationManager .service(googleAuthRequest); if (ServiceResult.SUCCESS == response.getResult()) { try {/*ww w .j a v a 2 s. co m*/ 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()); } }
From source file:com.mymita.vaadlets.VaadletsBuilder.java
License:Apache License
private static void setWindowAttributes(final com.vaadin.ui.Component vaadinComponent, final com.mymita.vaadlets.core.Component vaadletsComponent) { if (vaadletsComponent instanceof com.mymita.vaadlets.ui.Window) { final com.vaadin.ui.Window vaadinWindow = (com.vaadin.ui.Window) vaadinComponent; final com.mymita.vaadlets.ui.Window vaadletsWindow = (com.mymita.vaadlets.ui.Window) vaadletsComponent; if (vaadletsWindow.isCenter()) { vaadinWindow.center();//from w w w .j a v a 2s. c o m } final Short positionX = vaadletsWindow.getPositionX(); if (positionX != null) { vaadinWindow.setPositionX(positionX); } final Short positionY = vaadletsWindow.getPositionY(); if (positionY != null) { vaadinWindow.setPositionY(positionY); } vaadinWindow.setBorder(vaadletsWindow.getBorder().ordinal()); vaadinWindow.setModal(vaadletsWindow.isModal()); vaadinWindow.setClosable(vaadletsWindow.isCloseable()); vaadinWindow.setDraggable(vaadletsWindow.isDraggable()); vaadinWindow.setResizable(vaadletsWindow.isResizeable()); vaadinWindow.setResizeLazy(vaadletsWindow.isResizeLazy()); } }