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:de.catma.CatmaApplication.java

License:Open Source License

@Override
public void init() {

    Properties properties = loadProperties();
    backgroundService = new BackgroundService(this);

    final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION);
    mainWindow.addParameterHandler(this);
    HorizontalLayout mainLayout = new HorizontalLayout();
    mainLayout.setSizeUndefined();//from   w ww .j av  a 2s.c  o m
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainWindow.addStyleName("catma-mainwindow");

    mainWindow.setContent(mainLayout);
    MenuFactory menuFactory = new MenuFactory();
    try {
        initTempDirectory(properties);
        tagManager = new TagManager();

        repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties));

        tagManagerView = new TagManagerView(tagManager);

        taggerManagerView = new TaggerManagerView();

        analyzerManagerView = new AnalyzerManagerView();

        visualizationManagerView = new VisualizationManagerView();

        defaultProgressIndicator = new ProgressIndicator();
        defaultProgressIndicator.setIndeterminate(true);
        defaultProgressIndicator.setEnabled(false);
        defaultProgressIndicator.setPollingInterval(500);
        progressWindow = new ProgressWindow(defaultProgressIndicator);

        menu = menuFactory.createMenu(mainLayout,
                new MenuFactory.MenuEntryDefinition("Repository Manager",
                        new RepositoryManagerWindow(repositoryManagerView)),
                new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)),
                new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)),
                new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)),
                new MenuFactory.MenuEntryDefinition("Visualizer",
                        new VisualizationManagerWindow(visualizationManagerView)));
        Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de"));
        aboutLink.setTargetName("_blank");
        mainLayout.addComponent(aboutLink);
        mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT);
        mainLayout.setExpandRatio(aboutLink, 1.0f);

        Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/"));
        helpLink.setTargetName("_blank");
        mainLayout.addComponent(helpLink);
        mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT);

        Label helpLabel = new Label();
        helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this));
        helpLabel.setWidth("20px");
        helpLabel.setDescription(
                "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating "
                        + "through CATMA. They provide useful hints for managing the first "
                        + "steps within a CATMA component.</p>" + "<h4>Login</h4>"
                        + "Once you're logged in, you will see the Repository Manager, "
                        + "which will explain the first steps to you. "
                        + "Just hover your mouse over the question mark icons!");
        VerticalLayout helpWrapper = new VerticalLayout();
        helpWrapper.addComponent(helpLabel);
        helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT);

        Animator helpAnimator = new Animator(helpWrapper);

        helpAnimator.setFadedOut(true);

        mainLayout.addComponent(helpAnimator);
        mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT);
        helpAnimator.fadeIn(2000, 300);

        MenuBar loginLogoutMenu = new MenuBar();
        LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this);
        MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand);
        loginLogoutCommand.setLoginLogoutItem(loginLogoutitem);

        mainLayout.addComponent(loginLogoutMenu);
        mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT);
        mainLayout.setWidth("100%");
    } catch (Exception e) {
        showAndLogError("The system could not be initialized!", e);
    }

    setMainWindow(mainWindow);

    setTheme("cleatheme");
}

From source file:de.catma.ui.analyzer.TagKwicDialog.java

License:Open Source License

private void initComponents() {
    window = new Window("Select affected User Markup Collections");
    window.setModal(true);/*w w  w  .j  ava 2 s .c  o  m*/

    setSpacing(true);
    setMargin(true);
    setSizeFull();

    Label tagResultsLabel = new Label(
            "The selected User Markup Collections will be modfied by this tagging operation. Are sure?");
    addComponent(tagResultsLabel);

    umcTable = new TreeTable("User Markup Collections");
    umcTable.addContainerProperty(UmcTableProperty.CAPTION, String.class, null);
    umcTable.setColumnHeader(UmcTableProperty.CAPTION, "Document/Collection");
    umcTable.addContainerProperty(UmcTableProperty.TARGET, Component.class, null);
    umcTable.setColumnHeader(UmcTableProperty.TARGET, "targeted User Markup Collection");
    umcTable.setSizeFull();

    addComponent(umcTable);

    setExpandRatio(umcTable, 1.0f);

    btOk = new Button("Ok");
    btOk.setEnabled(false);

    btCancel = new Button("Cancel");

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    buttonPanel.addComponent(btOk);
    buttonPanel.addComponent(btCancel);

    buttonPanel.setComponentAlignment(btOk, Alignment.MIDDLE_RIGHT);
    buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT);

    addComponent(buttonPanel);
    setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT);

    window.setContent(this);
    window.setWidth("50%");
    window.setHeight("80%");
}

From source file:de.catma.ui.dialog.FormDialog.java

License:Open Source License

private void initComponents(String caption, final PropertysetItem propertysetItem,
        FormFieldFactory formFieldFactory) {

    setSizeFull();//  w w  w  . ja  v  a2s  .  c  om
    setSpacing(true);

    dialogWindow = new Window(caption);
    dialogWindow.setModal(true);

    form = new Form();
    if (formFieldFactory != null) {
        form.setFormFieldFactory(formFieldFactory);
    }
    form.setSizeFull();
    form.setWriteThrough(false);
    form.setInvalidCommitted(false);
    form.setItemDataSource(propertysetItem);

    addComponent(form);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    btSave = new Button("Save");

    btSave.setClickShortcut(KeyCode.ENTER);

    btCancel = new Button("Cancel");
    buttonPanel.addComponent(btSave);
    buttonPanel.addComponent(btCancel);

    addComponent(buttonPanel);
    this.setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT);

    dialogWindow.addComponent(this);

    form.focus();
}

From source file:de.catma.ui.dialog.UploadDialog.java

License:Open Source License

private void initComponents() {
    setSizeFull();/*w ww .j  a v a2 s  .  c  om*/
    setSpacing(true);

    dialogWindow = new Window(caption);
    dialogWindow.setModal(true);

    upload = new Upload("Please select a file to upload", new DataReceiver(data));
    upload.setButtonCaption("Select file");
    upload.setImmediate(true);

    addComponent(upload);
    pi = new ProgressIndicator();
    pi.setVisible(false);
    addComponent(pi);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    btCancel = new Button("Cancel");
    buttonPanel.addComponent(btCancel);

    addComponent(buttonPanel);
    this.setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT);

    dialogWindow.addComponent(this);

    upload.focus();

}

From source file:de.catma.ui.dialog.wizard.WizardFactory.java

License:Open Source License

public Window createWizardWindow(String caption, String width, String height) {

    Wizard wizard = new Wizard();
    wizard.getFinishButton().setEnabled(false);
    Window wizardWindow = new Window(caption);
    wizardWindow.setModal(true);/*  www  .  ja v  a2  s .  c o m*/
    wizardWindow.setContent(wizard);
    wizardWindow.setWidth(width);
    wizardWindow.setHeight(height);

    wizard.addListener(new WizardManager(wizardWindow));
    wizard.addListener(wizardProgressListener);

    addSteps(wizard);

    return wizardWindow;
}

From source file:de.catma.ui.repository.AuthenticationDialog.java

License:Open Source License

private void initComponents() {
    setSizeFull();/*from   www. j  a  v a 2 s  .c o  m*/
    setSpacing(true);

    dialogWindow = new Window(caption);
    dialogWindow.setModal(true);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    btCancel = new Button("Cancel");
    buttonPanel.addComponent(btCancel);

    addComponent(buttonPanel);
    this.setComponentAlignment(buttonPanel, Alignment.BOTTOM_RIGHT);

    dialogWindow.addComponent(this);

}

From source file:de.catma.ui.repository.CorpusContentSelectionDialog.java

License:Open Source License

private void initComponents() {
    setSizeFull();// w  w w  . j a  v a2 s. co  m
    Panel documentsPanel = new Panel();
    documentsPanel.getContent().setSizeUndefined();
    documentsPanel.getContent().setWidth("100%");
    documentsPanel.setSizeFull();

    documentsContainer = new HierarchicalContainer();
    documentsTree = new TreeTable("Documents for the analysis", documentsContainer);
    documentsTree.setWidth("100%");

    documentsTree.addContainerProperty(DocumentTreeProperty.caption, String.class, null);
    documentsTree.addContainerProperty(DocumentTreeProperty.include, AbstractComponent.class, null);
    documentsTree.setColumnHeader(DocumentTreeProperty.caption, "document/collection");
    documentsTree.setColumnHeader(DocumentTreeProperty.include, "include");

    documentsTree.addItem(new Object[] { sourceDocument.toString(), createCheckBox(false) }, sourceDocument);

    documentsTree.setCollapsed(sourceDocument, false);

    MarkupCollectionItem userMarkupItem = new MarkupCollectionItem(sourceDocument, userMarkupItemDisplayString,
            true);
    documentsTree.addItem(new Object[] { userMarkupItemDisplayString, new Label() }, userMarkupItem);
    documentsTree.setParent(userMarkupItem, sourceDocument);

    for (UserMarkupCollectionReference umcRef : sourceDocument.getUserMarkupCollectionRefs()) {
        documentsTree.addItem(new Object[] { umcRef.getName(), createCheckBox(true) }, umcRef);
        documentsTree.setParent(umcRef, userMarkupItem);
        documentsTree.setChildrenAllowed(umcRef, false);
    }
    documentsTree.setCollapsed(userMarkupItem, false);
    int pageLength = sourceDocument.getUserMarkupCollectionRefs().size() + 1;
    if (pageLength < 5) {
        pageLength = 5;
    }
    if (pageLength > 15) {
        pageLength = 15;
    }
    documentsTree.setPageLength(pageLength);
    documentsPanel.addComponent(documentsTree);

    addComponent(documentsPanel);
    setExpandRatio(documentsPanel, 1.0f);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);
    buttonPanel.setWidth("100%");
    btOk = new Button("Ok");
    btOk.setClickShortcut(KeyCode.ENTER);
    btOk.focus();

    buttonPanel.addComponent(btOk);
    buttonPanel.setComponentAlignment(btOk, Alignment.MIDDLE_RIGHT);
    buttonPanel.setExpandRatio(btOk, 1.0f);
    btCancel = new Button("Cancel");
    buttonPanel.addComponent(btCancel);
    buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT);
    addComponent(buttonPanel);

    dialogWindow = new Window("Selection of relevant documents");
    dialogWindow.setContent(this);
}

From source file:de.catma.ui.tagmanager.PropertyDefinitionDialog.java

License:Open Source License

private void initComponents(String caption) {
    setMargin(true);//from   w  w  w.  jav  a 2 s  . co m
    setSpacing(true);

    GridLayout propPanel = new GridLayout(3, 3);
    propPanel.setSpacing(true);

    nameInput = new TextField("Name");
    nameInput.setRequired(true);
    if (propertyDefinition != null) {
        nameInput.setValue(propertyDefinition.getName());
    }
    propPanel.addComponent(nameInput, 0, 0, 2, 0);

    if (propertyDefinition != null) {
        valueInput = new ListSelect("Possible values",
                propertyDefinition.getPossibleValueList().getPropertyValueList().getValues());
    } else {
        valueInput = new ListSelect("Possible values");
    }
    valueInput.setWidth("100%");
    valueInput.setRequired(true);
    valueInput.setNullSelectionAllowed(false);

    propPanel.addComponent(valueInput, 0, 1, 2, 1);

    newValueInput = new TextField("Add possible value");
    propPanel.addComponent(newValueInput, 0, 2);

    btAdd = new Button("+");
    propPanel.addComponent(btAdd, 1, 2);
    propPanel.setComponentAlignment(btAdd, Alignment.BOTTOM_CENTER);

    btRemove = new Button("-");
    propPanel.addComponent(btRemove, 2, 2);
    propPanel.setComponentAlignment(btRemove, Alignment.BOTTOM_CENTER);

    addComponent(propPanel);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    btSave = new Button("Save");
    buttonPanel.addComponent(btSave);
    buttonPanel.setComponentAlignment(btSave, Alignment.MIDDLE_RIGHT);

    btCancel = new Button("Cancel");
    buttonPanel.addComponent(btCancel);
    buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT);

    addComponent(buttonPanel);
    setComponentAlignment(buttonPanel, Alignment.MIDDLE_RIGHT);

    window = new Window(caption);
    window.setContent(this);
    window.setWidth("30%");
    window.setHeight("70%");
    window.center();
}

From source file:de.dimm.vsm.vaadin.VSMCMain.java

public <T> void SelectObject(Class<T> t, String caption, String buttonCaption, List<T> list,
        final SelectObjectCallback cb) {

    if (list.size() == 1) {
        cb.SelectedAction(list.get(0));//  w  ww. j  a  v a2 s  . co m
        return;
    }
    final NativeSelect sel = new NativeSelect(caption);
    sel.setNewItemsAllowed(false);
    sel.setInvalidAllowed(false);
    sel.setNullSelectionAllowed(false);

    for (int i = 0; i < list.size(); i++) {
        Object object = list.get(i);
        sel.addItem(object);
    }
    if (!list.isEmpty())
        sel.setValue(list.get(0));

    VerticalLayout vl = new VerticalLayout();
    vl.setSpacing(true);
    NativeButton ok = new NativeButton(buttonCaption);

    final Window win = new Window(Txt("Auswahl") + " " + caption);
    win.setWidth("350px");
    win.center();

    ok.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getRootWin().removeWindow(win);

            cb.SelectedAction(sel.getValue());
        }
    });

    vl.addComponent(sel);
    sel.setWidth("80%");
    vl.addComponent(ok);
    vl.setComponentAlignment(ok, Alignment.BOTTOM_RIGHT);

    vl.setSizeFull();
    win.addComponent(vl);
    getRootWin().addWindow(win);
}

From source file:de.flapdoodle.mongoui.MongoUIApplication.java

License:Apache License

@Override
public void init() {
    final Window window = new Window("My Vaadin Application");
    setMainWindow(window);//from w  w w  . jav a 2s  .  c  o m
    Button button = new Button("Click Me");
    button.addListener(new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            window.addComponent(new Label("Thank you for clicking: " + "Fuh"));
        }
    });
    window.addComponent(button);

    window.addComponent(new ConfigDatabase());
    window.addComponent(new VaadinUIComp());
}