Example usage for com.vaadin.ui Button addStyleName

List of usage examples for com.vaadin.ui Button addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Button addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.esofthead.mycollab.ui.chart.PieChartWrapper.java

License:Open Source License

@Override
protected final ComponentContainer createLegendBox() {
    final CssLayout mainLayout = new CssLayout();
    mainLayout.addStyleName("legendBoxContent");
    mainLayout.setSizeUndefined();/* ww w.j  av  a 2 s. c om*/
    final List keys = pieDataSet.getKeys();

    for (int i = 0; i < keys.size(); i++) {
        MHorizontalLayout layout = new MHorizontalLayout()
                .withMargin(new MarginInfo(false, false, false, true));
        layout.addStyleName("inline-block");
        layout.setSizeUndefined();
        layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

        final Comparable key = (Comparable) keys.get(i);
        int colorIndex = i % CHART_COLOR_STR.size();
        final String color = "<div style = \" width:13px;height:13px;background: #"
                + CHART_COLOR_STR.get(colorIndex) + "\" />";
        final Label lblCircle = new Label(color);
        lblCircle.setContentMode(ContentMode.HTML);

        String btnCaption;
        if (enumKeyCls == null) {
            if (key instanceof Key) {
                btnCaption = String.format("%s (%d)", StringUtils.trim(((Key) key).getDisplayName(), 20, true),
                        pieDataSet.getValue(key).intValue());
            } else {
                btnCaption = String.format("%s (%d)", key, pieDataSet.getValue(key).intValue());
            }
        } else {
            btnCaption = String.format("%s(%d)", AppContext.getMessage(enumKeyCls, key.toString()),
                    pieDataSet.getValue(key).intValue());
        }
        final Button btnLink = new Button(StringUtils.trim(btnCaption, 25, true), new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                if (key instanceof Key) {
                    clickLegendItem(((Key) key).getKey());
                } else {
                    clickLegendItem(key.toString());
                }
            }
        });
        btnLink.setDescription(btnCaption);
        btnLink.addStyleName(UIConstants.BUTTON_LINK);
        layout.with(lblCircle, btnLink);
        mainLayout.addComponent(layout);
    }
    mainLayout.setWidth("100%");
    return mainLayout;
}

From source file:com.esofthead.mycollab.vaadin.ui.AbstractBeanBlockList.java

License:Open Source License

protected CssLayout createPageControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setWidth("100%");

    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);

    this.pageManagement = new HorizontalLayout();

    // defined layout here ---------------------------

    if (this.currentPage > 1) {
        final Button firstLink = new ButtonLink("1", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override/*  ww  w.j  a va2s  .  co m*/
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(1);
            }
        }, false);
        firstLink.addStyleName("buttonPaging");
        this.pageManagement.addComponent(firstLink);
    }
    if (this.currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss1);
    }
    if (this.currentPage > 3) {
        final Button previous2 = new ButtonLink("" + (this.currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage - 2);
            }
        }, false);
        previous2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous2);
    }
    if (this.currentPage > 2) {
        final Button previous1 = new ButtonLink("" + (this.currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage - 1);
            }
        }, false);
        previous1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLink
    final Button current = new ButtonLink("" + this.currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage);
        }
    }, false);
    current.addStyleName("buttonPaging");
    current.addStyleName("buttonPagingcurrent");

    this.pageManagement.addComponent(current);
    final int range = this.totalPage - this.currentPage;
    if (range >= 1) {
        final Button next1 = new ButtonLink("" + (this.currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage + 1);
            }
        }, false);
        next1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new ButtonLink("" + (this.currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.currentPage + 2);
            }
        }, false);
        next2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new ButtonLink("" + this.totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(AbstractBeanBlockList.this.totalPage);
            }
        }, false);
        last.addStyleName("buttonPaging");
        this.pageManagement.addComponent(last);
    }

    this.pageManagement.setWidth(null);
    this.pageManagement.setSpacing(true);
    controlBar.addComponent(this.pageManagement);
    controlBar.setComponentAlignment(this.pageManagement, Alignment.MIDDLE_RIGHT);

    return this.controlBarWrapper;
}

From source file:com.esofthead.mycollab.vaadin.ui.AbstractBeanPagedList.java

License:Open Source License

protected CssLayout createPageControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setStyleName(listControlStyle);
    this.controlBarWrapper.setWidth("100%");

    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);

    this.pageManagement = new HorizontalLayout();

    // defined layout here ---------------------------

    if (this.currentPage > 1) {
        final Button firstLink = new ButtonLink("1", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override/*from ww w .j av a  2 s .co  m*/
            public void buttonClick(final ClickEvent event) {
                AbstractBeanPagedList.this.pageChange(1);
            }
        }, false);
        firstLink.addStyleName("buttonPaging");
        this.pageManagement.addComponent(firstLink);
    }
    if (this.currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss1);
    }
    if (this.currentPage > 3) {
        final Button previous2 = new ButtonLink("" + (this.currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage - 2);
            }
        }, false);
        previous2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous2);
    }
    if (this.currentPage > 2) {
        final Button previous1 = new ButtonLink("" + (this.currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage - 1);
            }
        }, false);
        previous1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLink
    final Button current = new ButtonLink("" + this.currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage);
        }
    }, false);
    current.addStyleName("buttonPaging");
    current.addStyleName("buttonPagingcurrent");

    this.pageManagement.addComponent(current);
    final int range = this.totalPage - this.currentPage;
    if (range >= 1) {
        final Button next1 = new ButtonLink("" + (this.currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage + 1);
            }
        }, false);
        next1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new ButtonLink("" + (this.currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.currentPage + 2);
            }
        }, false);
        next2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new ButtonLink("" + this.totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanPagedList.this.pageChange(AbstractBeanPagedList.this.totalPage);
            }
        }, false);
        last.addStyleName("buttonPaging");
        this.pageManagement.addComponent(last);
    }

    this.pageManagement.setWidth(null);
    this.pageManagement.setSpacing(true);
    controlBar.addComponent(this.pageManagement);
    controlBar.setComponentAlignment(this.pageManagement, Alignment.MIDDLE_RIGHT);

    return this.controlBarWrapper;
}

From source file:com.esofthead.mycollab.vaadin.ui.BuildCriterionComponent.java

License:Open Source License

private void buildFilterBox(String queryname) {
    filterBox.removeAllComponents();/*from  ww  w .  ja  v  a2  s .c om*/

    filterComboBox = new SavedSearchResultComboBox();
    filterComboBox.setWidth("125px");
    filterBox.addComponent(filterComboBox);

    Button saveSearchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_NEW_FILTER),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    buildSaveFilterBox();
                }
            });
    saveSearchBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    saveSearchBtn.setIcon(FontAwesome.PLUS);
    filterBox.addComponent(saveSearchBtn);
}

From source file:com.esofthead.mycollab.vaadin.ui.BuildCriterionComponent.java

License:Open Source License

private void buildSaveFilterBox() {
    filterBox.removeAllComponents();/*from   w  w w  .  java2s .c  om*/

    final TextField queryTextField = new TextField();
    queryTextField.setWidth("125px");
    filterBox.addComponent(queryTextField);

    Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            String queryText = queryTextField.getValue();
            saveSearchCriteria(queryText);
        }
    });
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    saveBtn.setIcon(FontAwesome.SAVE);
    filterBox.addComponent(saveBtn);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    buildFilterBox(null);
                }
            });
    cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    filterBox.addComponent(cancelBtn);
}

From source file:com.esofthead.mycollab.vaadin.ui.DefaultMassItemActionHandlersContainer.java

License:Open Source License

public void addActionItem(final String id, Resource resource, String groupId, String description) {
    ButtonGroup group = groupMap.get(groupId);

    if (group == null) {
        group = new ButtonGroup();
        groupMap.put(groupId, group);/*from  w w w  .  java 2  s. com*/

        this.addComponent(group);
    }

    Button optionBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            changeOption(id);
        }
    });
    optionBtn.setIcon(resource);
    if ("delete".equals(groupId)) {
        optionBtn.addStyleName(UIConstants.THEME_RED_LINK);
    } else {
        optionBtn.addStyleName(UIConstants.THEME_BLUE_LINK);
    }
    optionBtn.addStyleName("small-padding");
    optionBtn.setDescription(description);

    group.addButton(optionBtn);
}

From source file:com.esofthead.mycollab.vaadin.ui.DefaultMassItemActionHandlersContainer.java

License:Open Source License

public void addDownloadActionItem(final String id, Resource resource, String groupId, String downloadFileName,
        String description) {//from   w w  w . j a va  2s .co  m
    ButtonGroup group = groupMap.get(groupId);

    if (group == null) {
        group = new ButtonGroup();
        groupMap.put(groupId, group);
        this.addComponent(group);
    }

    Button optionBtn = new Button("");
    FileDownloader fileDownler = new FileDownloader(
            new StreamResource(new LazyStreamSource(id), downloadFileName));
    fileDownler.extend(optionBtn);
    optionBtn.setIcon(resource);
    optionBtn.addStyleName(UIConstants.THEME_BLUE_LINK);
    optionBtn.addStyleName("small-padding");
    optionBtn.setDescription(description);
    group.addButton(optionBtn);
}

From source file:com.esofthead.mycollab.vaadin.ui.table.AbstractPagedBeanTable.java

License:Open Source License

private CssLayout createControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setStyleName("listControl");
    this.controlBarWrapper.setWidth("100%");

    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);

    this.pageManagement = new HorizontalLayout();

    // defined layout here ---------------------------

    if (this.currentPage > 1) {
        final Button firstLink = new ButtonLink("1", new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override//  www .jav  a 2  s .  c  om
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(1);
            }
        }, false);
        firstLink.addStyleName("buttonPaging");
        this.pageManagement.addComponent(firstLink);
    }
    if (this.currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss1);
    }

    if (this.currentPage > 3) {
        final Button previous2 = new ButtonLink("" + (this.currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage - 2);
            }
        }, false);
        previous2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous2);
    }
    if (this.currentPage > 2) {
        final Button previous1 = new ButtonLink("" + (this.currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage - 1);
            }
        }, false);
        previous1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLink
    final Button current = new ButtonLink("" + this.currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage);
        }
    }, false);
    current.addStyleName("buttonPaging");
    current.addStyleName("buttonPagingcurrent");

    this.pageManagement.addComponent(current);
    final int range = this.totalPage - this.currentPage;
    if (range >= 1) {
        final Button next1 = new ButtonLink("" + (this.currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage + 1);
            }
        }, false);
        next1.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new ButtonLink("" + (this.currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.currentPage + 2);
            }
        }, false);
        next2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        this.pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new ButtonLink("" + this.totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractPagedBeanTable.this.pageChange(AbstractPagedBeanTable.this.totalPage);
            }
        }, false);
        last.addStyleName("buttonPaging");
        this.pageManagement.addComponent(last);
    }

    this.pageManagement.setWidth(null);
    this.pageManagement.setSpacing(true);
    controlBar.addComponent(this.pageManagement);
    controlBar.setComponentAlignment(this.pageManagement, Alignment.MIDDLE_RIGHT);

    return this.controlBarWrapper;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.AbstractBeanBlockList.java

License:Open Source License

protected CssLayout createPageControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setWidth("100%");

    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);

    pageManagement = new MHorizontalLayout();

    // defined layout here ---------------------------

    if (currentPage > 1) {
        final Button firstLink = new Button("1", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override//from www .  ja v a2 s  .c  o  m
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(1);
            }
        });
        firstLink.addStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }
    if (currentPage > 3) {
        final Button previous2 = new Button("" + (currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(currentPage - 2);
            }
        });
        previous2.addStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage - 1);
            }
        });
        previous1.addStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    final Button current = new Button("" + currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractBeanBlockList.this.pageChange(currentPage);
        }
    });
    current.addStyleName("buttonPaging");
    current.addStyleName("current");

    pageManagement.addComponent(current);
    final int range = totalPage - currentPage;
    if (range >= 1) {
        final Button next1 = new Button("" + (currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage + 1);
            }
        });
        next1.addStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new Button("" + (currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage + 2);
            }
        });
        next2.addStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new Button("" + totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(totalPage);
            }
        });
        last.addStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }

    pageManagement.setWidth(null);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT);

    return this.controlBarWrapper;
}

From source file:com.esofthead.mycollab.vaadin.web.ui.AbstractBeanPagedList.java

License:Open Source License

protected MHorizontalLayout createPageControls() {
    controlBarWrapper = new MHorizontalLayout().withFullWidth()
            .withMargin(new MarginInfo(false, true, false, true)).withStyleName(listControlStyle);

    pageManagement = new MHorizontalLayout().withWidth(null);

    // defined layout here ---------------------------

    if (currentPage > 1) {
        Button firstLink = new Button("1", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override/* www  .j  a v a  2 s . co  m*/
            public void buttonClick(final ClickEvent event) {
                pageChange(1);
            }
        });
        firstLink.addStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }
    if (currentPage > 3) {
        Button previous2 = new Button("" + (currentPage - 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(currentPage - 2);
            }
        });
        previous2.addStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(currentPage - 1);
            }
        });
        previous1.addStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    final Button current = new Button("" + currentPage, new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            pageChange(currentPage);
        }
    });
    current.addStyleName("buttonPaging");
    current.addStyleName("current");

    pageManagement.addComponent(current);
    final int range = this.totalPage - currentPage;
    if (range >= 1) {
        final Button next1 = new Button("" + (currentPage + 1), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(currentPage + 1);
            }
        });
        next1.addStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        Button next2 = new Button("" + (currentPage + 2), new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(currentPage + 2);
            }
        });
        next2.addStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        Button last = new Button("" + this.totalPage, new ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(totalPage);
            }
        });
        last.addStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }

    controlBarWrapper.with(pageManagement).withAlign(pageManagement, Alignment.MIDDLE_RIGHT);
    return controlBarWrapper;
}