Example usage for com.vaadin.ui Window setSizeUndefined

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

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java

License:Open Source License

public void appendImportMenu(CustomMenuBar.MenuItem parent, CustomMenuBar.MenuItem beforeItem) {
    final Window importWindow = new Window() {
        private static final long serialVersionUID = -397373017493034496L;

        @Override/*from  ww w . j  a  v a  2  s .c  om*/
        public void close() {
            setVisible(false);
        }
    };
    importWindow.setCaption("Import from sequence");
    importWindow.setResizable(false);

    final CanvasImport canvasImport = new CanvasImport();
    importWindow.getContent().addComponent(canvasImport);
    importWindow.center();
    importWindow.setVisible(false);

    @SuppressWarnings("unused")
    CustomMenuBar.MenuItem importMenu = parent.addItemBefore("Import", null, new CustomMenuBar.Command() {
        private static final long serialVersionUID = -6735134306275926140L;

        @Override
        public void menuSelected(CustomMenuBar.MenuItem selectedItem) {
            if (!importWindow.isVisible()) {
                if (getWindow().getChildWindows().contains(importWindow) == false) {
                    getWindow().addWindow(importWindow);
                }

                importWindow.setVisible(true);
            }
        }
    }, beforeItem);

    importWindow.setSizeUndefined();
    importWindow.getContent().setSizeUndefined();

    final Window importFromStringWindow = new Window() {
        private static final long serialVersionUID = 7035248961169308096L;

        @Override
        public void close() {
            setVisible(false);
        }
    };

    importFromStringWindow.setCaption("Import sequence from string");
    importFromStringWindow.setWidth("400px");

    final ImportStructureFromStringDialog importStructureStringDialog = new ImportStructureFromStringDialog(
            theCanvas);

    importStructureStringDialog.addListener(new UserInputEndedListener() {
        @Override
        public void done(boolean cancelled) {
            if (!cancelled) {
                if (!theCanvas.theDoc.importFromString(importStructureStringDialog.getSequenceString(),
                        theCanvas
                                .getImportFormatShortFormat(importStructureStringDialog.getSequenceFormat()))) {
                    IGGApplication.reportMessage(LogUtils.getLastError());

                    LogUtils.clearLastError();
                }
            }
        }
    });

    WeeLayout layout = new WeeLayout(Direction.VERTICAL);
    layout.setSizeFull();
    importFromStringWindow.setContent(layout);
    layout.addComponent(importStructureStringDialog, Alignment.MIDDLE_CENTER);

    importFromStringWindow.center();
    importFromStringWindow.setVisible(false);

    @SuppressWarnings("unused")
    CustomMenuBar.MenuItem importFromStringMenu = parent.addItemBefore("Import from string", null,
            new CustomMenuBar.Command() {
                private static final long serialVersionUID = 1586089744665899803L;

                @Override
                public void menuSelected(CustomMenuBar.MenuItem selectedItem) {
                    if (!importFromStringWindow.isVisible()) {
                        if (getWindow().getChildWindows().contains(importFromStringWindow) == false) {
                            getWindow().addWindow(importFromStringWindow);
                        }

                        importFromStringWindow.setVisible(true);
                    }
                }
            }, beforeItem);
}

From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java

License:Open Source License

public void appendNotationMenu(CustomMenuBar.MenuItem parent) {
    final HashMap<String, String> notationIndex = new HashMap<String, String>();

    CustomMenuBar.Command notationChangeCommand = new CustomMenuBar.Command() {
        private static final long serialVersionUID = 5081687058270283137L;

        @Override//from  w  ww . j a va  2s .co  m
        public void menuSelected(CustomMenuBar.MenuItem selectedItem) {
            String notation = notationIndex.get(selectedItem.getText());
            theCanvas.setNotation(notation);
        }
    };

    parent.addItem("CFG notation", notationChangeCommand);
    notationIndex.put("CFG notation", GraphicOptions.NOTATION_CFG);

    parent.addItem("CFG black and white notation", notationChangeCommand);
    notationIndex.put("CFG black and white notation", GraphicOptions.NOTATION_CFGBW);

    parent.addItem("CFG with linkage placement notation", notationChangeCommand);
    notationIndex.put("CFG with linkage placement notation", GraphicOptions.NOTATION_CFGLINK);

    parent.addItem("UOXF notation", notationChangeCommand);
    notationIndex.put("UOXF notation", GraphicOptions.NOTATION_UOXF);

    parent.addItem("UOXFCOL notation", notationChangeCommand);
    notationIndex.put("UOXFCOL notation", GraphicOptions.NOTATION_UOXFCOL);

    parent.addItem("Text only notation", notationChangeCommand);
    notationIndex.put("Text only notation", GraphicOptions.NOTATION_TEXT);

    parent.addItem("Show Masses", new ThemeResource("icons/uncheckedbox.png"), new CustomMenuBar.Command() {
        private static final long serialVersionUID = 6140157670134115820L;

        @Override
        public void menuSelected(CustomMenuBar.MenuItem selectedItem) {
            //selectedItem.setIcon(arg0);

            boolean showMasses = theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS;

            if (showMasses) {
                theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS = false;
                selectedItem.setIcon(new ThemeResource("icons/uncheckedbox.png"));
            } else {
                theCanvas.theWorkspace.getGraphicOptions().SHOW_MASSES_CANVAS = true;
                selectedItem.setIcon(new ThemeResource("icons/checkbox.png"));
            }

            theCanvas.documentUpdated();
        }
    });

    parent.addItem("Show reducing end symbol", new ThemeResource("icons/uncheckedbox.png"),
            new CustomMenuBar.Command() {
                private static final long serialVersionUID = -5209359926737326181L;

                @Override
                public void menuSelected(CustomMenuBar.MenuItem selectedItem) {
                    boolean showRedEnd = theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS;

                    if (showRedEnd) {
                        theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS = false;
                        selectedItem.setIcon(new ThemeResource("icons/uncheckedbox.png"));
                    } else {
                        theCanvas.theWorkspace.getGraphicOptions().SHOW_REDEND_CANVAS = true;
                        selectedItem.setIcon(new ThemeResource("icons/checkbox.png"));
                    }

                    theCanvas.documentUpdated();
                }
            });

    final Window massOptionsDialog = new Window() {
        private static final long serialVersionUID = -5094399884130705221L;

        @Override
        public void close() {
            setVisible(false);
        }
    };

    massOptionsDialog.setResizable(false);
    //massOptionsDialog.setIcon(new ThemeResource("icons/massoptions.png"));

    massOptionsDialog.setCaption("Mass options");

    MassOptionsDialog dialog = new MassOptionsDialog(theCanvas.theDoc.getStructures(),
            theCanvas.theWorkspace.getDefaultMassOptions());

    dialog.addMassOptionListener(this);

    massOptionsDialog.addComponent(dialog);

    ((VerticalLayout) massOptionsDialog.getContent()).setComponentAlignment(dialog, Alignment.MIDDLE_CENTER);

    massOptionsDialog.setVisible(false);

    massOptionsDialog.center();

    parent.addItem("Mass options", new CustomMenuBar.Command() {
        private static final long serialVersionUID = -589321392382766804L;

        @Override
        public void menuSelected(CustomMenuBar.MenuItem selectedItem) {
            if (massOptionsDialog.getParent() == null) {
                getWindow().addWindow(massOptionsDialog);
            }

            massOptionsDialog.setVisible(true);
        }
    });

    massOptionsDialog.setSizeUndefined();
    massOptionsDialog.getContent().setSizeUndefined();
}

From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java

License:Open Source License

@Override
public void recieveSelectionUpdate(double x, double y, double width, double height, boolean mouseMoved) {
    final Residue selectedResidue = theCanvas.getCurrentResidue();

    theCanvas.selectIntersectingRectangles(x, y, width, height, mouseMoved);

    if (theCanvas.getCurrentResidue() != null && selectedResidue == theCanvas.getCurrentResidue()
            && selectedResidue.isRepetition()) {
        final Window window = new Window("Repeatition options");

        WeeLayout layout = new WeeLayout(org.vaadin.weelayout.WeeLayout.Direction.VERTICAL);

        final TextField minRep = new TextField("Minimum");
        final TextField maxRep = new TextField("Maximum");
        NativeButton okBut = new NativeButton("Ok");
        NativeButton cancelBut = new NativeButton("Cancel");

        minRep.setImmediate(true);//from   w w  w . ja v  a  2  s.c om
        maxRep.setImmediate(true);

        minRep.setValue(String.valueOf(selectedResidue.getMinRepetitions()));
        maxRep.setValue(String.valueOf(selectedResidue.getMaxRepetitions()));

        okBut.addListener(new ClickListener() {
            private static final long serialVersionUID = -408364885359729326L;

            @Override
            public void buttonClick(ClickEvent event) {
                String minRepNum = (String) minRep.getValue();
                String maxRepNum = (String) maxRep.getValue();

                boolean valid = true;

                try {
                    Integer.parseInt(minRepNum);
                    Integer.parseInt(maxRepNum);
                } catch (NumberFormatException ex) {
                    valid = false;
                }

                if (valid) {
                    selectedResidue.setMinRepetitions((String) minRep.getValue());
                    selectedResidue.setMaxRepetitions((String) maxRep.getValue());

                    theCanvas.documentUpdated();
                }

                getWindow().removeWindow(window);
            }
        });

        cancelBut.addListener(new ClickListener() {
            private static final long serialVersionUID = -657746118918366530L;

            @Override
            public void buttonClick(ClickEvent event) {
                getWindow().removeWindow(window);
            }
        });

        layout.addComponent(minRep, Alignment.TOP_CENTER);
        layout.addComponent(maxRep, Alignment.MIDDLE_CENTER);

        WeeLayout buttonLayout = new WeeLayout(Direction.HORIZONTAL);
        buttonLayout.addComponent(okBut, Alignment.TOP_CENTER);
        buttonLayout.addComponent(cancelBut, Alignment.TOP_CENTER);

        layout.addComponent(buttonLayout, Alignment.BOTTOM_CENTER);

        window.center();
        window.getContent().addComponent(layout);

        window.getContent().setSizeUndefined();
        window.setSizeUndefined();

        getWindow().addWindow(window);
    }
}

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

License:Open Source License

/**
 * Configures the popup window size at 95% height and undefined width.
 * May be overriden to customize size.//  w  w w . j  a v a2  s .c o m
 *
 * @param popupWindow popup window available custome configuration
 */
protected void configurePopupWindow(Window popupWindow) {
    popupWindow.setSizeUndefined();
    popupWindow.setHeight("95%");
}

From source file:com.hivesys.dashboard.view.repository.DragAndDropBox.java

private void showComponent(final Component c, final String name) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setSizeUndefined();//  w w w.j a  v a 2s  . com
    layout.setMargin(true);
    final Window w = new Window(name, layout);
    w.addStyleName("dropdisplaywindow");
    w.setSizeUndefined();
    w.setResizable(false);
    c.setSizeUndefined();
    layout.addComponent(c);
    UI.getCurrent().addWindow(w);

}

From source file:com.liferay.mail.vaadin.PreferencesView.java

License:Open Source License

private void editAccount(Account account) {

    String windowTitle = Lang.get(account == null ? "add-mail-account" : "edit-account");
    final Window editorWindow = new Window(windowTitle);
    editorWindow.setSizeUndefined();
    editorWindow.center();/* w  w w  .  j a  va  2s  .c o  m*/
    editorWindow.setModal(true);
    editorWindow.setResizable(false);

    AccountEditor.AccountEditorListener listener = new SaveAccountListener(editorWindow);

    // show a pre-filled edit dialog
    AccountEditor editor = new AccountEditor(account, controller, listener);
    editorWindow.setContent(editor);
    controller.getApplication().getMainWindow().addWindow(editorWindow);
}

From source file:com.liferay.mail.vaadin.PreferencesView.java

License:Open Source License

private void editGmailAccount(Account account) {
    String windowTitle = Lang.get(account == null ? "add-gmail-account" : "edit-gmail-account");
    final Window editorWindow = new Window(windowTitle);
    editorWindow.setSizeUndefined();
    editorWindow.center();//from w w  w.j a v  a 2  s . c  om
    editorWindow.setModal(true);
    editorWindow.setResizable(false);

    AccountEditor.AccountEditorListener listener = new SaveAccountListener(editorWindow);

    // show a pre-filled edit dialog
    AccountEditor editor = new GMailAccountEditor(account, controller, listener);
    editorWindow.setContent(editor);
    controller.getApplication().getMainWindow().addWindow(editorWindow);
}

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:de.symeda.sormas.ui.samples.SampleController.java

License:Open Source License

private void requestSampleCollectionTaskCreation(SampleDto dto, SampleEditForm form) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//w  w  w. j a v a2s.  c om

    ConfirmationComponent requestTaskComponent = VaadinUiUtil.buildYesNoConfirmationComponent();

    Label description = new Label(I18nProperties.getString(Strings.messageCreateCollectionTask),
            ContentMode.HTML);
    description.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(description);
    layout.addComponent(requestTaskComponent);
    layout.setComponentAlignment(requestTaskComponent, Alignment.BOTTOM_RIGHT);
    layout.setSizeUndefined();
    layout.setSpacing(true);

    Window popupWindow = VaadinUiUtil.showPopupWindow(layout);
    popupWindow.setSizeUndefined();
    popupWindow.setCaption(I18nProperties.getString(Strings.headingCreateNewTaskQuestion));
    requestTaskComponent.getConfirmButton().addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            popupWindow.close();
            ControllerProvider.getTaskController().createSampleCollectionTask(TaskContext.CASE,
                    dto.getAssociatedCase(), dto);
        }
    });
    requestTaskComponent.getCancelButton().addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

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

From source file:de.symeda.sormas.ui.samples.SampleController.java

License:Open Source License

public void showChangePathogenTestResultWindow(CommitDiscardWrapperComponent<SampleEditForm> editComponent,
        String sampleUuid, PathogenTestResultType newResult) {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*from w  w w  . ja  v a2 s  . co m*/

    ConfirmationComponent confirmationComponent = VaadinUiUtil.buildYesNoConfirmationComponent();

    Label description = new Label(String
            .format(I18nProperties.getString(Strings.messageChangePathogenTestResult), newResult.toString()));
    description.setWidth(100, Unit.PERCENTAGE);
    layout.addComponent(description);
    layout.addComponent(confirmationComponent);
    layout.setComponentAlignment(confirmationComponent, Alignment.BOTTOM_RIGHT);
    layout.setSizeUndefined();
    layout.setSpacing(true);

    Window popupWindow = VaadinUiUtil.showPopupWindow(layout);
    popupWindow.setSizeUndefined();
    popupWindow.setCaption(I18nProperties.getString(Strings.headingChangePathogenTestResult));
    confirmationComponent.getConfirmButton().addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            editComponent.commit();
            SampleDto sample = FacadeProvider.getSampleFacade().getSampleByUuid(sampleUuid);
            sample.setPathogenTestResult(newResult);
            FacadeProvider.getSampleFacade().saveSample(sample);
            popupWindow.close();
            SormasUI.refreshView();
        }
    });
    confirmationComponent.getCancelButton().addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

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