Example usage for com.vaadin.ui Window setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(float width, Unit unit) 

Source Link

Usage

From source file:annis.gui.controlpanel.CorpusListPanel.java

License:Apache License

public void initCorpusBrowser(String topLevelCorpusName, final Button l) {

    AnnisCorpus c = ui.getQueryState().getAvailableCorpora().getItem(topLevelCorpusName).getBean();
    MetaDataPanel meta = new MetaDataPanel(c.getName());

    CorpusBrowserPanel browse = new CorpusBrowserPanel(c, ui.getQueryController());
    GridLayout infoLayout = new GridLayout(2, 2);
    infoLayout.setSizeFull();//from   w  ww  .  ja  va  2 s.  c o  m

    String corpusURL = Helper.generateCorpusLink(Sets.newHashSet(topLevelCorpusName));
    Label lblLink = new Label("Link to corpus: <a href=\"" + corpusURL + "\">" + corpusURL + "</a>",
            ContentMode.HTML);
    lblLink.setHeight("-1px");
    lblLink.setWidth("-1px");

    infoLayout.addComponent(meta, 0, 0);
    infoLayout.addComponent(browse, 1, 0);
    infoLayout.addComponent(lblLink, 0, 1, 1, 1);

    infoLayout.setRowExpandRatio(0, 1.0f);
    infoLayout.setColumnExpandRatio(0, 0.5f);
    infoLayout.setColumnExpandRatio(1, 0.5f);
    infoLayout.setComponentAlignment(lblLink, Alignment.MIDDLE_CENTER);

    Window window = new Window("Corpus information for " + c.getName() + " (ID: " + c.getId() + ")",
            infoLayout);
    window.setWidth(70, UNITS_EM);
    window.setHeight(45, UNITS_EM);
    window.setResizable(true);
    window.setModal(false);
    window.setResizeLazy(true);

    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            l.setEnabled(true);
        }
    });

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

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);/* w  w  w.  jav  a2  s  .  c  o m*/
    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.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());
    }/*  ww  w  .  j a va2 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:com.kelt.disk.db.web.DiskDBApplication.java

License:Apache License

@Override
public void init() {
    final Window mainWindow = new Window("Samplevaadin Application");
    final Window window = new Window("Some Window");
    window.setWidth(800, Sizeable.UNITS_PIXELS);
    window.setHeight(601, Sizeable.UNITS_PIXELS);
    window.setClosable(false);/*from w w  w.j av a  2 s.co  m*/
    window.setDraggable(false);
    window.setResizable(false);
    window.center();
    setUpWindow(window);
    mainWindow.addWindow(window);
    setMainWindow(mainWindow);
}

From source file:com.lizardtech.expresszip.ui.SetupMapPresenter.java

License:Apache License

@Override
public void shapeFileUploadedEvent(final String filename, final ByteArrayInputStream input) {
    final Window modal = new Window("Wait");
    final Window mainWindow = (ExpressZipWindow) setupMapView.getApplication().getMainWindow();
    final SetupMapPresenter presenter = this;

    Thread spinner = new Thread(new Runnable() {
        public void run() {
            ProgressIndicator pi = new ProgressIndicator();
            pi.setCaption("Processing Shapefile...");
            modal.setModal(true);/*from   w ww.j  a  va  2  s .  c o  m*/
            modal.setClosable(false);
            modal.setResizable(false);
            modal.getContent().setSizeUndefined(); // trick to size around content
            modal.getContent().addComponent(pi);
            modal.setWidth(modal.getWidth(), modal.getWidthUnits());
            mainWindow.addWindow(modal);
            VectorLayer uploadedShapeFile = setupMapModel.shapeFileUploaded(filename, input);
            if (uploadedShapeFile != null) {
                shapeFileLayer = uploadedShapeFile;
                mapModel.addVectorLayer(shapeFileLayer);
                setupMapView.updateShapeLayer(shapeFileLayer);
                mapModel.updateOpenLayersMap();

                Bounds shpFileBounds = shapeFileLayer.getBoundsForLayer(mapModel.getCurrentProjection());
                resetExtentLayer(shpFileBounds, presenter);
                map.addLayer(boundingBoxLayer);
            }
            mainWindow.removeWindow(modal);
        }
    });
    spinner.start();
}

From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentComplaintsPanel.java

private void openComplaintWindow(Complaint complaint) {

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();

    Window window = new Window("Registro de Queja");
    window.setModal(true);// ww  w  . ja  v a 2  s .  co m
    if (webBrowser.getScreenWidth() < 1024) {
        window.setSizeFull();
    } else {
        window.setHeight(90.0f, Unit.PERCENTAGE);
        window.setWidth(90.0f, Unit.PERCENTAGE);
    }

    //        TextField nameField = new TextField();
    //        nameField.setInputPrompt("Introduzca el ttulo de la queja");
    //        nameField.setWidth("100%");
    TextArea notesArea = new TextArea();
    notesArea.setInputPrompt("Introduzca el contenido de la queja");
    notesArea.setSizeFull();
    //        CheckBox doneField = new CheckBox("Atendido");

    HorizontalLayout horizontal = new HorizontalLayout();
    horizontal.setSpacing(true);
    horizontal.addComponent(createDeleteButton(window));
    horizontal.addComponent(createOkButton(window));

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setMargin(true);
    layout.addComponent(complaintType);
    layout.addComponent(notesArea);
    //        layout.addComponent(doneField);
    layout.addComponent(horizontal);
    layout.setComponentAlignment(horizontal, Alignment.MIDDLE_RIGHT);
    layout.setExpandRatio(complaintType, 1);
    layout.setExpandRatio(notesArea, 8);
    //        layout.setExpandRatio(doneField, 1);
    layout.setExpandRatio(horizontal, 1);

    BeanItem beanItem = new BeanItem<>(complaint);
    fieldGroup = new BeanFieldGroup<>(Complaint.class);
    fieldGroup.setItemDataSource(beanItem);
    fieldGroup.bind(complaintType, "complaintType");
    fieldGroup.bind(notesArea, "notes");
    //        fieldGroup.bind(doneField, "done");

    window.setContent(layout);
    getUI().addWindow(window);

    //        Window windowComplaint = new Window(complaintView);
    //        WidgetActions actions = new WidgetActions(){
    //
    //            @Override
    //            public void saveAction() {
    //                refreshBind();
    //                windowComplaint.close();
    //            }
    //
    //            @Override
    //            public void deleteAction() {
    //                appointment.getComplaints().remove(complaint);
    //                refreshBind();
    //                windowComplaint.close();
    //            }
    //            
    //        };
    //        complaintView.bind(complaint);
    //        complaintView.setActions(actions);
    //        getUI().addWindow(windowComplaint);
}

From source file:com.zklogtool.web.components.MainLayout.java

License:Apache License

public MainLayout() {

    buildMainLayout();/*from w w w  .  ja va 2  s  .  co m*/

    setCompositionRoot(mainLayout);

    versionLabel.setValue("zklogtoolwebapp " + projectVersion());

    MenuItem fileMenuItem = menuBar_1.addItem("File", null, null);

    fileMenuItem.addItem("Open transaction log", new MenuBar.Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {

            final Window window = new Window("Open transaction log file");
            window.setModal(true);

            OpenTransactionLogFileDialog openFileDialog = new OpenTransactionLogFileDialog(tabSheet_1, window);
            window.setHeight(300, Unit.PIXELS);
            window.setWidth(600, Unit.PIXELS);

            window.setContent(openFileDialog);
            UI.getCurrent().addWindow(window);

        }

    });

    fileMenuItem.addItem("Open snapshot", new MenuBar.Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {

            final Window window = new Window("Open snapshot file");
            window.setModal(true);

            OpenSnapshotFileDialog openFileDialog = new OpenSnapshotFileDialog(tabSheet_1, window);
            window.setHeight(250, Unit.PIXELS);
            window.setWidth(600, Unit.PIXELS);

            window.setContent(openFileDialog);
            UI.getCurrent().addWindow(window);

        }

    });

    MenuItem helpMenuItem = menuBar_1.addItem("Help", null, null);

    helpMenuItem.addItem("About", new MenuBar.Command() {

        @Override
        public void menuSelected(MenuItem selectedItem) {

            final Window window = new Window("About");
            window.setModal(true);

            final VerticalLayout verticalLayout = new VerticalLayout();
            verticalLayout.setMargin(true);
            verticalLayout.addComponent(new Label("This is zklogtool web front end in development"));

            window.setContent(verticalLayout);
            UI.getCurrent().addWindow(window);

        }

    });

}

From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPost.java

/**
 * Adds click listeners to the buttons//from w  w  w  .  j a  v  a  2 s .c  o  m
 */
private void addClickListeners() {
    this.likes.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Post post = componentPostService.updateLikeRating(postId);
            numberOfLikes = post.getLikeCount();
            numberOfDisagrees = post.getHateCount();
            updateHateLike();

        }
    });
    this.disagrees.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Post post = componentPostService.updateDisagreeRating(postId);

            numberOfLikes = post.getLikeCount();
            numberOfDisagrees = post.getHateCount();
            updateHateLike();
        }
    });
    this.tags.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Window subWindow = new Window(msgs.getMessage("post.tags"));

            subWindow.setModal(true);
            subWindow.center();
            subWindow.setWidth(400, Unit.PIXELS);
            subWindow.setHeight(110, Unit.PIXELS);
            subWindow.setResizable(false);
            Panel panel = new Panel();

            panel.setSizeFull();
            HorizontalLayout tagsWrapper = new HorizontalLayout();
            tagsWrapper.setStyleName("margin-left-big");
            panel.setContent(tagsWrapper);
            tagsWrapper.setSpacing(true);
            tagsWrapper.setMargin(true);
            tagsWrapper.setSizeUndefined();

            for (Tag t : postService.getPostTags(postId)) {
                CustomLayout tag = new CustomLayout("tag");
                Button tagLabel = new Button(t.getTagName());
                tag.addComponent(tagLabel, "button");

                tagsWrapper.addComponent(tag);
            }

            subWindow.setContent(panel);
            UI.getCurrent().addWindow(subWindow);
        }
    });
    this.comments.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Window subWindow = new Window(msgs.getMessage("post.comments"));

            subWindow.setModal(true);
            subWindow.center();
            subWindow.setWidth(400, Unit.PIXELS);
            subWindow.setHeight(600, Unit.PIXELS);
            subWindow.setResizable(true);

            ComponentPostComments componentPostComments = applicationContext
                    .getBean(ComponentPostComments.class, postId);
            subWindow.setContent(componentPostComments);
            UI.getCurrent().addWindow(subWindow);
        }
    });
    this.name.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            Window subWindow = new Window(msgs.getMessage("header.profile") + "- " + name.getCaption());

            subWindow.setModal(true);
            subWindow.center();
            subWindow.setWidth(400, Unit.PIXELS);
            subWindow.setHeight(350, Unit.PIXELS);
            subWindow.setResizable(true);

            Users user = postService.getPostById(postId).getUser();
            ComponentProfilePost profilePost = applicationContext.getBean(ComponentProfilePost.class, user);

            subWindow.setContent(profilePost);
            UI.getCurrent().addWindow(subWindow);
        }
    });
}

From source file:cz.zcu.pia.social.network.frontend.components.profile.friends.ComponentFriends.java

/**
 * Function for manage friends requests button
 *//*  www. j a va2 s  .c  o  m*/
private void manageFriendsRequestsButtonFunction() {
    Window subWindow = new Window(msgs.getMessage("post.comments"));
    ComponentManageFriendRequest manageFriendRequest = applicationContext
            .getBean(ComponentManageFriendRequest.class);
    manageFriendRequest.setParentReference(this);
    manageFriendRequest.setSizeFull();
    subWindow.setModal(true);
    subWindow.center();
    subWindow.setWidth(500, Unit.PIXELS);
    subWindow.setHeight(400, Unit.PIXELS);
    subWindow.setResizable(true);
    subWindow.setContent(manageFriendRequest);
    UI.getCurrent().addWindow(subWindow);

}

From source file:cz.zcu.pia.social.network.frontend.views.ViewHome.java

/**
 * Add button function//from www.j  a v  a  2 s.  c  o  m
 * @param event  click event
 */
private void addButtonFunction(Button.ClickEvent event) {
    Window subWindow = new Window(msgs.getMessage("post.add.new"));
    subWindow.setModal(true);
    subWindow.center();
    subWindow.setWidth(400, Unit.PIXELS);
    subWindow.setHeight(300, Unit.PIXELS);
    ComponentPostAdd postAdd = applicationContext.getBean(ComponentPostAdd.class);
    postAdd.setComponentParent(this);
    postAdd.setWindow(subWindow);
    postAdd.setMargin(true);
    subWindow.setContent(postAdd);
    UI.getCurrent().addWindow(subWindow);
}