Example usage for com.vaadin.ui Window setCaption

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

Introduction

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

Prototype

@Override
    public void setCaption(String caption) 

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 w w w.j a  va2 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:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java

License:Open Source License

public void showMessage(String message, String width, String height, String caption) {
    Window window = new Window();
    window.setCaption(caption);
    window.setWidth(width);/*from  w w w.j  a v  a2 s.  co  m*/
    window.setHeight(height);

    window.center();

    Panel panel = new Panel();

    panel.getContent().addComponent(new Label(message));

    window.getContent().addComponent(panel);

    getWindow().addWindow(window);
}

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//w w w .j ava 2 s  .c o  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:annis.gui.docbrowser.DocBrowserTable.java

License:Apache License

public Button generateInfoButtonCell(final String docName) {
    Button btn = new Button();
    btn.setStyleName(ChameleonTheme.BUTTON_BORDERLESS);
    btn.setIcon(INFO_ICON);/*from  w w  w.  ja  v a  2s.c om*/
    btn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {

                List<Annotation> annos = getDocMetaData(docName);

                /**
                 * Transforms to a list of key value pairs. The values concates the
                 * namespace and ordinary value. Namespaces "NULL" are ignored.
                 */
                // create datasource and bind it to a table
                BeanItemContainer<Annotation> metaContainer = new BeanItemContainer<>(Annotation.class);
                metaContainer.addAll(annos);
                metaContainer.sort(new Object[] { "namespace", "name" }, new boolean[] { true, true });

                Table metaTable = new Table();
                metaTable.setContainerDataSource(metaContainer);
                metaTable.addGeneratedColumn("genname",
                        new MetaDataPanel.MetaTableNameGenerator(metaContainer));
                metaTable.addGeneratedColumn("genvalue",
                        new MetaDataPanel.MetaTableValueGenerator(metaContainer));

                metaTable.setVisibleColumns("genname", "genvalue");

                metaTable.setColumnHeaders(new String[] { "Name", "Value" });
                metaTable.setSizeFull();
                metaTable.setColumnWidth("genname", -1);
                metaTable.setColumnExpandRatio("genvalue", 1.0f);
                metaTable.addStyleName(ChameleonTheme.TABLE_STRIPED);

                // create and style the extra window for the metadata table
                Window metaWin = new Window();
                metaWin.setContent(metaTable);
                metaWin.setCaption("metadata doc " + docName);
                metaWin.center();
                metaWin.setWidth(400, Unit.PIXELS);
                metaWin.setHeight(400, Unit.PIXELS);

                // paint the window
                docBrowserPanel.getUI().addWindow(metaWin);
            } catch (UniformInterfaceException ex) {
                log.error("can not retrieve metadata for document " + docName, ex);
            }

        }
    });
    return btn;
}

From source file:annis.gui.MainToolbar.java

License:Apache License

public MainToolbar() {

    String bugmail = (String) VaadinSession.getCurrent().getAttribute(BUG_MAIL_KEY);
    if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${")
            && new EmailValidator("").isValid(bugmail)) {
        this.bugEMailAddress = bugmail;
    } else {/*  www .j  a v a 2  s.  com*/
        this.bugEMailAddress = null;
    }

    UI ui = UI.getCurrent();
    if (ui instanceof CommonUI) {
        ((CommonUI) ui).getSettings().addedLoadedListener(MainToolbar.this);
    }

    setWidth("100%");
    setHeight("-1px");

    addStyleName("toolbar");
    addStyleName("border-layout");

    btAboutAnnis = new Button("About ANNIS");
    btAboutAnnis.addStyleName(ValoTheme.BUTTON_SMALL);
    btAboutAnnis.setIcon(new ThemeResource("images/annis_16.png"));
    btAboutAnnis.addClickListener(new AboutClickListener());

    btSidebar = new Button();
    btSidebar.setDisableOnClick(true);
    btSidebar.addStyleName(ValoTheme.BUTTON_SMALL);
    btSidebar.setDescription("Show and hide search sidebar");
    btSidebar.setIconAlternateText(btSidebar.getDescription());

    btBugReport = new Button("Report Problem");
    btBugReport.addStyleName(ValoTheme.BUTTON_SMALL);
    btBugReport.setDisableOnClick(true);
    btBugReport.setIcon(FontAwesome.ENVELOPE_O);
    btBugReport.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            reportBug();
        }
    });
    btBugReport.setVisible(this.bugEMailAddress != null);

    btNavigate = new Button();
    btNavigate.setVisible(false);
    btNavigate.setDisableOnClick(true);
    btNavigate.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            btNavigate.setEnabled(true);
            if (navigationTarget != null) {
                UI.getCurrent().getNavigator().navigateTo(navigationTarget.state);
            }
        }
    });
    lblUserName = new Label("not logged in");
    lblUserName.setWidth("-1px");
    lblUserName.setHeight("-1px");
    lblUserName.addStyleName("right-aligned-text");

    btLogin = new Button("Login", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            showLoginWindow(false);
        }
    });

    btLogout = new Button("Logout", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            // logout
            Helper.setUser(null);
            for (LoginListener l : loginListeners) {
                l.onLogout();
            }
            Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION);
            updateUserInformation();
        }
    });

    btLogin.setSizeUndefined();
    btLogin.setStyleName(ValoTheme.BUTTON_SMALL);
    btLogin.setIcon(FontAwesome.USER);

    btLogout.setSizeUndefined();
    btLogout.setStyleName(ValoTheme.BUTTON_SMALL);
    btLogout.setIcon(FontAwesome.USER);

    btOpenSource = new Button("Help us to make ANNIS better!");
    btOpenSource.setStyleName(BaseTheme.BUTTON_LINK);
    btOpenSource.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Window w = new HelpUsWindow();
            w.setCaption("Help us to make ANNIS better!");
            w.setModal(true);
            w.setResizable(true);
            w.setWidth("600px");
            w.setHeight("500px");
            UI.getCurrent().addWindow(w);
            w.center();
        }
    });

    addComponent(btSidebar);
    setComponentAlignment(btSidebar, Alignment.MIDDLE_LEFT);

    addComponent(btAboutAnnis);
    addComponent(btBugReport);
    addComponent(btNavigate);

    addComponent(btOpenSource);

    setSpacing(true);
    setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT);
    setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT);
    setComponentAlignment(btNavigate, Alignment.MIDDLE_LEFT);

    setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER);
    setExpandRatio(btOpenSource, 1.0f);

    addLoginButton();

    btSidebar.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            btSidebar.setEnabled(true);

            // decide new state
            switch (sidebarState) {
            case VISIBLE:
                if (event.isCtrlKey()) {
                    sidebarState = SidebarState.AUTO_VISIBLE;
                } else {
                    sidebarState = SidebarState.HIDDEN;
                }
                break;
            case HIDDEN:
                if (event.isCtrlKey()) {
                    sidebarState = SidebarState.AUTO_HIDDEN;
                } else {
                    sidebarState = SidebarState.VISIBLE;
                }
                break;

            case AUTO_VISIBLE:
                if (event.isCtrlKey()) {
                    sidebarState = SidebarState.VISIBLE;
                } else {
                    sidebarState = SidebarState.AUTO_HIDDEN;
                }
                break;
            case AUTO_HIDDEN:
                if (event.isCtrlKey()) {
                    sidebarState = SidebarState.HIDDEN;
                } else {
                    sidebarState = SidebarState.AUTO_VISIBLE;
                }
                break;
            }

            updateSidebarState();
        }
    });

    screenshotExtension = new ScreenshotMaker(this);

    JavaScript.getCurrent().addFunction("annis.gui.logincallback", new LoginCloseCallback());

    updateSidebarState();
    MainToolbar.this.updateUserInformation();
}

From source file:annis.gui.resultview.SingleResultPanel.java

License:Apache License

private void showShareSingleMatchGenerator() {
    // select the current match
    if (ui != null) {
        ui.getQueryState().getSelectedMatches().getValue().clear();
        ui.getQueryState().getSelectedMatches().getValue().add(resultNumber);
        ui.getSearchView().updateFragment(ui.getQueryController().getSearchQuery());
    }/*w  w  w  .  j a  v a 2 s  .  c  o  m*/

    Window window = new ShareSingleMatchGenerator(resolverEntries, match, query, segmentationName, ps);
    window.setWidth(790, Unit.PIXELS);
    window.setHeight(580, Unit.PIXELS);
    window.setResizable(true);
    window.setModal(true);

    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            btLink.setEnabled(true);
        }
    });
    window.setCaption("Match reference link");

    UI.getCurrent().addWindow(window);
}

From source file:annis.gui.SearchUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    super.init(request);

    this.instanceConfig = getInstanceConfig(request);

    getPage().setTitle(instanceConfig.getInstanceDisplayName() + " (ANNIS Corpus Search)");

    queryController = new QueryController(this);

    refresh = new Refresher();
    // deactivate refresher by default
    refresh.setRefreshInterval(-1);//from  w w  w . java2s.c  om
    refresh.addListener(queryController);
    addExtension(refresh);

    // always get the resize events directly
    setImmediate(true);

    VerticalLayout mainLayout = new VerticalLayout();
    setContent(mainLayout);

    mainLayout.setSizeFull();
    mainLayout.setMargin(false);

    final ScreenshotMaker screenshot = new ScreenshotMaker(this);
    addExtension(screenshot);

    css = new CSSInject(this);

    HorizontalLayout layoutToolbar = new HorizontalLayout();
    layoutToolbar.setWidth("100%");
    layoutToolbar.setHeight("-1px");

    mainLayout.addComponent(layoutToolbar);
    layoutToolbar.addStyleName("toolbar");
    layoutToolbar.addStyleName("border-layout");

    Button btAboutAnnis = new Button("About ANNIS");
    btAboutAnnis.addStyleName(ChameleonTheme.BUTTON_SMALL);
    btAboutAnnis.setIcon(new ThemeResource("info.gif"));

    btAboutAnnis.addClickListener(new AboutClickListener());

    btBugReport = new Button("Report Bug");
    btBugReport.addStyleName(ChameleonTheme.BUTTON_SMALL);
    btBugReport.setDisableOnClick(true);
    btBugReport.setIcon(new ThemeResource("../runo/icons/16/email.png"));
    btBugReport.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            screenshot.makeScreenshot();
            btBugReport.setCaption("bug report is initialized...");
        }
    });

    String bugmail = (String) VaadinSession.getCurrent().getAttribute("bug-e-mail");
    if (bugmail != null && !bugmail.isEmpty() && !bugmail.startsWith("${")
            && new EmailValidator("").isValid(bugmail)) {
        this.bugEMailAddress = bugmail;
    }
    btBugReport.setVisible(this.bugEMailAddress != null);

    lblUserName = new Label("not logged in");
    lblUserName.setWidth("-1px");
    lblUserName.setHeight("-1px");
    lblUserName.addStyleName("right-aligned-text");

    btLoginLogout = new Button("Login", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (isLoggedIn()) {
                // logout
                Helper.setUser(null);
                Notification.show("Logged out", Notification.Type.TRAY_NOTIFICATION);
                updateUserInformation();
            } else {
                showLoginWindow();
            }
        }
    });
    btLoginLogout.setSizeUndefined();
    btLoginLogout.setStyleName(ChameleonTheme.BUTTON_SMALL);
    btLoginLogout.setIcon(new ThemeResource("../runo/icons/16/user.png"));

    Button btOpenSource = new Button("Help us to make ANNIS better!");
    btOpenSource.setStyleName(BaseTheme.BUTTON_LINK);
    btOpenSource.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Window w = new HelpUsWindow();
            w.setCaption("Help us to make ANNIS better!");
            w.setModal(true);
            w.setResizable(true);
            w.setWidth("600px");
            w.setHeight("500px");
            addWindow(w);
            w.center();
        }
    });

    layoutToolbar.addComponent(btAboutAnnis);
    layoutToolbar.addComponent(btBugReport);
    layoutToolbar.addComponent(btOpenSource);
    layoutToolbar.addComponent(lblUserName);
    layoutToolbar.addComponent(btLoginLogout);

    layoutToolbar.setSpacing(true);
    layoutToolbar.setComponentAlignment(btAboutAnnis, Alignment.MIDDLE_LEFT);
    layoutToolbar.setComponentAlignment(btBugReport, Alignment.MIDDLE_LEFT);
    layoutToolbar.setComponentAlignment(btOpenSource, Alignment.MIDDLE_CENTER);
    layoutToolbar.setComponentAlignment(lblUserName, Alignment.MIDDLE_RIGHT);
    layoutToolbar.setComponentAlignment(btLoginLogout, Alignment.MIDDLE_RIGHT);
    layoutToolbar.setExpandRatio(btOpenSource, 1.0f);

    //HorizontalLayout hLayout = new HorizontalLayout();
    final HorizontalSplitPanel hSplit = new HorizontalSplitPanel();
    hSplit.setSizeFull();

    mainLayout.addComponent(hSplit);
    mainLayout.setExpandRatio(hSplit, 1.0f);

    AutoGeneratedQueries autoGenQueries = new AutoGeneratedQueries("example queries", this);

    controlPanel = new ControlPanel(queryController, instanceConfig, autoGenQueries);
    controlPanel.setWidth(100f, Layout.Unit.PERCENTAGE);
    controlPanel.setHeight(100f, Layout.Unit.PERCENTAGE);
    hSplit.setFirstComponent(controlPanel);

    tutorial = new TutorialPanel();
    tutorial.setHeight("99%");

    mainTab = new TabSheet();
    mainTab.setSizeFull();
    mainTab.addTab(autoGenQueries, "example queries");
    mainTab.addTab(tutorial, "Tutorial");

    queryBuilder = new QueryBuilderChooser(queryController, this, instanceConfig);
    mainTab.addTab(queryBuilder, "Query Builder");

    hSplit.setSecondComponent(mainTab);
    hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS);
    hSplit.addSplitterClickListener(new AbstractSplitPanel.SplitterClickListener() {
        @Override
        public void splitterClick(AbstractSplitPanel.SplitterClickEvent event) {
            if (event.isDoubleClick()) {
                if (hSplit.getSplitPosition() == CONTROL_PANEL_WIDTH) {
                    // make small
                    hSplit.setSplitPosition(0.0f, Unit.PIXELS);
                } else {
                    // reset to default width
                    hSplit.setSplitPosition(CONTROL_PANEL_WIDTH, Unit.PIXELS);
                }
            }
        }
    });
    // hLayout.setExpandRatio(mainTab, 1.0f);

    addAction(new ShortcutListener("^Query builder") {
        @Override
        public void handleAction(Object sender, Object target) {
            mainTab.setSelectedTab(queryBuilder);
        }
    });

    addAction(new ShortcutListener("Tutor^eial") {
        @Override
        public void handleAction(Object sender, Object target) {
            mainTab.setSelectedTab(tutorial);
        }
    });

    getPage().addUriFragmentChangedListener(this);

    getSession().addRequestHandler(new RequestHandler() {
        @Override
        public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response)
                throws IOException {
            checkCitation(request);

            if (request.getPathInfo() != null && request.getPathInfo().startsWith("/vis-iframe-res/")) {
                String uuidString = StringUtils.removeStart(request.getPathInfo(), "/vis-iframe-res/");
                UUID uuid = UUID.fromString(uuidString);
                IFrameResourceMap map = VaadinSession.getCurrent().getAttribute(IFrameResourceMap.class);
                if (map == null) {
                    response.setStatus(404);
                } else {
                    IFrameResource res = map.get(uuid);
                    if (res != null) {
                        response.setStatus(200);
                        response.setContentType(res.getMimeType());
                        response.getOutputStream().write(res.getData());
                    }
                }
                return true;
            }

            return false;
        }
    });

    getSession().setAttribute(MediaController.class, new MediaControllerImpl());

    getSession().setAttribute(PDFController.class, new PDFControllerImpl());

    loadInstanceFonts();

    checkCitation(request);
    lastQueriedFragment = "";
    evaluateFragment(getPage().getUriFragment());

    updateUserInformation();
}

From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java

Window removeTeamMemberWindow(int facultyRowId) {
    Window sub = new Window();
    sub.setCaption("REMOVE TEAM MEMBER");
    sub.setWidth("250px");
    sub.setModal(true);/*from  ww  w. j av a 2s.  c om*/
    sub.center();

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

    Button removeBtn = new Button("REMOVE");
    removeBtn.setWidth("100%");
    removeBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    removeBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    removeBtn.addClickListener((Button.ClickEvent event) -> {
        boolean result = tts.removeTeamMember(getTeamTeachId(), facultyRowId);
        if (result) {
            populateDataTable();
            sub.close();
        }
    });
    vlayout.addComponent(removeBtn);

    sub.setContent(vlayout);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.etest.view.systemadministration.SemestralTeam.AddSemestralTeamMembersWindow.java

Window editTeamMemberPositionWindow(int facultyRowId) {
    Window sub = new Window();
    sub.setCaption("REMOVE TEAM MEMBER");
    sub.setWidth("250px");
    sub.setModal(true);/*w w w.ja v a  2s .  c om*/
    sub.center();

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

    String name = fs.getFacultyNameById(facultyRowId);
    vlayout.addComponent(new Label("Set " + name.toUpperCase() + " as Team Leader."));

    Button updateBtn = new Button("UPDATE");
    updateBtn.setWidth("100%");
    updateBtn.setIcon(FontAwesome.USER);
    updateBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    updateBtn.addStyleName(ValoTheme.BUTTON_SMALL);
    updateBtn.addClickListener((Button.ClickEvent event) -> {
        int userId = us.getUserIdByFacultyId(facultyRowId);
        boolean result = tts.updateTeamTeach(getTeamTeachId(), userId);
        if (result) {
            sub.close();
            populateDataTable();
            close();
        }
    });
    vlayout.addComponent(updateBtn);

    sub.setContent(vlayout);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.expressui.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    currentInstance.set(this);

    setTheme(getCustomTheme());/*from w w  w  .  ja  v a  2s.  c  om*/
    customizeConfirmDialogStyle();

    Window mainWindow = new Window();
    setMainWindow(mainWindow);
    mainWindow.addStyleName("e-main-window");
    mainWindow.setCaption(getTypeCaption());

    VerticalLayout mainLayout = new VerticalLayout();
    String id = StringUtil.generateDebugId("e", this, mainLayout, "mainLayout");
    mainLayout.setDebugId(id);

    mainWindow.setSizeFull();
    mainLayout.setSizeFull();
    mainWindow.setContent(mainLayout);

    setLogoutURL(getApplicationProperties().getRestartApplicationUrl());

    configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot());
    configureRightMenuBar(mainMenuBar.getRightMenuBarRoot());
    mainLayout.addComponent(mainMenuBar);

    pageLayoutTabSheet = new TabSheet();
    id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet");
    pageLayoutTabSheet.setDebugId(id);

    pageLayoutTabSheet.addStyleName("e-main-page-layout");
    pageLayoutTabSheet.setSizeFull();
    mainLayout.addComponent(pageLayoutTabSheet);
    mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f);

    Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"),
            new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink")));
    expressUILink.setTargetName("_blank");
    expressUILink.setIcon(new ThemeResource("../expressui/favicon.png"));
    expressUILink.setSizeUndefined();
    mainLayout.addComponent(expressUILink);
    mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER);

    configureSessionTimeout(mainWindow);
    postWire();
    onDisplay();
}