com.vaadin.ui.renderers.ClickableRenderer Java Examples

The following examples show how to use com.vaadin.ui.renderers.ClickableRenderer. 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: WebAbstractClickableRenderer.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected ClickableRenderer.RendererClickListener<T> createClickListenerWrapper(Consumer<DataGrid.RendererClickEvent<T>> listener) {
    return (ClickableRenderer.RendererClickListener<T>) e -> {
        DataGrid.Column column = getColumnByGridColumn(e.getColumn());
        DataGrid.RendererClickEvent<T> event = new DataGrid.RendererClickEvent<>(getDataGrid(),
                WebWrapperUtils.toMouseEventDetails(e), e.getItem(), column.getId());
        listener.accept(event);
    };
}