Example usage for com.vaadin.ui Window setHeight

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

Introduction

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

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:at.peppol.webgui.app.MainWindow.java

License:Mozilla Public License

public void showOrdUploadWindow() {
    // this.showNotification("Warning",
    // "<br/>Uploading orders is under construction",
    // Window.Notification.TYPE_HUMANIZED_MESSAGE);
    final Window popup = new OrderUploadWindow().getWindow();
    popup.setResizable(false);/*from  w ww  .  j a  va 2 s.  c o m*/
    popup.setHeight("150px");
    popup.setWidth("430px");
    getWindow().addWindow(popup);
}

From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.topic.accounting.AccountingQuestionManager.java

License:LGPL

public AccountingQuestionManager(String quizName) {
    super(quizName);
    Button openKontenplan = new Button("Open Kontenplan");
    openKontenplan.addClickListener(e -> {
        openKontenplan.setEnabled(false);
        // Create Window with layout
        Window window = new Window("Kontenplan");
        GridLayout layout = new GridLayout(1, 1);
        layout.addComponent(AccountingDataProvider.getInstance().toHtmlTable());
        layout.setSizeFull();//from  w  ww .  ja v a  2s .c o m
        window.setContent(layout);
        window.center();
        window.setWidth("60%");
        window.setHeight("80%");
        window.setResizable(false);
        window.addCloseListener(e1 -> openKontenplan.setEnabled(true));
        getUI().addWindow(window);

    });
    addHelpButton(openKontenplan);
}

From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.VaadinResultView.java

License:LGPL

public VaadinResultView(ResultFiredArgs args, String title) {
    setSpacing(true);//w w  w  .jav  a 2 s .  c om
    addComponent(new HtmlLabel(title));
    addComponent(HtmlLabel.getCenteredLabel("h2", "Finished test"));
    addComponent(HtmlLabel.getCenteredLabel("The test ended, because we "
            + (args.outOfQuestions ? "did not have any more questions" : "determined your skill level")));
    addComponent(HtmlLabel.getCenteredLabel(
            "This are the difficulties and your answers. On top are your last answers. The first column indicates the difficulty."));
    addComponent(HtmlLabel.getCenteredLabel(
            "Closer to -INF means easy question, to +INF dificult questions. This also applies to your skill level!"));

    // Create HTML table of the history
    Table table = new Table();
    final String solution = "Solution", userAnswewr = "Yourt answer";
    table.addContainerProperty("Question difficulty", Float.class, null);
    table.addContainerProperty("Result", String.class, null);
    table.addContainerProperty(userAnswewr, Button.class, null);
    table.addContainerProperty(solution, Button.class, null);
    List<HistoryEntry> entries = Lists.reverse(args.history);

    for (HistoryEntry entry : entries) {
        Button qAnswer = null, qSolution = null;
        if (entry.question instanceof Component && entry.question != null) {
            try {
                Class<? extends AnswerStorage> dataStorageClass = entry.question.getSolution().getClass();
                Constructor<? extends IQuestion> constructor = entry.question.getClass()
                        .getConstructor(dataStorageClass, dataStorageClass, float.class, String.class);
                // The following casts can not fail, because the question is
                // a component as well
                Component iQuestionSolution = (Component) constructor.newInstance(entry.question.getSolution(),
                        entry.question.getSolution(), entry.question.getDifficulty(),
                        entry.question.getQuestionText());
                Component iQuestionUser = (Component) constructor.newInstance(entry.question.getSolution(),
                        entry.question.getUserAnswer(), entry.question.getDifficulty(),
                        entry.question.getQuestionText());
                // Create the 2 needed click listeners
                ClickListener clickListenerSol = event -> {
                    Window window = new Window(solution);
                    event.getButton().setEnabled(false);
                    window.addCloseListener(e -> event.getButton().setEnabled(true));
                    window.setContent(iQuestionSolution);
                    window.center();
                    window.setWidth("90%");
                    window.setHeight("50%");
                    if (iQuestionSolution instanceof Sizeable) {
                        Sizeable sizeable = iQuestionSolution;
                        sizeable.setSizeFull();
                    }
                    getUI().addWindow(window);
                };

                ClickListener clickListenerUA = event -> {
                    Window window = new Window(userAnswewr);
                    event.getButton().setEnabled(false);
                    window.addCloseListener(e -> event.getButton().setEnabled(true));
                    window.setContent(iQuestionUser);
                    window.center();
                    window.setWidth("90%");
                    window.setHeight("50%");
                    if (iQuestionUser instanceof Sizeable) {
                        Sizeable sizeable = iQuestionUser;
                        sizeable.setSizeFull();
                    }
                    getUI().addWindow(window);
                };

                // Create the two buttons
                qAnswer = new Button(userAnswewr, clickListenerUA);
                qSolution = new Button(solution, clickListenerSol);

            } catch (Exception e) {
                // Ignore this line in the table
                LogHelper.logInfo("1 entry's solution/ user answer are missing on the final screen."
                        + entry.question.getClass().getName()
                        + " does not implement the constructors required by" + IQuestion.class.getName());
            }
        }

        table.addItem(new Object[] { entry.question.getDifficulty(),
                isCorrect(entry.points, entry.question.getMaxPoints()), qAnswer, qSolution }, null);
    }
    int size = table.size();
    if (size > 10) {
        size = 10;
    }
    table.setPageLength(size);
    addComponent(table);
    setComponentAlignment(table, Alignment.MIDDLE_CENTER);

    addComponent(HtmlLabel.getCenteredLabel("h3", "Your skill level is: <b>" + args.skillLevel + "</b>"));
    addComponent(HtmlLabel.getCenteredLabel("Delta (Valus close to 0 are best):  " + args.delta));
}

From source file:au.org.scoutmaster.views.ContactView.java

private void showMailForm(final TextField emailField) {
    final Window mailWindow = new Window("Send Email");
    mailWindow.setWidth("80%");
    mailWindow.setHeight("80%");
    final User sender = (User) getSession().getAttribute("user");
    mailWindow.setContent(new EmailForm(mailWindow, sender, getCurrent(), emailField.getValue()));
    mailWindow.setVisible(true);//  ww  w  .  j a v  a2s.co m
    mailWindow.center();
    UI.getCurrent().addWindow(mailWindow);

}

From source file:br.com.anteros.mobileserver.util.UserMessages.java

License:Apache License

public Window confirm(String title, String message, String okTitle, String cancelTitle,
        Button.ClickListener listener) {

    if (title == null) {
        title = CONFIRM_OK_TITLE;/*w w w.  j  a v  a  2  s  . c o  m*/
    }
    if (cancelTitle == null) {
        cancelTitle = CONFIRM_CANCEL_TITLE;
    }
    if (okTitle == null) {
        okTitle = CONFIRM_OK_TITLE;
    }

    final Window confirm = new Window(title);
    this.confirm = confirm;
    win.addWindow(confirm);

    confirm.addListener(new Window.CloseListener() {

        private static final long serialVersionUID = 1971800928047045825L;

        public void windowClose(CloseEvent ce) {
            Object data = ce.getWindow().getData();
            if (data != null) {
                try {
                } catch (Exception exception) {
                    error("Unhandled Exception", exception);
                }
            }
        }
    });

    int chrW = 5;
    int chrH = 15;
    int txtWidth = Math.max(250, Math.min(350, message.length() * chrW));
    int btnHeight = 25;
    int vmargin = 100;
    int hmargin = 40;

    int txtHeight = 2 * chrH * (message.length() * chrW) / txtWidth;

    confirm.setWidth((txtWidth + hmargin) + "px");
    confirm.setHeight((vmargin + txtHeight + btnHeight) + "px");
    confirm.getContent().setSizeFull();

    confirm.center();
    confirm.setModal(true);

    Label text = new Label(message);
    text.setWidth("100%");
    text.setHeight("100%");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setHeight(btnHeight + 5 + "px");
    buttons.setWidth("100%");
    buttons.setSpacing(true);
    buttons.setMargin(false);

    Button cancel = new Button(cancelTitle, listener);
    cancel.setIcon(new ThemeResource("icons/16/no.png"));
    cancel.setData(USER_CONFIRM_CANCEL);
    cancel.setClickShortcut(KeyCode.ESCAPE);
    Button ok = new Button(okTitle, listener);
    ok.setIcon(new ThemeResource("icons/16/yes.png"));
    ok.setData(USER_CONFIRM_OK);
    ok.setClickShortcut(KeyCode.ENTER);
    buttons.addComponent(ok);
    buttons.setExpandRatio(ok, 1);
    buttons.setComponentAlignment(ok, Alignment.MIDDLE_RIGHT);

    buttons.addComponent(cancel);
    buttons.setComponentAlignment(cancel, Alignment.MIDDLE_RIGHT);

    confirm.addComponent(text);
    confirm.addComponent(buttons);
    ((VerticalLayout) confirm.getContent()).setExpandRatio(text, 1f);
    confirm.setResizable(false);
    return confirm;
}

From source file:com.cavisson.gui.dashboard.components.charts.Impl.ResizeInsideVaadinComponent.java

@Override
protected Component getChart() {

    VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel();
    HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSecondComponent(verticalSplitPanel);
    verticalSplitPanel.setFirstComponent(createChart());

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setMargin(true);// w ww. jav  a2  s .  com
    verticalLayout.setSpacing(true);
    verticalLayout.addComponent(
            new Label("Relatively sized components resize themselves automatically when in Vaadin component."));

    Button button = new Button("Open in a window");
    button.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Window window = new Window("Chart windodw");
            window.setContent(createChart());
            window.setWidth("50%");
            window.setHeight("50%");

            getUI().addWindow(window);

        }
    });

    verticalLayout.addComponent(button);
    horizontalSplitPanel.setFirstComponent(verticalLayout);

    return horizontalSplitPanel;
}

From source file:com.concur.ui.WebApp.java

License:Apache License

private void submit() {
    String action = (String) actionField.getValue();
    String token = (String) tokenField.getValue();
    String tupleKey = (String) tupleKeyField.getValue();
    String tupleData = (String) tupleDataArea.getValue();

    if (!"Authenticate".equals(action) && "".equals(token.trim())) // if not logging in & not logged in
    {//from   ww  w  .  j a v a 2 s . co m
        w.showNotification("Authentication Required");
        return;
    }

    String xml = WsXml.cmd(action, token, tupleKey, tupleData);
    String responseXml = Http.post(Config.getWsUrl(), xml);
    XmlMap xmlMap = XmlHandler.parse(responseXml).get("response");

    final XmlMap status = xmlMap.get("status");
    if (!"0".equals(status.getText("statuscode"))) {
        w.showNotification("Web Service call failed -- " + status.getText("statusmsg"));
        return;
    }

    if ("Authenticate".equals(action)) {
        tokenField.setValue(xmlMap.getText("token"));
    } else if ("GetTuple".equals(action)) {
        tupleDataArea.setValue(xmlMap.getText("tupledata"));
    } else if ("PutTuple".equals(action)) {
        w.showNotification("OK");
    } else if ("GetConfigurations".equals(action)) {
        List<XmlMap> tuples = xmlMap.get("config").getAll("tuple");

        Window subWin = new Window("Configurations");
        subWin.setHeight("400px");
        subWin.setWidth("400px");
        subWin.center();
        subWin.setModal(true);

        for (XmlMap tuple : tuples) {
            String text = tuple.getText("key") + " ==> " + tuple.getText("data");
            subWin.addComponent(new Label(text));
        }

        w.addWindow(subWin);
    }
}

From source file:com.etest.connection.ErrorDBNotification.java

public static void showLoggedErrorOnWindow(String str) {
    Window sub = new Window("Logged ERROR");
    sub.setWidth("500px");
    sub.setHeight("300px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);//from w  ww  .  ja  v  a  2s. c o  m
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();

    panel.setContent(new Label(str));
    sub.setContent(panel);
}

From source file:com.expressui.core.view.entityselect.EntitySelect.java

License:Open Source License

/**
 * Configures the popup window size at 95% height and undefined width.
 * May be overriden to customize size./*from w  w  w .j  av a  2 s .  c  om*/
 *
 * @param popupWindow popup window available custome configuration
 */
protected void configurePopupWindow(Window popupWindow) {
    popupWindow.setSizeUndefined();
    popupWindow.setHeight("95%");
}

From source file:com.expressui.core.view.util.CodePopup.java

License:Open Source License

/**
 * Opens popup for given classes./*from  w w w.jav a 2 s .  c  o  m*/
 *
 * @param classes classes for displaying related source code and Javadoc. If
 *                class is within com.expressui.core or com.expressui.domain,
 *                then Javadoc is displayed, otherwise source code.
 */
public void open(Class... classes) {

    Window codeWindow = new Window();
    codeWindow.addStyleName("code-popup");
    codeWindow.setPositionX(20);
    codeWindow.setPositionY(40);
    codeWindow.setWidth("90%");
    codeWindow.setHeight("90%");

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

    codePopupTabSheet.setSizeFull();
    codeWindow.addComponent(codePopupTabSheet);

    String windowCaption = "";
    Set<String> shownUrls = new HashSet<String>();
    for (Class clazz : classes) {
        String tabCaption;
        String url;
        if (clazz.getName().startsWith("com.expressui.core")
                || clazz.getName().startsWith("com.expressui.domain")) {
            url = applicationProperties.getDocUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + " API";
            Embedded embedded = getEmbeddedDoc(url);
            codePopupTabSheet.addTab(embedded, tabCaption);
        } else {
            url = applicationProperties.getCodeUrl(clazz);
            if (shownUrls.contains(url))
                continue;
            tabCaption = clazz.getSimpleName() + ".java";
            String code = getCodeContents(url);
            Label label = new CodeLabel(code);
            codePopupTabSheet.addTab(label, tabCaption);
        }
        shownUrls.add(url);
        if (windowCaption.length() > 0)
            windowCaption += ", ";

        windowCaption += tabCaption;
    }

    codeWindow.setCaption(windowCaption);
    MainApplication.getInstance().getMainWindow().addWindow(codeWindow);
}