Package org.jboss.ballroom.client.widgets.tools

Examples of org.jboss.ballroom.client.widgets.tools.ToolStrip


    public Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        ToolStrip topLevelTools = new ToolStrip();
        ToolButton commonLabelAddBtn = new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                presenter.launchNewXADatasourceWizard();
            }
        });
        commonLabelAddBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_xADataSourceEditor());
        topLevelTools.addToolButtonRight(commonLabelAddBtn);


        ClickHandler clickHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                final XADataSource currentSelection = details.getCurrentSelection();
                if(currentSelection!=null)
                {
                    Feedback.confirm(
                            Console.MESSAGES.deleteTitle("XA Datasource"),
                            Console.MESSAGES.deleteConfirm("XA Datasource "+currentSelection.getName()),
                            new Feedback.ConfirmationHandler() {
                                @Override
                                public void onConfirmation(boolean isConfirmed) {
                                    if (isConfirmed) {
                                        presenter.onDeleteXA(currentSelection);
                                    }
                                }
                            });
                }
            }
        };
        ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
        deleteBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_delete_xADataSourceEditor());
        deleteBtn.addClickHandler(clickHandler);
        topLevelTools.addToolButtonRight(deleteBtn);

        // ----

        VerticalPanel vpanel = new VerticalPanel();
        vpanel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(vpanel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        // ---

        vpanel.add(new ContentHeaderLabel("JDBC XA Datasources"));

        vpanel.add(new ContentDescription(Console.CONSTANTS.subsys_jca_xadataSources_desc()));

        dataSourceTable = new DefaultCellTable<XADataSource>(8,
                new ProvidesKey<XADataSource>() {
                    @Override
                    public Object getKey(XADataSource item) {
                        return item.getJndiName();
                    }
                });

        dataSourceProvider = new ListDataProvider<XADataSource>();
        dataSourceProvider.addDataDisplay(dataSourceTable);


        TextColumn<DataSource> nameColumn = new TextColumn<DataSource>() {
            @Override
            public String getValue(DataSource record) {
                return record.getName();
            }
        };

        TextColumn<DataSource> jndiNameColumn = new TextColumn<DataSource>() {
            @Override
            public String getValue(DataSource record) {
                return record.getJndiName();
            }
        };

        Column<DataSource, ImageResource> statusColumn =
                new Column<DataSource, ImageResource>(new ImageResourceCell()) {
                    @Override
                    public ImageResource getValue(DataSource dataSource) {

                        ImageResource res = null;

                        if(dataSource.isEnabled())
                            res = Icons.INSTANCE.status_good();
                        else
                            res = Icons.INSTANCE.status_bad();

                        return res;
                    }
                };


        dataSourceTable.addColumn(nameColumn, "Name");
        dataSourceTable.addColumn(jndiNameColumn, "JNDI");
        dataSourceTable.addColumn(statusColumn, "Enabled?");

        vpanel.add(new ContentGroupLabel(Console.MESSAGES.available("XA Datasources")));
        vpanel.add(topLevelTools.asWidget());
        vpanel.add(dataSourceTable);

        DefaultPager pager = new DefaultPager();
        pager.setDisplay(dataSourceTable);
        vpanel.add(pager);

        // -----------
        details = new XADataSourceDetails(presenter);


        propertyEditor = new PropertyEditor(this, true);
        propertyEditor.setHelpText(Console.CONSTANTS.subsys_jca_dataSource_xaprop_help());

        final SingleSelectionModel<XADataSource> selectionModel = new SingleSelectionModel<XADataSource>();
        selectionModel.addSelectionChangeHandler(
                new SelectionChangeEvent.Handler() {
                    @Override
                    public void onSelectionChange(SelectionChangeEvent event) {
                        XADataSource dataSource = selectionModel.getSelectedObject();
                        String nextState = dataSource.isEnabled() ? Console.CONSTANTS.common_label_disable():Console.CONSTANTS.common_label_enable();
                        disableBtn.setText(nextState);

                        presenter.loadXAProperties(dataSource.getName());
                        presenter.loadPoolConfig(true, dataSource.getName());
                    }
                });
        dataSourceTable.setSelectionModel(selectionModel);


        ClickHandler disableHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                final XADataSource selection = getCurrentSelection();
                final boolean doEnable = !selection.isEnabled();
                String title = doEnable ? Console.MESSAGES.enableConfirm("XA datasource") : Console.MESSAGES.disableConfirm("XA datasource");
                String text = doEnable ? Console.MESSAGES.enableConfirm("XA datasource "+selection.getName()) : Console.MESSAGES.disableConfirm("XA datasource "+selection.getName()) ;
                Feedback.confirm(title, text,
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed) {
                                    presenter.onDisableXA(selection, doEnable);
                                }
                            }
                        });
            }
        };

        disableBtn = new ToolButton(Console.CONSTANTS.common_label_enOrDisable());
        disableBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_enOrDisable_xADataSourceDetails());
        disableBtn.addClickHandler(disableHandler);
        topLevelTools.addToolButtonRight(disableBtn);

        // -----

        TabPanel bottomPanel = new TabPanel();
        bottomPanel.setStyleName("default-tabpanel");
View Full Code Here


    public Widget asWidget() {

        LayoutPanel layout = new LayoutPanel();

        ToolStrip topLevelTools = new ToolStrip();
        topLevelTools.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                presenter.launchNewDatasourceWizard();
            }
        }));


        ClickHandler clickHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                final DataSource currentSelection = details.getCurrentSelection();
                if(currentSelection!=null)
                {
                    Feedback.confirm(
                            Console.MESSAGES.deleteTitle("Datasource"),
                            Console.MESSAGES.deleteConfirm("Datasource "+currentSelection.getName()),
                            new Feedback.ConfirmationHandler() {
                                @Override
                                public void onConfirmation(boolean isConfirmed) {
                                    if (isConfirmed) {
                                        presenter.onDelete(currentSelection);
                                    }
                                }
                            });
                }
            }
        };
        ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
        deleteBtn.addClickHandler(clickHandler);
        topLevelTools.addToolButtonRight(deleteBtn);

        // ----

        VerticalPanel vpanel = new VerticalPanel();
        vpanel.setStyleName("rhs-content-panel");

        ScrollPanel scroll = new ScrollPanel(vpanel);
        layout.add(scroll);

        layout.setWidgetTopHeight(scroll, 0, Style.Unit.PX, 100, Style.Unit.PCT);

        // ---

        vpanel.add(new ContentHeaderLabel("JDBC Datasources"));
        vpanel.add(new ContentDescription(Console.CONSTANTS.subsys_jca_dataSources_desc()));

        dataSourceTable = new DatasourceTable();


        vpanel.add(new ContentGroupLabel(Console.MESSAGES.available("Datasources")));
        vpanel.add(topLevelTools.asWidget());
        vpanel.add(dataSourceTable.asWidget());


        // -----------
        details = new DataSourceDetails(presenter);
        details.bind(dataSourceTable.getCellTable());

        SingleSelectionModel<DataSource> selectionModel =
                (SingleSelectionModel<DataSource>)dataSourceTable.getCellTable().getSelectionModel();

        selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler () {
            @Override
            public void onSelectionChange(SelectionChangeEvent event) {
                DataSource selectedObject = ((SingleSelectionModel<DataSource>) dataSourceTable.getCellTable().getSelectionModel()).getSelectedObject();
                presenter.loadPoolConfig(false, selectedObject.getName());
                presenter.onLoadConnectionProperties(selectedObject.getName());

            }
        });

        // -----------------

        TabPanel bottomPanel = new TabPanel();
        bottomPanel.setStyleName("default-tabpanel");

        bottomPanel.add(details.asWidget(), "Attributes");

        // -----------------

        final FormToolStrip.FormCallback<DataSource> formCallback = new FormToolStrip.FormCallback<DataSource>() {
            @Override
            public void onSave(Map<String, Object> changeset) {
                DataSource ds = getCurrentSelection();
                presenter.onSaveDSDetails(ds.getName(), changeset);
            }

            @Override
            public void onDelete(DataSource entity) {
                // n/a
            }
        };

        connectionEditor = new DataSourceConnectionEditor(presenter, formCallback);
        connectionEditor.getForm().bind(dataSourceTable.getCellTable());
        bottomPanel.add(connectionEditor.asWidget(), "Connection");

        securityEditor = new DataSourceSecurityEditor(formCallback);
        securityEditor.getForm().bind(dataSourceTable.getCellTable());
        bottomPanel.add(securityEditor.asWidget(), "Security");

        // -----------------

        connectionProps = new ConnectionProperties(presenter);
        bottomPanel.add(connectionProps.asWidget(), "Properties");

        // -----------------

        poolConfig = new PoolConfigurationView(new PoolManagement() {
            @Override
            public void onSavePoolConfig(String parentName, Map<String, Object> changeset) {
                presenter.onSavePoolConfig(parentName, changeset, false);
            }

            @Override
            public void onResetPoolConfig(String parentName, PoolConfig entity) {
                presenter.onDeletePoolConfig(parentName, entity, false);
            }

            @Override
            public void onDoFlush(String editedName) {
                if(getCurrentSelection().isEnabled())
                    presenter.onDoFlush(false, editedName);
                else
                    Console.error(Console.CONSTANTS.subsys_jca_error_datasource_notenabled());
            }
        });


        bottomPanel.add(poolConfig.asWidget(), "Pool");
        poolConfig.getForm().bind(dataSourceTable.getCellTable());


        // ----

        validationEditor = new DataSourceValidationEditor(formCallback);
        validationEditor.getForm().bind(dataSourceTable.getCellTable());
        bottomPanel.add(validationEditor.asWidget(), "Validation");

        // ----

        timeoutEditor = new DataSourceTimeoutEditor<DataSource>(formCallback, false);
        timeoutEditor.getForm().bind(dataSourceTable.getCellTable());
        bottomPanel.add(timeoutEditor.asWidget(), "Timeouts");

        bottomPanel.selectTab(0);

        // -----------------

        vpanel.add(new ContentGroupLabel(Console.CONSTANTS.common_label_selection()));

        // --
        ClickHandler disableHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                final DataSource selection = getCurrentSelection();
                final boolean nextState = !selection.isEnabled();
                String title = nextState ? Console.MESSAGES.enableConfirm("datasource") : Console.MESSAGES.disableConfirm("datasource");
                String text = nextState ? Console.MESSAGES.enableConfirm("datasource "+selection.getName()) : Console.MESSAGES.disableConfirm("datasource "+selection.getName()) ;
                Feedback.confirm(title, text,
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed) {
                                    presenter.onDisable(selection, nextState);
                                }
                            }
                        });
            }
        };

        disableBtn = new ToolButton(Console.CONSTANTS.common_label_enOrDisable(), disableHandler);
        disableBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_enOrDisable_dataSourceDetails());


        // -----
        // handle modifications to the model

        dataSourceTable.getCellTable().getSelectionModel().addSelectionChangeHandler(
                new SelectionChangeEvent.Handler() {
                    @Override
                    public void onSelectionChange(SelectionChangeEvent event) {
                        String nextState = getCurrentSelection().isEnabled() ? Console.CONSTANTS.common_label_disable():Console.CONSTANTS.common_label_enable();
                        disableBtn.setText(nextState);
                    }
                }) ;


        topLevelTools.addToolButtonRight(disableBtn);


        // --

        vpanel.add(bottomPanel);
View Full Code Here

    public ToolStrip createTools() {
        return createTools(null);
    }

    public ToolStrip createTools(String resourceAddress) {
        final ToolStrip toolStrip = new ToolStrip(resourceAddress);

        if (!hideButtons.contains(FrameworkButton.ADD)) {
            ToolButton addBtn = new ToolButton(Console.CONSTANTS.common_label_add(),
                    new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            window.setNewBean();
                            window.show();
                        }
                    });
            addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_entityEditor());       
            toolStrip.addToolButtonRight(addBtn);
        }

        if (!hideButtons.contains(FrameworkButton.REMOVE)) {
            ToolButton removeBtn=new ToolButton(Console.CONSTANTS.common_label_remove(),
                    new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {

                            String name = Console.CONSTANTS.common_label_item();
                            Feedback.confirm(
                                    Console.MESSAGES.deleteTitle(name),
                                    Console.MESSAGES.deleteConfirm(name),
                                    new Feedback.ConfirmationHandler() {
                                        @Override
                                        public void onConfirmation(boolean isConfirmed) {
                                            if (isConfirmed) {
                                                presenter.getEntityBridge().onRemove(
                                                        ((SingleSelectionModel)table.getSelectionModel()).getSelectedObject()
                                                );
                                            }
                                        }
                                    });
                        }
                    });
            removeBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_remove_entityEditor());
            toolStrip.addToolButtonRight(removeBtn);
        }

        return toolStrip;
    }
View Full Code Here

        this.providesEditSaveOp = b;
    }

    public Widget asWidget() {

        ToolStrip toolStrip = new ToolStrip();
        if (providesEditSaveOp) {
            editBtn = new ToolButton(EDIT_LABEL);
            ClickHandler editHandler = new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {

                    if(null == form.getEditedEntity())
                    {
                        Log.warn("Empty form!");
                        return;
                    }

                    if(State.CLOSE == currentState)
                    {
                        editBtn.setHTML(SAVE_LABEL);
                        currentState = State.OPEN;
                        form.setEnabled(true);
                        cancelBtn.setVisible(true);
                    }
                    else
                    {

                        if(!form.validate().hasErrors())
                        {
                            boolean preValidationIsSuccess = preValidation != null && preValidation.isValid();
                            if(preValidation==null || preValidationIsSuccess)
                            {
                                cancelBtn.setVisible(false);
                                editBtn.setHTML(EDIT_LABEL);
                                currentState = State.CLOSE;
                                form.setEnabled(false);
                                Map<String, Object> changedValues = form.getChangedValues();
                                if(!changedValues.isEmpty())
                                    callback.onSave(changedValues);
                                else
                                    Log.warn("Empty changeset!");
                            }
                        }
                    }

                }
            };
            editBtn.addClickHandler(editHandler);
            toolStrip.addToolButton(editBtn);
        }
        editBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_edit_formToolStrip());

        for(ToolButton btn : additionalButtons)
            toolStrip.addToolButtonRight(btn);

        if(providesDeleteOp)
        {
            ClickHandler clickHandler = new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {

                    if(null == form.getEditedEntity()) return;


                    Feedback.confirm(
                            Console.MESSAGES.deleteTitle(Console.CONSTANTS.common_label_item()),
                            Console.MESSAGES.deleteConfirm(Console.CONSTANTS.common_label_item()),
                            new Feedback.ConfirmationHandler() {
                                @Override
                                public void onConfirmation(boolean isConfirmed) {
                                    if (isConfirmed) {
                                        callback.onDelete(form.getEditedEntity());
                                    }
                                }
                            });
                }
            };

            String title = deleteOpName!=null ? deleteOpName : Console.CONSTANTS.common_label_delete();
            ToolButton deleteBtn = new ToolButton(title);
            deleteBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_delete_formToolStrip());
            deleteBtn.addClickHandler(clickHandler);
            toolStrip.addToolButtonRight(deleteBtn);

        }

        final ClickHandler cancelHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                doCancel();
            }
        };

        cancelBtn = new InlineLink(Console.CONSTANTS.common_label_cancel());
        cancelBtn.addClickHandler(cancelHandler);
        toolStrip.addToolWidget(cancelBtn);

        cancelBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_cancel_formToolStrip());
        cancelBtn.setVisible(false);
        return toolStrip;
    }
View Full Code Here

            }
        };

        table.addColumn(name, "Name");

        ToolStrip tools = new ToolStrip();
        tools.addToolButtonRight(
                new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent clickEvent) {
                        presenter.launchNewAcceptorWizard(type);
                    }
                }));

        tools.addToolButtonRight(
                new ToolButton(Console.CONSTANTS.common_label_remove(), new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent clickEvent) {

                        Feedback.confirm(
View Full Code Here

            }
        };

        table.addColumn(name, "Name");

        ToolStrip tools = new ToolStrip();
        tools.addToolButtonRight(
                new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent clickEvent) {
                        presenter.launchNewConnectorWizard(type);
                    }
                }));

        tools.addToolButtonRight(
                new ToolButton(Console.CONSTANTS.common_label_remove(), new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent clickEvent) {

                        Feedback.confirm(
View Full Code Here

                            groups.setValue(serverGroups);
                        }
                    }
                });

        final ToolStrip toolStrip = new ToolStrip();
        filter = new DeploymentFilter(deploymentData);
        toolStrip.addToolWidget(filter.asWidget());

        ToolButton addContentBtn = new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler()
        {
            @Override
            public void onClick(ClickEvent event)
            {
                presenter.launchNewDeploymentDialoge(null, false);
            }
        });
        addContentBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_addContent_deploymentsOverview());
        toolStrip.addToolButtonRight(addContentBtn);

        toolStrip.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_remove(),
                new ClickHandler()
                {
                    @Override
                    public void onClick(ClickEvent clickEvent)
                    {
                        final DeploymentRecord selection = deploymentSelection.getSelectedObject();
                        if (selection != null)
                        {
                            new DeploymentCommandDelegate(ContentRepositoryPanel.this.presenter,
                                    DeploymentCommand.REMOVE_FROM_DOMAIN).execute(selection);
                        }
                    }
                }));

        toolStrip.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_assign(),
                new ClickHandler()
                {
                    @Override
                    public void onClick(ClickEvent clickEvent)
                    {
                        final DeploymentRecord selection = deploymentSelection.getSelectedObject();
                        if (selection != null)
                        {
                            new DeploymentCommandDelegate(ContentRepositoryPanel.this.presenter,
                                    DeploymentCommand.ADD_TO_GROUP).execute(selection);
                        }
                    }
                }));

        toolStrip.addToolButtonRight(new ToolButton(Console.CONSTANTS.common_label_replace(),
                new ClickHandler()
                {
                    @Override
                    public void onClick(ClickEvent clickEvent)
                    {
View Full Code Here

                    public void onDelete(AddressingPattern entity) {

                    }
                }
        );
        ToolStrip tableTools = new ToolStrip();
        ToolButton addBtn = new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                presenter.launchNewAddrDialogue();
            }
        });
        addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_addressingDetails());
        tableTools.addToolButtonRight(addBtn);

        ToolButton removeBtn = new ToolButton(Console.CONSTANTS.common_label_delete(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                Feedback.confirm(
                        Console.MESSAGES.deleteTitle("Addressing Config"),
                        Console.MESSAGES.deleteConfirm("Addressing Config"),
                        new Feedback.ConfirmationHandler() {
                            @Override
                            public void onConfirmation(boolean isConfirmed) {
                                if (isConfirmed)
                                    presenter.onDeleteAddressDetails(form.getEditedEntity());
                            }
                        });

            }
        });

        tableTools.addToolButtonRight(removeBtn);

        VerticalPanel formPanel = new VerticalPanel();
        formPanel.addStyleName("fill-layout-width");

        formPanel.add(helpPanel.asWidget());
        formPanel.add(formTools.asWidget());
        formPanel.add(form.asWidget());

        serverName = new ContentHeaderLabel();

        MultipleToOneLayout layout = new MultipleToOneLayout()
                .setPlain(true)
                .setHeadlineWidget(serverName)
                .setDescription("An address setting defines the attributes that are applied to any address that matches the address setting's name (that can contain wildcards).")
                .setMaster("Available Address Settings", addrTable)
                .setMasterTools(tableTools.asWidget())
                .setDetail("Details", formPanel);

        return layout.build();

    }
View Full Code Here

                        });
            }
        });
        reloadBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_reload_standaloneServerView());

        ToolStrip tools = new ToolStrip();
        tools.addToolButtonRight(reloadBtn);

        headline = new Label("HEADLINE");

        headline.setStyleName("content-header-label");

        form = new Form<StandaloneServer>(StandaloneServer.class);
        form.setNumColumns(2);

        TextItem codename = new TextItem("releaseCodename", "Code Name");
        TextItem version = new TextItem("releaseVersion", "Version");
        TextItem state = new TextItem("serverState", "Server State");

        form.setFields(codename, version, state);

        // ----

        reloadPanel = new DeckPanel();
        reloadPanel.setStyleName("fill-layout-width");

        // ----

        VerticalPanel configUptodate = new VerticalPanel();
        HorizontalPanel uptodateContent = new HorizontalPanel();
        uptodateContent.setStyleName("status-panel");
        uptodateContent.addStyleName("serverUptoDate");

        Image img = new Image(Icons.INSTANCE.status_good());
        HTML desc = new HTML(Console.CONSTANTS.server_config_uptodate());
        uptodateContent.add(desc);
        uptodateContent.add(img);

        //img.getElement().getParentElement().addClassName("InfoBlock");
        img.getElement().getParentElement().setAttribute("style", "padding:15px;vertical-align:middle;width:20%");
        desc.getElement().getParentElement().setAttribute("style", "padding:15px;vertical-align:middle");

        configUptodate.add(uptodateContent);

        // --

        VerticalPanel configNeedsUpdate = new VerticalPanel();
        configNeedsUpdate.add(tools.asWidget());

        HorizontalPanel staleContent = new HorizontalPanel();
        staleContent.setStyleName("status-panel");
        staleContent.addStyleName("serverNeedsUpdate");
View Full Code Here

                    }
                }
        );

        ToolStrip tableTools = new ToolStrip();
        ToolButton addBtn = new ToolButton(Console.CONSTANTS.common_label_add(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                presenter.launchConnectorDialogue();
            }
        });
        addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_connectorList());
        tableTools.addToolButtonRight(addBtn);


        ToolButton removeBtn = new ToolButton(Console.CONSTANTS.common_label_delete(), new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                final HttpConnector selectedObject = ((SingleSelectionModel<HttpConnector>) connectorTable.getSelectionModel()).getSelectedObject();
                if(selectedObject!=null)
                {
                    Feedback.confirm(
                            Console.MESSAGES.deleteTitle("Connector"),
                            Console.MESSAGES.deleteConfirm("Connector"), new Feedback.ConfirmationHandler()
                    {
                        @Override
                        public void onConfirmation(boolean isConfirmed) {
                            if(isConfirmed)
                                presenter.onDeleteConnector(selectedObject.getName());
                        }
                    });
                }
            }
        });

        tableTools.addToolButtonRight(addBtn);
        tableTools.addToolButtonRight(removeBtn);

        layout.add(tableTools.asWidget());

        // ----


        connectorTable = new DefaultCellTable<HttpConnector>(8, new ProvidesKey<HttpConnector>() {
            @Override
            public Object getKey(HttpConnector item) {
                return item.getName()+"_"+item.getProtocol();
            }
        });
        dataProvider = new ListDataProvider<HttpConnector>();
        dataProvider.addDataDisplay(connectorTable);

        Column<HttpConnector, String> nameColumn = new Column<HttpConnector, String>(new TextCell()) {
            @Override
            public String getValue(HttpConnector object) {
                return object.getName();
            }
        };


        Column<HttpConnector, String> protocolColumn = new Column<HttpConnector, String>(new TextCell()) {
            @Override
            public String getValue(HttpConnector object) {
                return object.getProtocol();
            }
        };


        Column<HttpConnector, ImageResource> statusColumn =
                new Column<HttpConnector, ImageResource>(new ImageResourceCell()) {
                    @Override
                    public ImageResource getValue(HttpConnector connector) {

                        ImageResource res = null;

                        if(connector.isEnabled())
                            res = Icons.INSTANCE.status_good();
                        else
                            res = Icons.INSTANCE.status_bad();

                        return res;
                    }
                };

        connectorTable.addColumn(nameColumn, "Name");
        connectorTable.addColumn(protocolColumn, "Protocol");
        connectorTable.addColumn(statusColumn, "Enabled?");

        layout.add(tableTools.asWidget());
        layout.add(connectorTable);


        // ---
View Full Code Here

TOP

Related Classes of org.jboss.ballroom.client.widgets.tools.ToolStrip

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.