Example usage for com.vaadin.ui Window Window

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

Introduction

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

Prototype

public Window(String caption) 

Source Link

Document

Creates a new, empty window with a given title.

Usage

From source file:org.robot.gtf.gui.GTFApplication.java

License:Apache License

private void buildNewProjectWindow() {

    // Reading in Project Data
    ProjectService projectService = new DummyProjectService();
    List<ProjectTO> projectList = projectService.read();

    final ListSelect projectSelect = new ListSelect("For main project (please select)");

    String firstElement = null;//ww w  . ja  va 2s . co m
    for (ProjectTO projectTO : projectList) {
        projectSelect.addItem(projectTO.getName());
        if (firstElement == null) {
            firstElement = projectTO.getName();
        }
    }

    projectSelect.setNullSelectionAllowed(false);
    if (firstElement != null) {
        projectSelect.select(firstElement);
    }

    // Create the window...
    newProjectWindow = new Window("New Testcase Project");
    newProjectWindow.setModal(true);
    newProjectWindow.setResizable(true);
    newProjectWindow.setParent(getWindow());

    // Configure the window layout; by default a VerticalLayout
    VerticalLayout layout = (VerticalLayout) newProjectWindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Input field for the project name
    final TextField projectName = new TextField("Name: ");
    newProjectWindow.addComponent(projectName);

    newProjectWindow.addComponent(projectSelect);

    // Definition of buttons
    HorizontalLayout buttons = new HorizontalLayout();

    Button loadButton = new Button("Load", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            String projectNameValue = (String) projectName.getValue();
            String projectSelectValue = (String) projectSelect.getValue();

            if (projectNameValue == null || projectNameValue.isEmpty()) {
                getWindow().showNotification("Mandatory value missing",
                        "Please give a name for the new Testcase Project", Notification.TYPE_ERROR_MESSAGE);

            } else {
                getWindow().removeWindow(newProjectWindow);
                createTestdataProject(projectSelectValue, projectNameValue);
            }
        }
    });

    Button abortButton = new Button("Abort", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            (newProjectWindow.getParent()).removeWindow(newProjectWindow);
        }
    });

    buttons.addComponent(loadButton);
    buttons.addComponent(abortButton);

    layout.addComponent(buttons);
}

From source file:org.robot.gtf.gui.GTFApplication.java

License:Apache License

private void buildAboutWindow() {

    // Create the window...
    aboutWindow = new Window("About");
    aboutWindow.setModal(true);//from   w  ww  .j  av  a2 s . c  o m
    aboutWindow.setResizable(false);
    aboutWindow.setWidth(350, Window.UNITS_PIXELS);
    aboutWindow.setHeight(180, Window.UNITS_PIXELS);

    // Configure the window layout; by default a VerticalLayout
    VerticalLayout layout = (VerticalLayout) aboutWindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Add some content; a label and a close-button
    Label message = new Label(TextResources.getAboutText());
    message.setContentMode(Label.CONTENT_XHTML);
    aboutWindow.addComponent(message);

    Button close = new Button("Close", new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            (aboutWindow.getParent()).removeWindow(aboutWindow);
        }
    });

    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.addComponent(close);
    layout.setComponentAlignment(close, Alignment.TOP_RIGHT);
}

From source file:org.s23m.cell.editor.semanticdomain.Editor.java

License:Mozilla Public License

@Override
public void init() {
    EditorController.getInstance().setEditor(this);
    mainWindow = new Window("Gmodel");
    //mainWindow.addComponent(pusher);
    setMainWindow(mainWindow);/*from w ww  . j  a  v a2 s  . com*/
    setTheme(THEME_NAME);

    initializeGmodelKernel();

    final HorizontalSplitPanel splitter = new HorizontalSplitPanel();
    splitter.setSplitPosition(DEFAULT_L_WIDTH, Sizeable.UNITS_PIXELS);
    mainWindow.setContent(splitter);

    containmentTreePanel = new ContainmentTreePanel(this);
    multitabPanel = new MultitabPanel(this);
    //((VerticalLayout)multitabPanel.getConsole().getParent()).addComponent(pusher);
    splitter.addComponent(containmentTreePanel);
    splitter.addComponent(multitabPanel);
}

From source file:org.semanticsoft.vaaclipse.app.VaadinApplication.java

License:Open Source License

@Override
public void init() {
    context = VaadinE4Application.getInstance().getAppContext();
    logger = VaadinE4Application.getInstance().getLogger();

    //--user agent detection
    //      if (this.getContext() instanceof WebApplicationContext) {
    //         String userAgent = ((WebApplicationContext)this.getContext()).getBrowser().getBrowserApplication();
    //         if (userAgent.contains("MSIE"))
    //         {//from ww w  .j  a  v  a2  s. c  o m
    //            String str = "<html><br/>Vaaclipse currently does not support Internet Explorer.<br/><br/>" +
    //                  "Please use one of the browser from list:<br/><ul><li>Mozilla Firefox (recomended)</li> <li>Google Chrome or Chromium</li> <li>Opera</li> <li>Safari</li> <li>Rekonq</li> <li>Any other not listed browser based on Webkit</li></ul></html>";
    //            Label errorLabel = new Label(str, Label.CONTENT_XHTML);
    //            mainWindow.getContent().addComponent(errorLabel);
    //            return;
    //         }
    //      }
    //--

    //-------------------------------------
    prepareEnvironment(context);

    IEventBroker eventBroker = appContext.get(EventBroker.class);

    eventBroker.subscribe(ThemeConstants.Events.setThemeEvent, new EventHandler() {

        @Override
        public void handleEvent(Event event) {
            Theme theme = (Theme) event.getProperty(IEventBroker.DATA);
            if (theme != null) {
                HttpSession session = ((WebApplicationContext) getContext()).getHttpSession();
                session.setAttribute(ThemeConstants.Attrubutes.themeid, theme.getId());
                setThemeInternal(theme.getWebId());
            }
        }
    });

    String themeId = VaadinE4Application.getInstance().getCssTheme();
    ThemeManager themeManager = appContext.get(ThemeManager.class);
    themeManager.setTheme(themeId);

    String authProvider = VaadinE4Application.getInstance().getApplicationAuthenticationProvider();

    if (authProvider == null || authProvider.trim().isEmpty()) {
        //start workbench as usually
        e4Workbench = createE4Workbench(context);
        e4Workbench.createAndRunUI(e4Workbench.getApplication());
    } else {
        final Window window = new Window("Login");
        window.setSizeFull();
        setMainWindow(window);

        eventBroker.subscribe(AuthenticationConstants.Events.Authentication, new EventHandler() {

            @Override
            public void handleEvent(Event event) {
                Object data = event.getProperty(EventUtils.DATA);
                if (data instanceof User) {
                    //login user:
                    user = (User) data;

                    //TODO: Now we can load persistande model of this user (not implemented yet, just load initial model)
                    e4Workbench = createE4Workbench(context);
                    e4Workbench.createAndRunUI(e4Workbench.getApplication());
                }
            }
        });

        IContributionFactory contributionFactory = (IContributionFactory) appContext
                .get(IContributionFactory.class.getName());
        IEclipseContext authConext = appContext.createChild();
        VerticalLayout windowContent = new VerticalLayout();
        windowContent.setSizeFull();
        window.setContent(windowContent);
        authConext.set(ComponentContainer.class, windowContent);
        authConext.set(VerticalLayout.class, windowContent);
        Object authProviderObj = contributionFactory.create(authProvider, authConext);
        System.out.println(authProvider);
    }
}

From source file:org.semanticsoft.vaadinaddons.boundsinfo.BoundsinfoApplication.java

License:Open Source License

@Override
public void init() {
    Window mainWindow = new Window("Boundsinfo Application");
    Label label = new Label("Hello Vaadin user");
    mainWindow.addComponent(label);//from   ww w.  j a v  a  2 s .c o  m
    setMainWindow(mainWindow);
}

From source file:org.tltv.gantt.demo.DemoUI.java

License:Apache License

private void openStepEditor(AbstractStep step) {
    final Window win = new Window("Step Editor");
    win.setResizable(false);/*from w ww.  j a v  a 2s  .  c  o m*/
    win.center();

    final Collection<Component> hidden = new ArrayList<Component>();

    BeanItem<AbstractStep> item = new BeanItem<AbstractStep>(step);

    final FieldGroup group = new FieldGroup(item);
    group.setBuffered(true);

    TextField captionField = new TextField("Caption");
    captionField.setNullRepresentation("");
    group.bind(captionField, "caption");

    TextField descriptionField = new TextField("Description");
    descriptionField.setNullRepresentation("");
    group.bind(descriptionField, "description");
    descriptionField.setVisible(false);
    hidden.add(descriptionField);

    NativeSelect captionMode = new NativeSelect("Caption Mode");
    captionMode.addItem(Step.CaptionMode.TEXT);
    captionMode.addItem(Step.CaptionMode.HTML);
    group.bind(captionMode, "captionMode");
    captionMode.setVisible(false);
    hidden.add(captionMode);

    CheckBox showProgress = new CheckBox("Show progress");
    group.bind(showProgress, "showProgress");
    showProgress.setVisible(false);
    hidden.add(showProgress);

    Slider progress = new Slider("Progress");
    progress.setWidth(100, Unit.PERCENTAGE);
    group.bind(progress, "progress");
    progress.setVisible(false);
    hidden.add(progress);

    NativeSelect predecessorSelect = new NativeSelect("Predecessor Step");
    predecessorSelect.setWidth(100, Unit.PERCENTAGE);
    fillPredecessorCanditatesToSelect(step, predecessorSelect);
    predecessorSelect.setEnabled(step instanceof Step);
    if (step instanceof Step) {
        group.bind(predecessorSelect, "predecessor");
    }
    predecessorSelect.setVisible(false);
    hidden.add(predecessorSelect);

    final NativeSelect parentStepSelect = new NativeSelect("Parent Step");
    parentStepSelect.setWidth(100, Unit.PERCENTAGE);
    parentStepSelect.setEnabled(false);
    fillParentStepCanditatesToSelect(step, parentStepSelect);
    parentStepSelect.setVisible(false);
    hidden.add(parentStepSelect);

    HorizontalLayout colorLayout = new HorizontalLayout();
    colorLayout.setWidth(100, Unit.PERCENTAGE);
    colorLayout.setVisible(false);
    hidden.add(colorLayout);

    final TextField bgField = new TextField("Background color");
    bgField.setNullRepresentation("");
    group.bind(bgField, "backgroundColor");
    bgField.setEnabled(false);

    final ColorPicker bgColorPicker = new ColorPicker();
    bgColorPicker.setPosition(300, 100);
    bgColorPicker.setColor(new CssColorToColorPickerConverter().convertToModel(step.getBackgroundColor()));
    bgColorPicker.addColorChangeListener(new ColorChangeListener() {
        @Override
        public void colorChanged(ColorChangeEvent event) {
            bgField.setValue(event.getColor().getCSS());
        }
    });

    colorLayout.addComponent(bgField);
    colorLayout.addComponent(bgColorPicker);
    colorLayout.setExpandRatio(bgField, 1);
    colorLayout.setComponentAlignment(bgColorPicker, Alignment.BOTTOM_LEFT);

    DateField startDate = new DateField("Start date");
    startDate.setLocale(gantt.getLocale());
    startDate.setTimeZone(gantt.getTimeZone());
    startDate.setResolution(Resolution.SECOND);
    startDate.setConverter(new DateToLongConverter());
    group.bind(startDate, "startDate");

    DateField endDate = new DateField("End date");
    endDate.setLocale(gantt.getLocale());
    endDate.setTimeZone(gantt.getTimeZone());
    endDate.setResolution(Resolution.SECOND);
    endDate.setConverter(new DateToLongConverter());
    group.bind(endDate, "endDate");

    CheckBox showMore = new CheckBox("Show all settings");
    showMore.addValueChangeListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            for (Component c : hidden) {
                c.setVisible((Boolean) event.getProperty().getValue());
            }
            win.center();
        }
    });

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    win.setContent(content);

    content.addComponent(captionField);
    content.addComponent(captionMode);
    content.addComponent(descriptionField);
    content.addComponent(showProgress);
    content.addComponent(progress);
    content.addComponent(predecessorSelect);
    content.addComponent(parentStepSelect);
    content.addComponent(colorLayout);
    content.addComponent(startDate);
    content.addComponent(endDate);
    content.addComponent(showMore);

    HorizontalLayout buttons = new HorizontalLayout();
    content.addComponent(buttons);

    Button ok = new Button("Ok", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            commit(win, group, parentStepSelect);
        }

    });
    Button cancel = new Button("Cancel", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            cancel(win, group);
        }
    });
    Button delete = new Button("Delete", new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            delete(win, group);
        }

    });
    buttons.addComponent(ok);
    buttons.addComponent(cancel);
    buttons.addComponent(delete);
    win.setClosable(true);

    getUI().addWindow(win);
}

From source file:org.universAAL.ucc.controller.desktop.ToolController.java

public void buttonClick(ClickEvent event) {
    if (event.getButton() == toolWin.getuStoreButton()) {
        Embedded em = new Embedded("", new ExternalResource(createLink()));
        em.setType(Embedded.TYPE_BROWSER);
        em.setWidth("100%");
        em.setHeight("850px");
        Window w = new Window("uStore");
        w.setWidth("1250px");
        w.setHeight("800px");
        VerticalLayout v = new VerticalLayout();
        w.center();/*from   w ww .  j  a  v a  2 s . c o  m*/
        v.addComponent(em);
        w.setContent(v);
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(w);
    }
    if (event.getButton() == toolWin.getOpenAAL()) {
        //         Embedded em = new Embedded("", new ExternalResource(
        //               "http://wiki.openaal.org"));
        //         em.setType(Embedded.TYPE_BROWSER);
        //         em.setWidth("100%");
        //         em.setHeight("800px");
        //         Window w = new Window("openAAL");
        //         w.setWidth("1250px");
        //         w.setHeight("800px");
        //         VerticalLayout v = new VerticalLayout();
        //         w.center();
        //         v.addComponent(em);
        //         w.setContent(v);
        BrowseServicesWindow pw = new BrowseServicesWindow(app);
        PurchasedServicesController pc = new PurchasedServicesController(pw, app);
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(pw);
    }
    if (event.getButton() == toolWin.getInstallButton()) {
        // Later uncomment again only for testing commented out!
        Upload up = new Upload("", new AALServiceReceiver());
        up.setButtonCaption(res.getString("install.button"));
        up.addListener((Upload.FinishedListener) this);
        up.addListener((Upload.FailedListener) this);
        installWindow = new Window(res.getString("install.win.caption"));
        installWindow.setResizable(false);
        installWindow.center();
        installWindow.setWidth("400px");
        VerticalLayout v = new VerticalLayout();
        v.setSizeFull();
        v.setSpacing(true);
        v.setMargin(true);
        v.addComponent(up);
        installWindow.setContent(v);

        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(installWindow);
    }
    if (event.getButton() == toolWin.getLogoutButton()) {
        DesktopController.setCurrentPassword("");
        DesktopController.setCurrentUser("");
        //         if(!DesktopController.web.getSocket().isClosed()) {
        //            try {
        //               DesktopController.web.getSocket().close();
        //            } catch (IOException e) {
        //               e.printStackTrace();
        //            }
        //         }
        app.close();
    }

    if (event.getButton() == toolWin.getUninstallButton()) {
        app.getMainWindow().removeWindow(toolWin);
        List<RegisteredService> ids = new ArrayList<RegisteredService>();
        Document doc = Model.getSrvDocument();
        NodeList nodeList = doc.getElementsByTagName("service");
        for (int i = 0; i < nodeList.getLength(); i++) {
            RegisteredService srv = new RegisteredService();
            Element element = (Element) nodeList.item(i);
            System.err.println(element.getAttribute("serviceId"));
            srv.setServiceId(element.getAttribute("serviceId"));
            NodeList srvChilds = element.getChildNodes();
            for (int j = 0; j < srvChilds.getLength(); j++) {
                Node n = srvChilds.item(j);
                if (n.getNodeName().equals("application")) {
                    Element e = (Element) n;
                    srv.getAppId().add(e.getAttribute("appId"));
                }
                if (n.getNodeName().equals("bundle")) {
                    Element b = (Element) n;
                    srv.getBundleId().add(b.getAttribute("id"));
                    srv.setBundleVersion(b.getAttribute("version"));
                }
                if (n.getNodeName().equals("menuEntry")) {
                    Element e = (Element) n;
                    srv.setMenuName(e.getAttribute("entryName"));
                    srv.setIconURL(e.getAttribute("iconURL"));
                    srv.setProvider(e.getAttribute("vendor"));
                    srv.setServiceClass(e.getAttribute("serviceClass"));
                    srv.setUserID(e.getAttribute("userID"));
                }
            }
            ids.add(srv);
        }
        DeinstallWindow dw = new DeinstallWindow(ids);
        app.getMainWindow().addWindow(dw);
        DeinstallController dc = new DeinstallController(dw, app);
        //         frontend.uninstallService(Activator.getSessionKey(), "28002");
        //         frontend.getInstalledUnitsForService(Activator.getSessionKey(), "28002");
    }

    if (event.getButton() == toolWin.getPersonButton()) {
        AddNewPersonWindow apw = null;
        try {
            apw = new AddNewPersonWindow(null, null, app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(apw);
    }
    if (event.getButton() == toolWin.getConfigButton()) {
        AddNewHardwareWindow anhw = null;
        try {
            anhw = new AddNewHardwareWindow(null, null, app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(anhw);
    }
    if (event.getButton() == toolWin.getEditHW()) {
        RoomsWindow hardWare = null;
        try {
            hardWare = new RoomsWindow(app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(hardWare);

    }

    if (event.getButton() == toolWin.getEditPerson()) {
        HumansWindow hw = null;
        try {
            hw = new HumansWindow(app);
        } catch (JAXBException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(hw);
    }
    if (event.getButton() == toolWin.getEditUC()) {
        WhichBundleShouldBeConfiguredWindow uc = new WhichBundleShouldBeConfiguredWindow("Use Cases");
        app.getMainWindow().removeWindow(toolWin);
        app.getMainWindow().addWindow(uc);

    }

}

From source file:org.vaadin.addons.criteriacontainersample.AbstractBeanTupleApplication.java

License:Apache License

@Override
public void init() {

    Window mainWindow = new Window("Tuple Application");
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setMargin(true);/*from  w w  w .j a  va 2  s  .  c  o m*/
    mainLayout.setSpacing(true);
    mainWindow.setContent(mainLayout);

    Panel filterPanel = new Panel();
    createTopPanel(mainWindow, filterPanel);

    entityManager = ENTITY_MANAGER_FACTORY.createEntityManager();
    criteriaContainer = createTupleContainer();
    int size = criteriaContainer.size();
    if (size == 0) {
        createEntities();
        // must refresh container to recompute size (table would be empty otherwise)
        criteriaContainer.refresh();
        size = criteriaContainer.size();
    }

    createTable(criteriaContainer);
    mainWindow.addComponent(table);
    setMainWindow(mainWindow);
}

From source file:org.vaadin.addons.criteriacontainersample.AbstractEntityApplication.java

License:Apache License

@Override
public void init() {

    Window mainWindow = new Window("Lazycontainer Application");

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();// ww  w.  jav  a  2s  . com
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    createFilterPanel(mainLayout);

    entityManager = ENTITY_MANAGER_FACTORY.createEntityManager();
    criteriaContainer = createTaskContainer();

    int size = criteriaContainer.size();
    if (size == 0 && TESTING) {
        createEntities();
        criteriaContainer.refresh();
        size = criteriaContainer.size();
    }

    createTable(criteriaContainer);
    table.setPageLength(0);
    table.setSizeUndefined();
    table.setHeight("100%");
    mainLayout.addComponent(table);
    mainLayout.setExpandRatio(table, 100.0F);

    mainWindow.setContent(mainLayout);
    setMainWindow(mainWindow);
}

From source file:org.vaadin.addons.forms.LocationApplication.java

License:Apache License

public void init() {
    Window mainWindow = new Window("Location Form Sample");

    Button button = new Button("Open Location Form");
    button.setWidth("150px");
    button.setHeight("30px");
    button.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            Window window = new Window("Update Location");
            window.addComponent(new LocationForm());
            window.setModal(true);/*from  w  w w.  j  a v a2 s .  c o m*/
            window.setResizable(false);
            window.setWidth("510px");
            window.setHeight("370px");
            getMainWindow().addWindow(window);
            window.center();
        }
    });
    mainWindow.addComponent(button);
    setMainWindow(mainWindow);
}