Java 类com.vaadin.ui.renderers.ClickableRenderer 实例源码

项目:dubbo-switch    文件:ZookeeperConsumerManageUI.java   
/**
 * 添加按钮列
 * @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);
    }));
}
项目:dubbo-switch    文件:ZookeeperAppManageUI.java   
/**
 * 添加按钮列
 * @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);
        }
    }));
}
项目:dubbo-switch    文件:ZookeeperProviderManageUI.java   
/**
 * 添加按钮列
 * @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);
    }));
}
项目:vaadin-clickabletextrenderer-v8    文件:DemoUI.java   
/**
 * Listener which determines what happens when a city is clicked upon.
 */
private ClickableRenderer.RendererClickListener<DemoPerson> getCityClickListener() {
    return (ClickableRenderer.RendererClickEvent<DemoPerson> event) -> {
        DemoPerson rowClicked =  event.getItem();

        Notification.show("You clicked",
                "A city : " + rowClicked.getCity(),
                Notification.Type.HUMANIZED_MESSAGE);
    };
}
项目:vaadin-clickabletextrenderer-v8    文件:DemoUI.java   
/**
 * Listener which determines what happens when a company is clicked upon.
 */
private ClickableRenderer.RendererClickListener<DemoPerson> getCompanyClickListener() {
    return (ClickableRenderer.RendererClickEvent<DemoPerson> event) -> {
        DemoPerson rowClicked = event.getItem();

        Notification.show("You clicked",
                "A company : " + rowClicked.getCompany(),
                Notification.Type.HUMANIZED_MESSAGE);
    };
}
项目:dubbo-switch    文件:ZookeeperAppManageUI.java   
/**
 * 添加查看列
 * @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);
    }));
}
项目:cuba    文件:WebAbstractClickableRenderer.java   
protected ClickableRenderer.RendererClickListener createClickListenerWrapper(DataGrid.RendererClickListener listener) {
    return (ClickableRenderer.RendererClickListener) e -> {
        DataGrid.Column column = getColumnByGridColumn(e.getColumn());
        DataGrid.RendererClickEvent event = new DataGrid.RendererClickEvent(
                getDataGrid(), WebWrapperUtils.toMouseEventDetails(e), e.getItemId(), column.getId());
        listener.onClick(event);
    };
}