Example usage for com.vaadin.ui Window setHeight

List of usage examples for com.vaadin.ui Window setHeight

Introduction

In this page you can find the example usage for com.vaadin.ui Window setHeight.

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:com.foc.vaadin.gui.components.FVTreeDropHandler_ObjectTree.java

License:Apache License

@Override
public void drop(DragAndDropEvent dropEvent) {
    if (dropEvent.getTransferable() instanceof DataBoundTransferable) {
        DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable();
        if (t.getSourceContainer() instanceof ContainerOrderedWrapper) {
            ContainerOrderedWrapper source = (ContainerOrderedWrapper) t.getSourceContainer();
            Object sourceItemId = t.getItemId();
            FocObject objDroped = (FocObject) source.getItem(sourceItemId);

            AbstractSelectTargetDetails dropData = ((AbstractSelectTargetDetails) dropEvent.getTargetDetails());
            Object targetItemId = dropData.getItemIdOver();

            if (focData != null && focData instanceof FocDataMap) {
                FocDataMap focDataMap = (FocDataMap) focData;
                focData = focDataMap.getMainFocData();
            }/* w  w w  .j av a 2 s.  c  om*/

            if (focData != null && focData instanceof FObjectTree) {
                FObjectTree objectTree = (FObjectTree) focData;
                setObjectTree(objectTree);
                if (objectTree != null) {
                    targetNode = (FObjectNode) objectTree.findNode(((Long) targetItemId).longValue());
                    sourceNode = (FObjectNode) objectTree.findNode(objDroped.getReference().getLong());

                    if (targetNode != null && sourceNode != null && focXMLLayout != null) {

                        XMLViewKey xmlViewKey = new XMLViewKey(AdminWebModule.OPTION_WINDOW_STORAGE,
                                XMLViewKey.TYPE_FORM);
                        OptionDialog_Form optionDialogForm = (OptionDialog_Form) XMLViewDictionary.getInstance()
                                .newCentralPanel(focXMLLayout.getMainWindow(), xmlViewKey, null);

                        setOptionDialog_Form(optionDialogForm);

                        ClickListener clickListener = new ClickListener() {

                            @Override
                            public void buttonClick(ClickEvent event) {
                                FocObject targetObject = (FocObject) targetNode.getObject();
                                FocObject sourceObject = (FocObject) sourceNode.getObject();

                                boolean shouldExecute = (sourceObject != null && sourceObject != targetObject)
                                        && (!sourceNode.isAncestorOf(targetNode));

                                if (shouldExecute && getObjectTree() != null) {

                                    sourceObject.setPropertyObject(getObjectTree().getFatherNodeId(),
                                            targetObject);
                                    sourceNode.moveTo(targetNode);

                                    FVTableWrapperLayout bkdnTreeWrapper = (FVTableWrapperLayout) focXMLLayout
                                            .getComponentByName(treeName);
                                    if (bkdnTreeWrapper != null) {
                                        FVTreeTable treeTable = ((FVTreeTable) bkdnTreeWrapper
                                                .getTableOrTree());
                                        if (treeTable != null && treeTable instanceof FVTreeTable) {
                                            getOptionDialog_Form().goBack(null);
                                            treeTable.markAsDirty();
                                            treeTable.refreshRowCache_Foc();
                                            focXMLLayout.refresh();
                                        }
                                    }
                                }
                            }
                        };

                        optionDialogForm.addButton("Confirm node move", clickListener);

                        clickListener = new ClickListener() {

                            @Override
                            public void buttonClick(ClickEvent event) {
                                getOptionDialog_Form().goBack(null);
                            }

                        };
                        optionDialogForm.addButton("Cancel", clickListener);

                        FocCentralPanel centralPanel = new FocCentralPanel();
                        centralPanel.fill();
                        centralPanel.changeCentralPanelContent(getOptionDialog_Form(), false);
                        Window optionWindow = centralPanel.newWrapperWindow();
                        optionWindow.setCaption("Node Move Confirmation");
                        optionWindow.setWidth("400px");
                        optionWindow.setHeight("200px");
                        focXMLLayout.getUI().addWindow(optionWindow);
                    }
                }
            }
        }
    }
}

From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java

License:Apache License

public static void popupInDialog(ICentralPanel contentPanel, String title, String width, String height) {
    FocCentralPanel centralPanel = new FocCentralPanel();
    centralPanel.fill();/*from  w w w  .j a  v a2  s .  c  om*/
    centralPanel.changeCentralPanelContent(contentPanel, false);

    Window optionWindow = centralPanel.newWrapperWindow();
    optionWindow.setResizable(true);
    optionWindow.setCaption(title);

    optionWindow.setWidth(width);
    optionWindow.setHeight(height);
    //ATTENTION-MAN
    //      optionWindow.getContent().setWidth(width);
    //      optionWindow.getContent().setHeight(width);
    //ATTENTION-MAN

    FocWebApplication.getInstanceForThread().addWindow(optionWindow);
}

From source file:com.foc.web.modules.admin.OptionDialog_Form.java

License:Apache License

public Window popup() {
    Window optionWindow = null;
    fillMessage();// w w  w.  j a v a 2s . co m
    addButtons();

    if (FocWebApplication.getInstanceForThread().isMobile()) {
        getMainWindow().changeCentralPanelContent(OptionDialog_Form.this, true);
    } else {
        FocCentralPanel centralPanel = new FocCentralPanel();
        centralPanel.fill();
        centralPanel.changeCentralPanelContent(OptionDialog_Form.this, false);

        optionWindow = centralPanel.newWrapperWindow();

        optionWindow.setCaption(optionDialog.getTitle());
        optionWindow.setWidth(optionDialog.getWidth());
        optionWindow.setHeight(optionDialog.getHeight());

        FocWebApplication.getInstanceForThread().addWindow(optionWindow);
    }
    return optionWindow;
}

From source file:com.foc.web.modules.business.BusinessEssentialsWebModule.java

License:Apache License

public static FVUploadLayout_Form popupUploadLayout(IUploadReader iUploadReader) {
    FocCentralPanel centralPanel = new FocCentralPanel();
    XMLViewKey key = new XMLViewKey(BusinessEssentialsWebModule.STORAGE_UPLOAD_LAYOUT, XMLViewKey.TYPE_FORM);
    FVUploadLayout_Form uploadLayout = (FVUploadLayout_Form) XMLViewDictionary.getInstance()
            .newCentralPanel(centralPanel, key, null);
    uploadLayout.setUploadReader(iUploadReader);
    centralPanel.fill();/*from w  ww . jav a2  s . c om*/
    centralPanel.changeCentralPanelContent(uploadLayout, true);
    Window window = centralPanel.newWrapperWindow();
    window.setWidth("400px");
    window.setHeight("300px");
    FocWebApplication.getInstanceForThread().addWindow(window);
    return uploadLayout;
}

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 {//from   w  ww.j av a2s  .c o 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.mechanicshop.components.TableLayout.java

public void createCustomMessage() {
    final TextArea textArea = new TextArea();
    textArea.setImmediate(true);//from  w ww. j a  va 2 s .co  m
    textArea.setColumns(30);
    textArea.setRows(10);
    textArea.addStyleName(ValoTheme.TEXTAREA_SMALL);
    textArea.setRequired(true);
    final Window subWindow = new Window();
    subWindow.setModal(true);
    subWindow.setHeight("350px");
    subWindow.setWidth("500px");
    subWindow.setCaption("Insert Message");
    subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR);
    subWindow.setClosable(false);
    subWindow.setResizable(false);

    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    Button sendBtn = new Button("Send");
    sendBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                textArea.validate();
                String message = textArea.getValue();
                smsSenderService.sendMessageMassive(message);
                subWindow.close();
                Notification.show("Message Sent");
            } catch (Exception e) {

            }
        }
    });
    sendBtn.setImmediate(true);
    sendBtn.setStyleName(ValoTheme.BUTTON_TINY);
    sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    Button cancelBtn = new Button("Cancel");
    cancelBtn.setStyleName(ValoTheme.BUTTON_TINY);
    cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER);
    cancelBtn.setImmediate(true);
    cancelBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            subWindow.close();

        }
    });

    layoutButtons.setSizeUndefined();
    layoutButtons.setSpacing(true);
    layoutButtons.addComponents(cancelBtn, sendBtn);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.addComponent(textArea);
    layout.addComponent(layoutButtons);
    layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT);
    layout.setExpandRatio(textArea, 3);

    layout.setSizeFull();

    subWindow.setContent(layout);
    subWindow.center();

    getUI().addWindow(subWindow);
}

From source file:com.openhris.commons.reports.AdvancesReport.java

public void openAdvancesReport() {
    Connection conn = getConnection.connection();
    File reportFile = new File("C:/reportsJasper/AdvancesReport.jasper");

    final HashMap hm = new HashMap();
    hm.put("CORPORATE", getCorporate());
    hm.put("PAYROLL_DATE", getPayrollDate());

    Window subWindow = new Window("Advances Report");
    ((VerticalLayout) subWindow.getContent()).setSizeFull();
    subWindow.setWidth("800px");
    subWindow.setHeight("600px");
    subWindow.center();//from   w  ww. j ava  2s . com

    try {
        JasperPrint jpReport = JasperFillManager.fillReport(reportFile.getAbsolutePath(), hm, conn);
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = df.format(new Date());
        final String filePath = "C:/reportsPdf/AdvancesReport_" + timestamp + ".pdf";
        JasperExportManager.exportReportToPdfFile(jpReport, filePath);

        StreamResource.StreamSource source = new StreamResource.StreamSource() {
            @Override
            public InputStream getStream() {
                try {
                    File f = new File(filePath);
                    FileInputStream fis = new FileInputStream(f);
                    return fis;
                } catch (Exception e) {
                    e.getMessage();
                    return null;
                }
            }
        };

        StreamResource resource = new StreamResource(source, filePath, getApplication());
        resource.setMIMEType("application/pdf");

        Embedded e = new Embedded();
        e.setMimeType("application/pdf");
        e.setType(Embedded.TYPE_OBJECT);
        e.setSizeFull();
        e.setSource(resource);
        e.setParameter("Content-Disposition", "attachment; filename=" + resource.getFilename());

        subWindow.addComponent(e);

        getApplication().getMainWindow().open(resource, "_blank");
    } catch (Exception e) {
        e.getMessage();
    }
}

From source file:com.purebred.core.view.entityselect.EntitySelect.java

License:Open Source License

public void configurePopupWindow(Window popupWindow) {
    popupWindow.setSizeUndefined();
    popupWindow.setHeight("95%");
}

From source file:com.ribas.andrei.vaadin.OpenWindowApplication.java

License:Open Source License

private void createSubWindow(String subWindowMessage, boolean modal, Embedded iframe) {

    final Window tempSubWindow = new Window(subWindowMessage);
    tempSubWindow.setWidth("80%");
    tempSubWindow.setHeight("80%");
    tempSubWindow.center();/*from   w  w w.  j  a  va2s  . c  o  m*/
    tempSubWindow.setModal(modal);

    tempSubWindow.addListener(new Window.CloseListener() {
        public void windowClose(CloseEvent e) {
            closeWindow();
        }
    });

    tempSubWindow.addComponent(iframe);

    OpenWindowApplication.this.subWindow = tempSubWindow;

    OpenWindowApplication.this.mainWindow.addWindow(OpenWindowApplication.this.subWindow);

}

From source file:com.save.client.RemoveAccountWindow.java

void getConfirmationWindow(final String str) {
    final Window sub = new Window("Conifrm?");
    sub.setWidth("180px");
    sub.setHeight("150px");
    sub.center();//  ww w .  j a v a  2 s  .co  m
    sub.setResizable(false);
    UI.getCurrent().addWindow(sub);

    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSpacing(true);

    vlayout.addComponent(new Label("Client is a Distributor!"));

    Button removeBtn = new Button("REMOVE");
    removeBtn.setWidth("100%");
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = clientService.removeAccount(getClientId(), str);
        if (result) {
            sub.close();
            close();
        }
    });
    vlayout.addComponent(removeBtn);

    sub.setContent(vlayout);
    sub.addCloseListener((CloseEvent e) -> {
        close();
    });
}