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

项目: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);
    }));
}
项目: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    文件:WebButtonRenderer.java   
@Override
protected ButtonRenderer createImplementation() {
    if (listener != null) {
        return new ButtonRenderer(createClickListenerWrapper(listener), getNullRepresentation());
    } else {
        return new ButtonRenderer(getNullRepresentation());
    }
}
项目:limbr    文件:EntityListViewImpl.java   
@PostConstruct
@SuppressWarnings("unchecked")
public void init() {
    grid = new Grid();
    grid.setEditorEnabled(true);
    grid.setSizeFull();
    TextField filter = new TextField();
    filter.setInputPrompt(messages.get("filterLabel"));
    filter.addTextChangeListener(event -> listEntities(event.getText()));

    Button addNewButton = new Button(messages.get("newButtonLabel"), FontAwesome.PLUS);
    HorizontalLayout actions = new HorizontalLayout(filter, addNewButton);
    actions.setSpacing(true);
    grid.removeAllColumns();

    java.lang.reflect.Field[] fields = entityClass.getDeclaredFields();
    for (java.lang.reflect.Field field : fields) {
        if (null != field.getAnnotation(ListColumn.class)) {
            grid.addColumn(field.getName());
        }
    }

    Grid.Column editColumn = grid.addColumn(EDIT_PROPERTY_ID);
    editColumn.setMaximumWidth(50.0);
    editColumn.setHeaderCaption("");
    editColumn.setRenderer(new ButtonRenderer(event ->
            listeners.forEach(listener ->
                    listener.editItemClicked((T)event.getItemId()))));

    addNewButton.addClickListener(event -> listeners.forEach(EntityListView.Listener::addNewClicked));

    addComponent(actions);
    addComponent(grid);

    listeners.forEach(listener -> listener.viewInitialized(this));

    refresh();
}
项目:cuba    文件:WebButtonRenderer.java   
@Override
public ButtonRenderer getImplementation() {
    return (ButtonRenderer) super.getImplementation();
}