incubator-kalumet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1205585 [14/23] - in /incubator/kalumet/trunk: ./ console/ console/src/main/java/org/apache/kalumet/console/app/ console/src/main/resources/org/apache/kalumet/console/app/templates/
Date Wed, 23 Nov 2011 20:52:25 GMT
Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsQueuesPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsQueuesPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsQueuesPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsQueuesPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,260 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import java.util.Iterator;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Insets;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.TextField;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import org.apache.kalumet.model.JMSQueue;
+
+/**
+ * JMS server queues pane.
+ */
+public class JmsQueuesPane extends ContentPane {
+
+    private JmsServerWindow parent;
+    private Grid grid;
+    private TextField newQueueNameField;
+
+    // delete
+    private ActionListener delete = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the jms queue object
+            final JMSQueue jmsQueue = parent.getJMSServer().getJMSQueue(event.getActionCommand());
+            if (jmsQueue == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsqueue.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // delete the jms queue
+                    parent.getJMSServer().getJMSQueues().remove(jmsQueue);
+                    // add a change event
+                    parent.getEnvironmentWindow().getChangeEvents().add("Delete JMS queue " + jmsQueue.getName());
+                    // change the updated flag
+                    parent.getEnvironmentWindow().setUpdated(true);
+                    // update the whole environnment window
+                    parent.getEnvironmentWindow().update();
+                    // update the pane
+                    update();
+                }
+            }));
+        }
+    };
+    // edit
+    private ActionListener edit = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission
+                    && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the field
+            TextField queueNameField = (TextField) JmsQueuesPane.this.getComponent("queuename_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + parent.getServerName() + "_" + parent.getJMSServerName() + "_"
+                    + event.getActionCommand());
+            // get the field value
+            String queueNameFieldValue = queueNameField.getText();
+            // check field
+            if (queueNameFieldValue == null || queueNameFieldValue.trim().length() < 1) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsqueue.mandatory"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the JMS queue object
+            JMSQueue jmsQueue = parent.getJMSServer().getJMSQueue(event.getActionCommand());
+            if (jmsQueue == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsqueue.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // if the user change the JMS queue name, check if the JMS queue name
+            // doesn't already exist
+            if (!queueNameFieldValue.equals(jmsQueue.getName())) {
+                if (parent.getJMSServer().getJMSQueue(queueNameFieldValue) != null) {
+                    KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsqueue.exists"), getEnvironmentWindow().getEnvironmentName());
+                    return;
+                }
+            }
+            // add a change event
+            parent.getEnvironmentWindow().getChangeEvents().add("Change JMS queue " + jmsQueue.getName());
+            // update the jms queue object
+            jmsQueue.setName(queueNameFieldValue);
+            // change the updated flag
+            parent.getEnvironmentWindow().setUpdated(true);
+            // update the whole parent window
+            parent.getEnvironmentWindow().update();
+            // update the pane
+            update();
+        }
+    };
+    // create
+    private ActionListener create = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the field value
+            String newQueueNameFieldValue = newQueueNameField.getText();
+            // check the field
+            if (newQueueNameFieldValue == null || newQueueNameFieldValue.trim().length() < 1) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsqueue.mandatory"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // create the jms queue object
+            JMSQueue jmsQueue = new JMSQueue();
+            jmsQueue.setName(newQueueNameFieldValue);
+            // add the jms queue in the jms server
+            try {
+                parent.getJMSServer().addJMSQueue(jmsQueue);
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsqueue.exists"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // add a change event
+            parent.getEnvironmentWindow().getChangeEvents().add("Add JMS queue " + jmsQueue.getName());
+            // change the updated flag
+            parent.getEnvironmentWindow().setUpdated(true);
+            // update the whole window
+            parent.getEnvironmentWindow().update();
+            // update the pane
+            update();
+        }
+    };
+
+    /**
+     * Create a new <code>JMSQueuesPane</code>.
+     *
+     * @param parent the parent <code>JmsServerWindow</code>.
+     */
+    public JmsQueuesPane(JmsServerWindow parent) {
+        super();
+        setStyleName("tab.content");
+
+        // update parent
+        this.parent = parent;
+
+        // add queues grid
+        grid = new Grid(2);
+        grid.setStyleName("border.grid");
+        grid.setColumnWidth(0, new Extent(50, Extent.PX));
+        add(grid);
+
+        // update the pane
+        update();
+    }
+
+    /**
+     * Update the pane.
+     */
+    public void update() {
+        // remove queues grid children
+        grid.removeAll();
+        // add queues header
+        Label actionHeader = new Label(" ");
+        actionHeader.setStyleName("grid.header");
+        grid.add(actionHeader);
+        Label nameHeader = new Label(Messages.getString("name"));
+        nameHeader.setStyleName("grid.header");
+        grid.add(nameHeader);
+        // add the queue
+        for (Iterator queueIterator = parent.getJMSServer().getJMSQueues().iterator(); queueIterator.hasNext(); ) {
+            JMSQueue queue = (JMSQueue) queueIterator.next();
+            // row
+            Row row = new Row();
+            row.setCellSpacing(new Extent(2));
+            row.setInsets(new Insets(2));
+            grid.add(row);
+            if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+                // edit
+                Button editButton = new Button(Styles.ACCEPT);
+                editButton.setToolTipText(Messages.getString("apply"));
+                editButton.setActionCommand(queue.getName());
+                editButton.addActionListener(edit);
+                row.add(editButton);
+                // delete
+                Button deleteButton = new Button(Styles.DELETE);
+                deleteButton.setToolTipText(Messages.getString("delete"));
+                deleteButton.setActionCommand(queue.getName());
+                deleteButton.addActionListener(delete);
+                row.add(deleteButton);
+            }
+            // name
+            TextField nameField = new TextField();
+            nameField.setStyleName("default");
+            nameField.setWidth(new Extent(100, Extent.PERCENT));
+            nameField.setId("queuename_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + parent.getServerName() + "_" + parent.getJMSServerName() + "_" + queue.getName());
+            nameField.setText(queue.getName());
+            grid.add(nameField);
+        }
+        if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+            // row
+            Row row = new Row();
+            row.setCellSpacing(new Extent(2));
+            row.setInsets(new Insets(2));
+            grid.add(row);
+            // add
+            Button createButton = new Button(Styles.ADD);
+            createButton.setToolTipText(Messages.getString("add"));
+            createButton.addActionListener(create);
+            row.add(createButton);
+            // name
+            newQueueNameField = new TextField();
+            newQueueNameField.setStyleName("default");
+            newQueueNameField.setWidth(new Extent(100, Extent.PERCENT));
+            grid.add(newQueueNameField);
+        }
+    }
+
+    public EnvironmentWindow getEnvironmentWindow() {
+        return parent.getEnvironmentWindow();
+    }
+
+}
\ No newline at end of file

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerGeneralPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerGeneralPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerGeneralPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerGeneralPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.SelectField;
+import nextapp.echo2.app.TextField;
+
+/**
+ * JMS server general tab <code>ContentPane</code>.
+ */
+public class JmsServerGeneralPane extends ContentPane {
+
+    private JmsServerWindow parent;
+
+    private TextField nameField;
+    private SelectField activeField;
+    private SelectField blockerField;
+
+    /**
+     * Create a new <code>JMSServerGeneralTabPane</code>.
+     *
+     * @param parent the parent <code>JMSServerWindow</code>.
+     */
+    public JmsServerGeneralPane(JmsServerWindow parent) {
+        super();
+        setStyleName("tab.content");
+
+        // update parent
+        this.parent = parent;
+
+        // grid layout
+        Grid layout = new Grid(2);
+        layout.setStyleName("default");
+        layout.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+        layout.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+        add(layout);
+
+        // add name field
+        Label nameLabel = new Label(Messages.getString("name"));
+        nameLabel.setStyleName("grid.cell");
+        layout.add(nameLabel);
+        nameField = new TextField();
+        nameField.setStyleName("default");
+        nameField.setWidth(new Extent(100, Extent.PERCENT));
+        layout.add(nameField);
+
+        // add active field
+        Label activeLabel = new Label(Messages.getString("active"));
+        activeLabel.setStyleName("grid.cell");
+        layout.add(activeLabel);
+        activeField = new SelectField(MainScreen.LABELS);
+        activeField.setSelectedIndex(0);
+        activeField.setStyleName("default");
+        activeField.setWidth(new Extent(10, Extent.EX));
+        layout.add(activeField);
+
+        // add blocker field
+        Label blockerLabel = new Label(Messages.getString("blocker"));
+        blockerLabel.setStyleName("grid.cell");
+        layout.add(blockerLabel);
+        blockerField = new SelectField(MainScreen.LABELS);
+        blockerField.setSelectedIndex(0);
+        blockerField.setStyleName("default");
+        blockerField.setWidth(new Extent(10, Extent.EX));
+        layout.add(blockerField);
+
+        // update the pane
+        update();
+    }
+
+    /**
+     * Update the pane
+     */
+    public void update() {
+        // update the name field
+        nameField.setText(parent.getJMSServer().getName());
+        // update the active field
+        if (parent.getJMSServer().isActive()) {
+            activeField.setSelectedIndex(0);
+        } else {
+            activeField.setSelectedIndex(1);
+        }
+        // update the blocker field
+        if (parent.getJMSServer().isBlocker()) {
+            blockerField.setSelectedIndex(0);
+        } else {
+            blockerField.setSelectedIndex(1);
+        }
+    }
+
+    public TextField getNameField() {
+        return this.nameField;
+    }
+
+    public SelectField getActiveField() {
+        return this.activeField;
+    }
+
+    public SelectField getBlockerField() {
+        return this.blockerField;
+    }
+
+}
\ No newline at end of file

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerWindow.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerWindow.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerWindow.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServerWindow.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,481 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.SplitPane;
+import nextapp.echo2.app.WindowPane;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import nextapp.echo2.extras.app.TabPane;
+import nextapp.echo2.extras.app.layout.TabPaneLayoutData;
+import org.apache.kalumet.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.Agent;
+import org.apache.kalumet.model.JMSServer;
+import org.apache.kalumet.model.Kalumet;
+import org.apache.kalumet.ws.client.JMSServerClient;
+
+/**
+ * JMS server window.
+ */
+public class JmsServerWindow extends WindowPane {
+
+    private String jmsServerName;
+    private String serverName;
+    private JMSServer jmsServer = null;
+    private JmsServersPane parent;
+    private JmsServerGeneralPane generalPane;
+    private JmsQueuesPane jmsQueuesPane;
+    private JmsTopicsPane jmsTopicsPane;
+
+    // status thread
+    class StatusThread extends Thread {
+
+        public boolean ended = false;
+        public boolean failure = false;
+        public String message;
+
+        public void run() {
+            try {
+                // load Kalumet configuration
+                Kalumet kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(parent.getEnvironmentWindow().getEnvironment().getAgent());
+                if (agent == null) {
+                    throw new IllegalArgumentException("agent not found.");
+                }
+                // call the webservice
+                JMSServerClient client = new JMSServerClient(agent.getHostname(), agent.getPort());
+                boolean uptodate = client.check(parent.getEnvironmentWindow().getEnvironmentName(), serverName, jmsServerName);
+                if (uptodate) {
+                    message = "JMS server " + jmsServerName + " is up to date.";
+                } else {
+                    failure = true;
+                    message = "JMS server " + jmsServerName + " is not up to date.";
+                }
+            } catch (Exception e) {
+                failure = true;
+                message = "JMS server " + jmsServerName + " status check failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // update thread
+    class UpdateThread extends Thread {
+
+        public boolean ended = false;
+        public boolean failure = false;
+        public String message;
+
+        public void run() {
+            try {
+                // load Kalumet configuration
+                Kalumet kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(parent.getEnvironmentWindow().getEnvironment().getAgent());
+                if (agent == null) {
+                    throw new IllegalArgumentException("agent not found.");
+                }
+                // call the webservice
+                JMSServerClient client = new JMSServerClient(agent.getHostname(), agent.getPort());
+                client.update(parent.getEnvironmentWindow().getEnvironmentName(), serverName, jmsServerName);
+            } catch (Exception e) {
+                failure = true;
+                message = "JMS server " + jmsServerName + " update failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // close
+    private ActionListener close = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            JmsServerWindow.this.userClose();
+        }
+    };
+    // refresh
+    private ActionListener refresh = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // looking for original JMS server object
+            jmsServer = parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(serverName).getJMSServer(jmsServerName);
+            if (jmsServer == null) {
+                jmsServer = new JMSServer();
+            }
+            // update the window
+            update();
+        }
+    };
+    // delete
+    private ActionListener delete = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // remove the jms server
+                    parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(serverName).getJMSServers().remove(jmsServer);
+                    // add a change event
+                    parent.getEnvironmentWindow().getChangeEvents().add("Delete JMS server " + jmsServer.getName());
+                    // change the updated flag
+                    parent.getEnvironmentWindow().setUpdated(true);
+                    // update the journal log tab pane
+                    parent.getEnvironmentWindow().updateJournalPane();
+                    // update the parent pane
+                    parent.update();
+                    // close the window
+                    JmsServerWindow.this.userClose();
+                }
+            }));
+        }
+    };
+    // apply
+    private ActionListener apply = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get fields value
+            String nameFieldValue = generalPane.getNameField().getText();
+            int activeFieldIndex = generalPane.getActiveField().getSelectedIndex();
+            int blockerFieldIndex = generalPane.getBlockerField().getSelectedIndex();
+            // check name field
+            if (nameFieldValue == null || nameFieldValue.trim().length() < 1) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsserver.mandatory"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // if the user change the JMS server name, check if the JMS server name
+            // doesn't already exist
+            if (jmsServerName == null || (jmsServerName != null && !jmsServerName.equals(nameFieldValue))) {
+                if (parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(serverName).getJMSServer(nameFieldValue) != null) {
+                    KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsserver.exists"), getEnvironmentWindow().getEnvironmentName());
+                    return;
+                }
+            }
+            // add a change event
+            if (jmsServerName != null) {
+                parent.getEnvironmentWindow().getChangeEvents().add("Change JMS server " + jmsServer.getName());
+            }
+            // update the jms server object
+            jmsServer.setName(nameFieldValue);
+            if (activeFieldIndex == 0) {
+                jmsServer.setActive(true);
+            } else {
+                jmsServer.setActive(false);
+            }
+            if (blockerFieldIndex == 0) {
+                jmsServer.setBlocker(true);
+            } else {
+                jmsServer.setBlocker(false);
+            }
+            // add the jms server object if needed
+            if (jmsServerName == null) {
+                try {
+                    parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(serverName).addJMSServer(jmsServer);
+                    parent.getEnvironmentWindow().getChangeEvents().add("Add JMS server (name [ " + nameFieldValue + " ]) in the J2EE application server " + serverName);
+                } catch (Exception e) {
+                    KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsserver.exists"), getEnvironmentWindow().getEnvironmentName());
+                    return;
+                }
+            }
+            // update the window definition
+            setTitle(Messages.getString("jmsserver") + " " + jmsServer.getName());
+            setId("jmsserverwindow_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + serverName + "_" + jmsServer.getName());
+            jmsServerName = jmsServer.getName();
+            // change the updated flag
+            parent.getEnvironmentWindow().setUpdated(true);
+            // update the journal log tab pane
+            parent.getEnvironmentWindow().updateJournalPane();
+            // update the parent tab
+            parent.update();
+            // update the window
+            update();
+        }
+    };
+    // copy
+    private ActionListener copy = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            try {
+                KalumetConsoleApplication.getApplication().setCopyComponent(jmsServer.clone());
+            } catch (Exception e) {
+                return;
+            }
+        }
+    };
+    // paste
+    private ActionListener paste = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the copy is correct
+            Object copy = KalumetConsoleApplication.getApplication().getCopyComponent();
+            if (copy == null || !(copy instanceof JMSServer)) {
+                return;
+            }
+            jmsServer = (JMSServer) copy;
+            jmsServerName = null;
+            // update the parent pane
+            parent.update();
+            // update the window
+            update();
+        }
+    };
+    // status
+    private ActionListener status = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if some change has not yet been saved
+            if (getEnvironmentWindow().isUpdated()) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // add a message in the log pane and the journal
+            KalumetConsoleApplication.getApplication().getLogPane().addInfo("JMS server " + jmsServerName + " status check in progress...", parent.getEnvironmentWindow().getEnvironmentName());
+            parent.getEnvironmentWindow().getChangeEvents().add("JMS server " + jmsServerName + " status check requested.");
+            // start the status thread
+            final StatusThread statusThread = new StatusThread();
+            statusThread.start();
+            // sync with the client
+            KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                public void run() {
+                    if (statusThread.ended) {
+                        if (statusThread.failure) {
+                            KalumetConsoleApplication.getApplication().getLogPane().addWarning(statusThread.message, parent.getEnvironmentWindow().getEnvironmentName());
+                        } else {
+                            KalumetConsoleApplication.getApplication().getLogPane().addInfo(statusThread.message, parent.getEnvironmentWindow().getEnvironmentName());
+                        }
+                        parent.getEnvironmentWindow().getChangeEvents().add(statusThread.message);
+                    } else {
+                        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                    }
+                }
+            });
+        }
+    };
+    // update
+    private ActionListener update = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesUpdatePermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if some change has not been saved
+            if (getEnvironmentWindow().isUpdated()) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // add a message in the log pane and journal
+                    KalumetConsoleApplication.getApplication().getLogPane().addInfo("JMS server " + jmsServerName + " update in progress...", parent.getEnvironmentWindow().getEnvironmentName());
+                    parent.getEnvironmentWindow().getChangeEvents().add("JMS server " + jmsServerName + " update requested.");
+                    // start the update thread
+                    final UpdateThread updateThread = new UpdateThread();
+                    updateThread.start();
+                    // sync with the client
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (updateThread.ended) {
+                                if (updateThread.failure) {
+                                    KalumetConsoleApplication.getApplication().getLogPane().addError(updateThread.message, parent.getEnvironmentWindow().getEnvironmentName());
+                                    parent.getEnvironmentWindow().getChangeEvents().add(updateThread.message);
+                                } else {
+                                    KalumetConsoleApplication.getApplication().getLogPane().addConfirm("JMS server " + jmsServerName + " updated.", parent.getEnvironmentWindow().getEnvironmentName());
+                                    parent.getEnvironmentWindow().getChangeEvents().add("JMS server " + jmsServerName + " updated.");
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+            }));
+        }
+    };
+
+    /**
+     * Create a new <code>JmsServerWindow</code>.
+     *
+     * @param parent                the <code>JmsServersPane</code>.
+     * @param applicationServerName the original J2EE application server name.
+     * @param jmsServerName         the original JMS server name.
+     */
+    public JmsServerWindow(JmsServersPane parent, String applicationServerName, String jmsServerName) {
+        super();
+
+        // update the parent tab pane
+        this.parent = parent;
+
+        // update the application server name and jms server name
+        this.serverName = applicationServerName;
+        this.jmsServerName = jmsServerName;
+
+        // update the jms server object from the parent environment
+        this.jmsServer = parent.getEnvironmentWindow().getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(serverName).getJMSServer(jmsServerName);
+        if (this.jmsServer == null) {
+            this.jmsServer = new JMSServer();
+        }
+
+        if (jmsServerName == null) {
+            setTitle(Messages.getString("jmsserver"));
+        } else {
+            setTitle(Messages.getString("jmsserver") + " " + jmsServerName);
+        }
+        setId("jmsserverwindow_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + serverName + "_" + jmsServerName);
+        setStyleName("default");
+        setWidth(new Extent(600, Extent.PX));
+        setHeight(new Extent(400, Extent.PX));
+        setModal(false);
+        setDefaultCloseOperation(WindowPane.DISPOSE_ON_CLOSE);
+
+        // create a split pane for the control button
+        SplitPane splitPane = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new Extent(32));
+        add(splitPane);
+
+        // add the control pane
+        Row controlRow = new Row();
+        controlRow.setStyleName("control");
+        splitPane.add(controlRow);
+        // add the refresh button
+        Button refreshButton = new Button(Messages.getString("reload"), Styles.DATABASE_REFRESH);
+        refreshButton.setStyleName("control");
+        refreshButton.addActionListener(refresh);
+        controlRow.add(refreshButton);
+        // add the copy button
+        Button copyButton = new Button(Messages.getString("copy"), Styles.PAGE_COPY);
+        copyButton.setStyleName("control");
+        copyButton.addActionListener(copy);
+        controlRow.add(copyButton);
+        if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+            // add the paste button
+            Button pasteButton = new Button(Messages.getString("paste"), Styles.PAGE_PASTE);
+            pasteButton.setStyleName("control");
+            pasteButton.addActionListener(paste);
+            controlRow.add(pasteButton);
+        }
+        // add the status button
+        Button statusButton = new Button(Messages.getString("status"), Styles.INFORMATION);
+        statusButton.setStyleName("status");
+        statusButton.addActionListener(status);
+        controlRow.add(statusButton);
+        if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesUpdatePermission) {
+            // add the update button
+            Button updateButton = new Button(Messages.getString("update"), Styles.COG);
+            updateButton.setStyleName("control");
+            updateButton.addActionListener(update);
+            controlRow.add(updateButton);
+        }
+        if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+            // add the apply button
+            Button applyButton = new Button(Messages.getString("apply"), Styles.ACCEPT);
+            applyButton.setStyleName("control");
+            applyButton.addActionListener(apply);
+            controlRow.add(applyButton);
+            // add the delete button
+            Button deleteButton = new Button(Messages.getString("delete"), Styles.DELETE);
+            deleteButton.setStyleName("control");
+            deleteButton.addActionListener(delete);
+            controlRow.add(deleteButton);
+        }
+        // add the close button
+        Button closeButton = new Button(Messages.getString("close"), Styles.CROSS);
+        closeButton.setStyleName("control");
+        closeButton.addActionListener(close);
+        controlRow.add(closeButton);
+
+        // add the main tab pane
+        TabPane tabPane = new TabPane();
+        tabPane.setStyleName("default");
+        splitPane.add(tabPane);
+
+        // add the jms server general tab
+        TabPaneLayoutData tabLayoutData = new TabPaneLayoutData();
+        tabLayoutData.setTitle(Messages.getString("general"));
+        generalPane = new JmsServerGeneralPane(this);
+        generalPane.setLayoutData(tabLayoutData);
+        tabPane.add(generalPane);
+
+        // add the jms server queues tab
+        tabLayoutData = new TabPaneLayoutData();
+        tabLayoutData.setTitle(Messages.getString("jmsqueues"));
+        jmsQueuesPane = new JmsQueuesPane(this);
+        jmsQueuesPane.setLayoutData(tabLayoutData);
+        tabPane.add(jmsQueuesPane);
+
+        // add the jms server topics tab
+        tabLayoutData = new TabPaneLayoutData();
+        tabLayoutData.setTitle(Messages.getString("jmstopics"));
+        jmsTopicsPane = new JmsTopicsPane(this);
+        jmsTopicsPane.setLayoutData(tabLayoutData);
+        tabPane.add(jmsTopicsPane);
+
+        // update the window
+        update();
+    }
+
+    /**
+     * Update the window.
+     */
+    public void update() {
+        generalPane.update();
+        jmsQueuesPane.update();
+        jmsTopicsPane.update();
+    }
+
+    public JMSServer getJMSServer() {
+        return this.jmsServer;
+    }
+
+    public String getJMSServerName() {
+        return this.jmsServerName;
+    }
+
+    public String getServerName() {
+        return this.serverName;
+    }
+
+    public EnvironmentWindow getEnvironmentWindow() {
+        return parent.getEnvironmentWindow();
+    }
+
+}
\ No newline at end of file

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServersPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServersPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServersPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsServersPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,563 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import java.util.Iterator;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.Column;
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Insets;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.SelectField;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import nextapp.echo2.app.list.DefaultListModel;
+import nextapp.echo2.app.list.ListModel;
+import org.apache.kalumet.console.configuration.ConfigurationManager;
+import org.apache.kalumet.model.*;
+import org.apache.kalumet.ws.client.JMSServerClient;
+
+/**
+ * Environment JMS servers pane.
+ */
+public class JmsServersPane extends ContentPane {
+
+    private EnvironmentWindow parent;
+    private SelectField scopeField;
+    private Grid grid;
+
+    // status thread
+    class StatusThread extends Thread {
+
+        public String serverName;
+        public String jmsServerName;
+        public boolean ended = false;
+        public boolean failure = false;
+        public String message;
+
+        public void run() {
+            try {
+                // load Kalumet configuration
+                Kalumet kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(parent.getEnvironment().getAgent());
+                if (agent == null) {
+                    throw new IllegalArgumentException("agent not found.");
+                }
+                // call the webservice
+                JMSServerClient client = new JMSServerClient(agent.getHostname(), agent.getPort());
+                boolean uptodate = client.check(parent.getEnvironmentName(), serverName, jmsServerName);
+                if (uptodate) {
+                    message = "JMS server " + jmsServerName + " is up to date.";
+                } else {
+                    failure = true;
+                    message = "JMS server " + jmsServerName + " is not up to date.";
+                }
+            } catch (Exception e) {
+                failure = true;
+                message = "JMS server " + jmsServerName + " status check failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // update thread
+    class UpdateThread extends Thread {
+
+        public String serverName;
+        public String jmsServerName;
+        public boolean ended = false;
+        public boolean failure = false;
+        public String message;
+
+        public void run() {
+            try {
+                // load Kalumet configuration
+                Kalumet kalumet = ConfigurationManager.loadStore();
+                // looking for the agent
+                Agent agent = kalumet.getAgent(parent.getEnvironment().getAgent());
+                if (agent == null) {
+                    throw new IllegalArgumentException("agent not found.");
+                }
+                // call the webservice
+                JMSServerClient client = new JMSServerClient(agent.getHostname(), agent.getPort());
+                client.update(parent.getEnvironmentName(), serverName, jmsServerName);
+            } catch (Exception e) {
+                failure = true;
+                message = "JMS server " + jmsServerName + " update failed: " + e.getMessage();
+            } finally {
+                ended = true;
+            }
+        }
+    }
+
+    // scope select
+    private ActionListener scopeSelect = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            update();
+        }
+    };
+    // toggle active
+    private ActionListener toggleActive = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the JMS server object
+            JMSServer jmsServer = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSServer(event.getActionCommand());
+            if (jmsServer == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsserver.warn.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // change the jms server state and add a change event
+            if (jmsServer.isActive()) {
+                jmsServer.setActive(false);
+                parent.getChangeEvents().add("Disable JMS server " + jmsServer.getName());
+            } else {
+                jmsServer.setActive(true);
+                parent.getChangeEvents().add("Enable JMS server " + jmsServer.getName());
+            }
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log tab pane
+            parent.updateJournalPane();
+            // update the pane
+            update();
+        }
+    };
+    // toggle blocker
+    private ActionListener toggleBlocker = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the JMS server object
+            JMSServer jmsServer = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSServer(event.getActionCommand());
+            if (jmsServer == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsserver.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // change the jms server blocker state and add a change event
+            if (jmsServer.isBlocker()) {
+                jmsServer.setBlocker(false);
+                parent.getChangeEvents().add("Set not blocker for JMS server " + jmsServer.getName());
+            } else {
+                jmsServer.setBlocker(true);
+                parent.getChangeEvents().add("Set blocker for JMS server " + jmsServer.getName());
+            }
+            // change the updated flag
+            parent.setUpdated(true);
+            // update the journal log tab pane
+            parent.updateJournalPane();
+            // update the pane
+            update();
+        }
+    };
+    // delete
+    private ActionListener delete = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the jms server object
+            final JMSServer jmsServer = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSServer(event.getActionCommand());
+            if (jmsServer == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmsserver.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // delete the jms server object
+                    parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSServers().remove(jmsServer);
+                    // add a change event
+                    parent.getChangeEvents().add("Delete JMS server " + jmsServer.getName());
+                    // change the updated flag
+                    parent.setUpdated(true);
+                    // update the journal log tab pane
+                    parent.updateJournalPane();
+                    // update the pane
+                    update();
+                }
+            }));
+        }
+    };
+    // edit
+    private ActionListener edit = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            if (KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().getComponent("jmsserverwindow_" + parent.getEnvironmentName() + "_" + (String) scopeField.getSelectedItem() + "_" + event.getActionCommand()) == null) {
+                KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new JmsServerWindow(JmsServersPane.this, (String) scopeField.getSelectedItem(), event.getActionCommand()));
+            }
+        }
+    };
+    // create
+    private ActionListener create = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            ListModel listModel = scopeField.getModel();
+            if (listModel.size() == 0) {
+                return;
+            }
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new JmsServerWindow(JmsServersPane.this, (String) scopeField.getSelectedItem(), null));
+        }
+    };
+    // copy
+    private ActionListener copy = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // looking for the jms server object
+            JMSServer jmsServer = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer((String) scopeField.getSelectedItem()).getJMSServer(event.getActionCommand());
+            if (jmsServer == null) {
+                return;
+            }
+            try {
+                KalumetConsoleApplication.getApplication().setCopyComponent(jmsServer.clone());
+            } catch (Exception e) {
+                return;
+            }
+        }
+    };
+    // status
+    private ActionListener status = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if some change has not yet been saved
+            if (getEnvironmentWindow().isUpdated()) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the JEE server and JMS server name
+            final String serverName = (String) scopeField.getSelectedItem();
+            final String jmsServerName = event.getActionCommand();
+            // add a message in the log pane and the journal
+            KalumetConsoleApplication.getApplication().getLogPane().addInfo("JMS server " + jmsServerName + " status check in progress...", parent.getEnvironmentName());
+            parent.getChangeEvents().add("JMS server " + jmsServerName + " status check requested.");
+            // start the status thread
+            final StatusThread statusThread = new StatusThread();
+            statusThread.serverName = serverName;
+            statusThread.jmsServerName = jmsServerName;
+            statusThread.start();
+            // sync with the client
+            KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                public void run() {
+                    if (statusThread.ended) {
+                        if (statusThread.failure) {
+                            KalumetConsoleApplication.getApplication().getLogPane().addWarning(statusThread.message, parent.getEnvironmentName());
+                        } else {
+                            KalumetConsoleApplication.getApplication().getLogPane().addInfo(statusThread.message, parent.getEnvironmentName());
+                        }
+                        parent.getChangeEvents().add(statusThread.message);
+                    } else {
+                        KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                    }
+                }
+            });
+        }
+    };
+    // update
+    private ActionListener update = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesUpdatePermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if some change has not been saved
+            if (getEnvironmentWindow().isUpdated()) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.notsaved"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the JEE server and JMS server name
+            final String serverName = (String) scopeField.getSelectedItem();
+            final String jmsServerName = event.getActionCommand();
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // add a message in the log pane and the journal
+                    KalumetConsoleApplication.getApplication().getLogPane().addInfo("JMS server " + jmsServerName + " update in progress...", parent.getEnvironmentName());
+                    parent.getChangeEvents().add("JMS server " + jmsServerName + " update requested.");
+                    // start the update thread
+                    final UpdateThread updateThread = new UpdateThread();
+                    updateThread.serverName = serverName;
+                    updateThread.jmsServerName = jmsServerName;
+                    updateThread.start();
+                    // sync with the client
+                    KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), new Runnable() {
+                        public void run() {
+                            if (updateThread.ended) {
+                                if (updateThread.failure) {
+                                    KalumetConsoleApplication.getApplication().getLogPane().addError(updateThread.message, parent.getEnvironmentName());
+                                    parent.getChangeEvents().add(updateThread.message);
+                                } else {
+                                    KalumetConsoleApplication.getApplication().getLogPane().addConfirm("JMS server " + jmsServerName + " updated.", parent.getEnvironmentName());
+                                    parent.getChangeEvents().add("JMS server " + jmsServerName + " updated.");
+                                }
+                            } else {
+                                KalumetConsoleApplication.getApplication().enqueueTask(KalumetConsoleApplication.getApplication().getTaskQueue(), this);
+                            }
+                        }
+                    });
+                }
+            }));
+        }
+    };
+
+    /**
+     * Create a new <code>JmsServersPane</code>.
+     *
+     * @param parent the parent <code>EnvironmentWindow</code>.
+     */
+    public JmsServersPane(EnvironmentWindow parent) {
+        super();
+        setStyleName("tab.content");
+
+        // update parent
+        this.parent = parent;
+
+        // column layout
+        Column content = new Column();
+        content.setCellSpacing(new Extent(2));
+        add(content);
+
+        // add the scope select field
+        Grid layoutGrid = new Grid(2);
+        layoutGrid.setStyleName("default");
+        layoutGrid.setColumnWidth(0, new Extent(20, Extent.PERCENT));
+        layoutGrid.setColumnWidth(1, new Extent(80, Extent.PERCENT));
+        content.add(layoutGrid);
+        Label scopeLabel = new Label(Messages.getString("scope"));
+        scopeLabel.setStyleName("default");
+        layoutGrid.add(scopeLabel);
+        scopeField = new SelectField();
+        scopeField.addActionListener(scopeSelect);
+        scopeField.setStyleName("default");
+        layoutGrid.add(scopeField);
+        // populate the scope field
+        DefaultListModel scopeModel = (DefaultListModel) scopeField.getModel();
+        scopeModel.removeAll();
+        for (Iterator serversIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServers().iterator(); serversIterator.hasNext(); ) {
+            J2EEApplicationServer server = (J2EEApplicationServer) serversIterator.next();
+            scopeModel.add(server.getName());
+        }
+        if (scopeModel.size() > 0) {
+            scopeField.setSelectedIndex(0);
+        }
+
+        // add the create button
+        if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+            Button createButton = new Button(Messages.getString("jmsserver.add"), Styles.ADD);
+            createButton.setStyleName("default");
+            createButton.addActionListener(create);
+            content.add(createButton);
+        }
+
+        // add JMS servers grid
+        grid = new Grid(4);
+        grid.setStyleName("border.grid");
+        grid.setColumnWidth(0, new Extent(50, Extent.PX));
+        grid.setColumnWidth(1, new Extent(33, Extent.PERCENT));
+        grid.setColumnWidth(2, new Extent(33, Extent.PERCENT));
+        grid.setColumnWidth(3, new Extent(33, Extent.PERCENT));
+        content.add(grid);
+
+        // update the pane
+        update();
+    }
+
+    /**
+     * Update the pane
+     */
+    public void update() {
+        String applicationServerName = null;
+        // update the scope field
+        DefaultListModel scopeListModel = (DefaultListModel) scopeField.getModel();
+        if (scopeListModel.size() > 0) {
+            applicationServerName = (String) scopeField.getSelectedItem();
+        }
+        scopeListModel.removeAll();
+        int scopeIndex = 0;
+        int found = -1;
+        for (Iterator applicationServerIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServers().iterator(); applicationServerIterator.hasNext(); ) {
+            J2EEApplicationServer applicationServer = (J2EEApplicationServer) applicationServerIterator.next();
+            scopeListModel.add(applicationServer.getName());
+            if (applicationServer.getName().equals(applicationServerName)) {
+                found = scopeIndex;
+            }
+            scopeIndex++;
+        }
+
+        // remove all JMS servers grid children
+        grid.removeAll();
+
+        // check if at least one application server is present
+        if (scopeListModel.size() < 1) {
+            return;
+        }
+        // update the scope field selected index
+        if (found == -1) {
+            scopeField.setSelectedIndex(0);
+        } else {
+            scopeField.setSelectedIndex(found);
+        }
+        // update the application server name from the scope (in case of
+        // application server deletion)
+        applicationServerName = (String) scopeField.getSelectedItem();
+
+        // add JMS servers grid header
+        Label actionHeader = new Label(" ");
+        actionHeader.setStyleName("grid.header");
+        grid.add(actionHeader);
+        Label nameHeader = new Label(Messages.getString("name"));
+        nameHeader.setStyleName("grid.header");
+        grid.add(nameHeader);
+        Label queuesHeader = new Label(Messages.getString("jmsqueues"));
+        queuesHeader.setStyleName("grid.header");
+        grid.add(queuesHeader);
+        Label topicsHeader = new Label(Messages.getString("jmstopics"));
+        topicsHeader.setStyleName("grid.header");
+        grid.add(topicsHeader);
+        // add the jms servers
+        for (Iterator jmsServerIterator = parent.getEnvironment().getJ2EEApplicationServers().getJ2EEApplicationServer(applicationServerName).getJMSServers().iterator(); jmsServerIterator.hasNext(); ) {
+            JMSServer jmsServer = (JMSServer) jmsServerIterator.next();
+            // row
+            Row row = new Row();
+            row.setInsets(new Insets(2));
+            row.setCellSpacing(new Extent(2));
+            grid.add(row);
+            // copy
+            Button copyButton = new Button(Styles.PAGE_COPY);
+            copyButton.setToolTipText(Messages.getString("copy"));
+            copyButton.setActionCommand(jmsServer.getName());
+            copyButton.addActionListener(copy);
+            row.add(copyButton);
+            // active
+            Button activeButton;
+            if (jmsServer.isActive()) {
+                activeButton = new Button(Styles.LIGHTBULB);
+                activeButton.setToolTipText(Messages.getString("switch.disable"));
+            } else {
+                activeButton = new Button(Styles.LIGHTBULB_OFF);
+                activeButton.setToolTipText(Messages.getString("switch.enable"));
+            }
+            if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+                activeButton.setActionCommand(jmsServer.getName());
+                activeButton.addActionListener(toggleActive);
+            }
+            row.add(activeButton);
+            // blocker
+            Button blockerButton;
+            if (jmsServer.isBlocker()) {
+                blockerButton = new Button(Styles.PLUGIN);
+                blockerButton.setToolTipText(Messages.getString("switch.notblocker"));
+            } else {
+                blockerButton = new Button(Styles.PLUGIN_DISABLED);
+                blockerButton.setToolTipText(Messages.getString("switch.blocker"));
+            }
+            if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+                blockerButton.setActionCommand(jmsServer.getName());
+                blockerButton.addActionListener(toggleBlocker);
+            }
+            row.add(blockerButton);
+            // status
+            Button statusButton = new Button(Styles.INFORMATION);
+            statusButton.setToolTipText(Messages.getString("status"));
+            statusButton.setActionCommand(jmsServer.getName());
+            statusButton.addActionListener(status);
+            row.add(statusButton);
+            if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesUpdatePermission) {
+                // update
+                Button updateButton = new Button(Styles.COG);
+                updateButton.setToolTipText(Messages.getString("update"));
+                updateButton.setActionCommand(jmsServer.getName());
+                updateButton.addActionListener(update);
+                row.add(updateButton);
+            }
+            if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+                // delete
+                Button deleteButton = new Button(Styles.DELETE);
+                deleteButton.setToolTipText(Messages.getString("delete"));
+                deleteButton.setActionCommand(jmsServer.getName());
+                deleteButton.addActionListener(delete);
+                row.add(deleteButton);
+            }
+            // name
+            Button jmsServerName = new Button(jmsServer.getName());
+            jmsServerName.setActionCommand(jmsServer.getName());
+            jmsServerName.addActionListener(edit);
+            jmsServerName.setStyleName("default");
+            grid.add(jmsServerName);
+            // queues
+            Column queuesColumn = new Column();
+            grid.add(queuesColumn);
+            for (Iterator queueIterator = jmsServer.getJMSQueues().iterator(); queueIterator.hasNext(); ) {
+                JMSQueue queue = (JMSQueue) queueIterator.next();
+                Label queueName = new Label(queue.getName());
+                queueName.setStyleName("default");
+                queuesColumn.add(queueName);
+            }
+            // topics
+            Column topicsColumn = new Column();
+            grid.add(topicsColumn);
+            for (Iterator topicIterator = jmsServer.getJMSTopics().iterator(); topicIterator.hasNext(); ) {
+                JMSTopic topic = (JMSTopic) topicIterator.next();
+                Label topicName = new Label(topic.getName());
+                topicName.setStyleName("default");
+                topicsColumn.add(topicName);
+            }
+        }
+    }
+
+    /**
+     * Return the parent <code>EnvironmentWindow</code>.
+     *
+     * @return the parent <code>EnvironmentWindow</code>.
+     */
+    public EnvironmentWindow getEnvironmentWindow() {
+        return parent;
+    }
+
+}
\ No newline at end of file

Added: incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsTopicsPane.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsTopicsPane.java?rev=1205585&view=auto
==============================================================================
--- incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsTopicsPane.java (added)
+++ incubator/kalumet/trunk/console/src/main/java/org/apache/kalumet/console/app/JmsTopicsPane.java Wed Nov 23 20:52:16 2011
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.kalumet.console.app;
+
+import java.util.Iterator;
+
+import nextapp.echo2.app.Button;
+import nextapp.echo2.app.ContentPane;
+import nextapp.echo2.app.Extent;
+import nextapp.echo2.app.Grid;
+import nextapp.echo2.app.Insets;
+import nextapp.echo2.app.Label;
+import nextapp.echo2.app.Row;
+import nextapp.echo2.app.TextField;
+import nextapp.echo2.app.event.ActionEvent;
+import nextapp.echo2.app.event.ActionListener;
+import org.apache.kalumet.model.JMSTopic;
+
+/**
+ * JMS topics pane.
+ */
+public class JmsTopicsPane extends ContentPane {
+
+    private JmsServerWindow parent;
+    private Grid grid;
+    private TextField newTopicNameField;
+
+    // delete
+    private ActionListener delete = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the jms topic object
+            final JMSTopic jmsTopic = parent.getJMSServer().getJMSTopic(event.getActionCommand());
+            if (jmsTopic == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmstopic.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // display confirm window
+            KalumetConsoleApplication.getApplication().getDefaultWindow().getContent().add(new ConfirmWindow(new ActionListener() {
+                public void actionPerformed(ActionEvent event) {
+                    // delete the jms topic
+                    parent.getJMSServer().getJMSTopics().remove(jmsTopic);
+                    // add a change event
+                    parent.getEnvironmentWindow().getChangeEvents().add("Delete JMS topic " + jmsTopic.getName());
+                    // change the updated flag
+                    parent.getEnvironmentWindow().setUpdated(true);
+                    // update the whole environment window
+                    parent.getEnvironmentWindow().update();
+                    // update the pane
+                    update();
+                }
+            }));
+        }
+    };
+    // edit
+    private ActionListener edit = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("action.restricted"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the field
+            TextField topicNameField = (TextField) JmsTopicsPane.this.getComponent("jmsTopicNameField_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + parent.getServerName() + "_" + parent.getJMSServerName() + "_"
+                    + event.getActionCommand());
+            // get the field value
+            String topicNameFieldValue = topicNameField.getText();
+            // check field
+            if (topicNameFieldValue == null || topicNameFieldValue.trim().length() < 1) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmstopic.mandatory"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // looking for the JMS topic object
+            JMSTopic jmsTopic = parent.getJMSServer().getJMSTopic(event.getActionCommand());
+            if (jmsTopic == null) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmstopic.notfound"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // if the user change the JMS topic name, check if the JMS topic name
+            // doesn't already exist
+            if (!topicNameFieldValue.equals(jmsTopic.getName())) {
+                if (parent.getJMSServer().getJMSTopic(topicNameFieldValue) != null) {
+                    KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmstopic.exists"), getEnvironmentWindow().getEnvironmentName());
+                    return;
+                }
+            }
+            // add a change event
+            parent.getEnvironmentWindow().getChangeEvents().add("Change JMS topic " + jmsTopic.getName());
+            // update the jms topic object
+            jmsTopic.setName(topicNameFieldValue);
+            // change the updated flag
+            parent.getEnvironmentWindow().setUpdated(true);
+            // update the whole parent window
+            parent.getEnvironmentWindow().update();
+            // update the pane
+            update();
+        }
+    };
+    // create
+    private ActionListener create = new ActionListener() {
+        public void actionPerformed(ActionEvent event) {
+            // check if the user has the environment lock
+            if (!getEnvironmentWindow().getEnvironment().getLock().equals(KalumetConsoleApplication.getApplication().getUserid())) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // check if the user can do it
+            if (!getEnvironmentWindow().adminPermission && !getEnvironmentWindow().jeeResourcesPermission) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("environment.locked"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // get the field value
+            String newTopicNameFieldValue = newTopicNameField.getText();
+            // check the field
+            if (newTopicNameFieldValue == null || newTopicNameFieldValue.trim().length() < 1) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmstopic.mandatory"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // create the jms topic object
+            JMSTopic jmsTopic = new JMSTopic();
+            jmsTopic.setName(newTopicNameFieldValue);
+            // add the jms topic in the jms server
+            try {
+                parent.getJMSServer().addJMSTopic(jmsTopic);
+            } catch (Exception e) {
+                KalumetConsoleApplication.getApplication().getLogPane().addWarning(Messages.getString("jmstopic.exists"), getEnvironmentWindow().getEnvironmentName());
+                return;
+            }
+            // add a change event
+            parent.getEnvironmentWindow().getChangeEvents().add("Add JMS topic " + jmsTopic.getName());
+            // change the updated flag
+            parent.getEnvironmentWindow().setUpdated(true);
+            // update the whole window
+            parent.getEnvironmentWindow().update();
+            // update the pane
+            update();
+        }
+    };
+
+    /**
+     * Create a new <code>JmsTopicsPane</code>.
+     *
+     * @param parent the parent <code>JmsServerWindow</code>.
+     */
+    public JmsTopicsPane(JmsServerWindow parent) {
+        super();
+        setStyleName("tab.content");
+
+        // update parent
+        this.parent = parent;
+
+        // add topics grid
+        grid = new Grid(2);
+        grid.setStyleName("border.grid");
+        grid.setColumnWidth(0, new Extent(50, Extent.PX));
+        add(grid);
+
+        // update the pane
+        update();
+    }
+
+    /**
+     * Update the pane.
+     */
+    public void update() {
+        // remove topics grid children
+        grid.removeAll();
+        // add topics header
+        Label actionHeader = new Label(" ");
+        actionHeader.setStyleName("grid.header");
+        grid.add(actionHeader);
+        Label nameHeader = new Label(Messages.getString("name"));
+        nameHeader.setStyleName("grid.header");
+        grid.add(nameHeader);
+        // add topic
+        for (Iterator topicIterator = parent.getJMSServer().getJMSTopics().iterator(); topicIterator.hasNext(); ) {
+            JMSTopic topic = (JMSTopic) topicIterator.next();
+            // row
+            Row row = new Row();
+            row.setCellSpacing(new Extent(2));
+            row.setInsets(new Insets(2));
+            grid.add(row);
+            if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+                // add edit button
+                Button editButton = new Button(Styles.ACCEPT);
+                editButton.setToolTipText(Messages.getString("apply"));
+                editButton.setActionCommand(topic.getName());
+                editButton.addActionListener(edit);
+                row.add(editButton);
+                // delete 
+                Button deleteButton = new Button(Styles.DELETE);
+                deleteButton.setToolTipText(Messages.getString("delete"));
+                deleteButton.setActionCommand(topic.getName());
+                deleteButton.addActionListener(delete);
+                row.add(deleteButton);
+            }
+            // name
+            TextField nameField = new TextField();
+            nameField.setStyleName("default");
+            nameField.setWidth(new Extent(100, Extent.PERCENT));
+            nameField.setId("topicname_" + parent.getEnvironmentWindow().getEnvironmentName() + "_" + parent.getServerName() + "_" + parent.getJMSServerName() + "_" + topic.getName());
+            nameField.setText(topic.getName());
+            grid.add(nameField);
+        }
+        if (getEnvironmentWindow().adminPermission || getEnvironmentWindow().jeeResourcesPermission) {
+            // row
+            Row row = new Row();
+            row.setCellSpacing(new Extent(2));
+            row.setInsets(new Insets(2));
+            grid.add(row);
+            // add
+            Button addButton = new Button(Styles.ADD);
+            addButton.setToolTipText(Messages.getString("add"));
+            addButton.addActionListener(create);
+            row.add(addButton);
+            // name
+            newTopicNameField = new TextField();
+            newTopicNameField.setStyleName("default");
+            newTopicNameField.setWidth(new Extent(100, Extent.PERCENT));
+            grid.add(newTopicNameField);
+        }
+    }
+
+    public EnvironmentWindow getEnvironmentWindow() {
+        return parent.getEnvironmentWindow();
+    }
+
+}
\ No newline at end of file



Mime
View raw message