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:roart.client.MyVaadinUI.java

private Window getLoginWindow() {
    final Window window = new Window("Login");
    window.setWidth("30%");
    window.setHeight("30%");
    window.center();//from   w w  w .j  a va2 s  .com
    final TextField login = new TextField("Username");
    final PasswordField password = new PasswordField("Password");
    Button button = new Button("Login");
    button.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            tryLogin(login.getValue(), password.getValue());
            window.close();
        }
    });
    VerticalLayout vert = new VerticalLayout();
    vert.addComponent(login);
    vert.addComponent(password);
    vert.addComponent(button);
    window.setContent(vert);
    return window;
}

From source file:rs.pupin.jpo.dsdrepo.DSDRepoApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("DSD Repo");
    setMainWindow(window);// www  . j av  a  2 s.  com
    setTheme("esta-ld");

    String endpoint = "http://localhost:8890/sparql";

    SPARQLRepository repository = new SPARQLRepository(endpoint);
    try {
        repository.initialize();
    } catch (RepositoryException ex) {
        Logger.getLogger(EstaLdComponent.class.getName()).log(Level.SEVERE, null, ex);
    }

    try {
        RepositoryConnection conn = repository.getConnection();
        conn.prepareGraphQuery(QueryLanguage.SPARQL, "DROP GRAPH <http://regular-data-replica/>").evaluate();
        conn.prepareGraphQuery(QueryLanguage.SPARQL, "CREATE GRAPH <http://regular-data-replica/>").evaluate();
        String query = "INSERT INTO GRAPH <http://regular-data-replica/> {?s ?p ?o } "
                + "WHERE { GRAPH <http://validation-test/regular-data-nolabels/> { ?s ?p ?o } }";
        conn.prepareGraphQuery(QueryLanguage.SPARQL, query).evaluate();
    } catch (RepositoryException ex) {
        Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
    } catch (MalformedQueryException ex) {
        Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
    } catch (QueryEvaluationException ex) {
        Logger.getLogger(DSDRepoComponent.class.getName()).log(Level.SEVERE, null, ex);
    }

    DSDRepoComponent component = new DSDRepoComponent(repository, "http://regular-data-replica/",
            "http://validation-test/regular-dsd-nolabels/");

    window.addComponent(component);
}

From source file:rs.pupin.jpo.esta_ld.InspectApplication.java

@Override
public void init() {
    window = new Window("ESTA-LD: Inspect and Prepare");
    window.addStyleName("estald-window");
    window.addParameterHandler(new ParameterHandler() {
        public void handleParameters(Map<String, String[]> parameters) {
            if (!first)
                return;
            first = false;/*from w  w w.  j a v a  2  s .  c  om*/
            String[] titleParam = parameters.get("endpoint");
            String endpointURL = (titleParam == null) ? null : titleParam[0];
            System.out.println(endpointURL);

            InspectWrapperComponent component = new InspectWrapperComponent(endpointURL);

            window.addComponent(component);
        }
    });

    window.addListener(new Window.CloseListener() {
        public void windowClose(Window.CloseEvent e) {
            window.getApplication().close();
        }
    });

    setMainWindow(window);
    setTheme("esta-ld");

}

From source file:rs.pupin.jpo.esta_ld.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    window = new Window("ESTA-LD");
    window.getContent().setSizeFull();/*w w  w  .j av a  2 s .c om*/
    window.addStyleName("estald-window");
    window.addParameterHandler(new ParameterHandler() {
        public void handleParameters(Map<String, String[]> parameters) {
            if (!first)
                return;
            first = false;
            String[] titleParam = parameters.get("endpoint");
            String[] graphParam = parameters.get("graph");
            String endpointURL = (titleParam == null) ? null : titleParam[0];
            String graphURL = (graphParam == null) ? null : graphParam[0];
            System.out.println("Endpoint: " + endpointURL);
            System.out.println("Graph: " + graphURL);

            EstaLdComponent component = new EstaLdComponent(endpointURL, graphURL);

            window.addComponent(component);

            // TODO: add Loading gif

            // execute JS part
            window.executeJavaScript("estamainInitVuk()");
            window.executeJavaScript("sparqlqueryInitVuk()");
            window.executeJavaScript("rammapInitVuk()");
            window.executeJavaScript("chartsInitVuk()");
            window.executeJavaScript("timechartInitVuk()");
            component.refreshJS();
        }
    });
    window.addListener(new Window.CloseListener() {
        public void windowClose(Window.CloseEvent e) {
            window.getApplication().close();
        }
    });
    setMainWindow(window);
    setTheme("esta-ld");

}

From source file:rs.superb.apps.inventory.components.UI.clients.mol.AccordionMenu.java

private void createTabs(String[] mainMenuItems) {
    for (String mainMenuItem : mainMenuItems) {
        VerticalLayout vl = new VerticalLayout();
        vl.setMargin(true);/*from ww w  .  j a v  a  2s  . c  o m*/
        vl.setSpacing(true);
        vl.setCaption(mainMenuItem);
        addComponent(vl);

        for (Button subMenuButton : mainMenu.get(mainMenuItem)) {
            subMenuButton.setStyleName(BUTTON_STYLE1);
            subMenuButton.setWidth("80%");
            subMenuButton.setHeight("90px");

            vl.addComponent(subMenuButton);
            vl.setComponentAlignment(subMenuButton, Alignment.MIDDLE_CENTER);
        }

        subMenuButtons0.get(0).addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                Window w = new Window("Click" + subMenuButtons0.get(0).getCaption());
                w.setWidth(66, Unit.PERCENTAGE);
                w.setHeight(66, Unit.PERCENTAGE);
                w.center();
                UI.getCurrent().addWindow(w);
            }
        });
        subMenuButtons0.get(1).addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                UI.getCurrent().getNavigator().navigateTo(GodPopis_View.VIEW_ID);
            }
        });
    }
}

From source file:ru.codeinside.gses.webui.components.ShowDiagramComponent.java

License:Mozilla Public License

private void buildLayout(final ShowDiagramComponentParameterObject param) {
    setSizeFull();/*from  w  w  w.j av a 2 s.  co  m*/
    setSpacing(true);
    final Panel panel = new Panel();
    panel.getContent().setSizeUndefined();
    panel.setCaption(param.caption);
    TaskGraph tg = new TaskGraph(param.processDefinitionId, param.executionId);
    if (param.height != null) {
        tg.setHeight(param.height);
    }
    if (param.width != null) {
        tg.setWidth(param.width);
    }
    tg.setStyleName("scheme-image");
    final TaskGraph bigGraph = new TaskGraph(param.processDefinitionId, param.executionId);
    tg.addListener(new MouseEvents.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(MouseEvents.ClickEvent event) {
            final Window schemeWindow = new Window(param.windowHeader);
            getWindow().addWindow(schemeWindow);
            schemeWindow.addComponent(bigGraph);
            schemeWindow.setWidth("90%");
            schemeWindow.setHeight("90%");
            schemeWindow.center();
            schemeWindow.focus();
            schemeWindow.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, 0);
            bigGraph.addListener(new MouseEvents.ClickListener() {
                @Override
                public void click(MouseEvents.ClickEvent event) {
                    getWindow().removeWindow(schemeWindow);
                }
            });
        }
    });
    panel.addComponent(tg);
    addComponent(panel);
}

From source file:ru.codeinside.gses.webui.utils.Components.java

License:Mozilla Public License

public static Window createWindow(Window mainwindow, String caption) {
    Window subwindow = new Window(caption);
    subwindow.setSizeUndefined();//from  w  ww  .  j  a v a 2s. c o m
    subwindow.getContent().setSizeUndefined();
    subwindow.setScrollable(false);
    subwindow.setResizable(false);
    subwindow.setPositionX(50);
    subwindow.setPositionY(50);
    mainwindow.addWindow(subwindow);
    return subwindow;
}

From source file:se.natusoft.osgi.aps.apsadminweb.app.gui.vaadin.APSAdminWebApp.java

License:Open Source License

/**
 * Creates the application GUI.//  ww w .jav a2  s  .  c  o  m
 */
@Override
public void initGUI() {

    this.setTheme(APSTheme.THEME);

    this.main = new Window("Application Platform Services Administration App");
    this.main.setSizeFull();

    this.mainLayout = new VerticalLayout();
    this.mainLayout.setSizeFull();

    SidesAndCenterLayout layout = new SidesAndCenterLayout();
    layout.setTop(new LogoPanel(this));
    this.tabPanel.refreshTabs();
    layout.setCenter(this.tabPanel);

    layout.doLayout();
    this.mainLayout.addComponent(layout);
    this.main.setContent(this.mainLayout);

    // And finally set the main window in the application to make it visible.
    setMainWindow(this.main);

    this.loginDialogHandler = new VaadinLoginDialogHandler(this.main, this.loginHandler);
    this.loginDialogHandler.setLoginDialogTitle("APS Admin Login");
}

From source file:se.natusoft.osgi.aps.apsconfigadminweb.gui.vaadin.APSConfigAdminWebApp.java

License:Open Source License

/**
 * Creates the application GUI./*from   w  ww . j  a  v  a 2s.  c  om*/
 */
@Override
public void initGUI() {

    this.setTheme(APSTheme.THEME);

    this.main = new Window("Application Platform Services Administration App");
    this.main.setSizeFull();
    VerticalLayout mainLayout = new VerticalLayout();
    this.main.setContent(mainLayout);
    mainLayout.setMargin(false);
    mainLayout.setSizeFull();

    this.layout = new SidesAndCenterLayout();
    this.main.addComponent(this.layout);

    LeftBar leftBar = new LeftBar();

    this.menuTree = new MenuTree();

    APSConfigAdminService configAdminService = getClientContext().getService(APSConfigAdminService.class);

    /* The menu builder for editing configuration environments. */
    ConfigEnvMenuBuilder configEnvMenuBuilder = new ConfigEnvMenuBuilder(
            configAdminService.getConfigEnvAdmin());
    configEnvMenuBuilder.addRefreshable(this.menuTree);
    configEnvMenuBuilder.addRefreshable(new RemoveCenterRefreshable());
    this.menuTree.addMenuBuilder(configEnvMenuBuilder);

    /* The menu builder for editing configurations. */
    ConfigMenuBuilder configMenuBuilder = new ConfigMenuBuilder(configAdminService, this.logger);
    this.menuTree.addMenuBuilder(configMenuBuilder);

    this.menuTree.refresh();

    this.menuTree.addListener(new ValueChangeListener() {
        /** Handles input changes in the menu tree. */
        @Override
        public void valueChange(ValueChangeEvent event) {
            menuTreeItemHandler((IntID) event.getProperty().getValue());
        }
    });

    this.menuTree.setActionHandler(this);
    leftBar.addComponent(this.menuTree);

    this.layout.setLeft(leftBar);
    this.layout.doLayout(); // This is required after contents have been set.

    this.notAuthWindow = new Window("Application Platform Services Administration App");
    this.notAuthWindow.setSizeFull();
    VerticalLayout nawvl = new VerticalLayout();
    Label loginMessage = new Label("<font size='+2'>Please login!</font>", Label.CONTENT_XHTML);
    nawvl.addComponent(loginMessage);
    this.notAuthWindow.setContent(nawvl);

    setMainWindow(this.notAuthWindow);
}

From source file:se.natusoft.osgi.aps.apsuseradminweb.vaadin.APSUSerAdminWebApp.java

License:Open Source License

/**
 * Creates the application GUI.//  www .  j av  a  2  s.  c  o m
 */
@Override
public void initGUI() {

    this.setTheme(APSTheme.THEME);

    this.main = new Window("Application Platform Services Simple User Service Administration App");
    this.main.setSizeFull();
    VerticalLayout mainLayout = new VerticalLayout();
    this.main.setContent(mainLayout);
    mainLayout.setMargin(false);
    mainLayout.setSizeFull();

    this.layout = new SidesAndCenterLayout();
    this.main.addComponent(this.layout);

    LeftBar leftBar = new LeftBar();

    this.menuTree = new MenuTree();

    this.menuTree.addListener(new Property.ValueChangeListener() {
        /** Handles input changes in the menu tree. */
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            menuTreeItemHandler(event);
        }
    });

    UsersMenuBuilder usersMenuBuilder = new UsersMenuBuilder(this.userService, this.logger);
    usersMenuBuilder.addRefreshable(this.menuTree);
    usersMenuBuilder.addRefreshable(new MenuRefreshable());
    usersMenuBuilder.setClearCenterRefreshable(new ClearCenterRefreshable());
    this.menuTree.addMenuBuilder(usersMenuBuilder);

    RolesMenuBuilder rolesMenuBuilder = new RolesMenuBuilder(this.userService, this.logger);
    rolesMenuBuilder.addRefreshable(this.menuTree);
    rolesMenuBuilder.addRefreshable(new MenuRefreshable());
    rolesMenuBuilder.setClearCenterRefreshable(new ClearCenterRefreshable());
    this.menuTree.addMenuBuilder(rolesMenuBuilder);

    this.menuTree.refresh();

    this.menuTree.setActionHandler(this);
    leftBar.addComponent(this.menuTree);

    this.layout.setLeft(leftBar);
    this.layout.setCenter(Description.DESCRIPTION_VIEW);
    this.layout.doLayout(); // This is required after contents have been set.

    /* The window to show when an authorized user is not available. */
    Window notAuthWindow = new Window("Application Platform Services Administration App");
    notAuthWindow.setSizeFull();
    VerticalLayout nawvl = new VerticalLayout();
    Label loginMessage = new Label("<font size='+2'>Please login!</font>", Label.CONTENT_XHTML);
    nawvl.addComponent(loginMessage);
    notAuthWindow.setContent(nawvl);

    setMainWindow(notAuthWindow);

}