Example usage for com.vaadin.ui Window setResizable

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

Introduction

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

Prototype

public void setResizable(boolean resizable) 

Source Link

Document

Sets window resizable.

Usage

From source file:fi.pss.cleanbeach.standalone.map.MapComponent.java

public void addPoint(final fi.pss.cleanbeach.data.Event e) {

    Location l = e.getLocation();

    LMarker m = new LMarker(l.getLatitude(), l.getLongitude());
    m.setData(l);//from w w  w  . j  a  v a 2 s . co m
    addComponent(m);

    setIcon(m, l);
    m.setIconAnchor(new Point(16, 32));

    m.addClickListener(new LeafletClickListener() {

        @Override
        public void onClick(LeafletClickEvent event) {
            details.update(e);
            Window pop = new Window(null, details);
            pop.setResizable(false);
            pop.addStyleName("detailpop");
            pop.setModal(true);
            getUI().addWindow(pop);

            setCenter(e.getLocation().getLatitude(), e.getLocation().getLongitude() + getDetailsPosOffset());
        }

    });
    markers.put(l, m);
}

From source file:fi.semantum.strategia.Utils.java

License:Open Source License

public static void setUserMeter(final Main main, final Base base, final Meter m) {

    final Database database = main.getDatabase();

    final Window subwindow = new Window("Aseta mittarin arvo", new VerticalLayout());
    subwindow.setModal(true);//from   ww  w  .  j a va 2s . co m
    subwindow.setWidth("350px");
    subwindow.setResizable(false);

    final VerticalLayout winLayout = (VerticalLayout) subwindow.getContent();
    winLayout.setMargin(true);
    winLayout.setSpacing(true);

    String caption = m.getCaption(database);
    if (caption != null && !caption.isEmpty()) {
        final Label header = new Label(caption);
        header.addStyleName(ValoTheme.LABEL_LARGE);
        winLayout.addComponent(header);
    }

    final Indicator indicator = m.getPossibleIndicator(database);
    if (indicator == null)
        return;

    Datatype dt = indicator.getDatatype(database);
    if (!(dt instanceof EnumerationDatatype))
        return;

    final Label l = new Label("Selite: " + indicator.getValueShortComment());

    AbstractField<?> forecastField = dt.getEditor(main, base, indicator, true, new CommentCallback() {

        @Override
        public void runWithComment(String shortComment, String comment) {
            l.setValue("Selite: " + indicator.getValueShortComment());
        }

        @Override
        public void canceled() {
        }

    });
    forecastField.setWidth("100%");
    forecastField.setCaption("Ennuste");
    winLayout.addComponent(forecastField);

    AbstractField<?> currentField = dt.getEditor(main, base, indicator, false, new CommentCallback() {

        @Override
        public void runWithComment(String shortComment, String comment) {
            l.setValue("Selite: " + indicator.getValueShortComment());
        }

        @Override
        public void canceled() {
        }

    });
    currentField.setWidth("100%");
    currentField.setCaption("Toteuma");
    winLayout.addComponent(currentField);

    winLayout.addComponent(l);

    l.setWidth("100%");
    winLayout.setComponentAlignment(l, Alignment.BOTTOM_CENTER);

    HorizontalLayout hl = new HorizontalLayout();
    winLayout.addComponent(hl);
    winLayout.setComponentAlignment(hl, Alignment.BOTTOM_CENTER);

    Button ok = new Button("Sulje", new Button.ClickListener() {

        private static final long serialVersionUID = 1364802814012491490L;

        public void buttonClick(ClickEvent event) {
            main.removeWindow(subwindow);
        }

    });

    Button define = new Button("Mrit", new Button.ClickListener() {

        private static final long serialVersionUID = 1364802814012491490L;

        public void buttonClick(ClickEvent event) {
            Meter.editMeter(main, base, m);
        }

    });

    hl.addComponent(ok);
    hl.setComponentAlignment(ok, Alignment.BOTTOM_LEFT);
    hl.addComponent(define);
    hl.setComponentAlignment(define, Alignment.BOTTOM_LEFT);

    main.addWindow(subwindow);

}

From source file:fi.semantum.strategia.Utils.java

License:Open Source License

public static void editTextAndId(final Main main, String title, final Base container) {

    final Database database = main.getDatabase();

    final Window subwindow = new Window(title, new VerticalLayout());
    subwindow.setModal(true);/*from  w  w  w  .j a v a2 s .  co m*/
    subwindow.setWidth("400px");
    subwindow.setHeight("500px");
    subwindow.setResizable(false);

    VerticalLayout winLayout = (VerticalLayout) subwindow.getContent();
    winLayout.setMargin(true);
    winLayout.setSpacing(true);

    final TextField tf = new TextField();
    tf.setCaption("Lyhytnimi:");
    tf.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    tf.setValue(container.getId(database));
    tf.setWidth("100%");
    winLayout.addComponent(tf);

    final TextArea ta = new TextArea();
    ta.setCaption("Teksti:");
    ta.setValue(container.getText(database));
    ta.setWidth("100%");
    ta.setHeight("290px");
    winLayout.addComponent(ta);

    Button save = new Button("Tallenna", new Button.ClickListener() {

        private static final long serialVersionUID = 6641880870005364983L;

        public void buttonClick(ClickEvent event) {
            String idValue = tf.getValue();
            String value = ta.getValue();
            main.removeWindow(subwindow);
            container.modifyId(main, idValue);
            container.modifyText(main, value);
            Collection<String> tags = Tag.extractTags(value);
            database.assertTags(tags);
            ArrayList<Tag> tagObjects = new ArrayList<Tag>();
            for (String s : tags)
                tagObjects.add(database.getOrCreateTag(s));
            container.assertRelatedTags(database, tagObjects);
            Updates.update(main, true);
            Property emails = Property.find(database, Property.EMAIL);
            String addr = emails.getPropertyValue(container);
            if (addr != null && !addr.isEmpty()) {
                String[] addrs = addr.split(",");
                if (addrs.length > 0) {
                    try {
                        Email.send(addrs, "Muutos strategiakartassa: " + container.getId(database),
                                "Kyttj " + main.account.getId(database)
                                        + " on muuttanut strategiakarttaa.<br/><br/>Lyhytnimi: "
                                        + container.getId(database) + "<br/><br/>Teksti: "
                                        + container.getText(database));
                    } catch (MessagingException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

    });

    Button discard = new Button("Peru muutokset", new Button.ClickListener() {

        private static final long serialVersionUID = -784522457615993823L;

        public void buttonClick(ClickEvent event) {
            Updates.update(main, true);
            main.removeWindow(subwindow);
        }

    });

    HorizontalLayout hl2 = new HorizontalLayout();
    hl2.setSpacing(true);
    hl2.addComponent(save);
    hl2.addComponent(discard);
    winLayout.addComponent(hl2);
    winLayout.setComponentAlignment(hl2, Alignment.MIDDLE_CENTER);
    main.addWindow(subwindow);

    ta.setCursorPosition(ta.getValue().length());

}

From source file:fi.semantum.strategia.Utils.java

License:Open Source License

public static void editTags(final Main main, String title, final Base container) {

    final Database database = main.getDatabase();

    final Window subwindow = new Window(title, new VerticalLayout());
    subwindow.setModal(true);/* ww w .j  av a2s.  co  m*/
    subwindow.setWidth("400px");
    subwindow.setHeight("360px");
    subwindow.setResizable(true);

    VerticalLayout winLayout = (VerticalLayout) subwindow.getContent();
    winLayout.setMargin(true);
    winLayout.setSpacing(true);

    // Add some content; a label and a close-button
    final List<String> tags = new ArrayList<String>();
    for (Tag t : container.getRelatedTags(database))
        tags.add(t.getId(database));

    final CssLayout vl = new CssLayout();
    vl.setCaption("Kytss olevat aihetunnisteet:");
    fillTagEditor(database, vl, tags, Account.canWrite(main, container));
    winLayout.addComponent(vl);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setSpacing(true);

    final TagCombo combo = new TagCombo();
    final CustomLazyContainer comboContainer = new CustomLazyContainer(database, combo,
            Tag.enumerate(database));
    combo.setWidth("100%");
    combo.setCaption("Uusi aihetunniste:");
    combo.setInputPrompt("valitse listasta tai kirjoita");
    combo.setFilteringMode(FilteringMode.STARTSWITH);
    combo.setTextInputAllowed(true);
    combo.setImmediate(true);
    combo.setNullSelectionAllowed(false);
    combo.setInvalidAllowed(true);
    combo.setInvalidCommitted(true);
    combo.setItemCaptionMode(ItemCaptionMode.PROPERTY);
    combo.setItemCaptionPropertyId("id"); //should set
    combo.setContainerDataSource(comboContainer);

    hl.addComponent(combo);
    hl.setExpandRatio(combo, 1.0f);

    Button add = new Button("Lis", new Button.ClickListener() {

        private static final long serialVersionUID = -2848576385076605664L;

        public void buttonClick(ClickEvent event) {
            String filter = (String) combo.getValue();
            if (filter != null && filter.length() > 0) {
                Tag t = database.getOrCreateTag(filter);
                if (tags.contains(t.getId(database)))
                    return;
                tags.add(t.getId(database));
                fillTagEditor(database, vl, tags, main.account != null);
                combo.clear();
            }
        }
    });
    hl.addComponent(add);
    hl.setComponentAlignment(add, Alignment.BOTTOM_LEFT);
    hl.setExpandRatio(add, 0.0f);

    winLayout.addComponent(hl);

    Button close = new Button("Tallenna", new Button.ClickListener() {

        private static final long serialVersionUID = -451523776456589591L;

        public void buttonClick(ClickEvent event) {
            main.removeWindow(subwindow);
            List<Tag> newTags = new ArrayList<Tag>();
            for (String s : tags)
                newTags.add(database.getOrCreateTag(s));
            container.setRelatedTags(database, newTags);
            Updates.update(main, true);
        }
    });
    Button discard = new Button("Peru muutokset", new Button.ClickListener() {

        private static final long serialVersionUID = -2387057110951581993L;

        public void buttonClick(ClickEvent event) {
            main.removeWindow(subwindow);
        }
    });

    HorizontalLayout hl2 = new HorizontalLayout();
    hl2.setSpacing(true);
    hl2.addComponent(close);
    hl2.addComponent(discard);
    winLayout.addComponent(hl2);
    winLayout.setComponentAlignment(hl2, Alignment.MIDDLE_CENTER);

    main.addWindow(subwindow);

}

From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.CoordMobileAuthView.java

License:Open Source License

public CoordMobileAuthView(String CoordID) {

    CtCoordinator ctCoordinator = (CtCoordinator) sys
            .getCtCoordinator(new DtCoordinatorID(new PtString(CoordID)));
    ActCoordinator actCoordinator = sys.getActCoordinator(ctCoordinator);

    actCoordinator.setActorUI(UI.getCurrent());
    env.setActCoordinator(actCoordinator.getName(), actCoordinator);

    IcrashSystem.assCtAuthenticatedActAuthenticated.replace(ctCoordinator, actCoordinator);
    IcrashSystem.assCtCoordinatorActCoordinator.replace(ctCoordinator, actCoordinator);

    thisCoordID = CoordID;/*from w  w  w.j a  v a2s.  c  om*/

    setResponsive(true);
    setWidth("100%");

    NavigationBar alertsBar = new NavigationBar();
    VerticalComponentGroup alertsContent = new VerticalComponentGroup();
    alertsContent.setWidth("100%");
    alertsContent.setResponsive(true);

    HorizontalLayout alertButtons1 = new HorizontalLayout();
    HorizontalLayout alertButtons2 = new HorizontalLayout();
    //alertButtons.setMargin(true);
    //alertButtons.setSpacing(true);

    alertsBar.setCaption("Coordinator " + ctCoordinator.login.toString());
    // NavigationButton logoutBtn1 = new NavigationButton("Logout");
    Button logoutBtn1 = new Button("Logout");
    alertsBar.setRightComponent(logoutBtn1);

    alertsTable = new Grid();
    alertsTable.setContainerDataSource(actCoordinator.getAlertsContainer());
    alertsTable.setColumnOrder("ID", "date", "time", "longitude", "latitude", "comment", "status");
    alertsTable.setSelectionMode(SelectionMode.SINGLE);

    alertsTable.setWidth("100%");
    alertsTable.setResponsive(true);
    //alertsTable.setSizeUndefined();

    alertsTable.setImmediate(true);

    Grid inputEventsTable1 = new Grid();
    inputEventsTable1.setContainerDataSource(actCoordinator.getMessagesDataSource());
    inputEventsTable1.setWidth("100%");
    inputEventsTable1.setResponsive(true);

    alertsContent.addComponents(alertsBar, alertButtons1, alertButtons2, alertsTable, inputEventsTable1);

    Tab alertsTab = this.addTab(alertsContent);
    alertsTab.setCaption("Alerts");

    alertStatus = new NativeSelect();
    alertStatus.setNullSelectionAllowed(false);
    alertStatus.addItems("Pending", "Valid", "Invalid");
    alertStatus.setImmediate(true);

    alertStatus.select("Pending");

    Button validateAlertBtn = new Button("Validate");
    Button invalidateAlertBtn = new Button("Invalidate");
    Button getAlertsSetBtn = new Button("Get alerts set");

    validateAlertBtn.setImmediate(true);
    invalidateAlertBtn.setImmediate(true);

    validateAlertBtn.addClickListener(event -> {
        AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow();

        Integer thisAlertID = new Integer(selectedAlertBean.getID());
        PtBoolean res;
        res = sys.oeValidateAlert(new DtAlertID(new PtString(thisAlertID.toString())));
    });

    invalidateAlertBtn.addClickListener(event -> {
        AlertBean selectedAlertBean = (AlertBean) alertsTable.getSelectedRow();
        Integer thisAlertID = new Integer(selectedAlertBean.getID());
        PtBoolean res;
        res = sys.oeInvalidateAlert(new DtAlertID(new PtString(thisAlertID.toString())));
    });

    getAlertsSetBtn.addClickListener(event -> {
        if (alertStatus.getValue().toString().equals("Pending"))
            actCoordinator.oeGetAlertsSet(EtAlertStatus.pending);
        else if (alertStatus.getValue().toString().equals("Valid"))
            actCoordinator.oeGetAlertsSet(EtAlertStatus.valid);
        else if (alertStatus.getValue().toString().equals("Invalid"))
            actCoordinator.oeGetAlertsSet(EtAlertStatus.invalid);
    });

    alertButtons1.addComponents(validateAlertBtn, invalidateAlertBtn);
    alertButtons2.addComponents(getAlertsSetBtn, alertStatus);

    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////////////////////////////////////////

    NavigationBar crisesBar = new NavigationBar();
    VerticalComponentGroup crisesContent = new VerticalComponentGroup();
    crisesContent.setWidth("100%");
    crisesContent.setResponsive(true);

    HorizontalLayout crisesButtons1 = new HorizontalLayout();
    HorizontalLayout crisesButtons2 = new HorizontalLayout();
    crisesBar.setCaption("Coordinator " + ctCoordinator.login.toString());
    //NavigationButton logoutBtn2 = new NavigationButton("Logout");
    Button logoutBtn2 = new Button("Logout");
    crisesBar.setRightComponent(logoutBtn2);

    crisesTable = new Grid();
    crisesTable.setContainerDataSource(actCoordinator.getCrisesContainer());
    crisesTable.setColumnOrder("ID", "date", "time", "type", "longitude", "latitude", "comment", "status");
    crisesTable.setSelectionMode(SelectionMode.SINGLE);

    crisesTable.setWidth("100%");
    //crisesTable.setSizeUndefined();

    crisesTable.setImmediate(true);
    crisesTable.setResponsive(true);

    Grid inputEventsTable2 = new Grid();
    inputEventsTable2.setContainerDataSource(actCoordinator.getMessagesDataSource());
    inputEventsTable2.setWidth("100%");
    inputEventsTable2.setResponsive(true);

    crisesContent.addComponents(crisesBar, crisesButtons1, crisesButtons2, crisesTable, inputEventsTable2);

    Tab crisesTab = this.addTab(crisesContent);
    crisesTab.setCaption("Crises");

    Button handleCrisesBtn = new Button("Handle");
    Button reportOnCrisisBtn = new Button("Report");
    Button changeCrisisStatusBtn = new Button("Status");
    Button closeCrisisBtn = new Button("Close");
    Button getCrisesSetBtn = new Button("Get crises set");
    crisesStatus = new NativeSelect();

    handleCrisesBtn.setImmediate(true);
    reportOnCrisisBtn.setImmediate(true);
    changeCrisisStatusBtn.setImmediate(true);
    closeCrisisBtn.setImmediate(true);
    getCrisesSetBtn.setImmediate(true);
    crisesStatus.setImmediate(true);

    crisesStatus.addItems("Pending", "Handled", "Solved", "Closed");
    crisesStatus.setNullSelectionAllowed(false);
    crisesStatus.select("Pending");

    crisesButtons1.addComponents(handleCrisesBtn, reportOnCrisisBtn, changeCrisisStatusBtn);
    crisesButtons2.addComponents(closeCrisisBtn, getCrisesSetBtn, crisesStatus);

    ////////////////////////////////////////

    Window reportCrisisSubWindow = new Window();
    reportCrisisSubWindow.setClosable(false);
    reportCrisisSubWindow.setResizable(false);
    reportCrisisSubWindow.setResponsive(true);
    VerticalLayout reportLayout = new VerticalLayout();
    reportLayout.setMargin(true);
    reportLayout.setSpacing(true);
    reportCrisisSubWindow.setContent(reportLayout);
    TextField crisisID = new TextField();
    TextField reportText = new TextField();
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    Button reportCrisisBtn = new Button("Report");
    reportCrisisBtn.setClickShortcut(KeyCode.ENTER);
    reportCrisisBtn.addStyleName(ValoTheme.BUTTON_PRIMARY);
    Button cancelBtn = new Button("Cancel");
    buttonsLayout.addComponents(reportCrisisBtn, cancelBtn);
    buttonsLayout.setSpacing(true);
    reportLayout.addComponents(crisisID, reportText, buttonsLayout);

    cancelBtn.addClickListener(event -> {
        reportCrisisSubWindow.close();
        reportText.clear();
    });

    reportCrisisBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        actCoordinator.oeReportOnCrisis(new DtCrisisID(new PtString(thisCrisisID.toString())),
                new DtComment(new PtString(reportText.getValue())));

        reportCrisisSubWindow.close();
        reportText.clear();
    });

    ////////////////////////////////////////

    Window changeCrisisStatusSubWindow = new Window();
    changeCrisisStatusSubWindow.setClosable(false);
    changeCrisisStatusSubWindow.setResizable(false);
    changeCrisisStatusSubWindow.setResponsive(true);
    VerticalLayout statusLayout = new VerticalLayout();
    statusLayout.setMargin(true);
    statusLayout.setSpacing(true);
    changeCrisisStatusSubWindow.setContent(statusLayout);
    TextField crisisID1 = new TextField();

    NativeSelect crisisStatus = new NativeSelect("crisis status");
    crisisStatus.addItems("Pending", "Handled", "Solved", "Closed");
    crisisStatus.setNullSelectionAllowed(false);
    crisisStatus.select("Pending");

    HorizontalLayout buttonsLayout1 = new HorizontalLayout();
    Button changeCrisisStatusBtn1 = new Button("Change status");
    changeCrisisStatusBtn1.setClickShortcut(KeyCode.ENTER);
    changeCrisisStatusBtn1.addStyleName(ValoTheme.BUTTON_PRIMARY);
    Button cancelBtn1 = new Button("Cancel");
    buttonsLayout1.addComponents(changeCrisisStatusBtn1, cancelBtn1);
    buttonsLayout1.setSpacing(true);
    statusLayout.addComponents(crisisID1, crisisStatus, buttonsLayout1);

    cancelBtn1.addClickListener(event -> changeCrisisStatusSubWindow.close());

    changeCrisisStatusBtn1.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());

        EtCrisisStatus statusToPut = null;

        if (crisisStatus.getValue().toString().equals("Pending"))
            statusToPut = EtCrisisStatus.pending;
        if (crisisStatus.getValue().toString().equals("Handled"))
            statusToPut = EtCrisisStatus.handled;
        if (crisisStatus.getValue().toString().equals("Solved"))
            statusToPut = EtCrisisStatus.solved;
        if (crisisStatus.getValue().toString().equals("Closed"))
            statusToPut = EtCrisisStatus.closed;

        PtBoolean res = actCoordinator.oeSetCrisisStatus(new DtCrisisID(new PtString(thisCrisisID.toString())),
                statusToPut);

        changeCrisisStatusSubWindow.close();
    });

    ////////////////////////////////////////

    handleCrisesBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        PtBoolean res = actCoordinator
                .oeSetCrisisHandler(new DtCrisisID(new PtString(thisCrisisID.toString())));
    });

    reportOnCrisisBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        reportCrisisSubWindow.center();
        crisisID.setValue(thisCrisisID.toString());
        crisisID.setEnabled(false);
        reportText.focus();
        UI.getCurrent().addWindow(reportCrisisSubWindow);
    });

    changeCrisisStatusBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        changeCrisisStatusSubWindow.center();
        crisisID1.setValue(thisCrisisID.toString());
        crisisID1.setEnabled(false);
        crisisStatus.focus();
        UI.getCurrent().addWindow(changeCrisisStatusSubWindow);
    });

    closeCrisisBtn.addClickListener(event -> {
        CrisisBean selectedCrisisBean = (CrisisBean) crisesTable.getSelectedRow();
        Integer thisCrisisID = new Integer(selectedCrisisBean.getID());
        PtBoolean res = actCoordinator.oeCloseCrisis(new DtCrisisID(new PtString(thisCrisisID.toString())));
    });

    getCrisesSetBtn.addClickListener(event -> {
        if (crisesStatus.getValue().toString().equals("Closed"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.closed);
        if (crisesStatus.getValue().toString().equals("Handled"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.handled);
        if (crisesStatus.getValue().toString().equals("Solved"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.solved);
        if (crisesStatus.getValue().toString().equals("Pending"))
            actCoordinator.oeGetCrisisSet(EtCrisisStatus.pending);
    });

    ClickListener logoutAction = event -> {
        PtBoolean res;
        try {
            res = actCoordinator.oeLogout();
            if (res.getValue()) {
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        Page.getCurrent().reload();
    };

    logoutBtn1.addClickListener(logoutAction);
    logoutBtn2.addClickListener(logoutAction);
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private void initView() {
    setCompositionRoot(root);/*from  ww  w. j a  v  a  2s .c o m*/
    root.setSizeFull();
    root.setSplitPosition(15);
    root.setStyleName("small previews");

    previewArea.setWidth("100%");
    previewTabs = new VerticalLayout();
    previewTabs.setSizeFull();
    previewTabs.setHeight(null);

    compoundTabs = new VerticalLayout();
    compoundTabs.setSizeFull();
    compoundTabs.setHeight(null);

    bennuStylesTabs = new VerticalLayout();
    bennuStylesTabs.setSizeFull();
    bennuStylesTabs.setHeight(null);

    VerticalLayout menu = new VerticalLayout();
    menu.setSizeFull();
    menu.setStyleName("sidebar-menu");

    Button syncThemes = new Button("Sync Themes", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            syncThemes();
        }
    });
    menu.addComponent(syncThemes);
    menu.addComponent(new Label("Single Components"));
    menu.addComponent(previewTabs);
    menu.addComponent(new Label("Compound Styles"));
    menu.addComponent(compoundTabs);

    menu.addComponent(new Label("Bennu Styles"));
    menu.addComponent(bennuStylesTabs);

    root.setFirstComponent(menu);

    CssLayout toolbar = new CssLayout();
    toolbar.setWidth("100%");
    toolbar.setStyleName("toolbar");
    toolbar.addComponent(editorToggle);

    final Window downloadWindow = new Window("Download Theme");
    GridLayout l = new GridLayout(3, 2);
    l.setSizeUndefined();
    l.setMargin(true);
    l.setSpacing(true);
    downloadWindow.setContent(l);
    downloadWindow.setModal(true);
    downloadWindow.setResizable(false);
    downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null);
    downloadWindow.addStyleName("opaque");
    Label caption = new Label("Theme Name");
    l.addComponent(caption);
    l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
    final TextField name = new TextField();
    name.setValue("my-chameleon");
    name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed"));
    name.setRequired(true);
    name.setRequiredError("Please give a name for the theme");
    downloadWindow.addComponent(name);
    Label info = new Label(
            "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.",
            Label.CONTENT_XHTML);
    info.addStyleName("tiny");
    info.setWidth("200px");
    l.addComponent(info, 1, 1, 2, 1);

    Button download = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().addWindow(downloadWindow);
            name.focus();
        }
    });
    download.setDescription("Donwload the current theme");
    download.setIcon(new ThemeResource("download.png"));
    download.setStyleName("icon-only");
    toolbar.addComponent(download);

    menu.addComponent(toolbar);
    menu.setExpandRatio(toolbar, 1);
    menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER);

}

From source file:org.eclipse.hawkbit.ui.common.builder.WindowBuilder.java

License:Open Source License

/**
 * Build window based on type.//w w w.j a  v  a 2s.  c  o  m
 *
 * @return Window
 */
public Window buildWindow() {
    final Window window = new Window(caption);
    window.setContent(content);
    window.setSizeUndefined();
    window.setModal(true);
    window.setResizable(false);

    decorateWindow(window);

    if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
        window.setClosable(false);
    }

    return window;
}

From source file:org.eclipse.hawkbit.ui.distributions.smtable.SwModuleDetails.java

License:Open Source License

private void showArtifactDetailsWindow(final SoftwareModule softwareModule) {
    final Window artifactDtlsWindow = new Window();
    artifactDtlsWindow.setCaption(HawkbitCommonUtil.getArtifactoryDetailsLabelId(
            softwareModule.getName() + "." + softwareModule.getVersion(), getI18n()));
    artifactDtlsWindow.setCaptionAsHtml(true);
    artifactDtlsWindow.setClosable(true);
    artifactDtlsWindow.setResizable(true);
    artifactDtlsWindow.setImmediate(true);
    artifactDtlsWindow.setWindowMode(WindowMode.NORMAL);
    artifactDtlsWindow.setModal(true);//w w w .  j  a v a  2  s  .co  m
    artifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);

    artifactDetailsLayout.setFullWindowMode(false);
    artifactDetailsLayout.populateArtifactDetails(softwareModule);
    artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS);
    artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS);
    artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());

    artifactDtlsWindow.addWindowModeChangeListener(event -> {
        if (event.getWindowMode() == WindowMode.MAXIMIZED) {
            artifactDtlsWindow.setSizeFull();
            artifactDetailsLayout.setFullWindowMode(true);
            artifactDetailsLayout.createMaxArtifactDetailsTable();
            artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE);
            artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE);
            artifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable());
        } else {
            artifactDtlsWindow.setSizeUndefined();
            artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
        }
    });
    UI.getCurrent().addWindow(artifactDtlsWindow);
}

From source file:org.esn.esobase.view.MainView.java

private void openSearchInCatalogs() {
    if (searchInCatalogsTabContent == null) {
        searchInCatalogsTabContent = new SearchInCatalogsTab(service, dictionaryService);
    }/* www  .j av a2s . c  o  m*/
    Window subWindow = new Window(searchInCatalogsMenuItem.getText());
    subWindow.setModal(true);

    subWindow.center();
    this.getUI().addWindow(subWindow);
    subWindow.setResizable(false);
    subWindow.setSizeFull();
    subWindow.setContent(searchInCatalogsTabContent);
    searchInCatalogsTabContent.setWidth();
}

From source file:org.esn.esobase.view.MainView.java

private void openSearchInRaw() {
    if (searchInRawStringsTabContent == null) {
        searchInRawStringsTabContent = new SearchInRawStringsTab(service);
    }//from   ww w. j a v  a2s.  c  o m
    Window subWindow = new Window(searchInRawStringsMenuItem.getText());
    subWindow.setModal(true);

    subWindow.center();
    this.getUI().addWindow(subWindow);
    subWindow.setResizable(false);
    subWindow.setSizeFull();
    subWindow.setContent(searchInRawStringsTabContent);
    searchInRawStringsTabContent.setWidth();
}