Example usage for com.vaadin.ui Window isVisible

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

Introduction

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

Prototype

@Override
    public boolean isVisible() 

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  .  co  m*/
        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:org.lightframe.components.WindowManager.java

License:Apache License

@Override
@SuppressWarnings("unchecked")
public void changeVariables(Object source, Map variables) {
    super.changeVariables(source, variables);

    if (variables.containsKey(VWindowManager.ATTRIBUTE_CS_WINDOW_CLOSE)) {
        Integer closedWindowIndex = (Integer) variables.get(VWindowManager.ATTRIBUTE_CS_WINDOW_CLOSE);
        closeWindow(managedWindows.get(closedWindowIndex));
        requestRepaint();//  ww w  .j a v  a 2s . c o m
    }

    if (variables.containsKey(VWindowManager.ATTRIBUTE_CS_WINDOW_MINIMIZE)) {
        Integer minimizedWindowIndex = (Integer) variables.get(VWindowManager.ATTRIBUTE_CS_WINDOW_MINIMIZE);
        Window window = managedWindows.get(minimizedWindowIndex);
        window.setVisible(!window.isVisible());
        requestRepaint();
    }
}

From source file:org.lightframe.components.WindowManager.java

License:Apache License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    super.paintContent(target);

    Object[] windowNames = new String[managedWindows.size()];
    Object[] minimizedWindows = new Integer[managedWindows.size()];

    for (int i = 0; i < managedWindows.size(); i++) {
        final Window window = managedWindows.get(i);
        windowNames[i] = window.getCaption();
        minimizedWindows[i] = window.isVisible() ? 0 : 1;
    }// w w  w . j  a v a2s  . com

    target.addAttribute(VWindowManager.ATTRIBUTE_SC_WINDOW_NAMES, windowNames);
    target.addAttribute(VWindowManager.ATTRIBUTE_SC_WINDOW_MINIMZED, minimizedWindows);
}