com.vaadin.ui.renderers.ButtonRenderer Java Examples

The following examples show how to use com.vaadin.ui.renderers.ButtonRenderer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZookeeperConsumerManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addTestColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String ip = (String) item.getItemProperty("IP").getValue();
        String port = (String) item.getItemProperty("端口").getValue();
        boolean isConnected = DubboSwitchTool.isConnected(ip + ":" + port);
        if (isConnected) {
            Notification.show("连接成功!",Notification.Type.HUMANIZED_MESSAGE);
            return;
        }
        Notification.show("连接失败!",Notification.Type.ERROR_MESSAGE);
    }));
}
 
Example #2
Source File: ZookeeperAppManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        Long appId = (Long) item.getItemProperty("序号").getValue();
        String appName = (String) item.getItemProperty("应用名称").getValue();
        if ("清理".equals(pId)) {
            zookeeperAppClearUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppClearUI);
        } else if ("切换".equals(pId)) {
            zookeeperAppSwitchUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppSwitchUI);
        }
    }));
}
 
Example #3
Source File: ZookeeperProviderManageUI.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addTestColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String ip = (String) item.getItemProperty("IP").getValue();
        String port = (String) item.getItemProperty("端口").getValue();
        boolean isConnected = DubboSwitchTool.isConnected(ip + ":" + port);
        if (isConnected) {
            Notification.show("连接成功!",Notification.Type.HUMANIZED_MESSAGE);
            return;
        }
        Notification.show("连接失败!",Notification.Type.ERROR_MESSAGE);
    }));
}
 
Example #4
Source File: ZookeeperConsumerManageUI.java    From dubbo-switch with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addTestColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String ip = (String) item.getItemProperty("IP").getValue();
        String port = (String) item.getItemProperty("端口").getValue();
        boolean isConnected = DubboSwitchTool.isConnected(ip + ":" + port);
        if (isConnected) {
            Notification.show("连接成功!",Notification.Type.HUMANIZED_MESSAGE);
            return;
        }
        Notification.show("连接失败!",Notification.Type.ERROR_MESSAGE);
    }));
}
 
Example #5
Source File: ZookeeperAppManageUI.java    From dubbo-switch with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        Long appId = (Long) item.getItemProperty("序号").getValue();
        String appName = (String) item.getItemProperty("应用名称").getValue();
        if ("清理".equals(pId)) {
            zookeeperAppClearUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppClearUI);
        } else if ("切换".equals(pId)) {
            zookeeperAppSwitchUI.show(appId,appName);
            UI.getCurrent().addWindow(zookeeperAppSwitchUI);
        }
    }));
}
 
Example #6
Source File: ZookeeperProviderManageUI.java    From dubbo-switch with Apache License 2.0 6 votes vote down vote up
/**
 * 添加按钮列
 * @param pId
 */
private void addTestColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId,String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String ip = (String) item.getItemProperty("IP").getValue();
        String port = (String) item.getItemProperty("端口").getValue();
        boolean isConnected = DubboSwitchTool.isConnected(ip + ":" + port);
        if (isConnected) {
            Notification.show("连接成功!",Notification.Type.HUMANIZED_MESSAGE);
            return;
        }
        Notification.show("连接失败!",Notification.Type.ERROR_MESSAGE);
    }));
}
 
Example #7
Source File: ZookeeperAppManageUI.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 添加查看列
 * @param pId
 */
private void addViewColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId, String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String appName = (String) item.getItemProperty("应用名称").getValue();
        zookeeperAppViewUI.show(appName);
        UI.getCurrent().addWindow(zookeeperAppViewUI);
    }));
}
 
Example #8
Source File: ZookeeperAppManageUI.java    From dubbo-switch with Apache License 2.0 5 votes vote down vote up
/**
 * 添加查看列
 * @param pId
 */
private void addViewColumnButton(String pId) {
    Grid.Column column = grid.addColumn(pId, String.class);
    column.setWidth(100d);
    column.setRenderer(new ButtonRenderer((ClickableRenderer.RendererClickListener) rendererClickEvent -> {
        Object itemId = rendererClickEvent.getItemId();
        Item item = grid.getContainerDataSource().getItem(itemId);
        String appName = (String) item.getItemProperty("应用名称").getValue();
        zookeeperAppViewUI.show(appName);
        UI.getCurrent().addWindow(zookeeperAppViewUI);
    }));
}
 
Example #9
Source File: WebButtonRenderer.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected ButtonRenderer<T> createImplementation() {
    if (listener != null) {
        return new ButtonRenderer<>(createClickListenerWrapper(listener), getNullRepresentation());
    } else {
        return new ButtonRenderer<>(getNullRepresentation());
    }
}
 
Example #10
Source File: WebButtonRenderer.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public ButtonRenderer<T> getImplementation() {
    return (ButtonRenderer<T>) super.getImplementation();
}