Package org.jboss.as.console.client.shared.subsys.jca.model

Examples of org.jboss.as.console.client.shared.subsys.jca.model.ConnectionDefinition


                    // connection definition
                    if (raModel.hasDefined("connection-definitions")) {
                        List<Property> connections = raModel.get("connection-definitions").asPropertyList();
                        for (final Property con : connections) {
                            ModelNode connectionModel = con.getValue();
                            ConnectionDefinition connectionDefinition = connectionAdapter
                                    .with(new KeyAssignment() {
                                        @Override
                                        public Object valueForKey(String key) {
                                            return con.getName();
                                        }
                                    })
                                    .fromDMR(connectionModel);

                            // config properties
                            List<PropertyRecord> connectionProps = parseConfigProperties(connectionModel);
                            connectionDefinition.setProperties(connectionProps);

                            // pool
                            PoolConfig poolConfig = poolAdapter.with(new KeyAssignment() {
                                @Override
                                public Object valueForKey(String key) {
                                    //return connectionModel.get("");
                                    return "";
                                }
                            }).fromDMR(connectionModel);
                            connectionDefinition.setPoolConfig(poolConfig);

                            resourceAdapter.getConnectionDefinitions().add(connectionDefinition);

                        }
View Full Code Here


                    {
                        List<Property> connections = raModel.get("connection-definitions").asPropertyList();
                        for(final Property con : connections )
                        {
                            ModelNode connectionModel = con.getValue();
                            ConnectionDefinition connectionDefinition = connectionAdapter
                                    .with(new KeyAssignment() {
                                        @Override
                                        public Object valueForKey(String key) {
                                            return con.getName();
                                        }
                                    })
                                    .fromDMR(connectionModel);

                            // config properties
                            List<PropertyRecord> connectionProps = parseConfigProperties(connectionModel);
                            connectionDefinition.setProperties(connectionProps);

                            // pool
                            PoolConfig poolConfig = poolAdapter.with(new KeyAssignment() {
                                @Override
                                public Object valueForKey(String key) {
                                    //return connectionModel.get("");
                                    return "";
                                }
                            }).fromDMR(connectionModel);
                            connectionDefinition.setPoolConfig(poolConfig);

                            resourceAdapter.getConnectionDefinitions().add(connectionDefinition);

                        }
View Full Code Here

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

                final ConnectionDefinition selection = getCurrentSelection();

                if(selection!=null)
                {
                    Feedback.confirm(
                            Console.MESSAGES.deleteTitle("Connection Definition"),
                            Console.MESSAGES.deleteConfirm("Connection Definition"+selection.getName()),
                            new Feedback.ConfirmationHandler() {
                                @Override
                                public void onConfirmation(boolean isConfirmed) {
                                    if (isConfirmed) {
                                        presenter.onDeleteConnection(selection);
                                    }
                                }
                            });
                }
            }
        };
        ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
        deleteBtn.addClickHandler(clickHandler);
        topLevelTools.addToolButtonRight(deleteBtn);


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

                final ConnectionDefinition selection = getCurrentSelection();
                if(selection!=null)
                {

                    selection.setEnabled(!selection.isEnabled());

                    Feedback.confirm(
                            Console.MESSAGES.modify("Connection Definition"),
                            Console.MESSAGES.modifyConfirm("Connection Definition " + selection.getName()),
                            new Feedback.ConfirmationHandler() {
                                @Override
                                public void onConfirmation(boolean isConfirmed) {
                                    if (isConfirmed) {
                                        presenter.enOrDisbaleConnection(currentAdapter, selection);
                                    }
                                }
                            });
                }

            }
        });
        topLevelTools.addToolButtonRight(disableBtn);

        // -------

        table = new DefaultCellTable<ConnectionDefinition>(10,
                new ProvidesKey<ConnectionDefinition>() {
                    @Override
                    public Object getKey(ConnectionDefinition item) {
                        return item.getName();
                    }
                });

        dataProvider = new ListDataProvider<ConnectionDefinition>();
        dataProvider.addDataDisplay(table);

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

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

                        ImageResource res = null;

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

                        return res;
                    }
                };


        table.addColumn(nameColumn, "Name");
        table.addColumn(statusColumn, "Enabled?");


        table.setSelectionModel(new SingleSelectionModel<ConnectionDefinition>());


        // -------


        connectionDetails = new AdapterConnectionDetails(presenter);

        // ---

        securityConfig = new AdapterSecurity(presenter);

        // ---

        validationConfig = new AdapterValidation(presenter);

        // ---

        connectionProperties = new AdapterConnectionProperties(presenter, this);

        // ---

        final SingleSelectionModel<ConnectionDefinition> selectionModel = (SingleSelectionModel<ConnectionDefinition>)table.getSelectionModel();

        poolConfig = new PoolConfigurationView(this);

        selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler () {
            @Override
            public void onSelectionChange(SelectionChangeEvent event) {
                ConnectionDefinition selectedObject = getCurrentSelection();

                connectionProperties.updateFrom(selectedObject.getProperties());
                poolConfig.updateFrom(selectedObject.getName(), selectedObject.getPoolConfig());

                String nextState = selectedObject.isEnabled() ?
                        Console.CONSTANTS.common_label_disable():Console.CONSTANTS.common_label_enable();
                disableBtn.setText(nextState);

            }
        });
View Full Code Here

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

                final ConnectionDefinition selection = getCurrentSelection();

                if(selection!=null)
                {
                    Feedback.confirm(
                            Console.MESSAGES.deleteTitle("Connection Definition"),
                            Console.MESSAGES.deleteConfirm("Connection Definition"+selection.getName()),
                            new Feedback.ConfirmationHandler() {
                                @Override
                                public void onConfirmation(boolean isConfirmed) {
                                    if (isConfirmed) {
                                        presenter.onDeleteConnection(selection);
                                    }
                                }
                            });
                }
            }
        };
        ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
        deleteBtn.addClickHandler(clickHandler);
        topLevelTools.addToolButtonRight(deleteBtn);


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

                final ConnectionDefinition selection = getCurrentSelection();
                if(selection!=null)
                {

                    selection.setEnabled(!selection.isEnabled());

                    Feedback.confirm(
                            Console.MESSAGES.modify("Connection Definition"),
                            Console.MESSAGES.modifyConfirm("Connection Definition " + selection.getName()),
                            new Feedback.ConfirmationHandler() {
                                @Override
                                public void onConfirmation(boolean isConfirmed) {
                                    if (isConfirmed) {
                                        presenter.enOrDisbaleConnection(selection);
                                    }
                                }
                            });
                }

            }
        });
        topLevelTools.addToolButtonRight(disableBtn);

        // -------

        table = new DefaultCellTable<ConnectionDefinition>(10,
                new ProvidesKey<ConnectionDefinition>() {
                    @Override
                    public Object getKey(ConnectionDefinition item) {
                        return item.getName();
                    }
                });

        dataProvider = new ListDataProvider<ConnectionDefinition>();
        dataProvider.addDataDisplay(table);

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

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

                        ImageResource res = null;

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

                        return res;
                    }
                };


        table.addColumn(nameColumn, "Name");
        table.addColumn(statusColumn, "Enabled?");


        table.setSelectionModel(new SingleSelectionModel<ConnectionDefinition>());


        // -------


        connectionDetails = new AdapterConnectionDetails(presenter);

        // ---

        securityConfig = new AdapterSecurity(presenter);

        // ---

        validationConfig = new AdapterValidation(presenter);

        // ---

        connectionProperties = new AdapterConnectionProperties(presenter, this);

        // ---

        final SingleSelectionModel<ConnectionDefinition> selectionModel = (SingleSelectionModel<ConnectionDefinition>)table.getSelectionModel();

        poolConfig = new PoolConfigurationView(this);

        selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler () {
            @Override
            public void onSelectionChange(SelectionChangeEvent event) {
                ConnectionDefinition selectedObject = getCurrentSelection();

                connectionProperties.updateFrom(selectedObject.getProperties());
                poolConfig.updateFrom(selectedObject.getName(), selectedObject.getPoolConfig());

                String nextState = selectedObject.isEnabled() ?
                        Console.CONSTANTS.common_label_disable():Console.CONSTANTS.common_label_enable();
                disableBtn.setText(nextState);

            }
        });
View Full Code Here

                    // connection definition
                    if (raModel.hasDefined("connection-definitions")) {
                        List<Property> connections = raModel.get("connection-definitions").asPropertyList();
                        for (final Property con : connections) {
                            ModelNode connectionModel = con.getValue();
                            ConnectionDefinition connectionDefinition = connectionAdapter
                                    .with(new KeyAssignment() {
                                        @Override
                                        public Object valueForKey(String key) {
                                            return con.getName();
                                        }
                                    })
                                    .fromDMR(connectionModel);

                            // config properties
                            List<PropertyRecord> connectionProps = parseConfigProperties(connectionModel);
                            connectionDefinition.setProperties(connectionProps);

                            // pool
                            PoolConfig poolConfig = poolAdapter.with(new KeyAssignment() {
                                @Override
                                public Object valueForKey(String key) {
                                    //return connectionModel.get("");
                                    return "";
                                }
                            }).fromDMR(connectionModel);
                            connectionDefinition.setPoolConfig(poolConfig);

                            resourceAdapter.getConnectionDefinitions().add(connectionDefinition);

                        }
View Full Code Here

                    @Override
                    public void onClick(ClickEvent event) {
                        FormValidation validation = form.validate();
                        if(!validation.hasErrors())
                        {
                            ConnectionDefinition connectionDef = form.getUpdatedEntity();
                            connectionDef.setApplication(true); // JBPAPP-9977: reasonable default
                            parent.onCompleteStep1(connectionDef);
                        }
                    }
                },
View Full Code Here

TOP

Related Classes of org.jboss.as.console.client.shared.subsys.jca.model.ConnectionDefinition

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.