Example usage for com.vaadin.server FontAwesome PRINT

List of usage examples for com.vaadin.server FontAwesome PRINT

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome PRINT.

Prototype

FontAwesome PRINT

To view the source code for com.vaadin.server FontAwesome PRINT.

Click Source Link

Usage

From source file:com.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java

License:Open Source License

public UserListViewImpl() {
    super();//from  ww  w.j av  a 2 s. c  o m
    this.setMargin(new MarginInfo(false, true, false, true));
    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth();
    MButton createBtn = new MButton(UserUIContext.getMessage(UserI18nEnum.NEW),
            clickEvent -> EventBusFactory.getInstance().post(new UserEvent.GotoAdd(this, null)))
                    .withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION)
                    .withVisible(UserUIContext.canWrite(RolePermissionCollections.ACCOUNT_USER));

    headerText = HeaderWithFontAwesome.h2(FontAwesome.USERS, UserUIContext.getMessage(UserI18nEnum.LIST) + " "
            + UserUIContext.getMessage(GenericI18Enum.OPT_TOTAL_VALUE, 0));

    final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;
        if (sortAsc) {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
            displayUsers();
        } else {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
            displayUsers();
        }
    });
    header.addComponent(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setDisplayName(StringSearchField.and(value));
            displayUsers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setDisplayName(null);
            displayUsers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);

    MButton printBtn = new MButton("", clickEvent -> UI.getCurrent()
            .addWindow(new UserCustomizeReportOutputWindow(new LazyValueInjector() {
                @Override
                protected Object doEval() {
                    return searchCriteria;
                }
            }))).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION)
                    .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));

    header.with(headerText, sortBtn, searchTextField, printBtn, createBtn).alignAll(Alignment.MIDDLE_LEFT)
            .expand(headerText);
    this.addComponent(header);

    contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    this.addComponent(contentLayout);
}

From source file:com.save.client.promodeals.PDDataContainer.java

public PDDataContainer(int clientId) {
    this.clientId = clientId;

    addContainerProperty("sn", Integer.class, null);
    addContainerProperty("promo items", String.class, null);
    addContainerProperty("amount", Double.class, null);
    addContainerProperty("quantity", Double.class, null);
    addContainerProperty("product", String.class, null);
    addContainerProperty("view", String.class, null);
    addContainerProperty("edit", String.class, null);
    addContainerProperty("del", String.class, null);

    for (PromoDeals p : pds.getPromoDealsByClientId(getClientId())) {
        Item item = getItem(addItem());//from w  w  w  . j  av a 2s  .  c om
        item.getItemProperty("sn").setValue(p.getPromoId());
        item.getItemProperty("promo items").setValue(p.getPromoItem());
        item.getItemProperty("amount").setValue(p.getPromoAmount());
        item.getItemProperty("quantity").setValue(p.getQuantity());
        item.getItemProperty("product").setValue(p.getProductItem());
        item.getItemProperty("view").setValue(FontAwesome.PRINT.getHtml());
        item.getItemProperty("edit").setValue(FontAwesome.PENCIL.getHtml());
        item.getItemProperty("del").setValue(FontAwesome.TRASH_O.getHtml());
    }
}

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

License:Open Source License

@Override
protected void init(VaadinRequest request) {

    getPage().addUriFragmentChangedListener(new UriFragmentChangedListener() {
        public void uriFragmentChanged(UriFragmentChangedEvent source) {
            applyFragment(source.getUriFragment(), true);
        }/*from  w ww. j a  va 2  s.  c o  m*/
    });

    String pathInfo = request.getPathInfo();
    if (pathInfo.startsWith("/"))
        pathInfo = pathInfo.substring(1);
    if (pathInfo.endsWith("/"))
        pathInfo = pathInfo.substring(0, pathInfo.length() - 1);

    String databaseId = validatePathInfo(pathInfo);

    setWindowWidth(Page.getCurrent().getBrowserWindowWidth(), Page.getCurrent().getBrowserWindowHeight());

    // Find the application directory
    String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

    // Image as a file resource
    redResource = new FileResource(new File(basepath + "/WEB-INF/images/bullet_red.png"));
    greenResource = new FileResource(new File(basepath + "/WEB-INF/images/bullet_green.png"));
    blackResource = new FileResource(new File(basepath + "/WEB-INF/images/bullet_black.png"));
    mapMagnify = new FileResource(new File(basepath + "/WEB-INF/images/map_magnify.png"));

    abs = new AbsoluteLayout();

    final VerticalLayout vs = new VerticalLayout();
    vs.setSizeFull();

    abs.addComponent(vs);
    setContent(abs);

    // This will set the login cookie
    Wiki.login(this);

    // Make sure that the printing directory exists
    new File(Main.baseDirectory(), "printing").mkdirs();

    database = Database.load(this, databaseId);
    database.getOrCreateTag("Tavoite");
    database.getOrCreateTag("Painopiste");

    for (Strategiakartta map : Strategiakartta.enumerate(database)) {
        Strategiakartta parent = map.getPossibleParent(database);
        if (parent == null)
            uiState.setCurrentMap(parent);
    }

    if (uiState.getCurrentMap() == null)
        uiState.setCurrentMap(database.getRoot());

    uiState.currentPosition = uiState.getCurrentMap();

    uiState.currentItem = uiState.getCurrentMap();

    setPollInterval(10000);

    addPollListener(new PollListener() {

        @Override
        public void poll(PollEvent event) {

            if (database.checkChanges()) {
                String curr = uiState.getCurrentMap().uuid;
                database = Database.load(Main.this, database.getDatabaseId());
                uiState.setCurrentMap((Strategiakartta) database.find(curr));
                Updates.updateJS(Main.this, false);
            }

        }

    });

    js.addListener(new MapListener(this, false));
    js2.addListener(new MapListener(this, true));

    browser_.addListener(new BrowserListener() {

        @Override
        public void select(double x, double y, String uuid) {
            Base b = database.find(uuid);
            Actions.selectAction(Main.this, x, y, null, b);
        }

        @Override
        public void save(String name, Map<String, BrowserNodeState> states) {

            UIState state = getUIState().duplicate(name);
            state.browserStates = states;

            account.uiStates.add(state);

            Updates.update(Main.this, true);

        }

    });

    Page.getCurrent().addBrowserWindowResizeListener(new BrowserWindowResizeListener() {

        @Override
        public void browserWindowResized(BrowserWindowResizeEvent event) {
            setWindowWidth(event.getWidth(), event.getHeight());
            Updates.updateJS(Main.this, false);
        }
    });

    modeLabel = new Label("Katselutila");
    modeLabel.setWidth("95px");
    modeLabel.addStyleName("viewMode");

    mode = new Button();
    mode.setDescription("Siirry tiedon sytttilaan");
    mode.setIcon(FontAwesome.EYE);
    mode.addStyleName(ValoTheme.BUTTON_TINY);

    mode.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            if ("Siirry tiedon sytttilaan".equals(mode.getDescription())) {

                mode.setDescription("Siirry katselutilaan");
                mode.setIcon(FontAwesome.PENCIL);
                modeLabel.setValue("Sytttila");
                modeLabel.removeStyleName("viewMode");
                modeLabel.addStyleName("editMode");

                UIState s = uiState.duplicate(Main.this);
                s.input = true;
                setFragment(s, true);

            } else {

                mode.setDescription("Siirry tiedon sytttilaan");
                mode.setIcon(FontAwesome.EYE);
                modeLabel.setValue("Katselutila");
                modeLabel.removeStyleName("editMode");
                modeLabel.addStyleName("viewMode");

                UIState s = uiState.duplicate(Main.this);
                s.input = false;
                setFragment(s, true);

            }

        }

    });

    meterMode = new Button();
    meterMode.setDescription("Vaihda toteumamittareihin");
    meterMode.setCaption("Ennuste");
    meterMode.addStyleName(ValoTheme.BUTTON_TINY);

    meterMode.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            if ("Vaihda toteumamittareihin".equals(meterMode.getDescription())) {

                meterMode.setDescription("Vaihda ennustemittareihin");
                meterMode.setCaption("Toteuma");

                UIState s = uiState.duplicate(Main.this);
                s.setActualMeters();
                setFragment(s, true);

            } else {

                meterMode.setDescription("Vaihda toteumamittareihin");
                meterMode.setCaption("Ennuste");

                UIState s = uiState.duplicate(Main.this);
                s.setForecastMeters();
                setFragment(s, true);

            }

        }

    });

    pdf = new PDFButton();
    pdf.setDescription("Tallenna kartta PDF-muodossa");
    pdf.setIcon(FontAwesome.PRINT);
    pdf.addStyleName(ValoTheme.BUTTON_TINY);

    pdf.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            Utils.print(Main.this);

        }

    });

    propertyExcelButton = new Button();
    propertyExcelButton.setDescription("Tallenna tiedot Excel-tiedostona");
    propertyExcelButton.setIcon(FontAwesome.PRINT);
    propertyExcelButton.addStyleName(ValoTheme.BUTTON_TINY);

    OnDemandFileDownloader dl = new OnDemandFileDownloader(new OnDemandStreamSource() {

        private static final long serialVersionUID = 981769438054780731L;

        File f;
        Date date = new Date();

        @Override
        public InputStream getStream() {

            String uuid = UUID.randomUUID().toString();
            File printing = new File(Main.baseDirectory(), "printing");
            f = new File(printing, uuid + ".xlsx");

            Workbook w = new XSSFWorkbook();
            Sheet sheet = w.createSheet("Sheet1");
            int row = 1;
            for (List<String> cells : propertyCells) {
                Row r = sheet.createRow(row++);
                for (int i = 0; i < cells.size(); i++) {
                    String value = cells.get(i);
                    r.createCell(i).setCellValue(value);
                }
            }

            try {
                FileOutputStream s = new FileOutputStream(f);
                w.write(s);
                s.close();
            } catch (Exception e) {
                e.printStackTrace();
            }

            try {
                return new FileInputStream(f);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }

            throw new IllegalStateException();

        }

        @Override
        public void onRequest() {
        }

        @Override
        public long getFileSize() {
            return f.length();
        }

        @Override
        public String getFileName() {
            return "Strategiakartta_" + Utils.dateString(date) + ".xlsx";
        }

    });

    dl.getResource().setCacheTime(0);
    dl.extend(propertyExcelButton);

    states = new ComboBox();
    states.setWidth("250px");
    states.addStyleName(ValoTheme.COMBOBOX_TINY);
    states.setInvalidAllowed(false);
    states.setNullSelectionAllowed(false);

    states.addValueChangeListener(statesListener);

    saveState = new Button();
    saveState.setEnabled(false);
    saveState.setDescription("Tallenna nykyinen nkym");
    saveState.setIcon(FontAwesome.BOOKMARK);
    saveState.addStyleName(ValoTheme.BUTTON_TINY);
    saveState.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Utils.saveCurrentState(Main.this);
        }

    });

    class SearchTextField extends TextField {
        public boolean hasFocus = false;
    }

    final SearchTextField search = new SearchTextField();
    search.setWidth("100%");
    search.addStyleName(ValoTheme.TEXTFIELD_TINY);
    search.addStyleName(ValoTheme.TEXTFIELD_BORDERLESS);
    search.setInputPrompt("hae vapaasanahaulla valitun asian alta");
    search.setId("searchTextField");
    search.addShortcutListener(new ShortcutListener("Shortcut Name", ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {

            if (!search.hasFocus)
                return;

            String text = search.getValue().toLowerCase();
            try {

                Map<String, String> content = new HashMap<String, String>();
                List<String> hits = Lucene.search(database.getDatabaseId(), text + "*");
                for (String uuid : hits) {
                    Base b = database.find(uuid);
                    if (b != null) {
                        String report = "";
                        Map<String, String> map = b.searchMap(database);
                        for (Map.Entry<String, String> e : map.entrySet()) {
                            if (e.getValue().contains(text)) {
                                if (!report.isEmpty())
                                    report += ", ";
                                report += e.getKey();
                            }
                        }
                        if (!report.isEmpty())
                            content.put(uuid, report);
                    }
                }

                uiState.setCurrentFilter(new SearchFilter(Main.this, content));

                Updates.updateJS(Main.this, false);

                switchToBrowser();

            } catch (IOException e) {
                e.printStackTrace();
            }

        }
    });
    search.addFocusListener(new FocusListener() {

        @Override
        public void focus(FocusEvent event) {
            search.hasFocus = true;
        }
    });
    search.addBlurListener(new BlurListener() {

        @Override
        public void blur(BlurEvent event) {
            search.hasFocus = false;
        }
    });

    hallinnoi = new Button("Hallinnoi");
    hallinnoi.setWidthUndefined();
    hallinnoi.setVisible(false);
    hallinnoi.addStyleName(ValoTheme.BUTTON_TINY);
    hallinnoi.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (account != null) {
                if (account.isAdmin()) {
                    Utils.manage(Main.this);
                }
            }
        }

    });

    tili = new Button("Kyttjtili");
    tili.setWidthUndefined();
    tili.setVisible(false);
    tili.addStyleName(ValoTheme.BUTTON_TINY);
    tili.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (account != null) {
                Utils.modifyAccount(Main.this);
            }
        }

    });

    duplicate = new Button("Avaa ikkunassa");
    duplicate2 = new Button("Avaa alas");

    duplicate.setWidthUndefined();
    duplicate.addStyleName(ValoTheme.BUTTON_TINY);
    duplicate.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            MapVis model = js2.getModel();
            if (model == null) {

                UIState s = uiState.duplicate(Main.this);
                s.reference = s.current;

                mapDialog = new Window(s.reference.getText(database), new VerticalLayout());
                mapDialog.setWidth(dialogWidth());
                mapDialog.setHeight(dialogHeight());
                mapDialog.setResizable(true);
                mapDialog.setContent(js2Container);
                mapDialog.setVisible(true);
                mapDialog.setResizeLazy(false);
                mapDialog.addCloseListener(new CloseListener() {

                    @Override
                    public void windowClose(CloseEvent e) {

                        duplicate.setCaption("Avaa ikkunassa");
                        duplicate2.setVisible(true);

                        UIState s = uiState.duplicate(Main.this);
                        mapDialog.close();
                        mapDialog = null;
                        s.reference = null;
                        setFragment(s, true);

                    }

                });
                mapDialog.addResizeListener(new ResizeListener() {

                    @Override
                    public void windowResized(ResizeEvent e) {
                        Updates.updateJS(Main.this, false);
                    }

                });

                setFragment(s, true);

                addWindow(mapDialog);

                duplicate.setCaption("Sulje referenssi");
                duplicate2.setVisible(false);

            } else {

                UIState s = uiState.duplicate(Main.this);
                if (mapDialog != null) {
                    mapDialog.close();
                    mapDialog = null;
                }

                panelLayout.removeComponent(js2Container);

                s.reference = null;
                setFragment(s, true);

                duplicate.setCaption("Avaa ikkunassa");
                duplicate2.setVisible(true);

            }

        }

    });

    duplicate2.setWidthUndefined();
    duplicate2.addStyleName(ValoTheme.BUTTON_TINY);
    duplicate2.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {

            MapVis model = js2.getModel();
            assert (model == null);

            UIState s = uiState.duplicate(Main.this);
            s.reference = s.current;
            setFragment(s, true);

            panelLayout.addComponent(js2Container);

            duplicate.setCaption("Sulje referenssi");
            duplicate2.setVisible(false);

        }

    });

    login = new Button("Kirjaudu");
    login.setWidthUndefined();
    login.addStyleName(ValoTheme.BUTTON_TINY);
    login.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (account != null) {
                account = null;
                hallinnoi.setVisible(false);
                tili.setVisible(false);
                Updates.update(Main.this, true);
                login.setCaption("Kirjaudu");
            } else {
                Login.login(Main.this);
            }
        }

    });

    times = new ComboBox();
    times.setWidth("130px");
    times.addStyleName(ValoTheme.COMBOBOX_SMALL);
    times.addItem(Property.AIKAVALI_KAIKKI);
    times.addItem("2016");
    times.addItem("2017");
    times.addItem("2018");
    times.addItem("2019");
    times.select("2016");
    times.setInvalidAllowed(false);
    times.setNullSelectionAllowed(false);

    times.addValueChangeListener(timesListener);

    final HorizontalLayout hl0 = new HorizontalLayout();
    hl0.setWidth("100%");
    hl0.setHeight("32px");
    hl0.setSpacing(true);

    hl0.addComponent(pdf);
    hl0.setComponentAlignment(pdf, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(pdf, 0.0f);

    hl0.addComponent(propertyExcelButton);
    hl0.setComponentAlignment(propertyExcelButton, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(propertyExcelButton, 0.0f);

    hl0.addComponent(states);
    hl0.setComponentAlignment(states, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(states, 0.0f);

    hl0.addComponent(saveState);
    hl0.setComponentAlignment(saveState, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(saveState, 0.0f);

    hl0.addComponent(times);
    hl0.setComponentAlignment(times, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(times, 0.0f);

    hl0.addComponent(search);
    hl0.setComponentAlignment(search, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(search, 1.0f);

    hl0.addComponent(modeLabel);
    hl0.setComponentAlignment(modeLabel, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(modeLabel, 0.0f);

    hl0.addComponent(mode);
    hl0.setComponentAlignment(mode, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(mode, 0.0f);

    hl0.addComponent(meterMode);
    hl0.setComponentAlignment(meterMode, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(meterMode, 0.0f);

    hl0.addComponent(hallinnoi);
    hl0.setComponentAlignment(hallinnoi, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(hallinnoi, 0.0f);

    hl0.addComponent(tili);
    hl0.setComponentAlignment(tili, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(tili, 0.0f);

    hl0.addComponent(duplicate);
    hl0.setComponentAlignment(duplicate, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(duplicate, 0.0f);

    hl0.addComponent(duplicate2);
    hl0.setComponentAlignment(duplicate2, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(duplicate2, 0.0f);

    hl0.addComponent(login);
    hl0.setComponentAlignment(login, Alignment.MIDDLE_LEFT);
    hl0.setExpandRatio(login, 0.0f);

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

    properties = new VerticalLayout();
    properties.setSpacing(true);
    properties.setMargin(true);

    propertiesPanel.setContent(properties);
    propertiesPanel.setVisible(false);

    tags = new VerticalLayout();
    tags.setSpacing(true);
    Updates.updateTags(this);

    AbsoluteLayout tabs = new AbsoluteLayout();
    tabs.setSizeFull();

    {
        panel = new Panel();
        panel.addStyleName(ValoTheme.PANEL_BORDERLESS);
        panel.setSizeFull();
        panel.setId("mapContainer1");
        panelLayout = new VerticalLayout();
        panelLayout.addComponent(js);
        panelLayout.setHeight("100%");

        js2Container = new VerticalLayout();
        js2Container.setHeight("100%");
        js2Container.addComponent(new Label("<hr />", ContentMode.HTML));
        js2Container.addComponent(js2);

        panel.setContent(panelLayout);
        tabs.addComponent(panel);
    }

    wiki = new BrowserFrame();
    wiki.setSource(new ExternalResource(Wiki.wikiAddress() + "/"));
    wiki.setWidth("100%");
    wiki.setHeight("100%");

    {

        wiki_ = new VerticalLayout();
        wiki_.setSizeFull();
        Button b = new Button("Palaa sovellukseen");
        b.setWidth("100%");
        b.addClickListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                applyFragment(backFragment, true);
                String content = Wiki.get(wikiPage);
                if (content == null)
                    return;
                int first = content.indexOf("<rev contentformat");
                if (first == -1)
                    return;
                content = content.substring(first);
                int term = content.indexOf(">");
                content = content.substring(term + 1);
                int end = content.indexOf("</rev>");
                content = content.substring(0, end);
                if (wikiBase.modifyMarkup(Main.this, content)) {
                    Updates.update(Main.this, true);
                }
            }
        });
        wiki_.addComponent(b);
        wiki_.addComponent(wiki);
        wiki_.setVisible(false);

        wiki_.setExpandRatio(b, 0.0f);
        wiki_.setExpandRatio(wiki, 1.0f);

        tabs.addComponent(wiki_);

    }

    hs = new HorizontalSplitPanel();
    hs.setSplitPosition(0, Unit.PIXELS);
    hs.setHeight("100%");
    hs.setWidth("100%");

    browser = new VerticalLayout();
    browser.setSizeFull();

    HorizontalLayout browserWidgets = new HorizontalLayout();
    browserWidgets.setWidth("100%");

    hori = new Button();
    hori.setDescription("Nyt asiat taulukkona");
    hori.setEnabled(true);
    hori.setIcon(FontAwesome.ARROW_RIGHT);
    hori.addStyleName(ValoTheme.BUTTON_TINY);
    hori.addClickListener(new ClickListener() {

        boolean right = false;

        @Override
        public void buttonClick(ClickEvent event) {
            if (right) {
                hs.setSplitPosition(0, Unit.PIXELS);
                hori.setIcon(FontAwesome.ARROW_RIGHT);
                hori.setDescription("Nyt asiat taulukkona");
                right = false;
            } else {
                hs.setSplitPosition(windowWidth / 2, Unit.PIXELS);
                hori.setIcon(FontAwesome.ARROW_LEFT);
                hori.setDescription("Piilota taulukko");
                right = true;
            }
        }

    });

    more = new Button();
    more.setDescription("Laajenna nytettvien asioiden joukkoa");
    more.setIcon(FontAwesome.PLUS_SQUARE);
    more.addStyleName(ValoTheme.BUTTON_TINY);
    more.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            uiState.level++;
            Updates.updateJS(Main.this, false);
            if (uiState.level >= 2)
                less.setEnabled(true);
        }

    });

    less = new Button();
    less.setDescription("Supista nytettvien asioiden joukkoa");
    less.setIcon(FontAwesome.MINUS_SQUARE);
    less.addStyleName(ValoTheme.BUTTON_TINY);
    less.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (uiState.level > 1) {
                uiState.level--;
                Updates.updateJS(Main.this, false);
            }
            if (uiState.level <= 1)
                less.setEnabled(false);
        }

    });

    reportAllButton = new Button();
    reportAllButton.setCaption("Nkyvt tulokset");
    reportAllButton.addStyleName(ValoTheme.BUTTON_TINY);
    reportAllButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            if (uiState.reportAll) {
                reportAllButton.setCaption("Nkyvt tulokset");
                uiState.reportAll = false;
            } else {
                reportAllButton.setCaption("Kaikki tulokset");
                uiState.reportAll = true;
            }
            Updates.updateJS(Main.this, false);
        }

    });

    reportStatus = new Label("0 tulosta.");
    reportStatus.setWidth("100px");

    filter = new ComboBox();
    filter.setWidth("100%");
    filter.addStyleName(ValoTheme.COMBOBOX_SMALL);
    filter.setInvalidAllowed(false);
    filter.setNullSelectionAllowed(false);

    filter.addValueChangeListener(filterListener);

    browserWidgets.addComponent(hori);
    browserWidgets.setComponentAlignment(hori, Alignment.MIDDLE_LEFT);
    browserWidgets.setExpandRatio(hori, 0.0f);

    browserWidgets.addComponent(more);
    browserWidgets.setComponentAlignment(more, Alignment.MIDDLE_LEFT);
    browserWidgets.setExpandRatio(more, 0.0f);

    browserWidgets.addComponent(less);
    browserWidgets.setComponentAlignment(less, Alignment.MIDDLE_LEFT);
    browserWidgets.setExpandRatio(less, 0.0f);

    browserWidgets.addComponent(reportAllButton);
    browserWidgets.setComponentAlignment(reportAllButton, Alignment.MIDDLE_LEFT);
    browserWidgets.setExpandRatio(reportAllButton, 0.0f);

    browserWidgets.addComponent(reportStatus);
    browserWidgets.setComponentAlignment(reportStatus, Alignment.MIDDLE_LEFT);
    browserWidgets.setExpandRatio(reportStatus, 0.0f);

    browserWidgets.addComponent(filter);
    browserWidgets.setComponentAlignment(filter, Alignment.MIDDLE_LEFT);
    browserWidgets.setExpandRatio(filter, 1.0f);

    browser.addComponent(browserWidgets);
    browser.addComponent(hs);

    browser.setExpandRatio(browserWidgets, 0.0f);
    browser.setExpandRatio(hs, 1.0f);

    browser.setVisible(false);

    tabs.addComponent(browser);

    {
        gridPanelLayout = new VerticalLayout();
        gridPanelLayout.setMargin(false);
        gridPanelLayout.setSpacing(false);
        gridPanelLayout.setSizeFull();
        hs.addComponent(gridPanelLayout);
    }

    CssLayout browserLayout = new CssLayout();

    browserLayout.setSizeFull();

    browserLayout.addComponent(browser_);

    hs.addComponent(browserLayout);

    tabs.addComponent(propertiesPanel);

    vs.addComponent(hl0);
    vs.addComponent(tabs);

    vs.setExpandRatio(hl0, 0.0f);
    vs.setExpandRatio(tabs, 1.0f);

    // Ground state
    fragments.put("", uiState);

    setCurrentItem(uiState.currentItem, (Strategiakartta) uiState.currentItem);

}

From source file:fr.amapj.view.views.mescontrats.MesContratsView.java

License:Open Source License

public void refresh() {
    mesContratsDTO = new MesContratsService().getMesContrats(SessionManager.getUserId());

    layout = this;
    layout.removeAllComponents();/*from www .ja va  2 s . c  o m*/

    // Information sur le renouvellement de l'adhsion
    adhesionPart.addAhesionInfo(layout);

    // Le titre
    addLabel(layout, "Les nouveaux contrats disponibles");

    // la liste des nouveaux contrats 
    List<ContratDTO> newContrats = mesContratsDTO.getNewContrats();
    for (ContratDTO c : newContrats) {
        Panel p = new Panel();
        p.addStyleName(PANEL_UNCONTRAT);

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

        VerticalLayout vl = new VerticalLayout();
        Label lab = new Label(c.nom);
        lab.addStyleName(LABEL_TITRECONTRAT);
        vl.addComponent(lab);

        String str = formatLibelleContrat(c, true);
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        Button b = addButtonInscription("S'inscrire", c);
        b.setWidth("100%");
        b.addStyleName(BUTTON_PRINCIPAL);
        vl2.addComponent(b);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        p.setContent(hl);

        layout.addComponent(p);

    }

    // Le titre
    addLabel(layout, "Mes contrats existants");

    // la liste des contrats existants 
    List<ContratDTO> existingContrats = mesContratsDTO.getExistingContrats();
    for (ContratDTO c : existingContrats) {
        Panel p = new Panel();
        p.addStyleName(PANEL_UNCONTRAT);

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

        VerticalLayout vl = new VerticalLayout();
        Label lab = new Label(c.nom);
        lab.addStyleName(LABEL_TITRECONTRAT);
        vl.addComponent(lab);

        String str = formatLibelleContrat(c, false);
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        if (c.isModifiable) {
            Button b = addButtonInscription("Modifier", c);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        if (c.isSupprimable) {
            Button b = addButtonSupprimer("Supprimer", c);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        if (c.isJoker) {
            Button b = addButtonJoker("Grer jokers", c);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        Button v = addButtonVoir("Voir", c);
        v.addStyleName(BUTTON_PRINCIPAL);
        v.setWidth("100%");
        vl2.addComponent(v);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        p.setContent(hl);

        layout.addComponent(p);

    }

    // Le bouton pour tlcharger les contrats
    if (existingContrats.size() > 0) {
        Button telechargerButton = new Button("Imprimer mes contrats ...");
        telechargerButton.setIcon(FontAwesome.PRINT);
        telechargerButton.addStyleName("borderless");
        telechargerButton.addStyleName("large");
        telechargerButton.addClickListener(e -> handleTelecharger());

        layout.addComponent(telechargerButton);
        layout.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT);

    }
}

From source file:fr.amapj.view.views.meslivraisons.MesLivraisonsView.java

License:Open Source License

/**
 * //from w w w. ja  v a2 s .c om
 */
@Override
public void enter() {
    PEMesLivraisons peMesLivraisons = (PEMesLivraisons) new ParametresService()
            .loadParamEcran(MenuList.MES_LIVRAISONS);

    semaineViewer = GapViewerUtil.createGapWiever(peMesLivraisons.modeAffichage, this);
    addComponent(semaineViewer.getComponent());

    VerticalLayout central = new VerticalLayout();
    addComponent(central);

    planning = new VerticalLayout();
    central.addComponent(planning);
    livraison = new VerticalLayout();
    central.addComponent(livraison);

    // Le bouton pour tlcharger les livraisons   
    Button telechargerButton = new Button("Imprimer mes livraisons ...");
    telechargerButton.setIcon(FontAwesome.PRINT);
    telechargerButton.addStyleName("borderless");
    telechargerButton.addStyleName("large");
    telechargerButton.addClickListener(e -> handleTelecharger());

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

    onPopupClose();
}

From source file:fr.amapj.view.views.permanence.mespermanences.MesPermanencesView.java

License:Open Source License

public void refresh() {
    mesContratsDTO = new MesPermanencesService().getMesPermanenceDTO(SessionManager.getUserId());

    layout = this;
    layout.removeAllComponents();/*from w w w  .  j a v  a2s .  c  om*/

    if (mesContratsDTO.mesPeriodesPermanences.size() > 0) {

        // Le titre
        addLabel(layout, "S'inscrire aux permanences");

        // la liste des inscriptions possibles
        for (UnePeriodePermanenceDTO c : mesContratsDTO.mesPeriodesPermanences) {
            Panel p = new Panel();
            p.addStyleName(PANEL_UNCONTRAT);

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

            VerticalLayout vl = new VerticalLayout();
            Label lab = new Label(c.nom);
            lab.addStyleName(LABEL_TITRECONTRAT);
            vl.addComponent(lab);

            String str = formatLibelleContrat(c, true);
            BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

            hl.addComponent(vl);
            hl.setExpandRatio(vl, 1);

            VerticalLayout vl2 = new VerticalLayout();
            vl2.setWidth("115px");
            vl2.setSpacing(true);

            String libButton = getLibButton(c);
            Button b = addButtonInscription(libButton, c);
            b.setWidth("100%");
            b.addStyleName(BUTTON_PRINCIPAL);
            vl2.addComponent(b);

            hl.addComponent(vl2);
            hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

            p.setContent(hl);

            layout.addComponent(p);

        }
    }

    //
    addLabel(layout, "Les dates de mes permanences");

    VerticalLayout vl1 = BaseUiTools.addPanel(this, "mes-permanences");
    String mesPermanences = getLibMesPermanences();
    BaseUiTools.addHtmlLabel(vl1, mesPermanences, "ligne");

    addLabel(layout, "Consulter les plannings de permanence");

    VerticalLayout vl2 = BaseUiTools.addPanel(this, "mes-permanences");

    // Le bouton pour visualiser les permanences en ligne 
    Button onLineButton = new Button("Visualiser les plannings de permanence ...");
    onLineButton.setIcon(FontAwesome.EYE);
    onLineButton.addStyleName("borderless");
    onLineButton.addStyleName("large");
    onLineButton.addClickListener(e -> handleVisualiser());

    vl2.addComponent(onLineButton);
    vl2.setComponentAlignment(onLineButton, Alignment.MIDDLE_LEFT);

    // Le bouton pour tlcharger les permanences 
    Button telechargerButton = new Button("Tlcharger les plannings de permanence au format tableur ...");
    telechargerButton.setIcon(FontAwesome.PRINT);
    telechargerButton.addStyleName("borderless");
    telechargerButton.addStyleName("large");
    telechargerButton.addClickListener(e -> handleTelecharger());

    vl2.addComponent(telechargerButton);
    vl2.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT);

}

From source file:pl.exsio.ca.module.terrain.evidence.TerrainDataTable.java

License:Open Source License

private Button getPrintCardsButton(final ComboBox types, final ComboBox groups, final DateField date) {
    Button printCards = new Button("", FontAwesome.PRINT);
    printCards.addClickListener(new Button.ClickListener() {

        @Override/* w w  w  . ja v  a2 s.c  o m*/
        public void buttonClick(Button.ClickEvent event) {

            String type = types.getValue() == null ? ""
                    : ((TerrainType) types.getValue()).getStringRepresentation();
            String group = groups.getValue() == null ? "" : groups.getValue().toString();
            String d = date.getValue() == null ? ""
                    : new SimpleDateFormat("yyyy-MM-dd").format(date.getValue());
            getUI().getPage().open("report/pdf/?report-name=terranCardsPdfReport&type=" + type + "&group="
                    + group + "&date=" + d, "_blank", false);
        }
    });
    return printCards;
}